From 4b0627c2143e2fd1166741f54b3e783eb0af21de Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 12 Sep 2008 14:35:32 +0200 Subject: initial --- bin/tibtoa | 360 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100755 bin/tibtoa (limited to 'bin') diff --git a/bin/tibtoa b/bin/tibtoa new file mode 100755 index 0000000..1578e2f --- /dev/null +++ b/bin/tibtoa @@ -0,0 +1,360 @@ +#!/usr/bin/env perl +use strict; +use feature 'switch'; +use warnings; +use utf8; +binmode(STDOUT, ':utf8'); +my ($char, $char2); +my $out; +my $hex; +my $context; +my %all = ( + 0x01 => '►DMS', + 0x02 => '►Dec', + 0x03 => '►Frac', + 0x04 => '→', + 0x05 => 'Boxplot', + 0x06 => '[', + 0x07 => ']', + 0x08 => '{', + 0x09 => '}', + 0x0a => 'r', + 0x0b => '°', + 0x0c => '⁻¹', + 0x0d => '²', + 0x0e => 'Ṭ', + 0x0f => '³', + 0x10 => '(', + 0x11 => ')', + 0x12 => 'round(', + 0x13 => 'pxl-Test(', + 0x14 => 'augment(', + 0x15 => 'rowSwap(', + 0x16 => 'row+(', + 0x17 => '*row(', + 0x18 => '*row+(', + 0x19 => 'max(', + 0x1a => 'min(', + 0x1b => 'R►Pr(', + 0x1c => 'R►Pθ(', + 0x1d => 'P►Rx(', + 0x1e => 'P►Ry', + 0x1f => 'median(', + 0x20 => 'randM(', + 0x21 => 'mean(', + 0x22 => 'solve(', + 0x23 => 'seq(', + 0x24 => 'fnInt(', + 0x25 => 'nDeriv(', + 0x27 => 'fMin(', + 0x28 => 'fMax(', + 0x29 => ' ', + 0x2a => '"', + 0x2b => ',', + 0x2c => 'i', + 0x2d => '!', + 0x2e => 'CubicReg', + 0x2f => 'QuartReg', + 0x30 => 0, + 0x31 => 1, + 0x32 => 2, + 0x33 => 3, + 0x34 => 4, + 0x35 => 5, + 0x36 => 6, + 0x37 => 7, + 0x38 => 8, + 0x39 => 9, + 0x3a => '.', + 0x3b => 'E', + 0x3c => ' or ', + 0x3d => ' xor ', + 0x3e => ':', + 0x3f => "\n", + 0x40 => ' and ', + 0x41 => 'A', + 0x42 => 'B', + 0x43 => 'C', + 0x44 => 'D', + 0x45 => 'E', + 0x46 => 'F', + 0x47 => 'G', + 0x48 => 'H', + 0x49 => 'I', + 0x4a => 'J', + 0x4b => 'K', + 0x4c => 'L', + 0x4d => 'M', + 0x4e => 'N', + 0x4f => 'O', + 0x50 => 'P', + 0x51 => 'O', + 0x52 => 'R', + 0x53 => 'S', + 0x54 => 'T', + 0x55 => 'U', + 0x56 => 'V', + 0x57 => 'W', + 0x58 => 'X', + 0x59 => 'Y', + 0x5a => 'Z', + 0x5b => 'θ', + 0x5f => 'prgm', + 0x64 => 'Radian', + 0x65 => 'Degree', + 0x66 => 'Normal', + 0x67 => 'Sci', + 0x68 => 'Eng', + 0x69 => 'Float', + 0x6a => '=', + 0x6b => '<', + 0x6c => '>', + 0x6d => '≤', + 0x6e => '≥', + 0x6f => '≠', + 0x70 => '+', + 0x71 => '-', + 0x72 => 'Ans', + 0x73 => 'Fix', + 0x74 => 'Horiz', + 0x75 => 'Full', + 0x76 => 'Func', + 0x77 => 'Param', + 0x78 => 'Polar', + 0x79 => 'Seq', + 0x7a => 'IndpntAuto', + 0x7b => 'IndpntAsk', + 0x7c => 'DependAuto', + 0x7d => 'DependAsk', + 0x7f => '☐', + 0x80 => '+', + 0x81 => '·', + 0x82 => '*', + 0x83 => '/', + 0x84 => 'Trace', + 0x85 => 'ClrDraw', + 0x86 => 'ZStandard', + 0x87 => 'ZTrig', + 0x88 => 'ZBox', + 0x89 => 'Zoom In', + 0x8a => 'Zoom Out', + 0x8b => 'ZSquare', + 0x8c => 'ZInteger', + 0x8d => 'ZPrevious', + 0x8e => 'ZDecimal', + 0x8f => 'ZoomStat', + 0x90 => 'ZoomRcl', + 0x91 => 'PrintScreen', + 0x92 => 'ZoomSto', + 0x93 => 'Text(', + 0x94 => 'nPr', + 0x95 => 'nCr', + 0x96 => 'FnOn', + 0x97 => 'FnOff', + 0x98 => 'StorePic', + 0x99 => 'RecallPic', + 0x9a => 'StoreGDB', + 0x9b => 'RecallGDB', + 0x9c => 'Line(', + 0x9d => 'Vertical', + 0x9e => 'Pt-On(', + 0x9f => 'Pt-Off(', + 0xa0 => 'Pt-Change(', + 0xa1 => 'Pxl-On(', + 0xa2 => 'Pxl-Off(', + 0xa3 => 'Pxl-Change(', + 0xa4 => 'Shade(', + 0xa5 => 'Circle(', + 0xa6 => 'Horizontal', + 0xa7 => 'Tangent(', + 0xa8 => 'DrawInv', + 0xa9 => 'DrawF', + 0xab => 'rand', + 0xac => 'π', + 0xad => 'getKey', + 0xae => '\'', + 0xaf => '?', + 0xb0 => '-', + 0xb1 => 'int(', + 0xb2 => 'abs(', + 0xb3 => 'det(', + 0xb4 => 'identity(', + 0xb5 => 'dim(', + 0xb6 => 'sum(', + 0xb7 => 'prod(', + 0xb8 => 'not(', + 0xb9 => 'iPart(', + 0xba => 'fPart(', + 0xbc => '√(', + 0xbd => '³√(', + 0xbe => 'ln(', + 0xbf => 'e^(', + 0xc0 => 'log(', + 0xc1 => '10^(', + 0xc2 => 'sin(', + 0xc3 => 'sinֿ¹(', + 0xc4 => 'cos(', + 0xc5 => 'cosֿ¹(', + 0xc6 => 'tan(', + 0xc7 => 'tanֿ¹(', + 0xc8 => 'sinh(', + 0xc9 => 'sinhֿ¹(', + 0xca => 'cosh(', + 0xcb => 'coshֿ¹(', + 0xcc => 'tanh(', + 0xcd => 'tanhֿ¹(', + 0xce => 'If ', + 0xcf => 'Then', + 0xd0 => 'Else', + 0xd1 => 'While ', + 0xd2 => 'Repeat ', + 0xd3 => 'For(', + 0xd4 => 'End', + 0xd5 => 'Return', + 0xd6 => 'Lbl ', + 0xd7 => 'Goto ', + 0xd8 => 'Pause', + 0xd9 => 'Stop', + 0xda => 'IS>(', + 0xdb => 'DS<(', + 0xdc => 'Input ', + 0xdd => 'Prompt ', + 0xde => 'Disp ', + 0xdf => 'DispGraph', + 0xe0 => 'Output(', + 0xe1 => 'ClrHome', + 0xe2 => 'Fill(', + 0xe3 => 'SortA(', + 0xe4 => 'SortD(', + 0xe5 => 'DispTable', + 0xe6 => 'Menu(', + 0xe7 => 'Send(', + 0xe8 => 'Get(', + 0xe9 => 'PlotsOn', + 0xea => 'PlotsOff', + 0xeb => '∟', + 0xec => 'Plot1(', + 0xed => 'Plot2(', + 0xee => 'Plot3(', + 0xf0 => '^', + 0xf1 => '×√', + 0xf2 => '1-Var Stats', + 0xf3 => '2-Var Stats', + 0xf4 => 'Linreg(a+bx)', + 0xf5 => 'ExpReg', + 0xf6 => 'LnReg', + 0xf7 => 'PwrReg', + 0xf8 => 'Med-Med', + 0xf9 => 'QuadReg', + 0xfa => 'ClrList', + 0xfb => 'ClrTable', + 0xfc => 'Histogram', + 0xfd => 'xyLine', + 0xfe => 'Scatter', + 0xff => 'LinReg(ax+b)', +); +my $special = { + 0x5c => { + 0x00 => '[A]', + 0x01 => '[B]', + 0x02 => '[C]', + 0x03 => '[D]', + 0x04 => '[E]', + 0x05 => '[F]', + 0x06 => '[G]', + 0x07 => '[H]', + 0x08 => '[I]', + 0x09 => '[J]', + }, + 0x5d => { + 0x00 => 'L1', + 0x01 => 'L2', + 0x02 => 'L3', + 0x03 => 'L4', + 0x04 => 'L5', + 0x05 => 'L6', + }, + 0x5e => {}, + 0x60 => { + 0x00 => 'Pic1', + 0x01 => 'Pic2', + 0x02 => 'Pic3', + 0x03 => 'Pic4', + 0x04 => 'Pic5', + 0x05 => 'Pic6', + 0x06 => 'Pic7', + 0x07 => 'Pic8', + 0x08 => 'Pic9', + 0x09 => 'Pic0', + }, + 0x61 => { + 0x00 => 'GDB1', + 0x01 => 'GDB2', + 0x02 => 'GDB3', + 0x03 => 'GDB4', + 0x04 => 'GDB5', + 0x05 => 'GDB6', + 0x06 => 'GDB7', + 0x07 => 'GDB8', + 0x08 => 'GDB9', + 0x09 => 'GDB0', + }, + 0x62 => {}, + 0x63 => {}, + 0x7e => {}, + 0xaa => { + 0x00 => 'Str1', + 0x01 => 'Str2', + 0x02 => 'Str3', + 0x03 => 'Str4', + 0x04 => 'Str5', + 0x05 => 'Str6', + 0x06 => 'Str7', + 0x07 => 'Str8', + 0x08 => 'Str9', + 0x09 => 'Str0', + }, + 0xbb => {}, + 0xef => { + 0x00 => 'setDate(', + 0x01 => 'setTime(', + 0x02 => 'checkTmr(', + 0x03 => 'setDtFmt(', + 0x04 => 'setTmFmt(', + 0x05 => 'timeCnv(', + 0x06 => 'dayOfWk(', + 0x07 => 'getDtStr(', + 0x08 => 'getTmStr(', + 0x09 => 'getDate', + 0x0a => 'getTime', + 0x0b => 'startTmr', + 0x0c => 'getDtFmt', + 0x0e => 'getTmFmt', + 0x0f => 'isClockOn', + 0x10 => 'ClockOn', + 0x11 => 'ClockOff', + 0x12 => 'OpenLib(', + 0x13 => 'ExecLib', + 0x14 => 'invT(', + 0x15 => 'χ²GOF-Test(', + 0x16 => 'LinRegTInt', + 0x17 => 'Manual-Fit', + }, +}; + +open(PRGM, '<', shift) or die; +seek(PRGM, 74, 0); +while(read(PRGM, $char, 1)) { + $char = ord($char); + if (exists($all{$char})) { + $out = $all{$char}; + } elsif (exists($special->{$char})) { + read(PRGM, $char2, 1); + $char2 = ord($char2); + $out = $special->{$char}->{$char2}; + } else { + warn(sprintf('Unknown byte: %2x', $char)); + $out = chr($char); + } + print $out; +} -- cgit v1.2.3