chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.web-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
show-thing database interaction improved
[ypp-sc-tools.web-live.git]
/
pctb
/
show-thing.tcl
diff --git
a/pctb/show-thing.tcl
b/pctb/show-thing.tcl
index 4537e6af63b8242cd7afca15aebd1cad341f4e69..1c55fcdcb8c0d75a441994c91abc998c63fb9b80 100755
(executable)
--- a/
pctb/show-thing.tcl
+++ b/
pctb/show-thing.tcl
@@
-1,4
+1,10
@@
-#!/usr/bin/tk
+#!/usr/bin/wish
+
+# usage:
+# run show-thing without args
+# then on stdin write
+# one line which is a Tcl list for foolist
+# the xpm in the format expected
proc manyset {list args} {
foreach val $list var $args {
proc manyset {list args} {
foreach val $list var $args {
@@
-287,11
+293,10
@@
proc read_database {} {
global database
set f [open database r]
while {[gets $f l] >= 0} {
global database
set f [open database r]
while {[gets $f l] >= 0} {
- if {![regexp {^(\w+) (\d+) (
[0-9a-f]{2}
+)$} $l \
+ if {![regexp {^(\w+) (\d+) (
(?:[0-9a-f]{2})
+)$} $l \
dummy context strl strh]} {
error "bad syntax"
}
dummy context strl strh]} {
error "bad syntax"
}
- binary scan $strw h* strh
if {[string length $strh] != $strl*2} { error "$strh $strl" }
gets $f l; set width [format %d $l]
set bm $context
if {[string length $strh] != $strl*2} { error "$strh $strl" }
gets $f l; set width [format %d $l]
set bm $context
@@
-300,6
+305,7
@@
proc read_database {} {
}
set database($bm) $strh
}
}
set database($bm) $strh
}
+ close $f
}
proc write_database {} {
}
proc write_database {} {
@@
-314,9
+320,12
@@
proc write_database {} {
foreach x [lrange $bm 1 end] { append o "$x\n" }
lappend ol $o
}
foreach x [lrange $bm 1 end] { append o "$x\n" }
lappend ol $o
}
+ set f [open database.new w]
foreach o [lsort $ol] {
foreach o [lsort $ol] {
- puts -nonewline $o
+ puts -nonewline $
f $
o
}
}
+ close $f
+ file rename -force database.new database
}
proc update_database/DEFINE {c0 c1 strh} {
}
proc update_database/DEFINE {c0 c1 strh} {