summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-01-02 18:58:35 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2009-01-02 18:58:35 +0100
commit9aa7660dd11efcaf2e1af831c20b3acb5dd872e1 (patch)
treed606a4d527d7310a85fd8962eaa50200146dcb1c
parent20ac80960b78ffe7ba491f8b3b9fe48b5c72c178 (diff)
tibtoa: Added support for equations
-rwxr-xr-xbin/tibtoa7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/tibtoa b/bin/tibtoa
index 8967266..a48cd75 100755
--- a/bin/tibtoa
+++ b/bin/tibtoa
@@ -640,6 +640,7 @@ sub header_type($) {
when(0x00) { return('var') }
when(0x01) { return('list') }
when(0x02) { return('matrix') }
+ when(0x03) { return('equation') }
when(0x04) { return('string') }
when(0x05) { return('program') }
default { return(sprintf('0x%02x', $_)) }
@@ -677,7 +678,7 @@ sub header_size($) {
$size->{cols} = ord(substr($header, 0x48, 1));
$size->{rows} = ord(substr($header, 0x49, 1));
}
- when($_ eq 'program' or $_ eq 'string') {
+ when(/program|string|equation/) {
$size->{source} = ord(substr($header, 0x48, 1)) + 255 * ord(substr($header, 0x49, 1));
}
}
@@ -734,12 +735,14 @@ if ($opts{h}) {
print_header('String length:', $header{size}->{source});
} elsif ($header{type} eq 'program') {
print_header('Program size :', $header{size}->{source});
+ } elsif ($header{type} eq 'equation') {
+ print_header('Payload length:', $header{size}->{source});
}
}
# And now, the actual file content
-if ($header{type} eq 'program') {
+if ($header{type} eq 'program' or $header{type} eq 'equation') {
while($offset < $length) {
$char = ord(substr($program, $offset++, 1));
if (exists($all{$char})) {