EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: msi and scoping
From: Benjamin Franksen <[email protected]>
To: [email protected]
Date: Mon, 6 Sep 2010 14:29:43 +0200
As I discovered today, msi does not handle scoping as I thought it would 
(and think it should). What msi (both msi-1.5 and my extended version) does 
is to open a scope for each

  file <filename> { }

block. But *not* for each instance inside such a block, i.e. in

  file xyz {
    { X=1, Y=a }
    { X=2 }
  }

in the second substitution instance  Y=a  is still defined.

This is easily fixed by moving the calls to macPushScope and macPopScope 
inside the inner while loop. The following patch is relative to my latest 
version:

diff -rN -u old-msi/msi.c new-msi/msi.c
--- old-msi/msi.c       2010-09-06 13:53:50.687470977 +0200
+++ new-msi/msi.c       2010-09-06 13:53:50.687470977 +0200
@@ -125,12 +125,12 @@
                    fprintf(stderr,"no template file\n");
                    usageExit();
                 }
-                if (optScoped) macPushScope(macPvt);
                while((pval = substituteGetReplacements(substitutePvt))){
+                    if (optScoped) macPushScope(macPvt);
                    addMacroReplacements(macPvt,pval);
                    makeSubstitutions(inputPvt,macPvt,filename);
+                    if (optScoped) macPopScope(macPvt);
                }
-                if (optScoped) macPopScope(macPvt);
             }
         } while (isGlobal || isFile);
         substituteDestruct(substitutePvt);


while this one is relative to msi-1.5:

diff -rN -u old-1-5/msi.c new-1-5/msi.c
--- old-1-5/msi.c       2010-09-06 13:59:11.819132417 +0200
+++ new-1-5/msi.c       2010-09-06 13:59:11.827129619 +0200
@@ -113,12 +113,12 @@
                fprintf(stderr,"no template file\n");
                usageExit();
             }
-            macPushScope(macPvt);
            while((pval = substituteGetReplacements(substitutePvt))){
+                macPushScope(macPvt);
                addMacroReplacements(macPvt,pval);
                makeSubstitutions(inputPvt,macPvt,filename);
+                macPopScope(macPvt);
            }
-            macPopScope(macPvt);
         }
         substituteDestruct(substitutePvt);
     }


Cheers
Ben

Navigate by Date:
Prev: Build IOC linking external *.lib file failed zhangning2095
Next: RE: Camera Link drivers for areaDetector? fajin.yuan
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Build IOC linking external *.lib file failed Mark Rivers
Next: Examples of synApps scaler record using asyn port driver Angus Gratton
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 09 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·