PACK.LST 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. Listing:
  2. 1 (*%T _fcall *) (*# call(near_call=>on,seg_name=>Btree) *) (*%E *)
  3. 2 IMPLEMENTATION MODULE Pack;
  4. 3 (*
  5. 4 Copyright (C) 1990 Jensen & Partners International
  6. 5 *)
  7. 6
  8. 7
  9. 8
  10. 9 IMPORT Btree, apack2;
  11. 10 (*%T _mthread *)
  12. 11 IMPORT Process;
  13. 12 (*%E *)
  14. 13
  15. 14
  16. 15
  17. 16 MODULE inline;
  18. 17
  19. 18 EXPORT MemMove, MemFastMove, AddAddr, IncAddr, DecAddr;
  20. 19
  21. 20 TYPE
  22. 21 A2 = ARRAY[0..1] OF SHORTCARD;
  23. ***** ^ not supported yet
  24. ***** ^ not supported yet
  25. 22 A3 = ARRAY[0..2] OF SHORTCARD;
  26. ***** ^ not supported yet
  27. ***** ^ not supported yet
  28. 23 A6 = ARRAY[0..5] OF SHORTCARD;
  29. ***** ^ not supported yet
  30. ***** ^ not supported yet
  31. 24 A8 = ARRAY[0..7] OF SHORTCARD;
  32. ***** ^ not supported yet
  33. ***** ^ not supported yet
  34. 25 A19 = ARRAY[0..18] OF SHORTCARD;
  35. ***** ^ not supported yet
  36. ***** ^ not supported yet
  37. 26 A21 = ARRAY[0..20] OF SHORTCARD;
  38. ***** ^ not supported yet
  39. ***** ^ not supported yet
  40. 27
  41. 28 (*%T _fptr *)
  42. 29
  43. 30 (*# save *)
  44. 31 (*# call(inline=>on) *)
  45. 32 (*# call(reg_param=>(si,ax,di,es,cx),reg_saved=>(ax,bx,dx,ds,es,st1,st2,st3,st4,st5,st6)) *)
  46. 33 PROCEDURE MemMove(s,r: ADDRESS; c: CARDINAL)=A21(0E3H,013H,(* jcxz $1 *)
  47. ***** ^ undeclared identifier
  48. ***** ^ not supported yet
  49. 34 09CH, (* pushf *)
  50. 35 01EH, (* push ds *)
  51. 36 08EH,0D8H,(* mov ds,ax *)
  52. 37 03BH,0FEH,(* cmp di,si *)
  53. 38 072H,007H,(* jb $0 *)
  54. 39 003H,0F1H,(* add si,cx *)
  55. 40 003H,0F9H,(* add di,cx *)
  56. 41 04EH, (* dec si *)
  57. 42 04FH, (* dec di *)
  58. 43 0FDH, (* std *)
  59. 44 (* $0: *)
  60. 45 0F3H,0A4H,(* rep ;movsb *)
  61. 46 01FH, (* pop ds *)
  62. 47 09DH); (* popf *)
  63. 48 (* $1: *)
  64. 49 (*# restore *)
  65. 50
  66. 51 (*# save *)
  67. 52 (*# call(inline=>on) *)
  68. 53 (*# call(reg_param=>(si,ax,di,es,cx),reg_saved=>(ax,bx,dx,ds,es,st1,st2,st3,st4,st5,st6)) *)
  69. 54 PROCEDURE MemFastMove(s,r: ADDRESS; c: CARDINAL)=A8(0E3H,006H,(* jcxz $0 *)
  70. ***** ^ undeclared identifier
  71. ***** ^ not supported yet
  72. 55 01EH, (* push ds *)
  73. 56 08EH,0D8H,(* mov ds,ax *)
  74. 57 0F3H,0A4H,(* rep ;movsb *)
  75. 58 01FH); (* pop ds *)
  76. 59 (* $0: *)
  77. 60 (*# restore *)
  78. 61
  79. 62 (*# save *)
  80. 63 (*# call(inline=>on) *)
  81. 64 (*# call(reg_param=>(ax,dx,cx),reg_saved=>(bx,cx,dx,si,di,ds,es,st1,st2,st3,st4,st5,st6)) *)
  82. 65 PROCEDURE AddAddr(A: ADDRESS; I: CARDINAL): ADDRESS=A2(003H,0C1H);(*add ax,cx*)
  83. ***** ^ undeclared identifier
  84. ***** ^ undeclared identifier
  85. ***** ^ not supported yet
  86. 66 (*# restore *)
  87. 67
  88. 68 (*# save *)
  89. 69 (*# call(inline=>on) *)
  90. 70 (*# call(reg_param=>(bx,es,ax),reg_saved=>(ax,bx,cx,dx,si,di,ds,es,st1,st2,st3,st4,st5,st6)) *)
  91. 71 PROCEDURE IncAddr(VAR a: ADDRESS; i: CARDINAL)=A3(026H,001H,007H); (* add es:[bx],cx *)
  92. ***** ^ undeclared identifier
  93. ***** ^ not supported yet
  94. 72 (*# restore *)
  95. 73
  96. 74 (*# save *)
  97. 75 (*# call(inline=>on) *)
  98. 76 (*# call(reg_param=>(bx,es,ax),reg_saved=>(ax,bx,cx,dx,si,di,ds,es,st1,st2,st3,st4,st5,st6)) *)
  99. 77 PROCEDURE DecAddr(VAR a: ADDRESS; i: CARDINAL)=A3(026H,029H,007H); (* sub es:[bx],cx *)
  100. ***** ^ undeclared identifier
  101. ***** ^ not supported yet
  102. 78 (*# restore *)
  103. 79
  104. 80 (*%E *)
  105. 81
  106. 82 (*%F _fptr *)
  107. 83
  108. 84 (*# save *)
  109. 85 (*# call(inline=>on) *)
  110. 86 (*# call(reg_param=>(si,di,cx),reg_saved=>(ax,bx,dx,ds,st1,st2,st3,st4,st5,st6)) *)
  111. 87 PROCEDURE MemMove(s,r: ADDRESS; c: CARDINAL)=A19(0E3H,011H,(* jcxz $1 *)
  112. 88 09CH, (* pushf *)
  113. 89 01EH, (* push ds *)
  114. 90 007H, (* pop es *)
  115. 91 03BH,0FEH,(* cmp di,si *)
  116. 92 072H,007H,(* jb $0 *)
  117. 93 003H,0F1H,(* add si,cx *)
  118. 94 003H,0F9H,(* add di,cx *)
  119. 95 04EH, (* dec si *)
  120. 96 04FH, (* dec di *)
  121. 97 0FDH, (* std *)
  122. 98 (* $0: *)
  123. 99 0F3H,0A4H,(* rep; movsb*)
  124. 100 09DH); (* popf *)
  125. 101 (* $1: *)
  126. 102 (*# restore *)
  127. 103
  128. 104 (*# save *)
  129. 105 (*# call(inline=>on) *)
  130. 106 (*# call(reg_param=>(si,di,cx),reg_saved=>(ax,bx,dx,ds,st1,st2,st3,st4,st5,st6)) *)
  131. 107 PROCEDURE MemFastMove(s,r: ADDRESS; c: CARDINAL)=A6(0E3H,004H, (* jcxz $0 *)
  132. 108 01EH, (* push ds *)
  133. 109 007H, (* pop es *)
  134. 110 0F3H,0A4H); (* rep; movsb*)
  135. 111 (* $0: *)
  136. 112 (*# restore *)
  137. 113
  138. 114 (*# save *)
  139. 115 (*# call(inline=>on) *)
  140. 116 (*# call(reg_param=>(ax,cx),reg_saved=>(bx,cx,dx,si,di,ds,es,st1,st2,st3,st4,st5,st6)) *)
  141. 117 PROCEDURE AddAddr(A: ADDRESS; I: CARDINAL): ADDRESS=A2(003H,0C1H);(*add ax,cx*)
  142. 118 (*# restore *)
  143. 119
  144. 120 (*# save *)
  145. 121 (*# call(inline=>on) *)
  146. 122 (*# call(reg_param=>(bx,ax),reg_saved=>(ax,bx,cx,dx,si,di,ds,es,st1,st2,st3,st4,st5,st6)) *)
  147. 123 PROCEDURE IncAddr(VAR a: ADDRESS; i: CARDINAL)=A2(001H,007H); (* add [bx],cx *)
  148. 124 (*# restore *)
  149. 125
  150. 126 (*# save *)
  151. 127 (*# call(inline=>on) *)
  152. 128 (*# call(reg_param=>(bx,ax),reg_saved=>(ax,bx,cx,dx,si,di,ds,es,st1,st2,st3,st4,st5,st6)) *)
  153. 129 PROCEDURE DecAddr(VAR a: ADDRESS; i: CARDINAL)=A2(029H,007H); (* sub [bx],cx *)
  154. 130 (*# restore *)
  155. 131
  156. 132 (*%E *)
  157. 133
  158. 134 END inline;
  159. ***** ^ not supported yet
  160. 135
  161. 136
  162. 137
  163. 138 TYPE
  164. 139 PackBlk = RECORD
  165. 140 _up,_p : CARDINAL;
  166. 141 END;
  167. ***** ^ not supported yet
  168. 142 PackBlkPtr = POINTER TO PackBlk;
  169. ***** ^ not supported yet
  170. 143
  171. 144
  172. 145
  173. 146 PROCEDURE Packer(n: CARDINAL; in: ADDRESS; out: ADDRESS): CARDINAL;
  174. ***** ^ undeclared identifier
  175. ***** ^ undeclared identifier
  176. 147 VAR
  177. 148 ofs : CARDINAL;
  178. 149 BEGIN
  179. 150 ofs := Ofs(out^);
  180. ***** ^ undeclared identifier
  181. ***** ^ not supported yet
  182. 151 WHILE n#0 DO
  183. 152 IF n>apack2.buf_size THEN
  184. ***** ^ not supported yet
  185. ***** ^ not supported yet
  186. 153 PackBlkPtr(out)^._up := apack2.buf_size;
  187. ***** ^ not supported yet
  188. ***** ^ not supported yet
  189. ***** ^ not supported yet
  190. ***** ^ not supported yet
  191. 154 ELSE
  192. 155 PackBlkPtr(out)^._up := n;
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. 156 END;
  196. 157 (*%T _mthread *) Process.Lock(); (*%E *)
  197. ***** ^ not supported yet
  198. ***** ^ not supported yet
  199. ***** ^ not supported yet
  200. 158 PackBlkPtr(out)^._p := apack2.Pack(PackBlkPtr(out)^._up,in);
  201. ***** ^ not supported yet
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. ***** ^ not supported yet
  205. ***** ^ not supported yet
  206. ***** ^ not supported yet
  207. ***** ^ not supported yet
  208. 159 (*%T _mthread *) Process.Unlock(); (*%E *)
  209. ***** ^ not supported yet
  210. ***** ^ not supported yet
  211. ***** ^ not supported yet
  212. 160 IF PackBlkPtr(out)^._up<=PackBlkPtr(out)^._p THEN
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. 161 PackBlkPtr(out)^._p := PackBlkPtr(out)^._up;
  218. ***** ^ not supported yet
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. ***** ^ not supported yet
  222. 162 MemFastMove(in,AddAddr(out,SIZE(PackBlk)),PackBlkPtr(out)^._p);
  223. ***** ^ undeclared identifier
  224. ***** ^ not supported yet
  225. ***** ^ undeclared identifier
  226. ***** ^ not supported yet
  227. ***** ^ undeclared identifier
  228. ***** ^ not supported yet
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. 163 ELSE
  232. 164 MemFastMove(ADR(apack2.p),AddAddr(out,SIZE(PackBlk)),PackBlkPtr(out)^._p);
  233. ***** ^ undeclared identifier
  234. ***** ^ undeclared identifier
  235. ***** ^ not supported yet
  236. ***** ^ not supported yet
  237. ***** ^ undeclared identifier
  238. ***** ^ not supported yet
  239. ***** ^ undeclared identifier
  240. ***** ^ not supported yet
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. 165 END;
  244. 166 DEC(n,PackBlkPtr(out)^._up);
  245. ***** ^ undeclared identifier
  246. ***** ^ not supported yet
  247. ***** ^ not supported yet
  248. 167 IncAddr(in,PackBlkPtr(out)^._up);
  249. ***** ^ undeclared identifier
  250. ***** ^ not supported yet
  251. ***** ^ not supported yet
  252. ***** ^ not supported yet
  253. 168 IncAddr(out,SIZE(PackBlk)+PackBlkPtr(out)^._p);
  254. ***** ^ undeclared identifier
  255. ***** ^ not supported yet
  256. ***** ^ undeclared identifier
  257. ***** ^ not supported yet
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. 169 END;
  261. 170 PackBlkPtr(out)^._up := 0;
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. 171 PackBlkPtr(out)^._p := 0;
  265. ***** ^ not supported yet
  266. ***** ^ not supported yet
  267. 172 RETURN Ofs(out^)-ofs+SIZE(PackBlk);
  268. ***** ^ undeclared identifier
  269. ***** ^ not supported yet
  270. ***** ^ undeclared identifier
  271. ***** ^ not supported yet
  272. 173 END Packer;
  273. ***** ^ not supported yet
  274. 174
  275. 175
  276. 176
  277. 177 PROCEDURE Unpacker(n: CARDINAL; in: ADDRESS; out: ADDRESS);
  278. ***** ^ undeclared identifier
  279. ***** ^ undeclared identifier
  280. 178 BEGIN
  281. 179 WHILE PackBlkPtr(in)^._p#0 DO
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. 180 IF PackBlkPtr(in)^._up=PackBlkPtr(in)^._p THEN
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. 181 MemFastMove(AddAddr(in,SIZE(PackBlk)),out,PackBlkPtr(in)^._up);
  290. ***** ^ undeclared identifier
  291. ***** ^ undeclared identifier
  292. ***** ^ not supported yet
  293. ***** ^ undeclared identifier
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. ***** ^ not supported yet
  297. ***** ^ not supported yet
  298. 182 ELSE
  299. 183 MemFastMove(AddAddr(in,SIZE(PackBlk)),ADR(apack2.p),PackBlkPtr(in)^._p);
  300. ***** ^ undeclared identifier
  301. ***** ^ undeclared identifier
  302. ***** ^ not supported yet
  303. ***** ^ undeclared identifier
  304. ***** ^ not supported yet
  305. ***** ^ undeclared identifier
  306. ***** ^ not supported yet
  307. ***** ^ not supported yet
  308. ***** ^ not supported yet
  309. ***** ^ not supported yet
  310. 184 (*%T _mthread *) Process.Lock(); (*%E *)
  311. ***** ^ not supported yet
  312. ***** ^ not supported yet
  313. ***** ^ not supported yet
  314. 185 apack2.Unpack(PackBlkPtr(in)^._up,out);
  315. ***** ^ not supported yet
  316. ***** ^ not supported yet
  317. ***** ^ not supported yet
  318. ***** ^ not supported yet
  319. ***** ^ not supported yet
  320. 186 (*%T _mthread *) Process.Unlock(); (*%E *)
  321. ***** ^ not supported yet
  322. ***** ^ not supported yet
  323. ***** ^ not supported yet
  324. 187 END;
  325. 188 IncAddr(out,PackBlkPtr(in)^._up);
  326. ***** ^ undeclared identifier
  327. ***** ^ not supported yet
  328. ***** ^ not supported yet
  329. ***** ^ not supported yet
  330. 189 IncAddr(in,SIZE(PackBlk)+PackBlkPtr(in)^._p);
  331. ***** ^ undeclared identifier
  332. ***** ^ not supported yet
  333. ***** ^ undeclared identifier
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. ***** ^ not supported yet
  337. 190 END;
  338. 191 END Unpacker;
  339. ***** ^ not supported yet
  340. 192
  341. 193
  342. 194
  343. 195 PROCEDURE UnpackedSize(n: CARDINAL; in: ADDRESS): CARDINAL;
  344. ***** ^ undeclared identifier
  345. 196 VAR
  346. 197 tmp : CARDINAL;
  347. 198 BEGIN
  348. 199 tmp := 0;
  349. 200 WHILE PackBlkPtr(in)^._p#0 DO
  350. ***** ^ not supported yet
  351. ***** ^ not supported yet
  352. 201 INC(tmp,PackBlkPtr(in)^._up);
  353. ***** ^ undeclared identifier
  354. ***** ^ not supported yet
  355. ***** ^ not supported yet
  356. 202 IncAddr(in,SIZE(PackBlk)+PackBlkPtr(in)^._p);
  357. ***** ^ undeclared identifier
  358. ***** ^ not supported yet
  359. ***** ^ undeclared identifier
  360. ***** ^ not supported yet
  361. ***** ^ not supported yet
  362. ***** ^ not supported yet
  363. 203 END;
  364. 204 RETURN tmp;
  365. 205 END UnpackedSize;
  366. ***** ^ not supported yet
  367. 206
  368. 207
  369. 208
  370. 209 PROCEDURE Packing(): BOOLEAN;
  371. 210 BEGIN
  372. 211 RETURN TRUE;
  373. 212 END Packing;
  374. ***** ^ not supported yet
  375. 213
  376. 214
  377. 215
  378. 216 PROCEDURE AdjustBlock(rs: CARDINAL): CARDINAL;
  379. 217 BEGIN
  380. 218 INC(rs,(rs+apack2.buf_size-1) DIV apack2.buf_size * SIZE(CARDINAL)*2);
  381. ***** ^ undeclared identifier
  382. ***** ^ not supported yet
  383. ***** ^ not supported yet
  384. ***** ^ not supported yet
  385. ***** ^ not supported yet
  386. ***** ^ undeclared identifier
  387. ***** ^ not supported yet
  388. ***** ^ not supported yet
  389. 219 RETURN rs;
  390. 220 END AdjustBlock;
  391. ***** ^ not supported yet
  392. 221
  393. 222
  394. 223 BEGIN
  395. 224 Btree.Packer := Packer;
  396. ***** ^ not supported yet
  397. ***** ^ not supported yet
  398. ***** ^ not supported yet
  399. 225 Btree.Unpacker := Unpacker;
  400. ***** ^ not supported yet
  401. ***** ^ not supported yet
  402. ***** ^ not supported yet
  403. 226 Btree.UnpackedSize := UnpackedSize;
  404. ***** ^ not supported yet
  405. ***** ^ not supported yet
  406. ***** ^ not supported yet
  407. 227 Btree.Packing := Packing;
  408. ***** ^ not supported yet
  409. ***** ^ not supported yet
  410. ***** ^ not supported yet
  411. 228 Btree.AdjustBlock := AdjustBlock;
  412. ***** ^ not supported yet
  413. ***** ^ not supported yet
  414. ***** ^ not supported yet
  415. 229 END Pack.
  416. ***** ^ not supported yet
  417. 186 errors