quit and detach globals refactored to cli_opt_quit and cli_opt_detach
This commit is contained in:
parent
b60cbf3086
commit
33eb3fecce
|
|
@ -168,8 +168,6 @@ int yyparse_error = 0;
|
|||
char *xschem_executable=NULL;
|
||||
Tcl_Interp *interp = NULL;
|
||||
double *character[256]; /* array or per-char coordinates of xschem internal vector font */
|
||||
int quit=0; /* set from process_options (ex netlist from cmdline and quit) */
|
||||
int detach = 0; /* no tcl console if set; batch mode */
|
||||
#ifndef __unix__
|
||||
char win_temp_dir[PATH_MAX]="";
|
||||
const char fopen_read_mode[] = "rb";
|
||||
|
|
@ -197,6 +195,8 @@ int cli_opt_do_print=0;
|
|||
int cli_opt_do_netlist=0; /* set by process_options if user wants netllist from cmdline */
|
||||
int cli_opt_do_simulation=0;
|
||||
int cli_opt_do_waves=0;
|
||||
int cli_opt_detach = 0; /* no tcl console if set; batch mode */
|
||||
int cli_opt_quit=0; /* set from process_options (ex netlist from cmdline and quit) */
|
||||
char cli_opt_tcl_script[PATH_MAX] = {'\0'};
|
||||
char cli_opt_initial_netlist_name[PATH_MAX]={0};
|
||||
char cli_opt_rcfile[PATH_MAX] = {'\0'};
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ int main(int argc, char **argv)
|
|||
my_strdup(_ALLOC_ID_, &xschem_executable, argv[0]);
|
||||
if(debug_var>=1 && !has_x)
|
||||
fprintf(errfp, "main(): no DISPLAY set, assuming no X available\n");
|
||||
/* if detach is 1 no interactive command shell is created ...
|
||||
* using detach if no windowing exists (has_x == 0) is non sense so do nothing
|
||||
/* if cli_opt_detach is 1 no interactive command shell is created ...
|
||||
* using cli_opt_detach if no windowing exists (has_x == 0) is non sense so do nothing
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
if(detach) {
|
||||
if(cli_opt_detach) {
|
||||
fclose(stdin);
|
||||
#ifdef __unix__
|
||||
freopen("/dev/null", "w", stdout);
|
||||
|
|
@ -111,7 +111,7 @@ int main(int argc, char **argv)
|
|||
freopen("nul", "w", stderr);
|
||||
#endif
|
||||
}
|
||||
if(detach && has_x) {
|
||||
if(cli_opt_detach && has_x) {
|
||||
Tcl_FindExecutable(argv[0]); /* tcl stores executable name for its internal usage */
|
||||
interp = Tcl_CreateInterp(); /* create the tcl interpreter */
|
||||
Tcl_AppInit(interp); /* execute our init function */
|
||||
|
|
|
|||
|
|
@ -138,18 +138,18 @@ static 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)) ) {
|
||||
detach = 1;
|
||||
cli_opt_detach = 1;
|
||||
|
||||
} else if( (type == SHORT && *opt == 'v') || (type == LONG && !strcmp("version", opt)) ) {
|
||||
print_version();
|
||||
quit=1;
|
||||
cli_opt_quit=1;
|
||||
has_x=0;
|
||||
} else if( (type == SHORT && *opt == 't') || (type == LONG && !strcmp("tedax", opt)) ) {
|
||||
dbg(1, "process_options(): set netlist type to tEDAx\n");
|
||||
cli_opt_netlist_type=CAD_TEDAX_NETLIST;
|
||||
|
||||
} else if( (type == SHORT && *opt == 'q') || (type == LONG && !strcmp("quit", opt)) ) {
|
||||
quit=1;
|
||||
cli_opt_quit=1;
|
||||
|
||||
} else if( (type == SHORT && *opt == 'x') || (type == LONG && !strcmp("no_x", opt)) ) {
|
||||
has_x=0;
|
||||
|
|
@ -159,7 +159,7 @@ static void check_opt(char *opt, char *optval, int type)
|
|||
|
||||
} else if( (type == SHORT && *opt == 'h') || (type == LONG && !strcmp("help", opt)) ) {
|
||||
help=1;
|
||||
quit=1;
|
||||
cli_opt_quit=1;
|
||||
has_x=0;
|
||||
} else {
|
||||
fprintf(errfp, "Unknown option: %s\n", opt);
|
||||
|
|
|
|||
|
|
@ -909,7 +909,7 @@ static void xwin_exit(void)
|
|||
dbg(1, "xwin_exit(): closing tcp servers\n");
|
||||
tcleval("if {[info exists xschem_server_getdata(server)]} { close $xschem_server_getdata(server) }");
|
||||
tcleval("if {[info exists bespice_server_getdata(server)]} { close $bespice_server_getdata(server) }");
|
||||
if(!detach) printf("\n");
|
||||
if(!cli_opt_detach) printf("\n");
|
||||
init_done=0; /* 20150409 to avoid multiple calls */
|
||||
}
|
||||
|
||||
|
|
@ -2817,7 +2817,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
tcleval(cli_opt_tcl_post_command);
|
||||
}
|
||||
|
||||
if(quit) {
|
||||
if(cli_opt_quit) {
|
||||
tcleval("exit");
|
||||
}
|
||||
|
||||
|
|
@ -2827,7 +2827,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
/* */
|
||||
|
||||
|
||||
if(tclgetboolvar("use_tclreadline") && !detach && !cli_opt_no_readline) {
|
||||
if(tclgetboolvar("use_tclreadline") && !cli_opt_detach && !cli_opt_no_readline) {
|
||||
tcleval( "if {![catch {package require tclreadline}]} "
|
||||
"{::tclreadline::readline builtincompleter 0;"
|
||||
"::tclreadline::readline customcompleter completer;"
|
||||
|
|
|
|||
|
|
@ -1109,8 +1109,6 @@ extern int yyparse_error;
|
|||
extern char *xschem_executable;
|
||||
extern Tcl_Interp *interp;
|
||||
extern double *character[256];
|
||||
extern int quit;
|
||||
extern int detach; /* no TCL console */
|
||||
extern const char fopen_read_mode[]; /* "r" on unix, "rb" on windows */
|
||||
|
||||
/*********** Cmdline options (used at xinit, and then not used anymore) ***********/
|
||||
|
|
@ -1130,6 +1128,8 @@ extern int cli_opt_do_print;
|
|||
extern int cli_opt_do_netlist;
|
||||
extern int cli_opt_do_simulation;
|
||||
extern int cli_opt_do_waves;
|
||||
extern int cli_opt_detach; /* no TCL console */
|
||||
extern int cli_opt_quit;
|
||||
extern char cli_opt_tcl_script[PATH_MAX];
|
||||
extern char cli_opt_initial_netlist_name[PATH_MAX];
|
||||
extern char cli_opt_rcfile[PATH_MAX];
|
||||
|
|
|
|||
Loading…
Reference in New Issue