X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=blobdiff_plain;f=pctb%2Fshow-thing.tcl;h=c04d4ddf21b897e56d323e0c1ac17d40a14f8ea3;hp=d71c36ef6381c54a885ab038dd55ef5b9840c280;hb=5d58a08423953756871493042a9cfff032b66e18;hpb=5a2c03e2e4f52b8329f45cf67afc3edec1f2c65b diff --git a/pctb/show-thing.tcl b/pctb/show-thing.tcl index d71c36e..c04d4dd 100755 --- a/pctb/show-thing.tcl +++ b/pctb/show-thing.tcl @@ -26,6 +26,10 @@ set gotsh 20 set csrh 20 set ctxh 20 +proc debug {m} { + puts stderr "SHOW-THING $m" +} + proc init_widgets {} { # idempotent global csrh gotsh ctxh @@ -134,7 +138,7 @@ proc read_xpm {f} { set realcols $cols set cols [expr {$cols - $chop_l - $chop_r}] - puts stderr "NOW cols=$cols chop_l,r=$chop_l,$chop_r rows=$rows\ + debug "NOW cols=$cols chop_l,r=$chop_l,$chop_r rows=$rows\ $unk_l $unk_r $ngd" set mulcols [expr {$cols*$mul+$inter}] @@ -269,6 +273,7 @@ proc recursor//01 {z1} { } bind_key Return { if {$cur_0 != $cur_1} { + .d.csr.csr.e delete 0 end set cur_mode text recursor } @@ -298,7 +303,6 @@ proc recursor/text {} { bind_key Return { set strq [.d.csr.csr.e get] if {[regexp {^(?:[!-[]|[]-~]|\\\\|\\x[0-9a-f]{2})+} $strq]} { - .d.csr.csr.e delete 0 end RETURN_RESULT DEFINE "$cur_0 $cur_1 $strq" } } @@ -387,6 +391,7 @@ proc read_database {} { global database database_header rows database_fn catch { unset database } set database_fn ./charset-$rows.txt + if {![file exists $database_fn]} return set f [open $database_fn r] if {[string compare [db_getsl $f] $database_header]} { error "$l ?" } if {([db_getsl $f])+0 != $rows} { error "wrong h ?" } @@ -476,7 +481,7 @@ proc RETURN_RESULT {how what} { helptext {{{ Processing }}} unbind_all_keys update idletasks - puts stderr "$how $what" + debug "$how $what" eval update_database/$how $what done/$mainkind } @@ -517,7 +522,7 @@ proc required {} { init_widgets manyset [lrange $l 0 3] unk_l unk_r unk_contexts set glyphsdone [lrange $l 3 end] - puts stderr "SHOW-THING GOT $l" + debug "GOT $l" fileevent stdin readable {}