diff options
author | Galin Simeonov <gts@volconst.com> | 2021-07-14 00:23:47 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-07-15 18:07:29 +0300 |
commit | 3877ff9860d2cbeda7127d932e45573ff0d9600b (patch) | |
tree | 26d827da8cf07003530a812a22c143baa6f3e757 /src/program | |
parent | c875f8795586056a676e8a643a44211041ce44d2 (diff) | |
download | MEGATRON-3877ff9860d2cbeda7127d932e45573ff0d9600b.tar.gz |
added context support
Diffstat (limited to 'src/program')
-rw-r--r-- | src/program/program.c | 16 | ||||
-rw-r--r-- | src/program/program.h | 1 |
2 files changed, 17 insertions, 0 deletions
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;i<argc;++i) { @@ -66,6 +67,21 @@ struct Options* parse_command_line(int argc,char **argv) ret->providing_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<argc) diff --git a/src/program/program.h b/src/program/program.h index 214e812..370cac6 100644 --- a/src/program/program.h +++ b/src/program/program.h @@ -36,6 +36,7 @@ struct Options int providing_own_queue_implementation:1; int providing_own_buffer_implementation:1; int has_mutex:1; + int has_context:1; char *src_name; char *output_name; }; |