aboutsummaryrefslogtreecommitdiffstats
path: root/src/backend/targets/C/ast_to_c.c
diff options
context:
space:
mode:
authorGalin Simeonov <gts@volconst.com>2021-07-14 01:43:40 +0300
committerGalin Simeonov <gts@volconst.com>2021-07-15 18:07:29 +0300
commitfbb038282af00eb09bc5a8ef7a0e7a7b76998683 (patch)
treef36565027c4da5edd5c03b53a78db4998b5cfb7c /src/backend/targets/C/ast_to_c.c
parent3877ff9860d2cbeda7127d932e45573ff0d9600b (diff)
downloadMEGATRON-fbb038282af00eb09bc5a8ef7a0e7a7b76998683.tar.gz
added ability to attach statements to entry and exit of a given state
Diffstat (limited to 'src/backend/targets/C/ast_to_c.c')
-rw-r--r--src/backend/targets/C/ast_to_c.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/targets/C/ast_to_c.c b/src/backend/targets/C/ast_to_c.c
index 9b8f95c..cd01e67 100644
--- a/src/backend/targets/C/ast_to_c.c
+++ b/src/backend/targets/C/ast_to_c.c
@@ -209,7 +209,9 @@ void ast_transitions_of_state_to_c(FILE *out,struct AST_Machine *machine,struct
if(vector->number_of_transitions>0)
{
- fprintf(out,"\n\t%smachine_states_lock=1;\n",context_arrow);
+ fprintf(out,"\n\t%smachine_states_lock=1;\n\n",context_arrow);
+ ast_statement_to_c(out,1,vector->state->on_exit_statement,options);
+ fprintf(out,"\n");
fprintf(out,"\tswitch(event)\n\t{\n");
for(i=0;i<vector->number_of_transitions;++i)
{
@@ -227,6 +229,7 @@ void ast_transitions_of_state_to_c(FILE *out,struct AST_Machine *machine,struct
//ast_pipeline_to_c(out,3,vector->transitions[i]->pipeline);
ast_statement_to_c(out,indentation,vector->transitions[i]->statement,options);
+ ast_statement_to_c(out,indentation,vector->transitions[i]->to->on_entry_statement,options);
ast_to_c_print_tabs(out,indentation);
fprintf(out,"%smachine_states[",context_arrow);
ast_token_to_c(out,machine->id);