polish `GCA' macro

checked for object file invariance
This commit is contained in:
rlar 2013-07-14 15:05:00 +02:00
parent d52c9e401a
commit 1b3e77ca32
5 changed files with 27 additions and 22 deletions

View File

@ -22,9 +22,14 @@ Copyright 1990 Regents of the University of California. All rights reserved.
/* and one for calling more General functions that still return an
* error code as above
*/
#define GCA(func,args)\
error=func args;\
if(error)current->error = INPerrCat(current->error,INPerror(error));
#define GCA(func, args) \
do { \
error = func args; \
if (error) \
current->error = INPerrCat(current->error, INPerror(error)); \
} while(0)
/* and one for putting our own error messages onto the current
* line's error string

View File

@ -58,7 +58,7 @@ dot_noise(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
INPgetNetTok(&line, &nname1, 0);
INPtermInsert(ckt, &nname1, tab, &node1);
ptemp.nValue = node1;
GCA(INPapName, (ckt, which, foo, "output", &ptemp))
GCA(INPapName, (ckt, which, foo, "output", &ptemp));
if (*line != ')') {
INPgetNetTok(&line, &nname2, 1);
@ -67,12 +67,12 @@ dot_noise(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
} else {
ptemp.nValue = gnode;
}
GCA(INPapName, (ckt, which, foo, "outputref", &ptemp))
GCA(INPapName, (ckt, which, foo, "outputref", &ptemp));
INPgetTok(&line, &name, 1);
INPinsert(&name, tab);
ptemp.uValue = name;
GCA(INPapName, (ckt, which, foo, "input", &ptemp))
GCA(INPapName, (ckt, which, foo, "input", &ptemp));
INPgetTok(&line, &steptype, 1);
ptemp.iValue = 1;
@ -501,7 +501,7 @@ dot_sens(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
INPgetNetTok(&line, &nname1, 0);
INPtermInsert(ckt, &nname1, tab, &node1);
ptemp.nValue = node1;
GCA(INPapName, (ckt, which, foo, "outpos", &ptemp))
GCA(INPapName, (ckt, which, foo, "outpos", &ptemp));
if (*line != ')') {
INPgetNetTok(&line, &nname2, 1);
@ -532,7 +532,7 @@ dot_sens(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
INPgetTok(&line, &name, 1);
if (name && !strcmp(name, "pct")) {
ptemp.iValue = 1;
GCA(INPapName, (ckt, which, foo, "pct", &ptemp))
GCA(INPapName, (ckt, which, foo, "pct", &ptemp));
INPgetTok(&line, &name, 1);
}
if (name && !strcmp(name, "ac")) {
@ -669,7 +669,7 @@ dot_pss(char *line, void *ckt, INPtables *tab, card *current,
INPgetNetTok(&line, &nname, 0);
INPtermInsert(ckt, &nname, tab, &nnode);
ptemp.nValue = nnode;
GCA(INPapName, (ckt, which, foo, "oscnode", &ptemp)) /* OscNode given as string */
GCA(INPapName, (ckt, which, foo, "oscnode", &ptemp)); /* OscNode given as string */
parm = INPgetValue(ckt, &line, IF_INTEGER, tab); /* PSS points */
GCA(INPapName, (ckt, which, foo, "points", parm));

View File

@ -115,14 +115,14 @@ int num, i;
/* IFC(bindNode,(ckt,fast,1,fakename)); */
ptemp.iValue = num;
GCA(INPpName,("dimension", &ptemp,ckt,type,fast))
GCA(INPpName,("dimension", &ptemp,ckt,type,fast));
ptemp.v.vec.sVec = nname1;
GCA(INPpName,("pos_nodes", &ptemp,ckt,type,fast))
GCA(INPpName,("pos_nodes", &ptemp,ckt,type,fast));
ptemp.v.vec.sVec = nname2;
GCA(INPpName,("neg_nodes", &ptemp,ckt,type,fast))
GCA(INPpName,("neg_nodes", &ptemp,ckt,type,fast));
if (error1 == 0 && lenvalgiven) {
ptemp.rValue = lenval;
GCA(INPpName,("length",&ptemp,ckt,type,fast))
GCA(INPpName,("length",&ptemp,ckt,type,fast));
}
return;

View File

@ -200,7 +200,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current)
if (error1 == 0) { /* got a resistance above */
ptemp.rValue = val;
GCA(INPpName, ("resistance", &ptemp, ckt, type, fast))
GCA(INPpName, ("resistance", &ptemp, ckt, type, fast));
}
IFC(bindNode, (ckt, fast, 1, node1));

View File

@ -140,7 +140,7 @@ int lenvalgiven = 0;
IFC(bindNode,(ckt,fast,1,node1));
IFC(bindNode,(ckt,fast,2,inode1));
ptemp.rValue = rval;
GCA(INPpName,("resistance",&ptemp,ckt,type,fast))
GCA(INPpName,("resistance",&ptemp,ckt,type,fast));
/* resistor between internal1 and internal2 */
internal2 = TMALLOC(char, 10 + strlen(name));
@ -156,7 +156,7 @@ int lenvalgiven = 0;
IFC(bindNode,(ckt,fast2,1,inode1));
IFC(bindNode,(ckt,fast2,2,inode2));
ptemp.rValue = rval;
GCA(INPpName,("resistance",&ptemp,ckt,type,fast2))
GCA(INPpName,("resistance",&ptemp,ckt,type,fast2));
/* resistor between internal2 and node2 */
rname3 = TMALLOC(char, 10 + strlen(name));
@ -168,7 +168,7 @@ int lenvalgiven = 0;
IFC(bindNode,(ckt,fast3,1,inode2));
IFC(bindNode,(ckt,fast3,2,node2));
ptemp.rValue = rval;
GCA(INPpName,("resistance",&ptemp,ckt,type,fast3))
GCA(INPpName,("resistance",&ptemp,ckt,type,fast3));
/* capacitor on node1 */
type = INPtypelook("Capacitor");
@ -185,7 +185,7 @@ int lenvalgiven = 0;
IFC(bindNode,(ckt,fast4,1,node1));
IFC(bindNode,(ckt,fast4,2,gnode1));
ptemp.rValue = cval;
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast4))
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast4));
/* capacitor on internal1 */
cname2 = TMALLOC(char, 10 + strlen(name));
@ -197,7 +197,7 @@ int lenvalgiven = 0;
IFC(bindNode,(ckt,fast4,1,inode1));
IFC(bindNode,(ckt,fast4,2,gnode1));
ptemp.rValue = cval * 2;
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast4))
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast4));
/* capacitor on internal2 */
cname3 = TMALLOC(char, 10 + strlen(name));
@ -209,7 +209,7 @@ int lenvalgiven = 0;
IFC(bindNode,(ckt,fast5,1,inode2));
IFC(bindNode,(ckt,fast5,2,gnode1));
ptemp.rValue = cval * 2;
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast5))
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast5));
/* capacitor on node2 */
cname4 = TMALLOC(char, 10 + strlen(name));
@ -221,7 +221,7 @@ int lenvalgiven = 0;
IFC(bindNode,(ckt,fast6,1,node2));
IFC(bindNode,(ckt,fast6,2,gnode1));
ptemp.rValue = cval;
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast6))
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast6));
return;
}
@ -246,7 +246,7 @@ int lenvalgiven = 0;
if (error1 == 0 && lenvalgiven) {
ptemp.rValue = lenval;
GCA(INPpName,("length",&ptemp,ckt,type,fast))
GCA(INPpName,("length",&ptemp,ckt,type,fast));
}
IFC(bindNode,(ckt,fast,1,node1));