old_winpath[] removed from globals, put as static string into callback(), fix ngspice::annotate netlist_dir fetching.

This commit is contained in:
Stefan Frederik 2021-11-23 23:20:10 +01:00
parent 9f33230f44
commit e77b72df9c
9 changed files with 10 additions and 13 deletions

View File

@ -1,6 +1,6 @@
int find_gtk4(const char *name, int logdepth, int fatal);
int find_gtk4_modversion(const char *name, int logdepth, int fatal);
int find_epoxy(const char *name, int logdepth, int fatal, const char *call, const char *arg);
int find_epoxy(const char *name, int logdepth, int fatal);

View File

@ -141,6 +141,7 @@ void start_wire(double mx, double my)
int callback(const char *winpath, int event, int mx, int my, KeySym key,
int button, int aux, int state)
{
static char old_winpath[PATH_MAX] = ""; /* previous focused window, used to do context switch */
char str[PATH_MAX + 100];
struct stat buf;
int redraw_only;

View File

@ -136,7 +136,7 @@ int debug_var=-10; /* will be set to 0 in xinit.c */
/* These variables are NOT mirrored in tcl code */
/* -------------------------------------------- */
int help=0; /* help option set to global scope, printing help is deferred */
/* when configuration ~/.schem has been read 20140406 */
/* when configuration xschemrc has been read 20140406 */
FILE *errfp = NULL;
int no_readline=0;
char *filename=NULL; /* filename given on cmdline */
@ -162,15 +162,13 @@ int do_simulation=0;
int do_waves=0;
int do_print=0;
int quit=0; /* set from process_options (ex netlist from cmdline and quit) */
int batch_mode = 0; /* no tcl console if set; batch mode */
int detach = 0; /* no tcl console if set; batch mode */
#ifndef __unix__
char win_temp_dir[PATH_MAX]="";
const char fopen_read_mode[] = "rb";
#else
const char fopen_read_mode[] = "r";
#endif
/* previous focused schematic window (used to switch context in callback()) */
char old_winpath[PATH_MAX] = ".drw";
/* ---------------------------------------------------------- */
/* Cmdline options (used at xinit, and then not used anymore) */

View File

@ -101,7 +101,7 @@ proc annotate {} {
xschem set no_undo 1
xschem set no_draw 1
read_hspice_log [xschem get netlist_dir]/hspice.out
read_hspice_log $::netlist_dir/hspice.out
set lastinst [xschem get instances]
for { set i 0 } { $i < $lastinst } {incr i } {
set name [xschem getprop instance $i name]

View File

@ -86,7 +86,7 @@ int main(int argc, char **argv)
/* detach from console (fork a child and close std file descriptors) */
#ifdef __unix__
if(batch_mode) {
if(detach) {
pid_t pid = fork();
if(pid < 0) {
fprintf(errfp, "main(): fork() failed\n");

View File

@ -165,7 +165,7 @@ proc ngspice::resetdata {} {
proc ngspice::annotate {} {
upvar ::ngspice::ngspice_data arr
set rawfile "[xschem get netlist_dir]/[file rootname [file tail [xschem get schname 0]]].raw"
set rawfile "$::netlist_dir/[file rootname [file tail [xschem get schname 0]]].raw"
if { ![file exists $rawfile] } {
puts "no raw file found: $rawfile"
return

View File

@ -125,7 +125,7 @@ void check_opt(char *opt, char *optval, int type)
cli_opt_netlist_type=CAD_VERILOG_NETLIST;
} else if( (type == SHORT && *opt == 'b') || (type == LONG && !strcmp("detach", opt)) ) {
batch_mode = 1;
detach = 1;
} else if( (type == SHORT && *opt == 'v') || (type == LONG && !strcmp("version", opt)) ) {
print_version();

View File

@ -910,7 +910,6 @@ void new_schematic(const char *what, const char *top_path, const char *tk_win_pa
int close = 0;
dbg(1, "new_schematic() destroy\n");
/* reset old focused window so callback() will force repaint on expose events */
my_strncpy(old_winpath, "", S(old_winpath));
if(xctx->modified && has_x) {
tcleval("tk_messageBox -type okcancel -message \""
"[get_cell [xschem get schname] 0]"
@ -1838,7 +1837,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
if(
#ifdef __unix__
!batch_mode &&
!detach &&
#endif
!no_readline) {
tcleval( "if {![catch {package require tclreadline}]} "

View File

@ -858,9 +858,8 @@ extern int do_netlist;
extern int do_simulation;
extern int do_waves;
extern int quit;
extern int batch_mode; /* no TCL console */
extern int detach; /* no TCL console */
extern const char fopen_read_mode[]; /* "r" on unix, "rb" on windows */
extern char old_winpath[PATH_MAX]; /* previous focused schematic window (used to switch context) */
/*********** Cmdline options (used at xinit, and then not used anymore) ***********/
extern int cli_opt_netlist_type;