--- a/stage1_2/iec_flex.ll Sun Oct 21 16:55:08 2012 +0200
+++ b/stage1_2/iec_flex.ll Mon Oct 22 17:44:40 2012 +0200
@@ -513,7 +513,7 @@
/* Any other pragma... */
-pragma "{"[^}]*"}"
+pragma "{"[^}]*"}"|"{{"([^}]|"}"[^}])*"}}"
/* NOTE: this seemingly unnecessary complex definition is required
* to be able to eat up comments such as:
@@ -849,8 +849,9 @@
/* Any other pragma we find, we just pass it up to the syntax parser... */
/* Note that the <body_state> state is exclusive, so we have to include it here too. */
{pragma} {/* return the pragmma without the enclosing '{' and '}' */
- yytext[strlen(yytext)-1] = '\0';
- yylval.ID=strdup(yytext+1);
+ uint cut = yytext[1]=='{'?2:1;
+ yytext[strlen(yytext)-cut] = '\0';
+ yylval.ID=strdup(yytext+cut);
return pragma_token;
}
<body_state>{pragma} {/* return the pragmma without the enclosing '{' and '}' */
--- a/stage4/generate_c/generate_c.cc Sun Oct 21 16:55:08 2012 +0200
+++ b/stage4/generate_c/generate_c.cc Mon Oct 22 17:44:40 2012 +0200
@@ -1022,8 +1022,7 @@
* To work around this we introduce the useless goto.
*/
s4o.print("\n");
- s4o.print(s4o.indent_spaces);
- s4o.print("/* to humour the compiler, we insert a goto */\n");
+ /* to humour the compiler, we insert a goto */
s4o.print(s4o.indent_spaces);
s4o.print("goto ");
s4o.print(END_LABEL);
--- a/stage4/generate_c/generate_c_base.cc Sun Oct 21 16:55:08 2012 +0200
+++ b/stage4/generate_c/generate_c_base.cc Mon Oct 22 17:44:40 2012 +0200
@@ -260,7 +260,19 @@
void *visit(disable_code_generation_pragma_c * symbol) {s4o.disable_output(); return NULL;}
/* Do not use print_token() as it will change everything into uppercase */
- void *visit(pragma_c *symbol) {return s4o.print(symbol->value);}
+ void *visit(pragma_c *symbol) {
+ s4o.print(s4o.indent_spaces);
+ s4o.print("#define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)\n");
+ s4o.print(s4o.indent_spaces);
+ s4o.print("#define SetFbVar(var,val,...) __SET_VAR(data__->,var,val,__VA_ARGS__)\n");
+ s4o.print(symbol->value);
+ s4o.print("\n");
+ s4o.print(s4o.indent_spaces);
+ s4o.print("#undef GetFbVar\n");
+ s4o.print(s4o.indent_spaces);
+ s4o.print("#undef SetFbVar\n");
+ return NULL;
+ }
/***************************/