beautify code
This commit is contained in:
parent
d65259fd45
commit
80ca57eb76
|
|
@ -38,8 +38,8 @@ extern char *spice_analysis_get_description(int index);
|
||||||
|
|
||||||
/* static declarations */
|
/* static declarations */
|
||||||
static int beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analName,
|
static int beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analName,
|
||||||
char *refName, int refType, int numNames, char **dataNames, int dataType,
|
char *refName, int refType, int numNames, char **dataNames, int dataType,
|
||||||
bool windowed, runDesc **runp);
|
bool windowed, runDesc **runp);
|
||||||
static int addDataDesc(runDesc *run, char *name, int type, int ind);
|
static int addDataDesc(runDesc *run, char *name, int type, int ind);
|
||||||
static int addSpecialDesc(runDesc *run, char *name, char *devname, char *param, int depind);
|
static int addSpecialDesc(runDesc *run, char *name, char *devname, char *param, int depind);
|
||||||
static void fileInit(runDesc *run);
|
static void fileInit(runDesc *run);
|
||||||
|
|
@ -83,22 +83,22 @@ OUTpBeginPlot(CKTcircuit *circuitPtr, JOB *analysisPtr,
|
||||||
IFuid refName, int refType,
|
IFuid refName, int refType,
|
||||||
int numNames, IFuid *dataNames, int dataType, runDesc **plotPtr)
|
int numNames, IFuid *dataNames, int dataType, runDesc **plotPtr)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
#ifdef PARALLEL_ARCH
|
#ifdef PARALLEL_ARCH
|
||||||
if (ARCHme != 0) return(OK);
|
if (ARCHme != 0) return(OK);
|
||||||
#endif /* PARALLEL_ARCH */
|
#endif /* PARALLEL_ARCH */
|
||||||
|
|
||||||
|
|
||||||
if (ft_curckt->ci_ckt == circuitPtr)
|
if (ft_curckt->ci_ckt == circuitPtr)
|
||||||
name = ft_curckt->ci_name;
|
name = ft_curckt->ci_name;
|
||||||
else
|
else
|
||||||
name = "circuit name";
|
name = "circuit name";
|
||||||
|
|
||||||
return (beginPlot(analysisPtr, circuitPtr, name,
|
return (beginPlot(analysisPtr, circuitPtr, name,
|
||||||
analName, refName, refType, numNames,
|
analName, refName, refType, numNames,
|
||||||
dataNames, dataType, FALSE,
|
dataNames, dataType, FALSE,
|
||||||
plotPtr));
|
plotPtr));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -112,9 +112,9 @@ OUTwBeginPlot(CKTcircuit *circuitPtr, JOB *analysisPtr,
|
||||||
#endif /* PARALLEL_ARCH */
|
#endif /* PARALLEL_ARCH */
|
||||||
|
|
||||||
return (beginPlot(analysisPtr, circuitPtr, "circuit name",
|
return (beginPlot(analysisPtr, circuitPtr, "circuit name",
|
||||||
analName, refName, refType, numNames,
|
analName, refName, refType, numNames,
|
||||||
dataNames, dataType, TRUE,
|
dataNames, dataType, TRUE,
|
||||||
plotPtr));
|
plotPtr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -133,238 +133,237 @@ beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNam
|
||||||
/*to resume a run saj
|
/*to resume a run saj
|
||||||
*All it does is reassign the file pointer and return (requires *runp to be NULL if this is not needed)
|
*All it does is reassign the file pointer and return (requires *runp to be NULL if this is not needed)
|
||||||
*/
|
*/
|
||||||
if(dataType == 666 && numNames == 666){
|
if(dataType == 666 && numNames == 666) {
|
||||||
run = *runp;
|
run = *runp;
|
||||||
run->writeOut = ft_getOutReq(&run->fp, &run->runPlot, &run->binary,
|
run->writeOut = ft_getOutReq(&run->fp, &run->runPlot, &run->binary,
|
||||||
run->type, run->name);
|
run->type, run->name);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*end saj*/
|
/*end saj*/
|
||||||
|
|
||||||
/* Check to see if we want to print informational data. */
|
/* Check to see if we want to print informational data. */
|
||||||
if (cp_getvar("printinfo", CP_BOOL, NULL))
|
if (cp_getvar("printinfo", CP_BOOL, NULL))
|
||||||
fprintf(cp_err, "(debug printing enabled)\n");
|
fprintf(cp_err, "(debug printing enabled)\n");
|
||||||
|
|
||||||
*runp = run = alloc(struct runDesc);
|
*runp = run = alloc(struct runDesc);
|
||||||
|
|
||||||
/* First fill in some general information. */
|
/* First fill in some general information. */
|
||||||
run->analysis = analysisPtr;
|
run->analysis = analysisPtr;
|
||||||
run->circuit = circuitPtr;
|
run->circuit = circuitPtr;
|
||||||
run->name = copy(cktName);
|
run->name = copy(cktName);
|
||||||
run->type = copy(analName);
|
run->type = copy(analName);
|
||||||
run->windowed = windowed;
|
run->windowed = windowed;
|
||||||
run->numData = 0;
|
run->numData = 0;
|
||||||
|
|
||||||
an_name = spice_analysis_get_name(analysisPtr->JOBtype);
|
an_name = spice_analysis_get_name(analysisPtr->JOBtype);
|
||||||
ft_curckt->ci_last_an = an_name;
|
ft_curckt->ci_last_an = an_name;
|
||||||
|
|
||||||
/* Now let's see which of these things we need. First toss in the
|
/* Now let's see which of these things we need. First toss in the
|
||||||
* reference vector. Then toss in anything that getSaves() tells
|
* reference vector. Then toss in anything that getSaves() tells
|
||||||
* us to save that we can find in the name list. Finally unpack
|
* us to save that we can find in the name list. Finally unpack
|
||||||
* the remaining saves into parameters.
|
* the remaining saves into parameters.
|
||||||
*/
|
*/
|
||||||
numsaves = ft_getSaves(&saves);
|
numsaves = ft_getSaves(&saves);
|
||||||
if (numsaves) {
|
if (numsaves) {
|
||||||
savesused = TMALLOC(bool, numsaves);
|
savesused = TMALLOC(bool, numsaves);
|
||||||
saveall = FALSE;
|
saveall = FALSE;
|
||||||
for (i = 0; i < numsaves; i++) {
|
for (i = 0; i < numsaves; i++) {
|
||||||
if (saves[i].analysis && !cieq(saves[i].analysis, an_name)) {
|
if (saves[i].analysis && !cieq(saves[i].analysis, an_name)) {
|
||||||
/* ignore this one this time around */
|
/* ignore this one this time around */
|
||||||
savesused[i] = TRUE;
|
savesused[i] = TRUE;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for ".save all" and new synonym ".save allv" */
|
|
||||||
|
|
||||||
if (cieq(saves[i].name, "all") || cieq(saves[i].name, "allv")) {
|
|
||||||
saveall = TRUE;
|
|
||||||
savesused[i] = TRUE;
|
|
||||||
saves[i].used = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* And now for the new ".save alli" option */
|
|
||||||
|
|
||||||
if (cieq(saves[i].name, "alli")) {
|
|
||||||
savealli = TRUE;
|
|
||||||
savesused[i] = TRUE;
|
|
||||||
saves[i].used = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Pass 0. */
|
|
||||||
if (refName) {
|
|
||||||
addDataDesc(run, refName, refType, -1);
|
|
||||||
for (i = 0; i < numsaves; i++)
|
|
||||||
if (!savesused[i] && name_eq(saves[i].name, refName)) {
|
|
||||||
savesused[i] = TRUE;
|
|
||||||
saves[i].used = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
run->refIndex = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Pass 1. */
|
|
||||||
if (numsaves && !saveall) {
|
|
||||||
for (i = 0; i < numsaves; i++) {
|
|
||||||
if (!savesused[i]) {
|
|
||||||
for (j = 0; j < numNames; j++) {
|
|
||||||
if (name_eq(saves[i].name, dataNames[j])) {
|
|
||||||
addDataDesc(run, dataNames[j], dataType, j);
|
|
||||||
savesused[i] = TRUE;
|
|
||||||
saves[i].used = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < numNames; i++)
|
|
||||||
if (!refName || !name_eq(dataNames[i], refName)) {
|
|
||||||
|
|
||||||
/* Save the node as long as it's an internal device node */
|
|
||||||
|
|
||||||
if (!strstr(dataNames[i], "#internal") &&
|
|
||||||
!strstr(dataNames[i], "#source") &&
|
|
||||||
!strstr(dataNames[i], "#drain") &&
|
|
||||||
!strstr(dataNames[i], "#collector") &&
|
|
||||||
!strstr(dataNames[i], "#emitter") &&
|
|
||||||
!strstr(dataNames[i], "#base")) {
|
|
||||||
addDataDesc(run, dataNames[i], dataType, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Pass 1 and a bit.
|
|
||||||
This is a new pass which searches for all the internal device
|
|
||||||
nodes, and saves the terminal currents instead */
|
|
||||||
|
|
||||||
if (savealli) {
|
|
||||||
depind=0;
|
|
||||||
for (i = 0; i < numNames; i++) {
|
|
||||||
if (strstr(dataNames[i], "#internal") ||
|
|
||||||
strstr(dataNames[i], "#source") ||
|
|
||||||
strstr(dataNames[i], "#drain") ||
|
|
||||||
strstr(dataNames[i], "#collector") ||
|
|
||||||
strstr(dataNames[i], "#emitter") ||
|
|
||||||
strstr(dataNames[i], "#base")) {
|
|
||||||
tmpname[0]='@';
|
|
||||||
tmpname[1]='\0';
|
|
||||||
strncat(tmpname, dataNames[i], BSIZE_SP-1);
|
|
||||||
ch=strchr(tmpname, '#');
|
|
||||||
|
|
||||||
if (strstr(ch, "#collector")!=NULL) {
|
|
||||||
strcpy(ch, "[ic]");
|
|
||||||
} else if (strstr(ch, "#base")!=NULL) {
|
|
||||||
strcpy(ch, "[ib]");
|
|
||||||
} else if (strstr(ch, "#emitter")!=NULL) {
|
|
||||||
strcpy(ch, "[ie]");
|
|
||||||
if (parseSpecial(tmpname, namebuf, parambuf, depbuf)) {
|
|
||||||
addSpecialDesc(run, tmpname, namebuf, parambuf, depind);
|
|
||||||
};
|
|
||||||
strcpy(ch, "[is]");
|
|
||||||
} else if (strstr(ch, "#drain")!=NULL) {
|
|
||||||
strcpy(ch, "[id]");
|
|
||||||
if (parseSpecial(tmpname, namebuf, parambuf, depbuf)) {
|
|
||||||
addSpecialDesc(run, tmpname, namebuf, parambuf, depind);
|
|
||||||
};
|
|
||||||
strcpy(ch, "[ig]");
|
|
||||||
} else if (strstr(ch, "#source")!=NULL) {
|
|
||||||
strcpy(ch, "[is]");
|
|
||||||
if (parseSpecial(tmpname, namebuf, parambuf, depbuf)) {
|
|
||||||
addSpecialDesc(run, tmpname, namebuf, parambuf, depind);
|
|
||||||
};
|
|
||||||
strcpy(ch, "[ib]");
|
|
||||||
} else
|
|
||||||
if ((strstr(ch, "#internal")!=NULL)&&(tmpname[1]=='d')) {
|
|
||||||
strcpy(ch, "[id]");
|
|
||||||
} else {
|
|
||||||
fprintf(cp_err,
|
|
||||||
"Debug: could output current for %s\n", tmpname);
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
if (parseSpecial(tmpname, namebuf, parambuf, depbuf)) {
|
|
||||||
if (*depbuf) { fprintf( stderr,
|
|
||||||
"Warning : unexpected dependent variable on %s\n", tmpname);
|
|
||||||
} else {
|
|
||||||
addSpecialDesc(run, tmpname, namebuf, parambuf, depind);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Pass 2. */
|
|
||||||
for (i = 0; i < numsaves; i++) {
|
|
||||||
if (savesused[i])
|
|
||||||
continue;
|
|
||||||
if (!parseSpecial(saves[i].name, namebuf, parambuf, depbuf)) {
|
|
||||||
if (saves[i].analysis)
|
|
||||||
fprintf(cp_err, "Warning: can't parse '%s': ignored\n",
|
|
||||||
saves[i].name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Now, if there's a dep variable, do we already have it? */
|
|
||||||
if (*depbuf) {
|
|
||||||
for (j = 0; j < run->numData; j++)
|
|
||||||
if (name_eq(depbuf, run->data[j].name))
|
|
||||||
break;
|
|
||||||
if (j == run->numData) {
|
|
||||||
/* Better add it. */
|
|
||||||
for (j = 0; j < numNames; j++)
|
|
||||||
if (name_eq(depbuf, dataNames[j]))
|
|
||||||
break;
|
|
||||||
if (j == numNames) {
|
|
||||||
fprintf(cp_err,
|
|
||||||
"Warning: can't find '%s': value '%s' ignored\n",
|
|
||||||
depbuf, saves[i].name);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addDataDesc(run, dataNames[j], dataType, j);
|
|
||||||
savesused[i] = TRUE;
|
/* Check for ".save all" and new synonym ".save allv" */
|
||||||
saves[i].used = 1;
|
|
||||||
depind = j;
|
if (cieq(saves[i].name, "all") || cieq(saves[i].name, "allv")) {
|
||||||
} else
|
saveall = TRUE;
|
||||||
depind = run->data[j].outIndex;
|
savesused[i] = TRUE;
|
||||||
|
saves[i].used = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And now for the new ".save alli" option */
|
||||||
|
|
||||||
|
if (cieq(saves[i].name, "alli")) {
|
||||||
|
savealli = TRUE;
|
||||||
|
savesused[i] = TRUE;
|
||||||
|
saves[i].used = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
addSpecialDesc(run, saves[i].name, namebuf, parambuf, depind);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numsaves) {
|
/* Pass 0. */
|
||||||
for (i = 0; i < numsaves; i++) {
|
if (refName) {
|
||||||
tfree(saves[i].analysis);
|
addDataDesc(run, refName, refType, -1);
|
||||||
tfree(saves[i].name);
|
for (i = 0; i < numsaves; i++)
|
||||||
}
|
if (!savesused[i] && name_eq(saves[i].name, refName)) {
|
||||||
tfree(savesused);
|
savesused[i] = TRUE;
|
||||||
}
|
saves[i].used = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
run->refIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (numNames &&
|
|
||||||
( (run->numData == 1 && run->refIndex != -1)
|
|
||||||
|| (run->numData == 0 && run->refIndex == -1)) ) /* va: suggested parentheses */
|
|
||||||
{
|
|
||||||
fprintf(cp_err, "Error: no data saved for %s; analysis not run\n",
|
|
||||||
spice_analysis_get_description(analysisPtr->JOBtype));
|
|
||||||
return E_NOTFOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now that we have our own data structures built up, let's see what
|
/* Pass 1. */
|
||||||
* nutmeg wants us to do.
|
if (numsaves && !saveall) {
|
||||||
*/
|
for (i = 0; i < numsaves; i++) {
|
||||||
run->writeOut = ft_getOutReq(&run->fp, &run->runPlot, &run->binary,
|
if (!savesused[i]) {
|
||||||
run->type, run->name);
|
for (j = 0; j < numNames; j++) {
|
||||||
|
if (name_eq(saves[i].name, dataNames[j])) {
|
||||||
|
addDataDesc(run, dataNames[j], dataType, j);
|
||||||
|
savesused[i] = TRUE;
|
||||||
|
saves[i].used = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < numNames; i++)
|
||||||
|
if (!refName || !name_eq(dataNames[i], refName)) {
|
||||||
|
|
||||||
if (run->writeOut)
|
/* Save the node as long as it's an internal device node */
|
||||||
fileInit(run);
|
|
||||||
else {
|
if (!strstr(dataNames[i], "#internal") &&
|
||||||
plotInit(run);
|
!strstr(dataNames[i], "#source") &&
|
||||||
if (refName)
|
!strstr(dataNames[i], "#drain") &&
|
||||||
run->runPlot->pl_ndims = 1;
|
!strstr(dataNames[i], "#collector") &&
|
||||||
|
!strstr(dataNames[i], "#emitter") &&
|
||||||
|
!strstr(dataNames[i], "#base")) {
|
||||||
|
addDataDesc(run, dataNames[i], dataType, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pass 1 and a bit.
|
||||||
|
This is a new pass which searches for all the internal device
|
||||||
|
nodes, and saves the terminal currents instead */
|
||||||
|
|
||||||
|
if (savealli) {
|
||||||
|
depind=0;
|
||||||
|
for (i = 0; i < numNames; i++) {
|
||||||
|
if (strstr(dataNames[i], "#internal") ||
|
||||||
|
strstr(dataNames[i], "#source") ||
|
||||||
|
strstr(dataNames[i], "#drain") ||
|
||||||
|
strstr(dataNames[i], "#collector") ||
|
||||||
|
strstr(dataNames[i], "#emitter") ||
|
||||||
|
strstr(dataNames[i], "#base")) {
|
||||||
|
tmpname[0]='@';
|
||||||
|
tmpname[1]='\0';
|
||||||
|
strncat(tmpname, dataNames[i], BSIZE_SP-1);
|
||||||
|
ch=strchr(tmpname, '#');
|
||||||
|
|
||||||
|
if (strstr(ch, "#collector")!=NULL) {
|
||||||
|
strcpy(ch, "[ic]");
|
||||||
|
} else if (strstr(ch, "#base")!=NULL) {
|
||||||
|
strcpy(ch, "[ib]");
|
||||||
|
} else if (strstr(ch, "#emitter")!=NULL) {
|
||||||
|
strcpy(ch, "[ie]");
|
||||||
|
if (parseSpecial(tmpname, namebuf, parambuf, depbuf)) {
|
||||||
|
addSpecialDesc(run, tmpname, namebuf, parambuf, depind);
|
||||||
|
};
|
||||||
|
strcpy(ch, "[is]");
|
||||||
|
} else if (strstr(ch, "#drain")!=NULL) {
|
||||||
|
strcpy(ch, "[id]");
|
||||||
|
if (parseSpecial(tmpname, namebuf, parambuf, depbuf)) {
|
||||||
|
addSpecialDesc(run, tmpname, namebuf, parambuf, depind);
|
||||||
|
};
|
||||||
|
strcpy(ch, "[ig]");
|
||||||
|
} else if (strstr(ch, "#source")!=NULL) {
|
||||||
|
strcpy(ch, "[is]");
|
||||||
|
if (parseSpecial(tmpname, namebuf, parambuf, depbuf)) {
|
||||||
|
addSpecialDesc(run, tmpname, namebuf, parambuf, depind);
|
||||||
|
};
|
||||||
|
strcpy(ch, "[ib]");
|
||||||
|
} else if ((strstr(ch, "#internal")!=NULL)&&(tmpname[1]=='d')) {
|
||||||
|
strcpy(ch, "[id]");
|
||||||
|
} else {
|
||||||
|
fprintf(cp_err,
|
||||||
|
"Debug: could output current for %s\n", tmpname);
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
if (parseSpecial(tmpname, namebuf, parambuf, depbuf)) {
|
||||||
|
if (*depbuf) {
|
||||||
|
fprintf( stderr,
|
||||||
|
"Warning : unexpected dependent variable on %s\n", tmpname);
|
||||||
|
} else {
|
||||||
|
addSpecialDesc(run, tmpname, namebuf, parambuf, depind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Pass 2. */
|
||||||
|
for (i = 0; i < numsaves; i++) {
|
||||||
|
if (savesused[i])
|
||||||
|
continue;
|
||||||
|
if (!parseSpecial(saves[i].name, namebuf, parambuf, depbuf)) {
|
||||||
|
if (saves[i].analysis)
|
||||||
|
fprintf(cp_err, "Warning: can't parse '%s': ignored\n",
|
||||||
|
saves[i].name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* Now, if there's a dep variable, do we already have it? */
|
||||||
|
if (*depbuf) {
|
||||||
|
for (j = 0; j < run->numData; j++)
|
||||||
|
if (name_eq(depbuf, run->data[j].name))
|
||||||
|
break;
|
||||||
|
if (j == run->numData) {
|
||||||
|
/* Better add it. */
|
||||||
|
for (j = 0; j < numNames; j++)
|
||||||
|
if (name_eq(depbuf, dataNames[j]))
|
||||||
|
break;
|
||||||
|
if (j == numNames) {
|
||||||
|
fprintf(cp_err,
|
||||||
|
"Warning: can't find '%s': value '%s' ignored\n",
|
||||||
|
depbuf, saves[i].name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
addDataDesc(run, dataNames[j], dataType, j);
|
||||||
|
savesused[i] = TRUE;
|
||||||
|
saves[i].used = 1;
|
||||||
|
depind = j;
|
||||||
|
} else
|
||||||
|
depind = run->data[j].outIndex;
|
||||||
|
}
|
||||||
|
addSpecialDesc(run, saves[i].name, namebuf, parambuf, depind);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numsaves) {
|
||||||
|
for (i = 0; i < numsaves; i++) {
|
||||||
|
tfree(saves[i].analysis);
|
||||||
|
tfree(saves[i].name);
|
||||||
|
}
|
||||||
|
tfree(savesused);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numNames &&
|
||||||
|
( (run->numData == 1 && run->refIndex != -1)
|
||||||
|
|| (run->numData == 0 && run->refIndex == -1)) ) { /* va: suggested parentheses */
|
||||||
|
fprintf(cp_err, "Error: no data saved for %s; analysis not run\n",
|
||||||
|
spice_analysis_get_description(analysisPtr->JOBtype));
|
||||||
|
return E_NOTFOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now that we have our own data structures built up, let's see what
|
||||||
|
* nutmeg wants us to do.
|
||||||
|
*/
|
||||||
|
run->writeOut = ft_getOutReq(&run->fp, &run->runPlot, &run->binary,
|
||||||
|
run->type, run->name);
|
||||||
|
|
||||||
|
if (run->writeOut)
|
||||||
|
fileInit(run);
|
||||||
|
else {
|
||||||
|
plotInit(run);
|
||||||
|
if (refName)
|
||||||
|
run->runPlot->pl_ndims = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/*Start BLT, initilises the blt vectors saj*/
|
/*Start BLT, initilises the blt vectors saj*/
|
||||||
#ifdef TCL_MODULE
|
#ifdef TCL_MODULE
|
||||||
blt_init(run);
|
blt_init(run);
|
||||||
|
|
@ -453,125 +452,124 @@ OUTpData(runDesc *plotPtr, IFvalue *refValue, IFvalue *valuePtr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (run->writeOut) {
|
if (run->writeOut) {
|
||||||
if (run->pointCount == 1)
|
if (run->pointCount == 1)
|
||||||
fileInit_pass2(run);
|
fileInit_pass2(run);
|
||||||
fileStartPoint(run->fp, run->binary, run->pointCount);
|
fileStartPoint(run->fp, run->binary, run->pointCount);
|
||||||
|
|
||||||
if (run->refIndex != -1) {
|
if (run->refIndex != -1) {
|
||||||
if (run->isComplex){
|
if (run->isComplex) {
|
||||||
fileAddComplexValue(run->fp, run->binary, refValue->cValue);
|
fileAddComplexValue(run->fp, run->binary, refValue->cValue);
|
||||||
|
|
||||||
/* While we're looking at the reference value, print it to the screen
|
/* While we're looking at the reference value, print it to the screen
|
||||||
every quarter of a second, to give some feedback without using
|
every quarter of a second, to give some feedback without using
|
||||||
too much CPU time */
|
too much CPU time */
|
||||||
#ifndef HAS_WINDOWS
|
#ifndef HAS_WINDOWS
|
||||||
currclock = clock();
|
currclock = clock();
|
||||||
if ((currclock-lastclock)>(0.25*CLOCKS_PER_SEC)) {
|
if ((currclock-lastclock)>(0.25*CLOCKS_PER_SEC)) {
|
||||||
fprintf(stderr, " Reference value : % 12.5e\r",
|
fprintf(stderr, " Reference value : % 12.5e\r",
|
||||||
refValue->cValue.real);
|
refValue->cValue.real);
|
||||||
lastclock = currclock;
|
lastclock = currclock;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* And the same for a non-complex value */
|
/* And the same for a non-complex value */
|
||||||
|
|
||||||
fileAddRealValue(run->fp, run->binary, refValue->rValue);
|
fileAddRealValue(run->fp, run->binary, refValue->rValue);
|
||||||
#ifndef HAS_WINDOWS
|
#ifndef HAS_WINDOWS
|
||||||
currclock = clock();
|
currclock = clock();
|
||||||
if ((currclock-lastclock)>(0.25*CLOCKS_PER_SEC)) {
|
if ((currclock-lastclock)>(0.25*CLOCKS_PER_SEC)) {
|
||||||
fprintf(stderr, " Reference value : % 12.5e\r", refValue->rValue);
|
fprintf(stderr, " Reference value : % 12.5e\r", refValue->rValue);
|
||||||
lastclock = currclock;
|
lastclock = currclock;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (i = 0; i < run->numData; i++) {
|
for (i = 0; i < run->numData; i++) {
|
||||||
/* we've already printed reference vec first */
|
/* we've already printed reference vec first */
|
||||||
if (run->data[i].outIndex == -1) continue;
|
if (run->data[i].outIndex == -1) continue;
|
||||||
#ifdef TCL_MODULE
|
#ifdef TCL_MODULE
|
||||||
blt_add(i, refValue ? refValue->rValue : NAN);
|
blt_add(i, refValue ? refValue->rValue : NAN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (run->data[i].regular) {
|
if (run->data[i].regular) {
|
||||||
if(run->data[i].type == IF_REAL)
|
if(run->data[i].type == IF_REAL)
|
||||||
fileAddRealValue(run->fp, run->binary,
|
fileAddRealValue(run->fp, run->binary,
|
||||||
valuePtr->v.vec.rVec
|
valuePtr->v.vec.rVec
|
||||||
[run->data[i].outIndex]);
|
[run->data[i].outIndex]);
|
||||||
else if (run->data[i].type == IF_COMPLEX)
|
else if (run->data[i].type == IF_COMPLEX)
|
||||||
fileAddComplexValue(run->fp, run->binary,
|
fileAddComplexValue(run->fp, run->binary,
|
||||||
valuePtr->v.vec.cVec
|
valuePtr->v.vec.cVec
|
||||||
[run->data[i].outIndex]);
|
[run->data[i].outIndex]);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "OUTpData: unsupported data type\n");
|
fprintf(stderr, "OUTpData: unsupported data type\n");
|
||||||
} else {
|
} else {
|
||||||
/* should pre-check instance */
|
/* should pre-check instance */
|
||||||
if (!getSpecial(&run->data[i], run, &val))
|
if (!getSpecial(&run->data[i], run, &val)) {
|
||||||
{
|
|
||||||
|
|
||||||
/* If this is the first data point, print a warning for any unrecognized
|
/* If this is the first data point, print a warning for any unrecognized
|
||||||
variables, since this has not already been checked */
|
variables, since this has not already been checked */
|
||||||
|
|
||||||
if (run->pointCount==1)
|
if (run->pointCount==1)
|
||||||
fprintf(stderr, "Warning: unrecognized variable - %s\n",
|
fprintf(stderr, "Warning: unrecognized variable - %s\n",
|
||||||
run->data[i].name);
|
run->data[i].name);
|
||||||
|
|
||||||
if (run->isComplex) {
|
if (run->isComplex) {
|
||||||
val.cValue.real=0;
|
val.cValue.real=0;
|
||||||
val.cValue.imag=0;
|
val.cValue.imag=0;
|
||||||
fileAddComplexValue(run->fp, run->binary,
|
fileAddComplexValue(run->fp, run->binary,
|
||||||
val.cValue);
|
val.cValue);
|
||||||
} else {
|
} else {
|
||||||
val.rValue=0;
|
val.rValue=0;
|
||||||
fileAddRealValue(run->fp, run->binary,
|
fileAddRealValue(run->fp, run->binary,
|
||||||
val.rValue);
|
val.rValue);
|
||||||
};
|
};
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
if (run->data[i].type == IF_REAL)
|
if (run->data[i].type == IF_REAL)
|
||||||
fileAddRealValue(run->fp, run->binary,
|
fileAddRealValue(run->fp, run->binary,
|
||||||
val.rValue);
|
val.rValue);
|
||||||
else if (run->data[i].type == IF_COMPLEX)
|
else if (run->data[i].type == IF_COMPLEX)
|
||||||
fileAddComplexValue(run->fp, run->binary,
|
fileAddComplexValue(run->fp, run->binary,
|
||||||
val.cValue);
|
val.cValue);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "OUTpData: unsupported data type\n");
|
fprintf(stderr, "OUTpData: unsupported data type\n");
|
||||||
}
|
}
|
||||||
#ifdef TCL_MODULE
|
#ifdef TCL_MODULE
|
||||||
blt_add(i,valuePtr->v.vec.rVec
|
blt_add(i,valuePtr->v.vec.rVec
|
||||||
[run->data[i].outIndex]);
|
[run->data[i].outIndex]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
fileEndPoint(run->fp, run->binary);
|
fileEndPoint(run->fp, run->binary);
|
||||||
|
|
||||||
/* Check that the write to disk completed successfully, otherwise abort */
|
/* Check that the write to disk completed successfully, otherwise abort */
|
||||||
|
|
||||||
if (ferror(run->fp)) {
|
if (ferror(run->fp)) {
|
||||||
fprintf(stderr, "Warning: rawfile write error !!\n");
|
fprintf(stderr, "Warning: rawfile write error !!\n");
|
||||||
shouldstop = TRUE;
|
shouldstop = TRUE;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* This is interactive mode. Update the screen with the reference
|
/* This is interactive mode. Update the screen with the reference
|
||||||
variable just the same */
|
variable just the same */
|
||||||
|
|
||||||
currclock = clock();
|
currclock = clock();
|
||||||
#ifndef HAS_WINDOWS
|
#ifndef HAS_WINDOWS
|
||||||
if ((currclock-lastclock)>(0.25*CLOCKS_PER_SEC)) {
|
if ((currclock-lastclock)>(0.25*CLOCKS_PER_SEC)) {
|
||||||
if (run->isComplex) {
|
if (run->isComplex) {
|
||||||
fprintf(stderr, " Reference value : % 12.5e\r",
|
fprintf(stderr, " Reference value : % 12.5e\r",
|
||||||
refValue ? refValue->cValue.real : NAN);
|
refValue ? refValue->cValue.real : NAN);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, " Reference value : % 12.5e\r",
|
fprintf(stderr, " Reference value : % 12.5e\r",
|
||||||
refValue ? refValue->rValue : NAN);
|
refValue ? refValue->rValue : NAN);
|
||||||
}
|
}
|
||||||
lastclock = currclock;
|
lastclock = currclock;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < run->numData; i++) {
|
for (i = 0; i < run->numData; i++) {
|
||||||
#ifdef TCL_MODULE
|
#ifdef TCL_MODULE
|
||||||
/*Locks the blt vector to stop access*/
|
/*Locks the blt vector to stop access*/
|
||||||
blt_lockvec(i);
|
blt_lockvec(i);
|
||||||
#endif
|
#endif
|
||||||
if (run->data[i].outIndex == -1) {
|
if (run->data[i].outIndex == -1) {
|
||||||
if (run->data[i].type == IF_REAL)
|
if (run->data[i].type == IF_REAL)
|
||||||
|
|
@ -581,12 +579,12 @@ OUTpData(runDesc *plotPtr, IFvalue *refValue, IFvalue *valuePtr)
|
||||||
} else if (run->data[i].regular) {
|
} else if (run->data[i].regular) {
|
||||||
if (run->data[i].type == IF_REAL)
|
if (run->data[i].type == IF_REAL)
|
||||||
plotAddRealValue(&run->data[i],
|
plotAddRealValue(&run->data[i],
|
||||||
valuePtr->v.vec.rVec[run->data[i].outIndex]);
|
valuePtr->v.vec.rVec[run->data[i].outIndex]);
|
||||||
else if (run->data[i].type == IF_COMPLEX)
|
else if (run->data[i].type == IF_COMPLEX)
|
||||||
plotAddComplexValue(&run->data[i],
|
plotAddComplexValue(&run->data[i],
|
||||||
valuePtr->v.vec.cVec[run->data[i].outIndex]);
|
valuePtr->v.vec.cVec[run->data[i].outIndex]);
|
||||||
} else {
|
} else {
|
||||||
/* should pre-check instance */
|
/* should pre-check instance */
|
||||||
if (!getSpecial(&run->data[i], run, &val))
|
if (!getSpecial(&run->data[i], run, &val))
|
||||||
continue;
|
continue;
|
||||||
if (run->data[i].type == IF_REAL)
|
if (run->data[i].type == IF_REAL)
|
||||||
|
|
@ -705,28 +703,28 @@ OUTattributes(runDesc *plotPtr, IFuid varName, int param, IFvalue *value)
|
||||||
NG_IGNORE(value);
|
NG_IGNORE(value);
|
||||||
|
|
||||||
if (param == OUT_SCALE_LIN)
|
if (param == OUT_SCALE_LIN)
|
||||||
type = GRID_LIN;
|
type = GRID_LIN;
|
||||||
else if (param == OUT_SCALE_LOG)
|
else if (param == OUT_SCALE_LOG)
|
||||||
type = GRID_XLOG;
|
type = GRID_XLOG;
|
||||||
else
|
else
|
||||||
return E_UNSUPP;
|
return E_UNSUPP;
|
||||||
|
|
||||||
if (run->writeOut) {
|
if (run->writeOut) {
|
||||||
if (varName) {
|
if (varName) {
|
||||||
for (i = 0; i < run->numData; i++)
|
for (i = 0; i < run->numData; i++)
|
||||||
if (!strcmp(varName, run->data[i].name))
|
if (!strcmp(varName, run->data[i].name))
|
||||||
run->data[i].gtype = type;
|
run->data[i].gtype = type;
|
||||||
} else {
|
} else {
|
||||||
run->data[run->refIndex].gtype = type;
|
run->data[run->refIndex].gtype = type;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (varName) {
|
if (varName) {
|
||||||
for (d = run->runPlot->pl_dvecs; d; d = d->v_next)
|
for (d = run->runPlot->pl_dvecs; d; d = d->v_next)
|
||||||
if (!strcmp(varName, d->v_name))
|
if (!strcmp(varName, d->v_name))
|
||||||
d->v_gridtype = type;
|
d->v_gridtype = type;
|
||||||
} else {
|
} else {
|
||||||
run->runPlot->pl_scale->v_gridtype = type;
|
run->runPlot->pl_scale->v_gridtype = type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (OK);
|
return (OK);
|
||||||
|
|
@ -810,16 +808,16 @@ fileInit_pass2(runDesc *run)
|
||||||
type = SV_VOLTAGE;
|
type = SV_VOLTAGE;
|
||||||
|
|
||||||
if ( type == SV_CURRENT ) {
|
if ( type == SV_CURRENT ) {
|
||||||
branch = NULL;
|
branch = NULL;
|
||||||
if ( (branch = strstr( name, "#branch" )) != NULL ) {
|
if ( (branch = strstr( name, "#branch" )) != NULL ) {
|
||||||
*branch = '\0';
|
*branch = '\0';
|
||||||
}
|
}
|
||||||
fprintf(run->fp, "\t%d\ti(%s)\t%s", i, name, ft_typenames(type));
|
fprintf(run->fp, "\t%d\ti(%s)\t%s", i, name, ft_typenames(type));
|
||||||
if ( branch != NULL ) *branch = '#';
|
if ( branch != NULL ) *branch = '#';
|
||||||
} else if ( type == SV_VOLTAGE ) {
|
} else if ( type == SV_VOLTAGE ) {
|
||||||
fprintf(run->fp, "\t%d\tv(%s)\t%s", i, name, ft_typenames(type));
|
fprintf(run->fp, "\t%d\tv(%s)\t%s", i, name, ft_typenames(type));
|
||||||
} else {
|
} else {
|
||||||
fprintf(run->fp, "\t%d\t%s\t%s", i, name, ft_typenames(type));
|
fprintf(run->fp, "\t%d\t%s\t%s", i, name, ft_typenames(type));
|
||||||
}
|
}
|
||||||
if (run->data[i].gtype == GRID_XLOG)
|
if (run->data[i].gtype == GRID_XLOG)
|
||||||
fprintf(run->fp, "\tgrid=3");
|
fprintf(run->fp, "\tgrid=3");
|
||||||
|
|
@ -863,9 +861,9 @@ fileAddRealValue(FILE *fp, bool bin, double value)
|
||||||
if (bin)
|
if (bin)
|
||||||
rowbuf[column++]=value;
|
rowbuf[column++]=value;
|
||||||
else
|
else
|
||||||
fprintf(fp, "\t%.*e\n", DOUBLE_PRECISION, value);
|
fprintf(fp, "\t%.*e\n", DOUBLE_PRECISION, value);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -886,11 +884,11 @@ fileAddComplexValue(FILE *fp, bool bin, IFcomplex value)
|
||||||
static void
|
static void
|
||||||
fileEndPoint(FILE *fp, bool bin)
|
fileEndPoint(FILE *fp, bool bin)
|
||||||
{
|
{
|
||||||
if (bin) {
|
if (bin) {
|
||||||
/* write row buffer to file */
|
/* write row buffer to file */
|
||||||
fwrite(rowbuf, sizeof(double), rowbuflen, fp);
|
fwrite(rowbuf, sizeof(double), rowbuflen, fp);
|
||||||
}; /* otherwise the data has already been written */
|
}; /* otherwise the data has already been written */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Here's the hack... Run back and fill in the number of points. */
|
/* Here's the hack... Run back and fill in the number of points. */
|
||||||
|
|
@ -901,20 +899,20 @@ fileEnd(runDesc *run)
|
||||||
long place;
|
long place;
|
||||||
|
|
||||||
if (run->fp != stdout) {
|
if (run->fp != stdout) {
|
||||||
place = ftell(run->fp);
|
place = ftell(run->fp);
|
||||||
fseek(run->fp, run->pointPos, SEEK_SET);
|
fseek(run->fp, run->pointPos, SEEK_SET);
|
||||||
fprintf(run->fp, "%d", run->pointCount);
|
fprintf(run->fp, "%d", run->pointCount);
|
||||||
fprintf(stdout, "\nNo. of Data Rows : %d\n", run->pointCount);
|
fprintf(stdout, "\nNo. of Data Rows : %d\n", run->pointCount);
|
||||||
fseek(run->fp, place, SEEK_SET);
|
fseek(run->fp, place, SEEK_SET);
|
||||||
} else {
|
} else {
|
||||||
/* Yet another hack-around */
|
/* Yet another hack-around */
|
||||||
fprintf(stderr, "@@@ %ld %d\n", run->pointPos, run->pointCount);
|
fprintf(stderr, "@@@ %ld %d\n", run->pointPos, run->pointCount);
|
||||||
}
|
}
|
||||||
fflush(run->fp);
|
fflush(run->fp);
|
||||||
|
|
||||||
if (run->binary) {
|
if (run->binary) {
|
||||||
/* deallocate row buffer */
|
/* deallocate row buffer */
|
||||||
tfree(rowbuf);
|
tfree(rowbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -945,7 +943,7 @@ plotInit(runDesc *run)
|
||||||
/* if any of them complex, make them all complex */
|
/* if any of them complex, make them all complex */
|
||||||
run->isComplex = FALSE;
|
run->isComplex = FALSE;
|
||||||
for (i = 0; i < run->numData; i++) {
|
for (i = 0; i < run->numData; i++) {
|
||||||
if (run->data[i].type == IF_COMPLEX) run->isComplex = TRUE;
|
if (run->data[i].type == IF_COMPLEX) run->isComplex = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < run->numData; i++) {
|
for (i = 0; i < run->numData; i++) {
|
||||||
|
|
@ -1001,15 +999,15 @@ plotAddRealValue(dataDesc *desc, double value)
|
||||||
struct dvec *v = desc->vec;
|
struct dvec *v = desc->vec;
|
||||||
|
|
||||||
if (isreal(v)) {
|
if (isreal(v)) {
|
||||||
v->v_realdata = (double *) trealloc(v->v_realdata,
|
v->v_realdata = (double *) trealloc(v->v_realdata,
|
||||||
sizeof(double) * (size_t) (v->v_length + 1));
|
sizeof(double) * (size_t) (v->v_length + 1));
|
||||||
v->v_realdata[v->v_length] = value;
|
v->v_realdata[v->v_length] = value;
|
||||||
} else {
|
} else {
|
||||||
/* a real parading as a VF_COMPLEX */
|
/* a real parading as a VF_COMPLEX */
|
||||||
v->v_compdata = (ngcomplex_t *) trealloc(v->v_compdata,
|
v->v_compdata = (ngcomplex_t *) trealloc(v->v_compdata,
|
||||||
sizeof(ngcomplex_t) * (size_t) (v->v_length + 1));
|
sizeof(ngcomplex_t) * (size_t) (v->v_length + 1));
|
||||||
v->v_compdata[v->v_length].cx_real = value;
|
v->v_compdata[v->v_length].cx_real = value;
|
||||||
v->v_compdata[v->v_length].cx_imag = 0.0;
|
v->v_compdata[v->v_length].cx_imag = 0.0;
|
||||||
}
|
}
|
||||||
v->v_length++;
|
v->v_length++;
|
||||||
v->v_dims[0]=v->v_length; /* va, must be updated */
|
v->v_dims[0]=v->v_length; /* va, must be updated */
|
||||||
|
|
@ -1023,7 +1021,7 @@ plotAddComplexValue(dataDesc *desc, IFcomplex value)
|
||||||
struct dvec *v = desc->vec;
|
struct dvec *v = desc->vec;
|
||||||
|
|
||||||
v->v_compdata = (ngcomplex_t *) trealloc(v->v_compdata,
|
v->v_compdata = (ngcomplex_t *) trealloc(v->v_compdata,
|
||||||
sizeof(ngcomplex_t) * (size_t) (v->v_length + 1));
|
sizeof(ngcomplex_t) * (size_t) (v->v_length + 1));
|
||||||
v->v_compdata[v->v_length].cx_real = value.real;
|
v->v_compdata[v->v_length].cx_real = value.real;
|
||||||
v->v_compdata[v->v_length].cx_imag = value.imag;
|
v->v_compdata[v->v_length].cx_imag = value.imag;
|
||||||
v->v_length++;
|
v->v_length++;
|
||||||
|
|
@ -1036,9 +1034,9 @@ plotAddComplexValue(dataDesc *desc, IFcomplex value)
|
||||||
static void
|
static void
|
||||||
plotEnd(runDesc *run)
|
plotEnd(runDesc *run)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
fprintf(stdout, "\nNo. of Data Rows : %d\n", run->pointCount);
|
fprintf(stdout, "\nNo. of Data Rows : %d\n", run->pointCount);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1119,24 +1117,24 @@ getSpecial(dataDesc *desc, runDesc *run, IFvalue *val)
|
||||||
|
|
||||||
selector.iValue = desc->specIndex;
|
selector.iValue = desc->specIndex;
|
||||||
if (INPaName(desc->specParamName, val, run->circuit, &desc->specType,
|
if (INPaName(desc->specParamName, val, run->circuit, &desc->specType,
|
||||||
desc->specName, &desc->specFast, ft_sim, &desc->type,
|
desc->specName, &desc->specFast, ft_sim, &desc->type,
|
||||||
&selector) == OK) {
|
&selector) == OK) {
|
||||||
desc->type &= (IF_REAL | IF_COMPLEX); /* mask out other bits */
|
desc->type &= (IF_REAL | IF_COMPLEX); /* mask out other bits */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if ((vv = if_getstat(run->circuit, &desc->name[1])) != NULL) {
|
} else if ((vv = if_getstat(run->circuit, &desc->name[1])) != NULL) {
|
||||||
/* skip @ sign */
|
/* skip @ sign */
|
||||||
desc->type = IF_REAL;
|
desc->type = IF_REAL;
|
||||||
if (vv->va_type == CP_REAL)
|
if (vv->va_type == CP_REAL)
|
||||||
val->rValue = vv->va_real;
|
val->rValue = vv->va_real;
|
||||||
else if (vv->va_type == CP_NUM)
|
else if (vv->va_type == CP_NUM)
|
||||||
val->rValue = vv->va_num;
|
val->rValue = vv->va_num;
|
||||||
else if (vv->va_type == CP_BOOL)
|
else if (vv->va_type == CP_BOOL)
|
||||||
val->rValue = (vv->va_bool ? 1.0 : 0.0);
|
val->rValue = (vv->va_bool ? 1.0 : 0.0);
|
||||||
else {
|
else {
|
||||||
return FALSE; /* not a real */
|
return FALSE; /* not a real */
|
||||||
}
|
}
|
||||||
tfree(vv);
|
tfree(vv);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -1149,8 +1147,8 @@ freeRun(runDesc *run)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i < run->numData; i++) {
|
for (i=0; i < run->numData; i++) {
|
||||||
tfree(run->data[i].name);
|
tfree(run->data[i].name);
|
||||||
tfree(run->data[i].specParamName);
|
tfree(run->data[i].specParamName);
|
||||||
}
|
}
|
||||||
tfree(run->data);
|
tfree(run->data);
|
||||||
|
|
||||||
|
|
@ -1175,14 +1173,14 @@ OUTstopnow(void)
|
||||||
/* Print out error messages. */
|
/* Print out error messages. */
|
||||||
|
|
||||||
static struct mesg {
|
static struct mesg {
|
||||||
char *string;
|
char *string;
|
||||||
long flag;
|
long flag;
|
||||||
} msgs[] = {
|
} msgs[] = {
|
||||||
{ "Warning", ERR_WARNING } ,
|
{ "Warning", ERR_WARNING } ,
|
||||||
{ "Fatal error", ERR_FATAL } ,
|
{ "Fatal error", ERR_FATAL } ,
|
||||||
{ "Panic", ERR_PANIC } ,
|
{ "Panic", ERR_PANIC } ,
|
||||||
{ "Note", ERR_INFO } ,
|
{ "Note", ERR_INFO } ,
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1194,27 +1192,27 @@ OUTerror(int flags, char *format, IFuid *names)
|
||||||
int nindex = 0;
|
int nindex = 0;
|
||||||
|
|
||||||
if ((flags == ERR_INFO) && cp_getvar("printinfo", CP_BOOL, NULL))
|
if ((flags == ERR_INFO) && cp_getvar("printinfo", CP_BOOL, NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (m = msgs; m->flag; m++)
|
for (m = msgs; m->flag; m++)
|
||||||
if (flags & m->flag)
|
if (flags & m->flag)
|
||||||
fprintf(cp_err, "%s: ", m->string);
|
fprintf(cp_err, "%s: ", m->string);
|
||||||
|
|
||||||
for (s = format, bptr = buf; *s; s++) {
|
for (s = format, bptr = buf; *s; s++) {
|
||||||
if (*s == '%' && (s == format || *(s-1) != '%') && *(s+1) == 's') {
|
if (*s == '%' && (s == format || *(s-1) != '%') && *(s+1) == 's') {
|
||||||
if (names[nindex])
|
if (names[nindex])
|
||||||
strcpy(bptr, names[nindex]);
|
strcpy(bptr, names[nindex]);
|
||||||
else
|
else
|
||||||
strcpy(bptr, "(null)");
|
strcpy(bptr, "(null)");
|
||||||
bptr += strlen(bptr);
|
bptr += strlen(bptr);
|
||||||
s++;
|
s++;
|
||||||
nindex++;
|
nindex++;
|
||||||
} else {
|
} else {
|
||||||
*bptr++ = *s;
|
*bptr++ = *s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*bptr = '\0';
|
*bptr = '\0';
|
||||||
fprintf(cp_err, "%s\n", buf);
|
fprintf(cp_err, "%s\n", buf);
|
||||||
fflush(cp_err);
|
fflush(cp_err);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue