From e4f468da4b49e122028a1b40efecabe93070be51 Mon Sep 17 00:00:00 2001 From: Tretter Date: Tue, 7 Feb 2017 20:07:58 +0000 Subject: [PATCH] initial checkin from subversion --- 0 | 0 1 | 1 + 250 | 1 + 254 | 1 + 255 | 1 + 256 | 1 + a.out | Bin 0 -> 23734 bytes aas | 1 + allchars.txt | 2 + axa | 1 + compile | 1 + dbcompile | 1 + dblach.txt | Bin 0 -> 512 bytes drittes.cc | 31 + err | 68 ++ erstes.cc | 30 + hello | 3 + hellod | 0 hivals | 1 + homepage.tiah/index.html | 89 +++ homepage.tiah/tiah05.tar.bz2 | Bin 0 -> 15852 bytes homepage.tiah/tiah05.tar.gz | Bin 0 -> 16841 bytes j | 1 + nix | 0 out | 1 + thx.cc | 628 +++++++++++++++++ thxv1.cc | 224 ++++++ thxv2.cc | 286 ++++++++ thxv3.cc | 463 +++++++++++++ thxv4.cc | 450 ++++++++++++ tiah.cc | 1248 +++++++++++++++++++++++++++++++++ tiah05/COPYING | 339 +++++++++ tiah05/Makefile | 40 ++ tiah05/README.BUG | 1 + tiah05/README.INSTALL | 24 + tiah05/README.PROGRAMMER | 24 + tiah05/tiah.1.gz | Bin 0 -> 830 bytes tiah05/tiah.cc | 1248 +++++++++++++++++++++++++++++++++ tiah05/tiah05.tar.bz2 | Bin 0 -> 15852 bytes tiah05/tiah05.tar.gz | Bin 0 -> 16841 bytes tiah05a/CHANGES | 6 + tiah05a/COPYING | 339 +++++++++ tiah05a/Makefile | 40 ++ tiah05a/README.BUG | 1 + tiah05a/README.INSTALL | 24 + tiah05a/README.PROGRAMMER | 24 + tiah05a/tiah.1.gz | Bin 0 -> 830 bytes tiah05a/tiah.cc | 1249 +++++++++++++++++++++++++++++++++ tiah05a/tiah05a.tar.bz2 | Bin 0 -> 15975 bytes tiah05b/CHANGES | 10 + tiah05b/COPYING | 339 +++++++++ tiah05b/Makefile | 40 ++ tiah05b/README.BUG | 1 + tiah05b/README.INSTALL | 24 + tiah05b/README.PROGRAMMER | 20 + tiah05b/THANKSTO | 1 + tiah05b/tiah.1.gz | Bin 0 -> 830 bytes tiah05b/tiah.cc | 1251 ++++++++++++++++++++++++++++++++++ tiah05c/CHANGES | 10 + tiah05c/COPYING | 339 +++++++++ tiah05c/Makefile | 40 ++ tiah05c/README.BUG | 1 + tiah05c/README.INSTALL | 24 + tiah05c/README.PROGRAMMER | 20 + tiah05c/THANKSTO | 1 + tiah05c/tiah.1.gz | Bin 0 -> 830 bytes tiah05c/tiah.cc | 1251 ++++++++++++++++++++++++++++++++++ tiah05c/tiah05b.tar | Bin 0 -> 61440 bytes tiahv1.cc | 224 ++++++ tiahv10.cc | 1226 +++++++++++++++++++++++++++++++++ tiahv11.cc | 1248 +++++++++++++++++++++++++++++++++ tiahv2.cc | 286 ++++++++ tiahv3.cc | 463 +++++++++++++ tiahv4.cc | 450 ++++++++++++ tiahv5.cc | 766 +++++++++++++++++++++ tiahv6.cc | 811 ++++++++++++++++++++++ tiahv7.cc | 927 +++++++++++++++++++++++++ tiahv8.cc | 973 ++++++++++++++++++++++++++ tiahv9.cc | 1079 +++++++++++++++++++++++++++++ uu | 1 + webprefs | 5 + x | Bin 0 -> 23734 bytes y | 0 zweites.cc | 58 ++ 84 files changed, 18782 insertions(+) create mode 100644 0 create mode 100644 1 create mode 100644 250 create mode 100644 254 create mode 100644 255 create mode 100644 256 create mode 100644 a.out create mode 100644 aas create mode 100644 allchars.txt create mode 100644 axa create mode 100644 compile create mode 100644 dbcompile create mode 100644 dblach.txt create mode 100644 drittes.cc create mode 100644 err create mode 100644 erstes.cc create mode 100644 hello create mode 100644 hellod create mode 100644 hivals create mode 100644 homepage.tiah/index.html create mode 100644 homepage.tiah/tiah05.tar.bz2 create mode 100644 homepage.tiah/tiah05.tar.gz create mode 100644 j create mode 100644 nix create mode 100644 out create mode 100644 thx.cc create mode 100644 thxv1.cc create mode 100644 thxv2.cc create mode 100644 thxv3.cc create mode 100644 thxv4.cc create mode 100644 tiah.cc create mode 100644 tiah05/COPYING create mode 100644 tiah05/Makefile create mode 100644 tiah05/README.BUG create mode 100644 tiah05/README.INSTALL create mode 100644 tiah05/README.PROGRAMMER create mode 100644 tiah05/tiah.1.gz create mode 100644 tiah05/tiah.cc create mode 100644 tiah05/tiah05.tar.bz2 create mode 100644 tiah05/tiah05.tar.gz create mode 100644 tiah05a/CHANGES create mode 100644 tiah05a/COPYING create mode 100644 tiah05a/Makefile create mode 100644 tiah05a/README.BUG create mode 100644 tiah05a/README.INSTALL create mode 100644 tiah05a/README.PROGRAMMER create mode 100644 tiah05a/tiah.1.gz create mode 100644 tiah05a/tiah.cc create mode 100644 tiah05a/tiah05a.tar.bz2 create mode 100644 tiah05b/CHANGES create mode 100644 tiah05b/COPYING create mode 100644 tiah05b/Makefile create mode 100644 tiah05b/README.BUG create mode 100644 tiah05b/README.INSTALL create mode 100644 tiah05b/README.PROGRAMMER create mode 100644 tiah05b/THANKSTO create mode 100644 tiah05b/tiah.1.gz create mode 100644 tiah05b/tiah.cc create mode 100644 tiah05c/CHANGES create mode 100644 tiah05c/COPYING create mode 100644 tiah05c/Makefile create mode 100644 tiah05c/README.BUG create mode 100644 tiah05c/README.INSTALL create mode 100644 tiah05c/README.PROGRAMMER create mode 100644 tiah05c/THANKSTO create mode 100644 tiah05c/tiah.1.gz create mode 100644 tiah05c/tiah.cc create mode 100644 tiah05c/tiah05b.tar create mode 100644 tiahv1.cc create mode 100644 tiahv10.cc create mode 100644 tiahv11.cc create mode 100644 tiahv2.cc create mode 100644 tiahv3.cc create mode 100644 tiahv4.cc create mode 100644 tiahv5.cc create mode 100644 tiahv6.cc create mode 100644 tiahv7.cc create mode 100644 tiahv8.cc create mode 100644 tiahv9.cc create mode 100644 uu create mode 100644 webprefs create mode 100644 x create mode 100644 y create mode 100644 zweites.cc diff --git a/0 b/0 new file mode 100644 index 0000000..e69de29 diff --git a/1 b/1 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/1 @@ -0,0 +1 @@ + diff --git a/250 b/250 new file mode 100644 index 0000000..0f164a1 --- /dev/null +++ b/250 @@ -0,0 +1 @@ +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/254 b/254 new file mode 100644 index 0000000..4d397ca --- /dev/null +++ b/254 @@ -0,0 +1 @@ +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/255 b/255 new file mode 100644 index 0000000..56deb17 --- /dev/null +++ b/255 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/256 b/256 new file mode 100644 index 0000000..8b96668 --- /dev/null +++ b/256 @@ -0,0 +1 @@ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/a.out b/a.out new file mode 100644 index 0000000000000000000000000000000000000000..6137fc2d9b41762607e94b5bea1c38e960fdc337 GIT binary patch literal 23734 zcmdsfdwi7Dx$c@|0z(WWARs7PM+M8JjtK_jQf#;k7bP$TLcQ!Xgk-`b=GJ5ef+Y|; zpqY&6$?m4D_1JFM+HOyGPfJ^BQCkei0cu+t(OR|9MjP8NPTIzrt*K4Pex7yt=1YjX zJ^k%J&hLD%vevWKyWaJ#cfITSeY5uaH?DQLT*5plB2^G&J>d4_(!WKeK?8RfVY)OpH(V;*i*!h%yA)wMrjfT@8qx&Zl9fWxF~7)C>3P6;&$~Tz zhfv_r@j{l%^c0Zgu7mpp%7;4)Oh>s`#tl^!J8q~dyS}QTCer9@sP!!rVh-YOf}0Nq z7GeP$AFvhaGNkxYwrLuB;b+5Tz%lNIY;psZO z82)4(zE1m-;9su8*J~dtv>&!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}*B0v=3|BkKc9ti%vAR4-zj&04xKT1J>Z(f`MMFtLX+;GupVW6jf^?Utqd*PFU4aWAt82@GDpuV#$qLj) zaK9!9)qRoWb)pdkChylQ4VBaz5`BH7zO7MR&8e=#tg0<3E3L&*Kux$oa&z8osqe3> zt8GyCUg|q8rS{~lm@K2B2Kgv|T_{*pC+fnx#=19B-HWMi_iU)e>o|c|QWcUD>%hRS zl6onDs<(N&hKn$zcFaAS_I;U+k_(z>%sWDV`cHjfjLAl6Q;Rw}}Q}!p`EL zSENZEyaTiw9GyjD`9Qo6c_Rb2)eu9cNASFGaB(g;q2^!=n2H4U}9 z>IF?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ diff --git a/axa b/axa new file mode 100644 index 0000000..b3c3e16 --- /dev/null +++ b/axa @@ -0,0 +1 @@ +axaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxax \ No newline at end of file diff --git a/compile b/compile new file mode 100644 index 0000000..a138799 --- /dev/null +++ b/compile @@ -0,0 +1 @@ +g++ -ox $1 -lncurses diff --git a/dbcompile b/dbcompile new file mode 100644 index 0000000..8da6c70 --- /dev/null +++ b/dbcompile @@ -0,0 +1 @@ +g++ -Wall -ox $1 -g -lncurses diff --git a/dblach.txt b/dblach.txt new file mode 100644 index 0000000000000000000000000000000000000000..553a99f955221f149c3a4ee0df0b19c117d744bf GIT binary patch literal 512 zcmZQzWMXDvWn<^yMC+6cQE@6%&_`l#-T_m6KOcR8m$^Ra4i{)Y8_`)zddH zG%_|ZH8Z!cw6eCbwX=6{baHlab#wRd^z!!c_45x13RUz zF>}`JIdkXDU$Ah|;w4L$Enl&6)#^2C*R9{Mant54TeofBv2)k%J$v` + +int main() +{ + WINDOW *stdscr; + const char *str1 = "Eins "; + int z; + +stdscr = initscr(); +int sc=start_color(); + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + int cp=init_pair(1,(COLOR_BLUE),COLOR_BLACK); + cp=init_pair(2,COLOR_BLUE,COLOR_MAGENTA); + attrset(COLOR_PAIR(1)); + attron(WA_BOLD); + box(stdscr,0,0); + for (z=1;z < 5;z++) + { + move(z,1); + attrset(COLOR_PAIR(1)); + addstr(str1); + attrset(COLOR_PAIR(2)); + addstr(str1); + } + refresh(); + sleep(1); + endwin(); + return 0; +} diff --git a/err b/err new file mode 100644 index 0000000..ab348b4 --- /dev/null +++ b/err @@ -0,0 +1,68 @@ +Im in Block0Working with line 0 - Distance is 5 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 5 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 5 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 5 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 5 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 5 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 4 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 3 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 2 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2Im in Block0Working with line 0 - Distance is 1 +Im in Block1Im in Block2 \ No newline at end of file diff --git a/erstes.cc b/erstes.cc new file mode 100644 index 0000000..60703fc --- /dev/null +++ b/erstes.cc @@ -0,0 +1,30 @@ +#include + +int main() +{ + WINDOW *stdscr; + const char *str1 = "Eins"; + int z; + +stdscr = initscr(); +int sc=start_color(); + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + int cp=init_pair(1,COLOR_MAGENTA,COLOR_BLUE); + cp=init_pair(2,COLOR_BLUE,COLOR_MAGENTA); + COLOR_PAIR(1); + for (z=1;z < 5;z++) + { + move(z,0); + attrset(COLOR_PAIR(1)); + addstr(str1); + attrset(COLOR_PAIR(2)); + addstr(str1); + usleep(1); + } + refresh(); + sleep(1); + endwin(); + return 0; +} diff --git a/hello b/hello new file mode 100644 index 0000000..617e7d4 --- /dev/null +++ b/hello @@ -0,0 +1,3 @@ +ao, jetzt machen air mal das file atwas grer, damat es auch was zua speichern gibt. das hier ist echat kewl.aaaadasdsaadkjkjkaas wirklach alleadrinne??a ich kaans kaum adauben aieder alasdasdasaasdasdsad-))rerrading moderide-mdae. over helfsadaasdfor testing of the +thex-hex-editor +xx \ No newline at end of file diff --git a/hellod b/hellod new file mode 100644 index 0000000..e69de29 diff --git a/hivals b/hivals new file mode 100644 index 0000000..32e2f22 --- /dev/null +++ b/hivals @@ -0,0 +1 @@ + diff --git a/homepage.tiah/index.html b/homepage.tiah/index.html new file mode 100644 index 0000000..b32e90f --- /dev/null +++ b/homepage.tiah/index.html @@ -0,0 +1,89 @@ + +Homepage of the T.I.A.H Hex-Editor for Linux + + +DOWNLOAD BELOW
+
+
+
+
+
+ +
+ T.I.A.H - Tiah Is A Hex-editor (EN)
+
+
+
+
+The tiah program is a (not yet) fully feauterd hex editor for Linux +
+
+The tiah-program comes with a interactive text-based user interface. +
+
+With tiah it is possible to insert ond delete characters. +
+
+Moving around, Edit in Hex/Ascii, Setting bits is possible in the moment. +
+
+It's planned to include functions for searching and filling in later versions. +
+
+
+ +
+ T.I.A.H - Tiah Is A Hex-editor (DE)
+
+
+
+
+Tiah ist ein noch nicht vollstaendig implementierter Hex-Editor fuer Linux. +
+
+Tiah hat ein interaktives Textinterface +
+
+Mit Tiah ist es moeglich Zeichen einzufuegen und zu lschen +
+
+Momentan sind Cursorbewegungen, Setzen einzelner Bist und editieren in Hex und Ascii moeglich. +
+
+Es ist fuer spaetere Versionen geplant, Funktionen zum suchen und fuellen zu implementieren +
+
+ +DOWNLOAD: + +
+ + + + + + + + +
+gzipped-version: + + tiah05.tar.gz +
+bzipped-version: + + tiah05.tar.bz2 +
+
+ +

You can write eMails to me: +j.tretter@gmx.de + +
+
+ +This Page was visited + +times. + + diff --git a/homepage.tiah/tiah05.tar.bz2 b/homepage.tiah/tiah05.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..4afbd17fdb5f935e123e10a20cb73c6875ec87b7 GIT binary patch literal 15852 zcmVs{m94fB*mg|NsC0|NsC0|NsC0|NsBL|Nr;?|KI!n z|Ns5}|L@>P-u1WB#%dL&?i<~2B9NYq9)RfqAONREfCVT302_Cvbgx6UZMzP8z0VrD zJEy(lst-knW190BC|_AOvckqd`vzqXfx>$r#kb zAewqim>EW%f_hI;riYSxO+6E8Xkq|j28M>3F{lGZfCE4@8UsKKfuI@#L8gHL36Mbo z095l-*rURmQ1p*e1Rj%W4F-T{8f`!ZC#j$SG8zB?0MG%D001-q000^c5CbZDYH76( zQKzY(Hc->kP}rW7eyQlx^$f~r^*o^Tk5kkErZSHt+D|Cah|%gjPbs5JOqzK{gVYTM zjDg~xsTiK8siuQQo~Dl!eyQp3KCARs2G`BT*W6!MKcrbE(s zGKLUn4^vN2(X>EqMuvcB01W^=KmY?k0000000001pa2m_l4M~J19+N{R zXpczRk4R)<27m^Jng9){pa1{>Gyu>513&-(4^RLA8UO=9A|U|)AP8vG(TF2WG|1CU zPfZijGHPu$ny0Dieu{c(Y)PgyG8!{eMol)R)MR1}G-$}s&@=&{8UO=L0009(Gyp%m z&=sYW$jc#nyvr}HVix9|tzacuA%!BifMVcO_$d#ofjH;jd>@0+zro=H<}qicse}wF zyc#T6hyoE30bn=`B!IC4b=>`%)c{oZrF8~F_Rh?y@lkb}y>`c6z;qXEcjgMKVbr9H z!8+`|+peGlxw+w+N(g&Kuwg7%DG!uMS%d4_WcnlMPmi(ZK%YFoIPXDK%q0uo+SBli z{`O4K?e6xTKdI4WciSxX(o=XDk`eIqrt&wZYc|qdKHE>9xweG*I(`9=`hGSW^WGm@ z^4NAJSYbY6IV8dZ0`EJ%C6lx9m(bx=>2x$BTh5BP3z_^;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h$Z*#+Y=N=k)@YKC0U+H}G<-hZ~+{qt%O#XWBBM*qm=dSucuXy#Hse69v zvL9Uco726SxBbs&uRVF`{;SV(_uSU^D_{87S08&eG4kfzYW7dBd(W-Q@BL2juJ;CK zukAl}`(r}lxp!7)U;pw+L@$^vv-izx`mpxb8zwefYKF zJ$>`nTzusHpL^@s|Nb`)zGC9(^H22M__lK{*eu;X^yPtvF8ugc9(e5DuV3?@6)$+ehE{rFVVv`n#U^oBJRBq0C{^fJu|6ivr`N7vely>%h`FnRiF!aIi$Wtf&^05amKkI=vKK-@L z*M47)o%i*#FW7VNGhg_t*W9`E@WhqR{>PuYV`b){r(XT97xqB!2UNMt!K&pz*S~te9Ta{d+ zvV1tEmXmU6)Bzr&Ux*x5SmTR3qlBOi^VO5ai#nw)crWd8gP28bXOMA!10^rOix&E* zxS11_P^FI7$;M@oh4Io$m8FrJVk?f4D3{3sgytx;9AgcGkYi~$fXR2mYA*)XAo$TH zt>%S|Fk&hQC_0(a$$PP%@+ODSVMqF|B?Pr zj*Q?h6O-e+^#8?py3zj(omXvQ#}ZQozuch0P(^=@jx3WeRn@eH4F5 zep9*#2_v6<@+Y7H7mqx-5VS?w z@sd-kb17Jt496i`s4b6SfvDDEux4;++rOp>n;n0Hch?un!k5b)||3_@S`0Y0!vQv?0| zVlpXbC=da&_txQ$x?O}bxg)Q5sn6E#v-|8myU*^k`|Liu&+fDP>^{5C57YDi0IIu% IascoE02n=&FaQ7m literal 0 HcmV?d00001 diff --git a/j b/j new file mode 100644 index 0000000..59b66ba --- /dev/null +++ b/j @@ -0,0 +1 @@ +xx \ No newline at end of file diff --git a/nix b/nix new file mode 100644 index 0000000..e69de29 diff --git a/out b/out new file mode 100644 index 0000000..dfdab82 --- /dev/null +++ b/out @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz \ No newline at end of file diff --git a/thx.cc b/thx.cc new file mode 100644 index 0000000..befbe82 --- /dev/null +++ b/thx.cc @@ -0,0 +1,628 @@ +#include +#include +#include +#include +#include + +struct data // Eine Zeile Speicher +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long zeile; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +int result; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten,*pdaten,*pfirst, *phelp; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).zeile=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Tastatureingabe erlauben + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// Echo ausschalten + noecho(); + +// Cursor auf Gro setzen + if(curs_set(2)==ERR) retval=1 ; + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +unsigned long rest,erg; +int pos=0; +int i; + + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +int loadcontents() +{ + int retval=0; + int x; + char ch; + int k=0; + unsigned long zeile=0; + + + pdaten=pfirst; + + ch=fgetc(fp); + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdaten).vals[x])=ch; + if (feof(fp)) //(*pdaten).vals[x]==EOF) + { + (*pdaten).vals[x]=0; + break; + } + (*pdaten).len=x+1; + ch=fgetc(fp); + } + (*pdaten).zeile=zeile++; + if(!(feof(fp))) + { + phelp=pdaten; + if (!(zeile%500)) {fprintf(stderr,"%c",'#');} + pdaten=((*pdaten).pnext)=(malloc(sizeof(daten))); +// BUG: Check for Memory-Full does not work. + if(!pdaten) {abort();} + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + + } +/* D E B U G O N L Y + + pdaten=pfirst; + +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; + +/* DEBUG ONLY + pdaten=pfirst; +int zeile=16; +int x; +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + +pdaten=pfirst; +for(;(*pdaten).pnext;pdaten=(*pdaten).pnext) + ; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} +} + + +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // die Reihenfolge wird anhand des Modus bestimmt (das letzte ist aktiv) + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +void lineout(unsigned long zeile) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdaten).zeile*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,zeile,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tonumsysx((*pdaten).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,zeile,1,shex); + for (z=0;z<(*pdaten).len;z++) + { +// BUG: Die Ober- und Untergrenze genau bestimmen. + xascii[z] = ((((*pdaten).vals[z]) > 31)&&((*pdaten).vals[z] != 127))?((*pdaten).vals[z]):254; + } + mvwaddstr(wascii,zeile,1,sascii); +} + +void initout() +{ +//Initiale Ausgabe (Alle) +int i; +bool schalter=false; +unsigned long zeile=1; +pdaten=pfirst; + +if ((*pdaten).pnext == NULL) schalter=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (schalter) break; + pdaten=(*pdaten).pnext; + if ((*pdaten).pnext == NULL) schalter=true; + } + scrrefresh(); + +if(i>15) pdaten=(*pdaten).plast; +} + +void scrolld() +{ + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + int z; + + miniinit(); + + lineout(16); +} + +void scrollu() +{ + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); +} + +void switchmode() +{ + if(mode==0) + { + mode=1; // modus:Hex->Ascii + // Umrechnen der Cursorposition + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // modue:Ascii->Hex + // Umrechnen der Cursorposition + pos.x=((pos.x*3)-1); + } +} + +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2)(pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.x > 1)pos.x--; + } +} + +void moveright() +{ + if(mode==0) + { + if(pos.x < 48)(pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.x < 16)pos.x++; + } +} + +void charin(char ch) +{ + int i=0; + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + // Wert schreiben + (*pdaten).vals[pos.x-1]=ch; + // Ausgabe aktualisieren + lineout(pos.y); + // wieder zurckblttern + while(i--) + { + pdaten=(*pdaten).pnext; + } +} + +int main(int argc, char *argv[]) +{ +/* --- DEBUG ONLY +printf("DEBUG: 5-%u\n",xto10(tonumsysx(5,2),2)); +printf("DEBUG: 16-%u\n",xto10(tonumsysx(16,16),16)); +printf("DEBUG: 36-%u\n",xto10 (tonumsysx(36,36),36)); +printf("DEBUG: 255-%u\n",xto10(tonumsysx(255,16),16)); +printf("DEBUG: 255-%u\n",xto10("FF",16)); +printf("DEBUG: 125-%u\n",xto10(tonumsysx(125,8),8)); +printf("DEBUG: 255-%u\n",xto10(tonumsysx(255,8),8)); +getchar(); + --- END DEBUG */ +//Variablen + unsigned int i,z; // Allgemeine Zhler + unsigned long zeile=0; // Zeilennummer + bool schalter; // Schalter fr lesevorlauf + int inpch; // Eingabezeichen + +//Vorbereitung + printf("GHEX Version 0.5\n"); + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + // sonstige Variableninitialisierung + pos.x = pos.y = 1; + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + mvwaddstr(wbot,1,1,argv[1]); + + +//Hauptprogramm + +initout(); +scrrefresh(); + +//Eventschleife + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + case KEY_F(9): switchmode(); + break; + case KEY_LEFT: moveleft(); + break; + case KEY_RIGHT:moveright(); + break; + case KEY_DOWN: if(pos.y>15) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + else + { + pos.y++; + } + break; + case KEY_UP: if(pos.y<2) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + else + { + pos.y--; + } + break; + case KEY_NPAGE: + for(i=0;i<16;i++) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + case KEY_PPAGE: + for(i=0;i<16;i++) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + break; + case KEY_HOME: + initout(); + break; + case KEY_END: + while((*pdaten).pnext) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + default: + if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="FF"; +// TODO hch korrekt fllen. if(pos.x%3) + switchmode(); // um die Koordinaten umzurechnen + charin(xto10(hch,16)); // Umrechnen Hex -> Ascii+charin + switchmode(); // und wieder zurcksetzen + moveright(); + } + } + else + { + //if((inpch > 31)&&(inpch < 256)) + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch); + moveright(); + } + } + }; + scrrefresh(); + } + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/thxv1.cc b/thxv1.cc new file mode 100644 index 0000000..93c5873 --- /dev/null +++ b/thxv1.cc @@ -0,0 +1,224 @@ +#include +#include + +struct data +{ +struct data* plast; +struct data* pnext; +char vals[16][16]; +}; + +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII"; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +int result; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten,*pfirst; + +void initvar() +{ + pfirst=&daten; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tohex(int base10) +{ + int newbase=16; + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +int loadcontents() +{ + int retval=0; + int x,y; + for(x=0;x<16;x++) + for(y=0;y<16;y++) + { + daten.vals[y][x]=fgetc(fp); + if (daten.vals[y][x]==EOF) daten.vals[y][x]=0; + } + for(x=0;x<16;x++) + for(y=0;y<16;y++) + printf("%c",daten.vals[y][x]); + + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +int main(int argc, char *argv[]) +{ +//Variablen + unsigned int i,z; + + printf("%s\n",tohex(0)); + printf("%s\n",tohex(10)); + printf("%s\n",tohex(20)); + printf("%s\n",tohex(30)); + printf("%s\n",tohex(40)); + printf("%s\n",tohex(50)); + +//Vorbereitung + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"THX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // pointer setzen + initvar(); + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + mvwaddstr(wbot,1,1,argv[1]); + + +//Hauptprogramm + + for (i=1;i<17;i++) + { + ptv = tohex(i-1); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,i,1,soffs); + for (z=0;z<16;z++) + { + ptv = tohex(daten.vals[z][i-1]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,i,1,shex); + for (z=0;z<16;z++) + { + xascii[z] = ((daten.vals[z][i-1]) > 33)?(daten.vals[z][i-1]):254; + } + mvwaddstr(wascii,i,1,sascii); + } + + wrefresh(woffs); + wrefresh(whex); + wrefresh(wascii); + wrefresh(wtop); + wrefresh(wbot); + + + sleep(1); + endscr(); + return (fclose(fp)); +} diff --git a/thxv2.cc b/thxv2.cc new file mode 100644 index 0000000..c125255 --- /dev/null +++ b/thxv2.cc @@ -0,0 +1,286 @@ +#include +#include +#include + +struct data +{ +struct data* plast; +struct data* pnext; +char vals[16][16]; +}; + +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII"; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +int result; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten,*pdaten,*pfirst, *phelp; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tohex(int base10) +{ + int newbase=16; + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +int loadcontents() +{ + int retval=0; + int x,y; + char ch; + int k=0; + + + pdaten=pfirst; + + ch=fgetc(fp); + + while (!(ch==EOF)) + { + k++; + + for(x=0;x<16;x++) + for(y=0;y<16;y++) + { + ((*pdaten).vals[y][x])=ch; + if ((*pdaten).vals[y][x]==EOF) (*pdaten).vals[y][x]=0; + ch=fgetc(fp); + } + + if(!(ch==EOF)) + { + phelp=pdaten; + printf("Vorher:%p\n",pdaten); + pdaten=((*pdaten).pnext)=(malloc(sizeof(daten))); + printf("Nachher:%p\n" ,pdaten); + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + + } +/* D E B U G O N L Y +getchar(); + + pdaten=pfirst; + + +while (k--) + { + for(x=0;x<16;x++) + for(y=0;y<16;y++) + { + printf("%c-",(*pdaten).vals[y][x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; +pdaten=pfirst; +for(;(*pdaten).pnext;pdaten=(*pdaten).pnext) + ; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} + + + +} + + +int main(int argc, char *argv[]) +{ +//Variablen + unsigned int i,z; + unsigned long zeile=0,pos=0; + + printf("%s\n",tohex(0)); + printf("%s\n",tohex(10)); + printf("%s\n",tohex(20)); + printf("%s\n",tohex(30)); + printf("%s\n",tohex(40)); + printf("%s\n",tohex(50)); + +//Vorbereitung + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"THX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + mvwaddstr(wbot,1,1,argv[1]); + + +//Hauptprogramm + + for (i=1;i<17;i++) + { + ptv = tohex(i-1); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,i,1,soffs); + for (z=0;z<16;z++) + { + ptv = tohex(daten.vals[z][i-1]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,i,1,shex); + for (z=0;z<16;z++) + { + xascii[z] = ((daten.vals[z][i-1]) > 33)?(daten.vals[z][i-1]):254; + } + mvwaddstr(wascii,i,1,sascii); + } + + wrefresh(woffs); + wrefresh(whex); + wrefresh(wascii); + wrefresh(wtop); + wrefresh(wbot); + + + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/thxv3.cc b/thxv3.cc new file mode 100644 index 0000000..0534219 --- /dev/null +++ b/thxv3.cc @@ -0,0 +1,463 @@ +#include +#include +#include + +struct data +{ +struct data* plast; +struct data* pnext; +char vals[16]; +unsigned long zeile; +char len; +}; + +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII"; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +int result; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten,*pdaten,*pfirst, *phelp; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).zeile=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Tastatureingabe erlauben + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tohex(int base10) +{ + int newbase=16; + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +int loadcontents() +{ + int retval=0; + int x; + char ch; + int k=0; + unsigned long zeile=0; + + + pdaten=pfirst; + + ch=fgetc(fp); + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(ch==EOF)) + { + for(x=0;x<16;x++) + { + ((*pdaten).vals[x])=ch; + if ((*pdaten).vals[x]==EOF) + { + (*pdaten).vals[x]=0; + break; + } + (*pdaten).len=x+1; + ch=fgetc(fp); + } + (*pdaten).zeile=zeile++; + if(!(ch==EOF)) + { + phelp=pdaten; + if (!(zeile%500)) {fprintf(stderr,"%c",'#');} + pdaten=((*pdaten).pnext)=(malloc(sizeof(daten))); + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + + } +/* D E B U G O N L Y +getchar(); + + pdaten=pfirst; + +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; +pdaten=pfirst; +for(;(*pdaten).pnext;pdaten=(*pdaten).pnext) + ; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} +} + + +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + wrefresh(woffs); + wrefresh(whex); + wrefresh(wascii); + wrefresh(wtop); + wrefresh(wbot); +} + +void lineout(unsigned long zeile) +{ + int z; + + miniinit(); + + ptv = tohex((*pdaten).zeile); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,zeile,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tohex((*pdaten).vals[z]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,zeile,1,shex); + for (z=0;z<(*pdaten).len;z++) + { + xascii[z] = (((*pdaten).vals[z]) > 33)?((*pdaten).vals[z]):254; + } + mvwaddstr(wascii,zeile,1,sascii); +} + + +void scrolld() +{ + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + int z; + + miniinit(); + + ptv = tohex((*pdaten).zeile); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,16,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tohex((*pdaten).vals[z]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,16,1,shex); + for (z=0;z<(*pdaten).len;z++) + { + xascii[z] = (((*pdaten).vals[z]) > 33)?((*pdaten).vals[z]):254; + } + mvwaddstr(wascii,16,1,sascii); +} + +void scrollu() +{ + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + int z; + ptv = tohex((*pdaten).zeile); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,1,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tohex((*pdaten).vals[z]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,1,1,shex); + for (z=0;z<(*pdaten).len;z++) + { + xascii[z] = (((*pdaten).vals[z]) > 33)?((*pdaten).vals[z]):254; + } + mvwaddstr(wascii,1,1,sascii); +} + + +int main(int argc, char *argv[]) +{ +//Variablen + unsigned int i,z; + unsigned long zeile=0,pos=0; + bool schalter; + int inpch; + +//Vorbereitung + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"THX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + mvwaddstr(wbot,1,1,argv[1]); + + +//Hauptprogramm + +schalter=false; +zeile=1; +pdaten=pfirst; + +//Initiale Ausgabe (Alle) +for(i=0;i<16;i++) + { + lineout(i+1); + if (schalter) break; + pdaten=(*pdaten).pnext; + if ((*pdaten).pnext == NULL) schalter=true; + } + scrrefresh(); + +if(i>15) pdaten=(*pdaten).plast; + +//Eventschleife + while(inpch!=KEY_END) + { + inpch=wgetch(whex); + switch(inpch) + { + case KEY_DOWN: + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + break; + case KEY_UP: + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + break; + case KEY_NPAGE: + for(i=0;i<16;i++) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + case KEY_PPAGE: + for(i=0;i<16;i++) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + break; + }; + scrrefresh(); + } + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/thxv4.cc b/thxv4.cc new file mode 100644 index 0000000..8c91a47 --- /dev/null +++ b/thxv4.cc @@ -0,0 +1,450 @@ +#include +#include +#include + +struct data +{ +struct data* plast; +struct data* pnext; +char vals[16]; +unsigned long zeile; +char len; +}; + +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +int result; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten,*pdaten,*pfirst, *phelp; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).zeile=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Tastatureingabe erlauben + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +int loadcontents() +{ + int retval=0; + int x; + char ch; + int k=0; + unsigned long zeile=0; + + + pdaten=pfirst; + + ch=fgetc(fp); + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdaten).vals[x])=ch; + if (feof(fp)) //(*pdaten).vals[x]==EOF) + { + (*pdaten).vals[x]=0; + break; + } + (*pdaten).len=x+1; + ch=fgetc(fp); + } + (*pdaten).zeile=zeile++; + if(!(feof(fp))) + { + phelp=pdaten; + if (!(zeile%500)) {fprintf(stderr,"%c",'#');} + pdaten=((*pdaten).pnext)=(malloc(sizeof(daten))); +// BUG: Check for Memory-Full does not work. + if(!pdaten) {abort();} + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + + } +/* D E B U G O N L Y +getchar(); + + pdaten=pfirst; + +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; +pdaten=pfirst; +for(;(*pdaten).pnext;pdaten=(*pdaten).pnext) + ; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} +} + + +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + wrefresh(woffs); + wrefresh(whex); + wrefresh(wascii); + wrefresh(wtop); + wrefresh(wbot); +} + +void lineout(unsigned long zeile) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdaten).zeile*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,zeile,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tonumsysx((*pdaten).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,zeile,1,shex); + for (z=0;z<(*pdaten).len;z++) + { + xascii[z] = (((*pdaten).vals[z]) > 31)?((*pdaten).vals[z]):254; + } + mvwaddstr(wascii,zeile,1,sascii); +} + +void initout() +{ +//Initiale Ausgabe (Alle) +int i; +bool schalter=false; +unsigned long zeile=1; +pdaten=pfirst; + +if ((*pdaten).pnext == NULL) schalter=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (schalter) break; + pdaten=(*pdaten).pnext; + if ((*pdaten).pnext == NULL) schalter=true; + } + scrrefresh(); + +if(i>15) pdaten=(*pdaten).plast; +} + +void scrolld() +{ + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + int z; + + miniinit(); + + lineout(16); +} + +void scrollu() +{ + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); +} + + +int main(int argc, char *argv[]) +{ +//Variablen + unsigned int i,z; + unsigned long zeile=0,pos=0; + bool schalter; + int inpch; + + printf("GHEX Version 0.5\n"); + +//Vorbereitung + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + mvwaddstr(wbot,1,1,argv[1]); + + +//Hauptprogramm + +initout(); + +//Eventschleife + while(inpch!=KEY_F(10)) + { + inpch=wgetch(whex); + switch(inpch) + { + case KEY_DOWN: + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + break; + case KEY_UP: + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + break; + case KEY_NPAGE: + for(i=0;i<16;i++) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + case KEY_PPAGE: + for(i=0;i<16;i++) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + break; + case KEY_HOME: + initout(); + break; + case KEY_END: + while((*pdaten).pnext) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + + }; + scrrefresh(); + } + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/tiah.cc b/tiah.cc new file mode 100644 index 0000000..3b9044f --- /dev/null +++ b/tiah.cc @@ -0,0 +1,1248 @@ +/* + * TIAH -- an advanced HEX-Editor + * Copyright (C) 1999 by Joerg Tretter + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +struct data // one line in Memory +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long line; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data datas, *pdatas, *pfirst, *phelp, *pmax; + +/*************************************************************************** + * FUNCTION: void initvar() * + * GOOD FOR: Initialization of basic-variables * + ***************************************************************************/ +void initvar() +{ + pfirst=&datas; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).line=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +/*************************************************************************** + * FUNCTION: void miniinit() * + * GOOD FOR: Initialization of frequent used variables * + ***************************************************************************/ +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +/*************************************************************************** + * FUNCTION: int screeninit() * + * GOOD FOR: Initialization of the n-curses-screen * + * RESULTS : 1:There was an error / 2:Everything ok. * + ***************************************************************************/ +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Create Curses-space for the windows +//TODO: check whether creation was fine. + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// enable scrolling + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// enable Keyboard-control + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// disable echoing of input + noecho(); + +// swich cursor to big size +// TODO: check why this not works in most cases +// if(curs_set(2)==ERR) retval=1 ; + +// creation of curses "Color-Pairs" + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + +// join the windows with the color-pairs + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + +// paint the boxes around the windows (in fact it's inside) + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + // change the color-pairs of the windows again. + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +/*************************************************************************** + * FUNCTION: char* tonumsysx() * + * GOOD FOR: Shift a number to another numbering system * + * INPUTS : - int base10 -The number in decimal system * + * - int newbase -The new system (16->Hex,2->Bin,...) * + * RESULTS : The number in the new system as a pointer of char * + ***************************************************************************/ +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +/*************************************************************************** + * FUNCTION: unsigned long xto10(char *c, int oldbase) * + * GOOD FOR: Shift a number from a foreign numbering system to decimal * + * INPUTS : - char* c -The number in foreign system * + * - int oldbase -The old system (16->Hex,2->Bin,...) * + * RESULTS : The number in decimal system as a unsigned long * + ***************************************************************************/ +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +/*************************************************************************** + * FUNCTION: int loadcontents() * + * GOOD FOR: Loading the contents of a file into the memory * + * RESULTS : The status of the loading (not used yet) * + ***************************************************************************/ +int loadcontents() +{ + int retval=0; + int x; + char ch; + unsigned long line=0; + + + pdatas=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"T.I.A.H - Tiah Is A Hex-editor. - opening 0-Byte file"); + pfirst=pmax=pdatas=(data*)(malloc(sizeof(datas))); + (*pdatas).pnext=NULL; + (*pdatas).plast=NULL; + (*pdatas).line=0; + (*pdatas).len=0; + + } + // TODO: how to flush the buffer of stdout??? + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdatas).vals[x])=ch; + if (feof(fp)) //(*pdatas).vals[x]==EOF) + { + (*pdatas).vals[x]=0; + break; + } + (*pdatas).len=x+1; + ch=fgetc(fp); + } + (*pdatas).line=line++; + if(!(feof(fp))) + { + phelp=pdatas; + if (!(line%500)) {printf("%c",'#');} + pdatas=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); +// BUG: Check for Memory-Full does not work. + if(!pdatas) {abort();} + (*pdatas).plast=phelp; + (*pdatas).pnext=NULL; + } + pmax=pdatas; + + } + return (retval); +} + +/*************************************************************************** + * FUNCTION: void endscr() * + * GOOD FOR: End the scrren session on curses-level * + ***************************************************************************/ +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +/*************************************************************************** + * FUNCTION: void unallocmem(int save, char* filename) * + * GOOD FOR: Free the memory from the bits & bytes * + * INPUTS : int save: flag (save Y/else key) * + * : cahr* filename: the name of the save-file * + ***************************************************************************/ +void unallocmem(int save, char *filename) +{ + int pos; + save=toupper(save); + if (save=='Y') + { + pdatas=pfirst; + fp=fopen(filename,"w"); + while((*pdatas).pnext) + { + for (pos=0;pos <(*pdatas).len;pos++) + { + fputc((*pdatas).vals[pos],fp); + } + pdatas=(*pdatas).pnext; + } + for (pos=0;pos <(*pdatas).len;pos++) fputc((*pdatas).vals[pos],fp); + close(fp); + } + { + pdatas=pmax; + } + while((*pdatas).plast) + { + phelp=(*pdatas).plast; + free(pdatas); + pdatas=phelp; + } +} + +/*************************************************************************** + * FUNCTION: void scrrefresh() * + * GOOD FOR: Refreah the basic-screen-elements (not the contents) * + ***************************************************************************/ +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + // depending on the mode (ascii/hex) set the cursor-position + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // the order is given by the mode (ascii/hex). the last window refreshed + // it the one, in which the cursor appears and the input-focus is. + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +/*************************************************************************** + * FUNCTION: void emplineout(unsigned long line) * + * GOOD FOR: Writing one empty line to the scrren * + ***************************************************************************/ +void emplineout(unsigned long line) +{ + mvwaddstr(woffs,line,1," "); + mvwaddstr(whex,line,1," "); + mvwaddstr(wascii,line,1," "); +} + +/*************************************************************************** + * FUNCTION: void lineout(unsigned long line) * + * GOOD FOR: Writing one line (the actual one) from the memory to screen * + ***************************************************************************/ +void lineout(unsigned long line) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdatas).line*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,line,1,soffs); + for (z=0;z<(*pdatas).len;z++) + { + ptv = tonumsysx((*pdatas).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,line,1,shex); + for (z=0;z<(*pdatas).len;z++) + { +// TODO: There are many other characters that are displayable. + xascii[z] = (isgraph((*pdatas).vals[z]))?((*pdatas).vals[z]):'.'; + } + mvwaddstr(wascii,line,1,sascii); +} + +/*************************************************************************** + * FUNCTION: void initout() * + * GOOD FOR: First output after loading the file // home-Key * + ***************************************************************************/ +void initout() +{ +//Initial output (All) +int i,z; +bool toggleswitch=false; +pdatas=pfirst; + +if ((*pdatas).pnext == NULL) toggleswitch=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + scrrefresh(); + +if(i>15) pdatas=(*pdatas).plast; +} + +/*************************************************************************** + * FUNCTION: int scrolld() * + * GOOD FOR: Scrolling the scrren one line down * + * RESULTS : 1: no more elements // 0: everything was nice * + ***************************************************************************/ +int scrolld() +{ + int resval; + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +/*************************************************************************** + * FUNCTION: int scrollu() * + * GOOD FOR: Scrolling the scrren one line up * + * RESULTS : 1: at first element // 0: everything was nice * + ***************************************************************************/ +int scrollu() +{ + int z=0; + int result; + while(((*pdatas).plast != NULL)&&(z < 16)) + { + pdatas=(*pdatas).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + } + } + return(result); +} + +/*************************************************************************** + * FUNCTION: void switchmode() * + * GOOD FOR: recalculation of cursor-position ascii<->hex * + ***************************************************************************/ +void switchmode() +{ + if(mode==0) + { + mode=1; // mode-toggle:Hex->Ascii + // recalculate cursor-position + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // mode-toggle:ascii->Hex + // recalculate cursor-position + pos.x=((pos.x*3)-1); + } +} + +/*************************************************************************** + * FUNCTION: void moveleft() * + * GOOD FOR: move the cursor one position to the left * + ***************************************************************************/ +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +/*************************************************************************** + * FUNCTION: void moveright() * + * GOOD FOR: move the cursor one position to the right * + ***************************************************************************/ +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +/*************************************************************************** + * FUNCTION: unsigned long getactpos() * + * GOOD FOR: get the acutal cursor-position as a file-offset * + * RESULTS : The file-offset on the cursor-position as unsigned long * + ***************************************************************************/ +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int distance; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the position + actpos=((*pdatas).line*16)+pos.x-1; + // and move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +/*************************************************************************** + * FUNCTION: void charin(char ch, int realmode, int realxpos) * + * GOOD FOR: insert/override one character in the memory * + * INPUTS : - char ch -the char to insert * + * - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int distance=0; + bool toggleswitch; + data *phelp2; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + unsigned long zhelp; + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + pdatas=pmax; + if ((*pdatas).len < 16) + { + (*pdatas).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).line+1; + pdatas=pmax=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).line=zhelp; + if (rbmode == 1) phelp=pmax; + } + while(pdatas!=phelp) + { + for(z=(*pdatas).len-1;z>=0;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + (*pdatas).vals[0]=(*(*pdatas).plast).vals[15]; + pdatas=(*pdatas).plast; + } + + for(z=(*pdatas).len-1;z+1>pos.x;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + pdatas=phelp; + } + // Write value + (*pdatas).vals[pos.x-1]=ch; + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +} + +/*************************************************************************** + * FUNCTION: int charout() * + * GOOD FOR: get the char at the actual cursor-position * + * RESULTS : the char as an integer (char should work too normaly) * + ***************************************************************************/ +int charout() +{ + int i=0; + int distance; + int posxsave; + int ch; + // Move in memory to cursor-position + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the value + ch=((*pdatas).vals[pos.x-1]); + // move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + return(ch); +} + +/*************************************************************************** + * FUNCTION: void bottomout() * + * GOOD FOR: refreshing the output of the bottom-window * + ***************************************************************************/ +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void swapbits() * + * GOOD FOR: toggle the bit [par1] an the actual position * + * INPUTS : - char bit the number (1-8) of the bit to toggle * + ***************************************************************************/ +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // for the Bits + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void delactchar(char ch, int realmode, int realxpos) * + * GOOD FOR: delete the char under the actual cursor-position * + * INPUTS : - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void delactchar(int realmode, int realxpos) +{ + //BUG: after deletion the last char in the last line it gives me a segfault. + int i=0; + int z=0; + int distance=0; + bool endflag=FALSE; + bool toggleswitch; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + for(z=realxpos-1;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + if((*pdatas).pnext) + { + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } + while(pdatas!=pmax) + { + for(z=0;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } +// check here for last char in last element + (*pdatas).len--; + if((*pdatas).len <= 0) + { + if(phelp==pmax) + { + if((*phelp).plast) + { + phelp=(*phelp).plast; + } + } + if(pfirst!=pmax) // is when pfirst!=pmax + { + pdatas=(*pdatas).plast; + free((*pdatas).pnext); + (*pdatas).pnext=NULL; + pmax=pdatas; + // TODO: there is one line less now, when we are at the last screen + // we should decrease i by one (only cosmetic) + endflag=TRUE; + } + else + { + (*pdatas).len=0; + } + } + else + { + if (phelp!=pmax) for(z=0;z<(*pdatas).len;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + } + pdatas=phelp; + } + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + // first delete the screen + for(z=0;z<16;z++) + { + emplineout(z+1); + } + // then do an initial output + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +// The rest is only a dirty workaround for the las (no longer needed) line +// because it was not possible for me to determine out, whether i am really +// at the end. + if (endflag) + { + for(i=0;i<16;i++) + { + if(!scrollu()) endflag=FALSE; + } + if (endflag) + { + if((pos.y < 16) && ((*pmax).line > 15)) pos.y++; + for(i=0;i<16;i++) + { + scrolld(); + } + } + } +} + +int main(int argc, char *argv[]) +{ +//Variables + unsigned int i; // Public counter + int inpch; // The char of input + +//Preperation + printf("T.I.A.H - Tiah Is A Hex-editor. Version 0.5 (C) Joerg Tretter 1999\n"); + //Is there a param? + if(argc < 2) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //open the file + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // set the pointers + initvar(); + // init of other useful varibles + pos.x = pos.y = 1; + filename=argv[1]; + //file -> ram + if(loadcontents()) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // init of terminal + if(screeninit()) + { + endscr(); + fprintf(stderr,"T.I.A.H -MESSAGE; !!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Main-procedure +initout(); +bottomout(); +scrrefresh(); + +//Event-loop + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + // The Keys F1-F8 (bit-setting) + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + //the delete character-key + case KEY_DC : if (mode == 1) + { + delactchar(1,pos.x); + } + else + { + switchmode(); + delactchar(1,pos.x); + switchmode(); + } + break; + + //the insert-key, switch insert mode + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + //Cursor-movement + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + case KEY_END: if((*pmax).line > 15) + { + pdatas=pmax; + for(i=0;((*pdatas).plast) && (i < 16);i++) + { + pdatas=(*pdatas).plast; + } + while((*pdatas).pnext) + { + scrolld(); + } + } + break; + // input characters + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // fill hch correct (old values) + int xpos=pos.x; // save position + switchmode(); // recalc. coordinates + ptv=tonumsysx(charout(),16); // actual char in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // recalc coordinates + pos.x=xpos; // restore coorinates + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // recalc coordinates + charin(xto10(hch,16),0,xpos); // calc Hex -> Ascii+charin + switchmode(); // and back + pos.x=xpos; // restore positions + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + + } + + WINDOW* s=derwin(whex,3,17,7,17); + wattrset(s,COLOR_PAIR(1)); + box(s,0,0); + wattrset(s,COLOR_PAIR(3)); + mvwaddstr(s,1,1,"SAVE FILE (Y/N)"); + wrefresh(s); + int saveit= wgetch(s); + endscr(); + unallocmem(saveit,argv[1]); + + return (fclose(fp)); +} diff --git a/tiah05/COPYING b/tiah05/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/tiah05/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/tiah05/Makefile b/tiah05/Makefile new file mode 100644 index 0000000..927ab66 --- /dev/null +++ b/tiah05/Makefile @@ -0,0 +1,40 @@ +############################################################################ +# # +# T.I.A.H - THIA IS A HEX-EDITOR # +# Copyright (C) 1999 by Joerg "Maddog" Tretter # +# # +############################################################################ + +PRGFILE = tiah +SRC = tiah.cc +MANFILE = tiah.1.gz + +INSTPATH = /usr/local/bin +MANPATH = /usr/man/man1 +DOCPATH = /usr/doc/tiah + +MAKE = make +CC = c++ +LIBS += -lncurses + +all: + $(MAKE) $(PRGFILE) + + +.cc: + @echo compiling $(SRC) . + @$(CC) $(LIBS) $(SRC) -o$(PRGFILE) + +install: + @install -s -g users -m 755 -o root $(PRGFILE) $(INSTPATH) + @install -d -g root -o root $(MANPATH) + @install -g root -m 644 -o root $(MANFILE) $(MANPATH) + @install -d -g root -o root $(DOCPATH) + @install -g root -m 644 -o root COPYING $(DOCPATH) + @install -g root -m 644 -o root README.PROGRAMMER $(DOCPATH) + @install -g root -m 644 -o root README.INSTALL $(DOCPATH) + @install -g root -m 644 -o root README.BUG $(DOCPATH) + +clean: + @echo removing object $(PRGFILE). + @rm $(PRGFILE) diff --git a/tiah05/README.BUG b/tiah05/README.BUG new file mode 100644 index 0000000..9213e9c --- /dev/null +++ b/tiah05/README.BUG @@ -0,0 +1 @@ +For known bugs see manpage. diff --git a/tiah05/README.INSTALL b/tiah05/README.INSTALL new file mode 100644 index 0000000..84f25af --- /dev/null +++ b/tiah05/README.INSTALL @@ -0,0 +1,24 @@ +TIAH (C) Joerg Tretter + +What do you need: +================= +- linux on a i386+ (other systems perhaps work, too) +- g++ or compatible +- ncurses library (normally installed on every linux-system) + +Steps of installation: +====================== +- edit Makefile if you want an alternative install-dir + (standard is /usr/local/bin) +- make && make install + (you will get some warnings, but that doesn't matter, + if you get an error and can't solve yourself: please report via mail) + +Please send me bug reports and other systems TIAH works on, too. + +If you like the program, please let me know (it's interesting for me to know +how may people are using TIAH.) + +Joerg Tretter +J.Tretter@gmx.de + diff --git a/tiah05/README.PROGRAMMER b/tiah05/README.PROGRAMMER new file mode 100644 index 0000000..7ffff92 --- /dev/null +++ b/tiah05/README.PROGRAMMER @@ -0,0 +1,24 @@ +TIAH (C) Joerg Tretter + +I know, the code abolutely cofusing, but keep in mind: + +This version is only the first prototype of TIAH. + +There is a complete revision of the source planned for the next release. + +So if you plan to adapt new features in this program better wait for +the new versions with a cleaned, object oriented source. + +Nevertheless, please send me every modification you did for fixing bugs. + +Plans for next releases +1. reengineer source-code (using classes, make code readable for others) +2. search-fuction +3. replace-function +4. fill-function +5. internal calculator (source numbering-system <-> target-numbering system) +6. perhaps various goodies :-)) +7. Changes suggested by others. + +Joerg Tretter +J.Tretter@gmx.de diff --git a/tiah05/tiah.1.gz b/tiah05/tiah.1.gz new file mode 100644 index 0000000000000000000000000000000000000000..468aaafed097a6fede3560ad79e6f4da930050be GIT binary patch literal 830 zcmV-E1Ht?siwFpLQ`I*B19WL&Xf81TO;llTn=lal&ab!+la_7)HT$$y)1-8zYo;dY z0@JpS1`e=le8@IQvtPfnp-CbIfqA@p_wL!reFfXnQGo^)b6DKm+(gN}gM77oghiBW zZIom!Y?kXZN;VxhDO$d%K-f~sITTV0bDTqkrR;>7LyNEC^gyK(3b2xnOyJ4>Znn?a zDvOf4iE3$}mI?uqBngoFH2bz&J?E?KCdyk3Fz5|6Msy%82$*Sda71?n^`O)dY7~P* zQ~BCcF*r!qGSuO#iwj|~0;w5OixTG`ohRJO3T?nk-2@SqL8Tfh|6HL$CrN|Q{#%PC zJW&m0D~u?a%(CF;{wy+nQ(02ST$6-Qm+^9smvRPXJZnm#HSMuO?R<+BX=H$x;h4M} zj3qONUNpSiPd61EG~3Okf<)y13m!*F!Rnr;!0z*+y$!1mi}>L)+(J%G!;X9EJLxPe z;?FR<{t|y(Tt!J?qK6yc-z{X^LD@oq?trM_G5r%NEwgW{Rqzcus&M>daUDMSIq<3{ zo~#HjSDWmT&rv{(p2jDN`}8TGg7J8E8AR=`XCq)nny22AwX#s22)IJJ%i}e3jV*-C zZu2y|jh;w^ffn*@$WFZQRgt$>di!`*sMIM6T&nY|7YdUoOjsjUoWOzx2cJF!Hu(>I zC~AWU9d=}nFxxHHAG6=f=d0u-=I+;b*5aRjx9p|wWAd8I; zh6wqq#h~0syYg9aXCK(tjzcu2!B2WYkwX5Lfp*;?vqK0@|xaed7(MXTRWAH3nG zT7Ku0L@!{Fw+uJQ=5iOlZ6)>a3OwvrU)Yc6U7qgN$=Sjq4FNd{=6yOs=ix;w_Q4R; zN|**O+KgM2P3xdI0&7$#tT&1e1!9ajNM`f|VFLb~u{iA%a*n$A!2QwTB>&{9MPWGG z^`Ofzr|}@+ea`39IR(pK`QvsM{U9_A +#include +#include +#include +#include + +struct data // one line in Memory +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long line; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data datas, *pdatas, *pfirst, *phelp, *pmax; + +/*************************************************************************** + * FUNCTION: void initvar() * + * GOOD FOR: Initialization of basic-variables * + ***************************************************************************/ +void initvar() +{ + pfirst=&datas; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).line=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +/*************************************************************************** + * FUNCTION: void miniinit() * + * GOOD FOR: Initialization of frequent used variables * + ***************************************************************************/ +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +/*************************************************************************** + * FUNCTION: int screeninit() * + * GOOD FOR: Initialization of the n-curses-screen * + * RESULTS : 1:There was an error / 2:Everything ok. * + ***************************************************************************/ +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Create Curses-space for the windows +//TODO: check whether creation was fine. + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// enable scrolling + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// enable Keyboard-control + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// disable echoing of input + noecho(); + +// swich cursor to big size +// TODO: check why this not works in most cases +// if(curs_set(2)==ERR) retval=1 ; + +// creation of curses "Color-Pairs" + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + +// join the windows with the color-pairs + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + +// paint the boxes around the windows (in fact it's inside) + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + // change the color-pairs of the windows again. + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +/*************************************************************************** + * FUNCTION: char* tonumsysx() * + * GOOD FOR: Shift a number to another numbering system * + * INPUTS : - int base10 -The number in decimal system * + * - int newbase -The new system (16->Hex,2->Bin,...) * + * RESULTS : The number in the new system as a pointer of char * + ***************************************************************************/ +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +/*************************************************************************** + * FUNCTION: unsigned long xto10(char *c, int oldbase) * + * GOOD FOR: Shift a number from a foreign numbering system to decimal * + * INPUTS : - char* c -The number in foreign system * + * - int oldbase -The old system (16->Hex,2->Bin,...) * + * RESULTS : The number in decimal system as a unsigned long * + ***************************************************************************/ +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +/*************************************************************************** + * FUNCTION: int loadcontents() * + * GOOD FOR: Loading the contents of a file into the memory * + * RESULTS : The status of the loading (not used yet) * + ***************************************************************************/ +int loadcontents() +{ + int retval=0; + int x; + char ch; + unsigned long line=0; + + + pdatas=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"T.I.A.H - Tiah Is A Hex-editor. - opening 0-Byte file"); + pfirst=pmax=pdatas=(data*)(malloc(sizeof(datas))); + (*pdatas).pnext=NULL; + (*pdatas).plast=NULL; + (*pdatas).line=0; + (*pdatas).len=0; + + } + // TODO: how to flush the buffer of stdout??? + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdatas).vals[x])=ch; + if (feof(fp)) //(*pdatas).vals[x]==EOF) + { + (*pdatas).vals[x]=0; + break; + } + (*pdatas).len=x+1; + ch=fgetc(fp); + } + (*pdatas).line=line++; + if(!(feof(fp))) + { + phelp=pdatas; + if (!(line%500)) {printf("%c",'#');} + pdatas=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); +// BUG: Check for Memory-Full does not work. + if(!pdatas) {abort();} + (*pdatas).plast=phelp; + (*pdatas).pnext=NULL; + } + pmax=pdatas; + + } + return (retval); +} + +/*************************************************************************** + * FUNCTION: void endscr() * + * GOOD FOR: End the scrren session on curses-level * + ***************************************************************************/ +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +/*************************************************************************** + * FUNCTION: void unallocmem(int save, char* filename) * + * GOOD FOR: Free the memory from the bits & bytes * + * INPUTS : int save: flag (save Y/else key) * + * : cahr* filename: the name of the save-file * + ***************************************************************************/ +void unallocmem(int save, char *filename) +{ + int pos; + save=toupper(save); + if (save=='Y') + { + pdatas=pfirst; + fp=fopen(filename,"w"); + while((*pdatas).pnext) + { + for (pos=0;pos <(*pdatas).len;pos++) + { + fputc((*pdatas).vals[pos],fp); + } + pdatas=(*pdatas).pnext; + } + for (pos=0;pos <(*pdatas).len;pos++) fputc((*pdatas).vals[pos],fp); + close(fp); + } + { + pdatas=pmax; + } + while((*pdatas).plast) + { + phelp=(*pdatas).plast; + free(pdatas); + pdatas=phelp; + } +} + +/*************************************************************************** + * FUNCTION: void scrrefresh() * + * GOOD FOR: Refreah the basic-screen-elements (not the contents) * + ***************************************************************************/ +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + // depending on the mode (ascii/hex) set the cursor-position + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // the order is given by the mode (ascii/hex). the last window refreshed + // it the one, in which the cursor appears and the input-focus is. + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +/*************************************************************************** + * FUNCTION: void emplineout(unsigned long line) * + * GOOD FOR: Writing one empty line to the scrren * + ***************************************************************************/ +void emplineout(unsigned long line) +{ + mvwaddstr(woffs,line,1," "); + mvwaddstr(whex,line,1," "); + mvwaddstr(wascii,line,1," "); +} + +/*************************************************************************** + * FUNCTION: void lineout(unsigned long line) * + * GOOD FOR: Writing one line (the actual one) from the memory to screen * + ***************************************************************************/ +void lineout(unsigned long line) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdatas).line*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,line,1,soffs); + for (z=0;z<(*pdatas).len;z++) + { + ptv = tonumsysx((*pdatas).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,line,1,shex); + for (z=0;z<(*pdatas).len;z++) + { +// TODO: There are many other characters that are displayable. + xascii[z] = (isgraph((*pdatas).vals[z]))?((*pdatas).vals[z]):'.'; + } + mvwaddstr(wascii,line,1,sascii); +} + +/*************************************************************************** + * FUNCTION: void initout() * + * GOOD FOR: First output after loading the file // home-Key * + ***************************************************************************/ +void initout() +{ +//Initial output (All) +int i,z; +bool toggleswitch=false; +pdatas=pfirst; + +if ((*pdatas).pnext == NULL) toggleswitch=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + scrrefresh(); + +if(i>15) pdatas=(*pdatas).plast; +} + +/*************************************************************************** + * FUNCTION: int scrolld() * + * GOOD FOR: Scrolling the scrren one line down * + * RESULTS : 1: no more elements // 0: everything was nice * + ***************************************************************************/ +int scrolld() +{ + int resval; + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +/*************************************************************************** + * FUNCTION: int scrollu() * + * GOOD FOR: Scrolling the scrren one line up * + * RESULTS : 1: at first element // 0: everything was nice * + ***************************************************************************/ +int scrollu() +{ + int z=0; + int result; + while(((*pdatas).plast != NULL)&&(z < 16)) + { + pdatas=(*pdatas).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + } + } + return(result); +} + +/*************************************************************************** + * FUNCTION: void switchmode() * + * GOOD FOR: recalculation of cursor-position ascii<->hex * + ***************************************************************************/ +void switchmode() +{ + if(mode==0) + { + mode=1; // mode-toggle:Hex->Ascii + // recalculate cursor-position + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // mode-toggle:ascii->Hex + // recalculate cursor-position + pos.x=((pos.x*3)-1); + } +} + +/*************************************************************************** + * FUNCTION: void moveleft() * + * GOOD FOR: move the cursor one position to the left * + ***************************************************************************/ +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +/*************************************************************************** + * FUNCTION: void moveright() * + * GOOD FOR: move the cursor one position to the right * + ***************************************************************************/ +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +/*************************************************************************** + * FUNCTION: unsigned long getactpos() * + * GOOD FOR: get the acutal cursor-position as a file-offset * + * RESULTS : The file-offset on the cursor-position as unsigned long * + ***************************************************************************/ +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int distance; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the position + actpos=((*pdatas).line*16)+pos.x-1; + // and move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +/*************************************************************************** + * FUNCTION: void charin(char ch, int realmode, int realxpos) * + * GOOD FOR: insert/override one character in the memory * + * INPUTS : - char ch -the char to insert * + * - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int distance=0; + bool toggleswitch; + data *phelp2; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + unsigned long zhelp; + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + pdatas=pmax; + if ((*pdatas).len < 16) + { + (*pdatas).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).line+1; + pdatas=pmax=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).line=zhelp; + if (rbmode == 1) phelp=pmax; + } + while(pdatas!=phelp) + { + for(z=(*pdatas).len-1;z>=0;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + (*pdatas).vals[0]=(*(*pdatas).plast).vals[15]; + pdatas=(*pdatas).plast; + } + + for(z=(*pdatas).len-1;z+1>pos.x;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + pdatas=phelp; + } + // Write value + (*pdatas).vals[pos.x-1]=ch; + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +} + +/*************************************************************************** + * FUNCTION: int charout() * + * GOOD FOR: get the char at the actual cursor-position * + * RESULTS : the char as an integer (char should work too normaly) * + ***************************************************************************/ +int charout() +{ + int i=0; + int distance; + int posxsave; + int ch; + // Move in memory to cursor-position + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the value + ch=((*pdatas).vals[pos.x-1]); + // move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + return(ch); +} + +/*************************************************************************** + * FUNCTION: void bottomout() * + * GOOD FOR: refreshing the output of the bottom-window * + ***************************************************************************/ +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void swapbits() * + * GOOD FOR: toggle the bit [par1] an the actual position * + * INPUTS : - char bit the number (1-8) of the bit to toggle * + ***************************************************************************/ +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // for the Bits + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void delactchar(char ch, int realmode, int realxpos) * + * GOOD FOR: delete the char under the actual cursor-position * + * INPUTS : - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void delactchar(int realmode, int realxpos) +{ + //BUG: after deletion the last char in the last line it gives me a segfault. + int i=0; + int z=0; + int distance=0; + bool endflag=FALSE; + bool toggleswitch; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + for(z=realxpos-1;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + if((*pdatas).pnext) + { + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } + while(pdatas!=pmax) + { + for(z=0;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } +// check here for last char in last element + (*pdatas).len--; + if((*pdatas).len <= 0) + { + if(phelp==pmax) + { + if((*phelp).plast) + { + phelp=(*phelp).plast; + } + } + if(pfirst!=pmax) // is when pfirst!=pmax + { + pdatas=(*pdatas).plast; + free((*pdatas).pnext); + (*pdatas).pnext=NULL; + pmax=pdatas; + // TODO: there is one line less now, when we are at the last screen + // we should decrease i by one (only cosmetic) + endflag=TRUE; + } + else + { + (*pdatas).len=0; + } + } + else + { + if (phelp!=pmax) for(z=0;z<(*pdatas).len;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + } + pdatas=phelp; + } + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + // first delete the screen + for(z=0;z<16;z++) + { + emplineout(z+1); + } + // then do an initial output + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +// The rest is only a dirty workaround for the las (no longer needed) line +// because it was not possible for me to determine out, whether i am really +// at the end. + if (endflag) + { + for(i=0;i<16;i++) + { + if(!scrollu()) endflag=FALSE; + } + if (endflag) + { + if((pos.y < 16) && ((*pmax).line > 15)) pos.y++; + for(i=0;i<16;i++) + { + scrolld(); + } + } + } +} + +int main(int argc, char *argv[]) +{ +//Variables + unsigned int i; // Public counter + int inpch; // The char of input + +//Preperation + printf("T.I.A.H - Tiah Is A Hex-editor. Version 0.5 (C) Joerg Tretter 1999\n"); + //Is there a param? + if(argc < 2) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //open the file + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // set the pointers + initvar(); + // init of other useful varibles + pos.x = pos.y = 1; + filename=argv[1]; + //file -> ram + if(loadcontents()) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // init of terminal + if(screeninit()) + { + endscr(); + fprintf(stderr,"T.I.A.H -MESSAGE; !!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Main-procedure +initout(); +bottomout(); +scrrefresh(); + +//Event-loop + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + // The Keys F1-F8 (bit-setting) + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + //the delete character-key + case KEY_DC : if (mode == 1) + { + delactchar(1,pos.x); + } + else + { + switchmode(); + delactchar(1,pos.x); + switchmode(); + } + break; + + //the insert-key, switch insert mode + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + //Cursor-movement + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + case KEY_END: if((*pmax).line > 15) + { + pdatas=pmax; + for(i=0;((*pdatas).plast) && (i < 16);i++) + { + pdatas=(*pdatas).plast; + } + while((*pdatas).pnext) + { + scrolld(); + } + } + break; + // input characters + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // fill hch correct (old values) + int xpos=pos.x; // save position + switchmode(); // recalc. coordinates + ptv=tonumsysx(charout(),16); // actual char in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // recalc coordinates + pos.x=xpos; // restore coorinates + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // recalc coordinates + charin(xto10(hch,16),0,xpos); // calc Hex -> Ascii+charin + switchmode(); // and back + pos.x=xpos; // restore positions + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + + } + + WINDOW* s=derwin(whex,3,17,7,17); + wattrset(s,COLOR_PAIR(1)); + box(s,0,0); + wattrset(s,COLOR_PAIR(3)); + mvwaddstr(s,1,1,"SAVE FILE (Y/N)"); + wrefresh(s); + int saveit= wgetch(s); + endscr(); + unallocmem(saveit,argv[1]); + + return (fclose(fp)); +} diff --git a/tiah05/tiah05.tar.bz2 b/tiah05/tiah05.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..4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|qb0u@MAXWsrCuT?XKoQXSaC9buq(@>=-PbeO1p-N~I zKoDv@-`aD4c|G47EGac972r)KjX1MCC)qv0J}6NsQG1Ve7@>>448UdzpJGu~m4{b# zQHZlyrI8gZ%9NzBu1Z!C$Vm0-F416)EUQ&=DU*gY=^SHp+g4%ai;e{}`~7g@6f`!= zI?C2Xr%;0OV7U?|Dz>TvO2}kna1T-xe-ga6_>sk(ThO)FGfOT6xmcS?9Bp@41dSPn zrMn;rgOwz>xGb}0%|FTP4M(Zeb)~M6DUmWhY9&Hb0w^P?E~=iVI`yTnL?{=K*&rj5 z6bNDfAc%ySCC2kIdq0!f#lc4CXZ`O7V*PBaU*uoY5<$4LuoT7&NS*~GSWKh<&*Z*? z8~#NOti+*=ucB<+C-p42#kK1!NGJMB5_7w%L0u?Cubx&&zwgt;+PP$!8aNpt!>!~M z=qp}tZKQj6pmq-bh&zIsL|KPMz7(8=G(UmlLlqk~#%au$n7DkgT7&40tWJ!g`hx>l zRT?xEZL0f8X^YS2b4Q;T>j;0fvV!r&ImU z&YdIiz!p?>ifMj=McWh5MW}9WoHWrHoS;M&+$MCypz#(Hlr>=3+)q)kMFkb?fY0@m zZqZPNY@}l0Ms_b}uZALYqLY(qp7M}@038$n53a?f312=BI|;4U4t{_)oYlOr&zl#* zT$(aH-yjy|uu`4##|gSxyc~B?NWYkYoG@;7z5R9ZO$k#I?O~N5)W;lUCuls9X{=?o zjHc4>w3Ka3+E|>b?;;S}qb~GGUt1fOkb};TZQ)4H1z_DbAFpqhus0j{3`(_{UxZY7 z?gYDph+K?jR%Vs%`hOmb{rCU?pmt78nB8n_4Mx!ye|{9VZu;X*=_q&loQ C0|uG^ literal 0 HcmV?d00001 diff --git a/tiah05/tiah05.tar.gz b/tiah05/tiah05.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..23db13678d352ad81b50357f89a0ba8152699ac9 GIT binary patch literal 16841 zcmV(`6zW1jsqgk%YsN`_ z0$^{f*~P#5X#uQntgp8>u%eCC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lxp!7)U;pw+L@$^vv-izx`mpxb8zwefYKF zJ$>`nTzusHpL^@s|Nb`)zGC9(^H22M__lK{*eu;X^yPtvF8ugc9(e5DuV3?@6)$+ehE{rFVVv`n#U^oBJRBq0C{^fJu|6ivr`N7vely>%h`FnRiF!aIi$Wtf&^05amKkI=vKK-@L z*M47)o%i*#FW7VNGhg_t*W9`E@WhqR{>PuYV`b){r(XT97xqB!2UNMt!K&pz*S~te9Ta{d+ zvV1tEmXmU6)Bzr&Ux*x5SmTR3qlBOi^VO5ai#nw)crWd8gP28bXOMA!10^rOix&E* zxS11_P^FI7$;M@oh4Io$m8FrJVk?f4D3{3sgytx;9AgcGkYi~$fXR2mYA*)XAo$TH zt>%S|Fk&hQC_0(a$$PP%@+ODSVMqF|B?Pr zj*Q?h6O-e+^#8?py3zj(omXvQ#}ZQozuch0P(^=@jx3WeRn@eH4F5 zep9*#2_v6<@+Y7H7mqx-5VS?w z@sd-kb17Jt496i`s4b6SfvDDEux4;++rOp>n;n0Hch?un!k5b)||3_@S`0Y0!vQv?0| zVlpXbC=da&_txQ$x?O}bxg)Q5sn6E#v-|8myU*^k`|Liu&+fDP>^{5C57YDi0IIu% IascoE02n=&FaQ7m literal 0 HcmV?d00001 diff --git a/tiah05a/CHANGES b/tiah05a/CHANGES new file mode 100644 index 0000000..9892a81 --- /dev/null +++ b/tiah05a/CHANGES @@ -0,0 +1,6 @@ +0.5a: +bugfix, use of proper function strncpy instead of "=" for filling string constants, there was a compile-problem with newer compilers. + +0.5: +first official release + diff --git a/tiah05a/COPYING b/tiah05a/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/tiah05a/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/tiah05a/Makefile b/tiah05a/Makefile new file mode 100644 index 0000000..927ab66 --- /dev/null +++ b/tiah05a/Makefile @@ -0,0 +1,40 @@ +############################################################################ +# # +# T.I.A.H - THIA IS A HEX-EDITOR # +# Copyright (C) 1999 by Joerg "Maddog" Tretter # +# # +############################################################################ + +PRGFILE = tiah +SRC = tiah.cc +MANFILE = tiah.1.gz + +INSTPATH = /usr/local/bin +MANPATH = /usr/man/man1 +DOCPATH = /usr/doc/tiah + +MAKE = make +CC = c++ +LIBS += -lncurses + +all: + $(MAKE) $(PRGFILE) + + +.cc: + @echo compiling $(SRC) . + @$(CC) $(LIBS) $(SRC) -o$(PRGFILE) + +install: + @install -s -g users -m 755 -o root $(PRGFILE) $(INSTPATH) + @install -d -g root -o root $(MANPATH) + @install -g root -m 644 -o root $(MANFILE) $(MANPATH) + @install -d -g root -o root $(DOCPATH) + @install -g root -m 644 -o root COPYING $(DOCPATH) + @install -g root -m 644 -o root README.PROGRAMMER $(DOCPATH) + @install -g root -m 644 -o root README.INSTALL $(DOCPATH) + @install -g root -m 644 -o root README.BUG $(DOCPATH) + +clean: + @echo removing object $(PRGFILE). + @rm $(PRGFILE) diff --git a/tiah05a/README.BUG b/tiah05a/README.BUG new file mode 100644 index 0000000..9213e9c --- /dev/null +++ b/tiah05a/README.BUG @@ -0,0 +1 @@ +For known bugs see manpage. diff --git a/tiah05a/README.INSTALL b/tiah05a/README.INSTALL new file mode 100644 index 0000000..84f25af --- /dev/null +++ b/tiah05a/README.INSTALL @@ -0,0 +1,24 @@ +TIAH (C) Joerg Tretter + +What do you need: +================= +- linux on a i386+ (other systems perhaps work, too) +- g++ or compatible +- ncurses library (normally installed on every linux-system) + +Steps of installation: +====================== +- edit Makefile if you want an alternative install-dir + (standard is /usr/local/bin) +- make && make install + (you will get some warnings, but that doesn't matter, + if you get an error and can't solve yourself: please report via mail) + +Please send me bug reports and other systems TIAH works on, too. + +If you like the program, please let me know (it's interesting for me to know +how may people are using TIAH.) + +Joerg Tretter +J.Tretter@gmx.de + diff --git a/tiah05a/README.PROGRAMMER b/tiah05a/README.PROGRAMMER new file mode 100644 index 0000000..7ffff92 --- /dev/null +++ b/tiah05a/README.PROGRAMMER @@ -0,0 +1,24 @@ +TIAH (C) Joerg Tretter + +I know, the code abolutely cofusing, but keep in mind: + +This version is only the first prototype of TIAH. + +There is a complete revision of the source planned for the next release. + +So if you plan to adapt new features in this program better wait for +the new versions with a cleaned, object oriented source. + +Nevertheless, please send me every modification you did for fixing bugs. + +Plans for next releases +1. reengineer source-code (using classes, make code readable for others) +2. search-fuction +3. replace-function +4. fill-function +5. internal calculator (source numbering-system <-> target-numbering system) +6. perhaps various goodies :-)) +7. Changes suggested by others. + +Joerg Tretter +J.Tretter@gmx.de diff --git a/tiah05a/tiah.1.gz b/tiah05a/tiah.1.gz new file mode 100644 index 0000000000000000000000000000000000000000..468aaafed097a6fede3560ad79e6f4da930050be GIT binary patch literal 830 zcmV-E1Ht?siwFpLQ`I*B19WL&Xf81TO;llTn=lal&ab!+la_7)HT$$y)1-8zYo;dY z0@JpS1`e=le8@IQvtPfnp-CbIfqA@p_wL!reFfXnQGo^)b6DKm+(gN}gM77oghiBW zZIom!Y?kXZN;VxhDO$d%K-f~sITTV0bDTqkrR;>7LyNEC^gyK(3b2xnOyJ4>Znn?a zDvOf4iE3$}mI?uqBngoFH2bz&J?E?KCdyk3Fz5|6Msy%82$*Sda71?n^`O)dY7~P* zQ~BCcF*r!qGSuO#iwj|~0;w5OixTG`ohRJO3T?nk-2@SqL8Tfh|6HL$CrN|Q{#%PC zJW&m0D~u?a%(CF;{wy+nQ(02ST$6-Qm+^9smvRPXJZnm#HSMuO?R<+BX=H$x;h4M} zj3qONUNpSiPd61EG~3Okf<)y13m!*F!Rnr;!0z*+y$!1mi}>L)+(J%G!;X9EJLxPe z;?FR<{t|y(Tt!J?qK6yc-z{X^LD@oq?trM_G5r%NEwgW{Rqzcus&M>daUDMSIq<3{ zo~#HjSDWmT&rv{(p2jDN`}8TGg7J8E8AR=`XCq)nny22AwX#s22)IJJ%i}e3jV*-C zZu2y|jh;w^ffn*@$WFZQRgt$>di!`*sMIM6T&nY|7YdUoOjsjUoWOzx2cJF!Hu(>I zC~AWU9d=}nFxxHHAG6=f=d0u-=I+;b*5aRjx9p|wWAd8I; zh6wqq#h~0syYg9aXCK(tjzcu2!B2WYkwX5Lfp*;?vqK0@|xaed7(MXTRWAH3nG zT7Ku0L@!{Fw+uJQ=5iOlZ6)>a3OwvrU)Yc6U7qgN$=Sjq4FNd{=6yOs=ix;w_Q4R; zN|**O+KgM2P3xdI0&7$#tT&1e1!9ajNM`f|VFLb~u{iA%a*n$A!2QwTB>&{9MPWGG z^`Ofzr|}@+ea`39IR(pK`QvsM{U9_A +#include +#include +#include +#include +#include + +struct data // one line in Memory +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long line; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data datas, *pdatas, *pfirst, *phelp, *pmax; + +/*************************************************************************** + * FUNCTION: void initvar() * + * GOOD FOR: Initialization of basic-variables * + ***************************************************************************/ +void initvar() +{ + pfirst=&datas; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).line=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +/*************************************************************************** + * FUNCTION: void miniinit() * + * GOOD FOR: Initialization of frequent used variables * + ***************************************************************************/ +void miniinit() +{ +strncpy(xoffs, " ",9); +strncpy(xhex, " ",51); +strncpy(xascii, " ",17); +} + +/*************************************************************************** + * FUNCTION: int screeninit() * + * GOOD FOR: Initialization of the n-curses-screen * + * RESULTS : 1:There was an error / 2:Everything ok. * + ***************************************************************************/ +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Create Curses-space for the windows +//TODO: check whether creation was fine. + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// enable scrolling + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// enable Keyboard-control + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// disable echoing of input + noecho(); + +// swich cursor to big size +// TODO: check why this not works in most cases +// if(curs_set(2)==ERR) retval=1 ; + +// creation of curses "Color-Pairs" + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + +// join the windows with the color-pairs + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + +// paint the boxes around the windows (in fact it's inside) + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + // change the color-pairs of the windows again. + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +/*************************************************************************** + * FUNCTION: char* tonumsysx() * + * GOOD FOR: Shift a number to another numbering system * + * INPUTS : - int base10 -The number in decimal system * + * - int newbase -The new system (16->Hex,2->Bin,...) * + * RESULTS : The number in the new system as a pointer of char * + ***************************************************************************/ +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + strncpy(swap,"********",9); + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +/*************************************************************************** + * FUNCTION: unsigned long xto10(char *c, int oldbase) * + * GOOD FOR: Shift a number from a foreign numbering system to decimal * + * INPUTS : - char* c -The number in foreign system * + * - int oldbase -The old system (16->Hex,2->Bin,...) * + * RESULTS : The number in decimal system as a unsigned long * + ***************************************************************************/ +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +/*************************************************************************** + * FUNCTION: int loadcontents() * + * GOOD FOR: Loading the contents of a file into the memory * + * RESULTS : The status of the loading (not used yet) * + ***************************************************************************/ +int loadcontents() +{ + int retval=0; + int x; + char ch; + unsigned long line=0; + + + pdatas=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"T.I.A.H - Tiah Is A Hex-editor. - opening 0-Byte file"); + pfirst=pmax=pdatas=(data*)(malloc(sizeof(datas))); + (*pdatas).pnext=NULL; + (*pdatas).plast=NULL; + (*pdatas).line=0; + (*pdatas).len=0; + + } + // TODO: how to flush the buffer of stdout??? + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdatas).vals[x])=ch; + if (feof(fp)) //(*pdatas).vals[x]==EOF) + { + (*pdatas).vals[x]=0; + break; + } + (*pdatas).len=x+1; + ch=fgetc(fp); + } + (*pdatas).line=line++; + if(!(feof(fp))) + { + phelp=pdatas; + if (!(line%500)) {printf("%c",'#');} + pdatas=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); +// BUG: Check for Memory-Full does not work. + if(!pdatas) {abort();} + (*pdatas).plast=phelp; + (*pdatas).pnext=NULL; + } + pmax=pdatas; + + } + return (retval); +} + +/*************************************************************************** + * FUNCTION: void endscr() * + * GOOD FOR: End the scrren session on curses-level * + ***************************************************************************/ +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +/*************************************************************************** + * FUNCTION: void unallocmem(int save, char* filename) * + * GOOD FOR: Free the memory from the bits & bytes * + * INPUTS : int save: flag (save Y/else key) * + * : cahr* filename: the name of the save-file * + ***************************************************************************/ +void unallocmem(int save, char *filename) +{ + int pos; + save=toupper(save); + if (save=='Y') + { + pdatas=pfirst; + fp=fopen(filename,"w"); + while((*pdatas).pnext) + { + for (pos=0;pos <(*pdatas).len;pos++) + { + fputc((*pdatas).vals[pos],fp); + } + pdatas=(*pdatas).pnext; + } + for (pos=0;pos <(*pdatas).len;pos++) fputc((*pdatas).vals[pos],fp); + fclose(fp); + } + { + pdatas=pmax; + } + while((*pdatas).plast) + { + phelp=(*pdatas).plast; + free(pdatas); + pdatas=phelp; + } +} + +/*************************************************************************** + * FUNCTION: void scrrefresh() * + * GOOD FOR: Refreah the basic-screen-elements (not the contents) * + ***************************************************************************/ +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + // depending on the mode (ascii/hex) set the cursor-position + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // the order is given by the mode (ascii/hex). the last window refreshed + // it the one, in which the cursor appears and the input-focus is. + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +/*************************************************************************** + * FUNCTION: void emplineout(unsigned long line) * + * GOOD FOR: Writing one empty line to the scrren * + ***************************************************************************/ +void emplineout(unsigned long line) +{ + mvwaddstr(woffs,line,1," "); + mvwaddstr(whex,line,1," "); + mvwaddstr(wascii,line,1," "); +} + +/*************************************************************************** + * FUNCTION: void lineout(unsigned long line) * + * GOOD FOR: Writing one line (the actual one) from the memory to screen * + ***************************************************************************/ +void lineout(unsigned long line) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdatas).line*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,line,1,soffs); + for (z=0;z<(*pdatas).len;z++) + { + ptv = tonumsysx((*pdatas).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,line,1,shex); + for (z=0;z<(*pdatas).len;z++) + { +// TODO: There are many other characters that are displayable. + xascii[z] = (isgraph((*pdatas).vals[z]))?((*pdatas).vals[z]):'.'; + } + mvwaddstr(wascii,line,1,sascii); +} + +/*************************************************************************** + * FUNCTION: void initout() * + * GOOD FOR: First output after loading the file // home-Key * + ***************************************************************************/ +void initout() +{ +//Initial output (All) +int i,z; +bool toggleswitch=false; +pdatas=pfirst; + +if ((*pdatas).pnext == NULL) toggleswitch=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + scrrefresh(); + +if(i>15) pdatas=(*pdatas).plast; +} + +/*************************************************************************** + * FUNCTION: int scrolld() * + * GOOD FOR: Scrolling the scrren one line down * + * RESULTS : 1: no more elements // 0: everything was nice * + ***************************************************************************/ +int scrolld() +{ + int resval; + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +/*************************************************************************** + * FUNCTION: int scrollu() * + * GOOD FOR: Scrolling the scrren one line up * + * RESULTS : 1: at first element // 0: everything was nice * + ***************************************************************************/ +int scrollu() +{ + int z=0; + int result; + while(((*pdatas).plast != NULL)&&(z < 16)) + { + pdatas=(*pdatas).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + } + } + return(result); +} + +/*************************************************************************** + * FUNCTION: void switchmode() * + * GOOD FOR: recalculation of cursor-position ascii<->hex * + ***************************************************************************/ +void switchmode() +{ + if(mode==0) + { + mode=1; // mode-toggle:Hex->Ascii + // recalculate cursor-position + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // mode-toggle:ascii->Hex + // recalculate cursor-position + pos.x=((pos.x*3)-1); + } +} + +/*************************************************************************** + * FUNCTION: void moveleft() * + * GOOD FOR: move the cursor one position to the left * + ***************************************************************************/ +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +/*************************************************************************** + * FUNCTION: void moveright() * + * GOOD FOR: move the cursor one position to the right * + ***************************************************************************/ +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +/*************************************************************************** + * FUNCTION: unsigned long getactpos() * + * GOOD FOR: get the acutal cursor-position as a file-offset * + * RESULTS : The file-offset on the cursor-position as unsigned long * + ***************************************************************************/ +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int distance; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the position + actpos=((*pdatas).line*16)+pos.x-1; + // and move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +/*************************************************************************** + * FUNCTION: void charin(char ch, int realmode, int realxpos) * + * GOOD FOR: insert/override one character in the memory * + * INPUTS : - char ch -the char to insert * + * - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int distance=0; + bool toggleswitch; + data *phelp2; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + unsigned long zhelp; + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + pdatas=pmax; + if ((*pdatas).len < 16) + { + (*pdatas).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).line+1; + pdatas=pmax=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).line=zhelp; + if (rbmode == 1) phelp=pmax; + } + while(pdatas!=phelp) + { + for(z=(*pdatas).len-1;z>=0;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + (*pdatas).vals[0]=(*(*pdatas).plast).vals[15]; + pdatas=(*pdatas).plast; + } + + for(z=(*pdatas).len-1;z+1>pos.x;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + pdatas=phelp; + } + // Write value + (*pdatas).vals[pos.x-1]=ch; + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +} + +/*************************************************************************** + * FUNCTION: int charout() * + * GOOD FOR: get the char at the actual cursor-position * + * RESULTS : the char as an integer (char should work too normaly) * + ***************************************************************************/ +int charout() +{ + int i=0; + int distance; + int posxsave; + int ch; + // Move in memory to cursor-position + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the value + ch=((*pdatas).vals[pos.x-1]); + // move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + return(ch); +} + +/*************************************************************************** + * FUNCTION: void bottomout() * + * GOOD FOR: refreshing the output of the bottom-window * + ***************************************************************************/ +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void swapbits() * + * GOOD FOR: toggle the bit [par1] an the actual position * + * INPUTS : - char bit the number (1-8) of the bit to toggle * + ***************************************************************************/ +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // for the Bits + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void delactchar(char ch, int realmode, int realxpos) * + * GOOD FOR: delete the char under the actual cursor-position * + * INPUTS : - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void delactchar(int realmode, int realxpos) +{ + //BUG: after deletion the last char in the last line it gives me a segfault. + int i=0; + int z=0; + int distance=0; + bool endflag=FALSE; + bool toggleswitch; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + for(z=realxpos-1;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + if((*pdatas).pnext) + { + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } + while(pdatas!=pmax) + { + for(z=0;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } +// check here for last char in last element + (*pdatas).len--; + if((*pdatas).len <= 0) + { + if(phelp==pmax) + { + if((*phelp).plast) + { + phelp=(*phelp).plast; + } + } + if(pfirst!=pmax) // is when pfirst!=pmax + { + pdatas=(*pdatas).plast; + free((*pdatas).pnext); + (*pdatas).pnext=NULL; + pmax=pdatas; + // TODO: there is one line less now, when we are at the last screen + // we should decrease i by one (only cosmetic) + endflag=TRUE; + } + else + { + (*pdatas).len=0; + } + } + else + { + if (phelp!=pmax) for(z=0;z<(*pdatas).len;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + } + pdatas=phelp; + } + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + // first delete the screen + for(z=0;z<16;z++) + { + emplineout(z+1); + } + // then do an initial output + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +// The rest is only a dirty workaround for the las (no longer needed) line +// because it was not possible for me to determine out, whether i am really +// at the end. + if (endflag) + { + for(i=0;i<16;i++) + { + if(!scrollu()) endflag=FALSE; + } + if (endflag) + { + if((pos.y < 16) && ((*pmax).line > 15)) pos.y++; + for(i=0;i<16;i++) + { + scrolld(); + } + } + } +} + +int main(int argc, char *argv[]) +{ +//Variables + unsigned int i; // Public counter + int inpch; // The char of input + +//Preperation + printf("T.I.A.H - Tiah Is A Hex-editor. Version 0.5a (C) Joerg Tretter 1999\n"); + //Is there a param? + if(argc < 2) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //open the file + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // set the pointers + initvar(); + // init of other useful varibles + pos.x = pos.y = 1; + filename=argv[1]; + //file -> ram + if(loadcontents()) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // init of terminal + if(screeninit()) + { + endscr(); + fprintf(stderr,"T.I.A.H -MESSAGE; !!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Main-procedure +initout(); +bottomout(); +scrrefresh(); + +//Event-loop + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + // The Keys F1-F8 (bit-setting) + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + //the delete character-key + case KEY_DC : if (mode == 1) + { + delactchar(1,pos.x); + } + else + { + switchmode(); + delactchar(1,pos.x); + switchmode(); + } + break; + + //the insert-key, switch insert mode + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + //Cursor-movement + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + case KEY_END: if((*pmax).line > 15) + { + pdatas=pmax; + for(i=0;((*pdatas).plast) && (i < 16);i++) + { + pdatas=(*pdatas).plast; + } + while((*pdatas).pnext) + { + scrolld(); + } + } + break; + // input characters + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // fill hch correct (old values) + int xpos=pos.x; // save position + switchmode(); // recalc. coordinates + ptv=tonumsysx(charout(),16); // actual char in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // recalc coordinates + pos.x=xpos; // restore coorinates + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // recalc coordinates + charin(xto10(hch,16),0,xpos); // calc Hex -> Ascii+charin + switchmode(); // and back + pos.x=xpos; // restore positions + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + + } + + WINDOW* s=derwin(whex,3,17,7,17); + wattrset(s,COLOR_PAIR(1)); + box(s,0,0); + wattrset(s,COLOR_PAIR(3)); + mvwaddstr(s,1,1,"SAVE FILE (Y/N)"); + wrefresh(s); + int saveit= wgetch(s); + endscr(); + unallocmem(saveit,argv[1]); + + return (fclose(fp)); +} diff --git a/tiah05a/tiah05a.tar.bz2 b/tiah05a/tiah05a.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..f3796b1a7ef104fdf941942c4826a2890b96f655 GIT binary patch literal 15975 zcmV-tKA6EmT4*^jL0KkKS(OXz*#K0W|NsC0|NsC0|NsC0|NsC0|NsBL|Nr;?|KI!n z|Ns5}|L@>QUiryAF4z z;+PiiHhXqc$U4eZK{oP}mO(*4X!PpzU>8}pyLQtAiW=1EP-xO5tqm2Zc2<)r)Y~kZ zoySmxD9qJ114gJTWm+W?iV8raHEJ`oRx%YSsasVx-7SeBO`5@n5xd_4hJ`ek5i)rQ z$*CFYY3eaDdNiXNYI-!AK%S=c6HJ>V$?7(vO)_K}dW_I&1Ju!=+CXS%4Lvf0MnDY) zngB91XaMy900Tj$gwO~eAVDS?O*KcMAEGpyNYlj+QRy0Jc}$0>+Ji>a#Aq1|jRqqi z3?m~W5YPh%Xbm*cp@h>Q3?`WX4FDojLQha>>UtwX)YDBg(0XD=siV~O4Lv50Q_2rW z^%?=Dk3`7w8c$K`dW{~V)byUFOpKajdV|!+^#*_&De4bV>UxZWN2!sfjTp)_$&sc( znvJ7SNu-eiXd^(HDtMWx8x#Sd>ODi$Xgy5_q74Rs&;v#%sL*Mk007Vc0002c0000F zPyl4pKmY*}h)n@0`AsoTAy3sdQ_-Z;dXx1N1U*d}9-tWvO&S^ofB+ga000000000Q z0000q00000&;*Et1OR{$piMM2FpUENG}S$+g*_T+si&#xY3Q5M6A;sCG{nRhnGFNf zdW{-sqeDOdXlT$h0MGycXwWp!15THsLUUZjI{$?3bnaa3yq_os2D$PfLs5~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10 @@ +0.5b: +flush stdout after printng hashmark while loading +Handle errors during create process of the Windows properly + +0.5a: +bugfix, use of proper function strncpy instead of "=" for filling string constants, there was a compile-problem with newer compilers. + +0.5: +first official release + diff --git a/tiah05b/COPYING b/tiah05b/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/tiah05b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/tiah05b/Makefile b/tiah05b/Makefile new file mode 100644 index 0000000..a914fc4 --- /dev/null +++ b/tiah05b/Makefile @@ -0,0 +1,40 @@ +############################################################################ +# # +# T.I.A.H - TIAH IS A HEX-EDITOR # +# Copyright (C) 1999 by Joerg "Maddog" Tretter # +# # +############################################################################ + +PRGFILE = tiah +SRC = tiah.cc +MANFILE = tiah.1.gz + +INSTPATH = /usr/local/bin +MANPATH = /usr/man/man1 +DOCPATH = /usr/doc/tiah + +MAKE = make +CC = c++ +LIBS += -lncurses + +all: + $(MAKE) $(PRGFILE) + + +.cc: + @echo compiling $(SRC) . + @$(CC) $(LIBS) $(SRC) -o$(PRGFILE) + +install: + @install -s -g users -m 755 -o root $(PRGFILE) $(INSTPATH) + @install -d -g root -o root $(MANPATH) + @install -g root -m 644 -o root $(MANFILE) $(MANPATH) + @install -d -g root -o root $(DOCPATH) + @install -g root -m 644 -o root COPYING $(DOCPATH) + @install -g root -m 644 -o root README.PROGRAMMER $(DOCPATH) + @install -g root -m 644 -o root README.INSTALL $(DOCPATH) + @install -g root -m 644 -o root README.BUG $(DOCPATH) + +clean: + @echo removing object $(PRGFILE). + @rm $(PRGFILE) diff --git a/tiah05b/README.BUG b/tiah05b/README.BUG new file mode 100644 index 0000000..9213e9c --- /dev/null +++ b/tiah05b/README.BUG @@ -0,0 +1 @@ +For known bugs see manpage. diff --git a/tiah05b/README.INSTALL b/tiah05b/README.INSTALL new file mode 100644 index 0000000..84f25af --- /dev/null +++ b/tiah05b/README.INSTALL @@ -0,0 +1,24 @@ +TIAH (C) Joerg Tretter + +What do you need: +================= +- linux on a i386+ (other systems perhaps work, too) +- g++ or compatible +- ncurses library (normally installed on every linux-system) + +Steps of installation: +====================== +- edit Makefile if you want an alternative install-dir + (standard is /usr/local/bin) +- make && make install + (you will get some warnings, but that doesn't matter, + if you get an error and can't solve yourself: please report via mail) + +Please send me bug reports and other systems TIAH works on, too. + +If you like the program, please let me know (it's interesting for me to know +how may people are using TIAH.) + +Joerg Tretter +J.Tretter@gmx.de + diff --git a/tiah05b/README.PROGRAMMER b/tiah05b/README.PROGRAMMER new file mode 100644 index 0000000..758668d --- /dev/null +++ b/tiah05b/README.PROGRAMMER @@ -0,0 +1,20 @@ +TIAH (C) Joerg Tretter + +I know, the code absolutely cofusing, but keep in mind: + +This version is only a first prototype of TIAH. + +please send me every bugfix / feature you programmed. + +Plans for next releases +1. search-fuction +2. replace-function +3. fill-function +4. internal calculator (source numbering-system <-> target-numbering system) +5. perhaps various goodies :-)) +6. Changes suggested by others. + +Because I have less time currently I would appreciate all patches. + +Joerg Tretter +J.Tretter@gmx.de diff --git a/tiah05b/THANKSTO b/tiah05b/THANKSTO new file mode 100644 index 0000000..0f95950 --- /dev/null +++ b/tiah05b/THANKSTO @@ -0,0 +1 @@ +Fabrice Haberer (for 64 Bit testing on Alpha) diff --git a/tiah05b/tiah.1.gz b/tiah05b/tiah.1.gz new file mode 100644 index 0000000000000000000000000000000000000000..468aaafed097a6fede3560ad79e6f4da930050be GIT binary patch literal 830 zcmV-E1Ht?siwFpLQ`I*B19WL&Xf81TO;llTn=lal&ab!+la_7)HT$$y)1-8zYo;dY z0@JpS1`e=le8@IQvtPfnp-CbIfqA@p_wL!reFfXnQGo^)b6DKm+(gN}gM77oghiBW zZIom!Y?kXZN;VxhDO$d%K-f~sITTV0bDTqkrR;>7LyNEC^gyK(3b2xnOyJ4>Znn?a zDvOf4iE3$}mI?uqBngoFH2bz&J?E?KCdyk3Fz5|6Msy%82$*Sda71?n^`O)dY7~P* zQ~BCcF*r!qGSuO#iwj|~0;w5OixTG`ohRJO3T?nk-2@SqL8Tfh|6HL$CrN|Q{#%PC zJW&m0D~u?a%(CF;{wy+nQ(02ST$6-Qm+^9smvRPXJZnm#HSMuO?R<+BX=H$x;h4M} zj3qONUNpSiPd61EG~3Okf<)y13m!*F!Rnr;!0z*+y$!1mi}>L)+(J%G!;X9EJLxPe z;?FR<{t|y(Tt!J?qK6yc-z{X^LD@oq?trM_G5r%NEwgW{Rqzcus&M>daUDMSIq<3{ zo~#HjSDWmT&rv{(p2jDN`}8TGg7J8E8AR=`XCq)nny22AwX#s22)IJJ%i}e3jV*-C zZu2y|jh;w^ffn*@$WFZQRgt$>di!`*sMIM6T&nY|7YdUoOjsjUoWOzx2cJF!Hu(>I zC~AWU9d=}nFxxHHAG6=f=d0u-=I+;b*5aRjx9p|wWAd8I; zh6wqq#h~0syYg9aXCK(tjzcu2!B2WYkwX5Lfp*;?vqK0@|xaed7(MXTRWAH3nG zT7Ku0L@!{Fw+uJQ=5iOlZ6)>a3OwvrU)Yc6U7qgN$=Sjq4FNd{=6yOs=ix;w_Q4R; zN|**O+KgM2P3xdI0&7$#tT&1e1!9ajNM`f|VFLb~u{iA%a*n$A!2QwTB>&{9MPWGG z^`Ofzr|}@+ea`39IR(pK`QvsM{U9_A +#include +#include +#include +#include +#include + +struct data // one line in Memory +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long line; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data datas, *pdatas, *pfirst, *phelp, *pmax; + +/*************************************************************************** + * FUNCTION: void initvar() * + * GOOD FOR: Initialization of basic-variables * + ***************************************************************************/ +void initvar() +{ + pfirst=&datas; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).line=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +/*************************************************************************** + * FUNCTION: void miniinit() * + * GOOD FOR: Initialization of frequent used variables * + ***************************************************************************/ +void miniinit() +{ +strncpy(xoffs, " ",9); +strncpy(xhex, " ",51); +strncpy(xascii, " ",17); +} + +/*************************************************************************** + * FUNCTION: int screeninit() * + * GOOD FOR: Initialization of the n-curses-screen * + * RESULTS : 1:There was an error / 0:Everything ok. * + ***************************************************************************/ +int screeninit() +{ + int retval =0; + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Create Curses-space for the windows + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + if (wbot == NULL || woffs == NULL || whex == NULL || wascii == NULL || wtop == NULL) { + endwin(); + fprintf(stderr,"ERROR: T.I.A.H Was not able to create all Program windows. Possibly your terminal dimensions are too small. You need a Screen-Size of at least 80x25 characters!"); + exit(5); + } + +// enable scrolling + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// enable Keyboard-control + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// disable echoing of input + noecho(); + +// swich cursor to big size +// TODO: check why this not works in most cases +// if(curs_set(2)==ERR) retval=1 ; + +// creation of curses "Color-Pairs" + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + +// join the windows with the color-pairs + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + +// paint the boxes around the windows (in fact it's inside) + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + // change the color-pairs of the windows again. + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +/*************************************************************************** + * FUNCTION: char* tonumsysx() * + * GOOD FOR: Shift a number to another numbering system * + * INPUTS : - int base10 -The number in decimal system * + * - int newbase -The new system (16->Hex,2->Bin,...) * + * RESULTS : The number in the new system as a pointer of char * + ***************************************************************************/ +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + strncpy(swap,"********",9); + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +/*************************************************************************** + * FUNCTION: unsigned long xto10(char *c, int oldbase) * + * GOOD FOR: Shift a number from a foreign numbering system to decimal * + * INPUTS : - char* c -The number in foreign system * + * - int oldbase -The old system (16->Hex,2->Bin,...) * + * RESULTS : The number in decimal system as a unsigned long * + ***************************************************************************/ +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +/*************************************************************************** + * FUNCTION: int loadcontents() * + * GOOD FOR: Loading the contents of a file into the memory * + * RESULTS : The status of the loading (not used yet) * + ***************************************************************************/ +int loadcontents() +{ + int retval=0; + int x; + char ch; + unsigned long line=0; + + + pdatas=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"T.I.A.H - Tiah Is A Hex-editor. - opening 0-Byte file"); + pfirst=pmax=pdatas=(data*)(malloc(sizeof(datas))); + (*pdatas).pnext=NULL; + (*pdatas).plast=NULL; + (*pdatas).line=0; + (*pdatas).len=0; + + } + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdatas).vals[x])=ch; + if (feof(fp)) //(*pdatas).vals[x]==EOF) + { + (*pdatas).vals[x]=0; + break; + } + (*pdatas).len=x+1; + ch=fgetc(fp); + } + (*pdatas).line=line++; + if(!(feof(fp))) + { + phelp=pdatas; + if (!(line%500)) {fprintf(stdout,"%c",'#'); fflush(stdout);} + pdatas=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); +// BUG: Check for Memory-Full does not work. + if(!pdatas) {abort();} + (*pdatas).plast=phelp; + (*pdatas).pnext=NULL; + } + pmax=pdatas; + + } + return (retval); +} + +/*************************************************************************** + * FUNCTION: void endscr() * + * GOOD FOR: End the scrren session on curses-level * + ***************************************************************************/ +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +/*************************************************************************** + * FUNCTION: void unallocmem(int save, char* filename) * + * GOOD FOR: Free the memory from the bits & bytes * + * INPUTS : int save: flag (save Y/else key) * + * : cahr* filename: the name of the save-file * + ***************************************************************************/ +void unallocmem(int save, char *filename) +{ + int pos; + save=toupper(save); + if (save=='Y') + { + pdatas=pfirst; + fp=fopen(filename,"w"); + while((*pdatas).pnext) + { + for (pos=0;pos <(*pdatas).len;pos++) + { + fputc((*pdatas).vals[pos],fp); + } + pdatas=(*pdatas).pnext; + } + for (pos=0;pos <(*pdatas).len;pos++) fputc((*pdatas).vals[pos],fp); + fclose(fp); + } + { + pdatas=pmax; + } + while((*pdatas).plast) + { + phelp=(*pdatas).plast; + free(pdatas); + pdatas=phelp; + } +} + +/*************************************************************************** + * FUNCTION: void scrrefresh() * + * GOOD FOR: Refreah the basic-screen-elements (not the contents) * + ***************************************************************************/ +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + // depending on the mode (ascii/hex) set the cursor-position + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // the order is given by the mode (ascii/hex). the last window refreshed + // it the one, in which the cursor appears and the input-focus is. + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +/*************************************************************************** + * FUNCTION: void emplineout(unsigned long line) * + * GOOD FOR: Writing one empty line to the scrren * + ***************************************************************************/ +void emplineout(unsigned long line) +{ + mvwaddstr(woffs,line,1," "); + mvwaddstr(whex,line,1," "); + mvwaddstr(wascii,line,1," "); +} + +/*************************************************************************** + * FUNCTION: void lineout(unsigned long line) * + * GOOD FOR: Writing one line (the actual one) from the memory to screen * + ***************************************************************************/ +void lineout(unsigned long line) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdatas).line*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,line,1,soffs); + for (z=0;z<(*pdatas).len;z++) + { + ptv = tonumsysx((*pdatas).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,line,1,shex); + for (z=0;z<(*pdatas).len;z++) + { +// TODO: There are many other characters that are displayable. + xascii[z] = (isgraph((*pdatas).vals[z]))?((*pdatas).vals[z]):'.'; + } + mvwaddstr(wascii,line,1,sascii); +} + +/*************************************************************************** + * FUNCTION: void initout() * + * GOOD FOR: First output after loading the file // home-Key * + ***************************************************************************/ +void initout() +{ +//Initial output (All) +int i,z; +bool toggleswitch=false; +pdatas=pfirst; + +if ((*pdatas).pnext == NULL) toggleswitch=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + scrrefresh(); + +if(i>15) pdatas=(*pdatas).plast; +} + +/*************************************************************************** + * FUNCTION: int scrolld() * + * GOOD FOR: Scrolling the scrren one line down * + * RESULTS : 1: no more elements // 0: everything was nice * + ***************************************************************************/ +int scrolld() +{ + int resval; + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +/*************************************************************************** + * FUNCTION: int scrollu() * + * GOOD FOR: Scrolling the scrren one line up * + * RESULTS : 1: at first element // 0: everything was nice * + ***************************************************************************/ +int scrollu() +{ + int z=0; + int result; + while(((*pdatas).plast != NULL)&&(z < 16)) + { + pdatas=(*pdatas).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + } + } + return(result); +} + +/*************************************************************************** + * FUNCTION: void switchmode() * + * GOOD FOR: recalculation of cursor-position ascii<->hex * + ***************************************************************************/ +void switchmode() +{ + if(mode==0) + { + mode=1; // mode-toggle:Hex->Ascii + // recalculate cursor-position + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // mode-toggle:ascii->Hex + // recalculate cursor-position + pos.x=((pos.x*3)-1); + } +} + +/*************************************************************************** + * FUNCTION: void moveleft() * + * GOOD FOR: move the cursor one position to the left * + ***************************************************************************/ +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +/*************************************************************************** + * FUNCTION: void moveright() * + * GOOD FOR: move the cursor one position to the right * + ***************************************************************************/ +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +/*************************************************************************** + * FUNCTION: unsigned long getactpos() * + * GOOD FOR: get the acutal cursor-position as a file-offset * + * RESULTS : The file-offset on the cursor-position as unsigned long * + ***************************************************************************/ +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int distance; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the position + actpos=((*pdatas).line*16)+pos.x-1; + // and move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +/*************************************************************************** + * FUNCTION: void charin(char ch, int realmode, int realxpos) * + * GOOD FOR: insert/override one character in the memory * + * INPUTS : - char ch -the char to insert * + * - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int distance=0; + bool toggleswitch; + data *phelp2; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + unsigned long zhelp; + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + pdatas=pmax; + if ((*pdatas).len < 16) + { + (*pdatas).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).line+1; + pdatas=pmax=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).line=zhelp; + if (rbmode == 1) phelp=pmax; + } + while(pdatas!=phelp) + { + for(z=(*pdatas).len-1;z>=0;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + (*pdatas).vals[0]=(*(*pdatas).plast).vals[15]; + pdatas=(*pdatas).plast; + } + + for(z=(*pdatas).len-1;z+1>pos.x;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + pdatas=phelp; + } + // Write value + (*pdatas).vals[pos.x-1]=ch; + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +} + +/*************************************************************************** + * FUNCTION: int charout() * + * GOOD FOR: get the char at the actual cursor-position * + * RESULTS : the char as an integer (char should work too normaly) * + ***************************************************************************/ +int charout() +{ + int i=0; + int distance; + int posxsave; + int ch; + // Move in memory to cursor-position + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the value + ch=((*pdatas).vals[pos.x-1]); + // move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + return(ch); +} + +/*************************************************************************** + * FUNCTION: void bottomout() * + * GOOD FOR: refreshing the output of the bottom-window * + ***************************************************************************/ +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void swapbits() * + * GOOD FOR: toggle the bit [par1] an the actual position * + * INPUTS : - char bit the number (1-8) of the bit to toggle * + ***************************************************************************/ +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // for the Bits + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void delactchar(char ch, int realmode, int realxpos) * + * GOOD FOR: delete the char under the actual cursor-position * + * INPUTS : - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void delactchar(int realmode, int realxpos) +{ + //BUG: after deletion the last char in the last line it gives me a segfault. + int i=0; + int z=0; + int distance=0; + bool endflag=FALSE; + bool toggleswitch; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + for(z=realxpos-1;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + if((*pdatas).pnext) + { + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } + while(pdatas!=pmax) + { + for(z=0;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } +// check here for last char in last element + (*pdatas).len--; + if((*pdatas).len <= 0) + { + if(phelp==pmax) + { + if((*phelp).plast) + { + phelp=(*phelp).plast; + } + } + if(pfirst!=pmax) // is when pfirst!=pmax + { + pdatas=(*pdatas).plast; + free((*pdatas).pnext); + (*pdatas).pnext=NULL; + pmax=pdatas; + // TODO: there is one line less now, when we are at the last screen + // we should decrease i by one (only cosmetic) + endflag=TRUE; + } + else + { + (*pdatas).len=0; + } + } + else + { + if (phelp!=pmax) for(z=0;z<(*pdatas).len;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + } + pdatas=phelp; + } + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + // first delete the screen + for(z=0;z<16;z++) + { + emplineout(z+1); + } + // then do an initial output + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +// The rest is only a dirty workaround for the las (no longer needed) line +// because it was not possible for me to determine out, whether i am really +// at the end. + if (endflag) + { + for(i=0;i<16;i++) + { + if(!scrollu()) endflag=FALSE; + } + if (endflag) + { + if((pos.y < 16) && ((*pmax).line > 15)) pos.y++; + for(i=0;i<16;i++) + { + scrolld(); + } + } + } +} + +int main(int argc, char *argv[]) +{ +//Variables + unsigned int i; // Public counter + int inpch; // The char of input + +//Preperation + printf("T.I.A.H - Tiah Is A Hex-editor. Version 0.5a (C) Joerg Tretter 1999\n"); + //Is there a param? + if(argc < 2) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //open the file + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // set the pointers + initvar(); + // init of other useful varibles + pos.x = pos.y = 1; + filename=argv[1]; + //file -> ram + if(loadcontents()) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // init of terminal + if(screeninit() != 0) + { + endscr(); + fprintf(stderr,"T.I.A.H -MESSAGE; !!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Main-procedure +initout(); +bottomout(); +scrrefresh(); + +//Event-loop + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + // The Keys F1-F8 (bit-setting) + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + //the delete character-key + case KEY_DC : if (mode == 1) + { + delactchar(1,pos.x); + } + else + { + switchmode(); + delactchar(1,pos.x); + switchmode(); + } + break; + + //the insert-key, switch insert mode + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + //Cursor-movement + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + case KEY_END: if((*pmax).line > 15) + { + pdatas=pmax; + for(i=0;((*pdatas).plast) && (i < 16);i++) + { + pdatas=(*pdatas).plast; + } + while((*pdatas).pnext) + { + scrolld(); + } + } + break; + // input characters + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // fill hch correct (old values) + int xpos=pos.x; // save position + switchmode(); // recalc. coordinates + ptv=tonumsysx(charout(),16); // actual char in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // recalc coordinates + pos.x=xpos; // restore coorinates + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // recalc coordinates + charin(xto10(hch,16),0,xpos); // calc Hex -> Ascii+charin + switchmode(); // and back + pos.x=xpos; // restore positions + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + + } + + WINDOW* s=derwin(whex,3,17,7,17); + wattrset(s,COLOR_PAIR(1)); + box(s,0,0); + wattrset(s,COLOR_PAIR(3)); + mvwaddstr(s,1,1,"SAVE FILE (Y/N)"); + wrefresh(s); + int saveit= wgetch(s); + endscr(); + unallocmem(saveit,argv[1]); + + return (fclose(fp)); +} diff --git a/tiah05c/CHANGES b/tiah05c/CHANGES new file mode 100644 index 0000000..baef432 --- /dev/null +++ b/tiah05c/CHANGES @@ -0,0 +1,10 @@ +0.5b: +flush stdout after printng hashmark while loading +Handle errors during create process of the Windows properly + +0.5a: +bugfix, use of proper function strncpy instead of "=" for filling string constants, there was a compile-problem with newer compilers. + +0.5: +first official release + diff --git a/tiah05c/COPYING b/tiah05c/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/tiah05c/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/tiah05c/Makefile b/tiah05c/Makefile new file mode 100644 index 0000000..a914fc4 --- /dev/null +++ b/tiah05c/Makefile @@ -0,0 +1,40 @@ +############################################################################ +# # +# T.I.A.H - TIAH IS A HEX-EDITOR # +# Copyright (C) 1999 by Joerg "Maddog" Tretter # +# # +############################################################################ + +PRGFILE = tiah +SRC = tiah.cc +MANFILE = tiah.1.gz + +INSTPATH = /usr/local/bin +MANPATH = /usr/man/man1 +DOCPATH = /usr/doc/tiah + +MAKE = make +CC = c++ +LIBS += -lncurses + +all: + $(MAKE) $(PRGFILE) + + +.cc: + @echo compiling $(SRC) . + @$(CC) $(LIBS) $(SRC) -o$(PRGFILE) + +install: + @install -s -g users -m 755 -o root $(PRGFILE) $(INSTPATH) + @install -d -g root -o root $(MANPATH) + @install -g root -m 644 -o root $(MANFILE) $(MANPATH) + @install -d -g root -o root $(DOCPATH) + @install -g root -m 644 -o root COPYING $(DOCPATH) + @install -g root -m 644 -o root README.PROGRAMMER $(DOCPATH) + @install -g root -m 644 -o root README.INSTALL $(DOCPATH) + @install -g root -m 644 -o root README.BUG $(DOCPATH) + +clean: + @echo removing object $(PRGFILE). + @rm $(PRGFILE) diff --git a/tiah05c/README.BUG b/tiah05c/README.BUG new file mode 100644 index 0000000..9213e9c --- /dev/null +++ b/tiah05c/README.BUG @@ -0,0 +1 @@ +For known bugs see manpage. diff --git a/tiah05c/README.INSTALL b/tiah05c/README.INSTALL new file mode 100644 index 0000000..84f25af --- /dev/null +++ b/tiah05c/README.INSTALL @@ -0,0 +1,24 @@ +TIAH (C) Joerg Tretter + +What do you need: +================= +- linux on a i386+ (other systems perhaps work, too) +- g++ or compatible +- ncurses library (normally installed on every linux-system) + +Steps of installation: +====================== +- edit Makefile if you want an alternative install-dir + (standard is /usr/local/bin) +- make && make install + (you will get some warnings, but that doesn't matter, + if you get an error and can't solve yourself: please report via mail) + +Please send me bug reports and other systems TIAH works on, too. + +If you like the program, please let me know (it's interesting for me to know +how may people are using TIAH.) + +Joerg Tretter +J.Tretter@gmx.de + diff --git a/tiah05c/README.PROGRAMMER b/tiah05c/README.PROGRAMMER new file mode 100644 index 0000000..758668d --- /dev/null +++ b/tiah05c/README.PROGRAMMER @@ -0,0 +1,20 @@ +TIAH (C) Joerg Tretter + +I know, the code absolutely cofusing, but keep in mind: + +This version is only a first prototype of TIAH. + +please send me every bugfix / feature you programmed. + +Plans for next releases +1. search-fuction +2. replace-function +3. fill-function +4. internal calculator (source numbering-system <-> target-numbering system) +5. perhaps various goodies :-)) +6. Changes suggested by others. + +Because I have less time currently I would appreciate all patches. + +Joerg Tretter +J.Tretter@gmx.de diff --git a/tiah05c/THANKSTO b/tiah05c/THANKSTO new file mode 100644 index 0000000..0f95950 --- /dev/null +++ b/tiah05c/THANKSTO @@ -0,0 +1 @@ +Fabrice Haberer (for 64 Bit testing on Alpha) diff --git a/tiah05c/tiah.1.gz b/tiah05c/tiah.1.gz new file mode 100644 index 0000000000000000000000000000000000000000..468aaafed097a6fede3560ad79e6f4da930050be GIT binary patch literal 830 zcmV-E1Ht?siwFpLQ`I*B19WL&Xf81TO;llTn=lal&ab!+la_7)HT$$y)1-8zYo;dY z0@JpS1`e=le8@IQvtPfnp-CbIfqA@p_wL!reFfXnQGo^)b6DKm+(gN}gM77oghiBW zZIom!Y?kXZN;VxhDO$d%K-f~sITTV0bDTqkrR;>7LyNEC^gyK(3b2xnOyJ4>Znn?a zDvOf4iE3$}mI?uqBngoFH2bz&J?E?KCdyk3Fz5|6Msy%82$*Sda71?n^`O)dY7~P* zQ~BCcF*r!qGSuO#iwj|~0;w5OixTG`ohRJO3T?nk-2@SqL8Tfh|6HL$CrN|Q{#%PC zJW&m0D~u?a%(CF;{wy+nQ(02ST$6-Qm+^9smvRPXJZnm#HSMuO?R<+BX=H$x;h4M} zj3qONUNpSiPd61EG~3Okf<)y13m!*F!Rnr;!0z*+y$!1mi}>L)+(J%G!;X9EJLxPe z;?FR<{t|y(Tt!J?qK6yc-z{X^LD@oq?trM_G5r%NEwgW{Rqzcus&M>daUDMSIq<3{ zo~#HjSDWmT&rv{(p2jDN`}8TGg7J8E8AR=`XCq)nny22AwX#s22)IJJ%i}e3jV*-C zZu2y|jh;w^ffn*@$WFZQRgt$>di!`*sMIM6T&nY|7YdUoOjsjUoWOzx2cJF!Hu(>I zC~AWU9d=}nFxxHHAG6=f=d0u-=I+;b*5aRjx9p|wWAd8I; zh6wqq#h~0syYg9aXCK(tjzcu2!B2WYkwX5Lfp*;?vqK0@|xaed7(MXTRWAH3nG zT7Ku0L@!{Fw+uJQ=5iOlZ6)>a3OwvrU)Yc6U7qgN$=Sjq4FNd{=6yOs=ix;w_Q4R; zN|**O+KgM2P3xdI0&7$#tT&1e1!9ajNM`f|VFLb~u{iA%a*n$A!2QwTB>&{9MPWGG z^`Ofzr|}@+ea`39IR(pK`QvsM{U9_A +#include +#include +#include +#include +#include + +struct data // one line in Memory +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long line; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data datas, *pdatas, *pfirst, *phelp, *pmax; + +/*************************************************************************** + * FUNCTION: void initvar() * + * GOOD FOR: Initialization of basic-variables * + ***************************************************************************/ +void initvar() +{ + pfirst=&datas; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).line=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +/*************************************************************************** + * FUNCTION: void miniinit() * + * GOOD FOR: Initialization of frequent used variables * + ***************************************************************************/ +void miniinit() +{ +strncpy(xoffs, " ",9); +strncpy(xhex, " ",51); +strncpy(xascii, " ",17); +} + +/*************************************************************************** + * FUNCTION: int screeninit() * + * GOOD FOR: Initialization of the n-curses-screen * + * RESULTS : 1:There was an error / 0:Everything ok. * + ***************************************************************************/ +int screeninit() +{ + int retval =0; + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Create Curses-space for the windows + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + if (wbot == NULL || woffs == NULL || whex == NULL || wascii == NULL || wtop == NULL) { + endwin(); + fprintf(stderr,"ERROR: T.I.A.H Was not able to create all Program windows. Possibly your terminal dimensions are too small. You need a Screen-Size of at least 80x25 characters!"); + exit(5); + } + +// enable scrolling + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// enable Keyboard-control + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// disable echoing of input + noecho(); + +// swich cursor to big size +// TODO: check why this not works in most cases +// if(curs_set(2)==ERR) retval=1 ; + +// creation of curses "Color-Pairs" + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + +// join the windows with the color-pairs + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + +// paint the boxes around the windows (in fact it's inside) + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + // change the color-pairs of the windows again. + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +/*************************************************************************** + * FUNCTION: char* tonumsysx() * + * GOOD FOR: Shift a number to another numbering system * + * INPUTS : - int base10 -The number in decimal system * + * - int newbase -The new system (16->Hex,2->Bin,...) * + * RESULTS : The number in the new system as a pointer of char * + ***************************************************************************/ +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + strncpy(swap,"********",9); + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +/*************************************************************************** + * FUNCTION: unsigned long xto10(char *c, int oldbase) * + * GOOD FOR: Shift a number from a foreign numbering system to decimal * + * INPUTS : - char* c -The number in foreign system * + * - int oldbase -The old system (16->Hex,2->Bin,...) * + * RESULTS : The number in decimal system as a unsigned long * + ***************************************************************************/ +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +/*************************************************************************** + * FUNCTION: int loadcontents() * + * GOOD FOR: Loading the contents of a file into the memory * + * RESULTS : The status of the loading (not used yet) * + ***************************************************************************/ +int loadcontents() +{ + int retval=0; + int x; + char ch; + unsigned long line=0; + + + pdatas=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"T.I.A.H - Tiah Is A Hex-editor. - opening 0-Byte file"); + pfirst=pmax=pdatas=(data*)(malloc(sizeof(datas))); + (*pdatas).pnext=NULL; + (*pdatas).plast=NULL; + (*pdatas).line=0; + (*pdatas).len=0; + + } + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdatas).vals[x])=ch; + if (feof(fp)) //(*pdatas).vals[x]==EOF) + { + (*pdatas).vals[x]=0; + break; + } + (*pdatas).len=x+1; + ch=fgetc(fp); + } + (*pdatas).line=line++; + if(!(feof(fp))) + { + phelp=pdatas; + if (!(line%500)) {fprintf(stdout,"%c",'#'); fflush(stdout);} + pdatas=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); +// BUG: Check for Memory-Full does not work. + if(!pdatas) {abort();} + (*pdatas).plast=phelp; + (*pdatas).pnext=NULL; + } + pmax=pdatas; + + } + return (retval); +} + +/*************************************************************************** + * FUNCTION: void endscr() * + * GOOD FOR: End the scrren session on curses-level * + ***************************************************************************/ +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +/*************************************************************************** + * FUNCTION: void unallocmem(int save, char* filename) * + * GOOD FOR: Free the memory from the bits & bytes * + * INPUTS : int save: flag (save Y/else key) * + * : cahr* filename: the name of the save-file * + ***************************************************************************/ +void unallocmem(int save, char *filename) +{ + int pos; + save=toupper(save); + if (save=='Y') + { + pdatas=pfirst; + fp=fopen(filename,"w"); + while((*pdatas).pnext) + { + for (pos=0;pos <(*pdatas).len;pos++) + { + fputc((*pdatas).vals[pos],fp); + } + pdatas=(*pdatas).pnext; + } + for (pos=0;pos <(*pdatas).len;pos++) fputc((*pdatas).vals[pos],fp); + fclose(fp); + } + { + pdatas=pmax; + } + while((*pdatas).plast) + { + phelp=(*pdatas).plast; + free(pdatas); + pdatas=phelp; + } +} + +/*************************************************************************** + * FUNCTION: void scrrefresh() * + * GOOD FOR: Refreah the basic-screen-elements (not the contents) * + ***************************************************************************/ +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + // depending on the mode (ascii/hex) set the cursor-position + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // the order is given by the mode (ascii/hex). the last window refreshed + // it the one, in which the cursor appears and the input-focus is. + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +/*************************************************************************** + * FUNCTION: void emplineout(unsigned long line) * + * GOOD FOR: Writing one empty line to the scrren * + ***************************************************************************/ +void emplineout(unsigned long line) +{ + mvwaddstr(woffs,line,1," "); + mvwaddstr(whex,line,1," "); + mvwaddstr(wascii,line,1," "); +} + +/*************************************************************************** + * FUNCTION: void lineout(unsigned long line) * + * GOOD FOR: Writing one line (the actual one) from the memory to screen * + ***************************************************************************/ +void lineout(unsigned long line) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdatas).line*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,line,1,soffs); + for (z=0;z<(*pdatas).len;z++) + { + ptv = tonumsysx((*pdatas).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,line,1,shex); + for (z=0;z<(*pdatas).len;z++) + { +// TODO: There are many other characters that are displayable. + xascii[z] = (isgraph((*pdatas).vals[z]))?((*pdatas).vals[z]):'.'; + } + mvwaddstr(wascii,line,1,sascii); +} + +/*************************************************************************** + * FUNCTION: void initout() * + * GOOD FOR: First output after loading the file // home-Key * + ***************************************************************************/ +void initout() +{ +//Initial output (All) +int i,z; +bool toggleswitch=false; +pdatas=pfirst; + +if ((*pdatas).pnext == NULL) toggleswitch=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + scrrefresh(); + +if(i>15) pdatas=(*pdatas).plast; +} + +/*************************************************************************** + * FUNCTION: int scrolld() * + * GOOD FOR: Scrolling the scrren one line down * + * RESULTS : 1: no more elements // 0: everything was nice * + ***************************************************************************/ +int scrolld() +{ + int resval; + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +/*************************************************************************** + * FUNCTION: int scrollu() * + * GOOD FOR: Scrolling the scrren one line up * + * RESULTS : 1: at first element // 0: everything was nice * + ***************************************************************************/ +int scrollu() +{ + int z=0; + int result; + while(((*pdatas).plast != NULL)&&(z < 16)) + { + pdatas=(*pdatas).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + } + } + return(result); +} + +/*************************************************************************** + * FUNCTION: void switchmode() * + * GOOD FOR: recalculation of cursor-position ascii<->hex * + ***************************************************************************/ +void switchmode() +{ + if(mode==0) + { + mode=1; // mode-toggle:Hex->Ascii + // recalculate cursor-position + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // mode-toggle:ascii->Hex + // recalculate cursor-position + pos.x=((pos.x*3)-1); + } +} + +/*************************************************************************** + * FUNCTION: void moveleft() * + * GOOD FOR: move the cursor one position to the left * + ***************************************************************************/ +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +/*************************************************************************** + * FUNCTION: void moveright() * + * GOOD FOR: move the cursor one position to the right * + ***************************************************************************/ +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +/*************************************************************************** + * FUNCTION: unsigned long getactpos() * + * GOOD FOR: get the acutal cursor-position as a file-offset * + * RESULTS : The file-offset on the cursor-position as unsigned long * + ***************************************************************************/ +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int distance; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the position + actpos=((*pdatas).line*16)+pos.x-1; + // and move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +/*************************************************************************** + * FUNCTION: void charin(char ch, int realmode, int realxpos) * + * GOOD FOR: insert/override one character in the memory * + * INPUTS : - char ch -the char to insert * + * - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int distance=0; + bool toggleswitch; + data *phelp2; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + unsigned long zhelp; + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + pdatas=pmax; + if ((*pdatas).len < 16) + { + (*pdatas).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).line+1; + pdatas=pmax=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).line=zhelp; + if (rbmode == 1) phelp=pmax; + } + while(pdatas!=phelp) + { + for(z=(*pdatas).len-1;z>=0;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + (*pdatas).vals[0]=(*(*pdatas).plast).vals[15]; + pdatas=(*pdatas).plast; + } + + for(z=(*pdatas).len-1;z+1>pos.x;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + pdatas=phelp; + } + // Write value + (*pdatas).vals[pos.x-1]=ch; + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +} + +/*************************************************************************** + * FUNCTION: int charout() * + * GOOD FOR: get the char at the actual cursor-position * + * RESULTS : the char as an integer (char should work too normaly) * + ***************************************************************************/ +int charout() +{ + int i=0; + int distance; + int posxsave; + int ch; + // Move in memory to cursor-position + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the value + ch=((*pdatas).vals[pos.x-1]); + // move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + return(ch); +} + +/*************************************************************************** + * FUNCTION: void bottomout() * + * GOOD FOR: refreshing the output of the bottom-window * + ***************************************************************************/ +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void swapbits() * + * GOOD FOR: toggle the bit [par1] an the actual position * + * INPUTS : - char bit the number (1-8) of the bit to toggle * + ***************************************************************************/ +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // for the Bits + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void delactchar(char ch, int realmode, int realxpos) * + * GOOD FOR: delete the char under the actual cursor-position * + * INPUTS : - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void delactchar(int realmode, int realxpos) +{ + //BUG: after deletion the last char in the last line it gives me a segfault. + int i=0; + int z=0; + int distance=0; + bool endflag=FALSE; + bool toggleswitch; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + for(z=realxpos-1;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + if((*pdatas).pnext) + { + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } + while(pdatas!=pmax) + { + for(z=0;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } +// check here for last char in last element + (*pdatas).len--; + if((*pdatas).len <= 0) + { + if(phelp==pmax) + { + if((*phelp).plast) + { + phelp=(*phelp).plast; + } + } + if(pfirst!=pmax) // is when pfirst!=pmax + { + pdatas=(*pdatas).plast; + free((*pdatas).pnext); + (*pdatas).pnext=NULL; + pmax=pdatas; + // TODO: there is one line less now, when we are at the last screen + // we should decrease i by one (only cosmetic) + endflag=TRUE; + } + else + { + (*pdatas).len=0; + } + } + else + { + if (phelp!=pmax) for(z=0;z<(*pdatas).len;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + } + pdatas=phelp; + } + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + // first delete the screen + for(z=0;z<16;z++) + { + emplineout(z+1); + } + // then do an initial output + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +// The rest is only a dirty workaround for the las (no longer needed) line +// because it was not possible for me to determine out, whether i am really +// at the end. + if (endflag) + { + for(i=0;i<16;i++) + { + if(!scrollu()) endflag=FALSE; + } + if (endflag) + { + if((pos.y < 16) && ((*pmax).line > 15)) pos.y++; + for(i=0;i<16;i++) + { + scrolld(); + } + } + } +} + +int main(int argc, char *argv[]) +{ +//Variables + unsigned int i; // Public counter + int inpch; // The char of input + +//Preperation + printf("T.I.A.H - Tiah Is A Hex-editor. Version 0.5a (C) Joerg Tretter 1999\n"); + //Is there a param? + if(argc < 2) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //open the file + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // set the pointers + initvar(); + // init of other useful varibles + pos.x = pos.y = 1; + filename=argv[1]; + //file -> ram + if(loadcontents()) + { + fprintf(stderr,"T.I.A.H -MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // init of terminal + if(screeninit() != 0) + { + endscr(); + fprintf(stderr,"T.I.A.H -MESSAGE; !!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Main-procedure +initout(); +bottomout(); +scrrefresh(); + +//Event-loop + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + // The Keys F1-F8 (bit-setting) + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + //the delete character-key + case KEY_DC : if (mode == 1) + { + delactchar(1,pos.x); + } + else + { + switchmode(); + delactchar(1,pos.x); + switchmode(); + } + break; + + //the insert-key, switch insert mode + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + //Cursor-movement + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + case KEY_END: if((*pmax).line > 15) + { + pdatas=pmax; + for(i=0;((*pdatas).plast) && (i < 16);i++) + { + pdatas=(*pdatas).plast; + } + while((*pdatas).pnext) + { + scrolld(); + } + } + break; + // input characters + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // fill hch correct (old values) + int xpos=pos.x; // save position + switchmode(); // recalc. coordinates + ptv=tonumsysx(charout(),16); // actual char in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // recalc coordinates + pos.x=xpos; // restore coorinates + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // recalc coordinates + charin(xto10(hch,16),0,xpos); // calc Hex -> Ascii+charin + switchmode(); // and back + pos.x=xpos; // restore positions + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + + } + + WINDOW* s=derwin(whex,3,17,7,17); + wattrset(s,COLOR_PAIR(1)); + box(s,0,0); + wattrset(s,COLOR_PAIR(3)); + mvwaddstr(s,1,1,"SAVE FILE (Y/N)"); + wrefresh(s); + int saveit= wgetch(s); + endscr(); + unallocmem(saveit,argv[1]); + + return (fclose(fp)); +} diff --git a/tiah05c/tiah05b.tar b/tiah05c/tiah05b.tar new file mode 100644 index 0000000000000000000000000000000000000000..cb7e9ba898f489399d6d10a3bb70e6e1896aa119 GIT binary patch literal 61440 zcmeHw4RoYgSthc=GM}*cgSxsRcQQYzN>?SR{B?J_tB2~Ox>GahBqZq>nwj3AQuQUN znMzftpH9*}ts=M_9Y7aYbk#-VETZ5ZMb@7q;NtFa74c_RSrM642RNb#h=Q&h1owH~ z_ulU>m2_vOgW&0c=~R8+ci;Qo_rCx4z4zY?6y1QmN8FRt#@0k zo#fr{_qFbaPku#x8y*~Ane;HY_PS|zs?Bc4lvg``%WSr4jZS0Dte4yC8|Bu+W^27x z_f5T7uGSiB-b}es#ZSN0YPQ;@+Qrjrrqc4u9Uo1b6~Em!%~jJ`_sxB^Mzy)s=H*Sl zRp0SEbXuM?-b#0EwYHrx-L}tX^}bo{HY%N3vjKEkjmqYZsWsXizg*=befd7K+H9HC zTD{H=@rd->#3SWKr=4MkE#GXF+oo(P&5cdqoCV;Oy1!wzYMph{@V78Jd#lwR6l{RZ zYOU4oppVsBrB<$+mS6YFZQt|0qGt2p$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2!Ovdo zQJk9=&B?4pBG~A`yH+*0a2gF%>LoH|L=;VKFx#Ltlr;@%?9O{pqfVXfT@9~~^%}nQ zWx@=BR($oqxA(kXLujqy@6~h2hvHANrXw&)@QMwTzofeMrHf0>oM&*+2O8QEm;riM= z(d_YwO?57VLG2+*yZB;cI0N1cM!ky%6hTr+H}r9j?C>PYctt7nG#&|eH5{7EF?W<- zlSxR_U~w6plTY#T5poUW1#kokghZlT?&?0GO%BMj+_|LHfgzT`H*|IlPIYRcx6DWV zLiHg6(DsXHds4WU+V3%x1Nb_$0vZG}=QJ*dF(kWpiwDW;PC-jxol))I%NWKH^(3ilR`yihWAVQ4O`rAIC&0)AzhOHa0~ z;eZR9+mP!)x`zqR;2d09pjt;$d`zWbaPH*f@K{k?zUn33jC}LwO$ywkz)cF=q`*xI J{PU&2{|61=ZsY&} literal 0 HcmV?d00001 diff --git a/tiahv1.cc b/tiahv1.cc new file mode 100644 index 0000000..93c5873 --- /dev/null +++ b/tiahv1.cc @@ -0,0 +1,224 @@ +#include +#include + +struct data +{ +struct data* plast; +struct data* pnext; +char vals[16][16]; +}; + +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII"; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +int result; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten,*pfirst; + +void initvar() +{ + pfirst=&daten; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tohex(int base10) +{ + int newbase=16; + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +int loadcontents() +{ + int retval=0; + int x,y; + for(x=0;x<16;x++) + for(y=0;y<16;y++) + { + daten.vals[y][x]=fgetc(fp); + if (daten.vals[y][x]==EOF) daten.vals[y][x]=0; + } + for(x=0;x<16;x++) + for(y=0;y<16;y++) + printf("%c",daten.vals[y][x]); + + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +int main(int argc, char *argv[]) +{ +//Variablen + unsigned int i,z; + + printf("%s\n",tohex(0)); + printf("%s\n",tohex(10)); + printf("%s\n",tohex(20)); + printf("%s\n",tohex(30)); + printf("%s\n",tohex(40)); + printf("%s\n",tohex(50)); + +//Vorbereitung + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"THX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // pointer setzen + initvar(); + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + mvwaddstr(wbot,1,1,argv[1]); + + +//Hauptprogramm + + for (i=1;i<17;i++) + { + ptv = tohex(i-1); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,i,1,soffs); + for (z=0;z<16;z++) + { + ptv = tohex(daten.vals[z][i-1]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,i,1,shex); + for (z=0;z<16;z++) + { + xascii[z] = ((daten.vals[z][i-1]) > 33)?(daten.vals[z][i-1]):254; + } + mvwaddstr(wascii,i,1,sascii); + } + + wrefresh(woffs); + wrefresh(whex); + wrefresh(wascii); + wrefresh(wtop); + wrefresh(wbot); + + + sleep(1); + endscr(); + return (fclose(fp)); +} diff --git a/tiahv10.cc b/tiahv10.cc new file mode 100644 index 0000000..7cda18e --- /dev/null +++ b/tiahv10.cc @@ -0,0 +1,1226 @@ +/* + * GHEX -- an advanced HEX-Editor + * Copyright (C) 1999 by Joerg Tretter + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +struct data // one line in Memory +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long line; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data datas, *pdatas, *pfirst, *phelp, *pmax; + +/*************************************************************************** + * FUNCTION: void initvar() * + * GOOD FOR: Initialization of basic-variables * + ***************************************************************************/ +void initvar() +{ + pfirst=&datas; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).line=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +/*************************************************************************** + * FUNCTION: void miniinit() * + * GOOD FOR: Initialization of frequent used variables * + ***************************************************************************/ +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +/*************************************************************************** + * FUNCTION: int screeninit() * + * GOOD FOR: Initialization of the n-curses-screen * + * RESULTS : 1:There was an error / 2:Everything ok. * + ***************************************************************************/ +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Create Curses-space for the windows +//TODO: check whether creation was fine. + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// enable scrolling + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// enable Keyboard-control + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// disable echoing of input + noecho(); + +// swich cursor to big size +// TODO: check why this not works in most cases +// if(curs_set(2)==ERR) retval=1 ; + +// creation of curses "Color-Pairs" + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + +// join the windows with the color-pairs + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + +// paint the boxes around the windows (in fact it's inside) + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + // change the color-pairs of the windows again. + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +/*************************************************************************** + * FUNCTION: char* tonumsysx() * + * GOOD FOR: Shift a number to another numbering system * + * INPUTS : - int base10 -The number in decimal system * + * - int newbase -The new system (16->Hex,2->Bin,...) * + * RESULTS : The number in the new system as a pointer of char * + ***************************************************************************/ +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +/*************************************************************************** + * FUNCTION: unsigned long xto10(char *c, int oldbase) * + * GOOD FOR: Shift a number from a foreign numbering system to decimal * + * INPUTS : - char* c -The number in foreign system * + * - int oldbase -The old system (16->Hex,2->Bin,...) * + * RESULTS : The number in decimal system as a unsigned long * + ***************************************************************************/ +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +/*************************************************************************** + * FUNCTION: int loadcontents() * + * GOOD FOR: Loading the contents of a file into the memory * + * RESULTS : The status of the loading (not used yet) * + ***************************************************************************/ +int loadcontents() +{ + int retval=0; + int x; + char ch; + unsigned long line=0; + + + pdatas=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"opening 0-Byte file"); + pfirst=pmax=pdatas=(data*)(malloc(sizeof(datas))); + (*pdatas).pnext=NULL; + (*pdatas).plast=NULL; + (*pdatas).line=0; + (*pdatas).len=0; + + } + // TODO: how to flush the buffer of stdout??? + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdatas).vals[x])=ch; + if (feof(fp)) //(*pdatas).vals[x]==EOF) + { + (*pdatas).vals[x]=0; + break; + } + (*pdatas).len=x+1; + ch=fgetc(fp); + } + (*pdatas).line=line++; + if(!(feof(fp))) + { + phelp=pdatas; + if (!(line%500)) {printf("%c",'#');} + pdatas=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); +// BUG: Check for Memory-Full does not work. + if(!pdatas) {abort();} + (*pdatas).plast=phelp; + (*pdatas).pnext=NULL; + } + pmax=pdatas; + + } + return (retval); +} + +/*************************************************************************** + * FUNCTION: void endscr() * + * GOOD FOR: End the scrren session on curses-level * + ***************************************************************************/ +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +/*************************************************************************** + * FUNCTION: void unallocmem() * + * GOOD FOR: Free the memory from the bits & bytes * + ***************************************************************************/ +void unallocmem() +{ +pdatas=pmax; +while((*pdatas).plast) +{ +phelp=(*pdatas).plast; +free(pdatas); +pdatas=phelp; +} +} + +/*************************************************************************** + * FUNCTION: void scrrefresh() * + * GOOD FOR: Refreah the basic-screen-elements (not the contents) * + ***************************************************************************/ +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + // depending on the mode (ascii/hex) set the cursor-position + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // the order is given by the mode (ascii/hex). the last window refreshed + // it the one, in which the cursor appears and the input-focus is. + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +/*************************************************************************** + * FUNCTION: void emplineout(unsigned long line) * + * GOOD FOR: Writing one empty line to the scrren * + ***************************************************************************/ +void emplineout(unsigned long line) +{ + mvwaddstr(woffs,line,1," "); + mvwaddstr(whex,line,1," "); + mvwaddstr(wascii,line,1," "); +} + +/*************************************************************************** + * FUNCTION: void lineout(unsigned long line) * + * GOOD FOR: Writing one line (the actual one) from the memory to screen * + ***************************************************************************/ +void lineout(unsigned long line) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdatas).line*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,line,1,soffs); + for (z=0;z<(*pdatas).len;z++) + { + ptv = tonumsysx((*pdatas).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,line,1,shex); + for (z=0;z<(*pdatas).len;z++) + { +// TODO: There are many other characters that are displayable. + xascii[z] = (isgraph((*pdatas).vals[z]))?((*pdatas).vals[z]):'.'; + } + mvwaddstr(wascii,line,1,sascii); +} + +/*************************************************************************** + * FUNCTION: void initout() * + * GOOD FOR: First output after loading the file // home-Key * + ***************************************************************************/ +void initout() +{ +//Initial output (All) +int i,z; +bool toggleswitch=false; +pdatas=pfirst; + +if ((*pdatas).pnext == NULL) toggleswitch=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + scrrefresh(); + +if(i>15) pdatas=(*pdatas).plast; +} + +/*************************************************************************** + * FUNCTION: int scrolld() * + * GOOD FOR: Scrolling the scrren one line down * + * RESULTS : 1: no more elements // 0: everything was nice * + ***************************************************************************/ +int scrolld() +{ + int resval; + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +/*************************************************************************** + * FUNCTION: int scrollu() * + * GOOD FOR: Scrolling the scrren one line up * + * RESULTS : 1: at first element // 0: everything was nice * + ***************************************************************************/ +int scrollu() +{ + int z=0; + int result; + while(((*pdatas).plast != NULL)&&(z < 16)) + { + pdatas=(*pdatas).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + } + } + return(result); +} + +/*************************************************************************** + * FUNCTION: void switchmode() * + * GOOD FOR: recalculation of cursor-position ascii<->hex * + ***************************************************************************/ +void switchmode() +{ + if(mode==0) + { + mode=1; // mode-toggle:Hex->Ascii + // recalculate cursor-position + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // mode-toggle:ascii->Hex + // recalculate cursor-position + pos.x=((pos.x*3)-1); + } +} + +/*************************************************************************** + * FUNCTION: void moveleft() * + * GOOD FOR: move the cursor one position to the left * + ***************************************************************************/ +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +/*************************************************************************** + * FUNCTION: void moveright() * + * GOOD FOR: move the cursor one position to the right * + ***************************************************************************/ +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +/*************************************************************************** + * FUNCTION: unsigned long getactpos() * + * GOOD FOR: get the acutal cursor-position as a file-offset * + * RESULTS : The file-offset on the cursor-position as unsigned long * + ***************************************************************************/ +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int distance; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the position + actpos=((*pdatas).line*16)+pos.x-1; + // and move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +/*************************************************************************** + * FUNCTION: void charin(char ch, int realmode, int realxpos) * + * GOOD FOR: insert/override one character in the memory * + * INPUTS : - char ch -the char to insert * + * - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int distance=0; + bool toggleswitch; + data *phelp2; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + unsigned long zhelp; + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + pdatas=pmax; + if ((*pdatas).len < 16) + { + (*pdatas).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).line+1; + pdatas=pmax=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).line=zhelp; + } + while(pdatas!=phelp) + { + for(z=(*pdatas).len-1;z>=0;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + (*pdatas).vals[0]=(*(*pdatas).plast).vals[15]; + pdatas=(*pdatas).plast; + } + + for(z=(*pdatas).len-1;z+1>pos.x;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + pdatas=phelp; + } + // Write value + (*pdatas).vals[pos.x-1]=ch; + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + pdatas=pfirst; + if ((*pdatas).pnext == NULL) toggleswitch=true; + for(z=0;z<16;z++) + { + lineout(z+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +} + +/*************************************************************************** + * FUNCTION: int charout() * + * GOOD FOR: get the char at the actual cursor-position * + * RESULTS : the char as an integer (char should work too normaly) * + ***************************************************************************/ +int charout() +{ + int i=0; + int distance; + int posxsave; + int ch; + // Move in memory to cursor-position + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the value + ch=((*pdatas).vals[pos.x-1]); + // move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + return(ch); +} + +/*************************************************************************** + * FUNCTION: void bottomout() * + * GOOD FOR: refreshing the output of the bottom-window * + ***************************************************************************/ +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void swapbits() * + * GOOD FOR: toggle the bit [par1] an the actual position * + * INPUTS : - char bit the number (1-8) of the bit to toggle * + ***************************************************************************/ +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // for the Bits + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void delactchar(char ch, int realmode, int realxpos) * + * GOOD FOR: delete the char under the actual cursor-position * + * INPUTS : - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void delactchar(int realmode, int realxpos) +{ + //BUG: after deletion the last char in the last line it gives me a segfault. + int i=0; + int z=0; + int distance=0; + bool endflag=FALSE; + bool toggleswitch; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + for(z=realxpos-1;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + if((*pdatas).pnext) + { + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } + while(pdatas!=pmax) + { + for(z=0;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } +// check here for last char in last element + (*pdatas).len--; + if((*pdatas).len <= 0) + { + if(phelp==pmax) + { + if((*phelp).plast) + { + phelp=(*phelp).plast; + } + } + if(pfirst!=pmax) // is when pfirst!=pmax + { + pdatas=(*pdatas).plast; + free((*pdatas).pnext); + (*pdatas).pnext=NULL; + pmax=pdatas; + // TODO: there is one line less now, when we are at the last screen + // we should decrease i by one (only cosmetic) + endflag=TRUE; + } + else + { + (*pdatas).len=0; + } + } + else + { + if (phelp!=pmax) for(z=0;z<(*pdatas).len;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + } + pdatas=phelp; + } + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + // first delete the screen + for(z=0;z<16;z++) + { + emplineout(z+1); + } + // then do an initial output + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +// The rest is only a dirty workaround for the las (no longer needed) line +// because it was not possible for me to determine out, whether i am really +// at the end. + if (endflag) + { + for(i=0;i<16;i++) + { + if(!scrollu()) endflag=FALSE; + } + if (endflag) + { + if((pos.y < 16) && ((*pmax).line > 15)) pos.y++; + for(i=0;i<16;i++) + { + scrolld(); + } + } + } +} + +int main(int argc, char *argv[]) +{ +//Variables + unsigned int i; // Public counter + int inpch; // The char of input + +//Preperation + printf("GHEX Version 0.5\n"); + //Is there a param? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //open the file + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // set the pointers + initvar(); + // init of other useful varibles + pos.x = pos.y = 1; + filename=argv[1]; + //file -> ram + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // init of terminal + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Main-procedure +initout(); +bottomout(); +scrrefresh(); + +//Event-loop + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + // The Keys F1-F8 (bit-setting) + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + //the delete character-key + case KEY_DC : if (mode == 1) + { + delactchar(1,pos.x); + } + else + { + switchmode(); + delactchar(1,pos.x); + switchmode(); + } + break; + + //the insert-key, switch insert mode + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + //Cursor-movement + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + case KEY_END: if((*pmax).line > 15) + { + pdatas=pmax; + for(i=0;((*pdatas).plast) && (i < 16);i++) + { + pdatas=(*pdatas).plast; + } + while((*pdatas).pnext) + { + scrolld(); + } + } + break; + // input characters + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // fill hch correct (old values) + int xpos=pos.x; // save position + switchmode(); // recalc. coordinates + ptv=tonumsysx(charout(),16); // actual char in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // recalc coordinates + pos.x=xpos; // restore coorinates + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // recalc coordinates + charin(xto10(hch,16),0,xpos); // calc Hex -> Ascii+charin + switchmode(); // and back + pos.x=xpos; // restore positions + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + + } + endscr(); + unallocmem(); + + return (fclose(fp)); +} diff --git a/tiahv11.cc b/tiahv11.cc new file mode 100644 index 0000000..f0b996e --- /dev/null +++ b/tiahv11.cc @@ -0,0 +1,1248 @@ +/* + * GHEX -- an advanced HEX-Editor + * Copyright (C) 1999 by Joerg Tretter + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +struct data // one line in Memory +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long line; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data datas, *pdatas, *pfirst, *phelp, *pmax; + +/*************************************************************************** + * FUNCTION: void initvar() * + * GOOD FOR: Initialization of basic-variables * + ***************************************************************************/ +void initvar() +{ + pfirst=&datas; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).line=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +/*************************************************************************** + * FUNCTION: void miniinit() * + * GOOD FOR: Initialization of frequent used variables * + ***************************************************************************/ +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +/*************************************************************************** + * FUNCTION: int screeninit() * + * GOOD FOR: Initialization of the n-curses-screen * + * RESULTS : 1:There was an error / 2:Everything ok. * + ***************************************************************************/ +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Create Curses-space for the windows +//TODO: check whether creation was fine. + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// enable scrolling + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// enable Keyboard-control + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// disable echoing of input + noecho(); + +// swich cursor to big size +// TODO: check why this not works in most cases +// if(curs_set(2)==ERR) retval=1 ; + +// creation of curses "Color-Pairs" + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + +// join the windows with the color-pairs + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + +// paint the boxes around the windows (in fact it's inside) + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + // change the color-pairs of the windows again. + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +/*************************************************************************** + * FUNCTION: char* tonumsysx() * + * GOOD FOR: Shift a number to another numbering system * + * INPUTS : - int base10 -The number in decimal system * + * - int newbase -The new system (16->Hex,2->Bin,...) * + * RESULTS : The number in the new system as a pointer of char * + ***************************************************************************/ +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +/*************************************************************************** + * FUNCTION: unsigned long xto10(char *c, int oldbase) * + * GOOD FOR: Shift a number from a foreign numbering system to decimal * + * INPUTS : - char* c -The number in foreign system * + * - int oldbase -The old system (16->Hex,2->Bin,...) * + * RESULTS : The number in decimal system as a unsigned long * + ***************************************************************************/ +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +/*************************************************************************** + * FUNCTION: int loadcontents() * + * GOOD FOR: Loading the contents of a file into the memory * + * RESULTS : The status of the loading (not used yet) * + ***************************************************************************/ +int loadcontents() +{ + int retval=0; + int x; + char ch; + unsigned long line=0; + + + pdatas=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"opening 0-Byte file"); + pfirst=pmax=pdatas=(data*)(malloc(sizeof(datas))); + (*pdatas).pnext=NULL; + (*pdatas).plast=NULL; + (*pdatas).line=0; + (*pdatas).len=0; + + } + // TODO: how to flush the buffer of stdout??? + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdatas).vals[x])=ch; + if (feof(fp)) //(*pdatas).vals[x]==EOF) + { + (*pdatas).vals[x]=0; + break; + } + (*pdatas).len=x+1; + ch=fgetc(fp); + } + (*pdatas).line=line++; + if(!(feof(fp))) + { + phelp=pdatas; + if (!(line%500)) {printf("%c",'#');} + pdatas=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); +// BUG: Check for Memory-Full does not work. + if(!pdatas) {abort();} + (*pdatas).plast=phelp; + (*pdatas).pnext=NULL; + } + pmax=pdatas; + + } + return (retval); +} + +/*************************************************************************** + * FUNCTION: void endscr() * + * GOOD FOR: End the scrren session on curses-level * + ***************************************************************************/ +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +/*************************************************************************** + * FUNCTION: void unallocmem(int save, char* filename) * + * GOOD FOR: Free the memory from the bits & bytes * + * INPUTS : int save: flag (save Y/else key) * + * : cahr* filename: the name of the save-file * + ***************************************************************************/ +void unallocmem(int save, char *filename) +{ + int pos; + save=toupper(save); + if (save=='Y') + { + pdatas=pfirst; + fp=fopen(filename,"w"); + while((*pdatas).pnext) + { + for (pos=0;pos <(*pdatas).len;pos++) + { + fputc((*pdatas).vals[pos],fp); + } + pdatas=(*pdatas).pnext; + } + for (pos=0;pos <(*pdatas).len;pos++) fputc((*pdatas).vals[pos],fp); + close(fp); + } + { + pdatas=pmax; + } + while((*pdatas).plast) + { + phelp=(*pdatas).plast; + free(pdatas); + pdatas=phelp; + } +} + +/*************************************************************************** + * FUNCTION: void scrrefresh() * + * GOOD FOR: Refreah the basic-screen-elements (not the contents) * + ***************************************************************************/ +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + // depending on the mode (ascii/hex) set the cursor-position + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // the order is given by the mode (ascii/hex). the last window refreshed + // it the one, in which the cursor appears and the input-focus is. + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +/*************************************************************************** + * FUNCTION: void emplineout(unsigned long line) * + * GOOD FOR: Writing one empty line to the scrren * + ***************************************************************************/ +void emplineout(unsigned long line) +{ + mvwaddstr(woffs,line,1," "); + mvwaddstr(whex,line,1," "); + mvwaddstr(wascii,line,1," "); +} + +/*************************************************************************** + * FUNCTION: void lineout(unsigned long line) * + * GOOD FOR: Writing one line (the actual one) from the memory to screen * + ***************************************************************************/ +void lineout(unsigned long line) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdatas).line*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,line,1,soffs); + for (z=0;z<(*pdatas).len;z++) + { + ptv = tonumsysx((*pdatas).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,line,1,shex); + for (z=0;z<(*pdatas).len;z++) + { +// TODO: There are many other characters that are displayable. + xascii[z] = (isgraph((*pdatas).vals[z]))?((*pdatas).vals[z]):'.'; + } + mvwaddstr(wascii,line,1,sascii); +} + +/*************************************************************************** + * FUNCTION: void initout() * + * GOOD FOR: First output after loading the file // home-Key * + ***************************************************************************/ +void initout() +{ +//Initial output (All) +int i,z; +bool toggleswitch=false; +pdatas=pfirst; + +if ((*pdatas).pnext == NULL) toggleswitch=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + scrrefresh(); + +if(i>15) pdatas=(*pdatas).plast; +} + +/*************************************************************************** + * FUNCTION: int scrolld() * + * GOOD FOR: Scrolling the scrren one line down * + * RESULTS : 1: no more elements // 0: everything was nice * + ***************************************************************************/ +int scrolld() +{ + int resval; + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +/*************************************************************************** + * FUNCTION: int scrollu() * + * GOOD FOR: Scrolling the scrren one line up * + * RESULTS : 1: at first element // 0: everything was nice * + ***************************************************************************/ +int scrollu() +{ + int z=0; + int result; + while(((*pdatas).plast != NULL)&&(z < 16)) + { + pdatas=(*pdatas).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + } + } + return(result); +} + +/*************************************************************************** + * FUNCTION: void switchmode() * + * GOOD FOR: recalculation of cursor-position ascii<->hex * + ***************************************************************************/ +void switchmode() +{ + if(mode==0) + { + mode=1; // mode-toggle:Hex->Ascii + // recalculate cursor-position + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // mode-toggle:ascii->Hex + // recalculate cursor-position + pos.x=((pos.x*3)-1); + } +} + +/*************************************************************************** + * FUNCTION: void moveleft() * + * GOOD FOR: move the cursor one position to the left * + ***************************************************************************/ +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +/*************************************************************************** + * FUNCTION: void moveright() * + * GOOD FOR: move the cursor one position to the right * + ***************************************************************************/ +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +/*************************************************************************** + * FUNCTION: unsigned long getactpos() * + * GOOD FOR: get the acutal cursor-position as a file-offset * + * RESULTS : The file-offset on the cursor-position as unsigned long * + ***************************************************************************/ +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int distance; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the position + actpos=((*pdatas).line*16)+pos.x-1; + // and move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +/*************************************************************************** + * FUNCTION: void charin(char ch, int realmode, int realxpos) * + * GOOD FOR: insert/override one character in the memory * + * INPUTS : - char ch -the char to insert * + * - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int distance=0; + bool toggleswitch; + data *phelp2; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + unsigned long zhelp; + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + pdatas=pmax; + if ((*pdatas).len < 16) + { + (*pdatas).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).line+1; + pdatas=pmax=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).line=zhelp; + if (rbmode == 1) phelp=pmax; + } + while(pdatas!=phelp) + { + for(z=(*pdatas).len-1;z>=0;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + (*pdatas).vals[0]=(*(*pdatas).plast).vals[15]; + pdatas=(*pdatas).plast; + } + + for(z=(*pdatas).len-1;z+1>pos.x;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + pdatas=phelp; + } + // Write value + (*pdatas).vals[pos.x-1]=ch; + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +} + +/*************************************************************************** + * FUNCTION: int charout() * + * GOOD FOR: get the char at the actual cursor-position * + * RESULTS : the char as an integer (char should work too normaly) * + ***************************************************************************/ +int charout() +{ + int i=0; + int distance; + int posxsave; + int ch; + // Move in memory to cursor-position + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the value + ch=((*pdatas).vals[pos.x-1]); + // move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + return(ch); +} + +/*************************************************************************** + * FUNCTION: void bottomout() * + * GOOD FOR: refreshing the output of the bottom-window * + ***************************************************************************/ +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void swapbits() * + * GOOD FOR: toggle the bit [par1] an the actual position * + * INPUTS : - char bit the number (1-8) of the bit to toggle * + ***************************************************************************/ +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // for the Bits + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void delactchar(char ch, int realmode, int realxpos) * + * GOOD FOR: delete the char under the actual cursor-position * + * INPUTS : - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void delactchar(int realmode, int realxpos) +{ + //BUG: after deletion the last char in the last line it gives me a segfault. + int i=0; + int z=0; + int distance=0; + bool endflag=FALSE; + bool toggleswitch; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + + // move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + for(z=realxpos-1;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + if((*pdatas).pnext) + { + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } + while(pdatas!=pmax) + { + for(z=0;z<15;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + (*pdatas).vals[15]=(*(*pdatas).pnext).vals[0]; + pdatas=(*pdatas).pnext; + } +// check here for last char in last element + (*pdatas).len--; + if((*pdatas).len <= 0) + { + if(phelp==pmax) + { + if((*phelp).plast) + { + phelp=(*phelp).plast; + } + } + if(pfirst!=pmax) // is when pfirst!=pmax + { + pdatas=(*pdatas).plast; + free((*pdatas).pnext); + (*pdatas).pnext=NULL; + pmax=pdatas; + // TODO: there is one line less now, when we are at the last screen + // we should decrease i by one (only cosmetic) + endflag=TRUE; + } + else + { + (*pdatas).len=0; + } + } + else + { + if (phelp!=pmax) for(z=0;z<(*pdatas).len;z++) + { + (*pdatas).vals[z]=(*pdatas).vals[z+1]; + } + } + pdatas=phelp; + } + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + // first delete the screen + for(z=0;z<16;z++) + { + emplineout(z+1); + } + // then do an initial output + initout(); + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +// The rest is only a dirty workaround for the las (no longer needed) line +// because it was not possible for me to determine out, whether i am really +// at the end. + if (endflag) + { + for(i=0;i<16;i++) + { + if(!scrollu()) endflag=FALSE; + } + if (endflag) + { + if((pos.y < 16) && ((*pmax).line > 15)) pos.y++; + for(i=0;i<16;i++) + { + scrolld(); + } + } + } +} + +int main(int argc, char *argv[]) +{ +//Variables + unsigned int i; // Public counter + int inpch; // The char of input + +//Preperation + printf("GHEX Version 0.5\n"); + //Is there a param? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //open the file + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // set the pointers + initvar(); + // init of other useful varibles + pos.x = pos.y = 1; + filename=argv[1]; + //file -> ram + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // init of terminal + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Main-procedure +initout(); +bottomout(); +scrrefresh(); + +//Event-loop + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + // The Keys F1-F8 (bit-setting) + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + //the delete character-key + case KEY_DC : if (mode == 1) + { + delactchar(1,pos.x); + } + else + { + switchmode(); + delactchar(1,pos.x); + switchmode(); + } + break; + + //the insert-key, switch insert mode + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + //Cursor-movement + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + case KEY_END: if((*pmax).line > 15) + { + pdatas=pmax; + for(i=0;((*pdatas).plast) && (i < 16);i++) + { + pdatas=(*pdatas).plast; + } + while((*pdatas).pnext) + { + scrolld(); + } + } + break; + // input characters + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // fill hch correct (old values) + int xpos=pos.x; // save position + switchmode(); // recalc. coordinates + ptv=tonumsysx(charout(),16); // actual char in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // recalc coordinates + pos.x=xpos; // restore coorinates + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // recalc coordinates + charin(xto10(hch,16),0,xpos); // calc Hex -> Ascii+charin + switchmode(); // and back + pos.x=xpos; // restore positions + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + + } + + WINDOW* s=derwin(whex,3,17,7,17); + wattrset(s,COLOR_PAIR(1)); + box(s,0,0); + wattrset(s,COLOR_PAIR(3)); + mvwaddstr(s,1,1,"SAVE FILE (Y/N)"); + wrefresh(s); + int saveit= wgetch(s); + endscr(); + unallocmem(saveit,argv[1]); + + return (fclose(fp)); +} diff --git a/tiahv2.cc b/tiahv2.cc new file mode 100644 index 0000000..c125255 --- /dev/null +++ b/tiahv2.cc @@ -0,0 +1,286 @@ +#include +#include +#include + +struct data +{ +struct data* plast; +struct data* pnext; +char vals[16][16]; +}; + +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII"; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +int result; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten,*pdaten,*pfirst, *phelp; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tohex(int base10) +{ + int newbase=16; + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +int loadcontents() +{ + int retval=0; + int x,y; + char ch; + int k=0; + + + pdaten=pfirst; + + ch=fgetc(fp); + + while (!(ch==EOF)) + { + k++; + + for(x=0;x<16;x++) + for(y=0;y<16;y++) + { + ((*pdaten).vals[y][x])=ch; + if ((*pdaten).vals[y][x]==EOF) (*pdaten).vals[y][x]=0; + ch=fgetc(fp); + } + + if(!(ch==EOF)) + { + phelp=pdaten; + printf("Vorher:%p\n",pdaten); + pdaten=((*pdaten).pnext)=(malloc(sizeof(daten))); + printf("Nachher:%p\n" ,pdaten); + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + + } +/* D E B U G O N L Y +getchar(); + + pdaten=pfirst; + + +while (k--) + { + for(x=0;x<16;x++) + for(y=0;y<16;y++) + { + printf("%c-",(*pdaten).vals[y][x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; +pdaten=pfirst; +for(;(*pdaten).pnext;pdaten=(*pdaten).pnext) + ; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} + + + +} + + +int main(int argc, char *argv[]) +{ +//Variablen + unsigned int i,z; + unsigned long zeile=0,pos=0; + + printf("%s\n",tohex(0)); + printf("%s\n",tohex(10)); + printf("%s\n",tohex(20)); + printf("%s\n",tohex(30)); + printf("%s\n",tohex(40)); + printf("%s\n",tohex(50)); + +//Vorbereitung + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"THX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + mvwaddstr(wbot,1,1,argv[1]); + + +//Hauptprogramm + + for (i=1;i<17;i++) + { + ptv = tohex(i-1); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,i,1,soffs); + for (z=0;z<16;z++) + { + ptv = tohex(daten.vals[z][i-1]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,i,1,shex); + for (z=0;z<16;z++) + { + xascii[z] = ((daten.vals[z][i-1]) > 33)?(daten.vals[z][i-1]):254; + } + mvwaddstr(wascii,i,1,sascii); + } + + wrefresh(woffs); + wrefresh(whex); + wrefresh(wascii); + wrefresh(wtop); + wrefresh(wbot); + + + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/tiahv3.cc b/tiahv3.cc new file mode 100644 index 0000000..0534219 --- /dev/null +++ b/tiahv3.cc @@ -0,0 +1,463 @@ +#include +#include +#include + +struct data +{ +struct data* plast; +struct data* pnext; +char vals[16]; +unsigned long zeile; +char len; +}; + +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII"; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +int result; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten,*pdaten,*pfirst, *phelp; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).zeile=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Tastatureingabe erlauben + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tohex(int base10) +{ + int newbase=16; + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +int loadcontents() +{ + int retval=0; + int x; + char ch; + int k=0; + unsigned long zeile=0; + + + pdaten=pfirst; + + ch=fgetc(fp); + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(ch==EOF)) + { + for(x=0;x<16;x++) + { + ((*pdaten).vals[x])=ch; + if ((*pdaten).vals[x]==EOF) + { + (*pdaten).vals[x]=0; + break; + } + (*pdaten).len=x+1; + ch=fgetc(fp); + } + (*pdaten).zeile=zeile++; + if(!(ch==EOF)) + { + phelp=pdaten; + if (!(zeile%500)) {fprintf(stderr,"%c",'#');} + pdaten=((*pdaten).pnext)=(malloc(sizeof(daten))); + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + + } +/* D E B U G O N L Y +getchar(); + + pdaten=pfirst; + +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; +pdaten=pfirst; +for(;(*pdaten).pnext;pdaten=(*pdaten).pnext) + ; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} +} + + +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + wrefresh(woffs); + wrefresh(whex); + wrefresh(wascii); + wrefresh(wtop); + wrefresh(wbot); +} + +void lineout(unsigned long zeile) +{ + int z; + + miniinit(); + + ptv = tohex((*pdaten).zeile); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,zeile,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tohex((*pdaten).vals[z]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,zeile,1,shex); + for (z=0;z<(*pdaten).len;z++) + { + xascii[z] = (((*pdaten).vals[z]) > 33)?((*pdaten).vals[z]):254; + } + mvwaddstr(wascii,zeile,1,sascii); +} + + +void scrolld() +{ + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + int z; + + miniinit(); + + ptv = tohex((*pdaten).zeile); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,16,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tohex((*pdaten).vals[z]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,16,1,shex); + for (z=0;z<(*pdaten).len;z++) + { + xascii[z] = (((*pdaten).vals[z]) > 33)?((*pdaten).vals[z]):254; + } + mvwaddstr(wascii,16,1,sascii); +} + +void scrollu() +{ + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + int z; + ptv = tohex((*pdaten).zeile); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,1,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tohex((*pdaten).vals[z]); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,1,1,shex); + for (z=0;z<(*pdaten).len;z++) + { + xascii[z] = (((*pdaten).vals[z]) > 33)?((*pdaten).vals[z]):254; + } + mvwaddstr(wascii,1,1,sascii); +} + + +int main(int argc, char *argv[]) +{ +//Variablen + unsigned int i,z; + unsigned long zeile=0,pos=0; + bool schalter; + int inpch; + +//Vorbereitung + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"THX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"THX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + mvwaddstr(wbot,1,1,argv[1]); + + +//Hauptprogramm + +schalter=false; +zeile=1; +pdaten=pfirst; + +//Initiale Ausgabe (Alle) +for(i=0;i<16;i++) + { + lineout(i+1); + if (schalter) break; + pdaten=(*pdaten).pnext; + if ((*pdaten).pnext == NULL) schalter=true; + } + scrrefresh(); + +if(i>15) pdaten=(*pdaten).plast; + +//Eventschleife + while(inpch!=KEY_END) + { + inpch=wgetch(whex); + switch(inpch) + { + case KEY_DOWN: + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + break; + case KEY_UP: + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + break; + case KEY_NPAGE: + for(i=0;i<16;i++) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + case KEY_PPAGE: + for(i=0;i<16;i++) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + break; + }; + scrrefresh(); + } + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/tiahv4.cc b/tiahv4.cc new file mode 100644 index 0000000..8c91a47 --- /dev/null +++ b/tiahv4.cc @@ -0,0 +1,450 @@ +#include +#include +#include + +struct data +{ +struct data* plast; +struct data* pnext; +char vals[16]; +unsigned long zeile; +char len; +}; + +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +int result; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten,*pdaten,*pfirst, *phelp; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).zeile=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Tastatureingabe erlauben + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +int loadcontents() +{ + int retval=0; + int x; + char ch; + int k=0; + unsigned long zeile=0; + + + pdaten=pfirst; + + ch=fgetc(fp); + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdaten).vals[x])=ch; + if (feof(fp)) //(*pdaten).vals[x]==EOF) + { + (*pdaten).vals[x]=0; + break; + } + (*pdaten).len=x+1; + ch=fgetc(fp); + } + (*pdaten).zeile=zeile++; + if(!(feof(fp))) + { + phelp=pdaten; + if (!(zeile%500)) {fprintf(stderr,"%c",'#');} + pdaten=((*pdaten).pnext)=(malloc(sizeof(daten))); +// BUG: Check for Memory-Full does not work. + if(!pdaten) {abort();} + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + + } +/* D E B U G O N L Y +getchar(); + + pdaten=pfirst; + +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; +pdaten=pfirst; +for(;(*pdaten).pnext;pdaten=(*pdaten).pnext) + ; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} +} + + +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(2)); + wattrset(wbot,COLOR_PAIR(2)); + + wrefresh(woffs); + wrefresh(whex); + wrefresh(wascii); + wrefresh(wtop); + wrefresh(wbot); +} + +void lineout(unsigned long zeile) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdaten).zeile*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,zeile,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tonumsysx((*pdaten).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,zeile,1,shex); + for (z=0;z<(*pdaten).len;z++) + { + xascii[z] = (((*pdaten).vals[z]) > 31)?((*pdaten).vals[z]):254; + } + mvwaddstr(wascii,zeile,1,sascii); +} + +void initout() +{ +//Initiale Ausgabe (Alle) +int i; +bool schalter=false; +unsigned long zeile=1; +pdaten=pfirst; + +if ((*pdaten).pnext == NULL) schalter=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (schalter) break; + pdaten=(*pdaten).pnext; + if ((*pdaten).pnext == NULL) schalter=true; + } + scrrefresh(); + +if(i>15) pdaten=(*pdaten).plast; +} + +void scrolld() +{ + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + int z; + + miniinit(); + + lineout(16); +} + +void scrollu() +{ + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); +} + + +int main(int argc, char *argv[]) +{ +//Variablen + unsigned int i,z; + unsigned long zeile=0,pos=0; + bool schalter; + int inpch; + + printf("GHEX Version 0.5\n"); + +//Vorbereitung + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + mvwaddstr(wbot,1,1,argv[1]); + + +//Hauptprogramm + +initout(); + +//Eventschleife + while(inpch!=KEY_F(10)) + { + inpch=wgetch(whex); + switch(inpch) + { + case KEY_DOWN: + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + break; + case KEY_UP: + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + break; + case KEY_NPAGE: + for(i=0;i<16;i++) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + case KEY_PPAGE: + for(i=0;i<16;i++) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + break; + case KEY_HOME: + initout(); + break; + case KEY_END: + while((*pdaten).pnext) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + + }; + scrrefresh(); + } + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/tiahv5.cc b/tiahv5.cc new file mode 100644 index 0000000..237a432 --- /dev/null +++ b/tiahv5.cc @@ -0,0 +1,766 @@ +#include +#include +#include +#include +#include + +struct data // Eine Zeile Speicher +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long zeile; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten, *pdaten, *pfirst, *phelp, *pmax; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).zeile=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Tastatureingabe erlauben + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// Echo ausschalten + noecho(); + +// Cursor auf Gro setzen +// if(curs_set(2)==ERR) retval=1 ; + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +unsigned long rest,erg; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +int loadcontents() +{ + int retval=0; + int x; + char ch; + int k=0; + unsigned long zeile=0; + + + pdaten=pfirst; + + ch=fgetc(fp); + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdaten).vals[x])=ch; + if (feof(fp)) //(*pdaten).vals[x]==EOF) + { + (*pdaten).vals[x]=0; + break; + } + (*pdaten).len=x+1; + ch=fgetc(fp); + } + (*pdaten).zeile=zeile++; + if(!(feof(fp))) + { + phelp=pdaten; + if (!(zeile%500)) {fprintf(stderr,"%c",'#');} + pdaten=((*pdaten).pnext)=(malloc(sizeof(daten))); +// BUG: Check for Memory-Full does not work. + if(!pdaten) {abort();} + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + pmax=pdaten; + + } +/* D E B U G O N L Y + + pdaten=pfirst; + +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; + +/* DEBUG ONLY + pdaten=pfirst; +int zeile=16; +int x; +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + +pdaten=pmax; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} +} + +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // die Reihenfolge wird anhand des Modus bestimmt (das letzte ist aktiv) + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +void lineout(unsigned long zeile) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdaten).zeile*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,zeile,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tonumsysx((*pdaten).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,zeile,1,shex); + for (z=0;z<(*pdaten).len;z++) + { +// BUG: Die Ober- und Untergrenze genau bestimmen. + xascii[z] = (isgraph((*pdaten).vals[z]))?((*pdaten).vals[z]):'.'; + } + mvwaddstr(wascii,zeile,1,sascii); +} + +void initout() +{ +//Initiale Ausgabe (Alle) +int i; +bool schalter=false; +unsigned long zeile=1; +pdaten=pfirst; + +if ((*pdaten).pnext == NULL) schalter=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (schalter) break; + pdaten=(*pdaten).pnext; + if ((*pdaten).pnext == NULL) schalter=true; + } + scrrefresh(); + +if(i>15) pdaten=(*pdaten).plast; +} + +void scrolld() +{ + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + int z; + + miniinit(); + + lineout(16); +} + +void scrollu() +{ + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); +} + +void switchmode() +{ + if(mode==0) + { + mode=1; // modus:Hex->Ascii + // Umrechnen der Cursorposition + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // modue:Ascii->Hex + // Umrechnen der Cursorposition + pos.x=((pos.x*3)-1); + } +} + +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2)(pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.x > 1)pos.x--; + } +} + +void moveright() +{ + if(mode==0) + { + if(pos.x < 48)(pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.x < 16)pos.x++; + } +} + +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + // Position holen + actpos=((*pdaten).zeile*16)+pos.x-1; + // wieder zurckblttern + while(i--) + { + pdaten=(*pdaten).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +void charin(char ch) +{ + int i=0; + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + // Wert schreiben + (*pdaten).vals[pos.x-1]=ch; + // Ausgabe aktualisieren + lineout(pos.y); + // wieder zurckblttern + while(i--) + { + pdaten=(*pdaten).pnext; + } +} + +int charout() +{ + int i=0; + int ch; + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + // Wert lesen + ch=((*pdaten).vals[pos.x-1]); + // wieder zurckblttern + while(i--) + { + pdaten=(*pdaten).pnext; + } + return(ch); +} + +void bottomout() +{ + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + +} + + +int main(int argc, char *argv[]) +{ +/* --- DEBUG ONLY +printf("DEBUG: 5-%u\n",xto10(tonumsysx(5,2),2)); +printf("DEBUG: 16-%u\n",xto10(tonumsysx(16,16),16)); +printf("DEBUG: 36-%u\n",xto10 (tonumsysx(36,36),36)); +printf("DEBUG: 255-%u\n",xto10(tonumsysx(255,16),16)); +printf("DEBUG: 255-%u\n",xto10("FF",16)); +printf("DEBUG: 125-%u\n",xto10(tonumsysx(125,8),8)); +printf("DEBUG: 255-%u\n",xto10(tonumsysx(255,8),8)); +getchar(); + --- END DEBUG */ +//Variablen + unsigned int i,z; // Allgemeine Zhler + unsigned long zeile=0; // Zeilennummer + bool schalter; // Schalter fr lesevorlauf + int inpch; // Eingabezeichen + +//Vorbereitung + printf("GHEX Version 0.5\n"); + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + // sonstige Variableninitialisierung + pos.x = pos.y = 1; + filename=argv[1]; + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Hauptprogramm + +initout(); +bottomout(); +scrrefresh(); +/* --- DEBUG ONLY + fprintf(stdout,"D%d\n",charout()); + pos.x++; + fprintf(stdout,"D%d\n",charout()); + pos.x++; + fprintf(stdout,"D%d\n",charout()); + pos.x++; + fprintf(stdout,"D%d\n",charout()); + pos.x++; + fprintf(stdout,"D%d\n",charout()); + + getchar(); + -- END DEBUG */ + +//Eventschleife + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + case KEY_F(9): switchmode(); + break; + case KEY_LEFT: moveleft(); + break; + case KEY_RIGHT:moveright(); + break; + case KEY_DOWN: if(pos.y>15) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + else + { + pos.y++; + } + break; + case KEY_UP: if(pos.y<2) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + else + { + pos.y--; + } + break; + case KEY_NPAGE: + for(i=0;i<16;i++) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + case KEY_PPAGE: + for(i=0;i<16;i++) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + break; + case KEY_HOME: + initout(); + break; + case KEY_END: pdaten=pmax; + for(i=0;((*pdaten).plast) && (i < 16);i++) + { + pdaten=(*pdaten).plast; + } + while((*pdaten).pnext) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + default: + if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="FF"; + // hch korrekt fllen. + int xpos=pos.x; // Position sichern + switchmode(); // um die Koordinaten umzurechnen + ptv=tonumsysx(charout(),16); // Aktuelles Zeichen in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // Koordinaten zurckrechnen + pos.x=xpos; // position restaurieren + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // um die Koordinaten umzurechnen + charin(xto10(hch,16)); // Umrechnen Hex -> Ascii+charin + switchmode(); // und wieder zurcksetzen + pos.x=xpos; // position restaurieren + moveright(); + } + + else + { + //if((inpch > 31)&&(inpch < 256)) + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch); + moveright(); + } + } + } + }; + + bottomout(); + scrrefresh(); + +// fprintf(stderr,"x: %d %d",pos.x,charout()); + + } + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/tiahv6.cc b/tiahv6.cc new file mode 100644 index 0000000..779f1c0 --- /dev/null +++ b/tiahv6.cc @@ -0,0 +1,811 @@ +#include +#include +#include +#include +#include + +struct data // Eine Zeile Speicher +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long zeile; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten, *pdaten, *pfirst, *phelp, *pmax; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).zeile=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Tastatureingabe erlauben + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// Echo ausschalten + noecho(); + +// Cursor auf Gro setzen +// if(curs_set(2)==ERR) retval=1 ; + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +unsigned long rest,erg; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +int loadcontents() +{ + int retval=0; + int x; + char ch; + int k=0; + unsigned long zeile=0; + + + pdaten=pfirst; + + ch=fgetc(fp); + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdaten).vals[x])=ch; + if (feof(fp)) //(*pdaten).vals[x]==EOF) + { + (*pdaten).vals[x]=0; + break; + } + (*pdaten).len=x+1; + ch=fgetc(fp); + } + (*pdaten).zeile=zeile++; + if(!(feof(fp))) + { + phelp=pdaten; + if (!(zeile%500)) {fprintf(stderr,"%c",'#');} + pdaten=((*pdaten).pnext)=(malloc(sizeof(daten))); +// BUG: Check for Memory-Full does not work. + if(!pdaten) {abort();} + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + pmax=pdaten; + + } +/* D E B U G O N L Y + + pdaten=pfirst; + +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; + +/* DEBUG ONLY + pdaten=pfirst; +int zeile=16; +int x; +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + +pdaten=pmax; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} +} + +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // die Reihenfolge wird anhand des Modus bestimmt (das letzte ist aktiv) + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +void lineout(unsigned long zeile) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdaten).zeile*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,zeile,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tonumsysx((*pdaten).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,zeile,1,shex); + for (z=0;z<(*pdaten).len;z++) + { +// BUG: Die Ober- und Untergrenze genau bestimmen. + xascii[z] = (isgraph((*pdaten).vals[z]))?((*pdaten).vals[z]):'.'; + } + mvwaddstr(wascii,zeile,1,sascii); +} + +void initout() +{ +//Initiale Ausgabe (Alle) +int i; +bool schalter=false; +unsigned long zeile=1; +pdaten=pfirst; + +if ((*pdaten).pnext == NULL) schalter=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (schalter) break; + pdaten=(*pdaten).pnext; + if ((*pdaten).pnext == NULL) schalter=true; + } + scrrefresh(); + +if(i>15) pdaten=(*pdaten).plast; +} + +void scrolld() +{ + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + int z; + + miniinit(); + + lineout(16); +} + +void scrollu() +{ + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); +} + +void switchmode() +{ + if(mode==0) + { + mode=1; // modus:Hex->Ascii + // Umrechnen der Cursorposition + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // modue:Ascii->Hex + // Umrechnen der Cursorposition + pos.x=((pos.x*3)-1); + } +} + +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2)(pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.x > 1)pos.x--; + } +} + +void moveright() +{ + if(mode==0) + { + if(pos.x < 48)(pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.x < 16)pos.x++; + } +} + +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + // Position holen + actpos=((*pdaten).zeile*16)+pos.x-1; + // wieder zurckblttern + while(i--) + { + pdaten=(*pdaten).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +void charin(char ch) +{ + int i=0; + int z=0; + int sicchar=9999; + // Das eigentliche Enfgen des Zeichens + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + if (insovr=='I') // In Override-Mode + { + phelp=pdaten; + pdaten=pmax; + if ((*pdaten).len < 16) + { + (*pdaten).len++; + } + else + { + // allocate new element + } + while(pdaten!=phelp) + { + for(z=(*pdaten).len;z>0;z--) + { + (*pdaten).vals[z]=(*pdaten).vals[z-1]; + } + (*pdaten).vals[0]=(*(*pdaten).plast).vals[15]; + pdaten=(*pdaten).plast; + } + + for(z=(*pdaten).len;z+1>pos.x;z--) + { + (*pdaten).vals[z]=(*pdaten).vals[z-1]; + } + pdaten=phelp; + } + // Wert schreiben + (*pdaten).vals[pos.x-1]=ch; + // Ausgabe aktualisieren + lineout(pos.y); + // wieder zurckblttern + while(i--) + { + pdaten=(*pdaten).pnext; + } +} + +int charout() +{ + int i=0; + int ch; + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + // Wert lesen + ch=((*pdaten).vals[pos.x-1]); + // wieder zurckblttern + while(i--) + { + pdaten=(*pdaten).pnext; + } + return(ch); +} + +void bottomout() +{ + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); +} + + +int main(int argc, char *argv[]) +{ +/* --- DEBUG ONLY +printf("DEBUG: 5-%u\n",xto10(tonumsysx(5,2),2)); +printf("DEBUG: 16-%u\n",xto10(tonumsysx(16,16),16)); +printf("DEBUG: 36-%u\n",xto10 (tonumsysx(36,36),36)); +printf("DEBUG: 255-%u\n",xto10(tonumsysx(255,16),16)); +printf("DEBUG: 255-%u\n",xto10("FF",16)); +printf("DEBUG: 125-%u\n",xto10(tonumsysx(125,8),8)); +printf("DEBUG: 255-%u\n",xto10(tonumsysx(255,8),8)); +getchar(); + --- END DEBUG */ +//Variablen + unsigned int i,z; // Allgemeine Zhler + unsigned long zeile=0; // Zeilennummer + bool schalter; // Schalter fr lesevorlauf + int inpch; // Eingabezeichen + +//Vorbereitung + printf("GHEX Version 0.5\n"); + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + // sonstige Variableninitialisierung + pos.x = pos.y = 1; + filename=argv[1]; + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Hauptprogramm + +initout(); +bottomout(); +scrrefresh(); +/* --- DEBUG ONLY + fprintf(stdout,"D%d\n",charout()); + pos.x++; + fprintf(stdout,"D%d\n",charout()); + pos.x++; + fprintf(stdout,"D%d\n",charout()); + pos.x++; + fprintf(stdout,"D%d\n",charout()); + pos.x++; + fprintf(stdout,"D%d\n",charout()); + + getchar(); + -- END DEBUG */ + +//Eventschleife + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): initout(); + break; + case KEY_EIC: + //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + case KEY_LEFT: moveleft(); + break; + case KEY_RIGHT:moveright(); + break; + case KEY_DOWN: if(pos.y>15) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + else + { + pos.y++; + } + break; + case KEY_UP: if(pos.y<2) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + else + { + pos.y--; + } + break; + case KEY_NPAGE: + for(i=0;i<16;i++) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + case KEY_PPAGE: + for(i=0;i<16;i++) + { + z=0; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + if(z>15) + { + z--; + scrollu(); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + } + break; + case KEY_HOME: + initout(); + break; + case KEY_END: pdaten=pmax; + for(i=0;((*pdaten).plast) && (i < 16);i++) + { + pdaten=(*pdaten).plast; + } + while((*pdaten).pnext) + { + if ((*pdaten).pnext != NULL) + { pdaten=(*pdaten).pnext; + scrolld(); + } + } + break; + default: + if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="FF"; + // hch korrekt fllen. + int xpos=pos.x; // Position sichern + switchmode(); // um die Koordinaten umzurechnen + ptv=tonumsysx(charout(),16); // Aktuelles Zeichen in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // Koordinaten zurckrechnen + pos.x=xpos; // position restaurieren + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // um die Koordinaten umzurechnen + charin(xto10(hch,16)); // Umrechnen Hex -> Ascii+charin + switchmode(); // und wieder zurcksetzen + pos.x=xpos; // position restaurieren + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + +// fprintf(stderr,"x: %d %d",pos.x,charout()); + + } + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/tiahv7.cc b/tiahv7.cc new file mode 100644 index 0000000..2ee807b --- /dev/null +++ b/tiahv7.cc @@ -0,0 +1,927 @@ +#include +#include +#include +#include +#include + +struct data // Eine Zeile Speicher +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long zeile; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data daten, *pdaten, *pfirst, *phelp, *pmax; + +void initvar() +{ + pfirst=&daten; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).zeile=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Zwei Fenster + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// Scrollen erlauben + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// Tastatureingabe erlauben + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// Echo ausschalten + noecho(); + +// Cursor auf Gro setzen +// if(curs_set(2)==ERR) retval=1 ; + +// Color-Pairs anlegen (Farbkombinationen) + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +unsigned long rest,erg; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +int loadcontents() +{ + int retval=0; + int x; + char ch; + int k=0; + unsigned long zeile=0; + + + pdaten=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"opening 0-Byte file"); + pfirst=pmax=pdaten=(data*)(malloc(sizeof(daten))); + (*pdaten).pnext=NULL; + (*pdaten).plast=NULL; + (*pdaten).zeile=0; + (*pdaten).len=0; + + } + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdaten).vals[x])=ch; + if (feof(fp)) //(*pdaten).vals[x]==EOF) + { + (*pdaten).vals[x]=0; + break; + } + (*pdaten).len=x+1; + ch=fgetc(fp); + } + (*pdaten).zeile=zeile++; + if(!(feof(fp))) + { + phelp=pdaten; + if (!(zeile%500)) {fprintf(stderr,"%c",'#');} + pdaten=((*pdaten).pnext)=(data*)(malloc(sizeof(daten))); +// BUG: Check for Memory-Full does not work. + if(!pdaten) {abort();} + (*pdaten).plast=phelp; + (*pdaten).pnext=NULL; + } + pmax=pdaten; + + } +/* D E B U G O N L Y + + pdaten=pfirst; + +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +int zv; + +/* DEBUG ONLY + pdaten=pfirst; +int zeile=16; +int x; +printf("%d\n",zeile); + +while (zeile--) + { + for(x=0;x<16;x++) + { + printf("%c-",(*pdaten).vals[x]); + } + pdaten=(*pdaten).pnext; + } +getchar(); + --- END DEBUG ---*/ + +pdaten=pmax; +while((*pdaten).plast) +{ +phelp=(*pdaten).plast; +free(pdaten); +pdaten=phelp; +} +} + +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // die Reihenfolge wird anhand des Modus bestimmt (das letzte ist aktiv) + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +void lineout(unsigned long zeile) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdaten).zeile*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,zeile,1,soffs); + for (z=0;z<(*pdaten).len;z++) + { + ptv = tonumsysx((*pdaten).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,zeile,1,shex); + for (z=0;z<(*pdaten).len;z++) + { +// BUG: Die Ober- und Untergrenze genau bestimmen. + xascii[z] = (isgraph((*pdaten).vals[z]))?((*pdaten).vals[z]):'.'; + } + mvwaddstr(wascii,zeile,1,sascii); +} + +void initout() +{ +//Initiale Ausgabe (Alle) +int i; +bool schalter=false; +unsigned long zeile=1; +pdaten=pfirst; + +if ((*pdaten).pnext == NULL) schalter=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (schalter) break; + pdaten=(*pdaten).pnext; + if ((*pdaten).pnext == NULL) schalter=true; + } + scrrefresh(); + +if(i>15) pdaten=(*pdaten).plast; +} + +int scrolld() +{ + int resval; + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +int scrollu() +{ + int z=0; + int result; + while(((*pdaten).plast != NULL)&&(z < 16)) + { + pdaten=(*pdaten).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdaten).pnext != NULL) + { + pdaten=(*pdaten).pnext; + } + } + return(result); +} + +void switchmode() +{ + if(mode==0) + { + mode=1; // modus:Hex->Ascii + // Umrechnen der Cursorposition + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // modus:Ascii->Hex + // Umrechnen der Cursorposition + pos.x=((pos.x*3)-1); + } +} + +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + // Position holen + actpos=((*pdaten).zeile*16)+pos.x-1; + // wieder zurckblttern + while(i--) + { + pdaten=(*pdaten).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int sicchar=9999; + data *phelp2; + unsigned long zhelp; + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + fprintf(stderr,"%d Pos. zurck\n",i); + // Fr den Einfgemodus + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdaten; + pdaten=pmax; + if ((*pdaten).len < 16) + { + (*pdaten).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).zeile+1; + pdaten=pmax=((*pdaten).pnext)=(data*)(malloc(sizeof(daten))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).zeile=zhelp; + } + while(pdaten!=phelp) + { + for(z=(*pdaten).len-1;z>0;z--) + { + (*pdaten).vals[z]=(*pdaten).vals[z-1]; + } + (*pdaten).vals[0]=(*(*pdaten).plast).vals[15]; + pdaten=(*pdaten).plast; + } + + for(z=(*pdaten).len-1;z+1>pos.x;z--) + { + (*pdaten).vals[z]=(*pdaten).vals[z-1]; + } + pdaten=phelp; + } + // Wert schreiben + (*pdaten).vals[pos.x-1]=ch; + // Ausgabe aktualisieren + lineout(pos.y); + // wieder zurckblttern + while(i--) + { + if((*pdaten).pnext) + { + pdaten=(*pdaten).pnext; + lineout(16-i); + } + } + +} + +int charout() +{ + int i=0; + int ch; + // im Speicher zur Cusrorposition blttern + while(i<(16-pos.y)&&((*pdaten).plast)) + { + i++; + pdaten=(*pdaten).plast; + } + // Wert lesen + ch=((*pdaten).vals[pos.x-1]); + // wieder zurckblttern + while(i--) + { + //fprintf(stderr,"l"); + pdaten=(*pdaten).pnext; + } + return(ch); +} + +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // Um Bits abzubilden + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +int main(int argc, char *argv[]) +{ +//Variablen + unsigned int i,z; // Allgemeine Zhler + unsigned long zeile=0; // Zeilennummer + bool schalter; // Schalter fr lesevorlauf + int inpch; // Eingabezeichen + +//Vorbereitung + printf("GHEX Version 0.5\n"); + //Parameter angegeben? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //Datei ffnen + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // pointer setzen + initvar(); + // sonstige Variableninitialisierung + pos.x = pos.y = 1; + filename=argv[1]; + //Datei -> Speicher + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // Terminal initialisieren + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Hauptprogramm +initout(); +bottomout(); +scrrefresh(); + +//Eventschleife + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + case KEY_END: pdaten=pmax; + for(i=0;((*pdaten).plast) && (i < 16);i++) + { + pdaten=(*pdaten).plast; + } + while((*pdaten).pnext) + { + scrolld(); + } + break; + + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // hch korrekt fllen. + int xpos=pos.x; // Position sichern + switchmode(); // um die Koordinaten umzurechnen + ptv=tonumsysx(charout(),16); // Aktuelles Zeichen in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // Koordinaten zurckrechnen + pos.x=xpos; // position restaurieren + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // um die Koordinaten umzurechnen + charin(xto10(hch,16),0,xpos); // Umrechnen Hex -> Ascii+charin + switchmode(); // und wieder zurcksetzen + pos.x=xpos; // position restaurieren + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + +// fprintf(stderr,"x: %d %d",pos.x,charout()); + + } + sleep(1); + endscr(); + unallocmem(); + return (fclose(fp)); +} diff --git a/tiahv8.cc b/tiahv8.cc new file mode 100644 index 0000000..af8d8aa --- /dev/null +++ b/tiahv8.cc @@ -0,0 +1,973 @@ +/* + * GHEX -- an advanced HEX-Editor + * Copyright (C) 1999 by Joerg Tretter + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include +#include + +struct data // one line in Memory +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long line; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data datas, *pdatas, *pfirst, *phelp, *pmax; + +void initvar() +{ + pfirst=&datas; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).line=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Create Curses-space for the windows +//TODO: check whether creation was fine. + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// enable scrolling + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// enable Keyboard-control + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// disable echoing of input + noecho(); + +// swich cursor to big size +// TODO: check why this not works in most cases +// if(curs_set(2)==ERR) retval=1 ; + +// creation of curses "Color-Pairs" + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + +// join the windows with the color-pairs + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + +// paint the boxes around the windows (in fact it's inside) + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + // change the color-pairs of the windows again. + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +int loadcontents() +{ + int retval=0; + int x; + char ch; + unsigned long line=0; + + + pdatas=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"opening 0-Byte file"); + pfirst=pmax=pdatas=(data*)(malloc(sizeof(datas))); + (*pdatas).pnext=NULL; + (*pdatas).plast=NULL; + (*pdatas).line=0; + (*pdatas).len=0; + + } + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdatas).vals[x])=ch; + if (feof(fp)) //(*pdatas).vals[x]==EOF) + { + (*pdatas).vals[x]=0; + break; + } + (*pdatas).len=x+1; + ch=fgetc(fp); + } + (*pdatas).line=line++; + if(!(feof(fp))) + { + phelp=pdatas; + if (!(line%500)) {printf("%c",'#');} + pdatas=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); +// BUG: Check for Memory-Full does not work. + if(!pdatas) {abort();} + (*pdatas).plast=phelp; + (*pdatas).pnext=NULL; + } + pmax=pdatas; + + } + return (retval); +} + +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +void unallocmem() +{ +pdatas=pmax; +while((*pdatas).plast) +{ +phelp=(*pdatas).plast; +free(pdatas); +pdatas=phelp; +} +} + +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + // depending on the mode (ascii/hex) set the cursor-position + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // the order is given by the mode (ascii/hex). the last window refreshed + // it the one, in which the cursor appears and the input-focus is. + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +void lineout(unsigned long line) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdatas).line*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,line,1,soffs); + for (z=0;z<(*pdatas).len;z++) + { + ptv = tonumsysx((*pdatas).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,line,1,shex); + for (z=0;z<(*pdatas).len;z++) + { +// TODO: There are many other characters that are displayable. + xascii[z] = (isgraph((*pdatas).vals[z]))?((*pdatas).vals[z]):'.'; + } + mvwaddstr(wascii,line,1,sascii); +} + +void initout() +{ +//Initial output (All) +int i; +bool toggleswitch=false; +pdatas=pfirst; + +if ((*pdatas).pnext == NULL) toggleswitch=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + scrrefresh(); + +if(i>15) pdatas=(*pdatas).plast; +} + +int scrolld() +{ + int resval; + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +int scrollu() +{ + int z=0; + int result; + while(((*pdatas).plast != NULL)&&(z < 16)) + { + pdatas=(*pdatas).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + } + } + return(result); +} + +void switchmode() +{ + if(mode==0) + { + mode=1; // mode-toggle:Hex->Ascii + // recalculate cursor-position + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // mode-toggle:ascii->Hex + // recalculate cursor-position + pos.x=((pos.x*3)-1); + } +} + +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int distance; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the position + actpos=((*pdatas).line*16)+pos.x-1; + // and move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int distance=0; + bool toggleswitch; + data *phelp2; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + unsigned long zhelp; + // im move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + pdatas=pmax; + if ((*pdatas).len < 16) + { + (*pdatas).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).line+1; + pdatas=pmax=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).line=zhelp; + } + while(pdatas!=phelp) + { + for(z=(*pdatas).len-1;z>=0;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + (*pdatas).vals[0]=(*(*pdatas).plast).vals[15]; + pdatas=(*pdatas).plast; + } + + for(z=(*pdatas).len-1;z+1>pos.x;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + pdatas=phelp; + } + // Write value + (*pdatas).vals[pos.x-1]=ch; + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + pdatas=pfirst; + if ((*pdatas).pnext == NULL) toggleswitch=true; + for(z=0;z<16;z++) + { + lineout(z+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +} + +int charout() +{ + int i=0; + int distance; + int posxsave; + int ch; + // Move in memory to cursor-position + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the value + ch=((*pdatas).vals[pos.x-1]); + // move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + return(ch); +} + +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // for the Bits + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +void delactchar() +{ + +} + +int main(int argc, char *argv[]) +{ +//Variables + unsigned int i; // Public counter + int inpch; // The char of input + +//Preperation + printf("GHEX Version 0.5\n"); + //Is there a param? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //open the file + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // set the pointers + initvar(); + // init of other useful varibles + pos.x = pos.y = 1; + filename=argv[1]; + //file -> ram + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // init of terminal + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Main-procedure +initout(); +bottomout(); +scrrefresh(); + +//Event-loop + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + // The Keys F1-F8 (bit-setting) + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + //the delete character-key + case KEY_DC : delactchar(); + break; + + //the insert-key, switch insert mode + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + //Cursor-movement + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + case KEY_END: pdatas=pmax; + for(i=0;((*pdatas).plast) && (i < 16);i++) + { + pdatas=(*pdatas).plast; + } + while((*pdatas).pnext) + { + scrolld(); + } + break; + // input characters + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // fill hch correct (old values) + int xpos=pos.x; // save position + switchmode(); // recalc. coordinates + ptv=tonumsysx(charout(),16); // actual char in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // recalc coordinates + pos.x=xpos; // restore coorinates + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // recalc coordinates + charin(xto10(hch,16),0,xpos); // calc Hex -> Ascii+charin + switchmode(); // and back + pos.x=xpos; // restore positions + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + + } + endscr(); + unallocmem(); + + return (fclose(fp)); +} diff --git a/tiahv9.cc b/tiahv9.cc new file mode 100644 index 0000000..4740862 --- /dev/null +++ b/tiahv9.cc @@ -0,0 +1,1079 @@ +/* + * GHEX -- an advanced HEX-Editor + * Copyright (C) 1999 by Joerg Tretter + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +struct data // one line in Memory +{ +struct data* plast; +struct data* pnext; +unsigned char vals[16]; +unsigned long line; +char len; +}; + +struct cpos // Cursor-Position +{ + char x,y; +}pos; + +char insovr='O'; // Isert/Override-Mode +int mode=1; +WINDOW *stdscr,*woffs,*whex, *wascii, *wtop, *wbot; +const char *topline= " Offset Hex ASCII "; +char xoffs[] = "12345678",*soffs; +char xhex[] = " 14 15 16 32 32 34 20 54 61 67 65 73 61 6D 74 0D ",*shex; +char xascii[] = "1234567890123456",*sascii; +char empty78[]=" "; +int result; +char *filename; +char *ptv="12345678"; +FILE *fp; +int ipoint; +data datas, *pdatas, *pfirst, *phelp, *pmax; + +/*************************************************************************** + * FUNCTION: void initvar() * + * GOOD FOR: Initialization of basic-variables * + ***************************************************************************/ +void initvar() +{ + pfirst=&datas; + (*pfirst).plast=NULL; + (*pfirst).pnext=NULL; + (*pfirst).line=0; + (*pfirst).len=0; + soffs=xoffs; + shex=xhex; + sascii=xascii; +} + +/*************************************************************************** + * FUNCTION: void miniinit() * + * GOOD FOR: Initialization of frequent used variables * + ***************************************************************************/ +void miniinit() +{ +xoffs = " "; +xhex = " "; +xascii = " "; +} + +/*************************************************************************** + * FUNCTION: int screeninit() * + * GOOD FOR: Initialization of the n-curses-screen * + * RESULTS : 1:There was an error / 2:Everything ok. * + ***************************************************************************/ +int screeninit() +{ + int retval=0; + + stdscr= initscr(); + if(start_color()) retval=1; + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + +// Create Curses-space for the windows +//TODO: check whether creation was fine. + woffs =newwin(18,10,3 ,0 ); + whex =newwin(18,52,3 ,10); + wascii=newwin(18,18,3 ,62); + wtop =newwin(3 ,80,0 ,0 ); + wbot =newwin(4 ,80,21,0 ); + +// enable scrolling + scrollok(woffs,1); + scrollok(whex,1); + scrollok(wascii,1); + +// enable Keyboard-control + keypad(stdscr,1); + keypad(whex,1); + keypad(wascii,1); + +// disable echoing of input + noecho(); + +// swich cursor to big size +// TODO: check why this not works in most cases +// if(curs_set(2)==ERR) retval=1 ; + +// creation of curses "Color-Pairs" + if(init_pair(1,COLOR_BLUE,COLOR_BLACK)) retval=1; + if(init_pair(2,COLOR_CYAN,COLOR_BLACK)) retval=1; + if(init_pair(3,COLOR_MAGENTA,COLOR_BLACK)) retval=1; + +// join the windows with the color-pairs + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + +// paint the boxes around the windows (in fact it's inside) + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + // change the color-pairs of the windows again. + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + return(retval); +} + +/*************************************************************************** + * FUNCTION: char* tonumsysx() * + * GOOD FOR: Shift a number to another numbering system * + * INPUTS : - int base10 -The number in decimal system * + * - int newbase -The new system (16->Hex,2->Bin,...) * + * RESULTS : The number in the new system as a pointer of char * + ***************************************************************************/ +char* tonumsysx(int base10,int newbase) +{ + int erg; + int rest=0; + int pos=0; + int i; + static char swap[9]; + char c[9]; + + swap="********"; + c[pos]='0'+rest; + while (base10 > 0) + { + erg=base10/newbase; + rest=base10%newbase; + if (rest <= 9) + c[pos]='0'+rest; + else + c[pos]='A'+(rest-10); + + base10=erg; + pos++; + c[pos]='\0'; + } + while(pos < 8) + { + c[pos]='0'; + pos++; + } + pos--; + for (i=0;i<=pos;i++) + { + swap[i]=c[pos-i]; + } + +return(swap); + + +} + +/*************************************************************************** + * FUNCTION: unsigned long xto10(char *c, int oldbase) * + * GOOD FOR: Shift a number from a foreign numbering system to decimal * + * INPUTS : - char* c -The number in foreign system * + * - int oldbase -The old system (16->Hex,2->Bin,...) * + * RESULTS : The number in decimal system as a unsigned long * + ***************************************************************************/ +unsigned long xto10(char *c, int oldbase) +{ +unsigned long base10=0; +int pos=0; +int i; + for (i=0;c[i];i++, c[i]=toupper(c[i])); + while(c[pos++]); + pos--; + int len=pos-1; + while(pos--) + { + if(isdigit(c[len-pos])) + { + base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ; + } + else + { + base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) ); + } + } + return(base10); +} + +/*************************************************************************** + * FUNCTION: int loadcontents() * + * GOOD FOR: Loading the contents of a file into the memory * + * RESULTS : The status of the loading (not used yet) * + ***************************************************************************/ +int loadcontents() +{ + int retval=0; + int x; + char ch; + unsigned long line=0; + + + pdatas=pfirst; + ch=fgetc(fp); + // Zero-byte-file. + if(feof(fp)) + { + fprintf(stderr,"opening 0-Byte file"); + pfirst=pmax=pdatas=(data*)(malloc(sizeof(datas))); + (*pdatas).pnext=NULL; + (*pdatas).plast=NULL; + (*pdatas).line=0; + (*pdatas).len=0; + + } + // TODO: how to flush the buffer of stdout??? + printf("Printing hashmark for every 8 Kbytes.\n"); + while (!(feof(fp))) + { + for(x=0;x<16;x++) + { + ((*pdatas).vals[x])=ch; + if (feof(fp)) //(*pdatas).vals[x]==EOF) + { + (*pdatas).vals[x]=0; + break; + } + (*pdatas).len=x+1; + ch=fgetc(fp); + } + (*pdatas).line=line++; + if(!(feof(fp))) + { + phelp=pdatas; + if (!(line%500)) {printf("%c",'#');} + pdatas=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); +// BUG: Check for Memory-Full does not work. + if(!pdatas) {abort();} + (*pdatas).plast=phelp; + (*pdatas).pnext=NULL; + } + pmax=pdatas; + + } + return (retval); +} + +/*************************************************************************** + * FUNCTION: void endscr() * + * GOOD FOR: End the scrren session on curses-level * + ***************************************************************************/ +void endscr() +{ + delwin(woffs); + delwin(whex); + delwin(wascii); + delwin(wtop); + delwin(wbot); + endwin(); +} + +/*************************************************************************** + * FUNCTION: void unallocmem() * + * GOOD FOR: Free the memory from the bits & bytes * + ***************************************************************************/ +void unallocmem() +{ +pdatas=pmax; +while((*pdatas).plast) +{ +phelp=(*pdatas).plast; +free(pdatas); +pdatas=phelp; +} +} + +/*************************************************************************** + * FUNCTION: void scrrefresh() * + * GOOD FOR: Refreah the basic-screen-elements (not the contents) * + ***************************************************************************/ +void scrrefresh() +{ + wattrset(woffs,COLOR_PAIR(1)); + wattrset(whex,COLOR_PAIR(1)); + wattrset(wascii,COLOR_PAIR(1)); + wattrset(wbot,COLOR_PAIR(1)); + wattrset(wtop,COLOR_PAIR(1)); + + box(woffs,0,0); + box(whex,0,0); + box(wascii,0,0); + box(wtop,0,0); + box(wbot,0,0); + + wattrset(woffs,COLOR_PAIR(2)); + wattrset(whex,COLOR_PAIR(2)); + wattrset(wascii,COLOR_PAIR(2)); + wattrset(wtop,COLOR_PAIR(3)); + wattrset(wbot,COLOR_PAIR(2)); + + // depending on the mode (ascii/hex) set the cursor-position + !mode?wmove(whex,pos.y,pos.x):wmove(wascii,pos.y,pos.x); + + wrefresh(woffs); + wrefresh(wtop); + wrefresh(wbot); + // the order is given by the mode (ascii/hex). the last window refreshed + // it the one, in which the cursor appears and the input-focus is. + !mode?wrefresh(wascii):wrefresh(whex); + mode?wrefresh(wascii):wrefresh(whex); +} + +/*************************************************************************** + * FUNCTION: void lineout(unsigned long line) * + * GOOD FOR: Writing one line (the actual one) from the memory to screen * + ***************************************************************************/ +void lineout(unsigned long line) +{ + int z; + + miniinit(); + + ptv = tonumsysx((*pdatas).line*16,16); + for(z=0;z<9;z++) + { + xoffs[z] = *(ptv+z); + } + mvwaddstr(woffs,line,1,soffs); + for (z=0;z<(*pdatas).len;z++) + { + ptv = tonumsysx((*pdatas).vals[z],16); + xhex[z*3+1] = *(ptv+6); + xhex[z*3+2] = *(ptv+7); + } + mvwaddstr(whex,line,1,shex); + for (z=0;z<(*pdatas).len;z++) + { +// TODO: There are many other characters that are displayable. + xascii[z] = (isgraph((*pdatas).vals[z]))?((*pdatas).vals[z]):'.'; + } + mvwaddstr(wascii,line,1,sascii); +} + +/*************************************************************************** + * FUNCTION: void initout() * + * GOOD FOR: First output after loading the file // home-Key * + ***************************************************************************/ +void initout() +{ +//Initial output (All) +int i; +bool toggleswitch=false; +pdatas=pfirst; + +if ((*pdatas).pnext == NULL) toggleswitch=true; +for(i=0;i<16;i++) + { + lineout(i+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + scrrefresh(); + +if(i>15) pdatas=(*pdatas).plast; +} + +/*************************************************************************** + * FUNCTION: int scrolld() * + * GOOD FOR: Scrolling the scrren one line down * + * RESULTS : 1: no more elements // 0: everything was nice * + ***************************************************************************/ +int scrolld() +{ + int resval; + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + wscrl(woffs,1); + wscrl(whex,1); + wscrl(wascii,1); + + miniinit(); + + lineout(16); + resval=1; + } + else + { + resval=0; + } + return(resval); +} + +/*************************************************************************** + * FUNCTION: int scrollu() * + * GOOD FOR: Scrolling the scrren one line up * + * RESULTS : 1: at first element // 0: everything was nice * + ***************************************************************************/ +int scrollu() +{ + int z=0; + int result; + while(((*pdatas).plast != NULL)&&(z < 16)) + { + pdatas=(*pdatas).plast; + z++; + } + result= (z!=15)?1:0; + if(z>15) + { + z--; + wscrl(woffs,-1); + wscrl(whex,-1); + wscrl(wascii,-1); + + miniinit(); + + lineout(1); + } + while(z--) + { + if ((*pdatas).pnext != NULL) + { + pdatas=(*pdatas).pnext; + } + } + return(result); +} + +/*************************************************************************** + * FUNCTION: void switchmode() * + * GOOD FOR: recalculation of cursor-position ascii<->hex * + ***************************************************************************/ +void switchmode() +{ + if(mode==0) + { + mode=1; // mode-toggle:Hex->Ascii + // recalculate cursor-position + pos.x=((pos.x+1)/3); + } + else + { + mode=0; // mode-toggle:ascii->Hex + // recalculate cursor-position + pos.x=((pos.x*3)-1); + } +} + +/*************************************************************************** + * FUNCTION: void moveleft() * + * GOOD FOR: move the cursor one position to the left * + ***************************************************************************/ +void moveleft() +{ + if(mode==0) + { + if(pos.x > 2) + { + (pos.x%3)?pos.x-=2:pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=48; + } + else + { + if(scrollu())pos.x=48; + } + } + } + else + { + if(pos.x > 1) + { + pos.x--; + } + else + { + if(pos.y >1) + { + pos.y--; + pos.x=16; + } + else + { + if(scrollu())pos.x=16; + } + } + } +} + +/*************************************************************************** + * FUNCTION: void moveright() * + * GOOD FOR: move the cursor one position to the right * + ***************************************************************************/ +void moveright() +{ + if(mode==0) + { + if(pos.x < 48) + { + (pos.x%3)?pos.x++:pos.x+=2; + } + else + { + if(pos.y < 16) + { + pos.x=2; + pos.y++; + } + else + { + if(scrolld()) pos.x=2; + } + } + } + else + { + if((pos.x < 16)) + { + pos.x++; + } + else + { + if(pos.y < 16) + { + pos.x=1; + pos.y++; + } + else + { + if(scrolld()) pos.x=1; + } + } + } +} + +/*************************************************************************** + * FUNCTION: unsigned long getactpos() * + * GOOD FOR: get the acutal cursor-position as a file-offset * + * RESULTS : The file-offset on the cursor-position as unsigned long * + ***************************************************************************/ +unsigned long getactpos() +{ + int i=0; + unsigned long actpos; + int distance; + int posxsave=9999; + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the position + actpos=((*pdatas).line*16)+pos.x-1; + // and move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + if (posxsave!=9999) + { + switchmode(); + pos.x=posxsave; + } + + return(actpos); +} + +/*************************************************************************** + * FUNCTION: void charin(char ch, int realmode, int realxpos) * + * GOOD FOR: insert/override one character in the memory * + * INPUTS : - char ch -the char to insert * + * - int realmode -the real mode (hex/ascii) * + * - int realxpos -the real x-position of the cursor * + ***************************************************************************/ +void charin(char ch, int realmode, int realxpos) +{ + int i=0; + int z=0; + int distance=0; + bool toggleswitch; + data *phelp2; + char rbmode; //rollbackmode (if file < 255 chars = 1 else 2) + unsigned long zhelp; + // im move to the cursor-position in memory + // Is the file smaller then one page, it has to be handled in another way. + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + rbmode=1; + } + else + { + distance=16-pos.y; + rbmode=2; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // For the insert-mode + if (((insovr=='I') && (realmode==1))||((insovr=='I') && (realmode==0) && (realxpos%3==2)) && (realmode!=3)) + { + phelp=pdatas; + pdatas=pmax; + if ((*pdatas).len < 16) + { + (*pdatas).len++; + } + else + { + // allocate new element + phelp2=pmax; + zhelp=(*pmax).line+1; + pdatas=pmax=((*pdatas).pnext)=(data*)(malloc(sizeof(datas))); + if(!pmax) {abort();} + (*pmax).plast=phelp2; + (*pmax).pnext=NULL; + (*pmax).len=1; + (*pmax).line=zhelp; + } + while(pdatas!=phelp) + { + for(z=(*pdatas).len-1;z>=0;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + (*pdatas).vals[0]=(*(*pdatas).plast).vals[15]; + pdatas=(*pdatas).plast; + } + + for(z=(*pdatas).len-1;z+1>pos.x;z--) + { + (*pdatas).vals[z]=(*pdatas).vals[z-1]; + } + pdatas=phelp; + } + // Write value + (*pdatas).vals[pos.x-1]=ch; + // refresh output of current line (not needed, I think) + lineout(pos.y); + // moving backwards again and print the lines immediate. + if (rbmode==1) + { + pdatas=pfirst; + if ((*pdatas).pnext == NULL) toggleswitch=true; + for(z=0;z<16;z++) + { + lineout(z+1); + if (toggleswitch) break; + pdatas=(*pdatas).pnext; + if ((*pdatas).pnext == NULL) toggleswitch=true; + } + } + else + { + while(i--) + { + if((*pdatas).pnext) + { + pdatas=(*pdatas).pnext; + lineout(16-i); + } + } + } +} + +/*************************************************************************** + * FUNCTION: int charout() * + * GOOD FOR: get the char at the actual cursor-position * + * RESULTS : the char as an integer (char should work too normaly) * + ***************************************************************************/ +int charout() +{ + int i=0; + int distance; + int posxsave; + int ch; + // Move in memory to cursor-position + if (!mode) + { + posxsave=pos.x; + switchmode(); + } + // move in Memory to the cursor-position + if((pdatas==pmax) && ((*pdatas).line<15)) + { + distance=(*pdatas).line-pos.y+1; + } + else + { + distance=16-pos.y; + } + while(i<(distance)&&((*pdatas).plast)) + { + i++; + pdatas=(*pdatas).plast; + } + // get the value + ch=((*pdatas).vals[pos.x-1]); + // move back + while(i--) + { + pdatas=(*pdatas).pnext; + } + return(ch); +} + +/*************************************************************************** + * FUNCTION: void bottomout() * + * GOOD FOR: refreshing the output of the bottom-window * + ***************************************************************************/ +void bottomout() +{ + int realmode,realposx; + realmode=mode; + + if (realmode == 0) + { + realposx=pos.x; + switchmode(); + } + mvwaddstr(wbot,1,1,empty78); + mvwaddstr(wbot,2,1,empty78); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,1,"CHR:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddch(wbot,1,6,32); + mvwaddch(wbot,1,5,(isgraph(charout()))?charout():'.'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,9,"HEX:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,13,(tonumsysx(charout(),16))+6); + mvwaddch(wbot,1,15,'h'); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,18,"DEC:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,22,(tonumsysx(charout(),10))+5); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,27,"OCT:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,31,(tonumsysx(charout(),8))+4); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,37,"BIN:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,41,tonumsysx(charout(),2)); + + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,52,"Offset:"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,59,tonumsysx(getactpos(),16)); + wattrset(wbot,COLOR_PAIR(3)); + mvwaddstr(wbot,1,67,"h -"); + wattrset(wbot,COLOR_PAIR(2)); + mvwaddstr(wbot,1,71,tonumsysx(getactpos(),10)); + + mvwaddstr(wbot,2,1,filename); + mvwaddstr(wbot,2,76,(insovr=='O')?"OVR":"INS"); + if (realmode == 0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void swapbits() * + * GOOD FOR: toggle the bit [par1] an the actual position * + * INPUTS : - char bit the number (1-8) of the bit to toggle * + ***************************************************************************/ +void swapbits(char bit) +{ + char bin[]="12345678",*pbin; // for the Bits + pbin=bin; + int realposx, realmode; + realmode=mode; + if (realmode==0) + { + realposx=pos.x; + switchmode(); + } + pbin=tonumsysx(charout(),2); + pbin[bit]= (pbin[bit]=='0')?'1':'0'; + charin(xto10(pbin,2),3,pos.x); + if (realmode==0) + { + switchmode(); + pos.x=realposx; + } +} + +/*************************************************************************** + * FUNCTION: void delactchar() * + * GOOD FOR: delete the char under the actual cursor-position * + ***************************************************************************/ +void delactchar() +{ + +} + +int main(int argc, char *argv[]) +{ +//Variables + unsigned int i; // Public counter + int inpch; // The char of input + +//Preperation + printf("GHEX Version 0.5\n"); + //Is there a param? + if(argc < 2) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nUSAGE: %s \n",argv[0]); + exit(1); + } + //open the file + fp=fopen(argv[1],"r"); + if (fp == NULL) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR opening file: %s \n",argv[1]); + exit(2); + } + // set the pointers + initvar(); + // init of other useful varibles + pos.x = pos.y = 1; + filename=argv[1]; + //file -> ram + if(loadcontents()) + { + fprintf(stderr,"GHEX-MESSAGE:\n\nERROR reading %s (too less RAM?)\n",argv[1]); + exit(3); + } + // init of terminal + if(screeninit()) + { + endscr(); + fprintf(stderr,"!!!Terminal not supported!!! -> Abort \n"); + exit(5); + } + mvwaddstr(wtop,1,1,topline); + + +//Main-procedure +initout(); +bottomout(); +scrrefresh(); + +//Event-loop + while(inpch!=KEY_F(10)) + { + if (mode==0) + { + inpch=wgetch(whex); + } + else + { + inpch=wgetch(wascii); + } + switch(inpch) + { + // The Keys F1-F8 (bit-setting) + case KEY_F(9): switchmode(); + break; + + case KEY_F(1): swapbits(0); + break; + + case KEY_F(2): swapbits(1); + break; + + case KEY_F(3): swapbits(2); + break; + + case KEY_F(4): swapbits(3); + break; + + case KEY_F(5): swapbits(4); + break; + + case KEY_F(6): swapbits(5); + break; + + case KEY_F(7): swapbits(6); + break; + + case KEY_F(8): swapbits(7); + break; + + //the delete character-key + case KEY_DC : delactchar(); + break; + + //the insert-key, switch insert mode + case KEY_EIC: //fallthru + case KEY_IC : if (insovr=='O') + { + insovr='I'; + } + else + { + insovr='O'; + } + break; + + //Cursor-movement + case KEY_LEFT: moveleft(); + break; + + case KEY_RIGHT:moveright(); + break; + + case KEY_DOWN: if(pos.y>15) + { + scrolld(); + } + else + { + pos.y++; + } + break; + + case KEY_UP: if(pos.y<2) + { + scrollu(); + } + else + { + pos.y--; + } + break; + + case KEY_NPAGE:for(i=0;i<16;i++) + { + scrolld(); + } + break; + + case KEY_PPAGE:for(i=0;i<16;i++) + { + scrollu(); + } + break; + + case KEY_HOME: initout(); + break; + + // BUG: should only work when file > one screen + case KEY_END: pdatas=pmax; + for(i=0;((*pdatas).plast) && (i < 16);i++) + { + pdatas=(*pdatas).plast; + } + while((*pdatas).pnext) + { + scrolld(); + } + break; + // input characters + default: if(mode==0) + { + if(isdigit(inpch) || (toupper(inpch)>='A' && toupper(inpch)<='F') ) + { + waddch(whex,toupper(inpch)); + char hch[]="00"; + // fill hch correct (old values) + int xpos=pos.x; // save position + switchmode(); // recalc. coordinates + ptv=tonumsysx(charout(),16); // actual char in Hex. + //* --- DEBUG ONLY + mvwaddstr(wbot,2,30,tonumsysx(charout(),16)); + // --- END DEBUG + switchmode(); // recalc coordinates + pos.x=xpos; // restore coorinates + if (insovr=='O') // Predef. only in Override! + { + hch[0] = *(ptv+6); + hch[1] = *(ptv+7); + } + else // In Insert only first char + { + if(pos.x%3==0) + hch[0] = *(ptv+6); + } + //* --- DEBUG ONLY + mvwaddstr(wbot,2,1,hch); + mvwaddstr(wbot,2,20,ptv); + // --- END DEBUG + hch[(pos.x%3)?0:1]=inpch; + switchmode(); // recalc coordinates + charin(xto10(hch,16),0,xpos); // calc Hex -> Ascii+charin + switchmode(); // and back + pos.x=xpos; // restore positions + moveright(); + } + } + + else + { + if((inpch < 256)) + { + waddch(wascii,inpch); + charin(inpch,1,pos.x); + moveright(); + } + } + }; + + bottomout(); + scrrefresh(); + + } + endscr(); + unallocmem(); + + return (fclose(fp)); +} diff --git a/uu b/uu new file mode 100644 index 0000000..32e2f22 --- /dev/null +++ b/uu @@ -0,0 +1 @@ + diff --git a/webprefs b/webprefs new file mode 100644 index 0000000..d31cd7c --- /dev/null +++ b/webprefs @@ -0,0 +1,5 @@ +Homepage: http://www.fortunecity.de/wolkenkratzer/messeturm/358 +user: ghex +Pass: bitmaster + +ftp: ftp.fortunecity.de diff --git a/x b/x new file mode 100644 index 0000000000000000000000000000000000000000..bbd09e838ad0356f0d59826c1b0b002f48cec75f GIT binary patch literal 23734 zcmdsfdwi7Dx$c_D1O^NwARs7PM+M8JjtK@tC^lS%ixL0=<(*#zg5NL3ZF<9bHofW zO^iVh<8qrp19uSbbm?#&xHPyI=@3VEDc}4|folj&d=N8>%X{-B49_eN{zGw9(&C>t7(mY=qwgHxKR# zxcP8=z*bx)-xOcUcCE%!;b+55gqs3)72I`jd_D^I5&5S6%z`%oE)!0cLj}vfm*Z~^ zoEPqDxEXMKs3*$od=@$Z-lxGWa)hxQGvS~H`P_)V=N}wkJl_2dY+k8f^Z4*W$2x=ux!)P0 zjQd_n;g197#Xa6T;7^7I1MtOvdc3U5$&l_g__?hfZ-vA{l)^ui@OWvqEbA_~Zs2F& zQwMv9!7m$v5buXO0DLce(kI|v1iuI>hWK-EtAJmFPy8=%N5QWNMo4^^80nt|KjLq} z^#k9j@e{yRFMGVy=Ok#X1AZ>jlP~Gdz#Ra8+9UCEaHo(ysPWI>mw~=P%hLrs3wXVb zf0G#LOEgZx?*}Fy@_QHVJoHO`%zp^}6vWdm7(W(r9ss}d8fO5XLi|Q8|E2IBg*=-y zz8wB$#2b090`3Ohjr7##Y+w)gb!hxi;G>8)wzm*Cf_Ung`7b3s;yd6IFNgmk@?$$7 zztzBHh+m0!#^(b+3Vf%=pCCQ>A;Nt4KVv! zBuASbFMbC+@Pm~7{}K2_NBbBYfxT`a`j8*fv;BzT;_cP7HN_2)lKMz-u|QW?QyQ&r z2sN-H%oW9}?%c3Ef89z^yk`Bz70cHbZ(O~4Q($xP=H)Ba2Z}{;MNLIS6qmyTr?OCe zXnRFNBvfBqUSCojLTq_0!bb}&uMdSpbxBoKZK>GVP+DIlc9xWtm4>BP(-5f_JGa%= zgQHNQmDX0()(d7=Tvt-T&@!YFWudB_6*Z!!HdGp}6``6kqMh4A5pt@o-4PNy>qE$^ zAuQ7}N%6XkC@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`xA?fM`zlLSQrAvp#PF?n8P+%lZuho4p$5Uj%#r`JG2F^}P-Fpd-Hu;ARJ|0e%$pvo-w= z;G@9i-q1b3rhc*@PXgHNeKEf;0iOc>tvda;fL{d81EziO7ZE&BhX;8t6;I-&8}ZNR z_@^16A0K@#8@W>Smx}GBr3;F&?5o4^N10!g)<+s5(eiS{)Zwb!;^I}CHx?AHU$<#9 z?vEr{6>b?U^WTV=vfAS9Rkhnns*2@$vbZGLh|s{=;?+3)2o$dftXa1KiI`7uS+u%( zm#E!V87htV7YlWPqza@gIv%G?TZLz+=aHS(}XMS=StMijIfeovWlNQzhC5A%V z!=XlhX{l(~SyG4mi$}EI@4(_iKVsU3OVsCmNAq>VD1Aa7n!((Kk@)+ZvtsUslzYl$F+EE1)LQAh|g& zv(&d=*3~wsTPgMJno@i6&P?V}QG;}pzb+iAsuOjQ9i!bFsqVH^w|h3!;y6y=NUB0| zVj1|dqoiI+pvrAd*KmEO)Q-7W)4qMPQF1{Qje18Y6_&dBv!)hTZ|aLF_0^iVn>nP^ zQ&=S$Begl%$UIoeTSrIUmDxbO@83NFdho6?+A_5)*=b+z z8G;Ervx8m{CwcHj(W+3nW~lB9)%TXFt3sW3YF3xvHc@7e)cW$!GRZ~d6ty|lS8NX} zmineq+-h1<3OkZ2rjYvDPj#cIzVnod*Gg(sN>}%=s>?tlwXzUG-$9BSP@~ul(l?`4 z)HKxYs24ElNNu&TI(?(6y4*C114vxWS{)qSfwS@ZH@ J*%7ze{vXP*!59Dl literal 0 HcmV?d00001 diff --git a/y b/y new file mode 100644 index 0000000..e69de29 diff --git a/zweites.cc b/zweites.cc new file mode 100644 index 0000000..b253bd0 --- /dev/null +++ b/zweites.cc @@ -0,0 +1,58 @@ +#include + +int main() +{ + WINDOW *stdscr,*w1,*w2; + char str1[] = "Zwei",*Pstr; + + int z; + +Pstr=str1; + +stdscr = initscr(); +int sc=start_color(); + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); +// Zwei Fenster + w1=newwin(10,10,0,0); + w2=newwin(10,10,0,20); + +// Scrollen erlauben + scrollok(w1,1); + scrollok(w2,1); + +// Color-Pairs anlegen (Farbkombinationen) + int cp=init_pair(1,COLOR_MAGENTA,COLOR_BLUE); + cp=init_pair(2,COLOR_BLUE,COLOR_MAGENTA); + COLOR_PAIR(1); + + for (z=0;z < 500;z++) + { + str1[1]='A'+(z%19); + +// Color-Pair1 fr window w1 benutzen + wattrset(w1,COLOR_PAIR(1)); + if (z > 9) wscrl(w1,1); + wmove(w1,z < 9?(z%9):9,0); + waddstr(w1,Pstr); + wrefresh(w1); + + wattrset(w2,COLOR_PAIR(2)); + if (z > 9) wscrl(w2,-1); + wmove(w2,z<9?(z%9):0,0); + waddstr(w2,Pstr); + wrefresh(w2); + + usleep(100); + usleep(100); + usleep(100); + usleep(100); + usleep(100); + } + sleep(1); + delwin(w1); + delwin(w2); + endwin(); + return 0; +}