use type `IFparm' to abbreviate some expressions
This commit is contained in:
parent
31b455afd4
commit
4d65fb908d
|
|
@ -318,6 +318,8 @@ if_sens_run(CKTcircuit *ckt, wordlist *args, INPtables *tab)
|
|||
next:
|
||||
while (*line) { /* read the entire line */
|
||||
|
||||
IFparm *if_parm;
|
||||
|
||||
if (flag)
|
||||
INPgetTok(&line, &token, 1);
|
||||
else
|
||||
|
|
@ -333,22 +335,24 @@ next:
|
|||
continue;
|
||||
}
|
||||
|
||||
if_parm = &(ft_sim->analyses[save]->analysisParms[i]);
|
||||
|
||||
/* found it, analysis which, parameter i */
|
||||
if (ft_sim->analyses[save]->analysisParms[i].dataType & IF_FLAG) {
|
||||
if (if_parm->dataType & IF_FLAG) {
|
||||
/* one of the keywords! */
|
||||
ptemp.iValue = 1;
|
||||
error = ft_sim->setAnalysisParm
|
||||
(ckt, senseJob,
|
||||
ft_sim->analyses[save]->analysisParms[i].id, &ptemp, NULL);
|
||||
if_parm->id, &ptemp, NULL);
|
||||
if (error)
|
||||
current->error = INPerrCat(current->error, INPerror(error));
|
||||
} else {
|
||||
parm = INPgetValue
|
||||
(ckt, &line,
|
||||
ft_sim->analyses[save]->analysisParms[i].dataType, tab);
|
||||
if_parm->dataType, tab);
|
||||
error = ft_sim->setAnalysisParm
|
||||
(ckt, senseJob,
|
||||
ft_sim->analyses[save]->analysisParms[i].id, parm, NULL);
|
||||
if_parm->id, parm, NULL);
|
||||
if (error)
|
||||
current->error = INPerrCat(current->error, INPerror(error));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,6 +393,7 @@ if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value)
|
|||
int err, i;
|
||||
char **vv;
|
||||
int which = -1;
|
||||
IFparm *if_parm;
|
||||
|
||||
if (eq(name, "acct")) {
|
||||
ft_acctprint = TRUE;
|
||||
|
|
@ -428,7 +429,9 @@ if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value)
|
|||
}
|
||||
|
||||
i = ft_find_analysis_parm(which, name);
|
||||
if (i < 0 || !(ft_sim->analyses[which]->analysisParms[i].dataType & IF_SET)) {
|
||||
if_parm = (i >= 0) ? &(ft_sim->analyses[which]->analysisParms[i]) : NULL;
|
||||
|
||||
if (!if_parm || !(if_parm->dataType & IF_SET)) {
|
||||
/* See if this is unsupported or obsolete. */
|
||||
for (vv = unsupported; *vv; vv++)
|
||||
if (eq(name, *vv)) {
|
||||
|
|
@ -443,7 +446,7 @@ if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
switch (ft_sim->analyses[which]->analysisParms[i].dataType & IF_VARTYPES) {
|
||||
switch (if_parm->dataType & IF_VARTYPES) {
|
||||
case IF_REAL:
|
||||
if (type == CP_REAL)
|
||||
pval.rValue = *((double *) value);
|
||||
|
|
@ -477,7 +480,7 @@ if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value)
|
|||
default:
|
||||
fprintf(cp_err,
|
||||
"if_option: Internal Error: bad option type %d.\n",
|
||||
ft_sim->analyses[which]->analysisParms[i].dataType);
|
||||
if_parm->dataType);
|
||||
}
|
||||
|
||||
if (!ckt) {
|
||||
|
|
@ -490,12 +493,12 @@ if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value)
|
|||
|
||||
#if (0)
|
||||
if ((err = ft_sim->setAnalysisParm (ckt, ft_curckt->ci_curOpt,
|
||||
ft_sim->analyses[which]->analysisParms[i].id, &pval,
|
||||
if_parm->id, &pval,
|
||||
NULL)) != OK)
|
||||
ft_sperror(err, "setAnalysisParm(options) ci_curOpt");
|
||||
#else /*CDHW*/
|
||||
if ((err = ft_sim->setAnalysisParm (ckt, ft_curckt->ci_defOpt,
|
||||
ft_sim->analyses[which]->analysisParms[i].id, &pval,
|
||||
if_parm->id, &pval,
|
||||
NULL)) != OK)
|
||||
ft_sperror(err, "setAnalysisParm(options) ci_curOpt");
|
||||
return 1;
|
||||
|
|
@ -525,7 +528,7 @@ badtype:
|
|||
break;
|
||||
}
|
||||
fprintf(cp_err, ", type expected was ");
|
||||
switch (ft_sim->analyses[which]->analysisParms[i].dataType & IF_VARTYPES) {
|
||||
switch (if_parm->dataType & IF_VARTYPES) {
|
||||
case IF_REAL:
|
||||
fputs("real.\n", cp_err);
|
||||
break;
|
||||
|
|
@ -1209,12 +1212,15 @@ int
|
|||
if_analQbyName(CKTcircuit *ckt, int which, JOB *anal, char *name, IFvalue *parm)
|
||||
{
|
||||
int i;
|
||||
IFparm *if_parm;
|
||||
i = ft_find_analysis_parm(which, name);
|
||||
if (i < 0)
|
||||
return (E_BADPARM);
|
||||
|
||||
if_parm = &(ft_sim->analyses[which]->analysisParms[i]);
|
||||
|
||||
return (ft_sim->askAnalysisQuest
|
||||
(ckt, anal, ft_sim->analyses[which]->analysisParms[i].id, parm, NULL));
|
||||
(ckt, anal, if_parm->id, parm, NULL));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1279,6 +1285,7 @@ if_getstat(CKTcircuit *ckt, char *name)
|
|||
int options_idx, i;
|
||||
IFanalysis *options;
|
||||
IFvalue parm;
|
||||
IFparm *if_parm;
|
||||
|
||||
options_idx = ft_find_analysis("options");
|
||||
|
||||
|
|
@ -1296,16 +1303,18 @@ if_getstat(CKTcircuit *ckt, char *name)
|
|||
if (i < 0)
|
||||
return (NULL);
|
||||
|
||||
if_parm = &(options->analysisParms[i]);
|
||||
|
||||
if (ft_sim->askAnalysisQuest (ckt,
|
||||
&(ft_curckt->ci_curTask->taskOptions),
|
||||
options->analysisParms[i].id, &parm,
|
||||
if_parm->id, &parm,
|
||||
NULL) == -1)
|
||||
{
|
||||
fprintf(cp_err, "if_getstat: Internal Error: can't get %s\n", name);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (parmtovar(&parm, &(options->analysisParms[i])));
|
||||
return (parmtovar(&parm, if_parm));
|
||||
|
||||
} else {
|
||||
|
||||
|
|
@ -1313,19 +1322,21 @@ if_getstat(CKTcircuit *ckt, char *name)
|
|||
|
||||
for (i = 0; i < options->numParms; i++) {
|
||||
|
||||
if (!(options->analysisParms[i].dataType & IF_ASK))
|
||||
if_parm = &(options->analysisParms[i]);
|
||||
|
||||
if (!(if_parm->dataType & IF_ASK))
|
||||
continue;
|
||||
|
||||
if (ft_sim->askAnalysisQuest (ckt,
|
||||
&(ft_curckt->ci_curTask->taskOptions),
|
||||
options->analysisParms[i].id, &parm,
|
||||
if_parm->id, &parm,
|
||||
NULL) == -1)
|
||||
{
|
||||
fprintf(cp_err, "if_getstat: Internal Error: can't get %s\n", name);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
*v = parmtovar(&parm, &(options->analysisParms[i]));
|
||||
*v = parmtovar(&parm, if_parm);
|
||||
v = &((*v)->va_next);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -514,6 +514,7 @@ dot_sens2(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
|
|||
}
|
||||
IFC(newAnalysis, (ckt, which, "Sensitivity-2 Analysis", &foo, task));
|
||||
while (*line) {
|
||||
IFparm *if_parm;
|
||||
/* read the entire line */
|
||||
INPgetTok(&line, &token, 1);
|
||||
i = ft_find_analysis_parm(which, token);
|
||||
|
|
@ -522,13 +523,16 @@ dot_sens2(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
|
|||
LITERR(" Error: unknown parameter on .sens-ignored \n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if_parm = &(ft_sim->analyses[which]->analysisParms[i]);
|
||||
|
||||
/* found it, analysis which, parameter i */
|
||||
if (ft_sim->analyses[which]->analysisParms[i].dataType & IF_FLAG) {
|
||||
if (if_parm->dataType & IF_FLAG) {
|
||||
/* one of the keywords! */
|
||||
ptemp.iValue = 1;
|
||||
error =
|
||||
ft_sim->setAnalysisParm (ckt, foo,
|
||||
ft_sim->analyses[which]->analysisParms[i].id,
|
||||
if_parm->id,
|
||||
&ptemp,
|
||||
NULL);
|
||||
if (error)
|
||||
|
|
@ -537,10 +541,10 @@ dot_sens2(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
|
|||
} else {
|
||||
parm =
|
||||
INPgetValue(ckt, &line,
|
||||
ft_sim->analyses[which]->analysisParms[i].dataType, tab);
|
||||
if_parm->dataType, tab);
|
||||
error =
|
||||
ft_sim->setAnalysisParm (ckt, foo,
|
||||
ft_sim->analyses[which]->analysisParms[i].id,
|
||||
if_parm->id,
|
||||
parm,
|
||||
NULL);
|
||||
if (error)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ INPapName(CKTcircuit *ckt, int type, JOB *analPtr, char *parmname,
|
|||
IFvalue * value)
|
||||
{
|
||||
int i;
|
||||
IFparm *if_parm;
|
||||
|
||||
if (!parmname)
|
||||
return (E_BADPARM);
|
||||
|
|
@ -28,8 +29,9 @@ INPapName(CKTcircuit *ckt, int type, JOB *analPtr, char *parmname,
|
|||
if (i < 0)
|
||||
return (E_BADPARM);
|
||||
|
||||
if_parm = &(ft_sim->analyses[type]->analysisParms[i]);
|
||||
return ft_sim->setAnalysisParm (ckt, analPtr,
|
||||
ft_sim->analyses[type]->analysisParms[i].id,
|
||||
if_parm->id,
|
||||
value,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,25 +43,24 @@ INPdoOpts(
|
|||
line = optCard->line;
|
||||
INPgetTok(&line,&token,1); /* throw away '.option' */
|
||||
while (*line) {
|
||||
IFparm *if_parm;
|
||||
INPgetTok(&line,&token,1);
|
||||
i = ft_find_analysis_parm(which, token);
|
||||
if(i >= 0) {
|
||||
if(!(prm->analysisParms[i].dataType & IF_UNIMP_MASK)) {
|
||||
if_parm = (i >= 0) ? &(prm->analysisParms[i]) : NULL;
|
||||
if(if_parm && !(if_parm->dataType & IF_UNIMP_MASK)) {
|
||||
errmsg = TMALLOC(char, 45 + strlen(token));
|
||||
(void) sprintf(errmsg,
|
||||
" Warning: %s not yet implemented - ignored \n",token);
|
||||
optCard->error = INPerrCat(optCard->error,errmsg);
|
||||
val = INPgetValue(ckt,&line,
|
||||
prm->analysisParms[i].dataType, tab);
|
||||
if_parm->dataType, tab);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(i >= 0) {
|
||||
if(prm->analysisParms[i].dataType & IF_SET) {
|
||||
if(if_parm && (if_parm->dataType & IF_SET)) {
|
||||
val = INPgetValue(ckt,&line,
|
||||
prm->analysisParms[i].dataType&IF_VARTYPES, tab);
|
||||
if_parm->dataType&IF_VARTYPES, tab);
|
||||
error = ft_sim->setAnalysisParm (ckt, anal,
|
||||
prm->analysisParms[i].id, val, NULL);
|
||||
if_parm->id, val, NULL);
|
||||
if(error) {
|
||||
errmsg = TMALLOC(char, 35 + strlen(token));
|
||||
(void) sprintf(errmsg,
|
||||
|
|
@ -69,7 +68,6 @@ INPdoOpts(
|
|||
optCard->error = INPerrCat(optCard->error, errmsg);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
errmsg = TMALLOC(char, 100);
|
||||
(void) strcpy(errmsg," Error: unknown option - ignored\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue