home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / code / p_make_b.sit < prev    next >
Encoding:
Text File  |  1988-09-25  |  21.9 KB  |  417 lines

  1. 24-Sep-88 01:35:34-MDT,22837;000000000001
  2. Return-Path: <INFO-MAC-REQUEST@SUMEX-AIM.Stanford.EDU>
  3. Received: from SUMEX-AIM.Stanford.EDU by SIMTEL20.ARMY.MIL with TCP; Sat, 24 Sep 88 01:35:08 MDT
  4. Return-Path: <milne@ICS.UCI.EDU>
  5. Received: from ICS.UCI.EDU by SUMEX-AIM.Stanford.EDU with TCP; Fri, 23 Sep 88 19:42:59 PDT
  6. Received: from ics.uci.edu by ICS.UCI.EDU id aa23760; 23 Sep 88 19:20 PDT
  7. To: info-mac%sumex-aim.stanford.edu@ICS.UCI.EDU
  8. Subject: Here is a Turbo Pascal make-binhex
  9. Date: Fri, 23 Sep 88 19:20:26 -0700
  10. From: Alastair Milne <milne@ICS.UCI.EDU>
  11. Message-ID:  <8809231920.aa23760@ICS.UCI.EDU>
  12. ReSent-Date: Fri, 23 Sep 88 22:41:13 PDT
  13. ReSent-From: Lance Nakata <INFO-MAC-REQUEST@SUMEX-AIM.Stanford.EDU>
  14. ReSent-To: macintosh%felix.uucp@ics.uci.edu, SHULMAN@sdr.slb.com,
  15.     RTHUM@SIMTEL20.ARMY.MIL
  16. ReSent-Message-ID: <12433027748.19.INFO-MAC-REQUEST@SUMEX-AIM.Stanford.EDU>
  17.  
  18.  
  19.    This is a version of BinHex4.Pas, modified for Turbo Pascal 1.1 .
  20.    Consider it a small thank-you for the several useful things I've acquired
  21.    from the info-mac repository.
  22.  
  23.    As the important parts of Binhex4.pas are undocumented, I had some 
  24.    guessing to do about the function of the non-Turbo constructs; but my
  25.    guesses appear to have been correct, as I now have a working BinHex4,
  26.    and have decoded many an HQX file with it.
  27.  
  28.    I regret that this does not conform will to Mac interface standards,
  29.    but it is so brief and simple (in its appearance anyway) that it wouldn't
  30.    make much difference.  Anybody who wants to put in the time to cover
  31.    the remaining distance is more than welcome to do so.  I wrote it on a Mac
  32.    II under Multifinder, where both it and BinHex seem to work fine.
  33.  
  34.    The program uses 3 Mac units, but these are built into the Turbo compiler,
  35.    so this source and a runing Turbo 1.1 should be all you need to create
  36.    BinHex4
  37.  
  38.    Enjoy.
  39.  
  40.    Alastair Milne
  41.  
  42. ----------------------------- cut here -------------------------------
  43. program Make_Binhex4;
  44. { Generates the application BinHex4.  So far it has always placed BinHex 
  45.      in the current folder. }
  46. { Requires at least 512K }
  47. { MakeMakers, by Steve Brecher,
  48.     generated this program on 7/6/85 }
  49. { This version adapted for Turbo Pascal 1.1, September 1988, by Alastair Milne.
  50.     It runs on the Mac II; it hasn't yet been tested on any other Mac.
  51.     It works with no apparent problem under MultiFinder.  (Note that, when
  52.     compiling with Turbo under Multifinder, compiles to memory should be 
  53.     avoided, as Turbo starts to screw up badly.  Compiling to disk, then
  54.     running the newly compiled file with Turbo suspended, works fine; and is
  55.     in fact somewhat safer, since an accidental crash won't cost you the 
  56.     running code.)
  57.   As each launch of this program simply generates BinHex, then quits, 
  58.     I have contented myself with Turbo Pascal's default, menuless startup 
  59.     window, and not attempted to make it more conventional for the Mac.   
  60.     Though it would improve the appearance to install proper windowing 
  61.     and menus, I doubt it would make any difference to the operation.  
  62.     Anybody who wishes to polish it a bit is more than welcome to do so.}
  63.   
  64.   USES Memtypes, QuickDraw,OSIntf;
  65. {}
  66. {}
  67. {}
  68. {}
  69. {}
  70. {}
  71. { Select "Go" from "Run" menu. }
  72. {}
  73. {}
  74. {}
  75. {}
  76. {}
  77. {}
  78. {}
  79.  const
  80.   DataLines = 167;
  81.   CodeWords = 129;
  82. {}
  83.  var
  84.   TextRect : rect;
  85.   D : array[1..DataLines] of string[66];
  86.   Code : array[1..CodeWords] of integer;
  87. {}
  88.  procedure InitDataArray;
  89.  var
  90.   i : integer;
  91.  begin
  92.   for i := 1 to DataLines do
  93.    D[i] := ''; {set all values in case any lines were dropped}
  94. D[1] := '4E56FF80204E42A0BFC865FA41EEFFB043FA00E221490012316100186620A008';
  95. D[2] := '670C0C40FFD0660EA009660A60F0117C0003001BA00A660000A632A80018222E';
  96. D[3] := '000867000062214F0020703021400024224172001219E4495341244F76287000';
  97. D[4] := '7403ED889711801951CAFFF815400002E0481540000148401480564A51C9FFE0';
  98. D[5] := '705A244F722FE318141AB50051C9FFF812199203E54997118211B00167047201';
  99. D[6] := '6034A0036038217C00001D81001CA012662242A8001CA00C661A700180290002';
  100. D[7] := '43F1000345E8002024FC4150504C24D93491A00D3200A0014A41670230013200';
  101. D[8] := '6704A009A0134E5E205F584F225F32814ED000000742696E68657834426E4871';
  102. D[9] := '2000';
  103. D[10] := '((()((((/*D(()TO((()>N1M0.5WCOAMDO9MA*)_B?9P0,1QCLIMF*a0A?HQ+8PKc+';
  104. D[11] := '8=)8;,1V:/,L4K(X4(\22JPR<L=;;]=:8\<H9Le::X\24+(X4+(Y4+(X4+(X4<4Z@+';
  105. D[12] := '4[(X4+(Y8K0[4+(X4+(Y5<,Z4+8`5+<]6+0X4K(Z4+0X4K([4+<Y4K(X4+(X5;0]I+';
  106. D[13] := '4X\25;0\4[(X4+(X4+,`5+0\9;8`5;,X4+(X4+(Z4+(X4+(Y5[8Z5KL^9;8`5K<_P)';
  107. D[14] := '6+0X5[@[5+1-4[(Z4+1,4L8Z4(\24[([4K1.4[,[6+1.4[H[5;<Z5;4]4K8[4+(X\)';
  108. D[15] := '4+(Y4+(\6;8[5,<Z4[(X6(((()H?8NMV:.=`0/@\3K(H3:\H4+0W4;LW6+<(((,(:*';
  109. D[16] := '+ggf((H((X(0((2(*()*8(H(@J(0Gg08*/gcf(Igd(H0D.(0*/)(*(IX((H0D((0H*';
  110. D[17] := '*/((*(IX((H0D+d0*GY(J(K`H,H0D;(P**/0.(H6GXd,(K(/(H,()X,(H(D(H.(/F+';
  111. D[18] := '(,(GaX(H(Id(,(8/((H0(((,,((((J((((-(((((H((7gg`(+ggg((ggg`(7ggg(@*';
  112. D[19] := '+ggg`(gggg(7ggg`+gggf(ggggH7ggg`+gggf(ggggH7ggg`+gggf(ggggH7ggg`\+';
  113. D[20] := '+gggf(ggggH7ggg`+ggggXGgggd+gggg(GgggX+gggd(Gggg(+gf/X(Gg(D(+gH(@*';
  114. D[21] := '((GX(((+`((((D((((*((((((8(7gg`(*((+((Q0(P(1<(1(*((*0(T@(I(0((7`-*';
  115. D[22] := '*=((*(Q0((H0(((0*(((*(H(((H0(((0*(*(*(H)8(H0(J(0*(8`*(H09@H0,360J*';
  116. D[23] := '*(OeJ(H,T@H0(T.0*(-gJ(H(H@H0(((0*(((*(H(((H0(((0*(((*(H(((H0(((0S*';
  117. D[24] := '+gggf(gggH(7ggd(+gggH(gggd(7gggH+gggd(ggggH7ggg`+gggf(ggggH7ggg`;(';
  118. D[25] := '+gggf(ggggH7ggg`+gggf(ggggH7ggg`+gggf(ggggH7ggg`+gggf(ggggH7ggg`>*';
  119. D[26] := '+gggf(ggggH7ggg`+gggf(ggggH7ggg`+gggf(ggggH7ggg`(((()\-8<,X(((((3+';
  120. D[27] := '(((/=,=@=(()(((((*9*CLIY(((((<M+;J4((8(((0(((8*)9M1-9H()((((H(()N(';
  121. D[28] := '(0,(((*((((((((7((((*@((((M((((1`(((**((((HH(((00(((GgX((*(0(()g;*';
  122. D[29] := 'g(((8(8((-(<(()()(()X(F((,(,H()()0((<):((,(,H()gg1`(0(Kf(/gd/H(*))';
  123. D[30] := 'H(((),((((IX(((8JX((0>D(()7c(((1@X(()@4(((3g((()(X(((((Q((,(((((,*';
  124. D[31] := '(((((7ggggT)-(])@Ne]E*)*B>a0A?K1((((((,U((((((((((**((0(((((((((8+';
  125. D[32] := '(7gggcD,9NMTA9=)D/)TB>5IE.MWCJ(U7J)=D.YW@>8(=8((-\9WE^aTC^-L0*\f/*';
  126. D[33] := '0,-XD.YQ@^-\B>eV(,8(((,U((((((U<9=I<0.AQC/9MDH((,H(68>9L0.YQCN<HM)';
  127. D[34] := 'AN=MA/4((((((:\((((()--]B?8(<8(((((((,H((X((((((((((ggggfX9-A.M\`+';
  128. D[35] := ')-=VA.d(>H(((:\((((((\5]E()@(((,8^eXF8)+(((-<.-[E.<(=H(()<5TA>-ZZ*';
  129. D[36] := '(((((((((((=(,@(A(*V(A(((8((((((((((((,(((((LH(,(((((()((6@(=(,Jc(';
  130. D[37] := ')(17:X((((((-(+\(+8)-2(*(0((((((()8(*H(L(4J0,L1QCLIMF*)^5*`X0*(P<*';
  131. D[38] := ':/-`28((((((3((2(+X(Z0HAE_1QE/9MCJ)JF:)AEN=[0,YMC?)MDN=]DH((((((1(';
  132. D[39] := '(,8(*H)<(4J0.L5WD/MZB>EPE*(Y6;H]0.1a0,]IB>a[E.-a((((+()L(.8(WH.8.*';
  133. D[40] := '((M==8(((*P((8((((((7(+N(-()0H8*;\T(((((()T(:((S(9J0*=`X0.=ZDNeZW*';
  134. D[41] := '3H(((((;(,@(A(*b(A(((8,(((((((((((((()4(2((<(9H)c(()(8((((((((((Z+';
  135. D[42] := '((((,X).(.L(B8..((,)((((((((((((()?X(((((<IUggZPCRKfR92Q42O48RFQT)';
  136. D[43] := 'F^,(,G0H7(((ggfH4Kdd((2Qb<2O3[Y88<537[X()bNH0-fH:L2O3[Y.;\a<7[X)K*';
  137. D[44] := 'K2NH0-fH:L2O3[Y.;\a<7[X**BNH0-fH:IUd((/g3IUd((+g3>,(,E)X(.,(+?bQW(';
  138. D[45] := 'U,0O7[X7g\IUgV:QD,PGAf`X3GcL\,(X6X(.;WT((WgH(+;g`((@gf+g`7gH(>3gg(';
  139. D[46] := '`7gHgf+g`.,(,N`X3GcZ*(((*.Fb8RDH3GcN7X*Q7N(((+9I()1:8NDW3GcV:._f?)';
  140. D[47] := 'e2LT4)g88+(c((A6fX(*ga((+H,,ga+gL7f8ga)*QZdUgVbQ7:UGgWHX3Gc`\,(X,(';
  141. D[48] := '6X(.;WT((H(0()@(CH+.8NFQ6/((@8(4].((g]8X3Gcb+,(((>@X8RDg7(()8RDWA*';
  142. D[49] := '77ggggfQG*U?gZJQ-<2O:._fg2N94*_fg(Y(((-NcJdUgZJQH^*`8RDg7(()R<LgC*';
  143. D[50] := '3Gcb:._fQ2M.8NE0CGbLRCA2?^*B4*_ffU)(4+T()Lcc((3gK(*<(FcgK((8(*[g+*';
  144. D[51] := 'K()0*J\((GdV8RDg7((*R<Lg7((,/Z_g3RM-@(+g@HPU((/g3<2O7[X((RM17[X(:)';
  145. D[52] := ')9dUgZ^Q9>((g\BQe+(UgWQO(7dd<\)*1[d(RD12/^((gZa0CGcL3Z_fe2N[@(+fN+';
  146. D[53] := 'H.,(,:8X3GcNAX+fE,1O7[X(A+dd(.8W3GcN7[X((2OQ:MeH(7aB7[X(9Kdd(,A0^*';
  147. D[54] := 'FI,P8RDg77gg8RE*Q\IUgHXg7((*RFQ23G`4AX+f\N,(*Z(g7()L7[X(9LIb,7]0-(';
  148. D[55] := 'CGbL8RE0CGa@7[X((BOR:J_f>.D(gRQX).,(*`)1cG`4@8(64N@(+R`SB((HgW`Sc*';
  149. D[56] := 'B((LgX0X2((P(L+`(+U(gX@SB((^gXHSB()(gXYI((V@:F_f>.,(+E9N((a^@8(5Q+';
  150. D[57] := 'XN@(+N1I((_VAH(6>J-d=,=@=((H0?Y*CLIY(*:H+;`P())N((a(D(1-cGPZ:F_fZ+';
  151. D[58] := '>.,(+;AN((`J@8(.;N@(+IQI((=TAH(6,O()9GH((,OUgHYI((\<AH(5e*UUgXKgV*';
  152. D[59] := '1.,()DYN((_N:F_f+.,(+:QN((_BD(--f(((:F_f+.,(+8)N((_02^_g+7dL@8(-/)';
  153. D[60] := 'P.@(+CQ1cG`4@8(4gN@(+BaI((B8AH(5TLOUgMII(([RAH(5QN,(*TII((eP@(+eD+';
  154. D[61] := 'P+dd(,@g7().:/P7[L2O:J_g3N@07[[gg\2O@(Hg7(():/P+?,2O:._f++dd((2QO*';
  155. D[62] := 'bLPUgHYO(7]PD(--f(((:F_f+.,(+.9N((\^@8(13N@(+:`f77gA:L-O((\L8F_dX(';
  156. D[63] := '7.(8,)H4(((bAX`4(((KAX()*-/1gfaH\JU0gYHc8Gd>@8(./.@(+7II((:FAH(4=(';
  157. D[64] := 'd+dd(.8g7().:/P77\IUgR9*Q\IUgMHg7(()RFQ23Ga@AX((UO(,@8(1XN,(*IY1\)';
  158. D[65] := 'cGa@@8(49N@(+31I((X\AH(4P.,(+.)N((Z@0>_fgH(H0>_g(H(L4*_g)P-P(*JH4)';
  159. D[66] := '+;`P())N((YbD(1-cGPZ:F_f>.,(*b9N((YD2^_g*7dL@8(,JN@(+,a1cGa@@8(3B)';
  160. D[67] := 'VN@(+,1X(L?UfK11cGa@@8(3L.@(++(SCGd4gZ9I((9FAH(40LOUgMII((V6AH(4*+';
  161. D[68] := '-LOUgHYI((V*AH(40.,(*>)I((`(@(+d6,OUgHYI((URAH(4+.((g*HSG-9->-;f=)';
  162. D[69] := 'gJUd8Na0DGd*8N_g)HY)((IM,.,((TPS87cf@8(*XJU(gX0488(-A9(4.((LAHQIV*';
  163. D[70] := '((2dA88c87d.@8(0BKdd(.8g7().:/P6,\IUgR9*Q\IUgMHg7(()RFQ23Ga@A`QXb)';
  164. D[71] := ').,(*1II((L,:F_f>.,(*YYN((V0@8(3*N@(*_AI((T^AH(3CJ-UgW`(0*-UgX0(@*';
  165. D[72] := '1+(UgXB)B((PP(\f2((8AH(3<,0UgZe*3GdY8N_g,N,()`9N((Td8gP);N,((QQNY(';
  166. D[73] := '+IUd((/g3^,()^YN((TL8gP)9.,((P1N+N,(*1QI((E>AH(3+N(R8gP)6>,((NQNX*';
  167. D[74] := '0.,(*19I((DfAH(2eO(*9F_b4LOUgMII((P`AH(2^.(:D(1-cGPZ:F_f>.,(*HYNZ*';
  168. D[75] := '((S,@8(2P.@(*SYI((B.@(II((D*AH(2SLPUg+YO1L7b(41I((0:AXQI((,4AH(2N*';
  169. D[76] := 'MN+F8gP(_N,((GaN*.,()UAN((R*@8(.0N@(*OQ1cGa@@8(1aN@(*Na+fH*B@8()8)';
  170. D[77] := '^.D(g]A+fH*C@8()[.D(g^11cG`4@8(1XN@(*N)I((FH8gP(O^,((C)N/N,((<9MI)';
  171. D[78] := '83(Ug[-O8,/b*[d83GdY@8()@O`*@((2CL7b(09I((.0AIaI((,@A9JXCGd:AYI)2*';
  172. D[79] := 'fHTJ4*_g,N,((;1f(>((*LAf(^((*L)I((WR@(+b0M9->-8+2JPR+:PR2L57;=):O+';
  173. D[80] := '9=5;9<842JPR9,-<8:).;]13,*PR2M1-<\e=<L5-0,A7<LT62JPR9<a,0,e.0,9)+*';
  174. D[81] := '=,,42JPR8\I-8\U;=<\b)ZPR2L5:8[QI((+N:J_g3^@@+(,((N<b@8((J.<\\:_gg+';
  175. D[82] := '4>,((+1ObN(R7+X(H,1(@8((4K8(@)AI(((R5J_g,UA(a]Tc8gd:@8((+.@.<DSgH(';
  176. D[83] := 'b,1/;O=0a`*(@8(,XL[G(8-6E?@/+(@(H.@B8LA28>D8<\,D.(8.(*(4)H)(A6[MW)';
  177. D[84] := '+H(.((3K+V48<DWg^La]E(7IJ)(@<\-9ZWg`;O=I(((*@8(((I8@<\,2(H(X+(0((+';
  178. D[85] := '*N<2)H0(J8X*(7QM+(0*((gQ:0(*(KX(gLa]7X+H:.,*4)dG(6H0@808/X0(((d()*';
  179. D[86] := '(((X+(((6N<*?H(8X,a]8F_d7,1),IIO+(X8((QN)M20<\-Ne,a]@FA*8I8ATL1MP+';
  180. D[87] := '+.(,TXIN)M/2ggQ*8,a]8N_g,L7UgIA*8909,)MI((+TAJ99ZGg^,*_f->,((5aNd*';
  181. D[88] := '-L7UgWaZ,9(A@8((\.@0<DOgeN,((2Y6E<1UgY1I((.BAKQf(8X((+eJ4L1),H)+])';
  182. D[89] := 'cGbL@(AI((.*AJ0:X-/1ggAI((-^AIA+cGcfDI-I((-RAHP:X-/1ggAI((,d;O=*[(';
  183. D[90] := 'CGd::R_g1.DF@8(+Z.@DLb_g1,7Ug+YH*)(A@8((?N@2<DOgeN+D@8((6,a]@8(+/*';
  184. D[91] := 'M,1UgY12SGdLAY1I((,DAIAI((4bAI);SGdLAVaI((+PAH9I((5,;O=*CGd8@(()P*';
  185. D[92] := '6O((@8((R.,((28X3Gd:4H+H:.,(((AN8+():6E(()0(@8((JLQUgY)O+3(Ug[)O:)';
  186. D[93] := ',.,((*IN/IU)g[)I(()2AI9:CGd8+.\(ggd8A8AI(((4AH1*9\[G((16E8YU((3g3(';
  187. D[94] := ',.<F@HII(((HAYAH.)(d(1)I((+\AH`X3Gd8@8((bN@,8N_g,,a],*_g4.,((5QN6+';
  188. D[95] := ',(X((1)N*/((@8(([.@*8LE6E>.^AH9I((,.;O=0af((5*_g,O0/`XKK<N8,*L08;*';
  189. D[96] := '0=/1gg8c8Wd:;5d()\a]8N_g,.(((>aI(((HAIQI(((BAI92CGd:AXa)fHG04*_g_)';
  190. D[97] := ',N,(gEIf(<a]:N_g,.@H@8()DN@Z+(((L.@J@8()AN@N:H)O--4((L((g[U(gY);f+';
  191. D[98] := 'CGd8,*_g4.(0,+X(L)U(g[)I(7eb8LE6E;Ud((;g-,1UgYAI((0F8gP([.,((AaN6*';
  192. D[99] := '-.,((AaN+O(b@8()XN@.<N_g-L1/;O=0af((5*_g-/0/`XKK,N8P-+TH?4-*@8()8*';
  193. D[100] := 'ON@N<N_g-HYU(,+g-N<2@8()@.@<8N_g-T-*5+X()-/1ge(c8Wd<8LE4_X(/;O<X(+';
  194. D[101] := '3Gd<`XILg)(c()YI((-HAI1X6N,((=IN*N,((:AN).,((>I6E:,J0Z8M1JDP2:PSL)';
  195. D[102] := '3*\X4;0[5+<^6+M(8<1+9,=.9\I1:LU4;<a8<=1;=-=>>-MB>^)I@N5LA>APB>QSF(';
  196. D[103] := 'C.]XD?0U2-9PB?4HANMTA:)UE?5\0.1M0.5WCOAMDO9MA*)_B?9P0,1QCLIMF*(\7+';
  197. D[104] := '3K(Q8F_e7/)g,7X(H-/0ggQ)fWf*8f_e7,1)D+d:4(((,`(8(-/0gg@cG(*(gY9*G(';
  198. D[105] := '9\a]:6EH(+8UgY9Z)XX*(0)N3,QUgYAN).,`AK(HCGd@<R_g.-5UgYA*8I88Bf9)G*';
  199. D[106] := 'cG\d-+(H(.WBa8P((H(*`XSK,-/1gdHc8Wd<8LE4_X(.;O=0ad((@8((`N@::L-O@)';
  200. D[107] := '-,/Ug+XS:7d@6\/g-L1/;5d((\a]7K[g^>+\@8((.N@<D(]I(((PAHY23GdUAXAXG*';
  201. D[108] := '*N,(()Q6E<1),IMH*)(A@8((+.@.<DOgeL1/;O<HCGdD,0):SGdD<R_g0(ZU(((HA(';
  202. D[109] := '(7dHA(9*9\a]8F_eW,2P((XYCGbJ()I0CEPZ0=d(0*-UgZ((1,1P(*Y*R((VP(4fG(';
  203. D[110] := '2((8:._B4JUGgYY*SGdH:LE6E</UgCY*R((44>_f=H(@:._d7*-G(*(IG((((8((;+';
  204. D[111] := '1,1P(*Y*R((VP(0J2((P7JH(,.D,+,Gg^<a]8F_eW,2P((XYCGa>()I0CGXd0=d(Q(';
  205. D[112] := '0*-d((()(((L4?X5H((T8RH(3R(*0JH(2+`P())O)(Y/geM6E</UgCY*R((44>_f,*';
  206. D[113] := '=H(@:._d7:-G(*(IG((((7d(1+-d+@((3,2P(*bH(IUP(*Wd7+`P())O)(Y/geM6\(';
  207. D[114] := 'E</UgIA+cGbL8L(8.(Y((+UK(O(c,T)H(I3@<DKgg,/b())X(Y3@<DKgg-HUgR96a)';
  208. D[115] := 'E:a0D?I)cG`>8f_fQ,1),I(:^(Y)((9N2I(8+(((3N@J,*H((>,((*04(()0AI88-)';
  209. D[116] := '2((+@8((-(X((-IN)MLUgR9H)-/1gdY6E8X((/QJ*HX((.-M)(0((-e6E<Q(AH:PO)';
  210. D[117] := '<.(48RDg(2Na0-dW,2I9;O=*Q[dd((-*QZddgggggbNe2]Gg22I[7[X((bJ/7[X(B)';
  211. D[118] := '+2J28NFPJ+dd((.PJ<a]3Z_g22L<;O=IZ.,((,aI((*2@8((QN(((41IUN,((-YI-*';
  212. D[119] := '(()`@8((M.(((3)IQ.,((,QH((*N7[X(-+dd(+*PL\?b(=)H((-\7[X(-+dd(,*P@)';
  213. D[120] := 'L\?b(<MH((-J7[X(-+dd(**PL\Ib(4RPI,?UgIAI((-2:/P(\RJ,;O<g7((<7[X(L(';
  214. D[121] := '02J;:/P(RRJ,9F_f@N,((:Q0FH*ZR096E;dd()8g7((XR150FH*KR08H3Gd0@8((S)';
  215. D[122] := 'g,Ib(2JPI,a]7[X(-+dd(,*PL\Ib(1bPI*(UgXYI((+D:/P(J2J,;O<g7((<7[X()(';
  216. D[123] := '<2J;:/P(MBJ,._X()7Xe2^_fgWXf9F_d7>,((3a0FH).R08g7((<7[X(@2J;:/P()*';
  217. D[124] := 'EBJ,._X()7Xe2^_g(WXf9F_d7>,((190FH(DR096E9=+C^a^A?1\B>aO0/9PA:)N()';
  218. D[125] := 'B>YM0*0*0J`:9.-\@:)NC_1S0/5QFN<HB?4H)Z)JF?9MDZ`><N=[C_=Z@^<HANeZM)';
  219. D[126] := 'BZ)[B?QM0.M[0(M<F?)M0.M[0*048_1M@?9WDJ)QDZ(J*L9IE.,HANeZBZ,6<N=[6+';
  220. D[127] := 'C_=Z@^<HANeZBZ-)cGXd7[X((2OV9F_d7+dd((*PIZd2R08g7((+R0E6E</UgCY*M+';
  221. D[128] := 'R((4:.X(*J-G()0YC((.()@9C((1()Q6E>/H,<((.Z-2()ZH(+MP()H(:K`P())6]+';
  222. D[129] := 'E>/0,<((.Z-2()ZH*KMP()H(:K`P())6E</UgCY*R((44>X(:H(@P(,f2((8AI)*Q)';
  223. D[130] := 'R((:4>X()H(>P)4f2((8;O=IJ2(07JH(,,a]@8+gGL1P()ZH++`P())O)HY/ge=HA(';
  224. D[131] := ',K`dge402((/(*IN)R(17JH(,,a]@8+g=,1P()ZH++`P())6E</UgCY*R((44>X(6)';
  225. D[132] := ':H(>4?X((H(T8RH(3R),7JH(,,a]7XE1cGa@@8+gC+`G7XE1cGa@@A0f/^,(g<0g7*';
  226. D[133] := ')\OUgHYI(7e:7IeH2+d/:F_f+.,(g\8f/[d/:F_f>.,(g[Hf/[d/:F_f>.,(g]`fc)';
  227. D[134] := '/^,(g8Y)fH(\,)IO+LJ(WL)O*,1(,)K8X.+V3XI*Q\2O8RFQJ_((@8+dPL1O7[X(*+';
  228. D[135] := '*<2OR@A2?^((ccCG+L9QDN=KE.eZF:)NE>YT_HM,B?5S0.A]C.[D*,9QD^TH::e7>)';
  229. D[136] := '^8U-CN8HC^@HANMTAE8@=_1QE.<HD/1WE.=KE.=L0.9QD^UME/9M\XU.B>YM0.YWP)';
  230. D[137] := '@^UMA505=NeTE>]M0.YW@^UMA5,19NMTA:)JE?5a(XU6CZ)KB.=KB_5]C8068^IMD+';
  231. D[138] := '@^U[E>\H2*8X4*L)*\5:8Z(P1+(X4+(Q((U.B>YM0/5aD_9MC<2O7[X((BNg3YE*b+';
  232. D[139] := 'AbL]3[Y,<MA:R<]*Q[dd((2QW\1OR;=*Q[dd((6QW\1OR;>Q5\a]8RDg7((*8RDWN(';
  233. D[140] := '77ggggfQW:U?gZJPD[dd((*PI[dd((ZPJKdd((.PJ+dd((.PJ<Ib(9\W7(((((U05+';
  234. D[141] := 'FH*`7[X((BO67[X((bJ/8NFPJ,Ib(8PW7(((()-0FH*J7[X((BO67[X()2J/7[X(*+';
  235. D[142] := '*BJ2:/P(fZdd(((**LIb(0Pg7(((RDa0FH3Y3[X((()):/P(GKdd((.Q[IUd((/gB)';
  236. D[143] := '3,a]8RDg7((+8RDW77ggggfQW:U?gZJPD[dd((*PI[dd((ZPJL1OR0Hg7(()R0Lg++';
  237. D[144] := '7((27[X(-RJ;:/P(<BJ,._X((GdT;O=23GdTAXPW3GdPR99*3GdT;O<(*H(2()P)4)';
  238. D[145] := '[H(B((P(6H/6(,P(*H*`(D`(V((2(68)[H(9<^-^A:)LC^5]C>=VE*)ID[PO9NMTB*';
  239. D[146] := 'A:)KC^a^A?1[B>eV0/5]@^5MD_5NE>YTF:)KC^]XC.=\A>8I8NMV:.=`0/@\3K)J-)';
  240. D[147] := 'F8]AEN=[0,YMC?)MDN=]DM9PB?4HCN=_0.-VA*)QC?)ZC_AMA*)^A?1[B>eV0.eNb+';
  241. D[148] := '0,1QCLIMF*)QDZ)JDNe]A^I\0/9W0/MWE:)IDZ)I0/)]@NYQ@Z)[A?1^B>5M0.1aA*';
  242. D[149] := '0,]IB>a[E.-a3J)*B>a0A?HHB?4H@>`HB>a\A>EZ@?9MA*)X@?1\0.eN0/9PA:)<C(';
  243. D[150] := 'A>YMD^5ID.<H@^eUC?=VB>5IE.MWCO4HD.-KB^-OA:XHD^eWCJ)\CZ)JA:)ZA>YMJ*';
  244. D[151] := '@?5MA*)JF:)5@>MVD_9IF:`5+=9MC.=[@^-XA:)OB?AMDZ)aC_<HE.IM0.A]E/=Z\*';
  245. D[152] := 'A:)QCJ)KC^]UE>aQ@^-\B>eV0*\U0/9WA.-a0:);A>aL0.]MD_5IA^=[0/EQE.HH])';
  246. D[153] := 'EN-ZB>e]DZ)\A?I\0/5QFN=[3*)NC^a\DZ)ICN8HA_1ID.IQ@Z)[B.-XA?4V0,e\@+';
  247. D[154] := 'B.=Z0.AM@?9]DN=[0.MV@^Y]A.<b0.eV3?5KDN=MCJ)KC^]UE>aQ@^-\B>eVDZ)LH(';
  248. D[155] := 'B?1M@_9WDOLT0.MVE.=TC.MOA>a\0.]I@_1WDZXHE>aQEN=ZD^-T0/9MDN]QCN-Td*';
  249. D[156] := '0.=UE>YIE.MWCJXHA?1ZC_0H@^IM@^UQCNDHD/1WE.eKC^Y[0.-VA*)ICJ)]CN-\))';
  250. D[157] := 'E.=VA.=L0.]MD_5IA^<HD^=ZENMKA:`5+<AWDJ)NE?1\B.=Z0.MVANeZC>-\B>eV:)';
  251. D[158] := '3*)KC^a\@>5\6L]IB>a[E.-a+;0`5K,Y8J)+@>a_C^eL0-5\3H])A^e]DN,H:.MT8+';
  252. D[159] := 'C/4T0,5)0+LY4[(Y+:H`4;HQ0+La4:\^5;8X((((.((((*H((*?6((((*((((*((])';
  253. D[160] := '(+dd((.Qd((((8((()XO(((C1X(((=P((4XD(-X((((D(=P(*L1V:/,((()B:<56S(';
  254. D[161] := '0X()(.A.<L=.((,(GL169,X(((*>:<57;H(((2159<a=((0(SL94;\D(((+:9,M<)+';
  255. D[162] := ';(()(5a);-1<((((eME1;L8((H,*8\e,98()(:@((7gg0(((((((Ze((HGgg0(()E)';
  256. D[163] := '0(((ZdH(H7gg0(((/(((ZdX(HGgg0((*3X((Zd((H7gg0((*1(((Zd8(H7gg0((*>(';
  257. D[164] := '6H((ZcX(H7gg)((*@H((ZcH((ggg)((+N8((ZbX((Wgg)((+,X((Zc(((Ggg)((*\(';
  258. D[165] := 'aH((Zc8((Ggg)((+a8((ZbH(*Ggg)((,Q(((ZaX((Ggg)((+gH((Zb8(*Ggg)((,a(';
  259. D[166] := 'M(((Zb(((ggg)((-((((Za(((Wgg)((,b8((Za8((Ggg)((,\H((ZaH((7gg0((C+(';
  260. D[167] := '*X((Z`H((Ggg-((--X((Z`X(9)';
  261.  end; {InitDataArray}
  262. {}
  263.  procedure BadDownload;
  264.   begin
  265.    writeln('The text of procedure InitDataArray is not correct.');
  266.    writeln('Probable cause:  bad download of this program.');
  267.    writeln('To examine, choose first item from "Windows" menu.');
  268.   end;
  269. {}
  270.  function DataToCode: boolean;
  271.  const
  272.   StuffHex = $A866;  { the $A... format is a 680*0 is a trap instruction.
  273.                         I have not yet found in the interface declarations
  274.                         the routine to which it traps. }
  275.                         
  276.  var  Count, CodeIndex, i : integer;
  277.       Check : longint;
  278.       Error : boolean;
  279.       
  280.  procedure Stuffer( var addr1, addr2); inline StuffHex;
  281.  { Stuffer is expanded in-line: with the pointers Addr1 and Addr2 
  282.      on the stack, it traps to the routine indicated by StuffHex.
  283.      This implements the InlineP construct from the original,
  284.      commented out below.  Note the type-less VAR construct, allowing any
  285.      pointer to be passed without strong typing.
  286.    NOTE: assumes parameters are pushed onto the stack in the order they
  287.      appear in the code. }
  288.  
  289.  begin
  290.   Count := 0;
  291.   Error := false;
  292.   CodeIndex := 1;
  293.   while (Count < 9) and not Error do begin
  294.     Count := Count + 1;
  295.     i := length(D[Count]);
  296.     Error := (i <> 64) and 
  297.              ((Count <> 9) or (i <> 4));
  298.     if not Error then begin
  299.       (*InlineP(StuffHex, @Code[CodeIndex], @D[Count]); -- incompatible with Turbo*)
  300.       Stuffer( Code[CodeIndex], D[Count]);  { -- replaced the InlineP call}
  301.       CodeIndex := CodeIndex + 16;
  302.       end;
  303.    end;
  304.   if not Error then begin
  305.     Check := 0;
  306.     for CodeIndex := 1 to CodeWords do Check := Check + Code[CodeIndex];
  307.     Error := Check <> 883868;
  308.     end;
  309.   if Error then BadDownload;
  310.   DataToCode := not Error;
  311.  end; {DataToCode}
  312. {}
  313.  function WriteAppl : boolean;
  314.  const
  315.   JsrIndirectA0 = $4E90;
  316.   PopIntoA0 = $205F; {MOVEA.L  (SP)+,A0}
  317.   noErr = 0;
  318.   DataErr = 1;
  319.   dirFulErr = -33;
  320.   dskFulErr = -34;
  321.   ioErr = -36;
  322.   mFulErr = -41;
  323.   fLckdErr = -45;
  324.   vLckdErr = -46;
  325.   wPrErr = -44;
  326.   
  327.  type  GeneralPointer = ^integer;  { A free pointer type is needed (such as Turbo 4.0 has);
  328.                                      the type pointed to is immaterial. }
  329.  var
  330.   i, j, Result : integer;
  331.   
  332.  procedure Apply( Result, Arg: GeneralPointer; var TargetRoutine); 
  333.     inline  PopIntoA0,   { Assume TargetRoutine is on top of the stack.
  334.                               Pop it into A0 for JSR to use. }
  335.             JsrIndirectA0;
  336.  { Applies the TargetRoutine to the 2 parameters whose addresses are in 
  337.      Result and Arg.  This replaces the Glue array construct of the original.
  338.    NOTE: order of parameters on stack is essential.  Apply assumes they are
  339.      pushed in the order they appear.
  340.    NOTE: ObjPointer is used to allow NIL to be passed where necessary.
  341.      Otherwise I consider typeless VAR parameters preferable, since they advertise
  342.      that the code is escaping type checks. }
  343.  
  344.  begin
  345.   i := 10;
  346.   repeat
  347.     j := length(D[i]);
  348.     Result := ord((j <> 66) and ((i <> DataLines) or (j <> 26)));
  349.     if Result = noErr then begin
  350.       (*generic(JsrIndirectA0, RegRcd);  -- though undocumented, this appears 
  351.                    to work by stuffing the registers with their equivalently-named
  352.                    fields from RegRcd, then executing the first parameter 
  353.                    as an instruction.  RegRcd was set to point A0 to the Code array,
  354.                    and A1 and A2 to its parameters (Result and D).
  355.                    The JSR called the Glue array, which pushed the necessary 
  356.                    register values onto the stack, and jumped to the Code array. *)
  357.       Apply( @Result, @D[i], Code[1]); {-- used instead of the Generic routine.
  358.                                           Placing @Result and @D[i] on the stack
  359.                                           is apparently adequate; placing them 
  360.                                           in the registers was only intermediate. }
  361.       end;
  362.     i := i + 1;
  363.   until (i > DataLines) or (Result <> noErr);
  364.   if Result = noErr then begin
  365.      (*generic(JsrIndirectA0, RegRcd);*)
  366.      Apply( @Result, nil, Code[1]); { -- see notes above.  Note the NIL Arg
  367.                                         parameter -- this appears to be essential
  368.                                         to have the generation of BinHex finished 
  369.                                         correctly. }
  370.     end;
  371.   case Result of
  372.    DataErr :
  373.     BadDownLoad;
  374.    noErr :
  375.     ;
  376.    dirFulErr :
  377.     writeln('Output disk''s directory is full.');
  378.    dskFulErr :
  379.     writeln(' Output disk has too little free space.');
  380.    fLckdErr :
  381.     writeln('Old "Binhex4" file is locked, can''t replace it.');
  382.    ioErr : 
  383.     writeln('Disk I/O error.');
  384.    mFulErr :
  385.     writeln('Insufficient memory.');
  386.    vLckdErr :
  387.     writeln('Output disk is locked.');
  388.    wPrErr :
  389.     writeln('Output disk is write protected.');
  390.    otherwise
  391.     write('File Manager returned unexpected error code = ', Result);
  392.    end;
  393.   WriteAppl := Result = noErr;
  394.  end; {WriteAppl}
  395. {}
  396. begin {program}
  397.     { I assume this init. code was to establish a window and menu.  Only SetRect
  398.          appears to be known to Turbo -- though I haven't gone looking through
  399.          all the interfaces to find the others.  The very simple arrangement 
  400.          that the current code produces seems to be satisfactory for producing
  401.          BinHex4.
  402.          }
  403.  (*HideAll;
  404.  SetRect(TextRect, 0, 20, 528, 342);
  405.  SetTextRect(TextRect);
  406.  ShowText;*)
  407.  
  408.  Writeln('Processing -- please wait...');
  409.  InitDataArray;
  410.  if DataToCode then begin
  411.     if WriteAppl then writeln('Done!')
  412.     else writeln('Sorry, nothing was accomplished.');
  413.     writeln('To exit, press the "return" key.');
  414.     end;
  415.   readln;
  416. end.
  417.