added warnings (Options -> Show info window) if components are missing a name=... attribute / if symbols are missing a type=... attribute; eliminated usage of tcl "file normalize..." statements to avoid symlink dereferencing (if using symlinked libraries), aligned version/file_version tags in support awk scripts

This commit is contained in:
Stefan Schippers 2020-10-06 16:19:52 +02:00
parent 71f23a5242
commit a10cb2c429
12 changed files with 50 additions and 30 deletions

View File

@ -1074,7 +1074,6 @@ void descend_schematic(int instnumber)
int inst_mult, inst_number;
int save_ok = 0;
rebuild_selected_array();
if(lastselected !=1 || selectedgroup[0].type!=ELEMENT)
{

View File

@ -387,7 +387,7 @@ function print_header()
"device @name @device\n" \
"@comptag\"\n"
}
print "v {xschem version=2.9.7 file_version=1.1}"
print "v {xschem version=2.9.8 file_version=1.2}"
template_attrs = "template=\"" template_attrs "\"\n"
if(FILENAME ~/\.sym$/) {
@ -397,16 +397,17 @@ function print_header()
} else {
global_attrs = "type=symbol\n" global_attrs
}
print "G {" global_attrs template_attrs tedax_attrs spice_attrs
print "K {" global_attrs template_attrs tedax_attrs spice_attrs
if(extra) {
print extra
print extra_pinnumber
}
print "}"
} else {
print "G {}"
print "K {}"
}
print "G {}"
print "V {}"
print "S {}"
print "E {}"

View File

@ -1091,8 +1091,9 @@ void print_hilight_net(int show)
/* 20170323 this delete_netlist_structs is necessary, without it segfaults when going back (ctrl-e) */
/* from a schematic after placing pins (ctrl-j) and changing some pin direction (ipin -->iopin) */
prepared_hilight_structs=0; /* 20171212 */
prepared_netlist_structs=0; /* 20171212 */
prepared_hilight_structs=0;
prepared_netlist_structs=0;
/* delete_netlist_structs(); */
my_free(781, &filetmp1);
my_free(782, &filetmp2);

View File

@ -68,7 +68,7 @@ function beginfile(f)
text_voffset=20
lab_voffset=4
ip=op=n_pin=0
print "v {xschem version=2.9.7 file_version=1.1}" > sym
print "v {xschem version=2.9.8 file_version=1.2}" > sym
if(template=="") {
printf "%s", "K {type=subcircuit\nformat=\"@name @pinlist @symname\"\n" >sym
printf "%s\n", "template=\"name=x1\"" >sym

View File

@ -627,10 +627,15 @@ void prepare_netlist_structs(int for_netlist)
char *class=NULL;
char *global_node=NULL;
int inst_mult, pin_mult;
int print_erc;
static int startlevel = 0;
if (for_netlist>0 && prepared_netlist_structs) return; /* 20160413 */
else if (!for_netlist && prepared_hilight_structs) return; /* 20171210 */
else delete_netlist_structs();
if(netlist_count == 0 ) startlevel = currentsch;
print_erc = netlist_count == 0 || startlevel < currentsch;
if (for_netlist>0) {
my_snprintf(nn, S(nn), "-----------%s", schematic[currentsch]);
statusmsg(nn,2);
@ -662,6 +667,20 @@ void prepare_netlist_structs(int for_netlist)
if (inst_ptr[i].ptr<0) continue;
my_strdup(248, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
if(print_erc && (!inst_ptr[i].instname || !inst_ptr[i].instname[0]) ) {
char str[2048];
my_snprintf(str, S(str), "instance: %d (%s): no name attribute set", i, inst_ptr[i].name);
statusmsg(str,2);
inst_ptr[i].flags |=4;
hilight_nets=1;
}
if(print_erc && (!type || !type[0]) ) {
char str[2048];
my_snprintf(str, S(str), "Symbol: %s: no type attribute set", inst_ptr[i].name);
statusmsg(str,2);
inst_ptr[i].flags |=4;
hilight_nets=1;
}
if(type && inst_ptr[i].node && IS_LABEL_OR_PIN(type) ) { /* instance must have a pin! */
if (for_netlist>0) {
/* 20150918 skip labels / pins if ignore property specified on instance */
@ -983,8 +1002,10 @@ void prepare_netlist_structs(int for_netlist)
} /* end for(i...) */
/*---------------------- */
rebuild_selected_array();
if (for_netlist>0) prepared_netlist_structs=1;
else prepared_hilight_structs=1;
if (for_netlist>0) {
prepared_netlist_structs=1;
prepared_hilight_structs=1;
} else prepared_hilight_structs=1;
my_free(835, &dir);
my_free(836, &type);

View File

@ -197,10 +197,8 @@ void global_spice_netlist(int global) /* netlister driver */
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
sym_vs_sch_pins();
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
for(i=0;i<lastinst; i++) inst_ptr[i].flags |= stored_flags[i];
draw_hilight_net(1);
}
my_free(945, &stored_flags);
@ -271,6 +269,7 @@ void global_spice_netlist(int global) /* netlister driver */
}
my_free(946, &type);
my_free(947, &place);
netlist_count = 0;
}
static char *model_name_result = NULL;

View File

@ -120,6 +120,7 @@ void global_tedax_netlist(int global) /* netlister driver */
tcleval(tcl_cmd_netlist);
}
if(!debug_var) xunlink(netl_filename);
netlist_count = 0;
}

