diff --git a/Makefile.conf.in b/Makefile.conf.in index c795d63c..165c8228 100644 --- a/Makefile.conf.in +++ b/Makefile.conf.in @@ -2,6 +2,7 @@ put /local/xschem/cflags [@ @cc/cflags@ @?libs/sul/libjpeg/cflags@ @?libs/gui/cairo/cflags@ + @?libs/tty/readline/cflags@ @?libs/gui/xrender/cflags@ @?libs/gui/xcb/cflags@ @?libs/gui/xcb_render/cflags@ @@ -16,6 +17,7 @@ put /local/xschem/ldflags [@ -lm @?libs/sul/libjpeg/ldflags@ @?libs/gui/cairo/ldflags@ + @?libs/tty/readline/ldflags@ @?libs/gui/xrender/ldflags@ @?libs/gui/xcb/ldflags@ @?libs/gui/xcb_render/ldflags@ diff --git a/config.h.in b/config.h.in index 2fdf0aaa..9714da81 100644 --- a/config.h.in +++ b/config.h.in @@ -12,6 +12,7 @@ put /local/xschem/includes [@ @] uniq /local/xschem/includes +gsub /local/xschem/includes {[\\][n]} {\n} put /tmpasm/IFS { \t\r\n} @@ -24,6 +25,9 @@ print {\n\n/* Uncomment following line to work around some GPU problems in graph print {/* with tiled fill pattern. Restore of damaged content will use XCopyArea() */\n} print {/* #define FIX_BROKEN_TILED_FILL 1 */} +print {\n\n/* Define this var if libreadline is available and is to be used */\n} +print_ternary ?libs/tty/readline/presents {#define HAS_LIBREADLINE 1} {/*#undef HAS_LIBREADLINE */} + print {\n\n/* Define this var if libjpeg is available and is to be used */\n} print_ternary ?libs/sul/libjpeg/presents {#define HAS_LIBJPEG 1} {/*#undef HAS_LIBJPEG */} diff --git a/scconfig/Makefile b/scconfig/Makefile index 195b29ae..9292fb19 100644 --- a/scconfig/Makefile +++ b/scconfig/Makefile @@ -53,7 +53,7 @@ include $(SRC)/parsgen/Makefile.plugin include $(SRC)/gui/Makefile.plugin # Comment this line if you do not need tty (nurses, slang, pty-related calls) -#include $(SRC)/tty/Makefile.plugin +include $(SRC)/tty/Makefile.plugin # Comment this line if you do not need software utility libs (gen*, glib) #include $(SRC)/sul/Makefile.plugin diff --git a/scconfig/hooks.c b/scconfig/hooks.c index ff44eb0a..23e2d390 100644 --- a/scconfig/hooks.c +++ b/scconfig/hooks.c @@ -297,6 +297,7 @@ int hook_detect_target() require("fstools/awk", 0, 1); require("libs/gui/xpm/*", 0, 1); require("libs/gui/cairo/*", 0, 0); + require("libs/tty/readline/*", 0, 0); require("libs/sul/libjpeg/*", 0, 0); /* require("libs/types/stdint/*", 0, 0); */ require("sys/types/size/4_u_int", 0, 1); @@ -372,6 +373,7 @@ int hook_generate() printf(" tcl: %s\n", get("/target/libs/script/tcl/ldflags")); printf(" tk: %s\n", get("/target/libs/script/tk/ldflags")); printf(" cairo: %s\n", istrue(get("/target/libs/gui/cairo/presents")) ? "yes" : "no"); + printf(" readline: %s\n", istrue(get("/target/libs/tty/readline/presents")) ? "yes" : "no"); printf(" libjpeg: %s\n", istrue(get("/target/libs/sul/libjpeg/presents")) ? "yes" : "no"); printf(" xcb: %s\n", istrue(get("/target/libs/gui/xcb/presents")) ? "yes" : "no"); diff --git a/src/options.c b/src/options.c index 45ef2c76..f218b717 100644 --- a/src/options.c +++ b/src/options.c @@ -27,38 +27,38 @@ static void check_opt(char *opt, char *optval, int type) { if( (type == SHORT && *opt == 'd') || (type == LONG && !strcmp("debug", opt)) ) { - if(optval) debug_var=atoi(optval); + if(optval) debug_var = atoi(optval); else debug_var = 0; } else if( (type == SHORT && *opt == 'S') || (type == LONG && !strcmp("simulate", opt)) ) { dbg(1, "process_options(): will do simulation\n"); - cli_opt_do_simulation=1; + cli_opt_do_simulation = 1; } else if( (type == SHORT && *opt == 'W') || (type == LONG && !strcmp("waves", opt)) ) { dbg(1, "process_options(): will show waves\n"); - cli_opt_do_waves=1; + cli_opt_do_waves = 1; } else if( (type == SHORT && *opt == 'n') || (type == LONG && !strcmp("netlist", opt)) ) { dbg(1, "process_options(): will do netlist\n"); - cli_opt_do_netlist=1; + cli_opt_do_netlist = 1; } else if( (type == SHORT && *opt == 'f') || (type == LONG && !strcmp("flat_netlist", opt)) ) { dbg(1, "process_options(): set flat netlist\n"); - cli_opt_flat_netlist=1; + cli_opt_flat_netlist = 1; } else if( (type == SHORT && *opt == 'r') || (type == LONG && !strcmp("no_readline", opt)) ) { - cli_opt_no_readline=1; + cli_opt_no_readline = 1; } else if( (type == LONG && !strcmp("pipe", opt)) ) { - cli_opt_no_readline=1; + cli_opt_no_readline = 1; } else if( (type == SHORT && *opt == 'p') || (type == LONG && !strcmp("postscript", opt)) ) { dbg(1, "process_options(): will print postscript/pdf\n"); - cli_opt_do_print=1; + cli_opt_do_print = 1; } else if( (type == LONG && !strcmp("pdf", opt)) ) { dbg(1, "process_options(): will print postscript/pdf\n"); - cli_opt_do_print=1; + cli_opt_do_print = 1; } else if( (type == LONG && !strcmp("plotfile", opt)) ) { dbg(1, "process_options(): user plotfile specified: %s\n", optval ? optval : "NULL"); @@ -70,7 +70,7 @@ static void check_opt(char *opt, char *optval, int type) } else if( (type == LONG && !strcmp("png", opt)) ) { dbg(1, "process_options(): will print png\n"); - cli_opt_do_print=2; + cli_opt_do_print = 2; } else if( (type == LONG && !strcmp("preinit", opt)) ) { dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); @@ -94,26 +94,26 @@ static void check_opt(char *opt, char *optval, int type) } else if( (type == LONG && !strcmp("tcp_port", opt)) ) { dbg(1, "process_options(): setting tcp port: %s\n", optval); - if(optval) tcp_port=atoi(optval); + if(optval) tcp_port = atoi(optval); else tcp_port = 0; } else if( (type == LONG && !strcmp("svg", opt)) ) { dbg(1, "process_options(): will print png\n"); - cli_opt_do_print=3; + cli_opt_do_print = 3; } else if( (type == SHORT && *opt == 'c') || (type == LONG && !strcmp("color_ps", opt)) ) { dbg(1, "process_options(): set color postscript\n"); - color_ps=1; + color_ps = 1; } else if( (type == SHORT && *opt == 'i') || (type == LONG && !strcmp("no_rcload", opt)) ) { - cli_opt_load_initfile=0; + cli_opt_load_initfile = 0; } else if( (type == SHORT && *opt == 'l') || (type == LONG && !strcmp("log", opt)) ) { if(optval) { errfp = fopen(optval, "w"); setvbuf(errfp, NULL, _IOLBF, 0); /* line (_IOLBF) or disable (_IONBF) buffering on error log */ if(!errfp) { - errfp=stderr; + errfp = stderr; dbg(0, "Problems opening log file: %s\n", optval); } } @@ -126,44 +126,44 @@ static void check_opt(char *opt, char *optval, int type) } else if( (type == SHORT && *opt == 's') || (type == LONG && !strcmp("spice", opt)) ) { dbg(1, "process_options(): set netlist type to spice\n"); - cli_opt_netlist_type=CAD_SPICE_NETLIST; + cli_opt_netlist_type = CAD_SPICE_NETLIST; } else if( (type == SHORT && *opt == 'y') || (type == LONG && !strcmp("symbol", opt)) ) { dbg(1, "process_options(): set netlist type to symbol\n"); - cli_opt_netlist_type=CAD_SYMBOL_ATTRS; + cli_opt_netlist_type = CAD_SYMBOL_ATTRS; } else if( (type == SHORT && *opt == 'V') || (type == LONG && !strcmp("vhdl", opt)) ) { dbg(1, "process_options(): set netlist type to vhdl\n"); - cli_opt_netlist_type=CAD_VHDL_NETLIST; + cli_opt_netlist_type = CAD_VHDL_NETLIST; } else if( (type == SHORT && *opt == 'w') || (type == LONG && !strcmp("verilog", opt)) ) { dbg(1, "process_options(): set netlist type to verilog\n"); - cli_opt_netlist_type=CAD_VERILOG_NETLIST; + cli_opt_netlist_type = CAD_VERILOG_NETLIST; } else if( (type == SHORT && *opt == 'b') || (type == LONG && !strcmp("detach", opt)) ) { cli_opt_detach = 1; } else if( (type == SHORT && *opt == 'v') || (type == LONG && !strcmp("version", opt)) ) { print_version(); - cli_opt_quit=1; - has_x=0; + 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; + cli_opt_netlist_type = CAD_TEDAX_NETLIST; } else if( (type == SHORT && *opt == 'q') || (type == LONG && !strcmp("quit", opt)) ) { - cli_opt_quit=1; + cli_opt_quit = 1; } else if( (type == SHORT && *opt == 'x') || (type == LONG && !strcmp("no_x", opt)) ) { - has_x=0; + has_x = 0; } else if( (type == SHORT && *opt == 'z') || (type == LONG && !strcmp("rainbow", opt)) ) { - rainbow_colors=1; + rainbow_colors = 1; } else if( (type == SHORT && *opt == 'h') || (type == LONG && !strcmp("help", opt)) ) { - help=1; - cli_opt_quit=1; - has_x=0; + help = 1; + cli_opt_quit = 1; + has_x = 0; } else { fprintf(errfp, "Unknown option: %s\n", opt); }