* src/analysis/cktask.c: moved to src/devices.
* src/analysis/cktbindn.c: moved, renamed to src/devices/cktbindnode.c. * src/analysis/cktfdev.c: moved, renamed to src/devices/cktfinddev.c. * TODO: Updates * src/analysis/Makefile.am src/devices/Makefile.am: Updates.
This commit is contained in:
parent
dd8b8c6c7c
commit
6f81cb9446
10
ChangeLog
10
ChangeLog
|
|
@ -1,3 +1,13 @@
|
|||
2000-06-19 Arno W. Peters <A.W.Peters@ieee.org>
|
||||
|
||||
* src/analysis/cktask.c: moved to src/devices.
|
||||
|
||||
* src/analysis/cktbindn.c: moved, renamed to
|
||||
src/devices/cktbindnode.c.
|
||||
|
||||
* src/analysis/cktfdev.c: moved, renamed to
|
||||
src/devices/cktfinddev.c.
|
||||
|
||||
2000-06-18 Arno W. Peters <A.W.Peters@ieee.org>
|
||||
|
||||
* AUTHORS, doc/ngspice.texi: Included an acknowledgements
|
||||
|
|
|
|||
3
TODO
3
TODO
|
|
@ -31,7 +31,8 @@ most appealing.
|
|||
Refactorings
|
||||
------------
|
||||
|
||||
Make devices dynamically loadable (perhaps use framework from glib).
|
||||
Make devices dynamically loadable. Perhaps use framework from glib
|
||||
(http://developer.gnome.org/doc/API/glib/index.html).
|
||||
|
||||
Separate out circuit builder from the analysis code and put it in the
|
||||
devices directory (rename devices directory to simbuilder at some
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ libckt_a_SOURCES = \
|
|||
acsetp.c \
|
||||
cktacct.c \
|
||||
cktacdum.c \
|
||||
cktask.c \
|
||||
cktaskaq.c \
|
||||
cktasknq.c \
|
||||
cktbindn.c \
|
||||
|
|
@ -23,7 +22,6 @@ libckt_a_SOURCES = \
|
|||
cktdojob.c \
|
||||
cktdump.c \
|
||||
cktfbran.c \
|
||||
cktfdev.c \
|
||||
cktfnda.c \
|
||||
cktfndm.c \
|
||||
cktfnode.c \
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
/**********
|
||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||
Author: 1985 Thomas L. Quarles
|
||||
**********/
|
||||
|
||||
/* CKTbindNode
|
||||
* bind a node of the specified device of the given type to its place
|
||||
* in the specified circuit.
|
||||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "ifsim.h"
|
||||
#include "smpdefs.h"
|
||||
#include "cktdefs.h"
|
||||
#include "devdefs.h"
|
||||
#include "sperror.h"
|
||||
|
||||
|
||||
extern SPICEdev *DEVices[];
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
CKTbindNode(void *ckt, void *fast, int term, void *node)
|
||||
{
|
||||
int mappednode;
|
||||
int type = ((GENinstance *)fast)->GENmodPtr->GENmodType;
|
||||
|
||||
mappednode = ((CKTnode *)node)->number;
|
||||
|
||||
if(*((*DEVices[type]).DEVpublic.terms) >= term && term >0 ) {
|
||||
switch(term) {
|
||||
default: return(E_NOTERM);
|
||||
case 1:
|
||||
((GENinstance *)fast)->GENnode1 = mappednode;
|
||||
break;
|
||||
case 2:
|
||||
((GENinstance *)fast)->GENnode2 = mappednode;
|
||||
break;
|
||||
case 3:
|
||||
((GENinstance *)fast)->GENnode3 = mappednode;
|
||||
break;
|
||||
case 4:
|
||||
((GENinstance *)fast)->GENnode4 = mappednode;
|
||||
break;
|
||||
case 5:
|
||||
((GENinstance *)fast)->GENnode5 = mappednode;
|
||||
break;
|
||||
}
|
||||
return(OK);
|
||||
} else {
|
||||
return(E_NOTERM);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/**********
|
||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||
Author: 1985 Thomas L. Quarles
|
||||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "ifsim.h"
|
||||
#include "cktdefs.h"
|
||||
#include "sperror.h"
|
||||
|
||||
|
||||
|
||||
int
|
||||
CKTfndDev(void *Ckt, int *type, void **fast, IFuid name, void *modfast, IFuid modname)
|
||||
{
|
||||
CKTcircuit *ckt=(CKTcircuit *)Ckt;
|
||||
GENinstance *here;
|
||||
GENmodel *mods;
|
||||
|
||||
if((GENinstance **)fast != (GENinstance **)NULL &&
|
||||
*(GENinstance **)fast != (GENinstance *)NULL) {
|
||||
/* already have fast, so nothing much to do */
|
||||
/* just get & set type */
|
||||
if(type) *type = (*((GENinstance**)fast))->GENmodPtr->GENmodType;
|
||||
return(OK);
|
||||
}
|
||||
if(modfast) {
|
||||
/* have model, just need device */
|
||||
mods = (GENmodel*)modfast;
|
||||
for(here = mods->GENinstances ; here != NULL;
|
||||
here = here->GENnextInstance) {
|
||||
if (here->GENname == name) {
|
||||
if(fast != NULL) *(GENinstance **)fast = here;
|
||||
if(type) *type = mods->GENmodType;
|
||||
return(OK);
|
||||
}
|
||||
}
|
||||
return(E_NODEV);
|
||||
}
|
||||
if(*type >=0 && *type < DEVmaxnum) {
|
||||
/* have device type, need to find model & device */
|
||||
/* look through all models */
|
||||
for(mods=(GENmodel *)ckt->CKThead[*type]; mods != NULL ;
|
||||
mods = mods->GENnextModel) {
|
||||
/* and all instances */
|
||||
if(modname == (char *)NULL || mods->GENmodName == modname) {
|
||||
for(here = mods->GENinstances ; here != NULL;
|
||||
here = here->GENnextInstance) {
|
||||
if (here->GENname == name) {
|
||||
if(fast != 0) *(GENinstance **)fast = here;
|
||||
return(OK);
|
||||
}
|
||||
}
|
||||
if(mods->GENmodName == modname) {
|
||||
return(E_NODEV);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(E_NOMOD);
|
||||
} else if(*type == -1) {
|
||||
/* look through all types (UGH - worst case - take forever) */
|
||||
for(*type = 0;*type <DEVmaxnum;(*type)++) {
|
||||
/* need to find model & device */
|
||||
/* look through all models */
|
||||
for(mods=(GENmodel *)ckt->CKThead[*type];mods!=NULL;
|
||||
mods = mods->GENnextModel) {
|
||||
/* and all instances */
|
||||
if(modname == (char *)NULL || mods->GENmodName == modname) {
|
||||
for(here = mods->GENinstances ; here != NULL;
|
||||
here = here->GENnextInstance) {
|
||||
if (here->GENname == name) {
|
||||
if(fast != 0) *(GENinstance **)fast = here;
|
||||
return(OK);
|
||||
}
|
||||
}
|
||||
if(mods->GENmodName == modname) {
|
||||
return(E_NODEV);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*type = -1;
|
||||
return(E_NODEV);
|
||||
} else return(E_BADPARM);
|
||||
}
|
||||
|
|
@ -40,7 +40,10 @@ libdev_a_SOURCES = \
|
|||
devsup.c \
|
||||
cktaccept.c \
|
||||
cktaccept.h \
|
||||
cktask.c \
|
||||
cktbindnode.c \
|
||||
cktcrte.c \
|
||||
cktfinddev.c \
|
||||
cktinit.c
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/src/include
|
||||
|
|
|
|||
|
|
@ -3,30 +3,30 @@ Copyright 1990 Regents of the University of California. All rights reserved.
|
|||
Author: 1985 Thomas L. Quarles
|
||||
**********/
|
||||
|
||||
/* CKTask
|
||||
* Ask questions about a specified device.
|
||||
*/
|
||||
/* CKTask
|
||||
*
|
||||
* Ask questions about a specified device. */
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "ifsim.h"
|
||||
#include "devdefs.h"
|
||||
#include "sperror.h"
|
||||
#include <config.h>
|
||||
#include <devdefs.h>
|
||||
#include <sperror.h>
|
||||
|
||||
#include "dev.h"
|
||||
|
||||
extern SPICEdev *DEVices[];
|
||||
|
||||
int
|
||||
CKTask(void *ckt, void *fast, int which, IFvalue *value, IFvalue *selector)
|
||||
{
|
||||
int type = ((GENinstance *)fast)->GENmodPtr->GENmodType;
|
||||
GENinstance *instance = (GENinstance *) fast;
|
||||
int type = instance->GENmodPtr->GENmodType;
|
||||
int error;
|
||||
#ifdef PARALLEL_ARCH
|
||||
long msgtype, length;
|
||||
long from = ((GENinstance *)fast)->GENowner;
|
||||
long from = instance->GENowner;
|
||||
#endif /* PARALLEL_ARCH */
|
||||
SPICEdev **DEVices;
|
||||
|
||||
DEVices = devices();
|
||||
if((*DEVices[type]).DEVask) {
|
||||
error = DEVices[type]->DEVask((CKTcircuit *)ckt,
|
||||
(GENinstance *)fast,which,value,selector);
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/**********
|
||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||
Author: 1985 Thomas L. Quarles
|
||||
**********/
|
||||
|
||||
/* CKTbindNode
|
||||
*
|
||||
* bind a node of the specified device of the given type to its place
|
||||
* in the specified circuit. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <devdefs.h>
|
||||
#include <sperror.h>
|
||||
|
||||
#include "dev.h"
|
||||
|
||||
int
|
||||
CKTbindNode(void *ckt, void *fast, int term, void *node)
|
||||
{
|
||||
int mappednode;
|
||||
SPICEdev **devs;
|
||||
GENinstance *instance = (GENinstance *) fast;
|
||||
int type = instance->GENmodPtr->GENmodType;
|
||||
|
||||
devs = devices();
|
||||
mappednode = ((CKTnode *)node)->number;
|
||||
|
||||
if (*((*devs[type]).DEVpublic.terms) >= term && term >0 ) {
|
||||
switch(term) {
|
||||
default:
|
||||
return E_NOTERM;
|
||||
case 1:
|
||||
instance->GENnode1 = mappednode;
|
||||
break;
|
||||
case 2:
|
||||
instance->GENnode2 = mappednode;
|
||||
break;
|
||||
case 3:
|
||||
instance->GENnode3 = mappednode;
|
||||
break;
|
||||
case 4:
|
||||
instance->GENnode4 = mappednode;
|
||||
break;
|
||||
case 5:
|
||||
instance->GENnode5 = mappednode;
|
||||
break;
|
||||
}
|
||||
return OK;
|
||||
} else {
|
||||
return E_NOTERM;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/**********
|
||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||
Author: 1985 Thomas L. Quarles
|
||||
**********/
|
||||
|
||||
#include <config.h>
|
||||
#include <cktdefs.h>
|
||||
#include <sperror.h>
|
||||
|
||||
|
||||
int
|
||||
CKTfndDev(void *Ckt, int *type, void **fast, IFuid name, void *modfast, IFuid modname)
|
||||
{
|
||||
CKTcircuit *ckt=(CKTcircuit *)Ckt;
|
||||
GENinstance *here;
|
||||
GENmodel *mods;
|
||||
|
||||
if((GENinstance **)fast != (GENinstance **)NULL &&
|
||||
*(GENinstance **)fast != (GENinstance *)NULL) {
|
||||
/* already have fast, so nothing much to do just get & set
|
||||
type */
|
||||
if (type)
|
||||
*type = (*((GENinstance**)fast))->GENmodPtr->GENmodType;
|
||||
return(OK);
|
||||
}
|
||||
|
||||
if(modfast) {
|
||||
/* have model, just need device */
|
||||
mods = (GENmodel*)modfast;
|
||||
for (here = mods->GENinstances;
|
||||
here != NULL;
|
||||
here = here->GENnextInstance) {
|
||||
if (here->GENname == name) {
|
||||
if (fast != NULL)
|
||||
*(GENinstance **)fast = here;
|
||||
|
||||
if (type)
|
||||
*type = mods->GENmodType;
|
||||
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
return E_NODEV;
|
||||
}
|
||||
|
||||
if (*type >= 0 && *type < DEVmaxnum) {
|
||||
/* have device type, need to find model & device */
|
||||
/* look through all models */
|
||||
for (mods = (GENmodel *)ckt->CKThead[*type];
|
||||
mods != NULL ;
|
||||
mods = mods->GENnextModel) {
|
||||
/* and all instances */
|
||||
if (modname == (char *)NULL || mods->GENmodName == modname) {
|
||||
for (here = mods->GENinstances;
|
||||
here != NULL;
|
||||
here = here->GENnextInstance) {
|
||||
if (here->GENname == name) {
|
||||
if (fast != 0)
|
||||
*(GENinstance **)fast = here;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
if(mods->GENmodName == modname) {
|
||||
return E_NODEV;
|
||||
}
|
||||
}
|
||||
}
|
||||
return E_NOMOD;
|
||||
} else if (*type == -1) {
|
||||
/* look through all types (UGH - worst case - take forever) */
|
||||
for(*type = 0; *type < DEVmaxnum; (*type)++) {
|
||||
/* need to find model & device */
|
||||
/* look through all models */
|
||||
for(mods=(GENmodel *)ckt->CKThead[*type];mods!=NULL;
|
||||
mods = mods->GENnextModel) {
|
||||
/* and all instances */
|
||||
if(modname == (char *)NULL || mods->GENmodName == modname) {
|
||||
for (here = mods->GENinstances;
|
||||
here != NULL;
|
||||
here = here->GENnextInstance) {
|
||||
if (here->GENname == name) {
|
||||
if(fast != 0)
|
||||
*(GENinstance **)fast = here;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
if(mods->GENmodName == modname) {
|
||||
return E_NODEV;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*type = -1;
|
||||
return E_NODEV;
|
||||
} else
|
||||
return E_BADPARM;
|
||||
}
|
||||
Loading…
Reference in New Issue