remove calls to ngspice::resetdata in C code, done in ngspice annotator when reading a new file and in xinit.c when exiting the program. Some File menu item reordering

This commit is contained in:
Stefan Frederik 2021-12-01 00:35:52 +01:00
parent 6cf6c58841
commit d98c855135
6 changed files with 18 additions and 16 deletions

View File

@ -273,14 +273,13 @@ void new_window(const char* cell, int symbol)
fprintf(errfp, "new_window(): executable not found\n");
return;
}
fprintf(errfp, "new_window(): fork error 1\n");
tcleval("exit");
fprintf(errfp, "new_window(): feature doesn't exist\n");
}
#endif
const char *get_file_path(char *f)
{
char tmp[2*PATH_MAX+100];
my_snprintf(tmp, S(tmp),"get_file_path \"%s\"", f);
my_snprintf(tmp, S(tmp),"get_file_path {%s}", f);
tcleval(tmp);
return tclresult();
}

View File

@ -982,7 +982,6 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
{
if(xctx->semaphore >= 2) break;
tcleval("catch { ngspice::resetdata }");
ask_new_file();
break;
}

View File

@ -28,8 +28,8 @@ namespace eval ngspice {
proc ngspice::read_ngspice_raw {arr fp} {
upvar $arr var
unset -nocomplain var
unset -nocomplain var
set variables 0
while {[gets $fp line] >= 0} {
if {$line eq "Binary:"} break
@ -173,6 +173,8 @@ proc ngspice::annotate {} {
set fp [open $rawfile r]
fconfigure $fp -translation binary
set op_point_read 0
## not needed: done in ngspice::read_ngspice_raw
# array unset ::ngspice::ngspice_data
while 1 {
ngspice::read_ngspice_raw arr $fp
if { [info exists arr(n\ points)] } {

View File

@ -1423,7 +1423,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"load") )
{
cmd_found = 1;
tcleval("catch { ngspice::resetdata }");
if(argc==3) {
if(!has_x || !xctx->modified || !save(1) ) { /* save(1)==1 --> user cancel */
dbg(1, "scheduler(): load: filename=%s\n", argv[2]);
@ -1448,7 +1447,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
char fullname[PATH_MAX];
cmd_found = 1;
tcleval("catch { ngspice::resetdata }");
if(argc>=3) {
my_snprintf(fullname, S(fullname),"%s", argv[2]);
} else {

View File

@ -591,14 +591,17 @@ void delete_schematic_data(void)
/* clear static data in get_tok_value() must be done after unselect_all()
* as this functions re-uses get_tok_value() */
get_tok_value(NULL, NULL, 0); /* clear static data in function */
delete_netlist_structs(); /* netlist - specific data and hash tables */
/* delete inst and wire node fields, delete inst_pin spatial hash, and node hash table */
delete_netlist_structs();
clear_all_hilights(); /* data structs for hilighting nets/instances */
get_unnamed_node(0, 0, 0); /* net### enumerator used for netlisting */
if(has_x) {
resetwin(0, 1, 1, 0, 0); /* delete preview pixmap, delete cairo surfaces */
free_gc();
}
clear_drawing(); /* delete instances, wires, lines, rects, ... */
/* delete instances, wires, lines, rects, arcs, polys, texts, hash_inst, hash_wire,
* inst & wire .node fields, instance name hash */
clear_drawing();
remove_symbols();
free_xschem_data(); /* delete the xctx struct */
}
@ -611,6 +614,7 @@ void xwin_exit(void)
dbg(0, "xwin_exit() double call, doing nothing...\n");
return;
}
tcleval("catch { ngspice::resetdata }"); /* remove ngspice annotation data if any */
delete_schematic_data();
if(has_x) {
Tk_DestroyWindow(mainwindow);

View File

@ -3922,17 +3922,17 @@ proc build_widgets { {topwin {} } } {
xschem new_symbol_window
}
$topwin.menubar.file.menu add command -label "Open" -command "xschem load" -accelerator {Ctrl+O}
$topwin.menubar.file.menu add command -label {Open new window [exp]} -command "xschem load_new_window"
toolbar_create FileOpen "xschem load" "Open File" $topwin
$topwin.menubar.file.menu add command -label "Delete files" -command "xschem delete_files" -accelerator {Shift-D}
$topwin.menubar.file.menu add cascade -label "Open Recent" -menu $topwin.menubar.file.menu.recent
$topwin.menubar.file.menu add cascade -label {Open Recent in new window [exp]} \
-menu $topwin.menubar.file.menu.recent_new_window
menu $topwin.menubar.file.menu.recent_new_window -tearoff 0
menu $topwin.menubar.file.menu.recent -tearoff 0
setup_recent_menu 0 $topwin
setup_recent_menu 1 $topwin
$topwin.menubar.file.menu add cascade -label "Open Recent" -menu $topwin.menubar.file.menu.recent
$topwin.menubar.file.menu add cascade -label {Open Recent in new window [exp]} \
-menu $topwin.menubar.file.menu.recent_new_window
$topwin.menubar.file.menu add command -label {Open new window [exp]} -command "xschem load_new_window"
toolbar_create FileOpen "xschem load" "Open File" $topwin
$topwin.menubar.file.menu add command -label "Delete files" -command "xschem delete_files" -accelerator {Shift-D}
$topwin.menubar.file.menu add command -label "Open Most Recent" \
-command {xschem load [lindex "$recentfile" 0]} -accelerator {Ctrl+Shift+O}
$topwin.menubar.file.menu add command -label "Save" -command "xschem save" -accelerator {Ctrl+S}