View File

@ -335,6 +335,7 @@ void global_verilog_netlist(int global) /* netlister driver */
my_free(1076, &port_value);
my_free(1077, &tmp_string);
my_free(1078, &type);
netlist_count = 0;
}

View File

@ -386,6 +386,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
my_free(1089, &sig_type);
my_free(1090, &type);
my_free(1091, &port_value);
netlist_count = 0;
}

View File

@ -992,10 +992,10 @@ int Tcl_AppInit(Tcl_Interp *inter)
}
else {
if (running_in_src_dir ==1) {
my_snprintf(tmp, S(tmp), "%s/../src", pwd_dir);
my_snprintf(tmp, S(tmp), "[file dirname %s]/src", pwd_dir);
}
else {
my_snprintf(tmp, S(tmp), "%s/../share", install_dir);
my_snprintf(tmp, S(tmp), "[file dirname %s]/share", install_dir);
}
tclsetvar("XSCHEM_SHAREDIR", tmp);
}
@ -1456,14 +1456,10 @@ int Tcl_AppInit(Tcl_Interp *inter)
enable_layers();
if(filename) {
char s[PATH_MAX+100];
dbg(1, "Tcl_AppInit(): filename %s given, removing symbols\n", filename);
remove_symbols();
my_snprintf(s, S(s), "file normalize \"%s\"", filename);
tcleval(s);
my_strncpy(s, abs_sym_path(tclresult(), ""), S(s));
load_schematic(1, s, 1); /* 20180925.1 */
Tcl_VarEval(interp, "update_recent_file {", s, "}", NULL);
load_schematic(1, filename, 1);
Tcl_VarEval(interp, "update_recent_file {", filename, "}", NULL);
} else {
char * tmp; /* 20121110 */

View File

@ -2590,7 +2590,6 @@ proc rel_sym_path {symbol} {
global pathlist current_dirname
set name {}
if {[regexp {^/} $symbol] || [regexp {^[A-Za-z]:} $symbol]} {set symbol [file normalize $symbol]}
foreach path_elem $pathlist {
if { ![string compare $path_elem .] && [info exist current_dirname]} {
set path_elem $current_dirname
@ -2622,14 +2621,20 @@ proc abs_sym_path {fname {ext {} } } {
if { $fname eq "/"} {
return $fname;
}
# if fname is just "." return $current_dirname
if {$fname eq "."} {
return $current_dirname
}
}
# add extension for 1.0 file format compatibility
if { $ext ne {} } {
set fname [file rootname $fname]$ext
}
# transform ./file_or_path to file_or_path, resolve (normalize) ../file_or_path
# transform ./file_or_path to file_or_path, resolve ../file_or_path
if { [regexp {^\.\./} $fname ] } {
set fname [file normalize $fname]
if { [regexp {^/} $current_dirname] } {
set fname "[file dirname $current_dirname][regsub {^\.\.} $fname {}]"
}
} elseif {[regexp {^\./} $fname ] } {
regsub {^\./} $fname {} fname
}
@ -3032,7 +3037,7 @@ if { [info exists XSCHEM_LIBRARY_PATH] } {
if { ![string compare $i .] } {
lappend pathlist $i
} elseif { [ file exists $i] } {
lappend pathlist [file normalize ${i}]
lappend pathlist ${i}
}
}
}

View File

@ -54,10 +54,9 @@
###########################################################################
## set custom colors for xschem libraries matching certain patterns
## each line contains a pattern followed by a color
## each line contains a dircolor(pattern) followed by a color
## color can be an ordinary name (grey, brown, blue) or a hex code {#77aaff}
## hex code must be enclosed in braces
## don't forget backslash at end of line
###########################################################################
# set dircolor(/share/xschem/) red
@ -67,11 +66,7 @@
## Window to open on startup XSCHEM_START_WINDOW
###########################################################################
# Start without a design:
#
# set XSCHEM_START_WINDOW {}
# Start with a design
# Start without a design if no filename given on command line:
# To avoid absolute paths, use a path that is relative to one of the
# XSCHEM_LIBRARY_PATH directories.
#