fix once again an issue when working in symlinked directories and giving a relative .sch file path on cmdline; clean up print_spice_element(). JL to check if tclgetvar("env(PWD)") works on windows (xinit.c:1435)
This commit is contained in:
parent
26fdaae83d
commit
6f80fdbf76
27
src/token.c
27
src/token.c
|
|
@ -1426,7 +1426,7 @@ void print_spice_subckt(FILE *fd, int symbol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
|
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
|
||||||
char *prop;
|
char *prop=NULL;
|
||||||
for(i = 0; i<no_of_pins; i++) {
|
for(i = 0; i<no_of_pins; i++) {
|
||||||
prop = xctx.sym[symbol].rect[PINLAYER][i].prop_ptr;
|
prop = xctx.sym[symbol].rect[PINLAYER][i].prop_ptr;
|
||||||
if(!strcmp(get_tok_value(prop, "name",0), token + 2)) break;
|
if(!strcmp(get_tok_value(prop, "name",0), token + 2)) break;
|
||||||
|
|
@ -1478,7 +1478,6 @@ void print_spice_element(FILE *fd, int inst)
|
||||||
int sizetok=0;
|
int sizetok=0;
|
||||||
int token_pos=0, escape=0;
|
int token_pos=0, escape=0;
|
||||||
int no_of_pins=0;
|
int no_of_pins=0;
|
||||||
int quote=0;
|
|
||||||
/* struct inst_hashentry *ptr; */
|
/* struct inst_hashentry *ptr; */
|
||||||
|
|
||||||
my_strdup(483, &template,
|
my_strdup(483, &template,
|
||||||
|
|
@ -1508,19 +1507,20 @@ void print_spice_element(FILE *fd, int inst)
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
c=*s++;
|
c=*s++;
|
||||||
if(c=='"' && !escape) {
|
|
||||||
quote=!quote;
|
if(c=='\\') {
|
||||||
c = *s++;
|
escape=1;
|
||||||
|
c=*s++;
|
||||||
}
|
}
|
||||||
|
else escape=0;
|
||||||
if (c=='\n' && escape) c=*s++; /* 20171030 eat escaped newlines */
|
if (c=='\n' && escape) c=*s++; /* 20171030 eat escaped newlines */
|
||||||
/* 20150317 use SPACE2() instead of SPACE() */
|
/* 20150317 use SPACE2() instead of SPACE() */
|
||||||
space=SPACE2(c);
|
space=SPACE(c);
|
||||||
|
|
||||||
if (state==XBEGIN && (c=='@'|| c=='$') && !escape) state=XTOKEN;
|
if (state==XBEGIN && (c=='@'|| c=='$') && !escape) state=XTOKEN;
|
||||||
|
|
||||||
/* 20171029 added !escape, !quote */
|
else if(state==XTOKEN && (escape || (space || c == '$' || c == '@' || c == '\\')) && token_pos > 1 ) {
|
||||||
else if (state==XTOKEN && (space || c == '$' || c == '@' || c == '\\') && token_pos > 1 && !escape && !quote) {
|
dbg(1, "print_spice_element: c=%c, space=%d, escape=%d roken_pos=%d\n", c, space, escape, token_pos);
|
||||||
dbg(1, "print_spice_element: c=%c, space=%d, escape=%d, quote=%d\n", c, space, escape, quote);
|
|
||||||
state=XSEPARATOR;
|
state=XSEPARATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1531,7 +1531,7 @@ void print_spice_element(FILE *fd, int inst)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state==XTOKEN) {
|
if(state==XTOKEN) {
|
||||||
if (c!='\\' || escape) token[token_pos++]=c; /* 20171029 remove escaping backslashes */
|
token[token_pos++]=c;
|
||||||
}
|
}
|
||||||
else if (state==XSEPARATOR) /* got a token */
|
else if (state==XSEPARATOR) /* got a token */
|
||||||
{
|
{
|
||||||
|
|
@ -1619,18 +1619,17 @@ void print_spice_element(FILE *fd, int inst)
|
||||||
my_free(1018, &tclcmd);
|
my_free(1018, &tclcmd);
|
||||||
} /* /20171029 */
|
} /* /20171029 */
|
||||||
/* 20151028 dont print escaping backslashes */
|
/* 20151028 dont print escaping backslashes */
|
||||||
if (c != '$' && c != '@' && c!='\0' && (c!='\\' || escape)) fputc(c,fd);
|
if(c != '$' && c != '@' && c!='\0' ) fputc(c,fd);
|
||||||
if (c == '@' || c == '$' ) s--;
|
if(c == '@' || c == '$' ) s--;
|
||||||
state=XBEGIN;
|
state=XBEGIN;
|
||||||
}
|
}
|
||||||
/* 20151028 dont print escaping backslashes */
|
/* 20151028 dont print escaping backslashes */
|
||||||
else if(state==XBEGIN && c!='\0' && (c!='\\' || escape)) fputc(c,fd);
|
else if(state==XBEGIN && c!='\0') fputc(c,fd);
|
||||||
if(c=='\0')
|
if(c=='\0')
|
||||||
{
|
{
|
||||||
fputc('\n',fd);
|
fputc('\n',fd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (c=='\\') escape=1; else escape=0;
|
|
||||||
}
|
}
|
||||||
my_free(1019, &template);
|
my_free(1019, &template);
|
||||||
my_free(1020, &format);
|
my_free(1020, &format);
|
||||||
|
|
|
||||||
12
src/xinit.c
12
src/xinit.c
|
|
@ -1427,11 +1427,19 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
||||||
enable_layers();
|
enable_layers();
|
||||||
|
|
||||||
if(filename) {
|
if(filename) {
|
||||||
|
char f[PATH_MAX];
|
||||||
|
if(filename[0] !='/') {
|
||||||
|
/* can not use pwd_dir since it dereferences symlinks
|
||||||
|
|
|
||||||
|
\|/ */
|
||||||
|
my_snprintf(f, S(f), "%s/%s", tclgetvar("env(PWD)"), filename);
|
||||||
|
} else {
|
||||||
|
my_snprintf(f, S(f), "%s", filename);
|
||||||
|
}
|
||||||
dbg(1, "Tcl_AppInit(): filename %s given, removing symbols\n", filename);
|
dbg(1, "Tcl_AppInit(): filename %s given, removing symbols\n", filename);
|
||||||
remove_symbols();
|
remove_symbols();
|
||||||
load_schematic(1, filename, 1);
|
load_schematic(1, f, 1);
|
||||||
Tcl_VarEval(interp, "update_recent_file {", filename, "}", NULL);
|
Tcl_VarEval(interp, "update_recent_file {", filename, "}", NULL);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
char * tmp;
|
char * tmp;
|
||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX];
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
v {xschem version=2.9.8 file_version=1.2}
|
v {xschem version=2.9.8 file_version=1.2}
|
||||||
G {}
|
G {}
|
||||||
K {type=vsource
|
K {type=vsource
|
||||||
format="@name @pinlist pulse(0 @vhi '0.495/@freq' '0.01/@freq' '0.01/@freq' '0.49/@freq' '1/@freq')"
|
format="@name @pinlist pulse(0 @vhi '0.495/@freq\\\\' '0.01/@freq\\\\' '0.01/@freq\\\\' '0.49/@freq\\\\' '1/@freq\\\\')"
|
||||||
template="name=V1 vhi=3 freq=1M"
|
template="name=V1 vhi=3 freq=1M"
|
||||||
}
|
}
|
||||||
V {}
|
V {}
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,7 @@ v {xschem version=2.9.5_RC5 file_version=1.1}
|
||||||
G {type=timescale
|
G {type=timescale
|
||||||
spice_ignore=true
|
spice_ignore=true
|
||||||
template="name=s1 timestep=\\"100ps\\" precision=\\"100ps\\" "
|
template="name=s1 timestep=\\"100ps\\" precision=\\"100ps\\" "
|
||||||
format="`timescale @timestep/@precision"}
|
verilog_format="`timescale @timestep/@precision"}
|
||||||
V {}
|
V {}
|
||||||
S {}
|
S {}
|
||||||
E {}
|
E {}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue