diff options
author | Galin Simeonov <gts@volconst.com> | 2021-07-15 17:32:45 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-07-15 18:07:29 +0300 |
commit | 2a1799bb9588e17e78c0f181c0bbdc46102c8366 (patch) | |
tree | 2edf8030a10e81b2377dfbf12248b9a15ae58c18 | |
parent | fbb038282af00eb09bc5a8ef7a0e7a7b76998683 (diff) | |
download | MEGATRON-2a1799bb9588e17e78c0f181c0bbdc46102c8366.tar.gz |
various fixes on ast_to_c
-rw-r--r-- | src/backend/targets/C/ast_to_c.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/targets/C/ast_to_c.c b/src/backend/targets/C/ast_to_c.c index cd01e67..0a7a40c 100644 --- a/src/backend/targets/C/ast_to_c.c +++ b/src/backend/targets/C/ast_to_c.c @@ -123,7 +123,7 @@ void ast_translation_unit_to_c_print_external_part(FILE *out,char *base_name,str } if(options->providing_own_buffer_implementation) { - fprintf(out, "extern machine_buffer_t* get_machine_buffer(void *content,size_t size);\n"); + fprintf(out, "//extern machine_buffer_t* get_machine_buffer(void *content,size_t size);\n"); fprintf(out, "\nextern void delete_machine_buffer(machine_buffer_t *buffer);\n"); } if(options->has_mutex) @@ -374,7 +374,7 @@ void ast_to_c_print_internal_stuff_for_header(FILE *out,struct AST_Translation_U if(options->providing_own_buffer_implementation) { - fprintf(out,"typedef struct machine_buffer_t machine_buffer_t\t\n"); + fprintf(out,"typedef struct machine_buffer_t machine_buffer_t;\n"); }else { ast_print_machine_buffer_declarations(out); @@ -435,6 +435,7 @@ void ast_to_c_print_internal_stuff_for_body(FILE *out,struct AST_Translation_Uni context_arrow="context->"; global=""; fprintf(out, "void machine_context_init(machine_context_t *context)\n{\n\tcontext->machine_queue=(struct machine_queue_t){ .first=NULL,.last=NULL,.size=0};\n"); + fprintf(out, "\tcontext->machine_states_lock=0;\n"); for(which_machine=0;which_machine<translation_unit->number_of_machines;++which_machine) { fprintf(out,"\tcontext->machine_states[%zu]=",which_machine); @@ -672,6 +673,7 @@ void ast_print_machine_buffer_declarations(FILE *out) "\tit COPIES the contents of content \n" "\tsize is in bytes" ); + fprintf(out,"extern machine_buffer_t* get_machine_buffer(void *content,size_t size);\n\n"); ast_to_c_print_comment(out,"\tfrees the buffer from the heap"); fprintf(out,"extern void delete_machine_buffer(machine_buffer_t *buffer);\n\n"); |