From 4ba8ef34f01ee4aa7ad0737a2f38244c0934841d Mon Sep 17 00:00:00 2001 From: rlar Date: Thu, 12 Apr 2012 15:27:34 +0200 Subject: [PATCH] next step --- src/spicelib/devices/dev.c | 49 +++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/src/spicelib/devices/dev.c b/src/spicelib/devices/dev.c index d49bd21e3..1a1756b54 100644 --- a/src/spicelib/devices/dev.c +++ b/src/spicelib/devices/dev.c @@ -170,10 +170,32 @@ int DEVflag(int type){ #include "ngspice/cktdefs.h" /* for DEVmaxnum */ #include +struct admsaux { + bool is_adms; +}; + +int n_admsaux; +struct admsaux *a_admsaux; + +void +mark_adms(int type) +{ + if(type >= n_admsaux) { + int i; + a_admsaux = TREALLOC(struct admsaux, a_admsaux, type+1); + for(i=n_admsaux; iDEVpublic.name); + bool is_adms = type <= n_admsaux && a_admsaux[type].is_adms; + printf("%s(%d) --> %d\n", __func__, type, is_adms); + return is_adms; } int @@ -181,18 +203,16 @@ is_adms_type(const char *type_name) { int i; - if(strcmp(type_name, "hicum0")) - return -1; - for(i=0; iDEVpublic.name)) { - printf("found %d\n", i); - return i; + printf("%s(%s) --> type = %d\n", __func__, type_name, i); + return is_adms_type_(i) ? i : -1; } } + printf("%s(%s) --> type = \n", __func__, type_name); return -1; } @@ -252,6 +272,23 @@ int load_vadev(char *name) DEVices = TREALLOC(SPICEdev *, DEVices, DEVNUM + 1); printf("Added device: %s from dynamic library %s\n", device->spicedev.DEVpublic.name, libname); + + { + int i; + + printf(" name = %s\n" + " description = %s\n" + " number of terminals = %d\n", + device->spicedev.DEVpublic.name, + device->spicedev.DEVpublic.description, + *device->spicedev.DEVpublic.terms + ); + + for(i=0; i<*device->spicedev.DEVpublic.numNames; i++) + printf(" terminal[%d] %s\n", i, device->spicedev.DEVpublic.termNames[i]); + } + + mark_adms(DEVNUM); DEVices[DEVNUM++] = & (device->spicedev); relink_fixme(); return 0;