From 0ebe36bc8ff5bf8bf502e154dc7f5adb7993191d Mon Sep 17 00:00:00 2001
From: Stefan Frederik
+ XSCHEM is usually launched from a terminal, the terminal becomes a TCL shell where commands can be sent to xschem. + For this reason XSCHEM should not be launched in background, as any I/O operation to/from the terminal will block + the program. If you don't plan to use the terminal just start XSCHEM with the -b option: xschem -b. + XSCHEM will fork itself in the background detaching from the terminal. +
+diff --git a/src/callback.c b/src/callback.c index cd74bca4..2a330059 100644 --- a/src/callback.c +++ b/src/callback.c @@ -743,7 +743,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key, "[get_cell [xschem get schname] 0]" ": UNSAVED data: want to exit?\""); } - if(!xctx->modified || !strcmp(tclresult(),"ok")) tcleval( "exit"); + if(!xctx->modified || !strcmp(tclresult(),"ok")) tcleval("exit"); } } else { /* xschem new_schematic destroy asks user confirmation if schematic changed */ diff --git a/src/psprint.c b/src/psprint.c index 530b658e..dc88738e 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -673,7 +673,8 @@ void create_ps(char **psfile, int what) } ps_colors=my_calloc(311, cadlayers, sizeof(Ps_color)); if(ps_colors==NULL){ - fprintf(errfp, "create_ps(): calloc error\n");tcleval( "exit"); + fprintf(errfp, "create_ps(): calloc error\n"); + return; } fill_ps_colors(); diff --git a/src/save.c b/src/save.c index 3e4fc237..c92d50b1 100644 --- a/src/save.c +++ b/src/save.c @@ -1169,8 +1169,9 @@ static void init_undo(void) if(!xctx->undo_initialized) { /* create undo directory */ if( !my_strdup(644, &xctx->undo_dirname, create_tmpdir("xschem_undo_") )) { - fprintf(errfp, "xinit(): problems creating tmp undo dir\n"); - tcleval("exit"); + dbg(0, "xinit(): problems creating tmp undo dir, Undo will be disabled\n"); + dbg(0, "xinit(): Check permissions in %s\n", XSCHEM_TMP_DIR); + xctx->no_undo = 1; /* disable undo */ } xctx->undo_initialized = 1; } @@ -1424,8 +1425,9 @@ static void get_sym_type(const char *symname, char **type, case 'B': fscan_ret = fscanf(fd, "%d",&c); if(fscan_ret != 1 || c <0 || c>=cadlayers) { - fprintf(errfp,"FATAL: box layer wrong or missing or > defined cadlayers, increase cadlayers\n"); - tcleval( "exit"); + fprintf(errfp,"get_sym_type(): box layer wrong or missing or > defined cadlayers, ignoring, increase cadlayers\n"); + ungetc(tag[0], fd); + read_record(tag[0], fd, 1); } fscan_ret = fscanf(fd, "%lf %lf %lf %lf ",&box.x1, &box.y1, &box.x2, &box.y2); if(fscan_ret < 4) dbg(0, "Warning: missing fields in 'B' line\n"); @@ -1698,7 +1700,7 @@ int load_sym_def(const char *name, FILE *embed_fd) if((lcc[level].fd=fopen(sympath, fopen_read_mode))==NULL) { fprintf(errfp, "l_s_d(): systemlib/missing.sym missing, I give up\n"); - tcleval( "exit"); + tcleval("exit"); } } dbg(1, "l_s_d(): fopen1(%s), level=%d, fd=%p\n",sympath, level, lcc[level].fd); diff --git a/src/svgdraw.c b/src/svgdraw.c index d7d86775..dad4d6e1 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -577,7 +577,8 @@ void svg_draw(void) svg_restore_lw(); svg_colors=my_calloc(419, cadlayers, sizeof(Svg_color)); if(svg_colors==NULL){ - fprintf(errfp, "svg_draw(): calloc error\n");tcleval( "exit"); + fprintf(errfp, "svg_draw(): calloc error\n"); + return; } fill_svg_colors(); old_grid=tclgetboolvar("draw_grid"); diff --git a/src/xschem.tcl b/src/xschem.tcl index 808e7790..339d19a9 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -105,7 +105,7 @@ proc execute_wait {status args} { # while waiting for process to end. proc execute {status args} { global execute_id execute_status - global execute_data + global execute_data has_x global execute_cmd global execute_pipe if {![info exists execute_id]} { @@ -116,6 +116,10 @@ proc execute {status args} { set id $execute_id if { [catch {open "|$args" r} err] } { puts stderr "Proc execute error: $err" + if { [info exists has_x]} { + tk_messageBox -message "Can not execute '$args': ensure it is available on the system. Error: $err" \ + -icon error -parent [xschem get topwindow] -type ok + } return -1 } else { set pipe $err