added -b/--batch cmd option (__unix__ only) to detach xschem completely from console
This commit is contained in:
parent
08bf7cb962
commit
60791062ac
|
|
@ -38,6 +38,10 @@ hierarchical representation of circuits with a top down approach.
|
||||||
Print help and exit.
|
Print help and exit.
|
||||||
.TP
|
.TP
|
||||||
|
|
||||||
|
.B -n, --batch
|
||||||
|
Detach xschem from console.
|
||||||
|
.TP
|
||||||
|
|
||||||
.B -n, --netlist
|
.B -n, --netlist
|
||||||
Do a netlist of the given schematic cell.
|
Do a netlist of the given schematic cell.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ user:~$ xschem .../xschem_library/examples/0_examples_top.sch
|
||||||
usage: xschem [options] [schematic | symbol ]
|
usage: xschem [options] [schematic | symbol ]
|
||||||
Options:
|
Options:
|
||||||
-h --help Print this help.
|
-h --help Print this help.
|
||||||
|
-b --batch Detach Xschem from console.
|
||||||
-n --netlist Do a netlist of the given schematic cell.
|
-n --netlist Do a netlist of the given schematic cell.
|
||||||
-v --version Print version information and exit.
|
-v --version Print version information and exit.
|
||||||
-V --vhdl Set netlist type to VHDL.
|
-V --vhdl Set netlist type to VHDL.
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ struct wireentry *wiretable[NBOXES][NBOXES];
|
||||||
struct instentry *insttable[NBOXES][NBOXES];
|
struct instentry *insttable[NBOXES][NBOXES];
|
||||||
size_t get_tok_value_size;
|
size_t get_tok_value_size;
|
||||||
size_t get_tok_size;
|
size_t get_tok_size;
|
||||||
|
int batch_mode = 0; /* no tcl console if set; batch mode */
|
||||||
|
|
||||||
#ifdef HAS_CAIRO
|
#ifdef HAS_CAIRO
|
||||||
cairo_surface_t *sfc, *save_sfc;
|
cairo_surface_t *sfc, *save_sfc;
|
||||||
|
|
|
||||||
24
src/main.c
24
src/main.c
|
|
@ -84,6 +84,30 @@ int main(int argc, char **argv)
|
||||||
if(debug_var>=1 && !has_x)
|
if(debug_var>=1 && !has_x)
|
||||||
fprintf(errfp, "main(): no DISPLAY set, assuming no X available\n");
|
fprintf(errfp, "main(): no DISPLAY set, assuming no X available\n");
|
||||||
|
|
||||||
|
/* detach from console (fork a child and close std file descriptors) */
|
||||||
|
#ifdef __unix__
|
||||||
|
if(batch_mode) {
|
||||||
|
pid_t pid = fork();
|
||||||
|
if(pid < 0) {
|
||||||
|
fprintf(errfp, "main(): fork() failed\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if(pid == 0) {
|
||||||
|
/* The child becomes the daemon. */
|
||||||
|
/* Detach all standard I/O descriptors */
|
||||||
|
close(0); /* stdin */
|
||||||
|
close(1); /* stdout */
|
||||||
|
close(2); /* stderr */
|
||||||
|
setsid(); /* new session */
|
||||||
|
/* Ok, now detached */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* terminate parent */
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(has_x) Tk_Main(1, argv, Tcl_AppInit);
|
if(has_x) Tk_Main(1, argv, Tcl_AppInit);
|
||||||
else Tcl_Main(1, argv, Tcl_AppInit);
|
else Tcl_Main(1, argv, Tcl_AppInit);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,9 @@ void check_opt(char *opt, char *optval, int type)
|
||||||
dbg(1, "process_options(): set netlist type to verilog\n");
|
dbg(1, "process_options(): set netlist type to verilog\n");
|
||||||
netlist_type=CAD_VERILOG_NETLIST;
|
netlist_type=CAD_VERILOG_NETLIST;
|
||||||
|
|
||||||
|
} else if( (type == SHORT && *opt == 'b') || (type == LONG && !strcmp("batch", opt)) ) {
|
||||||
|
batch_mode = 1;
|
||||||
|
|
||||||
} else if( (type == SHORT && *opt == 'v') || (type == LONG && !strcmp("version", opt)) ) {
|
} else if( (type == SHORT && *opt == 'v') || (type == LONG && !strcmp("version", opt)) ) {
|
||||||
print_version();
|
print_version();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1454,7 +1454,11 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
|
|
||||||
if(!no_readline) {
|
if(
|
||||||
|
#ifdef __unix__
|
||||||
|
!batch_mode &&
|
||||||
|
#endif
|
||||||
|
!no_readline) {
|
||||||
tcleval( "if {![catch {package require tclreadline}]} "
|
tcleval( "if {![catch {package require tclreadline}]} "
|
||||||
"{::tclreadline::readline customcompleter completer; ::tclreadline::Loop }" ) ;
|
"{::tclreadline::readline customcompleter completer; ::tclreadline::Loop }" ) ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -674,7 +674,7 @@ extern double mx_double_save, my_double_save; /* 20070322 */
|
||||||
extern struct instentry *insttable[NBOXES][NBOXES];
|
extern struct instentry *insttable[NBOXES][NBOXES];
|
||||||
extern size_t get_tok_value_size;
|
extern size_t get_tok_value_size;
|
||||||
extern size_t get_tok_size;
|
extern size_t get_tok_size;
|
||||||
|
extern int batch_mode; /* no TCL console */
|
||||||
/* functions */
|
/* functions */
|
||||||
extern void dbg(int level, char *fmt, ...);
|
extern void dbg(int level, char *fmt, ...);
|
||||||
extern void here(void);
|
extern void here(void);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
usage: xschem [options] [schematic | symbol ]
|
usage: xschem [options] [schematic | symbol ]
|
||||||
Options:
|
Options:
|
||||||
-h --help Print this help.
|
-h --help Print this help.
|
||||||
|
-b --batch Detach Xschem from console.
|
||||||
-n --netlist Do a netlist of the given schematic cell.
|
-n --netlist Do a netlist of the given schematic cell.
|
||||||
-v --version Print version information and exit.
|
-v --version Print version information and exit.
|
||||||
-V --vhdl Set netlist type to VHDL.
|
-V --vhdl Set netlist type to VHDL.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue