set inter 1
set rhsmost_max -1
-set f [open text.xpm]
-set o {}
-set y -3
-while 1 {
- if {[gets $f l] < 0} { error "huh? "}
- if {![regexp {^"(.*)",$} $l dummy l]} {
- append o "$l\n"
- if {[regexp {^\}\;$} $l]} break
- continue
- }
- if {$y==-3} {
- manyset $l cols rows colours cpp
- #assert {$colours==2}
- #assert {$cpp==1}
- set mulcols [expr {$cols*$mul+$inter}]
- set mulrows [expr {$rows*$mul+$inter}]
- append o "\"$mulcols $mulrows 9 1\",\n"
- for {set x 0} {$x<$cols} {incr x} { set wordmap($x) 0 }
- } elseif {$y==-2} { # first pixel
- append o \
+proc read_xpm {f} {
+ set o {}
+ set y -3
- while {[gets $f l] >= 0} {
++ while 1 {
++ if {[gets $f l] < 0} { error "huh? "}
+ if {![regexp {^"(.*)",$} $l dummy l]} {
+ append o "$l\n"
++ if {[regexp {^\}\;$} $l]} break
+ continue
+ }
+ if {$y==-3} {
+ manyset $l cols rows colours cpp
+ #assert {$colours==2}
+ #assert {$cpp==1}
+ set mulcols [expr {$cols*$mul+$inter}]
+ set mulrows [expr {$rows*$mul+$inter}]
+ append o "\"$mulcols $mulrows 9 1\",\n"
+ for {set x 0} {$x<$cols} {incr x} { set wordmap($x) 0 }
+ } elseif {$y==-2} { # first pixel
+ append o \
"\"+ c #111\",
\"a c #800\",
\"A c #fcc\",