00001 #include "CParsedFile.h"
00002 #include "Else.h"
00003
00004 namespace xi {
00005
00006 ElseConstruct::ElseConstruct(SdagConstruct* body)
00007 : BlockConstruct(SELSE, 0, 0, 0, 0, 0, body, 0) {
00008 label_str = "else";
00009 }
00010
00011 void ElseConstruct::generateCode(XStr& decls, XStr& defs, Entry* entry) {
00012 strcpy(nameStr, label->charstar());
00013 generateClosureSignature(decls, defs, entry, false, "void", label, false, encapState);
00014 #if CMK_BIGSIM_CHARM
00015
00016 generateBeginTime(defs);
00017 generateEventBracket(defs, SELSE);
00018 #endif
00019 defs << " ";
00020 generateCall(defs, encapStateChild, encapStateChild, constructs->front()->label);
00021 endMethod(defs);
00022
00023
00024 sprintf(nameStr, "%s%s", CParsedFile::className->charstar(), label->charstar());
00025 strcat(nameStr, "_end");
00026 generateClosureSignature(decls, defs, entry, false, "void", label, true,
00027 encapStateChild);
00028 #if CMK_BIGSIM_CHARM
00029 generateBeginTime(defs);
00030 generateEventBracket(defs, SELSE_END);
00031 #endif
00032 defs << " ";
00033 generateCall(defs, encapState, encapState, next->label, nextBeginOrEnd ? 0 : "_end");
00034 endMethod(defs);
00035
00036 generateChildrenCode(decls, defs, entry);
00037 }
00038
00039 void ElseConstruct::numberNodes(void) {
00040 nodeNum = numElses++;
00041 SdagConstruct::numberNodes();
00042 }
00043
00044 }