diff --git a/compile_macos_clang_M2_shared.sh b/compile_macos_clang_M2_shared.sh index 3ba0e1ef9..575c2e417 100644 --- a/compile_macos_clang_M2_shared.sh +++ b/compile_macos_clang_M2_shared.sh @@ -21,14 +21,14 @@ SECONDS=0 if test "$1" = "d"; then - if [ ! -d "debug" ]; then - mkdir debug - if [ $? -ne 0 ]; then echo "mkdir debug failed"; exit 1 ; fi + if [ ! -d "debug_sh" ]; then + mkdir debug_sh + if [ $? -ne 0 ]; then echo "mkdir debug_sh failed"; exit 1 ; fi fi else - if [ ! -d "release" ]; then - mkdir release - if [ $? -ne 0 ]; then echo "mkdir release failed"; exit 1 ; fi + if [ ! -d "release_sh" ]; then + mkdir release_sh + if [ $? -ne 0 ]; then echo "mkdir release_sh failed"; exit 1 ; fi fi fi @@ -38,15 +38,15 @@ if [ $? -ne 0 ]; then echo "./autogen.sh failed"; exit 1 ; fi echo if test "$1" = "d"; then - cd debug - if [ $? -ne 0 ]; then echo "cd debug failed"; exit 1 ; fi + cd debug_sh + if [ $? -ne 0 ]; then echo "cd debug_sh failed"; exit 1 ; fi echo "configuring for 64 bit debug" echo ../configure --with-ngshared --enable-cider --with-readline=/opt/homebrew/opt/readline --enable-debug CFLAGS="-m64 -O0 -g -Wall -I/opt/X11/include/freetype2 -I/opt/homebrew/opt/readline/include" LDFLAGS="-m64 -g -L/opt/homebrew/opt/readline/lib -L/opt/X11/lib -L/usr/local/lib -lomp" else - cd release - if [ $? -ne 0 ]; then echo "cd release failed"; exit 1 ; fi + cd release_sh + if [ $? -ne 0 ]; then echo "cd release_sh failed"; exit 1 ; fi echo "configuring for 64 bit release" echo ../configure --with-ngshared --enable-cider --with-readline=/opt/homebrew/opt/readline CFLAGS="-m64 -O2 -I/opt/X11/include/freetype2 -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/ncurses/include" LDFLAGS="-m64 -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/ncurses/lib -L/opt/X11/lib -L/usr/local/lib -lomp" diff --git a/src/ciderlib/twod/twocont.c b/src/ciderlib/twod/twocont.c index a92955578..40d75add5 100644 --- a/src/ciderlib/twod/twocont.c +++ b/src/ciderlib/twod/twocont.c @@ -758,76 +758,62 @@ void } } else { /* Horizontal Slice */ -// <<<<<<< HEAD -// if ( nIndex == 0 || nIndex == 3 ) { /* Left (Top?) Side : bug 483 */ -// pNode->fNPsiIn = spGetElement( matrix, nEqn, psiEqnInM ); -// pNode->fNPsiInP1 = spGetElement( matrix, nEqn, psiEqnInP ); -// pNode->fNPsiOx = spGetElement( matrix, nEqn, psiEqnOxM ); -// pNode->fNPsiOxP1 = spGetElement( matrix, nEqn, psiEqnOxP ); -// pNode->fPPsiIn = spGetElement( matrix, pEqn, psiEqnInM ); -// pNode->fPPsiInP1 = spGetElement( matrix, pEqn, psiEqnInP ); -// pNode->fPPsiOx = spGetElement( matrix, pEqn, psiEqnOxM ); -// pNode->fPPsiOxP1 = spGetElement( matrix, pEqn, psiEqnOxP ); -// ======= - if ( nIndex <= 1 ) { /* Top Side */ -// -// #ifdef KLU -// pNode->fNPsiIn = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnInM) ; -// pNode->fNPsiInBinding = NULL ; -// #else -// pNode->fNPsiIn = SMPmakeElt(matrix, nEqn, psiEqnInM); -// #endif -// -// #ifdef KLU -// pNode->fNPsiInP1 = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnInP) ; -// pNode->fNPsiInP1Binding = NULL ; -// #else -// pNode->fNPsiInP1 = SMPmakeElt(matrix, nEqn, psiEqnInP); -// #endif -// -// #ifdef KLU -// pNode->fNPsiOx = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnOxM) ; -// pNode->fNPsiOxBinding = NULL ; -// #else -// pNode->fNPsiOx = SMPmakeElt(matrix, nEqn, psiEqnOxM); -// #endif -// -// #ifdef KLU -// pNode->fNPsiOxP1 = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnOxP) ; -// pNode->fNPsiOxP1Binding = NULL ; -// #else -// pNode->fNPsiOxP1 = SMPmakeElt(matrix, nEqn, psiEqnOxP); -// #endif -// -// #ifdef KLU -// pNode->fPPsiIn = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnInM) ; -// pNode->fPPsiInBinding = NULL ; -// #else -// pNode->fPPsiIn = SMPmakeElt(matrix, pEqn, psiEqnInM); -// #endif -// -// #ifdef KLU -// pNode->fPPsiInP1 = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnInP) ; -// pNode->fPPsiInP1Binding = NULL ; -// #else -// pNode->fPPsiInP1 = SMPmakeElt(matrix, pEqn, psiEqnInP); -// #endif -// -// #ifdef KLU -// pNode->fPPsiOx = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnOxM) ; -// pNode->fPPsiOxBinding = NULL ; -// #else -// pNode->fPPsiOx = SMPmakeElt(matrix, pEqn, psiEqnOxM); -// #endif -// -// #ifdef KLU -// pNode->fPPsiOxP1 = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnOxP) ; -// pNode->fPPsiOxP1Binding = NULL ; -// #else -// pNode->fPPsiOxP1 = SMPmakeElt(matrix, pEqn, psiEqnOxP); -// #endif -// -// >>>>>>> First KLU support of CIDER TWOD simulations + if ( nIndex == 0 || nIndex == 3 ) { /* Left (Top?) Side : bug 483 */ +#ifdef KLU + pNode->fNPsiIn = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnInM) ; + pNode->fNPsiInBinding = NULL ; +#else + pNode->fNPsiIn = SMPmakeElt(matrix, nEqn, psiEqnInM); +#endif + +#ifdef KLU + pNode->fNPsiInP1 = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnInP) ; + pNode->fNPsiInP1Binding = NULL ; +#else + pNode->fNPsiInP1 = SMPmakeElt(matrix, nEqn, psiEqnInP); +#endif + +#ifdef KLU + pNode->fNPsiOx = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnOxM) ; + pNode->fNPsiOxBinding = NULL ; +#else + pNode->fNPsiOx = SMPmakeElt(matrix, nEqn, psiEqnOxM); +#endif + +#ifdef KLU + pNode->fNPsiOxP1 = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnOxP) ; + pNode->fNPsiOxP1Binding = NULL ; +#else + pNode->fNPsiOxP1 = SMPmakeElt(matrix, nEqn, psiEqnOxP); +#endif + +#ifdef KLU + pNode->fPPsiIn = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnInM) ; + pNode->fPPsiInBinding = NULL ; +#else + pNode->fPPsiIn = SMPmakeElt(matrix, pEqn, psiEqnInM); +#endif + +#ifdef KLU + pNode->fPPsiInP1 = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnInP) ; + pNode->fPPsiInP1Binding = NULL ; +#else + pNode->fPPsiInP1 = SMPmakeElt(matrix, pEqn, psiEqnInP); +#endif + +#ifdef KLU + pNode->fPPsiOx = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnOxM) ; + pNode->fPPsiOxBinding = NULL ; +#else + pNode->fPPsiOx = SMPmakeElt(matrix, pEqn, psiEqnOxM); +#endif + +#ifdef KLU + pNode->fPPsiOxP1 = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnOxP) ; + pNode->fPPsiOxP1Binding = NULL ; +#else + pNode->fPPsiOxP1 = SMPmakeElt(matrix, pEqn, psiEqnOxP); +#endif } else { /* Bottom Side */ #ifdef KLU diff --git a/src/ciderlib/twod/twoncont.c b/src/ciderlib/twod/twoncont.c index 066a12e71..fe78f17d8 100644 --- a/src/ciderlib/twod/twoncont.c +++ b/src/ciderlib/twod/twoncont.c @@ -493,44 +493,35 @@ void } } else { /* Horizontal Slice */ -// <<<<<<< HEAD -// if ( nIndex == 0 || nIndex == 3 ) { /* Left (Top?) Side : bug 483 */ -// pNode->fNPsiIn = spGetElement( matrix, nEqn, psiEqnInM ); -// pNode->fNPsiInP1 = spGetElement( matrix, nEqn, psiEqnInP ); -// pNode->fNPsiOx = spGetElement( matrix, nEqn, psiEqnOxM ); -// pNode->fNPsiOxP1 = spGetElement( matrix, nEqn, psiEqnOxP ); -// ======= - if ( nIndex <= 1 ) { /* Top Side */ -// -// #ifdef KLU -// pNode->fNPsiIn = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnInM) ; -// pNode->fNPsiInBinding = NULL ; -// #else -// pNode->fNPsiIn = SMPmakeElt(matrix, nEqn, psiEqnInM); -// #endif -// -// #ifdef KLU -// pNode->fNPsiInP1 = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnInP) ; -// pNode->fNPsiInP1Binding = NULL ; -// #else -// pNode->fNPsiInP1 = SMPmakeElt(matrix, nEqn, psiEqnInP); -// #endif -// -// #ifdef KLU -// pNode->fNPsiOx = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnOxM) ; -// pNode->fNPsiOxBinding = NULL ; -// #else -// pNode->fNPsiOx = SMPmakeElt(matrix, nEqn, psiEqnOxM); -// #endif -// -// #ifdef KLU -// pNode->fNPsiOxP1 = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnOxP) ; -// pNode->fNPsiOxP1Binding = NULL ; -// #else -// pNode->fNPsiOxP1 = SMPmakeElt(matrix, nEqn, psiEqnOxP); -// #endif -// -// >>>>>>> First KLU support of CIDER TWOD simulations + if ( nIndex == 0 || nIndex == 3 ) { /* Left (Top?) Side : bug 483 */ +#ifdef KLU + pNode->fNPsiIn = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnInM) ; + pNode->fNPsiInBinding = NULL ; +#else + pNode->fNPsiIn = SMPmakeElt(matrix, nEqn, psiEqnInM); +#endif + +#ifdef KLU + pNode->fNPsiInP1 = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnInP) ; + pNode->fNPsiInP1Binding = NULL ; +#else + pNode->fNPsiInP1 = SMPmakeElt(matrix, nEqn, psiEqnInP); +#endif + +#ifdef KLU + pNode->fNPsiOx = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnOxM) ; + pNode->fNPsiOxBinding = NULL ; +#else + pNode->fNPsiOx = SMPmakeElt(matrix, nEqn, psiEqnOxM); +#endif + +#ifdef KLU + pNode->fNPsiOxP1 = SMPmakeEltKLUforCIDER (matrix, nEqn, psiEqnOxP) ; + pNode->fNPsiOxP1Binding = NULL ; +#else + pNode->fNPsiOxP1 = SMPmakeElt(matrix, nEqn, psiEqnOxP); +#endif + } else { /* Bottom Side */ #ifdef KLU diff --git a/src/ciderlib/twod/twopcont.c b/src/ciderlib/twod/twopcont.c index f64726d44..b8af9a399 100644 --- a/src/ciderlib/twod/twopcont.c +++ b/src/ciderlib/twod/twopcont.c @@ -493,44 +493,35 @@ void } } else { /* Horizontal Slice */ -// <<<<<<< HEAD -// if ( nIndex == 0 || nIndex == 3 ) { /* Left (Top?) Side : bug 483 */ -// pNode->fPPsiIn = spGetElement( matrix, pEqn, psiEqnInM ); -// pNode->fPPsiInP1 = spGetElement( matrix, pEqn, psiEqnInP ); -// pNode->fPPsiOx = spGetElement( matrix, pEqn, psiEqnOxM ); -// pNode->fPPsiOxP1 = spGetElement( matrix, pEqn, psiEqnOxP ); -// ======= - if ( nIndex <= 1 ) { /* Top Side */ -// -// #ifdef KLU -// pNode->fPPsiIn = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnInM) ; -// pNode->fPPsiInBinding = NULL ; -// #else -// pNode->fPPsiIn = SMPmakeElt(matrix, pEqn, psiEqnInM); -// #endif -// -// #ifdef KLU -// pNode->fPPsiInP1 = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnInP) ; -// pNode->fPPsiInP1Binding = NULL ; -// #else -// pNode->fPPsiInP1 = SMPmakeElt(matrix, pEqn, psiEqnInP); -// #endif -// -// #ifdef KLU -// pNode->fPPsiOx = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnOxM) ; -// pNode->fPPsiOxBinding = NULL ; -// #else -// pNode->fPPsiOx = SMPmakeElt(matrix, pEqn, psiEqnOxM); -// #endif -// -// #ifdef KLU -// pNode->fPPsiOxP1 = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnOxP) ; -// pNode->fPPsiOxP1Binding = NULL ; -// #else -// pNode->fPPsiOxP1 = SMPmakeElt(matrix, pEqn, psiEqnOxP); -// #endif -// -// >>>>>>> First KLU support of CIDER TWOD simulations + if ( nIndex == 0 || nIndex == 3 ) { /* Left (Top?) Side : bug 483 */ +#ifdef KLU + pNode->fPPsiIn = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnInM) ; + pNode->fPPsiInBinding = NULL ; +#else + pNode->fPPsiIn = SMPmakeElt(matrix, pEqn, psiEqnInM); +#endif + +#ifdef KLU + pNode->fPPsiInP1 = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnInP) ; + pNode->fPPsiInP1Binding = NULL ; +#else + pNode->fPPsiInP1 = SMPmakeElt(matrix, pEqn, psiEqnInP); +#endif + +#ifdef KLU + pNode->fPPsiOx = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnOxM) ; + pNode->fPPsiOxBinding = NULL ; +#else + pNode->fPPsiOx = SMPmakeElt(matrix, pEqn, psiEqnOxM); +#endif + +#ifdef KLU + pNode->fPPsiOxP1 = SMPmakeEltKLUforCIDER (matrix, pEqn, psiEqnOxP) ; + pNode->fPPsiOxP1Binding = NULL ; +#else + pNode->fPPsiOxP1 = SMPmakeElt(matrix, pEqn, psiEqnOxP); +#endif + } else { /* Bottom Side */ #ifdef KLU diff --git a/src/frontend/inpc_probe.c b/src/frontend/inpc_probe.c index dd61de7af..5642420b9 100644 --- a/src/frontend/inpc_probe.c +++ b/src/frontend/inpc_probe.c @@ -199,6 +199,7 @@ void inp_probe(struct card* deck) char* curr_line = card->line; struct card* prevcard = NULL; + int nn = 0; /* exclude any command inside .control ... .endc */ if (ciprefix(".control", curr_line)) { @@ -330,7 +331,8 @@ void inp_probe(struct card* deck) card = insert_new_line(card, vline, 0, card->linenum_orig, card->linesource); /* special for KiCad: add shunt resistor if thisnode contains 'unconnected' */ if (*instname == 'x' && strstr(thisnode, "unconnected")) { - char *rline = tprintf("R%s %s 0 1e15", thisnode, thisnode); + /* nn makes the resistor name unique for a device with multiple unconnected nodes */ + char *rline = tprintf("R%s%d %s 0 1e15", thisnode, nn++, thisnode); card = insert_new_line(card, rline, 0, card->linenum_orig, card->linesource); } char* nodesaves = tprintf("%s:%s#branch", instname, nodename); diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 5cab2a48b..e3863cb50 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -1050,9 +1050,15 @@ struct card *inp_readall(FILE *fp, const char *dir_name, const char* file_name, rv = inp_read(fp, 0, dir_name, file_name, comfile, intfile); cc = rv.cc; - /* skip all pre-processing for expanded input files created by 'listing r' */ - if (cc && ciprefix("* expanded deck of", cc->line)) + /* skip all pre-processing for expanded input files created by 'listing r', + but evaluate number of lines in input deck */ + if (cc && ciprefix("* expanded deck of", cc->line)) { + struct card* dd; + dynmaxline = 0; + for (dd = cc; dd; dd = dd->nextcard) + dynmaxline++; return cc; + } /* files starting with *ng_script are user supplied command files */ if (cc && ciprefix("*ng_script", cc->line)) diff --git a/src/frontend/inpcompat.c b/src/frontend/inpcompat.c index ce4d96af9..e865997c4 100644 --- a/src/frontend/inpcompat.c +++ b/src/frontend/inpcompat.c @@ -695,7 +695,7 @@ struct card *pspice_compat(struct card *oldcard) nextcard = insert_new_line(nextcard, new_str, 7, 0, "internal"); new_str = copy(".func if(a, b, c) {ternary_fcn( a , b , c )}"); nextcard = insert_new_line(nextcard, new_str, 8, 0, "internal"); - new_str = copy(".func int(x) { sign(x)*floor(abs(x)) }"); + new_str = copy(".func int(x) { sgn(x)*floor(abs(x)) }"); nextcard = insert_new_line(nextcard, new_str, 9, 0, "internal"); nextcard->nextcard = oldcard; diff --git a/src/frontend/numparam/spicenum.c b/src/frontend/numparam/spicenum.c index bd7690e08..7832a37b7 100644 --- a/src/frontend/numparam/spicenum.c +++ b/src/frontend/numparam/spicenum.c @@ -311,6 +311,11 @@ nupa_init(void) dicoS = TMALLOC(dico_t, 1); initdico(dicoS); + if (dynmaxline < 1) { + fprintf(stderr, "Error: not a valid input deck, check your netlist\n"); + controlled_exit(EXIT_BAD); + } + dicoS->dynrefptr = TMALLOC(char*, dynmaxline + 1); dicoS->dyncategory = TMALLOC(char, dynmaxline + 1); diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index c04a91c62..35bb0d1ca 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -947,7 +947,7 @@ fileInit(runDesc *run) or special parameter names for @ vecors. FIXME This guessing may fail due to the many options, especially for the @ vectors. */ static int -guess_type(const char *name) +guess_type(const char *name, char* pltypename) { int type; @@ -971,6 +971,23 @@ guess_type(const char *name) type = SV_CURRENT; else if (strstr(name, ":power\0")) type = SV_POWER; + /* Special treatment if plot has been generated by S-parameter simulation */ + else if (pltypename && ciprefix("sp", pltypename) && ciprefix("S_", name)) + type = SV_SPARAM; + else if (pltypename && ciprefix("sp", pltypename) && ciprefix("Y_", name)) + type = SV_ADMITTANCE; + else if (pltypename && ciprefix("sp", pltypename) && ciprefix("Z_", name)) + type = SV_IMPEDANCE; + else if (pltypename && ciprefix("sp", pltypename) && cieq(name, "NF")) + type = SV_DB; + else if (pltypename && ciprefix("sp", pltypename) && cieq(name, "NFmin")) + type = SV_DB; + else if (pltypename && ciprefix("sp", pltypename) && cieq(name, "Rn")) + type = SV_IMPEDANCE; + else if (pltypename && ciprefix("sp", pltypename) && cieq(name, "SOpt")) + type = SV_NOTYPE; + else if (pltypename && ciprefix("sp", pltypename) && ciprefix("Cy_", name)) + type = SV_CURRENT; /* current source ISRC parameters for current */ else if (substring("@i", name) && (substring("[c]", name) || substring("[dc]", name) || substring("[current]", name))) type = SV_CURRENT; @@ -1001,7 +1018,7 @@ fileInit_pass2(runDesc *run) char *name = run->data[i].name; - type = guess_type(name); + type = guess_type(name, NULL); if (type == SV_CURRENT && !keepbranch) { char *branch = strstr(name, "#branch"); @@ -1141,7 +1158,7 @@ plotInit(runDesc *run) name = copy(dd->name); v = dvec_alloc(name, - guess_type(name), + guess_type(name, pl->pl_typename), run->isComplex ? (VF_COMPLEX | VF_PERMANENT) : (VF_REAL | VF_PERMANENT), diff --git a/src/include/ngspice/sharedspice.h b/src/include/ngspice/sharedspice.h index f97e0d8c6..ec2f8d2d5 100644 --- a/src/include/ngspice/sharedspice.h +++ b/src/include/ngspice/sharedspice.h @@ -3,12 +3,21 @@ /* Modified BSD license */ /* -Interface between a calling program (caller) and ngspice.dll (ngspice.so) +Interface between a calling program (caller) and ngspice.dll (libngspice.so) + ** ngSpice_nospinit(void) Set variable no_spinit, if reading the initialization file 'spinit' is not wanted. To be called before ngSpice_Init() +** +ngSpice_nospiceinit(void) +Set variable no_spiceinit, if reading the user defined initialization file +'.spiceinit' is not wanted. +To be called before ngSpice_Init(). +Use with care, as this removes the last chance to send preparative commands +before the netlist is loaded. Then use the the caller to send such commands. + ** ngSpice_Init(SendChar*, SendStat*, ControlledExit*, SendData*, SendInitData*, BGThreadRunning*, void*) @@ -453,6 +462,10 @@ NG_BOOL ngSpice_SetBkpt(double time); IMPEXP int ngSpice_nospinit(void); +/* Set variable no_spiceinit, if reading '.spiceinit' is not wanted. */ +IMPEXP +int ngSpice_nospiceinit(void); + #ifdef __cplusplus } #endif diff --git a/src/sharedspice.c b/src/sharedspice.c index 5a30a0394..381805417 100644 --- a/src/sharedspice.c +++ b/src/sharedspice.c @@ -810,6 +810,16 @@ ngSpice_nospinit(void) return 0; } +/* Set variable no_spiceinit, if reading '.spiceinit' is not wanted. */ +IMPEXP +int +ngSpice_nospiceinit(void) +{ + bool t = TRUE; + cp_vset("no_spicenit", CP_BOOL, &t); + return 0; +} + /* Initialise external voltage source and synchronization */ IMPEXP int @@ -964,55 +974,61 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi tfree(s); } #else /* ~ HAVE_PWD_H */ - /* load user's initialisation file - try accessing the initialisation file .spiceinit in a user provided - path read from environmental variable SPICE_USERINIT_DIR, - if that fails try the alternate name spice.rc, then look into - the current directory, then the HOME directory, then into USERPROFILE */ - do { - { - const char* const userinit = getenv("SPICE_USERINIT_DIR"); - if (userinit) { - if (read_initialisation_file(userinit, INITSTR) != FALSE) { - break; - } - if (read_initialisation_file(userinit, ALT_INITSTR) != FALSE) { - break; + /* load user's initialisation file + try accessing the initialisation file .spiceinit in a user provided + path read from environmental variable SPICE_USERINIT_DIR, + if that fails try the alternate name spice.rc, then look into + the current directory, then the HOME directory, then into USERPROFILE. + Don't read .spiceinit, if ngSpice_nospiceinit() has been called. */ + if (!cp_getvar("no_spiceinit", CP_BOOL, NULL, 0)) { + do { + { + const char* const userinit = getenv("SPICE_USERINIT_DIR"); + if (userinit) { + if (read_initialisation_file(userinit, INITSTR) != FALSE) { + break; + } + if (read_initialisation_file(userinit, ALT_INITSTR) != FALSE) { + break; + } } } - } - if (read_initialisation_file("", INITSTR) != FALSE) { - break; - } - if (read_initialisation_file("", ALT_INITSTR) != FALSE) { - break; - } + if (read_initialisation_file("", INITSTR) != FALSE) { + break; + } + if (read_initialisation_file("", ALT_INITSTR) != FALSE) { + break; + } - { - const char* const home = getenv("HOME"); - if (home) { - if (read_initialisation_file(home, INITSTR) != FALSE) { - break; - } - if (read_initialisation_file(home, ALT_INITSTR) != FALSE) { - break; + { + const char* const home = getenv("HOME"); + if (home) { + if (read_initialisation_file(home, INITSTR) != FALSE) { + break; + } + if (read_initialisation_file(home, ALT_INITSTR) != FALSE) { + break; + } } } - } - { - const char* const usr = getenv("USERPROFILE"); - if (usr) { - if (read_initialisation_file(usr, INITSTR) != FALSE) { - break; - } - if (read_initialisation_file(usr, ALT_INITSTR) != FALSE) { - break; + { + const char* const usr = getenv("USERPROFILE"); + if (usr) { + if (read_initialisation_file(usr, INITSTR) != FALSE) { + break; + } + if (read_initialisation_file(usr, ALT_INITSTR) != FALSE) { + break; + } } } - } - } while (0); /* end of case that init file is read */ + } while (0); /* end of case that init file is read */ + } + else { + fprintf(stdout, "Note: .spiceinit is ignored, because ngSpice_nospiceinit() has been called.\n"); + } #endif /* ~ HAVE_PWD_H */ diff --git a/src/spicelib/analysis/span.c b/src/spicelib/analysis/span.c index 30c77370d..fcdabd28a 100644 --- a/src/spicelib/analysis/span.c +++ b/src/spicelib/analysis/span.c @@ -363,14 +363,17 @@ SPan(CKTcircuit* ckt, int restart) data = TMALLOC(Ndata, 1); } - if (ckt->CKTportCount == 0) { - fprintf(stderr, "No RF Port is present\n"); - return (E_PARMVAL); + fprintf(stderr, "\nError: No RF Port is present, cannot run sp analysis\n"); + controlled_exit(EXIT_BAD); } - + if (ckt->CKTportCount == 1) + { + fprintf(stderr, "\nError: Only one RF Port is found, we need at least two!\n"); + controlled_exit(EXIT_BAD); + } #ifdef XSPICE /* gtri - add - wbk - 12/19/90 - Add IPC stuff and anal_init and anal_type */ diff --git a/src/spicelib/devices/cpl/cplsetup.c b/src/spicelib/devices/cpl/cplsetup.c index 7e9052fb1..39feee276 100644 --- a/src/spicelib/devices/cpl/cplsetup.c +++ b/src/spicelib/devices/cpl/cplsetup.c @@ -832,7 +832,10 @@ Gaussian_Elimination2(int dims, int type) max = ABS(A[j][i]); } if (max < epsilon) { - fprintf(stderr, " can not choose a pivot (misc)\n"); + fprintf(stderr, "\nError: Gaussian elimination (misc) fails during setup of CPL\n"); + fprintf(stderr, " All matrix elements are less than %e, \n", epsilon); + fprintf(stderr, " thus cannot choose a pivot.\n"); + fprintf(stderr, " Please check your model parameters.\n"); controlled_exit(EXIT_FAILURE); } if (imax != i) @@ -1767,7 +1770,10 @@ Gaussian_Elimination(int dims) max = ABS(At[j][i]); } if (max < epsi_mult) { - fprintf(stderr, " can not choose a pivot (mult)\n"); + fprintf(stderr, "\nError: Gaussian elimination (mult) fails during setup of CPL\n"); + fprintf(stderr, " All matrix elements are less than %e, \n", epsi_mult); + fprintf(stderr, " thus cannot choose a pivot.\n"); + fprintf(stderr, " Please check your model parameters.\n"); controlled_exit(EXIT_FAILURE); } if (imax != i) diff --git a/src/spicelib/devices/hfet1/hfetinit.c b/src/spicelib/devices/hfet1/hfetinit.c index 339035b6e..346b382a5 100644 --- a/src/spicelib/devices/hfet1/hfetinit.c +++ b/src/spicelib/devices/hfet1/hfetinit.c @@ -69,7 +69,7 @@ SPICEdev HFETAinfo = { #ifdef KLU .DEVbindCSC = HFETAbindCSC, - .DEVbindCSCComplex = HFETAbindCSC, + .DEVbindCSCComplex = HFETAbindCSCComplex, .DEVbindCSCComplexToReal = HFETAbindCSCComplexToReal, #endif }; diff --git a/src/spicelib/devices/txl/txlsetup.c b/src/spicelib/devices/txl/txlsetup.c index effc0be8b..a0d3df9e8 100644 --- a/src/spicelib/devices/txl/txlsetup.c +++ b/src/spicelib/devices/txl/txlsetup.c @@ -545,7 +545,10 @@ Gaussian_Elimination1(int dims) max = ABS(A[j][i]); } if (max < epsi) { - fprintf(stderr, " can not choose a pivot \n"); + fprintf(stderr, "\nError: Gaussian elimination fails during setup of TXL\n"); + fprintf(stderr, " All matrix elements are less than %e, \n", epsi); + fprintf(stderr, " thus cannot choose a pivot.\n"); + fprintf(stderr, " Please check your model parameters.\n"); controlled_exit(EXIT_FAILURE); } if (imax != i) @@ -905,7 +908,10 @@ Gaussian_Elimination2(int dims) max = ABS(AA[j][i]); } if (max < epsi2) { - fprintf(stderr, " can not choose a pivot \n"); + fprintf(stderr, "\nError: Gaussian elimination fails during setup of TXL\n"); + fprintf(stderr, " All matrix elements are less than %e, \n", epsi2); + fprintf(stderr, " thus cannot choose a pivot.\n"); + fprintf(stderr, " Please check your model parameters.\n"); controlled_exit(EXIT_FAILURE); } if (imax != i) diff --git a/src/spicelib/parser/inpmkmod.c b/src/spicelib/parser/inpmkmod.c index 055d7a66b..3ff8ed92d 100644 --- a/src/spicelib/parser/inpmkmod.c +++ b/src/spicelib/parser/inpmkmod.c @@ -20,7 +20,9 @@ NGHASHPTR modtabhash = NULL; * This fcn takes the model name and looks to see if it is already * in the model table. If it is, then just return. Otherwise, * stick the model into the model table. - * Note that the model table INPmodel + * Note that the model table INPmodel *modtab is a linked list, + * in parallel a hash table modtabhash is filled in for faster + * access to modtab elements by giving the model name. *--------------------------------------------------------------*/ int INPmakeMod(char *token, int type, struct card *line)