chiark / gitweb /
merge changes made accidentally to wrong copy
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Wed, 3 Jun 2009 22:48:27 +0000 (23:48 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Wed, 3 Jun 2009 22:48:27 +0000 (23:48 +0100)
1  2 
pctb/show-thing.tcl

index c1e8cb94aa94cd0346d33cd9e4b531a869c12f31,9a5b1d253c91a0d43093551ad4889df95b30f02c..f2055f44aca83b55c64aefafd1906aa493e90e5a
@@@ -11,24 -30,26 +19,26 @@@ set mul 
  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\",