| 35 | |
| 36 | |
| 37 | void IfThenElseAction::generate(const ActionParametersBlock& apb, unsigned ident) |
| 38 | { |
| 39 | switch(apb.language) |
| 40 | { |
| 41 | case LANGUAGE_C: |
| 42 | case LANGUAGE_CPP: |
| 43 | identify(apb, ident); |
| 44 | fprintf(apb.out, "if (%s) {\n", exprIf->generate(apb.language, apb.prefix).c_str()); |
| 45 | actThen->generate(apb, ident + 1); |
| 46 | identify(apb, ident); |
| 47 | fprintf(apb.out, "}\n"); |
| 48 | if (actElse) |
| 49 | { |
| 50 | identify(apb, ident); |
| 51 | fprintf(apb.out, "else {\n"); |
| 52 | actElse->generate(apb, ident + 1); |
| 53 | identify(apb, ident); |
| 54 | fprintf(apb.out, "}\n"); |
| 55 | } |
| 56 | break; |
| 57 | |
| 58 | case LANGUAGE_PASCAL: |
| 59 | identify(apb, ident); |
| 60 | fprintf(apb.out, "if %s then begin\n", exprIf->generate(apb.language, apb.prefix).c_str()); |
| 61 | actThen->generate(apb, ident + 1); |
| 62 | identify(apb, ident); |
| 63 | fprintf(apb.out, "end\n"); |
| 64 | if (actElse) |
| 65 | { |
| 66 | identify(apb, ident); |
| 67 | fprintf(apb.out, "else begin\n"); |
| 68 | actElse->generate(apb, ident + 1); |
| 69 | identify(apb, ident); |
| 70 | fprintf(apb.out, "end\n"); |
| 71 | } |
| 72 | break; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | |
| 77 | void CallAction::generate(const ActionParametersBlock& apb, unsigned ident) |