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