removed duplicate netlist_dir global var in C code, use tcl netlist_dir variable, some widgets now display on top of current schematic window instead of xschem`s master window (use [xschem get topwindow] instead of ".")

This commit is contained in:
Stefan Frederik 2021-11-23 17:02:36 +01:00
parent d03147dce1
commit 78934d363f
18 changed files with 2061 additions and 2041 deletions

View File

@ -145,6 +145,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../src</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -192,6 +193,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../src</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -209,6 +211,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../src</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -210,6 +210,9 @@
<Component Id="cmp2173FAF69F8540F05A67BE470A4FCB17" Guid="{FEA44B30-BE70-41F3-8C18-363563A5052F}">
<File Id="filDD49DDCF001AD260D8440CFB0E98858F" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\devices\nmos4.sym" />
</Component>
<Component Id="cmpA4A5FD83CBC33E544ABB012A4600ECB8" Guid="{927480F2-D2F6-41A7-8824-75E0585955D3}">
<File Id="filD2D0A108656474DC8B195B2F61DF621D" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\devices\nmos4_depl.sym" />
</Component>
<Component Id="cmp37519ECAC14477D855620D60E7D296A9" Guid="{1146D1FE-2314-4E76-B12C-7C0D06D9F7A4}">
<File Id="fil6AAFA18553DE113F44328829AF007F73" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\devices\noconn.sym" />
</Component>
@ -4748,6 +4751,12 @@
<Component Id="cmp4A60B0C2446905D08CB4D677B69E7F36" Guid="{DFE94F87-E9EA-4FE7-A9F7-76FE309AE27A}">
<File Id="fil3DE76BA54478D9861EA237EC9379FE44" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\logic\testbench.sym" />
</Component>
<Component Id="cmp19E0C64566E03C232164D5C9DAAC21F8" Guid="{27A2A859-B288-43F0-A47B-31572D17652C}">
<File Id="filEFAB0C788C03602789BFE71092435328" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\logic\test_mos_verilog.sch" />
</Component>
<Component Id="cmp652C5B945784DFDAEAAE49D2A8C837DA" Guid="{9CBAC4B1-BCA0-4EF4-9166-87D4D6E5B87D}">
<File Id="fil384CD799ED5DC1B66298158C9E0DA1BF" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\logic\test_mos_verilog.sym" />
</Component>
<Component Id="cmp957C66E1E554227595BB630A4EC0D0E2" Guid="{59568C71-705A-47B0-B8AD-943E5962A127}">
<File Id="filFCC31D7F725583D6E612675EE1117498" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\logic\test_ngspice.sch" />
</Component>
@ -5292,6 +5301,7 @@
<ComponentRef Id="cmp201AEE90E7E1E6B8B996CDEF03672DE2" />
<ComponentRef Id="cmpED5728849DC160EFFFBC268099D26236" />
<ComponentRef Id="cmp2173FAF69F8540F05A67BE470A4FCB17" />
<ComponentRef Id="cmpA4A5FD83CBC33E544ABB012A4600ECB8" />
<ComponentRef Id="cmp37519ECAC14477D855620D60E7D296A9" />
<ComponentRef Id="cmp70CB0082A76C56681571711FDE65D168" />
<ComponentRef Id="cmpE0C90A81F0CF6685E9FCD62FF706EC3F" />
@ -6802,6 +6812,8 @@
<ComponentRef Id="cmp82A5FB55BC880A73F37F87DC173555AA" />
<ComponentRef Id="cmp91F57720752F6C668F54790494DA6349" />
<ComponentRef Id="cmp4A60B0C2446905D08CB4D677B69E7F36" />
<ComponentRef Id="cmp19E0C64566E03C232164D5C9DAAC21F8" />
<ComponentRef Id="cmp652C5B945784DFDAEAAE49D2A8C837DA" />
<ComponentRef Id="cmp957C66E1E554227595BB630A4EC0D0E2" />
<ComponentRef Id="cmp23DA7B587E0A71317E6EDB446EDB625E" />
<ComponentRef Id="cmp3C9FD81880B7434EA7FD7217DF0B7D35" />

View File

@ -162,8 +162,8 @@ alt 'l' add lab_pin.sym to schematic
ctrl+shift 'o' Load most recent schematic
ctrl 'o' Load schematic
- 'm' Move selected obj.
shift 'N' Hierarchical netlist
- 'n' Netlist
shift 'N' Top level only netlist
- 'n' Hierarchical Netlist
ctrl 'n' New schematic
ctrl+shift 'N' New symbol
alt 'n' Empty schematic in new window

View File

@ -120,7 +120,6 @@ xcb_visualtype_t *visual_xcb;
int cadlayers=0;
int has_x=1;
int rainbow_colors = 0;
char *netlist_dir = NULL;
int color_ps=-1;
double nocairo_vert_correct=0.0;
/* lift up the text by 'n' pixels (zoom corrected) within the bbox. */
@ -179,6 +178,7 @@ char old_winpath[PATH_MAX] = ".drw";
int cli_opt_netlist_type = 0;
int cli_opt_flat_netlist = 0;
char cli_opt_plotfile[PATH_MAX] = "";
char cli_opt_netlist_dir[PATH_MAX] = "";
/* --------------------------------------------------- */

View File

@ -263,7 +263,7 @@ void create_plot_cmd(void)
my_free(1270, &viewer_name);
}
if(!exists || !viewer) return;
my_snprintf(plotfile, S(plotfile), "%s/xplot", netlist_dir);
my_snprintf(plotfile, S(plotfile), "%s/xplot", tclgetvar("netlist_dir"));
if(viewer == NGSPICE) {
if(!(fd = fopen(plotfile, "w"))) {
fprintf(errfp, "create_plot_cmd(): error opening xplot file for writing\n");

View File

@ -122,8 +122,8 @@ alt 'l' add lab_pin.sym to schematic
ctrl+shift 'o' Load most recent schematic
ctrl 'o' Load schematic
- 'm' Move selected obj.
shift 'N' Hierarchical netlist
- 'n' Netlist
shift 'N' Top level only netlist
- 'n' Hierarchical Netlist
ctrl 'n' New schematic
ctrl+shift 'N' New symbol
alt 'n' Empty schematic in new window

View File

@ -102,7 +102,7 @@ void check_opt(char *opt, char *optval, int type)
}
}
} else if( (type == SHORT && *opt == 'o') || (type == LONG && !strcmp("netlist_path", opt)) ) {
if(optval) my_strdup(48, &netlist_dir, optval);
if(optval) my_strncpy(cli_opt_netlist_dir, optval, S(cli_opt_netlist_dir));
} else if( (type == SHORT && *opt == 'N') || (type == LONG && !strcmp("netlist_filename", opt)) ) {
dbg(1, "process_options(): set netlist name to %s\n", optval);

View File

@ -271,12 +271,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
else if(!strcmp(argv[1],"clear_netlist_dir") )
{
cmd_found = 1;
my_strdup(373, &netlist_dir, "");
}
else if(!strcmp(argv[1], "color_dim"))
{
cmd_found = 1;
@ -612,9 +606,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(s, S(s), "%g", xctx->lw);
Tcl_SetResult(interp, s, TCL_VOLATILE);
}
else if(!strcmp(argv[2],"netlist_dir")) {
Tcl_SetResult(interp, netlist_dir,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"netlist_name")) {
Tcl_SetResult(interp, xctx->netlist_name, TCL_VOLATILE);
}
@ -708,6 +699,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(s, S(s), "%d",TEXTLAYER);
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"topwindow")) {
char *top_path;
top_path = xctx->top_path[0] ? xctx->top_path : ".";
Tcl_SetResult(interp, top_path,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"version")) {
char s[30]; /* overflow safe 20161122 */
my_snprintf(s, S(s), "XSCHEM V%s",XSCHEM_VERSION);
@ -850,7 +846,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
{
cmd_found = 1;
printf("*******global variables:*******\n");
printf("netlist_dir=%s\n", netlist_dir? netlist_dir: "<NULL>");
printf("INT_WIDTH(lw)=%d\n", INT_WIDTH(xctx->lw));
printf("wires=%d\n", xctx->wires);
printf("instances=%d\n", xctx->instances);
@ -2252,13 +2247,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
else if(!strcmp(argv[1],"set_netlist_dir") && argc==3)
{
cmd_found = 1;
dbg(1, "scheduler(): xschem set_netlist_dir: argv[2] = %s\n", argv[2]);
my_strdup(0, &netlist_dir, argv[2]);
}
else if(!strcmp(argv[1], "setprop"))
{
/* 0 1 2 3 4 5

View File

@ -127,7 +127,7 @@ void global_spice_netlist(int global) /* netlister driver */
}
xctx->netlist_count=0;
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid());
tclgetvar("netlist_dir"), skip_dir(xctx->sch[xctx->currsch]), getpid());
dbg(1, "global_spice_netlist(): opening %s for writing\n",netl_filename);
fd=fopen(netl_filename, "w");
@ -430,7 +430,8 @@ void spice_block_netlist(FILE *fd, int i)
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
}
if(split_f) {
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sym[i].name), getpid());
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
tclgetvar("netlist_dir"), skip_dir(xctx->sym[i].name), getpid());
dbg(1, "spice_block_netlist(): split_files: netl_filename=%s\n", netl_filename);
fd=fopen(netl_filename, "w");
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx->sym[i].name));

View File

@ -45,7 +45,7 @@ void global_tedax_netlist(int global) /* netlister driver */
}
xctx->netlist_count=0;
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid());
tclgetvar("netlist_dir"), skip_dir(xctx->sch[xctx->currsch]), getpid());
fd=fopen(netl_filename, "w");
if(xctx->netlist_name[0]) {

View File

@ -51,7 +51,7 @@ void global_verilog_netlist(int global) /* netlister driver */
/* to be printed before any entity declarations */
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
netlist_dir, skip_dir(xctx->sch[xctx->currsch]),getpid());
tclgetvar("netlist_dir"), skip_dir(xctx->sch[xctx->currsch]),getpid());
fd=fopen(netl_filename, "w");
if(xctx->netlist_name[0]) {
@ -385,7 +385,7 @@ void verilog_block_netlist(FILE *fd, int i)
}
if(split_f) {
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
netlist_dir, skip_dir(xctx->sym[i].name), getpid());
tclgetvar("netlist_dir"), skip_dir(xctx->sym[i].name), getpid());
dbg(1, "global_vhdl_netlist(): split_files: netl_filename=%s\n", netl_filename);
fd=fopen(netl_filename, "w");
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx->sym[i].name) );

View File

@ -52,7 +52,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
xctx->netlist_count=0;
str_hash_free(subckt_table);
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid());
tclgetvar("netlist_dir"), skip_dir(xctx->sch[xctx->currsch]), getpid());
fd=fopen(netl_filename, "w");
@ -441,7 +441,8 @@ void vhdl_block_netlist(FILE *fd, int i)
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
}
if(split_f) {
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sym[i].name), getpid());
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
tclgetvar("netlist_dir"), skip_dir(xctx->sym[i].name), getpid());
dbg(1, "vhdl_block_netlist(): split_files: netl_filename=%s\n", netl_filename);
fd=fopen(netl_filename, "w");
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(xctx->sym[i].name) );

View File

@ -652,7 +652,6 @@ void xwin_exit(void)
for(i=0;i<127;i++) my_free(1140, &character[i]);
dbg(1, "xwin_exit(): closed display\n");
my_free(1141, &filename);
my_free(1142, &netlist_dir);
my_free(1143, &xschem_executable);
record_global_node(2, NULL, NULL); /* delete global node array */
dbg(1, "xwin_exit(): deleted undo buffer\n");
@ -1702,10 +1701,12 @@ int Tcl_AppInit(Tcl_Interp *inter)
/* */
/* set tcl netlist_dir if netlist_dir given on cmdline */
if(netlist_dir && netlist_dir[0]) tclsetvar("netlist_dir", netlist_dir);
if(cli_opt_netlist_dir[0]) tclsetvar("netlist_dir", cli_opt_netlist_dir);
if(!set_netlist_dir(0, NULL)) {
fprintf(errfp, "problems creating netlist directory %s\n", netlist_dir ? netlist_dir : "<NULL>");
const char *n;
n = tclgetvar("netlist_dir");
fprintf(errfp, "problems creating netlist directory %s\n", n ? n : "<NULL>");
}
if(initial_netlist_name[0]) my_strncpy(xctx->netlist_name, initial_netlist_name, S(initial_netlist_name));
@ -1762,7 +1763,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
fprintf(errfp, "xschem: cant do a netlist without a filename\n");
tcleval("exit");
}
if(netlist_dir && netlist_dir[0]) {
if(tclgetvar("netlist_dir")[0]) {
if(xctx->netlist_type == CAD_SPICE_NETLIST)
global_spice_netlist(1); /* 1 means global netlist */
else if(xctx->netlist_type == CAD_VHDL_NETLIST)

View File

@ -822,7 +822,6 @@ extern xcb_visualtype_t *visual_xcb;
extern int cadlayers;
extern int has_x;
extern int rainbow_colors;
extern char *netlist_dir;
extern int color_ps;
extern double nocairo_vert_correct;
extern double cairo_vert_correct;
@ -867,6 +866,7 @@ extern char old_winpath[PATH_MAX]; /* previous focused schematic window (used to
extern int cli_opt_netlist_type;
extern int cli_opt_flat_netlist;
extern char cli_opt_plotfile[PATH_MAX];
extern char cli_opt_netlist_dir[PATH_MAX];
/*********** Following data is relative to the current schematic ***********/
extern Xschem_ctx *xctx;

View File

@ -353,7 +353,8 @@ proc load_recent_file {} {
if {[catch { source $USER_CONF_DIR/recent_files } err] } {
puts "Problems opening recent_files: $err"
if {[info exists has_x]} {
tk_messageBox -message "Problems opening recent_files: $err" -icon warning -parent . -type ok
tk_messageBox -message "Problems opening recent_files: $err" \
-icon warning -parent [xschem get topwindow] -type ok
}
}
}
@ -449,7 +450,8 @@ proc set_sim_defaults {} {
if { [catch {source ${USER_CONF_DIR}/simrc} err]} {
puts "Problems opening simrc file: $err"
if {[info exists has_x]} {
tk_messageBox -message "Problems opening simrc file: $err" -icon warning -parent . -type ok
tk_messageBox -message "Problems opening simrc file: $err" -icon warning \
-parent [xschem get topwindow] -type ok
}
set failure 1
}
@ -1519,7 +1521,7 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}} {init
if {[file exists "$myload_dir1/$myload_retval"]} {
if {$confirm_overwrt == 1 } {
set answer [tk_messageBox -message "Overwrite $myload_dir1/${myload_retval}?" \
-icon warning -parent . -type okcancel]
-icon warning -parent [xschem get topwindow] -type okcancel]
} else {
set answer ok
}
@ -1534,7 +1536,7 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}} {init
if { $myload_type eq {0} } {
set answer [
tk_messageBox -message "$myload_dir1/$myload_retval does not seem to be an xschem file...\nContinue?" \
-icon warning -parent . -type yesno]
-icon warning -parent [xschem get topwindow] -type yesno]
if { $answer eq "no"} {
set myload_retval {}
return {}
@ -1544,7 +1546,7 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}} {init
} elseif { $myload_type ne {SYMBOL} && ($ext eq {.sym}) } {
set answer [
tk_messageBox -message "$myload_dir1/$myload_retval does not seem to be a SYMBOL file...\nContinue?" \
-icon warning -parent . -type yesno]
-icon warning -parent [xschem get topwindow] -type yesno]
if { $answer eq "no"} {
set myload_retval {}
return {}
@ -1799,7 +1801,6 @@ proc simuldir {} {
set simdir [xschem get current_dirname]/simulation
file mkdir $simdir
set netlist_dir $simdir
xschem set_netlist_dir $netlist_dir
return $netlist_dir
}
return {}
@ -1821,7 +1822,6 @@ proc select_netlist_dir { force {dir {} }} {
file mkdir $netlist_dir
}
regsub {^~/} $netlist_dir ${env(HOME)}/ netlist_dir
xschem set_netlist_dir $netlist_dir
return $netlist_dir
}
if { $dir eq {} } {
@ -1835,7 +1835,8 @@ proc select_netlist_dir { force {dir {} }} {
}
}
# 20140409 do not change netlist_dir if user Cancels action
set new_dir [tk_chooseDirectory -initialdir $initdir -parent . -title {Select netlist DIR} -mustexist false]
set new_dir [tk_chooseDirectory -initialdir $initdir \
-parent [xschem get topwindow] -title {Select netlist DIR} -mustexist false]
} else {
set new_dir $dir
}
@ -1847,7 +1848,6 @@ proc select_netlist_dir { force {dir {} }} {
set netlist_dir $new_dir
}
regsub {^~/} $netlist_dir ${env(HOME)}/ netlist_dir
xschem set_netlist_dir $netlist_dir
return $netlist_dir
}

View File

@ -51,6 +51,8 @@ function replace_pattern(old, new)
replace_pattern("zoom_full[:(:][:):]:.*$", "zoom_full(): ***Removed***")
replace_pattern("bbox[:(:][:):]: bbox=.*$", "bbox(): bbox=***Removed***")
replace_pattern("draw_string()[:(:][:):]:.*$", "draw_string(): ***Removed***")
replace_pattern("find_best_color.*$", "find_best_color ***Removed***")
replace_pattern("trim_wires.*$", "trim_wires ***Removed***")
__a[__lines++] = $0
}