Change Details
tornado/fw/txt/t |
1 | 1 | #!/bin/sh |
2 | | ./txt2xbm TEST | ./stretch 6 | ./xbm2gp "$@" | ./plot |
| 2 | T="TEST" |
| 3 | F=6 |
| 4 | if [ "$1" = -g ]; then |
| 5 | shift |
| 6 | ./txt2xbm "$T" | ./stretch $F | ./xbm2gp "$@" | ./plot |
| 7 | else |
| 8 | ./txt2xbm "$T" | ./stretch $F | ./xbm2tornado |
| 9 | fi |
tornado/fw/txt/xbm2tornado |
| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | sub pick |
| 4 | { |
| 5 | local ($x, $y) = @_; |
| 6 | |
| 7 | my $i = $x+$y*$X; |
| 8 | return ((hex $p[$i >> 3]) >> ($i & 7)) & 1; |
| 9 | } |
| 10 | |
| 11 | |
| 12 | while (<>) { |
| 13 | chop; |
| 14 | if (/#define\s+\S+_width\s+(\d+)/) { |
| 15 | $X = $1; |
| 16 | next; |
| 17 | } |
| 18 | if (/#define\s+\S+_height\s+(\d+)/) { |
| 19 | $Y = $1; |
| 20 | next; |
| 21 | } |
| 22 | next unless /\s*0x/; |
| 23 | s/^\s*//; |
| 24 | s/(,|};)$//; |
| 25 | push(@p, split /,/); |
| 26 | } |
| 27 | |
| 28 | for ($x = 0; $x != $X; $x++) { |
| 29 | for ($y = 0; $y != $Y; $y += 8) { |
| 30 | $v = 0; |
| 31 | for ($i = 0; $i != 8; $i++) { |
| 32 | $v |= 1 << $i if &pick($x, $y+$i); |
| 33 | } |
| 34 | print sprintf("0x%02x, ", $v); |
| 35 | } |
| 36 | } |
| 37 | print "\n"; |
Download the corresponding diff file