Add function ngSpice_nospiceinit(void) if you don't want to read .spiceinit
This commit is contained in:
parent
7ac92bb9fc
commit
2b89d2a1cd
|
|
@ -3,12 +3,21 @@
|
||||||
/* Modified BSD license */
|
/* 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)
|
ngSpice_nospinit(void)
|
||||||
Set variable no_spinit, if reading the initialization file 'spinit' is not wanted.
|
Set variable no_spinit, if reading the initialization file 'spinit' is not wanted.
|
||||||
To be called before ngSpice_Init()
|
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*,
|
ngSpice_Init(SendChar*, SendStat*, ControlledExit*,
|
||||||
SendData*, SendInitData*, BGThreadRunning*, void*)
|
SendData*, SendInitData*, BGThreadRunning*, void*)
|
||||||
|
|
@ -453,6 +462,10 @@ NG_BOOL ngSpice_SetBkpt(double time);
|
||||||
IMPEXP
|
IMPEXP
|
||||||
int ngSpice_nospinit(void);
|
int ngSpice_nospinit(void);
|
||||||
|
|
||||||
|
/* Set variable no_spiceinit, if reading '.spiceinit' is not wanted. */
|
||||||
|
IMPEXP
|
||||||
|
int ngSpice_nospiceinit(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -814,6 +814,16 @@ ngSpice_nospinit(void)
|
||||||
return 0;
|
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 */
|
/* Initialise external voltage source and synchronization */
|
||||||
IMPEXP
|
IMPEXP
|
||||||
int
|
int
|
||||||
|
|
@ -968,55 +978,61 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
|
||||||
tfree(s);
|
tfree(s);
|
||||||
}
|
}
|
||||||
#else /* ~ HAVE_PWD_H */
|
#else /* ~ HAVE_PWD_H */
|
||||||
/* load user's initialisation file
|
/* load user's initialisation file
|
||||||
try accessing the initialisation file .spiceinit in a user provided
|
try accessing the initialisation file .spiceinit in a user provided
|
||||||
path read from environmental variable SPICE_USERINIT_DIR,
|
path read from environmental variable SPICE_USERINIT_DIR,
|
||||||
if that fails try the alternate name spice.rc, then look into
|
if that fails try the alternate name spice.rc, then look into
|
||||||
the current directory, then the HOME directory, then into USERPROFILE */
|
the current directory, then the HOME directory, then into USERPROFILE.
|
||||||
do {
|
Don't read .spiceinit, if ngSpice_nospiceinit() has been called. */
|
||||||
{
|
if (!cp_getvar("no_spiceinit", CP_BOOL, NULL, 0)) {
|
||||||
const char* const userinit = getenv("SPICE_USERINIT_DIR");
|
do {
|
||||||
if (userinit) {
|
{
|
||||||
if (read_initialisation_file(userinit, INITSTR) != FALSE) {
|
const char* const userinit = getenv("SPICE_USERINIT_DIR");
|
||||||
break;
|
if (userinit) {
|
||||||
}
|
if (read_initialisation_file(userinit, INITSTR) != FALSE) {
|
||||||
if (read_initialisation_file(userinit, ALT_INITSTR) != FALSE) {
|
break;
|
||||||
break;
|
}
|
||||||
|
if (read_initialisation_file(userinit, ALT_INITSTR) != FALSE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (read_initialisation_file("", INITSTR) != FALSE) {
|
if (read_initialisation_file("", INITSTR) != FALSE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (read_initialisation_file("", ALT_INITSTR) != FALSE) {
|
if (read_initialisation_file("", ALT_INITSTR) != FALSE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const char* const home = getenv("HOME");
|
const char* const home = getenv("HOME");
|
||||||
if (home) {
|
if (home) {
|
||||||
if (read_initialisation_file(home, INITSTR) != FALSE) {
|
if (read_initialisation_file(home, INITSTR) != FALSE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (read_initialisation_file(home, ALT_INITSTR) != FALSE) {
|
if (read_initialisation_file(home, ALT_INITSTR) != FALSE) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const char* const usr = getenv("USERPROFILE");
|
const char* const usr = getenv("USERPROFILE");
|
||||||
if (usr) {
|
if (usr) {
|
||||||
if (read_initialisation_file(usr, INITSTR) != FALSE) {
|
if (read_initialisation_file(usr, INITSTR) != FALSE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (read_initialisation_file(usr, ALT_INITSTR) != FALSE) {
|
if (read_initialisation_file(usr, ALT_INITSTR) != FALSE) {
|
||||||
break;
|
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 */
|
#endif /* ~ HAVE_PWD_H */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue