From 2a1799bb9588e17e78c0f181c0bbdc46102c8366 Mon Sep 17 00:00:00 2001 From: Galin Simeonov Date: Thu, 15 Jul 2021 17:32:45 +0300 Subject: various fixes on ast_to_c --- src/backend/targets/C/ast_to_c.c | 6 ++++-- 1 file 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_machinenumber_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"); -- cgit v1.2.3