From 85a73411e68819806d2b0f843ea6d584b3d2ea6d Mon Sep 17 00:00:00 2001 From: gdiso Date: Sun, 17 Jun 2007 03:20:42 +0000 Subject: [PATCH] allow NULL pointer in DEVices array --- ChangeLog | 23 + DEVICES | 974 +++++++------------------------ src/spicelib/analysis/acan.c | 2 +- src/spicelib/analysis/cktdest.c | 2 +- src/spicelib/analysis/cktdisto.c | 4 +- src/spicelib/analysis/cktdump.c | 4 +- src/spicelib/analysis/cktfbran.c | 2 +- src/spicelib/analysis/cktic.c | 2 +- src/spicelib/analysis/cktload.c | 2 +- src/spicelib/analysis/cktnoise.c | 2 +- src/spicelib/analysis/cktop.c | 2 +- src/spicelib/analysis/cktpzld.c | 2 +- src/spicelib/analysis/cktpzset.c | 2 +- src/spicelib/analysis/cktsetup.c | 4 +- src/spicelib/analysis/ckttemp.c | 2 +- src/spicelib/analysis/ckttrunc.c | 2 +- src/spicelib/analysis/ckttyplk.c | 2 +- src/spicelib/devices/cktaccept.c | 2 +- src/spicelib/devices/dev.c | 150 ++--- src/spicelib/devices/dev_old.c | 581 ++++++++++++++++++ src/spicelib/parser/inptyplk.c | 2 +- 21 files changed, 856 insertions(+), 912 deletions(-) create mode 100644 src/spicelib/devices/dev_old.c diff --git a/ChangeLog b/ChangeLog index c5d398a91..e5ea0b9dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2007-06-17 Gong Ding + * src/spicelib/devices/dev.c: use a more flexiable way to define device. + If it doesn't work, one can returen to old version (rename as dev_old.c). + +These files are modified for avoiding NULL DEVices[] pointer. + * spicelib/analysis/acan.c: + * spicelib/analysis/cktdest.c: + * spicelib/analysis/cktdisto.c: + * spicelib/analysis/cktdump.c: + * spicelib/analysis/cktfbran.c: + * spicelib/analysis/cktic.c: + * spicelib/analysis/cktload.c: + * spicelib/analysis/cktnoise.c: + * spicelib/analysis/cktop.c: + * spicelib/analysis/cktpzld.c: + * spicelib/analysis/cktpzset.c: + * spicelib/analysis/cktsetup.c: + * spicelib/analysis/ckttemp.c: + * spicelib/analysis/ckttrunc.c: + * spicelib/analysis/ckttyplk.c: + * spicelib/parser/inptyplk.c: +The modifications should not affect ngspice's function. + 2007-06-14 Paolo Nenzi * src/misc/misc_time.c: added a casting to doube in seconds function to diff --git a/DEVICES b/DEVICES index e14c3c715..83e92d430 100644 --- a/DEVICES +++ b/DEVICES @@ -1,776 +1,198 @@ -DEVICES ---------------------------------------------------------------------------- - -This file contains the status of devices available in ngspice. This file -will be updated every time the device specific code is altered or changed. -This file is useful in writing ngspice documentation. - - -*************************************************************************** -************************* Linear devices ******************************** -*************************************************************************** - -CAP - Capacitor - Initial Release. - Ver: N/A - Class: C - Level: 1 (and only) - Dir: devices/cap - Status: - - Enhancements over the original model: - - - Parallel Multiplier - - Temperature difference from circuit temperature - - Preliminary technology scaling support - - Model capacitance - - Cj calculation based on relative dielectric constant - and insulator thickness - -IND - Inductor - Initial Release. - Ver: N/A - Class: L - Level: 1 (and only) - Dir: devices/ind - Status: - - Enhancements over the original model: - - - Parallel Multiplier - - Temperature difference from circuit temperature - - Preliminary technology scaling support - - Model inductance - - Inductance calculation for toroids or solenoids - on the model line. - -RES - Simple linear resistor - Initial Release. - Ver: N/A - Class: R - Level: 1 (and only) - Dir: devices/res - Status: - - Enhancements over the original model: - - - Parallel Multiplier - - Different value for ac analysis - - Temperature difference from circuit temperature - - Noiseless resistor - - Flicker noise - - Preliminary technology scaling support - - -*************************************************************************** -********************* Distributed elements ******************************** -*************************************************************************** - -CPL - Simple Coupled Multiconductor Lines (Kspice) - Initial Release. - Ver: N/A - Class: P - Level: 1 (and only) - Dir: devices/cpl - Status: - - This model comes from swec and kspice. It is not documented, if - you have kspice docs, can you write a short description - of its use ? - - - Does not implement parallel code switches - - Probably a lot of memory leaks - - Enhancements over the original model: - - - Better integrated into ngspice adding CPLask, CPLmAsk and - CPLunsetup functions - - -LTRA - Lossy Transmission line - Initial Release. - Ver: N/A - Class: O - Level: 1 (and only) - Dir: devices/ltra - Status: - - Original spice model. - - - Does not implement parallel code switches - -TRA - Transmission line - Initial Release. - Ver: N/A - Class: T - Level: 1 (and only) - Dir: devices/tra - Status: - - Original spice model. - - - Does not implement parallel code switches - -TXL - Simple Lossy Transmission Line (Kspice) - Initial Release. - Ver: N/A - Class: Y - Level: 1 (and only) - Dir: devices/txl - Status: - - This model comes from kspice. It is not documented, if - you have kspice docs, can you write a short description - of its use ? - - There is some code left out from compilation: - TXLaccept and TXLfindBr. Any ideas ? - - - Does not implement parallel code switches - - -URC - Uniform distributed RC line - Initial Release. - Ver: N/A - Class: U - Level: 1 (and only) - Dir: devices/urc - Status: - - Original spice model. - - - Does not implement parallel code switches - - -*************************************************************************** -**************************** V/I Sources ***************************** -*************************************************************************** - -ASRC - Arbitrary Source - Initial Release. - Ver: N/A - Class: B - Level: 1 (and only) - Dir: devices/asrc - Status: - - The arbitrary source code has been corrected with the patch - available on the Internet. There is still an issue to fix, the - current of current-controlled generators. - -CCCS - Current Controlled Current Source - Initial Release. - Ver: N/A - Class: F - Level: 1 (and only) - Dir: devices/cccs - Status: - - Original spice model. - -CCVS - Current Controlled Voltage Source - Initial Release. - Ver: N/A - Class: H - Level: 1 (and only) - Dir: devices/ccvs - Status: - - Original spice model. - -ISRC - Independent Current Source - Initial Release. - Ver: N/A - Class: I - Level: 1 (and only) - Dir: devices/isrc - Status: - - This is the original spice device improved by Alan Gillespie - with the following features: - - - Source ramping - - Check for non-monotonic series in PWL - - -VCCS - Voltage Controlled Current Source - Initial Release. - Ver: N/A - Class: G - Level: 1 (and only) - Dir: devices/vccs - Status: - - Original spice model. - -VCVS - Voltage Controlled Voltage Source - Initial Release. - Ver: N/A - Class: E - Level: 1 (and only) - Dir: devices/vcvs - Status: - - Original spice model. - -VSRC - Independent Voltage Source - Initial Release. - Ver: N/A - Class: V - Level: 1 (and only) - Dir: devices/vsrc - Status: - - This is the original spice device improved by Alan Gillespie - with the following features: - - - Source ramping - - Check for non-monotonic series in PWL - - -*************************************************************************** -**************************** Switches **************************** -*************************************************************************** - -CSW - Current controlled switch - Initial Release. - Ver: N/A - Class: W - Level: 1 (and only) - Dir: devices/csw - Status: - - This model comes from Jon Engelbert - - -SW - Voltage controlled switch - Initial release - Ver: N/A - Class: S - Level: 1 (and only) - Dir: devices/sw - Status: - - This model comes from Jon Engelbert - - -*************************************************************************** -**************************** Diodes **************************** -*************************************************************************** - -DIO - Junction Diode - Initial Release. - Ver: N/A - Class: D - Level: 1 (and only) - Dir: devices/dio - Status: - - Enhancements over the original model: - - - Parallel Multiplier - - Temperature difference from circuit temperature - - Forward and reverse knee currents - - Periphery (sidewall) effects - - Temperature correction of some parameters - - -*************************************************************************** -************************* Bipolar Devices ************************* -*************************************************************************** - -BJT - Bipolar Junction Transistor - Initial Release. - Ver: N/A - Class: Q - Level: 1 - Dir: devices/bjt - Status: - - Enhancements over the original model: - - - Parallel Multiplier - - Temperature difference from circuit temperature - - Different area parameters for collector, base and emitter - -BJT2 - Bipolar Junction Transistor - Initial Release. - Ver: N/A - Class: Q - Level: 2 - Dir: devices/bjt2 - Status: - - This is the BJT model written by Alan Gillespie to support lateral - devices. The model has been hacked by Dietmar Warning fixing some bugs - and adding some features (temp. correction on resistors). - - Enhancements over the original model: - - - Temperature correction on rc,rb,re - - Parallel Multiplier - - Temperature difference from circuit temperature - - Different area parameters for collector, base and emitter - -VBIC - Bipolar Junction Transistor - Initial Release. - Ver: N/A - Class: Q - Level: 4 - Dir: devices/vbic - Status: - - This is the Vertical Bipolar InterCompany model. - The author of VBIC is Colin McAndrew mcandrew@ieee.org - Spice3 Implementation: Dietmar Warning DAnalyse GmbH - warning@danalyse.de - Web Site: - http://www.designers-guide.com/VBIC/index.html - - Notes: This is the 4 terminals model, without excess phase - and thermal network. - - -*************************************************************************** -***************************** FET Devices *************************** -*************************************************************************** - -JFET - Junction Field Effect transistor - Initial Release. - Ver: N/A - Class: J - Level: 1 - Dir: devices/jfet - Status: - - This is the original spice JFET model. - - Enhancements over the original model: - - - Alan Gillespie's modified diode model - - Parallel multiplier - - Instance temperature as difference for circuit temperature - -JFET2 - Junction Field Effect Transistor (PS model) - Initial Release. - Ver: N/A - Class: J - Level: 2 - Dir: devices/jfet2 - Status: - - This is the Parker Skellern model for MESFETs. - - Web Site: - http://www.elec.mq.edu.au/cnerf/models/psmodel/ - - Enhancements over the original model: - - - Parallel multiplier - - Instance temperature as difference for circuit temperature - - -*************************************************************************** -*************************** HFET devices *************************** -*************************************************************************** - - Added code from macspice3f4 HFET1&2 and MESA model - Original note: - Added device calls for Mesfet models and HFET models - provided by Trond Ytterdal as of Nov 98 - -HFET1 - Heterostructure Field Effect Transistor Level 1 - Initial Release. - Ver: N/A - Class: Z - Level: 5 - Dir: devices/hfet1 - Status: - - This is the Heterostructure Field Effect Transistor model from: - K. Lee, M. Shur, T. A. Fjeldly and T. Ytterdal - "Semiconductor Device Modeling in VLSI", - 1993, Prentice Hall, New Jersey - - Enhancements over the original model: - - - Parallel multiplier - - Instance temperature as difference for circuit temperature - - Added pole-zero analysis - - -HFET2 - Heterostructure Field Effect Transistor Level 2 - Initial Release. - Ver: N/A - Class: Z - Level: 6 - Dir: devices/hfet2 - Status: - - Simplified version of hfet1 - - Enhancements over the original model: - - - Parallel multiplier - - Instance temperature as difference for circuit temperature - - Added pole-zero analysis - - -*************************************************************************** -*************************** MES devices *************************** -*************************************************************************** - -MES - MESFET model - Initial Release. - Ver: N/A - Class: Z - Level: 1 - Dir: devices/mes - Status: - - This is the original spice3 MESFET model (Statz). - - Enhancements over the original model: - - - Parallel multiplier - - Alan Gillespie junction diodes implementation - - - Added code from macspice3f4 HFET1&2 and MESA model - Original note: - Added device calls for Mesfet models and HFET models - provided by Trond Ytterdal as of Nov 98 - -MESA - MESFET model (MacSpice3f4) - Initial Release. - Ver: N/A - Class: Z - Level: 2,3,4 - Dir: devices/mesa - Status: - - This is a multilevel model. It contains code for mesa levels - 2,3 and 4 - - Enhancements over the original model: - - - Parallel multiplier - - Instance temperature as difference from circuit temperature - - Added pole-zero analysis - - -*************************************************************************** -**************************** MOS devices **************************** -*************************************************************************** - -MOS1 - Level 1 MOS model - Initial Release. - Ver: N/A - Class: M - Level: 1 - Dir: devices/mos1 - Status: - - This is the so-called Schichman-Hodges model. - - Enhancements over the original model: - - - Parallel multiplier - - Temperature difference from circuit temperature - - -MOS2 - Level 2 MOS model - Initial Release. - Ver: N/A - Class: M - Level: 2 - Dir: devices/mos2 - Status: - - This is the so-called Grove-Frohman model. - - Enhancements over the original model: - - - Parallel multiplier - - Temperature difference from circuit temperature - - -MOS3 - Level 3 MOS model - Initial Release. - Ver: N/A - Class: M - Level: 3 - Dir: devices/mos3 - Status: - - Enhancements over the original model: - - - Parallel multiplier - - Temperature difference from circuit temperature - - -MOS6 - Level 6 MOS model - Initial Release. - Ver: N/A - Class: M - Level: 6 - Dir: devices/mos6 - Status: - - Enhancements over the original model: - - - Parallel multiplier - - Temperature difference from circuit temperature - - -MOS9 - Level 9 MOS model - Initial Release. - Ver: N/A - Class: M - Level: 9 - Dir: devices/mos9 - Status: - - Enhancements over the original model: - - - Temperature difference from circuit temperature - - -BSIM1 - BSIM model level 1 - Initial Release. - Ver: N/A - Class: M - Level: 4 - Dir: devices/bsim1 - Status: - - Enhancements over the original model: - - - Parallel multiplier - - Noise analysis - - BUGS: - Distortion analysis probably does not - work with "parallel" devices. Equations - are too intricate to deal with. Any one - has ideas on the subject ? - - -BSIM2 - BSIM model level 2 - Initial Release. - Ver: N/A - Class: M - Level: 5 - Dir: devices/bsim2 - Status: - - Enhancements over the original model: - - - Parallel multiplier - - Noise analysis - - -BSIM3v0 - BSIM model level 3 - Initial Release. - Ver: 3.0 - Class: M - Level: 52 - Dir: devices/bsim3v0 - Status: TO BE TESTED AND IMPROVED - - -BSIM3v0 - BSIM model level 3 - Initial Release. - Ver: 3.0 - Class: M - Level: 51 - Dir: devices/bsim3v1a - Status: TO BE TESTED AND IMPROVED - - This is the BSIM3v3.0 model modified by Alan Gillespie. - - -BSIM3v1 - BSIM model level 3 - Initial Release. - Ver: 3.1 - Class: M - Level: 50 - Dir: devices/bsim3v1 - Status: TO BE TESTED - - -BSIM3v1 - BSIM model level 3 - Initial Release. - Ver: 3.1 - Class: M - Level: 49 - Dir: devices/bsim3v1s - Status: TO BE TESTED AND IMPROVED - - This is the BSIM3v3.1 model modified by Serban Popescu. - This is level 49 model. It is an implementation that supports - "HDIF" and "M" parameters. - - -BSIM3 - BSIM model level 3 - Initial Release. - Ver: 3.2.4 - Class: M - Level: 8 - Dir: devices/bsim3 - Status: TO BE TESTED - - This is the BSIM3v3.2.4 model from Berkeley device group. - You can find some test netlists with results for this model - on its web site. - - Web site: - http://www-device.eecs.berkeley.edu/~bsim3 - - Enhancements over the original model: - - - Parallel Multiplier - - ACM Area Calculation Method - - Multirevision code (supports all 3v3.2 minor revisions) - - NodesetFix - - -BSIM4 - BSIM model level 4 (0.18 um) - Initial Release. - Ver: 4.5.0 - Class: M - Level: 14 - Dir: devices/bsim4 - Status: TO BE TESTED - - This is the BSIM4 device model from Berkeley Device Group. - Test are available on its web site. - - Web site: - http://www-device.eecs.berkeley.edu/~bsim3/bsim4.html - - Updated to 4.5.0 YET UNTESTED. - - -HiSIM - Hiroshima-university STARC IGFET Model - Initial Release. - Ver: 1.2.0 - Class: M - Level: 64 - Dir: devices/hisim - Status: - - This is the HiSIM model available from Hiroshima University - (Ultra-Small Device Engineering Laboratory) - - Web site: - http://home.hiroshima-u.ac.jp/usdl/HiSIM.shtml - http://www.starc.or.jp/kaihatu/pdgr/hisim/index.html - - Enhancements over the original model: - - - Parallel Multiplier - - NodesetFix - - -*************************************************************************** -***************************** SOI Devices **************************** -*************************************************************************** - -BSIM3SOI_FD - SOI model (fully depleted devices) - Initial Release. - Ver: 2.1 - Class: M - Level: 55 - Dir: devices/bsim3soi_fd - Status: TO BE TESTED. - - FD model has been integrated. - There is a bsim3soifd directory under the test - hierarchy. Test circuits come from the bsim3soi - - Web site at: - http://www-device.eecs.berkeley.edu/~bsimsoi - - *) rework-14: removed #ifndef NEWCONV code. - - -BSIM3SOI_DD - SOI Model (dynamic depletion model) - Initial Release. - Ver: 2.1 - Class: M - Level: 56 - Dir: devices/bsim3soi_dd - Status: TO BE TESTED. - - There is a bsim3soidd directory under the - test hierarchy. Test circuits come from bsim3soi - - Web site at: - http://www-device.eecs.berkeley.edu/~bsimsoi - - *) rework-14: removed #ifndef NEWCONV code. - - -BSIM3SOI_PD - SOI model (partially depleted devices) - Initial Release. - Ver: 2.2.1 - Class: M - Level: 57 - Dir: devices/bsim3soi_pd - Status: TO BE TESTED. - - PD model has been integrated. - There is a bsim3soipd directory under the test - hierarchy. Test circuits come from the bsim3soi - - Web site at: - http://www-device.eecs.berkeley.edu/~bsimsoi - - *) rework-14: removed #ifndef NEWCONV code. - - -BSIMSOI - SOI model (partially/full depleted devices) - Initial Release. - Ver: 3.0 - Class: M - Level: 58 - Dir: devices/bsim3soi - Status: TO BE TESTED. - - This is the newer version from Berkeley. - Usable for partially/full depleted devices. - - Web site at: - http://www-device.eecs.berkeley.edu/~bsimsoi - - -SOI3 - STAG SOI3 Model - Initial Release. - Ver: 2.6 - Class: M - Level: 62 - Dir: devices/soi3 - Status: TO BE TESTED - - Web site at: - http://www.micro.ecs.soton.ac.uk/stag/ - - -*************************************************************************** -**************** Other devices not released as source code **************** -*************************************************************************** - -EKV - EKV model - Initial Release. - Ver: 2.6 - Class: M - Level: 44 - Dir: devices/ekv - Status: TO BE TESTED - - Note: This model is not released in source code. - You have to obtain the source code from the address below. - - Web site at: - http://legwww.epfl.ch/ekv/ +src/frontend/device.c: ft_sim->devices[dg->dev_type_no]->name, +src/frontend/device.c: ft_sim->devices[dg->dev_type_no]->description); +src/frontend/device.c: if (ft_sim->devices[dg->dev_type_no]->numModelParms) { +src/frontend/device.c: } else if (ft_sim->devices[dg->dev_type_no]->numModelParms) { +src/frontend/device.c: ft_sim->devices[dg->dev_type_no]->name, +src/frontend/device.c: ft_sim->devices[dg->dev_type_no]->description); +src/frontend/device.c: xcount = *ft_sim->devices[dg->dev_type_no]->numInstanceParms; +src/frontend/device.c: plist = ft_sim->devices[dg->dev_type_no]->instanceParms; +src/frontend/device.c: xcount = *ft_sim->devices[dg->dev_type_no]->numModelParms; +src/frontend/device.c: plist = ft_sim->devices[dg->dev_type_no]->modelParms; +src/frontend/device.c: xcount = *ft_sim->devices[dg->dev_type_no]->numInstanceParms; +src/frontend/device.c: plist = ft_sim->devices[dg->dev_type_no]->instanceParms; +src/frontend/device.c: xcount = *ft_sim->devices[dg->dev_type_no]->numModelParms; +src/frontend/device.c: plist = ft_sim->devices[dg->dev_type_no]->modelParms; +src/frontend/device.c: (*ft_sim->askInstanceQuest)(ft_curckt->ci_ckt, dg->instance, +src/frontend/device.c: (*ft_sim->askModelQuest)(ft_curckt->ci_ckt, dg->model, +src/frontend/gens.c: && (ft_sim->devices[dg->dev_type_no]->flags +src/frontend/misccoms.c: (void) sprintf(buf, SYSTEM_MAIL, ft_sim->simulator, +src/frontend/misccoms.c: ft_sim->version, Bug_Addr); +src/frontend/misccoms.c: fprintf(cp_out, "** %s-%s : %s\n", ft_sim->simulator, +src/frontend/misccoms.c: ft_sim->version, ft_sim->description); +src/frontend/misccoms.c: fprintf(cp_out, "** %s-%s\n", ft_sim->simulator, +src/frontend/misccoms.c: ft_sim->version); +src/frontend/misccoms.c: fprintf(cp_out, "** %s-%s : %s\n", ft_sim->simulator, +src/frontend/misccoms.c: ft_sim->version, ft_sim->description); +src/frontend/misccoms.c: } else if (!eq(ft_sim->version, s)) { +src/frontend/misccoms.c: wl->wl_word, ft_sim->version); +src/frontend/misccoms.c: printf("%s-%s done\n", ft_sim->simulator, ft_sim->version); +src/frontend/outitf.c: fprintf(run->fp, "Command: version %s\n", ft_sim->version); +src/frontend/shyu.c: err=(*(ft_sim->deleteTask))(ft_curckt->ci_ckt, +src/frontend/shyu.c: err = (*(ft_sim->newTask))(ft_curckt->ci_ckt, +src/frontend/shyu.c: for(j=0;jnumAnalyses;j++) { +src/frontend/shyu.c: if(strcmp(ft_sim->analyses[j]->name,"options")==0) { +src/frontend/shyu.c: err = (*(ft_sim->newAnalysis))(ft_curckt->ci_ckt,which,"options", +src/frontend/shyu.c: for(j=0;jnumAnalyses;j++) { +src/frontend/shyu.c: if(strcmp(ft_sim->analyses[j]->name,"SEN")==0) { +src/frontend/shyu.c: err = (*(ft_sim->newAnalysis))(ft_curckt->ci_ckt,which,"sense", +src/frontend/shyu.c: for(j=0;jnumAnalyses;j++) { +src/frontend/shyu.c: if(strcmp(ft_sim->analyses[j]->name,"AC")==0) { +src/frontend/shyu.c: err = (*(ft_sim->newAnalysis))(ft_curckt->ci_ckt,which,"acan", +src/frontend/shyu.c: for(i=0;inumAnalyses;i++) { +src/frontend/shyu.c: if(strcmp(ft_sim->analyses[i]->name,"DCOP")==0) { +src/frontend/shyu.c: err = (*(ft_sim->newAnalysis))(ft_curckt->ci_ckt,which,"dcop", +src/frontend/shyu.c: for(i=0;inumAnalyses;i++) { +src/frontend/shyu.c: if(strcmp(ft_sim->analyses[i]->name,"DCTransfer")==0) { +src/frontend/shyu.c: err = (*(ft_sim->newAnalysis))(ft_curckt->ci_ckt,which,"DCtransfer", +src/frontend/shyu.c: for(j=0;jnumAnalyses;j++) { +src/frontend/shyu.c: if(strcmp(ft_sim->analyses[j]->name,"TRAN")==0) { +src/frontend/shyu.c: err = (*(ft_sim->newAnalysis))(ft_curckt->ci_ckt,which,"tranan", +src/frontend/shyu.c: for(i=0;ianalyses[save]->numParms;i++) { +src/frontend/shyu.c: ft_sim->analyses[save]->analysisParms[i]. +src/frontend/shyu.c: if(ft_sim->analyses[save]->analysisParms[i]. +src/frontend/shyu.c: error = (*(ft_sim->setAnalysisParm))(ckt, +src/frontend/shyu.c: senseJob, ft_sim->analyses[save]-> +src/frontend/shyu.c: parm = INPgetValue(ckt,&line,ft_sim-> +src/frontend/shyu.c: error = (*(ft_sim->setAnalysisParm))(ckt, +src/frontend/shyu.c: senseJob, ft_sim->analyses[save]-> +src/frontend/shyu.c: if(i==ft_sim->analyses[save]->numParms) { +src/frontend/shyu.c: if((err = (*(ft_sim->doAnalyses))(ckt, 1, ft_curckt->ci_curTask))!=OK){ +src/frontend/spiceif.c: err = (*(ft_sim->newCircuit))(&ckt); +src/frontend/spiceif.c: (*(ft_sim->newTask))(ckt,(void**)&(ft_curckt->ci_defTask),taskUid); +src/frontend/spiceif.c: (*(ft_sim->newTask))(ckt,(void**)&(ft_curckt->ci_defTask),taskUid, +src/frontend/spiceif.c: for(j=0;jnumAnalyses;j++) { +src/frontend/spiceif.c: if(strcmp(ft_sim->analyses[j]->name,"options")==0) { +src/frontend/spiceif.c: err = (*(ft_sim->newAnalysis))(ft_curckt->ci_ckt,which,optUid, +src/frontend/spiceif.c: (INPtables *) *tab,ft_curckt->ci_defTask, ft_sim->nodeParms, +src/frontend/spiceif.c: ft_sim->numNodeParms); +src/frontend/spiceif.c: err=(*(ft_sim->deleteTask))(ft_curckt->ci_ckt, +src/frontend/spiceif.c: err = (*(ft_sim->newTask))(ft_curckt->ci_ckt, +src/frontend/spiceif.c: err = (*(ft_sim->newTask))(ft_curckt->ci_ckt, +src/frontend/spiceif.c: for(j=0;jnumAnalyses;j++) { +src/frontend/spiceif.c: if(strcmp(ft_sim->analyses[j]->name,"options")==0) { +src/frontend/spiceif.c: err = (*(ft_sim->newAnalysis))(ft_curckt->ci_ckt,which,optUid, +src/frontend/spiceif.c: if ((err = (*(ft_sim->doAnalyses))(ckt, 1, ft_curckt->ci_curTask))!=OK){ +src/frontend/spiceif.c: if ((err = (*(ft_sim->doAnalyses))(ckt, 0, ft_curckt->ci_curTask))!=OK){ +src/frontend/spiceif.c: for(i=0;inumAnalyses;i++) { +src/frontend/spiceif.c: if(strcmp(ft_sim->analyses[i]->name,"options")==0) { +src/frontend/spiceif.c: for (i = 0; i < ft_sim->analyses[which]->numParms; i++) +src/frontend/spiceif.c: if (eq(ft_sim->analyses[which]->analysisParms[i].keyword, name) && +src/frontend/spiceif.c: (ft_sim->analyses[which]->analysisParms[i].dataType & IF_SET)) +src/frontend/spiceif.c: if (i == ft_sim->analyses[which]->numParms) { +src/frontend/spiceif.c: switch (ft_sim->analyses[which]->analysisParms[i].dataType & IF_VARTYPES) { +src/frontend/spiceif.c: ft_sim->analyses[which]->analysisParms[i].dataType); +src/frontend/spiceif.c: if ((err = (*(ft_sim->setAnalysisParm))(cc, (void *)ft_curckt->ci_curOpt, +src/frontend/spiceif.c: ft_sim->analyses[which]->analysisParms[i].id, &pval, +src/frontend/spiceif.c: if ((err = (*(ft_sim->setAnalysisParm))(cc, (void *)ft_curckt->ci_defOpt, +src/frontend/spiceif.c: ft_sim->analyses[which]->analysisParms[i].id, &pval, +src/frontend/spiceif.c: switch(ft_sim->analyses[which]->analysisParms[i].dataType & IF_VARTYPES) { +src/frontend/spiceif.c: (*(ft_sim->deleteCircuit))(cc); +src/frontend/spiceif.c: device = ft_sim->devices[typecode]; +src/frontend/spiceif.c: device = ft_sim->devices[typecode]; +src/frontend/spiceif.c: device = ft_sim->devices[typecode]; +src/frontend/spiceif.c: err = (*(ft_sim->askInstanceQuest))((void *)ckt, (void *)dev, +src/frontend/spiceif.c: err = (*(ft_sim->askModelQuest))((void*)ckt, (void *) mod, +src/frontend/spiceif.c: err = (*(ft_sim->setInstanceParm))((void *)ckt, (void *)dev, +src/frontend/spiceif.c: err = (*(ft_sim->setModelParm))((void*)ckt, (void *) mod, +src/frontend/spiceif.c: err = (*(ft_sim->findInstance))((void *)ck,&type,devptr,name,NULL,NULL); +src/frontend/spiceif.c: err = (*(ft_sim->findModel))((void *)ck,&type,modptr,name); +src/frontend/spiceif.c: for(i=0;ianalyses[which]->numParms;i++) { +src/frontend/spiceif.c: if(strcmp(ft_sim->analyses[which]->analysisParms[i].keyword,name)==0) { +src/frontend/spiceif.c: return( (*(ft_sim->askAnalysisQuest))(ckt,anal, +src/frontend/spiceif.c: ft_sim->analyses[which]->analysisParms[i].id,parm, +src/frontend/spiceif.c: for(i=0;inumAnalyses;i++) { +src/frontend/spiceif.c: if(strcmp(ft_sim->analyses[i]->name,"TRAN")==0){ +src/frontend/spiceif.c: err =(*(ft_sim->findAnalysis))(ci->ci_ckt,&which, &anal,tranUid, +src/frontend/spiceif.c: for(i=0;inumAnalyses;i++) { +src/frontend/spiceif.c: if(strcmp(ft_sim->analyses[i]->name,"options")==0) { +src/frontend/spiceif.c: for (i = 0; i < ft_sim->analyses[which]->numParms; i++) +src/frontend/spiceif.c: if (eq(ft_sim->analyses[which]->analysisParms[i].keyword, name)) +src/frontend/spiceif.c: if (i == ft_sim->analyses[which]->numParms) +src/frontend/spiceif.c: if ((*(ft_sim->askAnalysisQuest))(ckt, ft_curckt->ci_curTask, +src/frontend/spiceif.c: ft_sim->analyses[which]->analysisParms[i].id, &parm, +src/frontend/spiceif.c: return (parmtovar(&parm, &(ft_sim->analyses[which]->analysisParms[i]))); +src/frontend/spiceif.c: for (i = 0, vars = v = NULL; ianalyses[which]->numParms; i++) { +src/frontend/spiceif.c: if(!(ft_sim->analyses[which]->analysisParms[i].dataType&IF_ASK)) { +src/frontend/spiceif.c: if ((*(ft_sim->askAnalysisQuest))(ckt, ft_curckt->ci_curTask, +src/frontend/spiceif.c: ft_sim->analyses[which]->analysisParms[i].id, +src/frontend/spiceif.c: &(ft_sim->analyses[which]->analysisParms[i])); +src/frontend/spiceif.c: &(ft_sim->analyses[which]->analysisParms[i])); +src/frontend/where.c: msg = (*ft_sim->nonconvErr)((void *) (ft_curckt->ci_ckt), 0); +src/frontend/where.c: msg = (*ft_sim->nonconvErr)((void *) (ft_curckt->ci_ckt), 0); +src/include/inpmacs.h:error=(*(ft_sim->func))args;\ +src/main.c: cp_program = ft_sim->simulator; +src/spicelib/devices/dev.c: * ft_sim->numDevices = num_devices(); +src/spicelib/devices/dev.c: ft_sim->numDevices = DEVNUM; +src/spicelib/devices/dev.c: ft_sim->devices = devices_ptr(); +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "NOISE") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "OP") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "DISTO") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "AC") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "PZ") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "DC") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "TF") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "TRAN") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "SENS") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->numAnalyses; i++) { +src/spicelib/parser/inp2dot.c: if (strcmp(ft_sim->analyses[i]->name, "SENS2") == 0) { +src/spicelib/parser/inp2dot.c: for (i = 0; i < ft_sim->analyses[which]->numParms; i++) { +src/spicelib/parser/inp2dot.c: ft_sim->analyses[which]->analysisParms[i].keyword)) { +src/spicelib/parser/inp2dot.c: if (ft_sim->analyses[which]->analysisParms[i].dataType & IF_FLAG) { +src/spicelib/parser/inp2dot.c: (*(ft_sim->setAnalysisParm)) (ckt, foo, +src/spicelib/parser/inp2dot.c: ft_sim->analyses[which]->analysisParms[i].id, +src/spicelib/parser/inp2dot.c: ft_sim->analyses[which]->analysisParms[i].dataType, tab); +src/spicelib/parser/inp2dot.c: (*(ft_sim->setAnalysisParm)) (ckt, foo, +src/spicelib/parser/inp2dot.c: ft_sim-> +src/spicelib/parser/inp2dot.c: if (i == ft_sim->analyses[which]->numParms) { +src/spicelib/parser/inpapnam.c: if (parmname && ft_sim->analyses[type]) { +src/spicelib/parser/inpapnam.c: for (i = 0; i < ft_sim->analyses[type]->numParms; i++) +src/spicelib/parser/inpapnam.c: ft_sim->analyses[type]->analysisParms[i].keyword) == +src/spicelib/parser/inpapnam.c: return (*(ft_sim->setAnalysisParm)) (ckt, analPtr, +src/spicelib/parser/inpapnam.c: ft_sim-> +src/spicelib/parser/inpdoopt.c: for(i=0;inumAnalyses;i++) { +src/spicelib/parser/inpdoopt.c: prm = ft_sim->analyses[i]; +src/spicelib/parser/inpdoopt.c: error = (*(ft_sim->setAnalysisParm))(ckt,anal, +src/spicelib/parser/inpdpar.c: for (i = 0; i < (*(*(ft_sim->devices)[dev]).numInstanceParms); i++) { +src/spicelib/parser/inpdpar.c: ((*(ft_sim->devices)[dev]).instanceParms[i]. +src/spicelib/parser/inpdpar.c: ((*(ft_sim->devices)[dev]). +src/spicelib/parser/inpdpar.c: error = (*(ft_sim->setInstanceParm)) (ckt, fast, +src/spicelib/parser/inpdpar.c: (*(ft_sim->devices) +src/spicelib/parser/inpdpar.c: if (i == (*(*(ft_sim->devices)[dev]).numInstanceParms)) { +src/spicelib/parser/inpgmod.c: error = (*(ft_sim->newModel)) (ckt, (modtmp)->INPmodType, +src/spicelib/parser/inpgmod.c: for (j = 0; j < (* (*(ft_sim->devices)[(modtmp)->INPmodType]).numModelParms); j++) { +src/spicelib/parser/inpgmod.c: if (strcmp("cpl", ((*(ft_sim->devices) [ (modtmp)->INPmodType ]).modelParms[j].keyword)) == 0) { +src/spicelib/parser/inpgmod.c: if (strcmp(parm,((*(ft_sim->devices)[(modtmp)->INPmodType]).modelParms[j].keyword)) == 0) { +src/spicelib/parser/inpgmod.c: val = INPgetValue(ckt, &line, ((* (ft_sim->devices)[(modtmp)->INPmodType]).modelParms[j].dataType), tab); +src/spicelib/parser/inpgmod.c: error = (*(ft_sim->setModelParm)) (ckt, ((modtmp)->INPmodfast), +src/spicelib/parser/inpgmod.c: (* (ft_sim->devices)[(modtmp)->INPmodType]).modelParms[j].id, +src/spicelib/parser/inpgmod.c: (*(ft_sim->devices) +src/spicelib/parser/inpgtitl.c: error = (*(ft_sim->newCircuit)) (ckt); +src/spicelib/parser/inppname.c: for (i = 0; i < (*(*(ft_sim->devices)[dev]).numInstanceParms); i++) { +src/spicelib/parser/inppname.c: ((*(ft_sim->devices)[dev]).instanceParms[i].keyword)) == +src/spicelib/parser/inppname.c: (*(ft_sim->setInstanceParm)) (ckt, fast, +src/spicelib/parser/inppname.c: (*(ft_sim->devices)[dev]). +src/spicelib/parser/inppname.c: if (i == (*(*(ft_sim->devices)[dev]).numInstanceParms)) { +src/spicelib/parser/inpptree.c: for (i = 0; i < ft_sim->numSpecSigs; i++) +src/spicelib/parser/inpptree.c: if (!strcmp(ft_sim->specSigs[i], buf)) +src/spicelib/parser/inpptree.c: if (i < ft_sim->numSpecSigs) { +src/spicelib/parser/inpsymt.c: error = (*(ft_sim->newNode)) (ckt, &t->t_node, *token); +src/spicelib/parser/inpsymt.c: error = (*(ft_sim->groundNode)) (ckt, &t->t_node, *token); +src/spicelib/parser/inptyplk.c: for (i = 0; i < ft_sim->numDevices; i++) { +src/spicelib/parser/inptyplk.c: printf("In INPtypelook, checking model type = %s against existing model = %s, . . .\n", type, (*(ft_sim->devices)[i]).name ); +src/spicelib/parser/inptyplk.c: if ((ft_sim->devices)[i] && strcmp(type, (*(ft_sim->devices)[i]).name) == 0) { +src/xspice/mif/mifgetmod.c: error = (*(ft_sim->newModel))( ckt,(modtmp)->INPmodType, +src/xspice/mif/mifgetmod.c: for(j=0;j<*((*(ft_sim->devices)[(modtmp)->INPmodType]).numModelParms); j++) { +src/xspice/mif/mifgetmod.c: if (strcmp(parm,((*(ft_sim->devices) [ (modtmp)-> +src/xspice/mif/mifgetmod.c: ((*(ft_sim->devices)[(modtmp)-> +src/xspice/mif/mifgetmod.c: error = (*(ft_sim->setModelParm))(ckt, +src/xspice/mif/mifgetmod.c: (*(ft_sim->devices)[(modtmp)->INPmodType ]). +src/xspice/mif/mifgetmod.c: if(j >= *((*(ft_sim->devices)[(modtmp)->INPmodType]).numModelParms)) diff --git a/src/spicelib/analysis/acan.c b/src/spicelib/analysis/acan.c index 8cb1c86b9..283bbdc53 100644 --- a/src/spicelib/analysis/acan.c +++ b/src/spicelib/analysis/acan.c @@ -392,7 +392,7 @@ CKTacLoad(CKTcircuit *ckt) SMPcClear(ckt->CKTmatrix); for (i=0;iCKThead[i] != NULL) ){ + if ( DEVices[i] && ((*DEVices[i]).DEVacLoad != NULL) && (ckt->CKThead[i] != NULL) ){ error = (*((*DEVices[i]).DEVacLoad))(ckt->CKThead[i],ckt); #ifdef PARALLEL_ARCH if (error) goto combine; diff --git a/src/spicelib/analysis/cktdest.c b/src/spicelib/analysis/cktdest.c index bb52ad1d0..8db82972c 100644 --- a/src/spicelib/analysis/cktdest.c +++ b/src/spicelib/analysis/cktdest.c @@ -40,7 +40,7 @@ CKTdestroy(void *inCkt) #endif for (i=0;iCKThead[i] != NULL) ){ + if ( DEVices[i] && ((*DEVices[i]).DEVdestroy != NULL) && (ckt->CKThead[i] != NULL) ){ (*((*DEVices[i]).DEVdestroy))(&(ckt->CKThead[i])); } } diff --git a/src/spicelib/analysis/cktdisto.c b/src/spicelib/analysis/cktdisto.c index ceaf699b0..bbc3d2484 100644 --- a/src/spicelib/analysis/cktdisto.c +++ b/src/spicelib/analysis/cktdisto.c @@ -32,7 +32,7 @@ CKTdisto (CKTcircuit *ckt, int mode) case D_SETUP: for (i=0;iCKThead[i] != NULL) ){ + if ( DEVices[i] && ((*DEVices[i]).DEVdisto != NULL) && (ckt->CKThead[i] != NULL) ){ error = (*((*DEVices[i]).DEVdisto))(mode,ckt->CKThead[i],ckt); if(error) return(error); } @@ -53,7 +53,7 @@ CKTdisto (CKTcircuit *ckt, int mode) } for (i=0;iCKThead[i] != NULL) ){ + if ( DEVices[i] && ((*DEVices[i]).DEVdisto != NULL) && (ckt->CKThead[i] != NULL) ){ error = (*((*DEVices[i]).DEVdisto))(mode,ckt->CKThead[i],ckt); if(error) return(error); } diff --git a/src/spicelib/analysis/cktdump.c b/src/spicelib/analysis/cktdump.c index c8c115c85..6c3a329fb 100644 --- a/src/spicelib/analysis/cktdump.c +++ b/src/spicelib/analysis/cktdump.c @@ -56,7 +56,7 @@ CKTdump(CKTcircuit *ckt, double ref, void *plot) */ for (i=0; iCKThead[i] != NULL) ){ (*((*DEVices[i]).DEVdump))(ckt->CKThead[i],ckt); } @@ -89,7 +89,7 @@ NDEVacct(CKTcircuit *ckt, FILE *file) } for (i=0; iCKThead[i] != NULL) ){ (*((*DEVices[i]).DEVacct))(ckt->CKThead[i],ckt, file); } diff --git a/src/spicelib/analysis/cktfbran.c b/src/spicelib/analysis/cktfbran.c index ad7b657c7..36806447f 100644 --- a/src/spicelib/analysis/cktfbran.c +++ b/src/spicelib/analysis/cktfbran.c @@ -25,7 +25,7 @@ CKTfndBranch(CKTcircuit *ckt, IFuid name) int j; for (i=0;iCKThead[i] != NULL) { + if ( DEVices[i] && (*DEVices[i]).DEVfindBranch != NULL && ckt->CKThead[i] != NULL ) { j = (*((*DEVices[i]).DEVfindBranch))(ckt,ckt->CKThead[i],name); if(j != 0) return(j); } diff --git a/src/spicelib/analysis/cktic.c b/src/spicelib/analysis/cktic.c index dcd595f6a..50c47e512 100644 --- a/src/spicelib/analysis/cktic.c +++ b/src/spicelib/analysis/cktic.c @@ -47,7 +47,7 @@ CKTic(CKTcircuit *ckt) if(ckt->CKTmode & MODEUIC) { for (i=0;iCKThead[i] != NULL) ){ + if( DEVices[i] && ((*DEVices[i]).DEVsetic != NULL) && (ckt->CKThead[i] != NULL) ){ error = (*((*DEVices[i]).DEVsetic))(ckt->CKThead[i],ckt); if(error) return(error); } diff --git a/src/spicelib/analysis/cktload.c b/src/spicelib/analysis/cktload.c index b196d3b82..16a2c025c 100644 --- a/src/spicelib/analysis/cktload.c +++ b/src/spicelib/analysis/cktload.c @@ -64,7 +64,7 @@ CKTload(CKTcircuit *ckt) #endif /* STEPDEBUG */ for (i=0;iCKThead[i] != NULL) ){ + if ( DEVices[i] && ((*DEVices[i]).DEVload != NULL) && (ckt->CKThead[i] != NULL) ){ error = (*((*DEVices[i]).DEVload))(ckt->CKThead[i],ckt); if (ckt->CKTnoncon) ckt->CKTtroubleNode = 0; diff --git a/src/spicelib/analysis/cktnoise.c b/src/spicelib/analysis/cktnoise.c index 05f17af4a..5c40e43e8 100644 --- a/src/spicelib/analysis/cktnoise.c +++ b/src/spicelib/analysis/cktnoise.c @@ -35,7 +35,7 @@ CKTnoise (CKTcircuit *ckt, int mode, int operation, Ndata *data) /* let each device decide how many and what type of noise sources it has */ for (i=0; i < DEVmaxnum; i++) { - if ( ((*DEVices[i]).DEVnoise != NULL) && (ckt->CKThead[i] != NULL) ) { + if ( DEVices[i] && ((*DEVices[i]).DEVnoise != NULL) && (ckt->CKThead[i] != NULL) ) { error = (*((*DEVices[i]).DEVnoise))(mode,operation,ckt->CKThead[i], ckt,data, &outNdens); if (error) return (error); diff --git a/src/spicelib/analysis/cktop.c b/src/spicelib/analysis/cktop.c index 0b64da41a..4aec50a1d 100644 --- a/src/spicelib/analysis/cktop.c +++ b/src/spicelib/analysis/cktop.c @@ -99,7 +99,7 @@ CKTconvTest (CKTcircuit * ckt) for (i = 0; i < DEVmaxnum; i++) { - if (((*DEVices[i]).DEVconvTest != NULL) && (ckt->CKThead[i] != NULL)) + if (DEVices[i] && ((*DEVices[i]).DEVconvTest != NULL) && (ckt->CKThead[i] != NULL)) { error = (*((*DEVices[i]).DEVconvTest)) (ckt->CKThead[i], ckt); } diff --git a/src/spicelib/analysis/cktpzld.c b/src/spicelib/analysis/cktpzld.c index 63f589bf5..928686b5f 100644 --- a/src/spicelib/analysis/cktpzld.c +++ b/src/spicelib/analysis/cktpzld.c @@ -31,7 +31,7 @@ CKTpzLoad(CKTcircuit *ckt, SPcomplex *s) SMPcClear(ckt->CKTmatrix); for (i = 0; i < DEVmaxnum; i++) { - if (DEVices[i]->DEVpzLoad != NULL && ckt->CKThead[i] != NULL) { + if (DEVices[i] && DEVices[i]->DEVpzLoad != NULL && ckt->CKThead[i] != NULL) { error = (*DEVices[i]->DEVpzLoad)(ckt->CKThead[i], ckt, s); #ifdef PARALLEL_ARCH if (error) goto combine; diff --git a/src/spicelib/analysis/cktpzset.c b/src/spicelib/analysis/cktpzset.c index 70e85754f..cfa75bb3f 100644 --- a/src/spicelib/analysis/cktpzset.c +++ b/src/spicelib/analysis/cktpzset.c @@ -35,7 +35,7 @@ CKTpzSetup(CKTcircuit *ckt, int type) ckt->CKTnumStates = 0; for (i = 0; i < DEVmaxnum; i++) { - if (DEVices[i]->DEVpzSetup != NULL && ckt->CKThead[i] != NULL) { + if (DEVices[i] && DEVices[i]->DEVpzSetup != NULL && ckt->CKThead[i] != NULL) { error = (*DEVices[i]->DEVpzSetup)(matrix, ckt->CKThead[i], ckt, &ckt->CKTnumStates); if (error != OK) diff --git a/src/spicelib/analysis/cktsetup.c b/src/spicelib/analysis/cktsetup.c index 83f9db13c..b349a8feb 100644 --- a/src/spicelib/analysis/cktsetup.c +++ b/src/spicelib/analysis/cktsetup.c @@ -57,7 +57,7 @@ CKTsetup(CKTcircuit *ckt) matrix = ckt->CKTmatrix; for (i=0;iCKThead[i] != NULL) ){ + if ( DEVices[i] && ((*DEVices[i]).DEVsetup != NULL) && (ckt->CKThead[i] != NULL) ){ error = (*((*DEVices[i]).DEVsetup))(matrix,ckt->CKThead[i],ckt, &ckt->CKTnumStates); if(error) return(error); @@ -136,7 +136,7 @@ CKTunsetup(CKTcircuit *ckt) } for (i=0;iCKThead[i] != NULL) ){ + if ( DEVices[i] && ((*DEVices[i]).DEVunsetup != NULL) && (ckt->CKThead[i] != NULL) ){ e2 = (*((*DEVices[i]).DEVunsetup))(ckt->CKThead[i],ckt); if (!error && e2) error = e2; diff --git a/src/spicelib/analysis/ckttemp.c b/src/spicelib/analysis/ckttemp.c index 11aa073f3..f839ce3ef 100644 --- a/src/spicelib/analysis/ckttemp.c +++ b/src/spicelib/analysis/ckttemp.c @@ -31,7 +31,7 @@ CKTtemp(CKTcircuit *ckt) ckt->CKTvt = CONSTKoverQ * ckt->CKTtemp; for (i=0;iCKThead[i] != NULL) ){ error = (*((*DEVices[i]).DEVtemperature))(ckt->CKThead[i],ckt); if(error) return(error); diff --git a/src/spicelib/analysis/ckttrunc.c b/src/spicelib/analysis/ckttrunc.c index 137fb1e56..fec405aa0 100644 --- a/src/spicelib/analysis/ckttrunc.c +++ b/src/spicelib/analysis/ckttrunc.c @@ -39,7 +39,7 @@ CKTtrunc(CKTcircuit *ckt, double *timeStep) timetemp = HUGE; for (i=0;iCKThead[i] != NULL) { + if (DEVices[i] && (*DEVices[i]).DEVtrunc != NULL && ckt->CKThead[i] != NULL) { #ifdef STEPDEBUG debugtemp = timetemp; #endif /* STEPDEBUG */ diff --git a/src/spicelib/analysis/ckttyplk.c b/src/spicelib/analysis/ckttyplk.c index 9177cc9dc..28b1ac1b0 100644 --- a/src/spicelib/analysis/ckttyplk.c +++ b/src/spicelib/analysis/ckttyplk.c @@ -21,7 +21,7 @@ CKTtypelook(char *type) int i; for(i=0;iCKThead[i] != NULL) ){ + if ( devs[i] && ((*devs[i]).DEVaccept != NULL) && (ckt->CKThead[i] != NULL) ){ error = (*((*devs[i]).DEVaccept))(ckt,ckt->CKThead[i]); if (error) return(error); diff --git a/src/spicelib/devices/dev.c b/src/spicelib/devices/dev.c index 8792c7a81..abc898362 100644 --- a/src/spicelib/devices/dev.c +++ b/src/spicelib/devices/dev.c @@ -136,77 +136,11 @@ int add_udn(int,Evt_Udn_Info_t **); #endif /*saj in xspice the DEVices size can be varied so DEVNUM is an int*/ -#ifdef CIDER - - #ifdef ADMS - - #ifdef NDEV - #ifdef XSPICE - static int DEVNUM = 57; - #else - #define DEVNUM 57 - #endif - #else /* no ndev */ - #ifdef XSPICE - static int DEVNUM = 56; - #else - #define DEVNUM 56 - #endif - #endif /* NDEV */ - - #else /* NOT ADMS */ - #ifdef NDEV - #ifdef XSPICE - static int DEVNUM = 53; - #else - #define DEVNUM 53 - #endif - #else - #ifdef XSPICE - static int DEVNUM = 52; - #else - #define DEVNUM 52 - #endif - #endif /* NDEV */ - #endif /* ADMS */ - -#else /* NOT CIDER */ - - #ifdef ADMS - - #ifdef NDEV - #ifdef XSPICE - static int DEVNUM = 53; /* was 52 */ - #else - #define DEVNUM 53 /* was 52 */ - #endif - #else /* no ndev */ - #ifdef XSPICE - static int DEVNUM = 52; /* was 51 */ - #else - #define DEVNUM 52 /* was 51 */ - #endif - #endif /* NDEV */ - - #else /* NOT ADMS */ - - #ifdef NDEV - #ifdef XSPICE - static int DEVNUM = 48; - #else - #define DEVNUM 48 - #endif - #else /* no ndev */ - #ifdef XSPICE - static int DEVNUM = 47; - #else - #define DEVNUM 47 - #endif - #endif /* NDEV */ - - #endif /* ADMS */ - -#endif /* CIDER */ +#ifdef XSPICE + static int DEVNUM = 60; +#else + #define DEVNUM 60 +#endif /*Make this dynamic for later attempt to make all devices dynamic*/ SPICEdev **DEVices=NULL; @@ -293,66 +227,50 @@ spice_init_devices(void) DEVices[48] = get_nbjt2_info(); DEVices[49] = get_numd_info(); DEVices[50] = get_numd2_info(); - DEVices[51] = get_numos_info(); - #ifdef ADMS + DEVices[51] = get_numos_info(); +#else + DEVices[47] = NULL; + DEVices[48] = NULL; + DEVices[49] = NULL; + DEVices[50] = NULL; + DEVices[51] = NULL; +#endif + +#ifdef ADMS DEVices[52] = get_hicum0_info(); DEVices[53] = get_hicum2_info(); DEVices[54] = get_mextram_info(); DEVices[55] = get_ekv_info(); DEVices[56] = get_psp102_info(); - #ifdef NDEV /* NDEV */ - DEVices[57] = get_ndev_info(); - assert(58 == DEVNUM); - #else - assert(57 == DEVNUM); - #endif - #else /* NOT ADMS */ - #ifdef NDEV /* NDEV */ - DEVices[52] = get_ndev_info(); - assert(53 == DEVNUM); - #else - assert(52 == DEVNUM); - #endif - #endif /* ADMS */ -#else /* NOT CIDER */ - #ifdef ADMS - DEVices[47] = get_hicum0_info(); - DEVices[48] = get_hicum2_info(); - DEVices[49] = get_mextram_info(); - DEVices[50] = get_ekv_info(); - DEVices[51] = get_psp102_info(); - #ifdef NDEV /* NDEV */ - DEVices[52] = get_ndev_info(); - assert(53 == DEVNUM); - #else - assert(52 == DEVNUM); - #endif - #else /* NOT ADMS */ - #ifdef NDEV /* NDEV */ - DEVices[47] = get_ndev_info(); - assert(48 == DEVNUM); - #else - assert(47 == DEVNUM); - #endif - #endif /* ADMS */ -#endif /* CIDER */ - return; +#else + DEVices[52] = NULL; + DEVices[53] = NULL; + DEVices[54] = NULL; + DEVices[55] = NULL; + DEVices[56] = NULL; +#endif + +#ifdef NDEV /* NDEV */ + DEVices[57] = get_ndev_info(); +#else + DEVices[57] = NULL; +#endif + DEVices[58] = NULL; + DEVices[59] = NULL; + return; } -int -num_devices(void) +int num_devices(void) { return DEVNUM; } -IFdevice ** -devices_ptr(void) +IFdevice ** devices_ptr(void) { return (IFdevice **) DEVices; } -SPICEdev ** -devices(void) +SPICEdev ** devices(void) { return DEVices; } diff --git a/src/spicelib/devices/dev_old.c b/src/spicelib/devices/dev_old.c new file mode 100644 index 000000000..8792c7a81 --- /dev/null +++ b/src/spicelib/devices/dev_old.c @@ -0,0 +1,581 @@ +/* NG-SPICE -- An electrical circuit simulator + * + * Copyright (c) 1990 University of California + * Copyright (c) 2000 Arno W. Peters + * + * $Id$ + * + * Permission to use, copy, modify, and distribute this software and + * its documentation without fee, and without a written agreement is + * hereby granted, provided that the above copyright notice, this + * paragraph and the following three paragraphs appear in all copies. + * + * This software program and documentation are copyrighted by their + * authors. The software program and documentation are supplied "as + * is", without any accompanying services from the authors. The + * authors do not warrant that the operation of the program will be + * uninterrupted or error-free. The end-user understands that the + * program was developed for research purposes and is advised not to + * rely exclusively on the program for any reason. + * + * IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, + * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING + * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS + * DOCUMENTATION, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. THE AUTHORS SPECIFICALLY DISCLAIMS ANY + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE + * SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS + * HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, + * ENHANCEMENTS, OR MODIFICATIONS. */ + +#include "config.h" +#include "assert.h" + +#include "devdefs.h" +#include "ifsim.h" + +#include "dev.h" +#include "memory.h" /* to alloc, realloc devices*/ + + +#ifdef XSPICE +/*saj headers for xspice*/ +#include /* for strcpy, strcat*/ +#ifndef HAS_WINDOWS +#include /* to load libraries*/ +#else /* ifdef HAS_WINDOWS */ +#include +#include "wstdio.h" +void *dlopen (const char *, int); +void *dlsym (void *, const char *); +int dlclose (void *); +char *dlerror (void); +#define RTLD_LAZY 1 /* lazy function call binding */ +#define RTLD_NOW 2 /* immediate function call binding */ +#define RTLD_GLOBAL 4 /* symbols in this dlopen'ed obj are visible to other dlopen'ed objs */ +static char errstr[128]; +#endif /* ifndef HAS_WINDOWS */ +#include "dllitf.h" /* the coreInfo Structure*/ +#include "evtudn.h" /*Use defined nodes */ + +Evt_Udn_Info_t **g_evt_udn_info = NULL; +int g_evt_num_udn_types = 0; + +/*The digital node type */ +extern Evt_Udn_Info_t idn_digital_info; + +int add_udn(int,Evt_Udn_Info_t **); +/*saj*/ +#endif + + +#include "asrc/asrcitf.h" +#include "bjt/bjtitf.h" +#include "bjt2/bjt2itf.h" +#include "bsim1/bsim1itf.h" +#include "bsim2/bsim2itf.h" +#include "bsim3/bsim3itf.h" +#include "bsim3v0/bsim3v0itf.h" +#include "bsim3v1/bsim3v1itf.h" +#include "bsim3v1a/bsim3v1aitf.h" +#include "bsim3v1s/bsim3v1sitf.h" +#include "bsim3soi/b3soiitf.h" +#include "bsim4/bsim4itf.h" +#include "bsim3soi_pd/b3soipditf.h" +#include "bsim3soi_fd/b3soifditf.h" +#include "bsim3soi_dd/b3soidditf.h" +#include "cap/capitf.h" +#include "cccs/cccsitf.h" +#include "ccvs/ccvsitf.h" +#include "csw/cswitf.h" +#include "dio/dioitf.h" +#include "hfet1/hfetitf.h" +#include "hfet2/hfet2itf.h" +#include "hisim/hsm1itf.h" +#include "ind/inditf.h" +#include "isrc/isrcitf.h" +#include "jfet/jfetitf.h" +#include "jfet2/jfet2itf.h" +#include "ltra/ltraitf.h" +#include "mes/mesitf.h" +#include "mesa/mesaitf.h" +#include "mos1/mos1itf.h" +#include "mos2/mos2itf.h" +#include "mos3/mos3itf.h" +#include "mos6/mos6itf.h" +#include "mos9/mos9itf.h" +#include "cpl/cplitf.h" +#include "res/resitf.h" +#include "soi3/soi3itf.h" +#include "sw/switf.h" +#include "tra/traitf.h" +#include "txl/txlitf.h" +#include "urc/urcitf.h" +#include "vbic/vbicitf.h" +#include "vccs/vccsitf.h" +#include "vcvs/vcvsitf.h" +#include "vsrc/vsrcitf.h" +#ifdef ADMS +#include "adms/hicum0/hicum0itf.h" +#include "adms/hicum2/hicum2itf.h" +#include "adms/mextram/mextramitf.h" +#include "adms/ekv/ekvitf.h" +#include "adms/psp102/psp102itf.h" +#endif +#ifdef CIDER +/* Numerical devices (Cider integration) */ +#include "nbjt/nbjtitf.h" +#include "nbjt2/nbjt2itf.h" +#include "numd/numditf.h" +#include "numd2/numd2itf.h" +#include "numos/numositf.h" +#endif +#ifdef NDEV +#include "ndev/ndevitf.h" +#endif + +/*saj in xspice the DEVices size can be varied so DEVNUM is an int*/ +#ifdef CIDER + + #ifdef ADMS + + #ifdef NDEV + #ifdef XSPICE + static int DEVNUM = 57; + #else + #define DEVNUM 57 + #endif + #else /* no ndev */ + #ifdef XSPICE + static int DEVNUM = 56; + #else + #define DEVNUM 56 + #endif + #endif /* NDEV */ + + #else /* NOT ADMS */ + #ifdef NDEV + #ifdef XSPICE + static int DEVNUM = 53; + #else + #define DEVNUM 53 + #endif + #else + #ifdef XSPICE + static int DEVNUM = 52; + #else + #define DEVNUM 52 + #endif + #endif /* NDEV */ + #endif /* ADMS */ + +#else /* NOT CIDER */ + + #ifdef ADMS + + #ifdef NDEV + #ifdef XSPICE + static int DEVNUM = 53; /* was 52 */ + #else + #define DEVNUM 53 /* was 52 */ + #endif + #else /* no ndev */ + #ifdef XSPICE + static int DEVNUM = 52; /* was 51 */ + #else + #define DEVNUM 52 /* was 51 */ + #endif + #endif /* NDEV */ + + #else /* NOT ADMS */ + + #ifdef NDEV + #ifdef XSPICE + static int DEVNUM = 48; + #else + #define DEVNUM 48 + #endif + #else /* no ndev */ + #ifdef XSPICE + static int DEVNUM = 47; + #else + #define DEVNUM 47 + #endif + #endif /* NDEV */ + + #endif /* ADMS */ + +#endif /* CIDER */ + +/*Make this dynamic for later attempt to make all devices dynamic*/ +SPICEdev **DEVices=NULL; + +/*Flag to indicate that device type it is, + *0 = normal spice device + *1 = xspice device + */ +#ifdef XSPICE +int *DEVicesfl=NULL; +int DEVflag(int type){ + if(type < DEVNUM && type >= 0) + return DEVicesfl[type]; + else + return -1; +} +#endif + + +void +spice_init_devices(void) +{ +#ifdef XSPICE + /*Initilise the structs and add digital node type */ + g_evt_udn_info = (Evt_Udn_Info_t **)MALLOC(sizeof(Evt_Udn_Info_t *)); + g_evt_num_udn_types = 1; + g_evt_udn_info[0] = &idn_digital_info; + + DEVicesfl = (int *)tmalloc(DEVNUM*sizeof(int)); + /* tmalloc should automatically zero the array! */ +#endif + + DEVices = (SPICEdev **)tmalloc(DEVNUM*sizeof(SPICEdev *)); + /* URC device MUST precede both resistors and capacitors */ + DEVices[ 0] = get_urc_info(); + DEVices[ 1] = get_asrc_info(); + DEVices[ 2] = get_bjt_info(); + DEVices[ 3] = get_bjt2_info(); + DEVices[ 4] = get_bsim1_info(); + DEVices[ 5] = get_bsim2_info(); + DEVices[ 6] = get_bsim3_info(); + DEVices[ 7] = get_bsim3v0_info(); + DEVices[ 8] = get_bsim3v1_info(); + DEVices[ 9] = get_bsim3v1a_info(); + DEVices[10] = get_bsim3v1s_info(); + DEVices[11] = get_b3soi_info(); + DEVices[12] = get_bsim4_info(); + DEVices[13] = get_b3soipd_info(); + DEVices[14] = get_b3soifd_info(); + DEVices[15] = get_b3soidd_info(); + DEVices[16] = get_cap_info(); + DEVices[17] = get_cccs_info(); + DEVices[18] = get_ccvs_info(); + DEVices[19] = get_cpl_info(); + DEVices[20] = get_csw_info(); + DEVices[21] = get_dio_info(); + DEVices[22] = get_hfeta_info(); + DEVices[23] = get_hfet2_info(); + DEVices[24] = get_hsm1_info(); + DEVices[25] = get_ind_info(); + DEVices[26] = get_mut_info(); + DEVices[27] = get_isrc_info(); + DEVices[28] = get_jfet_info(); + DEVices[29] = get_jfet2_info(); + DEVices[30] = get_ltra_info(); + DEVices[31] = get_mes_info(); + DEVices[32] = get_mesa_info(); + DEVices[33] = get_mos1_info(); + DEVices[34] = get_mos2_info(); + DEVices[35] = get_mos3_info(); + DEVices[36] = get_mos6_info(); + DEVices[37] = get_mos9_info(); + DEVices[38] = get_res_info(); + DEVices[39] = get_soi3_info(); + DEVices[40] = get_sw_info(); + DEVices[41] = get_tra_info(); + DEVices[42] = get_txl_info(); + DEVices[43] = get_vbic_info(); + DEVices[44] = get_vccs_info(); + DEVices[45] = get_vcvs_info(); + DEVices[46] = get_vsrc_info(); +#ifdef CIDER + DEVices[47] = get_nbjt_info(); + DEVices[48] = get_nbjt2_info(); + DEVices[49] = get_numd_info(); + DEVices[50] = get_numd2_info(); + DEVices[51] = get_numos_info(); + #ifdef ADMS + DEVices[52] = get_hicum0_info(); + DEVices[53] = get_hicum2_info(); + DEVices[54] = get_mextram_info(); + DEVices[55] = get_ekv_info(); + DEVices[56] = get_psp102_info(); + #ifdef NDEV /* NDEV */ + DEVices[57] = get_ndev_info(); + assert(58 == DEVNUM); + #else + assert(57 == DEVNUM); + #endif + #else /* NOT ADMS */ + #ifdef NDEV /* NDEV */ + DEVices[52] = get_ndev_info(); + assert(53 == DEVNUM); + #else + assert(52 == DEVNUM); + #endif + #endif /* ADMS */ +#else /* NOT CIDER */ + #ifdef ADMS + DEVices[47] = get_hicum0_info(); + DEVices[48] = get_hicum2_info(); + DEVices[49] = get_mextram_info(); + DEVices[50] = get_ekv_info(); + DEVices[51] = get_psp102_info(); + #ifdef NDEV /* NDEV */ + DEVices[52] = get_ndev_info(); + assert(53 == DEVNUM); + #else + assert(52 == DEVNUM); + #endif + #else /* NOT ADMS */ + #ifdef NDEV /* NDEV */ + DEVices[47] = get_ndev_info(); + assert(48 == DEVNUM); + #else + assert(47 == DEVNUM); + #endif + #endif /* ADMS */ +#endif /* CIDER */ + return; +} + +int +num_devices(void) +{ + return DEVNUM; +} + +IFdevice ** +devices_ptr(void) +{ + return (IFdevice **) DEVices; +} + +SPICEdev ** +devices(void) +{ + return DEVices; +} + + +#ifdef DEVLIB +/*not yet usable*/ + +#ifdef ADMS +#define DEVICES_USED {"asrc", "bjt", "bjt2", "vbic", "bsim1", "bsim2", "bsim3", "bsim3v2", "bsim3v1", "bsim4", "bsim3soipd", "bsim3soifd", "bsim3soidd", \ + "cap", "cccs", "ccvs", "csw", "dio", "hfet", "hfet2", "ind", "isrc", "jfet", "ltra", "mes", "mesa" ,"mos1", "mos2", "mos3", \ + "mos6", "mos9", "res", "soi3", "sw", "tra", "urc", "vccs", "vcvs", "vsrc", "hicum0", "hicum2", "mextram", "ekv", "psp102"} +#else +#define DEVICES_USED {"asrc", "bjt", "bjt2", "vbic", "bsim1", "bsim2", "bsim3", "bsim3v2", "bsim3v1", "bsim4", "bsim3soipd", "bsim3soifd", "bsim3soidd", \ + "cap", "cccs", "ccvs", "csw", "dio", "hfet", "hfet2", "ind", "isrc", "jfet", "ltra", "mes", "mesa" ,"mos1", "mos2", "mos3", \ + "mos6", "mos9", "res", "soi3", "sw", "tra", "urc", "vccs", "vcvs", "vsrc"} +#endif +int load_dev(char *name) { + char *msg; + char libname[50]; + void *lib; + SPICEdev *(*fetch)(void)=NULL; + SPICEdev *device; + + strcpy(libname, "lib"); + strcat(libname,name); + strcat(libname,".so"); + + lib = dlopen(libname,RTLD_NOW); + if(!lib){ + msg = dlerror(); + printf("%s\n", msg); + return 1; + } + + strcpy(libname, "get_"); + strcat(libname,name); + strcat(libname,"_info"); + fetch = dlsym(lib,libname); + + if(!fetch){ + msg = dlerror(); + printf("%s\n", msg); + return 1; + } + device = fetch(); + add_device(1,&device,0); + return 0; +} + +void load_alldevs(void){ + char *devs[] = DEVICES_USED; + int num = sizeof(devs)/sizeof(char *); + int i; + for(i=0; i< num;i++) + load_dev(devs[i]); + return; +} +#endif + +/*-------------------- XSPICE additions below ----------------------*/ +#ifdef XSPICE +#include "mif.h" +#include "cm.h" +#include "cpextern.h" +#include "fteext.h" /* for ft_sim */ +#include "cktdefs.h" /* for DEVmaxnum */ + +static void relink() { + /* added by SDB; DEVmaxnum is an external int defined in cktdefs.h */ + extern int DEVmaxnum; + +/* + * This replacement done by SDB on 6.11.2003 + * + * ft_sim->numDevices = num_devices(); + * DEVmaxnum = num_devices(); + */ + ft_sim->numDevices = DEVNUM; + DEVmaxnum = DEVNUM; + + ft_sim->devices = devices_ptr(); + return; +} + +int add_device(int n, SPICEdev **devs, int flag){ + int i; + DEVices = (SPICEdev **)trealloc(DEVices,(DEVNUM+n)*sizeof(SPICEdev *)); + DEVicesfl = (int *)trealloc(DEVicesfl,(DEVNUM+n)*sizeof(int)); + for(i = 0; i < n;i++){ + /*debug*/printf("Added device: %s\n",devs[i]->DEVpublic.name); + DEVices[DEVNUM+i] = devs[i]; + + /* added by SDB on 6.20.2003 */ + DEVices[DEVNUM+i]->DEVinstSize = &MIFiSize; + + DEVicesfl[DEVNUM+i] = flag; + } + DEVNUM += n; + relink(); + return 0; +} + +int add_udn(int n,Evt_Udn_Info_t **udns){ + int i; + g_evt_udn_info = (Evt_Udn_Info_t **)trealloc(g_evt_udn_info,(g_evt_num_udn_types+n)*sizeof(Evt_Udn_Info_t *)); + for(i = 0; i < n;i++){ + /*debug*/printf("Added udn: %s\n",udns[i]->name); + g_evt_udn_info[g_evt_num_udn_types+i] = udns[i]; + } + g_evt_num_udn_types += n; + return 0; +} + +extern struct coreInfo_t coreInfo; + +int load_opus(char *name){ + void *lib; + const char *msg; + int *num=NULL; + struct coreInfo_t **core; + SPICEdev **devs; + Evt_Udn_Info_t **udns; + void *(*fetch)(void)=NULL; + + lib = dlopen(name,RTLD_NOW); + if(!lib){ + msg = dlerror(); + printf("%s\n", msg); + return 1; + } + + fetch = dlsym(lib,"CMdevNum"); + if(fetch){ + num = (int *)(*fetch)(); + printf("Got %u devices.\n",*num); + fetch = NULL; + }else{ + msg = dlerror(); + printf("%s\n", msg); + return 1; + } + + fetch = dlsym(lib,"CMdevs"); + if(fetch){ + devs = (SPICEdev **)(*fetch)(); + fetch = NULL; + }else{ + msg = dlerror(); + printf("%s\n", msg); + return 1; + } + + fetch = dlsym(lib,"CMgetCoreItfPtr"); + if(fetch){ + core = (struct coreInfo_t **)(*fetch)(); + *core = &coreInfo; + fetch = NULL; + }else{ + msg = dlerror(); + printf("%s\n", msg); + return 1; + } + add_device(*num,devs,1); + + fetch = dlsym(lib,"CMudnNum"); + if(fetch){ + num = (int *)(*fetch)(); + printf("Got %u udns.\n",*num); + fetch = NULL; + }else{ + msg = dlerror(); + printf("%s\n", msg); + return 1; + } + + fetch = dlsym(lib,"CMudns"); + if(fetch){ + udns = (Evt_Udn_Info_t **)(*fetch)(); + fetch = NULL; + }else{ + msg = dlerror(); + printf("%s\n", msg); + return 1; + } + + add_udn(*num,udns); + + return 0; +} + +#if defined(__MINGW32__) || defined(HAS_WINDOWS) + +void *dlopen(const char *name,int type) +{ + return LoadLibrary(name); +} + +void *dlsym(void *hDll, const char *funcname) +{ + return GetProcAddress(hDll, funcname); +} + +char *dlerror(void) +{ + LPVOID lpMsgBuf; + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, + NULL + ); + strcpy(errstr,lpMsgBuf); + LocalFree(lpMsgBuf); + return errstr; +} +#endif + +#endif +/*-------------------- end of XSPICE additions ----------------------*/ diff --git a/src/spicelib/parser/inptyplk.c b/src/spicelib/parser/inptyplk.c index 40598c1f3..35df84949 100644 --- a/src/spicelib/parser/inptyplk.c +++ b/src/spicelib/parser/inptyplk.c @@ -31,7 +31,7 @@ int INPtypelook(char *type) printf("In INPtypelook, checking model type = %s against existing model = %s, . . .\n", type, (*(ft_sim->devices)[i]).name ); #endif - if (strcmp(type, (*(ft_sim->devices)[i]).name) == 0) { + if ((ft_sim->devices)[i] && strcmp(type, (*(ft_sim->devices)[i]).name) == 0) { /*found the device - return it */ #ifdef TRACE