avoid quitting the program for some serious but non fatal errors, add some error reporting, some documentation updates (faq.html)

This commit is contained in:
Stefan Frederik 2021-11-29 17:29:09 +01:00
parent d4fb14a0bb
commit 0ebe36bc8f
6 changed files with 25 additions and 9 deletions

View File

@ -49,6 +49,14 @@ p{padding: 15px 30px 10px;}
</p>
<h3> I start xschem in the background and it freezes. Why?</h3>
<p class="faq">
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: <kbd>xschem -b</kbd>.
XSCHEM will fork itself in the background detaching from the terminal.
</p>
<h3> </h3>
<p class="faq">

View File

@ -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 */

View File

@ -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();

View File

@ -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);

View File

@ -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");

View File

@ -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