Browse Source

global variable Infile_Path, which contains the

input netlist file path
pre-master-46
h_vogt 12 years ago
parent
commit
1f5de32512
  1. 11
      src/frontend/inp.c
  2. 1
      src/include/ngspice/ngspice.h
  3. 6
      src/main.c

11
src/frontend/inp.c

@ -1146,7 +1146,7 @@ com_source(wordlist *wl)
FILE *fp, *tp;
char buf[BSIZE_SP];
bool inter;
char *tempfile = NULL;
char *tempfile = NULL, *firstfile;
wordlist *owl = wl;
size_t n;
@ -1154,6 +1154,8 @@ com_source(wordlist *wl)
inter = cp_interactive;
cp_interactive = FALSE;
firstfile = wl->wl_word;
if (wl->wl_next) {
/* There are several files -- put them into a temp file */
tempfile = smktemp("sp");
@ -1189,8 +1191,13 @@ com_source(wordlist *wl)
/* Don't print the title if this is a spice initialisation file. */
if (ft_nutmeg || substring(INITSTR, owl->wl_word) || substring(ALT_INITSTR, owl->wl_word))
inp_spsource(fp, TRUE, tempfile ? NULL : wl->wl_word, FALSE);
else
else {
/* Save path name for use in XSPICE fopen_with_path() */
if (Infile_Path)
tfree(Infile_Path);
Infile_Path = ngdirname(firstfile);
inp_spsource(fp, FALSE, tempfile ? NULL : wl->wl_word, FALSE);
}
cp_interactive = inter;
if (tempfile)

1
src/include/ngspice/ngspice.h

@ -245,6 +245,7 @@ extern char *Spice_Path;
extern char *Help_Path;
extern char *Lib_Path;
extern char *Inp_Path;
extern char *Infile_Path;
#ifdef TCL_MODULE

6
src/main.c

@ -43,6 +43,7 @@
#include "spicelib/analysis/analysis.h"
#include "misc/ivars.h"
#include "misc/misc_time.h"
#include "misc/util.h"
#if defined(HAS_WINGUI) || defined(_MSC_VER) || defined(__MINGW32__)
# include "misc/mktemp.h"
@ -113,6 +114,8 @@ char *errRtn; /* name of the routine declaring error */
char *errMsg = NULL; /* descriptive message about what went wrong */
char *cp_program; /* program name 'ngspice' */
char *Infile_Path = NULL; /* Path to netlist input file */
/* Globals definitions for Machine Accuracy Limits
* (needed by CIDER)
@ -1217,6 +1220,9 @@ main(int argc, char **argv)
while (optind < argc) {
char *arg = argv[optind++];
FILE *tp;
/* Copy the the path of the first filename only */
if (!Infile_Path)
Infile_Path = ngdirname(arg);
/* Copy all the arguments into the temporary file */
tp = fopen(arg, "r");

Loading…
Cancel
Save