Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1988 Thomas L. Quarles
**********/
#include "ngspice/ngspice.h"
#include <stdio.h>
#include "ngspice/ifsim.h"
#include "ngspice/inpdefs.h"
#include "ngspice/inpmacs.h"
#include "ngspice/fteext.h"
#include "inpxx.h"
void INP2V(CKTcircuit *ckt, INPtables * tab, struct card *current)
{
* [<tran function>] */
static int type = -1;
char *line;
char *name;
char *nname1;
char *nname2;
CKTnode *node1;
CKTnode *node2;
int error;
GENinstance *fast;
IFvalue ptemp;
int waslead;
double leadval;
IFuid uid;
if (type < 0) {
if ((type = INPtypelook("Vsource")) < 0) {
LITERR("Device type Vsource not supported by this binary\n");
return;
}
}
line = current->line;
INPgetNetTok(&line, &name, 1);
INPinsert(&name, tab);
INPgetNetTok(&line, &nname1, 1);
INPtermInsert(ckt, &nname1, tab, &node1);
INPgetNetTok(&line, &nname2, 1);
INPtermInsert(ckt, &nname2, tab, &node2);
if (!tab->defVmod) {
IFnewUid(ckt, &uid, NULL, "V", UID_MODEL, NULL);
IFC(newModel, (ckt, type, &(tab->defVmod), uid));
}
IFC(newInstance, (ckt, tab->defVmod, &fast, name));
IFC(bindNode, (ckt, fast, 1, node1));
IFC(bindNode, (ckt, fast, 2, node2));
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab));
if (waslead) {
ptemp.rValue = leadval;
GCA(INPpName, ("dc", &ptemp, ckt, type, fast));
}
}