don`t try bring up the info ERC window if xschem is used in cli mode without X; filter out some events from graph event callback

This commit is contained in:
Stefan Frederik 2022-01-06 22:38:00 +01:00
parent 6297d1ac15
commit 71a98e78f5
9 changed files with 57 additions and 15 deletions

View File

@ -48,3 +48,35 @@ int find_script_mujs(const char *name, int logdepth, int fatal)
return try_fail(logdepth, "libs/script/mujs");
}
int find_script_mujs_isboolean(const char *name, int logdepth, int fatal)
{
const char *inc, *cflags, *ldflags;
char *test_c =
NL "#include <stdio.h>"
NL "#include <mujs.h>"
NL "int main() {"
NL " if (JS_ISBOOLEAN != JS_ISSTRING)"
NL " puts(\"OK\");"
NL " return 0;"
NL "}"
NL;
require("cc/cc", logdepth, fatal);
require("libs/script/mujs", logdepth, fatal);
report("Checking for mujs JS_ISBOOLEAN... ");
logprintf(logdepth, "find_mujs: trying to find mujs JS_ISBOOLEAN...\n");
logdepth++;
inc = get("libs/script/mujs/includes");
cflags = get("libs/script/mujs/cflags");
ldflags = get("libs/script/mujs/ldflags");
/* Look at the standard place */
if (try_icl(logdepth, "libs/script/mujs_isboolean", test_c, inc, cflags, ldflags))
return 0;
return try_fail(logdepth, "libs/script/mujs_isboolean");
}

View File

@ -42,6 +42,7 @@ void deps_scripts_init()
dep_add("libs/script/funlisp/*", find_script_funlisp);
dep_add("libs/script/duktape/*", find_script_duktape);
dep_add("libs/script/mujs/*", find_script_mujs);
dep_add("libs/script/mujs_isboolean/*", find_script_mujs_isboolean);
dep_add("libs/script/m4/bin/*", find_script_m4);
dep_add("libs/script/welltype/*", find_script_welltype);
dep_add("libs/script/welltype/wtc/*", find_script_wtc);

View File

@ -26,6 +26,7 @@ int find_script_estutter(const char *name, int logdepth, int fatal);
int find_script_funlisp(const char *name, int logdepth, int fatal);
int find_script_duktape(const char *name, int logdepth, int fatal);
int find_script_mujs(const char *name, int logdepth, int fatal);
int find_script_mujs_isboolean(const char *name, int logdepth, int fatal);
int find_script_fungw(const char *name, int logdepth, int fatal);
int find_script_fungw_user_call_ctx(const char *name, int logdepth, int fatal);
int find_script_fungw_cfg_pupdir(const char *name, int logdepth, int fatal);

View File

@ -28,12 +28,12 @@ static int waves_selected(int event, int key, int state, int button)
int is_inside = 0, skip = 0;
static int excl = STARTZOOM | STARTRECT | STARTLINE | STARTWIRE | STARTPAN2 | STARTSELECT | STARTMOVE | STARTCOPY;
if(xctx->ui_state & excl) skip = 1;
if(state & Mod1Mask) skip = 1;
if(event == MotionNotify && (state & Button2Mask)) skip = 1;
if(event == ButtonPress && button == Button2) skip = 1;
if(event == ButtonRelease && button == Button2) skip = 1;
if(!skip) for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
else if(state & Mod1Mask) skip = 1;
else if(event == MotionNotify && (state & Button2Mask)) skip = 1;
else if(event == ButtonPress && button == Button2) skip = 1;
else if(event == ButtonRelease && button == Button2) skip = 1;
else if(event == KeyPress && (state & ShiftMask)) skip = 1;
else if(!skip) for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
xRect *r;
r = &xctx->rect[GRIDLAYER][i];
if(!(r->flags & 1) ) continue;

View File

@ -275,7 +275,7 @@ static void hash_inst_pin(int for_netlist, int what, int i, int j)
my_snprintf(str, S(str), "symbol %s: missing all or name or dir attributes on pin %d\n %s",
xctx->inst[i].name, j, prop_ptr);
statusmsg(str,2);
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
tcleval("show_infotext"); /* critical error: force ERC window showing */
if(!xctx->netlist_count) {
xctx->inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
@ -447,7 +447,7 @@ static void signal_short( char *n1, char *n2)
my_snprintf(str, S(str), "shorted: %s - %s", n1, n2);
dbg(1, "signal_short(): signal_short: shorted: %s - %s", n1, n2);
statusmsg(str,2);
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
tcleval("show_infotext"); /* critical error: force ERC window showing */
if(!xctx->netlist_count) {
bus_hilight_hash_lookup(n1, xctx->hilight_color, XINSERT);
if(tclgetboolvar("incr_hilight")) incr_hilight_color();
@ -1194,7 +1194,7 @@ int sym_vs_sch_pins()
statusmsg(str,2);
my_snprintf(str, S(str), " %s <--> %s", type, pin_dir);
statusmsg(str,2);
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
tcleval("show_infotext"); /* critical error: force ERC window showing */
for(j = 0; j < xctx->instances; j++) {
if(!strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
xctx->inst[i].color = -PINLAYER;
@ -1211,7 +1211,7 @@ int sym_vs_sch_pins()
/* fprintf(errfp, " unmatched sch / sym pin: %s\n", lab); */
my_snprintf(str, S(str), "Symbol %s: schematic pin: %s not in symbol", xctx->sym[i].name, lab);
statusmsg(str,2);
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
tcleval("show_infotext"); /* critical error: force ERC window showing */
for(j = 0; j < xctx->instances; j++) {
if(!strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
xctx->inst[i].color = -PINLAYER;
@ -1245,7 +1245,7 @@ int sym_vs_sch_pins()
my_snprintf(str, S(str), "Symbol %s has %d pins, its schematic has %d pins",
xctx->sym[i].name, rects, pin_cnt);
statusmsg(str,2);
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
tcleval("show_infotext"); /* critical error: force ERC window showing */
for(j = 0; j < xctx->instances; j++) {
if(!strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
xctx->inst[i].color = -PINLAYER;
@ -1269,7 +1269,7 @@ int sym_vs_sch_pins()
my_snprintf(str, S(str), "Symbol %s: symbol pin: %s not in schematic",
xctx->sym[i].name, pin_name ? pin_name : "<NULL>");
statusmsg(str,2);
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
tcleval("show_infotext"); /* critical error: force ERC window showing */
for(k = 0; k < xctx->instances; k++) {
if(!strcmp(xctx->inst[k].name, xctx->sym[i].name)) {
xctx->inst[i].color = -PINLAYER;

View File

@ -213,7 +213,7 @@ void traverse_node_hash()
if(!xctx->netlist_count) bus_hilight_hash_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE);
if(incr_hi) incr_hilight_color();
statusmsg(str,2);
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
tcleval("show_infotext"); /* critical error: force ERC window showing */
}
else if(entry->d.out + entry->d.inout + entry->d.in == 1)
{

View File

@ -29,8 +29,8 @@ YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
void statusmsg(char str[],int n)
{
if(!has_x) return;
tclsetvar("infowindow_text", str);
if(!has_x) return;
if(n==2) {
dbg(3, "statusmsg(): n = 2, str = %s\n", str);
tcleval("infowindow");

View File

@ -2328,7 +2328,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int
my_snprintf(errstr, S(errstr), "Warning: unconnected pin, Inst idx: %d, Pin idx: %d Inst:%s\n",
i, j, xctx->inst[i].instname ) ;
statusmsg(errstr,2);
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
tcleval("show_infotext"); /* critical error: force ERC window showing */
if(!xctx->netlist_count) {
xctx->inst[i].color = -PINLAYER;
xctx->hilight_nets=1;

View File

@ -3081,6 +3081,14 @@ proc alert_ {txtlabel {position +200+300} {nowait {0}}} {
return {}
}
proc show_infotext {} {
global has_x infowindow_text
if {[info exists has_x]} {
wm deiconify .infotext
} else {
puts stderr $infowindow_text
}
}
proc infowindow {} {
global infowindow_text