From 3877ff9860d2cbeda7127d932e45573ff0d9600b Mon Sep 17 00:00:00 2001 From: Galin Simeonov Date: Wed, 14 Jul 2021 00:23:47 +0300 Subject: added context support --- src/program/program.c | 16 ++++++++++++++++ src/program/program.h | 1 + 2 files changed, 17 insertions(+) (limited to 'src/program') diff --git a/src/program/program.c b/src/program/program.c index 09650ec..a5226dc 100644 --- a/src/program/program.c +++ b/src/program/program.c @@ -51,6 +51,7 @@ struct Options* parse_command_line(int argc,char **argv) ret->providing_own_queue_implementation=0; ret->providing_own_buffer_implementation=0; ret->has_mutex=0; + ret->has_context=0; /*inline is the default*/ for(i=0;iproviding_own_buffer_implementation=1; else if(!strncmp(argv[i],"--extern-mutex",sizeof("--extern-mutex"))) ret->has_mutex=1; + else if(!strncmp(argv[i],"--with-context",sizeof("--extern-mutex"))) + ret->has_context=1; + else if(!strncmp(argv[i],"--help",sizeof("--help")) || !strncmp(argv[i],"-h",sizeof("-h"))) + { + printf("Wonky automata options:\n" + "--print-tokens Prints the tokens of the programs, used for debugging\n" + "--print-ast Prints the ast of the program, used for debugging\n" + "--print-c Transpiles to C and outputs the result to stdout ( default )\n" + "--extern-queue delegates the queue implementation to user\n" + "--extern-buffer delegates the buffer implementation to the user\n" + "--extern-mutex delegates the mutex implementation to the user and generates mutex guards\n" + "--with-context have a context struct, so you can have multiple instances of the automata\n" + "\n"); + exit(0); + } else if(!strncmp(argv[i],"-o",sizeof("-o")) || !strncmp(argv[i],"--output",sizeof("--output"))) { if(++i