home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume2 / tools / part3 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  47.1 KB

  1. From: ihnp4!mnetor!clewis (Chris Lewis)
  2. Subject: Software Tools in Pascal (Part 2 of 6)
  3. Newsgroups: mod.sources
  4. Approved: john@genrad.UUCP
  5.  
  6. Mod.sources:  Volume 2, Issue 8
  7. Submitted by: ihnp4!mnetor!clewis (Chris Lewis)
  8.  
  9. #!/bin/sh
  10. echo 'Start of pack.out, part 02 of 06:'
  11. echo 'x - charclas.pascal'
  12. sed 's/^X//' > charclas.pascal << '/'
  13. X{
  14. X    Copyright (c) 1982
  15. X    By:    Chris Lewis
  16. X
  17. X    Right is hereby granted to freely distribute or duplicate this
  18. X    software, providing distribution or duplication is not for profit
  19. X    or other commerical gain and that this copyright notice remains 
  20. X    intact.
  21. X}
  22. X{ CharClass -- definition of character table }
  23. Xsegment CharClass;
  24. X%include swtools
  25. X%include chardef
  26. Xvalue
  27. X    CharTable := ChTable(
  28. X    [] { 00 }, [] { 01 }, [] { 02 }, [] { 03 },
  29. X    [] { 04 }, [] { 05 }, [] { 06 }, [] { 07 },
  30. X    [] { 08 }, [] { 09 }, [] { 0a }, [] { 0b },
  31. X    [] { 0c }, [] { 0d }, [] { 0e }, [] { 0f },
  32. X    [] { 10 }, [] { 11 }, [] { 12 }, [] { 13 },
  33. X    [] { 14 }, [] { 15 }, [] { 16 }, [] { 17 },
  34. X    [] { 18 }, [] { 19 }, [] { 1a }, [] { 1b },
  35. X    [] { 1c }, [] { 1d }, [] { 1e }, [] { 1f },
  36. X    [] { 20 }, [] { 21 }, [] { 22 }, [] { 23 },
  37. X    [] { 24 }, [] { 25 }, [] { 26 }, [] { 27 },
  38. X    [] { 28 }, [] { 29 }, [] { 2a }, [] { 2b },
  39. X    [] { 2c }, [] { 2d }, [] { 2e }, [] { 2f },
  40. X    [] { 30 }, [] { 31 }, [] { 32 }, [] { 33 },
  41. X    [] { 34 }, [] { 35 }, [] { 36 }, [] { 37 },
  42. X    [] { 38 }, [] { 39 }, [] { 3a }, [] { 3b },
  43. X    [] { 3c }, [] { 3d }, [] { 3e }, [] { 3f },
  44. X    [ChSpecial] { 40 },
  45. X               [] { 41 }, [] { 42 }, [] { 43 },
  46. X    [] { 44 }, [] { 45 }, [] { 46 }, [] { 47 },
  47. X    [] { 48 }, [] { 49 },
  48. X    [ChSpecial] { 4a },     [ChSpecial] { 4b },
  49. X    [ChSpecial] { 4c },     [ChSpecial] { 4d },
  50. X    [ChSpecial] { 4e },     [ChSpecial] { 4f },
  51. X    [ChSpecial] { 50 },
  52. X               [] { 51 }, [] { 52 }, [] { 53 },
  53. X    [] { 54 }, [] { 55 }, [] { 56 }, [] { 57 },
  54. X    [] { 58 }, [] { 59 },
  55. X    [ChSpecial] { 5a },     [ChSpecial] { 5b },
  56. X    [ChSpecial] { 5c },     [ChSpecial] { 5d },
  57. X    [ChSpecial] { 5e },     [ChSpecial] { 5f },
  58. X    [ChSpecial] { 60 },     [ChSpecial] { 61 },
  59. X                          [] { 62 }, [] { 63 },
  60. X    [] { 64 }, [] { 65 }, [] { 66 }, [] { 67 },
  61. X    [] { 68 }, [] { 69 }, [] { 6a },
  62. X                            [ChSpecial] { 6b },
  63. X    [ChSpecial] { 6c },     [ChSpecial] { 6d },
  64. X    [ChSpecial] { 6e },     [ChSpecial] { 6f },
  65. X    [] { 70 }, [] { 71 }, [] { 72 }, [] { 73 },
  66. X    [] { 74 }, [] { 75 }, [] { 76 }, [] { 77 },
  67. X    [] { 78 }, [] { 79 },
  68. X    [ChSpecial] { 7a },     [ChSpecial] { 7b },
  69. X    [ChSpecial] { 7c },     [ChSpecial] { 7d },
  70. X    [ChSpecial] { 7e },     [ChSpecial] { 7f },
  71. X    [] { 80 },
  72. X                               [ChLetter,ChLower] { 81 },
  73. X    [ChLetter,ChLower] { 82 }, [ChLetter,ChLower] { 83 },
  74. X    [ChLetter,ChLower] { 84 }, [ChLetter,ChLower] { 85 },
  75. X    [ChLetter,ChLower] { 86 }, [ChLetter,ChLower] { 87 },
  76. X    [ChLetter,ChLower] { 88 }, [ChLetter,ChLower] { 89 },
  77. X                          [] { 8a },
  78. X                            [ChSpecial] { 8b },
  79. X    [] { 8c }, [] { 8d }, [] { 8e }, [] { 8f },
  80. X    [] { 90 },
  81. X                               [ChLetter,ChLower] { 91 },
  82. X    [ChLetter,ChLower] { 92 }, [ChLetter,ChLower] { 93 },
  83. X    [ChLetter,ChLower] { 94 }, [ChLetter,ChLower] { 95 },
  84. X    [ChLetter,ChLower] { 96 }, [ChLetter,ChLower] { 97 },
  85. X    [ChLetter,ChLower] { 98 }, [ChLetter,ChLower] { 99 },
  86. X                          [] { 9a },
  87. X                            [ChSpecial] { 9b },
  88. X    [] { 9c }, [] { 9d }, [] { 9e }, [] { 9f },
  89. X    [] { a0 }, [] { a1 },
  90. X    [ChLetter,ChLower] { a2 }, [ChLetter,ChLower] { a3 },
  91. X    [ChLetter,ChLower] { a4 }, [ChLetter,ChLower] { a5 },
  92. X    [ChLetter,ChLower] { a6 }, [ChLetter,ChLower] { a7 },
  93. X    [ChLetter,ChLower] { a8 }, [ChLetter,ChLower] { a9 },
  94. X                          [] { aa }, [] { ab },
  95. X    [] { ac },
  96. X                            [ChSpecial] { ad },
  97. X                          [] { ae }, [] { af },
  98. X    [] { b0 }, [] { b1 }, [] { b2 }, [] { b3 },
  99. X    [] { b4 }, [] { b5 }, [] { b6 }, [] { b7 },
  100. X    [] { b8 }, [] { b9 }, [] { ba }, [] { bb },
  101. X    [] { bc },
  102. X                            [ChSpecial] { bd },
  103. X                          [] { be }, [] { bf },
  104. X    [] { c0 },
  105. X                               [ChLetter,ChUpper] { c1 },
  106. X    [ChLetter,ChUpper] { c2 }, [ChLetter,ChUpper] { c3 },
  107. X    [ChLetter,ChUpper] { c4 }, [ChLetter,ChUpper] { c5 },
  108. X    [ChLetter,ChUpper] { c6 }, [ChLetter,ChUpper] { c7 },
  109. X    [ChLetter,ChUpper] { c8 }, [ChLetter,ChUpper] { c9 },
  110. X                          [] { ca }, [] { cb },
  111. X    [] { cc }, [] { cd }, [] { ce }, [] { cf },
  112. X    [] { d0 },
  113. X                               [ChLetter,ChUpper] { d1 },
  114. X    [ChLetter,ChUpper] { d2 }, [ChLetter,ChUpper] { d3 },
  115. X    [ChLetter,ChUpper] { d4 }, [ChLetter,ChUpper] { d5 },
  116. X    [ChLetter,ChUpper] { d6 }, [ChLetter,ChUpper] { d7 },
  117. X    [ChLetter,ChUpper] { d8 }, [ChLetter,ChUpper] { d9 },
  118. X                          [] { da }, [] { db },
  119. X    [] { dc }, [] { dd }, [] { de }, [] { df },
  120. X    [] { e0 }, [] { e1 },
  121. X    [ChLetter,ChUpper] { e2 }, [ChLetter,ChUpper] { e3 },
  122. X    [ChLetter,ChUpper] { e4 }, [ChLetter,ChUpper] { e5 },
  123. X    [ChLetter,ChUpper] { e6 }, [ChLetter,ChUpper] { e7 },
  124. X    [ChLetter,ChUpper] { e8 }, [ChLetter,ChUpper] { e9 },
  125. X                          [] { ea }, [] { eb },
  126. X    [] { ec }, [] { ed }, [] { ee }, [] { ef },
  127. X    [ChDigit] { f0 },         [ChDigit] { f1 },
  128. X    [ChDigit] { f2 },         [ChDigit] { f3 },
  129. X    [ChDigit] { f4 },         [ChDigit] { f5 },
  130. X    [ChDigit] { f6 },         [ChDigit] { f7 },
  131. X    [ChDigit] { f8 },         [ChDigit] { f9 },
  132. X                          [] { fa }, [] { fb },
  133. X    [] { fc }, [] { fd }, [] { fe }, [] { ff }
  134. X                     );
  135. Xfunction CharClass;
  136. Xbegin
  137. X    CharClass := CharTable[Ord(tIndex)]
  138. Xend;
  139. /
  140. echo 'x - docmd.pascal'
  141. sed 's/^X//' > docmd.pascal << '/'
  142. X{
  143. X    Copyright (c) 1981
  144. X    By:    Bell Telephone Laboratories, Inc. and
  145. X        Whitesmiths, Ltd.,
  146. X
  147. X    This software is derived from the book
  148. X        "Software Tools In Pascal", by
  149. X        Brian W. Kernighan and P.J. Plauger
  150. X        Addison-Wesley, 1981
  151. X        ISBN 0-201-10342-7
  152. X
  153. X    Right is hereby granted to freely distribute or duplicate this
  154. X    software, providing distribution or duplication is not for profit
  155. X    or other commerical gain and that this copyright notice remains 
  156. X    intact.
  157. X}
  158. X{ DoCmd -- handle all commands except globals }
  159. Xsegment DoCmd;
  160. X%include swtools
  161. X%include editcons
  162. X%include edittype
  163. X%include editproc
  164. X%include editref
  165. Xfunction DoCmd;
  166. Xvar
  167. X    fil, sub: StringType;
  168. X    line3: Integer;
  169. X    gFlag, pFlag: Boolean;
  170. Xbegin
  171. X    pFlag := false;   { may be set by d, m, s }
  172. X    status := ERR;
  173. X    case lin[i] of
  174. X        PCMD:
  175. X            if (lin[i+1] = NEWLINE) then
  176. X                if (Default(curLn, curLn, status) = OK) then
  177. X                    status := DoPrint(line1, line2);
  178. X        LCMD:
  179. X            if (lin[i+1] = NEWLINE) then
  180. X                if (Default(curLn, curLn, status) = OK) then
  181. X                    status := DoLPrint(line1, line2);
  182. X        NEWLINE: begin
  183. X            if (nLines = 0) then begin
  184. X                line2 := nextLn(curLn);
  185. X                line1 := line2;
  186. X            end; {if}
  187. X            status := DoPrint(line1, line2)
  188. X        end;
  189. X        QCMD:
  190. X            if (lin[i+1] = NEWLINE) and (nLines = 0) and (not glob) then
  191. X                status := ENDDATA;
  192. X        OCMD:
  193. X            if (not glob) then
  194. X                status := DoOption(lin, i);
  195. X        ACMD:
  196. X            if (lin[i+1] = NEWLINE) then
  197. X                status := Append(line2, glob);
  198. X        CCMD:
  199. X            if (lin[i+1] = NEWLINE) then
  200. X                if (Default(curLn, curLn, status) = OK) then
  201. X                  if (LnDelete(line1, line2, status) = OK) then
  202. X                        status := Append(PrevLn(line1), glob);
  203. X        DCMD:
  204. X            if (CkP(lin, i+1, pFlag, status) = OK) then
  205. X             if (Default(curLn, curLn, status) = OK) then
  206. X              if (LnDelete(line1, line2, status) = OK) then
  207. X               if (NextLn(curLn) <> 0) then
  208. X                curLn := NextLn(curLn);
  209. X        ICMD:
  210. X            if (lin[i+1] = NEWLINE) then begin
  211. X                if (line2 = 0) then
  212. X                    status := Append(0, glob)
  213. X                else
  214. X                    status := Append(PrevLn(line2), glob)
  215. X            end;
  216. X        EQCMD:
  217. X            if (CkP(lin, i+1, pFlag, status) = OK) then begin
  218. X                PutDec(line2, 1);
  219. X                PutC(NEWLINE);
  220. X            end;
  221. X        KCMD: begin
  222. X            i := i + 1;
  223. X            SkipBl(lin, i);
  224. X            if (GetOne(lin, i, line3, status) = ENDDATA) then
  225. X                status := ERR;
  226. X            if (status = OK) then
  227. X                if (CkP(lin, i, pFlag, status) = OK) then
  228. X                    if (Default(curLn, curLn, status) = OK) then
  229. X                        status := Kopy(line3)
  230. X        end;
  231. X        MCMD: begin
  232. X            i := i + 1;
  233. X            SkipBl(lin, i);
  234. X            if (GetOne(lin, i, line3, status) = ENDDATA) then
  235. X                status := ERR;
  236. X            if (status = OK) then
  237. X                if (CkP(lin, i, pFlag, status) = OK) then
  238. X                    if (Default(curLn, curLn, status) = OK) then
  239. X                        status := Move(line3)
  240. X        end;
  241. X        SCMD: begin
  242. X            i := i + 1;
  243. X            if (OptPat(lin,i) = OK) then
  244. X                if (GetRHS(lin,i,sub,gFlag) = OK) then
  245. X                    if (CkP(lin,i+1,pFlag,status) = OK) then
  246. X                        if (Default(curLn,curLn,status) = OK) then
  247. X                            status := SubSt(sub, gFlag, glob)
  248. X        end;
  249. X        ECMD:
  250. X            if (nLines = 0) then
  251. X                if (GetFn(lin, i, fil) = OK) then begin
  252. X                    SCopy(fil, 1, saveFile, 1);
  253. X                    ClrBuf;
  254. X                    SetBuf;
  255. X                    status := DoRead(0, fil)
  256. X                end;
  257. X        FCMD:
  258. X            if (nLines = 0) then
  259. X                if (GetFn(lin,i,fil) = OK) then begin
  260. X                    SCopy(fil, 1, saveFile, 1);
  261. X                    PutStr(saveFile, STDOUT);
  262. X                    PutC(NEWLINE);
  263. X                    status := OK
  264. X                end;
  265. X        RCMD:
  266. X            if (GetFn(lin, i, fil) = OK) then
  267. X                status := DoRead(line2, fil);
  268. X        WCMD:
  269. X            if (GetFn(lin,i,fil) = OK) then
  270. X                if (Default(1, lastLn, status) = OK) then
  271. X                    status := DoWrite(line1, line2, fil)
  272. X        otherwise
  273. X            status := ERR
  274. X    end;
  275. X    if (status = OK) and (pFlag) then
  276. X        status := DoPrint(curLn, curLn);
  277. X    DoCmd := status
  278. Xend;
  279. /
  280. echo 'x - fontinit.A'
  281. sed 's/^X//' > fontinit.A << '/'
  282. X{
  283. X    Copyright (c) 1982
  284. X    By:    Chris Lewis
  285. X
  286. X    Right is hereby granted to freely distribute or duplicate this
  287. X    software, providing distribution or duplication is not for profit
  288. X    or other commerical gain and that this copyright notice remains 
  289. X    intact.
  290. X}
  291. X{ Font -- definitions of font file }
  292. Xsegment FontInit;
  293. X%include swtools
  294. Xconst
  295. X    nChars = 68;
  296. X    charHeight = 14;
  297. X    nFonts     = 3;
  298. X    nElements = nChars * charHeight * nFonts;
  299. Xtype
  300. X    CharElement = packed -32768..32767;
  301. X    ElementArray = array [1..nElements] of CharElement;
  302. X    FontFirstType = array [0..nFonts-1] of 0..charHeight-1;
  303. X    FontWidthType = packed array [1..nChars * nFonts] of
  304. X                       0..16;
  305. Xdef
  306. X    fontWidth: FontWidthType;
  307. X    fontFirst: array [0..nFonts-1] of 0..charHeight-1;
  308. X    Displays: ElementArray;
  309. X    transArray: StringType;
  310. Xprocedure FontInit; external;
  311. X%PAGE
  312. X{ BANNER FONTS }
  313. Xvalue
  314. X    Displays := ElementArray(
  315. X{' '}
  316. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  317. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  318. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  319. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  320. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  321. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  322. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  323. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  324. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  325. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  326. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  327. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  328. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  329. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  330. X{'A'}
  331. X        '0000000000000000'B,'0000000000000000'B,'0000011111111100'B,
  332. X        '0000000000000000'B,'0000000000000000'B,'0000111111111110'B,
  333. X        '0000000000000000'B,'0000111111111000'B,'0001110000000111'B,
  334. X        '0000000000000000'B,'0001111111111100'B,'0001110000000111'B,
  335. X        '0000111111100000'B,'0001100000001100'B,'0001110000000111'B,
  336. X        '0001111111110000'B,'0001100000001100'B,'0001110000000111'B,
  337. X        '0001100000110000'B,'0001100000001100'B,'0001111111111111'B,
  338. X        '0001100000110000'B,'0001111111111100'B,'0001111111111111'B,
  339. X        '0001111111110000'B,'0001111111111100'B,'0001110000000111'B,
  340. X        '0001111111110000'B,'0001100000001100'B,'0001110000000111'B,
  341. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  342. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  343. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  344. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  345. X{'B'}
  346. X        '0000000000000000'B,'0000000000000000'B,'0001111111111100'B,
  347. X        '0000000000000000'B,'0000000000000000'B,'0001111111111110'B,
  348. X        '0000000000000000'B,'0001111111111000'B,'0000011100000111'B,
  349. X        '0000000000000000'B,'0001111111111100'B,'0000011100000111'B,
  350. X        '0001111111100000'B,'0000011000001100'B,'0000011100000111'B,
  351. X        '0001111111110000'B,'0000011000001100'B,'0000011100000111'B,
  352. X        '0000110000110000'B,'0000011000001100'B,'0000011111111100'B,
  353. X        '0000110000110000'B,'0000011111111000'B,'0000011111111100'B,
  354. X        '0000111111100000'B,'0000011111111000'B,'0000011100000111'B,
  355. X        '0000111111100000'B,'0000011000001100'B,'0000011100000111'B,
  356. X        '0000110000110000'B,'0000011000001100'B,'0000011100000111'B,
  357. X        '0000110000110000'B,'0000011000001100'B,'0000011100000111'B,
  358. X        '0001111111110000'B,'0001111111111100'B,'0001111111111110'B,
  359. X        '0001111111100000'B,'0001111111111000'B,'0001111111111100'B,
  360. X%PAGE
  361. X{'C'}
  362. X        '0000000000000000'B,'0000000000000000'B,'0000111111111100'B,
  363. X        '0000000000000000'B,'0000000000000000'B,'0001111111111110'B,
  364. X        '0000000000000000'B,'0000111111111000'B,'0001110000000111'B,
  365. X        '0000000000000000'B,'0001111111111100'B,'0001110000000111'B,
  366. X        '0000111111000000'B,'0001100000001100'B,'0001110000000000'B,
  367. X        '0001111111100000'B,'0001100000000000'B,'0001110000000000'B,
  368. X        '0001100001100000'B,'0001100000000000'B,'0001110000000000'B,
  369. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  370. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  371. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  372. X        '0001100000000000'B,'0001100000000000'B,'0001110000000111'B,
  373. X        '0001100001100000'B,'0001100000001100'B,'0001110000000111'B,
  374. X        '0001111111100000'B,'0001111111111100'B,'0000111111111110'B,
  375. X        '0000111111000000'B,'0000111111111000'B,'0000011111111100'B,
  376. X{'D'}
  377. X        '0000000000000000'B,'0000000000000000'B,'0001111111111100'B,
  378. X        '0000000000000000'B,'0000000000000000'B,'0001111111111110'B,
  379. X        '0000000000000000'B,'0001111111111000'B,'0000011100000111'B,
  380. X        '0000000000000000'B,'0001111111111100'B,'0000011100000111'B,
  381. X        '0001111111100000'B,'0000011000001100'B,'0000011100000111'B,
  382. X        '0001111111110000'B,'0000011000001100'B,'0000011100000111'B,
  383. X        '0000110000110000'B,'0000011000001100'B,'0000011100000111'B,
  384. X        '0000110000110000'B,'0000011000001100'B,'0000011100000111'B,
  385. X        '0000110000110000'B,'0000011000001100'B,'0000011100000111'B,
  386. X        '0000110000110000'B,'0000011000001100'B,'0000011100000111'B,
  387. X        '0000110000110000'B,'0000011000001100'B,'0000011100000111'B,
  388. X        '0000110000110000'B,'0000011000001100'B,'0000011100000111'B,
  389. X        '0001111111110000'B,'0001111111111100'B,'0001111111111110'B,
  390. X        '0001111111100000'B,'0001111111111000'B,'0001111111111100'B,
  391. X{'E'}
  392. X        '0000000000000000'B,'0000000000000000'B,'0001111111111111'B,
  393. X        '0000000000000000'B,'0000000000000000'B,'0001111111111111'B,
  394. X        '0000000000000000'B,'0001111111111100'B,'0001110000000000'B,
  395. X        '0000000000000000'B,'0001111111111100'B,'0001110000000000'B,
  396. X        '0001111111110000'B,'0001100000000000'B,'0001110000000000'B,
  397. X        '0001111111110000'B,'0001100000000000'B,'0001110000000000'B,
  398. X        '0001100000000000'B,'0001100000000000'B,'0001111111111000'B,
  399. X        '0001100000000000'B,'0001111111100000'B,'0001111111111000'B,
  400. X        '0001111110000000'B,'0001111111100000'B,'0001110000000000'B,
  401. X        '0001111110000000'B,'0001100000000000'B,'0001110000000000'B,
  402. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  403. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  404. X        '0001111111110000'B,'0001111111111100'B,'0001111111111111'B,
  405. X        '0001111111110000'B,'0001111111111100'B,'0001111111111111'B,
  406. X%PAGE
  407. X{'F'}
  408. X        '0000000000000000'B,'0000000000000000'B,'0001111111111111'B,
  409. X        '0000000000000000'B,'0000000000000000'B,'0001111111111111'B,
  410. X        '0000000000000000'B,'0001111111111100'B,'0001110000000000'B,
  411. X        '0000000000000000'B,'0001111111111100'B,'0001110000000000'B,
  412. X        '0001111111110000'B,'0001100000000000'B,'0001110000000000'B,
  413. X        '0001111111110000'B,'0001100000000000'B,'0001110000000000'B,
  414. X        '0001100000000000'B,'0001100000000000'B,'0001111111111000'B,
  415. X        '0001100000000000'B,'0001111111100000'B,'0001111111111000'B,
  416. X        '0001111110000000'B,'0001111111100000'B,'0001110000000000'B,
  417. X        '0001111110000000'B,'0001100000000000'B,'0001110000000000'B,
  418. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  419. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  420. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  421. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  422. X{'G'}
  423. X        '0000000000000000'B,'0000000000000000'B,'0000011111111100'B,
  424. X        '0000000000000000'B,'0000000000000000'B,'0000111111111110'B,
  425. X        '0000000000000000'B,'0000111111111000'B,'0001110000000111'B,
  426. X        '0000000000000000'B,'0001111111111100'B,'0001110000000000'B,
  427. X        '0000111111100000'B,'0001100000001100'B,'0001110000000000'B,
  428. X        '0001111111110000'B,'0001100000000000'B,'0001110000000000'B,
  429. X        '0001100000110000'B,'0001100000000000'B,'0001110001111110'B,
  430. X        '0001100000000000'B,'0001100000000000'B,'0001110001111111'B,
  431. X        '0001100111100000'B,'0001100001111000'B,'0001110000000111'B,
  432. X        '0001100111110000'B,'0001100001111100'B,'0001110000000111'B,
  433. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  434. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  435. X        '0001111111110000'B,'0001111111111100'B,'0000111111111110'B,
  436. X        '0000111111100000'B,'0000111111111000'B,'0000011111111100'B,
  437. X{'H'}
  438. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  439. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  440. X        '0000000000000000'B,'0001100000001100'B,'0001110000000111'B,
  441. X        '0000000000000000'B,'0001100000001100'B,'0001110000000111'B,
  442. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  443. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  444. X        '0001100000110000'B,'0001100000001100'B,'0001111111111111'B,
  445. X        '0001100000110000'B,'0001111111111100'B,'0001111111111111'B,
  446. X        '0001111111110000'B,'0001111111111100'B,'0001110000000111'B,
  447. X        '0001111111110000'B,'0001100000001100'B,'0001110000000111'B,
  448. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  449. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  450. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  451. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  452. X%PAGE
  453. X{'I'}
  454. X        '0000000000000000'B,'0000000000000000'B,'0001111111000000'B,
  455. X        '0000000000000000'B,'0000000000000000'B,'0001111111000000'B,
  456. X        '0000000000000000'B,'0001111110000000'B,'0000011100000000'B,
  457. X        '0000000000000000'B,'0001111110000000'B,'0000011100000000'B,
  458. X        '0001111110000000'B,'0000011000000000'B,'0000011100000000'B,
  459. X        '0001111110000000'B,'0000011000000000'B,'0000011100000000'B,
  460. X        '0000011000000000'B,'0000011000000000'B,'0000011100000000'B,
  461. X        '0000011000000000'B,'0000011000000000'B,'0000011100000000'B,
  462. X        '0000011000000000'B,'0000011000000000'B,'0000011100000000'B,
  463. X        '0000011000000000'B,'0000011000000000'B,'0000011100000000'B,
  464. X        '0000011000000000'B,'0000011000000000'B,'0000011100000000'B,
  465. X        '0000011000000000'B,'0000011000000000'B,'0000011100000000'B,
  466. X        '0001111110000000'B,'0001111110000000'B,'0001111111000000'B,
  467. X        '0001111110000000'B,'0001111110000000'B,'0001111111000000'B,
  468. X{'J'}
  469. X        '0000000000000000'B,'0000000000000000'B,'0000000011111111'B,
  470. X        '0000000000000000'B,'0000000000000000'B,'0000000011111111'B,
  471. X        '0000000000000000'B,'0000000111111110'B,'0000000011111111'B,
  472. X        '0000000000000000'B,'0000000111111110'B,'0000000000011100'B,
  473. X        '0000001111110000'B,'0000000000110000'B,'0000000000011100'B,
  474. X        '0000001111110000'B,'0000000000110000'B,'0000000000011100'B,
  475. X        '0000000011000000'B,'0000000000110000'B,'0000000000011100'B,
  476. X        '0000000011000000'B,'0000000000110000'B,'0000000000011100'B,
  477. X        '0000000011000000'B,'0000000000110000'B,'0000000000011100'B,
  478. X        '0000000011000000'B,'0000000000110000'B,'0000000000011100'B,
  479. X        '0000000011000000'B,'0001100000110000'B,'0001110000011100'B,
  480. X        '0001100011000000'B,'0001100000110000'B,'0001110000011100'B,
  481. X        '0001111111000000'B,'0000111111110000'B,'0000111111111100'B,
  482. X        '0000111110000000'B,'0000011111100000'B,'0000011111111000'B,
  483. X{'K'}
  484. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  485. X        '0000000000000000'B,'0000000000000000'B,'0001110000001110'B,
  486. X        '0000000000000000'B,'0001100000110000'B,'0001110000011100'B,
  487. X        '0000000000000000'B,'0001100001100000'B,'0001110000111000'B,
  488. X        '0001100001100000'B,'0001100011000000'B,'0001110001110000'B,
  489. X        '0001100011000000'B,'0001100110000000'B,'0001110011100000'B,
  490. X        '0001100110000000'B,'0001101100000000'B,'0001111111000000'B,
  491. X        '0001101100000000'B,'0001111000000000'B,'0001111111000000'B,
  492. X        '0001111000000000'B,'0001111000000000'B,'0001110011100000'B,
  493. X        '0001111000000000'B,'0001101100000000'B,'0001110001110000'B,
  494. X        '0001101100000000'B,'0001100110000000'B,'0001110000111000'B,
  495. X        '0001100110000000'B,'0001100011000000'B,'0001110000011100'B,
  496. X        '0001100011000000'B,'0001100001100000'B,'0001110000001110'B,
  497. X        '0001100001100000'B,'0001100000110000'B,'0001110000000111'B,
  498. X%PAGE
  499. X{'L'}
  500. X        '0000000000000000'B,'0000000000000000'B,'0001110000000000'B,
  501. X        '0000000000000000'B,'0000000000000000'B,'0001110000000000'B,
  502. X        '0000000000000000'B,'0001100000000000'B,'0001110000000000'B,
  503. X        '0000000000000000'B,'0001100000000000'B,'0001110000000000'B,
  504. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  505. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  506. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  507. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  508. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  509. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  510. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  511. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  512. X        '0001111111110000'B,'0001111111111100'B,'0001111111111111'B,
  513. X        '0001111111110000'B,'0001111111111100'B,'0001111111111111'B,
  514. X{'M'}
  515. X        '0000000000000000'B,'0000000000000000'B,'0001000000000001'B,
  516. X        '0000000000000000'B,'0000000000000000'B,'0001100000000011'B,
  517. X        '0000000000000000'B,'0001100000000110'B,'0001110000000111'B,
  518. X        '0000000000000000'B,'0001110000001110'B,'0001111000001111'B,
  519. X        '0001100000011000'B,'0001111000011110'B,'0001111100011111'B,
  520. X        '0001110000111000'B,'0001111100111110'B,'0001111110111111'B,
  521. X        '0001111001111000'B,'0001101111110110'B,'0001111111111111'B,
  522. X        '0001111111111000'B,'0001100111100110'B,'0001110111110111'B,
  523. X        '0001101111011000'B,'0001100011000110'B,'0001110011100111'B,
  524. X        '0001100110011000'B,'0001100000000110'B,'0001110001000111'B,
  525. X        '0001100000011000'B,'0001100000000110'B,'0001110000000111'B,
  526. X        '0001100000011000'B,'0001100000000110'B,'0001110000000111'B,
  527. X        '0001100000011000'B,'0001100000000110'B,'0001110000000111'B,
  528. X        '0001100000011000'B,'0001100000000110'B,'0001110000000111'B,
  529. X{'N'}
  530. X        '0000000000000000'B,'0000000000000000'B,'0001000000000111'B,
  531. X        '0000000000000000'B,'0000000000000000'B,'0001100000000111'B,
  532. X        '0000000000000000'B,'0001100000000110'B,'0001110000000111'B,
  533. X        '0000000000000000'B,'0001110000000110'B,'0001111000000111'B,
  534. X        '0001100000011000'B,'0001111000000110'B,'0001111100000111'B,
  535. X        '0001110000011000'B,'0001111100000110'B,'0001111110000111'B,
  536. X        '0001111000011000'B,'0001101110000110'B,'0001110111000111'B,
  537. X        '0001111100011000'B,'0001100111000110'B,'0001110011100111'B,
  538. X        '0001101110011000'B,'0001100011100110'B,'0001110001110111'B,
  539. X        '0001100111011000'B,'0001100001110110'B,'0001110000111111'B,
  540. X        '0001100011111000'B,'0001100000111110'B,'0001110000011111'B,
  541. X        '0001100001111000'B,'0001100000011110'B,'0001110000001111'B,
  542. X        '0001100000111000'B,'0001100000001110'B,'0001110000000111'B,
  543. X        '0001100000011000'B,'0001100000000110'B,'0001110000000011'B,
  544. X%PAGE
  545. X{'O'}
  546. X        '0000000000000000'B,'0000000000000000'B,'0000011111111100'B,
  547. X        '0000000000000000'B,'0000000000000000'B,'0000111111111110'B,
  548. X        '0000000000000000'B,'0000111111111000'B,'0001110000000111'B,
  549. X        '0000000000000000'B,'0001111111111100'B,'0001110000000111'B,
  550. X        '0000111111110000'B,'0001100000001100'B,'0001110000000111'B,
  551. X        '0001111111111000'B,'0001100000001100'B,'0001110000000111'B,
  552. X        '0001100000011000'B,'0001100000001100'B,'0001110000000111'B,
  553. X        '0001100000011000'B,'0001100000001100'B,'0001110000000111'B,
  554. X        '0001100000011000'B,'0001100000001100'B,'0001110000000111'B,
  555. X        '0001100000011000'B,'0001100000001100'B,'0001110000000111'B,
  556. X        '0001100000011000'B,'0001100000001100'B,'0001110000000111'B,
  557. X        '0001100000011000'B,'0001100000001100'B,'0001110000000111'B,
  558. X        '0001111111111000'B,'0001111111111100'B,'0000111111111110'B,
  559. X        '0000111111110000'B,'0000111111111000'B,'0000011111111100'B,
  560. X{'P'}
  561. X        '0000000000000000'B,'0000000000000000'B,'0001111111111100'B,
  562. X        '0000000000000000'B,'0000000000000000'B,'0001111111111110'B,
  563. X        '0000000000000000'B,'0001111111111000'B,'0001110000000111'B,
  564. X        '0000000000000000'B,'0001111111111100'B,'0001110000000111'B,
  565. X        '0001111111100000'B,'0001100000001100'B,'0001110000000111'B,
  566. X        '0001111111110000'B,'0001100000001100'B,'0001110000000111'B,
  567. X        '0001100000110000'B,'0001100000001100'B,'0001111111111110'B,
  568. X        '0001100000110000'B,'0001111111111100'B,'0001111111111100'B,
  569. X        '0001111111110000'B,'0001111111111000'B,'0001110000000000'B,
  570. X        '0001111111100000'B,'0001100000000000'B,'0001110000000000'B,
  571. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  572. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  573. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  574. X        '0001100000000000'B,'0001100000000000'B,'0001110000000000'B,
  575. X{'Q'}
  576. X        '0000000000000000'B,'0000000000000000'B,'0000011111111100'B,
  577. X        '0000000000000000'B,'0000000000000000'B,'0000111111111110'B,
  578. X        '0000000000000000'B,'0000111111111000'B,'0001110000000111'B,
  579. X        '0000000000000000'B,'0001111111111100'B,'0001110000000111'B,
  580. X        '0000111111100000'B,'0001100000001100'B,'0001110000000111'B,
  581. X        '0001111111110000'B,'0001100000001100'B,'0001110000000111'B,
  582. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  583. X        '0001100000110000'B,'0001100000001100'B,'0001110001100111'B,
  584. X        '0001100000110000'B,'0001100000001100'B,'0001110001110111'B,
  585. X        '0001100000110000'B,'0001100011001100'B,'0001110000111111'B,
  586. X        '0001100110110000'B,'0001100001101100'B,'0001110000011111'B,
  587. X        '0001100011110000'B,'0001100000111100'B,'0001110000001110'B,
  588. X        '0001111111100000'B,'0001111111111000'B,'0000111111111111'B,
  589. X        '0000111110110000'B,'0000111111101100'B,'0000011111110011'B,
  590. X%PAGE
  591. X{'R'}
  592. X        '0000000000000000'B,'0000000000000000'B,'0001111111111100'B,
  593. X        '0000000000000000'B,'0000000000000000'B,'0001111111111110'B,
  594. X        '0000000000000000'B,'0001111111111000'B,'0001110000000111'B,
  595. X        '0000000000000000'B,'0001111111111100'B,'0001110000000111'B,
  596. X        '0001111111100000'B,'0001100000001100'B,'0001110000000111'B,
  597. X        '0001111111110000'B,'0001100000001100'B,'0001110000000111'B,
  598. X        '0001100000110000'B,'0001100000001100'B,'0001111111111110'B,
  599. X        '0001100000110000'B,'0001111111111100'B,'0001111111111100'B,
  600. X        '0001111111110000'B,'0001111111111000'B,'0001110011100000'B,
  601. X        '0001111111100000'B,'0001100011000000'B,'0001110001110000'B,
  602. X        '0001100110000000'B,'0001100001100000'B,'0001110000111000'B,
  603. X        '0001100011000000'B,'0001100000110000'B,'0001110000011100'B,
  604. X        '0001100001100000'B,'0001100000011000'B,'0001110000001110'B,
  605. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  606. X{'S'}
  607. X        '0000000000000000'B,'0000000000000000'B,'0000001111111000'B,
  608. X        '0000000000000000'B,'0000000000000000'B,'0000111111111110'B,
  609. X        '0000000000000000'B,'0000111111110000'B,'0001110000000111'B,
  610. X        '0000000000000000'B,'0001111111111000'B,'0001110000000111'B,
  611. X        '0000111111100000'B,'0001100000011000'B,'0000111000000000'B,
  612. X        '0001111111110000'B,'0001100000000000'B,'0000011100000000'B,
  613. X        '0001100000110000'B,'0001100000000000'B,'0000000111000000'B,
  614. X        '0001100000000000'B,'0001111111110000'B,'0000000001110000'B,
  615. X        '0001111111100000'B,'0000111111111000'B,'0000000000011100'B,
  616. X        '0000111111110000'B,'0000000000011000'B,'0000000000001110'B,
  617. X        '0000000000110000'B,'0000000000011000'B,'0001110000000111'B,
  618. X        '0001100000110000'B,'0001100000011000'B,'0001110000000111'B,
  619. X        '0001111111110000'B,'0001111111111000'B,'0000111111111110'B,
  620. X        '0000111111100000'B,'0000111111110000'B,'0000001111111000'B,
  621. X{'T'}
  622. X        '0000000000000000'B,'0000000000000000'B,'0001111111111111'B,
  623. X        '0000000000000000'B,'0000000000000000'B,'0001111111111111'B,
  624. X        '0000000000000000'B,'0001111111111110'B,'0000000011100000'B,
  625. X        '0000000000000000'B,'0001111111111110'B,'0000000011100000'B,
  626. X        '0001111111111000'B,'0000000011000000'B,'0000000011100000'B,
  627. X        '0001111111111000'B,'0000000011000000'B,'0000000011100000'B,
  628. X        '0000000110000000'B,'0000000011000000'B,'0000000011100000'B,
  629. X        '0000000110000000'B,'0000000011000000'B,'0000000011100000'B,
  630. X        '0000000110000000'B,'0000000011000000'B,'0000000011100000'B,
  631. X        '0000000110000000'B,'0000000011000000'B,'0000000011100000'B,
  632. X        '0000000110000000'B,'0000000011000000'B,'0000000011100000'B,
  633. X        '0000000110000000'B,'0000000011000000'B,'0000000011100000'B,
  634. X        '0000000110000000'B,'0000000011000000'B,'0000000011100000'B,
  635. X        '0000000110000000'B,'0000000011000000'B,'0000000011100000'B,
  636. X%PAGE
  637. X{'U'}
  638. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  639. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  640. X        '0000000000000000'B,'0001100000001100'B,'0001110000000111'B,
  641. X        '0000000000000000'B,'0001100000001100'B,'0001110000000111'B,
  642. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  643. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  644. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  645. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  646. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  647. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  648. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  649. X        '0001100000110000'B,'0001100000001100'B,'0001110000000111'B,
  650. X        '0001111111110000'B,'0001111111111100'B,'0000111111111110'B,
  651. X        '0000111111100000'B,'0000111111111000'B,'0000011111111100'B,
  652. X{'V'}
  653. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  654. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  655. X        '0000000000000000'B,'0001100000000110'B,'0001110000000111'B,
  656. X        '0000000000000000'B,'0001100000000110'B,'0001110000000111'B,
  657. X        '0001100000011000'B,'0001100000000110'B,'0001110000000111'B,
  658. X        '0001100000011000'B,'0001100000000110'B,'0001110000000111'B,
  659. X        '0001100000011000'B,'0001100000000110'B,'0001110000000111'B,
  660. X        '0001100000011000'B,'0001100000000110'B,'0001110000000111'B,
  661. X        '0001100000011000'B,'0001100000000110'B,'0000110000001110'B,
  662. X        '0001100000011000'B,'0000110000001100'B,'0000011100011100'B,
  663. X        '0000110000110000'B,'0000011000011000'B,'0000001110111000'B,
  664. X        '0000011001100000'B,'0000001100110000'B,'0000000111110000'B,
  665. X        '0000001111000000'B,'0000000111100000'B,'0000000011100000'B,
  666. X        '0000000110000000'B,'0000000011000000'B,'0000000001000000'B,
  667. X{'W'}
  668. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  669. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  670. X        '0000000000000000'B,'0001100000001100'B,'0001110000000111'B,
  671. X        '0000000000000000'B,'0001100000001100'B,'0001110001000111'B,
  672. X        '0001100000110000'B,'0001100000001100'B,'0001110001000111'B,
  673. X        '0001100000110000'B,'0001100000001100'B,'0001110011100111'B,
  674. X        '0001100000110000'B,'0001100000001100'B,'0001110111110111'B,
  675. X        '0001100000110000'B,'0001100000001100'B,'0001111111111111'B,
  676. X        '0001100000110000'B,'0001100000001100'B,'0001111110111111'B,
  677. X        '0001100000110000'B,'0001100000001100'B,'0001111100011111'B,
  678. X        '0001100100110000'B,'0001100010001100'B,'0001111000001111'B,
  679. X        '0001101110110000'B,'0000110111011000'B,'0001110000000111'B,
  680. X        '0000111011100000'B,'0000011101110000'B,'0001100000000011'B,
  681. X        '0000010001000000'B,'0000001000100000'B,'0001000000000001'B,
  682. X%PAGE
  683. X{'X'}
  684. X        '0000000000000000'B,'0000000000000000'B,'0001100000000011'B,
  685. X        '0000000000000000'B,'0000000000000000'B,'0001110000000111'B,
  686. X        '0000000000000000'B,'0001100000000011'B,'0000111000001110'B,
  687. X        '0000000000000000'B,'0000110000000110'B,'0000011100011100'B,
  688. X        '0001100000001100'B,'0000011000001100'B,'0000001110111000'B,
  689. X        '0000110000011000'B,'0000001100011000'B,'0000000111110000'B,
  690. X        '0000011000110000'B,'0000000110110000'B,'0000000011100000'B,
  691. X        '0000001101100000'B,'0000000011100000'B,'0000000111110000'B,
  692. X        '0000000111000000'B,'0000000011100000'B,'0000001110111000'B,
  693. X        '0000000111000000'B,'0000000110110000'B,'0000011100011100'B,
  694. X        '0000001101100000'B,'0000001100011000'B,'0000111000001110'B,
  695. X        '0000011000110000'B,'0000011000001100'B,'0001110000000111'B,
  696. X        '0000110000011000'B,'0000110000000110'B,'0001100000000011'B,
  697. X        '0001100000001100'B,'0001100000000011'B,'0001000000000001'B,
  698. X{'Y'}
  699. X        '0000000000000000'B,'0000000000000000'B,'0001000000000001'B,
  700. X        '0000000000000000'B,'0000000000000000'B,'0001100000000011'B,
  701. X        '0000000000000000'B,'0001100000000011'B,'0001110000000111'B,
  702. X        '0000000000000000'B,'0001110000000111'B,'0000111000001110'B,
  703. X        '0001100000000110'B,'0000111000001110'B,'0000011100011100'B,
  704. X        '0000110000001100'B,'0000011100011100'B,'0000001110111000'B,
  705. X        '0000011000011000'B,'0000001110111000'B,'0000000111110000'B,
  706. X        '0000001100110000'B,'0000000111110000'B,'0000000011100000'B,
  707. X        '0000000111100000'B,'0000000011100000'B,'0000000011100000'B,
  708. X        '0000000011000000'B,'0000000011100000'B,'0000000011100000'B,
  709. X        '0000000011000000'B,'0000000011100000'B,'0000000011100000'B,
  710. X        '0000000011000000'B,'0000000011100000'B,'0000000011100000'B,
  711. X        '0000000011000000'B,'0000000011100000'B,'0000000011100000'B,
  712. X        '0000000011000000'B,'0000000011100000'B,'0000000011100000'B,
  713. X{'Z'}
  714. X        '0000000000000000'B,'0000000000000000'B,'0001111111111111'B,
  715. X        '0000000000000000'B,'0000000000000000'B,'0001111111111111'B,
  716. X        '0000000000000000'B,'0001111111111100'B,'0000000000001110'B,
  717. X        '0000000000000000'B,'0001111111111100'B,'0000000000011100'B,
  718. X        '0001111111110000'B,'0000000000011000'B,'0000000000111000'B,
  719. X        '0001111111110000'B,'0000000000110000'B,'0000000001110000'B,
  720. X        '0000000001100000'B,'0000000001100000'B,'0000000011100000'B,
  721. X        '0000000011000000'B,'0000000011000000'B,'0000000111000000'B,
  722. X        '0000000110000000'B,'0000000110000000'B,'0000001110000000'B,
  723. X        '0000001100000000'B,'0000001100000000'B,'0000011100000000'B,
  724. X        '0000011000000000'B,'0000011000000000'B,'0000111000000000'B,
  725. X        '0000110000000000'B,'0000110000000000'B,'0001110000000000'B,
  726. X        '0001111111110000'B,'0001111111111100'B,'0001111111111111'B,
  727. X        '0001111111110000'B,'0001111111111100'B,'0001111111111111'B,
  728. X%PAGE
  729. X{'a'}
  730. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  731. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  732. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  733. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  734. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  735. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  736. X        '0000000000000000'B,'0000000000000000'B,'0000111111000000'B,
  737. X        '0000000000000000'B,'0000111110000000'B,'0001111111100000'B,
  738. X        '0000000000000000'B,'0001111111000000'B,'0001100001100000'B,
  739. X        '0000111100000000'B,'0001100011000000'B,'0001111111100000'B,
  740. X        '0001000010000000'B,'0001111111000000'B,'0001111111100000'B,
  741. X        '0001111110000000'B,'0001111111000000'B,'0001100001100000'B,
  742. X        '0001000010000000'B,'0001100011000000'B,'0001100001100000'B,
  743. X        '0001000010000000'B,'0001100011000000'B,'0001100001100000'B,
  744. X{'b'}
  745. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  746. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  747. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  748. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  749. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  750. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  751. X        '0000000000000000'B,'0000000000000000'B,'0001111111000000'B,
  752. X        '0000000000000000'B,'0001111110000000'B,'0001111111100000'B,
  753. X        '0000000000000000'B,'0001111111000000'B,'0000110001100000'B,
  754. X        '0001111100000000'B,'0000100011000000'B,'0000111111000000'B,
  755. X        '0000100010000000'B,'0000111110000000'B,'0000111111000000'B,
  756. X        '0000111100000000'B,'0000100011000000'B,'0000110001100000'B,
  757. X        '0000100010000000'B,'0001111111000000'B,'0001111111100000'B,
  758. X        '0001111100000000'B,'0001111110000000'B,'0001111111000000'B,
  759. X{'c'}
  760. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  761. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  762. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  763. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  764. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  765. X        '0000000000000000'B,'0000000000000000'B,'0000000000000000'B,
  766. X        '0000000000000000'B,'0000000000000000'B,'0000111111000000'B,
  767. X        '0000000000000000'B,'0000111110000000'B,'0001111111100000'B,
  768. X        '0000000000000000'B,'0001111111000000'B,'0001100001100000'B,
  769. X        '0000111110000000'B,'0001100011000000'B,'0001100000000000'B,
  770. X        '0001000010000000'B,'0001100000000000'B,'0001100000000000'B,
  771. X        '0001000000000000'B,'0001100011000000'B,'0001100001100000'B,
  772. X        '0001000010000000'B,'0001111111000000'B,'0001111111100000'B,
  773. X        '0000111110000000'B,'0000111110000000'B,'0000111111000000'B,
  774. X%PAGE
  775. /
  776. echo 'x - sort.pascal'
  777. sed 's/^X//' > sort.pascal << '/'
  778. X{
  779. X    Copyright (c) 1981
  780. X    By:    Bell Telephone Laboratories, Inc. and
  781. X        Whitesmiths, Ltd.,
  782. X
  783. X    This software is derived from the book
  784. X        "Software Tools In Pascal", by
  785. X        Brian W. Kernighan and P.J. Plauger
  786. X        Addison-Wesley, 1981
  787. X        ISBN 0-201-10342-7
  788. X
  789. X    Right is hereby granted to freely distribute or duplicate this
  790. X    software, providing distribution or duplication is not for profit
  791. X    or other commerical gain and that this copyright notice remains 
  792. X    intact.
  793. X}
  794. X{ SortDriv -- Driver and Quick sort }
  795. Xprogram Sort;
  796. X%include SWTOOLS
  797. X%include ioref
  798. Xconst
  799. X    inCoreSize = 500;
  800. X    MERGEORDER = 5;
  801. Xtype
  802. X    LineType = -> StringType;
  803. X    fdBufType = array [1..MERGEORDER] of FileDesc;
  804. Xvar
  805. X    notEof: Boolean;
  806. X    inBuf: array [1..inCoreSize] of LineType;
  807. X    inFile: fdBufType;
  808. X    i: Integer;
  809. X    temp: StringType;
  810. X    depth: Integer;
  811. X    maxDepth: Integer;
  812. Xprocedure GName (n: Integer; var name: StringType);
  813. Xvar
  814. X    junk: Integer;
  815. X    temp: String(30);
  816. Xbegin
  817. X    WriteStr(temp, 'STEMP',n:1,' TEMP A');
  818. X    name := temp;
  819. Xend; {GName}
  820. Xprocedure GOpen (var inFile: fdBufType; f1, f2: Integer);
  821. Xvar
  822. X    name: StringType;
  823. X    i: 1..MERGEORDER;
  824. Xbegin
  825. X    for i := 1 to f2-f1+1 do begin
  826. X        GName (f1+i-1, name);
  827. X        inFile[i] := MustOpen(name, IOREAD);
  828. X    end; {for}
  829. Xend; {GOpen}
  830. Xprocedure GRemove (var inFile: fdBufType; f1, f2: Integer);
  831. Xvar
  832. X    name: StringType;
  833. X    i: 1..MERGEORDER;
  834. Xbegin
  835. X    for i := 1 to f2-f1+1 do begin
  836. X        FClose (inFile[i]);
  837. X        GName (f1+i-1, name);
  838. X        Remove (name);
  839. X    end; {for}
  840. Xend; {GRemove}
  841. Xfunction MakeFile (n: Integer): FileDesc;
  842. Xvar
  843. X    name: StringType;
  844. X    temp: FileDesc;
  845. Xbegin
  846. X    GName (n, name);
  847. X    temp := FCreate (name, IOWRITE);
  848. X    if temp = IOERROR then
  849. X        Error('Could not create temporary file' || Str(name));
  850. X    MakeFile := temp;
  851. Xend; {MakeFile}
  852. Xprocedure PText (nLines: Integer; outFile: FileDesc);
  853. Xvar
  854. X    i: Integer;
  855. Xbegin
  856. X    for i := 1 to nLines do begin
  857. X        PutStr(inBuf[i]@, outFile);
  858. X    end; {for}
  859. Xend; {PText}
  860. Xfunction GText (var nLines: Integer; inFile: FileDesc): Boolean;
  861. Xvar
  862. X    temp: StringType;
  863. X    done: Boolean;
  864. Xbegin
  865. X    nLines := 1;
  866. X    done := (GetLine(inBuf[nLines]@, inFile, MAXSTR) = false);
  867. X    while (not done) do begin
  868. X        nLines := nLines + 1;
  869. X        if nLines > inCoreSize then leave;
  870. X        done := (GetLine(inBuf[nLines]@, inFile, MAXSTR) = false);
  871. X    end; {while}
  872. X    nLines := nLines - 1;
  873. X    GText := done;
  874. Xend; {GText}
  875. X
  876. Xprocedure QSort(l,r: integer);
  877. X    var i,j: integer;
  878. X        temp, hold: LineType;
  879. Xbegin
  880. X    if l >= r then return;
  881. X    depth := depth + 1;
  882. X    maxDepth := Max (maxDepth, depth);
  883. X    i := l;
  884. X    j := r;
  885. X    temp := inBuf[(i+j) div 2];
  886. X    repeat
  887. X        while inBuf[i]@ < temp@ do
  888. X            i := i+1;
  889. X        while temp@ < inBuf[j]@ do
  890. X            j := j-1;
  891. X        if i <= j then begin
  892. X            hold := inBuf[i];
  893. X            inBuf[i] := inBuf[j];
  894. X            inBuf[j] := hold;
  895. X            i := i+1;
  896. X            j := j-1
  897. X        end
  898. X    until i > j;
  899. X    { if left smaller do: }
  900. X    if (j - l) < (r - i) then begin
  901. X        QSort(l,j);        {left side first}
  902. X        QSort(i,r);
  903. X    end
  904. X    else begin
  905. X        QSort(i,r);        {right side first}
  906. X        QSort(l,j);
  907. X    end; {if}
  908. X    depth := depth - 1;
  909. Xend {QSort} ;
  910. X{ Merge -- Merge infile[1] .. infile[nf] into outfile }
  911. Xprocedure Merge(var inFile: fdBufType; nf: Integer; outFile: FileDesc);
  912. Xvar
  913. X    i,j: Integer;
  914. X    lbp: Integer;
  915. X    temp: LineType;
  916. X    fromArray: array [1..MERGEORDER] of Integer;
  917. Xprocedure ReHeap (nf: Integer);
  918. Xvar
  919. X    i,j,k: Integer;
  920. X    temp: LineType;
  921. Xbegin
  922. X    i := 1;
  923. X    j := 2 * i;
  924. X    while (j <= nf) do begin
  925. X        if (j < nf) then { find smaller child }
  926. X            if inBuf[j]@ > inBuf[j+1]@ then
  927. X                j := j + 1;
  928. X        if inBuf[i]@ <= inBuf[j]@ then
  929. X            i := nf { proper position found, terminate loop }
  930. X        else begin
  931. X            k := fromArray[i];
  932. X            fromArray[i] := fromArray[j];
  933. X            fromArray[j] := k;
  934. X            temp := inBuf[i];
  935. X            inBuf[i] := inBuf[j];
  936. X            inBuf[j] := temp;
  937. X        end; {if}
  938. X        i := j;
  939. X        j := 2 * i;
  940. X    end; {while}
  941. Xend; {while}
  942. Xprocedure PermSort(l,r: Integer);
  943. Xvar
  944. X    i,j,k: Integer;
  945. X    temp: LineType;
  946. Xbegin
  947. X    for i := 1 to r do
  948. X        fromArray[i] := i;
  949. X
  950. X    for i := r downto 2 do
  951. X        for j := 1 to i-1 do
  952. X            if inBuf[j]@ > inBuf[j + 1]@ then begin
  953. X                k := fromArray[j];
  954. X                fromArray[j] := fromArray[j + 1];
  955. X                fromArray[j + 1] := k;
  956. X                temp := inBuf[j];
  957. X                inBuf[j] := inBuf[j + 1];
  958. X                inBuf[j + 1] := temp;
  959. X            end; {if}
  960. Xend; {PermSort}
  961. Xbegin
  962. X    j := 1;
  963. X    for i := 1 to nf do { get one line from each file }
  964. X        if GetLine(inBuf[j]@, inFile[i], MAXSTR) then
  965. X            j := j + 1;
  966. X    nf := j - 1;
  967. X    PermSort (1, nf);   { make initial heap }
  968. X    while (nf > 0) do begin
  969. X        PutStr(inBuf[1]@, outFile);
  970. X        if not
  971. X            (GetLine(inBuf[1]@, inFile[fromArray[1]], MAXSTR))
  972. X                then begin
  973. X            temp := inBuf[1];
  974. X            inBuf[1] := inBuf[nf];
  975. X            inBuf[nf] := temp;
  976. X            fromArray[1] := fromArray[nf];
  977. X            nf := nf - 1;
  978. X        end; {if}
  979. X        ReHeap(nf);
  980. X    end; {while}
  981. Xend; {Merge}
  982. X
  983. Xvar
  984. X    done: Boolean;
  985. X    nLines: Integer;
  986. X    highMark: Integer;
  987. X    lowMark: Integer;
  988. X    lim: Integer;
  989. X    outFile: FileDesc;
  990. X    name: StringType;
  991. Xbegin
  992. X    ToolInit;
  993. X    highMark := 0;
  994. X    for i := 1 to inCoreSize do
  995. X        New(inBuf[i]);
  996. X
  997. X    repeat { initial formation of runs }
  998. X        done := GText (nLines, STDIN);
  999. X        depth := 0;
  1000. X        maxDepth := 0;
  1001. X        QSort(1, nLines);
  1002. X        highMark := highMark + 1;
  1003. X        outFile := MakeFile(highMark);
  1004. X        PText (nLines, outFile);
  1005. X        FClose (outFile);
  1006. X    until (done);
  1007. X    lowMark := 1;
  1008. X    while (lowMark < highMark) do begin { merge runs }
  1009. X        lim := Min(lowMark +  MERGEORDER - 1, highMark);
  1010. X        GOpen (inFile, lowMark, lim);
  1011. X        highMark := highMark + 1;
  1012. X        outFile := MakeFile(highMark);
  1013. X        Merge(inFile, lim-lowMark+1, outFile);
  1014. X        FClose (outFile);
  1015. X        GRemove (inFile, lowMark, lim);
  1016. X        lowMark := lowMark + MERGEORDER;
  1017. X    end; {while}
  1018. X    GName (highMark, name); { final cleanup }
  1019. X    outFile := FOpen (name, IOREAD);
  1020. X    FCopy (outFile, STDOUT);
  1021. X    FClose (outFile);
  1022. X    Remove (name);
  1023. Xend.
  1024. /
  1025. echo 'Part 02 of pack.out complete.'
  1026. exit
  1027.  
  1028.  
  1029.