charmxi: convert Entry::stateVars from TList to std::list
authorPhil Miller <mille121@illinois.edu>
Fri, 5 Oct 2012 02:43:44 +0000 (21:43 -0500)
committerPhil Miller <mille121@illinois.edu>
Fri, 5 Oct 2012 02:43:44 +0000 (21:43 -0500)
src/xlat-i/sdag/CSdagConstruct.C
src/xlat-i/xi-symbol.h

index c2e9abd2c90883cdb892814c067abfd7482ac779..cc24bcfd547f9056e4a82fa9062e2368594edb9f 100644 (file)
@@ -443,7 +443,6 @@ void WhenConstruct::propagateState(list<CStateVar*>& plist, list<CStateVar*>& wl
   ParamList *pl;
   while (el != NULL) {
     pl = el->entry->param;
-    el->entry->stateVars = new TList<CStateVar*>();
     if (pl->isVoid()) {
       sv = new CStateVar(1, NULL, 0, NULL, 0, NULL, 0);
       //stateVars->push_back(sv);
@@ -462,7 +461,6 @@ void WhenConstruct::propagateState(list<CStateVar*>& plist, list<CStateVar*>& wl
       }
     }
     el = el->next;
-
   }
 
   propagateStateToChildren(*stateVarsChildren, whensEntryMethodStateVars, publist, uniqueVarNum);
@@ -675,11 +673,12 @@ void WhenConstruct::generateCode(XStr& decls, XStr& defs, Entry* entry)
                         e->getEntryName() << "_msg;\n";
     }
     else {
-        for(sv=e->stateVars->begin(); !e->stateVars->end(); e->stateVars->next()) {
-          defs << "    CMsgBuffer *"<<sv->name<<"_buf;\n";
-          defs << "    " << sv->type << " " <<
-                          sv->name << ";\n";
-        } 
+      for (list<CStateVar*>::iterator it = e->stateVars.begin(); it != e->stateVars.end();
+           ++it) {
+        sv = *it;
+        defs << "    CMsgBuffer *" << sv->name << "_buf;\n"
+             << "    " << sv->type << " " << sv->name << ";\n";
+      }
     }
     el = el->next;
   }
@@ -711,8 +710,8 @@ void WhenConstruct::generateCode(XStr& decls, XStr& defs, Entry* entry)
         defs << "(" << e->getEntryName() << "_buf != 0)";
      }
      else {
-        sv = e->stateVars->begin();
-        defs << "(" << sv->name << "_buf != 0)";
+       sv = *(e->stateVars.begin());
+       defs << "(" << sv->name << "_buf != 0)";
      }
      el = el->next;
      if (el != NULL)
@@ -765,7 +764,9 @@ void WhenConstruct::generateCode(XStr& decls, XStr& defs, Entry* entry)
         defs <<"       PUP::fromMem " <<e->getEntryName() <<"_implP("
           <<e->getEntryName() <<"_impl_buf);\n";
 
-        for(sv=e->stateVars->begin(); !e->stateVars->end(); sv=e->stateVars->next()) {
+        for (list<CStateVar*>::iterator it = e->stateVars.begin(); it != e->stateVars.end();
+             ++it) {
+        CStateVar *sv = *it;
            if (sv->arrayLength != NULL)
               defs <<"       int impl_off_"<<sv->name
                 <<"; "<<e->getEntryName() <<"_implP|impl_off_"
@@ -777,7 +778,9 @@ void WhenConstruct::generateCode(XStr& decls, XStr& defs, Entry* entry)
        }
         defs << "       " <<e->getEntryName() <<"_impl_buf+=CK_ALIGN("
           <<e->getEntryName() <<"_implP.size(),16);\n";
-        for(sv=e->stateVars->begin(); !e->stateVars->end(); sv=e->stateVars->next()) {
+        for (list<CStateVar*>::iterator it = e->stateVars.begin(); it != e->stateVars.end();
+             ++it) {
+          CStateVar *sv = *it;
            if (sv->arrayLength != NULL)
               defs << "       "<<sv->type<< " *" <<sv->name <<"=(" <<sv->type
                 <<" *)(" <<e->getEntryName() <<"_impl_buf+" <<"impl_off_"
@@ -788,7 +791,7 @@ void WhenConstruct::generateCode(XStr& decls, XStr& defs, Entry* entry)
         defs << "       delete " << e->getEntryName() << "_buf;\n";
      }
      else {  // There was a message as the only parameter
-        sv = e->stateVars->begin();
+        sv = *e->stateVars.begin();
         defs << "       " << sv->name << " = (" <<
               sv->type << ") " <<
               sv->name << "_buf->msg;\n";
@@ -987,7 +990,7 @@ void WhenConstruct::generateCode(XStr& decls, XStr& defs, Entry* entry)
   while (el) {
     e = el->entry;
     if (e->param->isMessage() == 1) {
-      sv = e->stateVars->begin();
+      sv = *e->stateVars.begin();
       defs << "    CmiFree(UsrToEnv(" << sv->name << "));\n";
     }
 
index 0d0e27731c8db0a86ff4e14d06ccb146c9353a4f..ba7de85caa2612ed5ba415b5ce47459d63aeb9f9 100644 (file)
@@ -979,8 +979,6 @@ class Entry : public Member {
 
     // SDAG support
     std::list<CStateVar *> estateVars;
-    TList<CStateVar *> *stateVarsChildren;
-
 
   public:
     XStr *label;
@@ -989,7 +987,7 @@ class Entry : public Member {
 
     // SDAG support
     SdagConstruct *sdagCon;
-    TList<CStateVar *> *stateVars;
+    std::list<CStateVar *> stateVars;
     CEntry *entryPtr;
     const char *intExpr;
     ParamList *param;
@@ -999,7 +997,7 @@ class Entry : public Member {
 
     void addEStateVar(CStateVar *sv) {
       estateVars.push_back(sv);
-      stateVars->append(sv);
+      stateVars.push_back(sv);
     }
 
     // DMK - Accel Support