Internal global variable Infile_Path is a file search path made

available for the code models. It is set when command 'source' is used.

This patch makes the first entry in var 'sourcepath' available to
the code models as well by setting Infile_Path, when 'sourcepath'
is set in .spiceinit.
This commit is contained in:
Holger Vogt 2021-04-17 18:17:31 +02:00
parent a08f120518
commit ba262eaa5f
1 changed files with 8 additions and 1 deletions

View File

@ -153,6 +153,7 @@ static bool cont_condition;
#include "frontend/com_measure2.h" #include "frontend/com_measure2.h"
#include "frontend/misccoms.h" #include "frontend/misccoms.h"
#include "ngspice/stringskip.h" #include "ngspice/stringskip.h"
#include "variable.h"
#ifdef HAVE_FTIME #ifdef HAVE_FTIME
#include <sys/timeb.h> #include <sys/timeb.h>
@ -388,7 +389,6 @@ static SendEvtData* sendevt;
static void* euserptr; static void* euserptr;
static wordlist *shcontrols; static wordlist *shcontrols;
// thread IDs // thread IDs
unsigned int main_id, ng_id, command_id; unsigned int main_id, ng_id, command_id;
@ -822,6 +822,8 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
{ {
sighandler old_sigsegv = NULL; sighandler old_sigsegv = NULL;
struct variable* sourcepathvar;
pfcn = printfcn; pfcn = printfcn;
/* if caller sends NULL, don't send printf strings */ /* if caller sends NULL, don't send printf strings */
if (!pfcn) if (!pfcn)
@ -998,6 +1000,11 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
if(!myvec) if(!myvec)
myvec = TMALLOC(vector_info, sizeof(vector_info)); myvec = TMALLOC(vector_info, sizeof(vector_info));
/* Read first entry of sourcepath var, set Infile_path for code models */
if ( cp_getvar("sourcepath", CP_LIST, &sourcepathvar, 0)) {
Infile_Path = copy(sourcepathvar->va_string);
}
#if !defined(low_latency) #if !defined(low_latency)
/* If caller has sent valid address for pfcn */ /* If caller has sent valid address for pfcn */
if (!noprintfwanted) if (!noprintfwanted)