equal
deleted
inserted
replaced
697 |
697 |
698 /* first and only parameter is a pointer to the data */ |
698 /* first and only parameter is a pointer to the data */ |
699 symbol->fblock_name->accept(*this); |
699 symbol->fblock_name->accept(*this); |
700 s4o.print(" *"); |
700 s4o.print(" *"); |
701 s4o.print(FB_FUNCTION_PARAM); |
701 s4o.print(FB_FUNCTION_PARAM); |
702 s4o.print(") {\n"); |
702 s4o.print(", BOOL retain) {\n"); |
703 s4o.indent_right(); |
703 s4o.indent_right(); |
704 |
704 |
705 /* (B.2) Member initializations... */ |
705 /* (B.2) Member initializations... */ |
706 s4o.print(s4o.indent_spaces); |
706 s4o.print(s4o.indent_spaces); |
707 vardecl = new generate_c_vardecl_c(&s4o, |
707 vardecl = new generate_c_vardecl_c(&s4o, |
885 |
885 |
886 /* first and only parameter is a pointer to the data */ |
886 /* first and only parameter is a pointer to the data */ |
887 symbol->program_type_name->accept(*this); |
887 symbol->program_type_name->accept(*this); |
888 s4o.print(" *"); |
888 s4o.print(" *"); |
889 s4o.print(FB_FUNCTION_PARAM); |
889 s4o.print(FB_FUNCTION_PARAM); |
890 s4o.print(") {\n"); |
890 s4o.print(", BOOL retain) {\n"); |
891 s4o.indent_right(); |
891 s4o.indent_right(); |
892 |
892 |
893 /* (B.2) Member initializations... */ |
893 /* (B.2) Member initializations... */ |
894 s4o.print(s4o.indent_spaces); |
894 s4o.print(s4o.indent_spaces); |
895 vardecl = new generate_c_vardecl_c(&s4o, |
895 vardecl = new generate_c_vardecl_c(&s4o, |
1200 send_at |
1200 send_at |
1201 } assigntype_t; |
1201 } assigntype_t; |
1202 |
1202 |
1203 assigntype_t wanted_assigntype; |
1203 assigntype_t wanted_assigntype; |
1204 |
1204 |
|
1205 /* the qualifier of variables that need to be processed... */ |
|
1206 static const unsigned int none_vq = 0x0000; |
|
1207 static const unsigned int constant_vq = 0x0001; // CONSTANT |
|
1208 static const unsigned int retain_vq = 0x0002; // RETAIN |
|
1209 static const unsigned int non_retain_vq = 0x0004; // NON_RETAIN |
|
1210 |
|
1211 /* variable used to store the qualifier of program currently being processed... */ |
|
1212 unsigned int current_varqualifier; |
|
1213 |
|
1214 void *print_retain(void) { |
|
1215 s4o.print(","); |
|
1216 switch (current_varqualifier) { |
|
1217 case retain_vq: |
|
1218 s4o.print("1"); |
|
1219 break; |
|
1220 case non_retain_vq: |
|
1221 s4o.print("0"); |
|
1222 break; |
|
1223 default: |
|
1224 s4o.print("retain"); |
|
1225 break; |
|
1226 } |
|
1227 return NULL; |
|
1228 } |
|
1229 |
|
1230 /******************************************/ |
|
1231 /* B 1.4.3 - Declaration & Initialisation */ |
|
1232 /******************************************/ |
|
1233 |
|
1234 void *visit(constant_option_c *symbol) { |
|
1235 current_varqualifier = constant_vq; |
|
1236 return NULL; |
|
1237 } |
|
1238 |
|
1239 void *visit(retain_option_c *symbol) { |
|
1240 current_varqualifier = retain_vq; |
|
1241 return NULL; |
|
1242 } |
|
1243 |
|
1244 void *visit(non_retain_option_c *symbol) { |
|
1245 current_varqualifier = non_retain_vq; |
|
1246 return NULL; |
|
1247 } |
|
1248 |
1205 /********************************/ |
1249 /********************************/ |
1206 /* B 1.7 Configuration elements */ |
1250 /* B 1.7 Configuration elements */ |
1207 /********************************/ |
1251 /********************************/ |
1208 |
1252 |
1209 /* |
1253 /* |
1279 s4o.print("void "); |
1323 s4o.print("void "); |
1280 current_resource_name->accept(*this); |
1324 current_resource_name->accept(*this); |
1281 s4o.print(FB_INIT_SUFFIX); |
1325 s4o.print(FB_INIT_SUFFIX); |
1282 s4o.print("(void) {\n"); |
1326 s4o.print("(void) {\n"); |
1283 s4o.indent_right(); |
1327 s4o.indent_right(); |
|
1328 s4o.print(s4o.indent_spaces); |
|
1329 s4o.print("BOOL retain = 0;\n"); |
1284 |
1330 |
1285 /* (B.2) Global variables initialisations... */ |
1331 /* (B.2) Global variables initialisations... */ |
1286 if (current_global_vars != NULL) { |
1332 if (current_global_vars != NULL) { |
1287 s4o.print(s4o.indent_spaces); |
1333 s4o.print(s4o.indent_spaces); |
1288 vardecl = new generate_c_vardecl_c(&s4o, |
1334 vardecl = new generate_c_vardecl_c(&s4o, |
1348 s4o.print("__"); |
1394 s4o.print("__"); |
1349 symbol->program_name->accept(*this); |
1395 symbol->program_name->accept(*this); |
1350 s4o.print("\n"); |
1396 s4o.print("\n"); |
1351 break; |
1397 break; |
1352 case init_dt: |
1398 case init_dt: |
|
1399 if (symbol->retain_option != NULL) |
|
1400 symbol->retain_option->accept(*this); |
1353 s4o.print(s4o.indent_spaces); |
1401 s4o.print(s4o.indent_spaces); |
1354 symbol->program_type_name->accept(*this); |
1402 symbol->program_type_name->accept(*this); |
1355 s4o.print(FB_INIT_SUFFIX); |
1403 s4o.print(FB_INIT_SUFFIX); |
1356 s4o.print("(&"); |
1404 s4o.print("(&"); |
1357 symbol->program_name->accept(*this); |
1405 symbol->program_name->accept(*this); |
|
1406 print_retain(); |
1358 s4o.print(");\n"); |
1407 s4o.print(");\n"); |
1359 break; |
1408 break; |
1360 case run_dt: |
1409 case run_dt: |
1361 current_program_name = ((identifier_c*)(symbol->program_name))->value; |
1410 current_program_name = ((identifier_c*)(symbol->program_name))->value; |
1362 if (symbol->task_name != NULL) { |
1411 if (symbol->task_name != NULL) { |