Skip to content

Commit

Permalink
Add basic cairo_run skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta committed Jul 27, 2023
1 parent 81eb091 commit 8f8d65e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/cairo_run.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "cairo_run.h"
#include "parser.h"
#include <stdlib.h>

ResultCairoRun cairo_run(char *program_file_name) {
Program *program = parse_json_filename(program_file_name);
free(program);
ResultCairoRun ok = {.is_error = false, .error_message = ""};
return ok;
}
7 changes: 7 additions & 0 deletions src/cairo_run.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdbool.h>
typedef struct ResultCairoRun {
bool is_error;
char *error_message;
} ResultCairoRun;

ResultCairoRun cairo_run(char *program_file_name);
9 changes: 6 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "decoder.h"
#include "utils.h"
#include "cairo_run.h"
#include <stdio.h>

int main(int argc, char **argv) {
Expand All @@ -9,6 +8,10 @@ int main(int argc, char **argv) {
}
char * program_file_name = argv[1];
printf("Running program: %s\n", program_file_name);

ResultCairoRun result = cairo_run(program_file_name);
if (result.is_error) {
printf("Error: %s\n", result.error_message);
}
printf("Run succesful\n");
return 0;
}

0 comments on commit 8f8d65e

Please sign in to comment.