sense2, cleanup, avoid (SENstruct *) casts

This commit is contained in:
rlar 2013-04-07 17:34:59 +02:00
parent fd0f22701d
commit d86c34aaca
1 changed files with 17 additions and 15 deletions

View File

@ -16,47 +16,49 @@ Author: 1985 Thomas L. Quarles
int int
SENsetParm(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value) SENsetParm(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value)
{ {
SENstruct *job = (SENstruct *) anal;
NG_IGNORE(ckt); NG_IGNORE(ckt);
switch(which) { switch(which) {
case SEN_DC: case SEN_DC:
if (value->iValue) if (value->iValue)
((SENstruct *)anal)->SENmode |= DCSEN; job->SENmode |= DCSEN;
break; break;
case SEN_AC: case SEN_AC:
if (value->iValue) if (value->iValue)
((SENstruct *)anal)->SENmode |= ACSEN; job->SENmode |= ACSEN;
break; break;
case SEN_TRAN: case SEN_TRAN:
if (value->iValue) if (value->iValue)
((SENstruct *)anal)->SENmode |= TRANSEN; job->SENmode |= TRANSEN;
break; break;
case SEN_DEV: case SEN_DEV:
((SENstruct *)anal)->SENnumVal += 1; job->SENnumVal += 1;
if ( ! ((SENstruct *)anal)->SENdevices ) { if (!job->SENdevices) {
((SENstruct *)anal)->SENdevices = TMALLOC(char *, ((SENstruct *)anal)->SENnumVal); job->SENdevices = TMALLOC(char *, job->SENnumVal);
if (((SENstruct *)anal)->SENdevices == NULL) if (job->SENdevices == NULL)
return E_NOMEM; return E_NOMEM;
((SENstruct *)anal)->SENparmNames = TMALLOC(char *, ((SENstruct *)anal)->SENnumVal); job->SENparmNames = TMALLOC(char *, job->SENnumVal);
if (((SENstruct *)anal)->SENparmNames == NULL) if (job->SENparmNames == NULL)
return E_NOMEM; return E_NOMEM;
} else { } else {
((SENstruct *)anal)->SENdevices = TREALLOC(char *, ((SENstruct *)anal)->SENdevices, ((SENstruct *)anal)->SENnumVal); job->SENdevices = TREALLOC(char *, job->SENdevices, job->SENnumVal);
if (((SENstruct *)anal)->SENdevices == NULL) if (job->SENdevices == NULL)
return E_NOMEM; return E_NOMEM;
((SENstruct *)anal)->SENparmNames = TREALLOC(char *, ((SENstruct *)anal)->SENparmNames, ((SENstruct *)anal)->SENnumVal); job->SENparmNames = TREALLOC(char *, job->SENparmNames, job->SENnumVal);
if (((SENstruct *)anal)->SENparmNames == NULL) if (job->SENparmNames == NULL)
return E_NOMEM; return E_NOMEM;
} }
((SENstruct *)anal)->SENdevices [ ((SENstruct *)anal)->SENnumVal - 1 ] = value->sValue; job->SENdevices [job->SENnumVal - 1] = value->sValue;
break; break;
case SEN_PARM: case SEN_PARM:
((SENstruct *)anal)->SENparmNames [ ((SENstruct *)anal)->SENnumVal - 1 ] = value->sValue; job->SENparmNames [job->SENnumVal - 1] = value->sValue;
break; break;
default: default: