Merge branch 'pre-master-44' into bt_dev

This commit is contained in:
Brian Taylor 2024-11-01 10:39:35 -07:00
commit 013ff65893
10 changed files with 124 additions and 64 deletions

View File

@ -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"

View File

@ -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);

View File

@ -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))

View File

@ -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);

View File

@ -969,6 +969,9 @@ guess_type(const char *name, char* pltypename)
type = SV_RES;
else if (cieq(name, "i-sweep"))
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))
@ -983,8 +986,8 @@ guess_type(const char *name, char* pltypename)
type = SV_IMPEDANCE;
else if (pltypename && ciprefix("sp", pltypename) && cieq(name, "SOpt"))
type = SV_NOTYPE;
else if (strstr(name, ":power\0"))
type = SV_POWER;
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;

View File

@ -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

View File

@ -814,6 +814,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
@ -968,55 +978,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 */

View File

@ -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 */

View File

@ -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)

View File

@ -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)