00001 #include "SList.h"
00002
00003 namespace xi {
00004
00005 SListConstruct::SListConstruct(SdagConstruct* single_construct)
00006 : SdagConstruct(SSLIST, single_construct) {
00007 label_str = "slist";
00008 }
00009
00010 SListConstruct::SListConstruct(SdagConstruct* single_construct, SListConstruct* tail)
00011 : SdagConstruct(SSLIST, single_construct, tail) {
00012 label_str = "slist";
00013 }
00014
00015 void SListConstruct::generateCode(XStr& decls, XStr& defs, Entry* entry) {
00016 buildTypes(encapState);
00017 buildTypes(encapStateChild);
00018
00019 generateClosureSignature(decls, defs, entry, false, "void", label, false, encapState);
00020 defs << " ";
00021 generateCall(defs, encapState, encapState, constructs->front()->label);
00022 endMethod(defs);
00023
00024 generateClosureSignature(decls, defs, entry, false, "void", label, true,
00025 encapStateChild);
00026 defs << " ";
00027 generateCall(defs, encapState, encapStateChild, next->label,
00028 nextBeginOrEnd ? 0 : "_end");
00029 endMethod(defs);
00030
00031 generateChildrenCode(decls, defs, entry);
00032 }
00033
00034 void SListConstruct::numberNodes() {
00035 nodeNum = numSlists++;
00036 SdagConstruct::numberNodes();
00037 }
00038
00039 void SListConstruct::propagateState(std::list<EncapState*> encap,
00040 std::list<CStateVar*>& plist,
00041 std::list<CStateVar*>& wlist, int uniqueVarNum) {
00042 stateVars = new std::list<CStateVar*>();
00043 stateVars->insert(stateVars->end(), plist.begin(), plist.end());
00044 stateVarsChildren = stateVars;
00045
00046 encapState = encap;
00047 encapStateChild = encap;
00048
00049 propagateStateToChildren(encap, *stateVarsChildren, wlist, uniqueVarNum);
00050 }
00051
00052 }