aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index b9d64a7..2166ff5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -53,9 +53,9 @@ static void usage() {
}
int main(int argc, char **argv) {
- int result;
- size_t filesize;
char *file_content;
+ size_t filesize;
+ TslProgram program;
if(argc != 2) {
usage();
@@ -65,7 +65,15 @@ int main(int argc, char **argv) {
file_content = file_get_content(argv[1], &filesize);
if(!file_content)
return 1;
- result = tsl_parse(file_content, filesize);
- free(file_content); /* Not needed, but it make valgrind happy */
- return result;
+
+ tsl_program_init(&program);
+ if(!tsl_parse(file_content, filesize, &program))
+ return 2;
+
+ if(!tsl_program_run(&program))
+ return 3;
+
+ free(file_content);
+ tsl_program_deinit(&program);
+ return 0;
}