M2STRING.LST 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. Listing:
  2. 1 IMPLEMENTATION MODULE M2Strings;
  3. 2 (*
  4. 3 * REPERTOIRE
  5. 4 * Release 1.6
  6. 5 * By Charles Bradford and Cole Brecheen
  7. 6 * (c) Copyright 1985-1992 PMI
  8. 7 * Green Bay, Wisconsin
  9. 8 * All rights reserved
  10. 9 * (414) 468-6040
  11. 10 *
  12. 11 * $Header: D:/logfiles/mods/m2string.mov 1.5 10 Mar 1991 15:29:14 coleb $
  13. 12 *
  14. 13 *)
  15. 14
  16. 15
  17. 16 IMPORT LowLevel;
  18. 17 IMPORT SYSTEM;
  19. 18 IMPORT PosUtils;
  20. 19
  21. 20 VAR
  22. 21 Initialized : BOOLEAN;
  23. 22
  24. 23 PROCEDURE Init();
  25. 24 BEGIN
  26. 25 IF Initialized THEN
  27. 26 RETURN;
  28. 27 ELSE
  29. 28 Initialized := TRUE;
  30. 29 END;
  31. 30 LowLevel.Init();
  32. ***** ^ not supported yet
  33. ***** ^ not supported yet
  34. ***** ^ not supported yet
  35. 31 PosUtils.Init();
  36. ***** ^ not supported yet
  37. ***** ^ not supported yet
  38. ***** ^ not supported yet
  39. 32 END Init;
  40. ***** ^ not supported yet
  41. 33
  42. 34
  43. 35 PROCEDURE Assign(VAR source : ARRAY OF CHAR; VAR dest : ARRAY OF CHAR);
  44. ***** ^ not supported yet
  45. ***** ^ not supported yet
  46. 36 VAR
  47. 37 size1, size2 : CARDINAL;
  48. 38 BEGIN
  49. 39 size1 := HIGH(source)+1;
  50. ***** ^ undeclared identifier
  51. ***** ^ not supported yet
  52. 40 size2 := HIGH(dest)+1;
  53. ***** ^ undeclared identifier
  54. ***** ^ not supported yet
  55. 41 IF size1>=size2 THEN
  56. 42 LowLevel.Move(SYSTEM.ADR(source), SYSTEM.ADR(dest), size2);
  57. ***** ^ not supported yet
  58. ***** ^ not supported yet
  59. ***** ^ not supported yet
  60. ***** ^ not supported yet
  61. ***** ^ not supported yet
  62. ***** ^ not supported yet
  63. ***** ^ not supported yet
  64. ***** ^ not supported yet
  65. ***** ^ not supported yet
  66. 43 ELSE
  67. 44 LowLevel.Move(SYSTEM.ADR(source), SYSTEM.ADR(dest), size1);
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. ***** ^ not supported yet
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. ***** ^ not supported yet
  77. 45 dest[size1] := 0C;
  78. ***** ^ not supported yet
  79. ***** ^ not supported yet
  80. 46 END;
  81. 47 END Assign;
  82. ***** ^ not supported yet
  83. 48
  84. 49
  85. 50 PROCEDURE Insert(substr : ARRAY OF CHAR; VAR str : ARRAY OF CHAR;
  86. ***** ^ not supported yet
  87. ***** ^ not supported yet
  88. 51 inx : CARDINAL);
  89. 52 VAR
  90. 53 room, lngth1, size2 : CARDINAL;
  91. 54 BEGIN
  92. 55 lngth1 := Length(substr);
  93. ***** ^ undeclared identifier
  94. ***** ^ not supported yet
  95. 56 IF (lngth1=0) OR (inx>HIGH(str)) THEN
  96. ***** ^ undeclared identifier
  97. ***** ^ not supported yet
  98. 57 RETURN;
  99. 58 END;
  100. 59 size2 := HIGH(str)+1;
  101. ***** ^ undeclared identifier
  102. ***** ^ not supported yet
  103. 60 room := size2-inx;
  104. 61 LowLevel.ShiftArrayRight(SYSTEM.ADR(str[inx]), room, lngth1);
  105. ***** ^ not supported yet
  106. ***** ^ not supported yet
  107. ***** ^ not supported yet
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. ***** ^ not supported yet
  112. 62 IF lngth1>room THEN
  113. 63 LowLevel.Move(SYSTEM.ADR(substr), SYSTEM.ADR(str[inx]), room);
  114. ***** ^ not supported yet
  115. ***** ^ not supported yet
  116. ***** ^ not supported yet
  117. ***** ^ not supported yet
  118. ***** ^ not supported yet
  119. ***** ^ not supported yet
  120. ***** ^ not supported yet
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. ***** ^ not supported yet
  124. 64 ELSE
  125. 65 LowLevel.Move(SYSTEM.ADR(substr), SYSTEM.ADR(str[inx]), lngth1);
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. ***** ^ not supported yet
  129. ***** ^ not supported yet
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. ***** ^ not supported yet
  136. 66 END;
  137. 67 END Insert;
  138. ***** ^ not supported yet
  139. 68
  140. 69
  141. 70 PROCEDURE Delete(VAR str : ARRAY OF CHAR; inx : CARDINAL; len :
  142. ***** ^ not supported yet
  143. 71 CARDINAL);
  144. 72 VAR
  145. 73 room, lngth : CARDINAL;
  146. 74 BEGIN
  147. 75 lngth := Length(str);
  148. ***** ^ undeclared identifier
  149. ***** ^ not supported yet
  150. 76 IF (len=0) OR (inx>=lngth) THEN
  151. 77 RETURN;
  152. 78 END;
  153. 79 room := lngth-inx;
  154. 80 IF len>room THEN
  155. 81 len := room;
  156. 82 END;
  157. 83 IF room>1 THEN
  158. 84 LowLevel.ShiftArrayLeft(SYSTEM.ADR(str[inx]), room, len);
  159. ***** ^ not supported yet
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. ***** ^ not supported yet
  164. ***** ^ not supported yet
  165. ***** ^ not supported yet
  166. 85 END;
  167. 86 str[lngth-len] := 0C;
  168. ***** ^ not supported yet
  169. ***** ^ not supported yet
  170. 87 END Delete;
  171. ***** ^ not supported yet
  172. 88
  173. 89
  174. 90 PROCEDURE Pos(substr, str : ARRAY OF CHAR) : CARDINAL;
  175. ***** ^ not supported yet
  176. 91 BEGIN
  177. 92 RETURN PosUtils.Pos(substr,str);
  178. ***** ^ not supported yet
  179. ***** ^ not supported yet
  180. ***** ^ not supported yet
  181. ***** ^ not supported yet
  182. 93 END Pos;
  183. ***** ^ not supported yet
  184. 94
  185. 95
  186. 96 PROCEDURE Copy(str : ARRAY OF CHAR; inx : CARDINAL; len : CARDINAL;
  187. ***** ^ not supported yet
  188. 97 VAR result : ARRAY OF CHAR);
  189. ***** ^ not supported yet
  190. 98 VAR
  191. 99 lngth1, size2, room : CARDINAL;
  192. 100 BEGIN
  193. 101 lngth1 := Length(str);
  194. ***** ^ undeclared identifier
  195. ***** ^ not supported yet
  196. 102 size2 := HIGH(result)+1;
  197. ***** ^ undeclared identifier
  198. ***** ^ not supported yet
  199. 103 result[0] := 0C;
  200. ***** ^ not supported yet
  201. ***** ^ not supported yet
  202. 104 (*This sets result to null in case we return from the
  203. 105 procedure in the next statement.*)
  204. 106 IF (len=0) OR (inx>=lngth1) THEN
  205. 107 RETURN;
  206. 108 END;
  207. 109 room := lngth1-inx;
  208. 110 IF len>room THEN
  209. 111 len := room;
  210. 112 END;
  211. 113 IF len>=size2 THEN
  212. 114 LowLevel.Move(SYSTEM.ADR(str[inx]), SYSTEM.ADR(result), size2);
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. ***** ^ not supported yet
  218. ***** ^ not supported yet
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. ***** ^ not supported yet
  222. ***** ^ not supported yet
  223. 115 ELSE
  224. 116 LowLevel.Move(SYSTEM.ADR(str[inx]), SYSTEM.ADR(result), len);
  225. ***** ^ not supported yet
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. ***** ^ not supported yet
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. ***** ^ not supported yet
  234. ***** ^ not supported yet
  235. 117 result[len] := 0C;
  236. ***** ^ not supported yet
  237. ***** ^ not supported yet
  238. 118 END;
  239. 119 END Copy;
  240. ***** ^ not supported yet
  241. 120
  242. 121
  243. 122 PROCEDURE Concat(s1, s2 : ARRAY OF CHAR; VAR result : ARRAY OF CHAR);
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. 123 BEGIN
  247. 124 Assign(s2, result);
  248. ***** ^ not supported yet
  249. ***** ^ not supported yet
  250. ***** ^ not supported yet
  251. 125 Insert(s1, result, 0);
  252. ***** ^ not supported yet
  253. ***** ^ not supported yet
  254. ***** ^ not supported yet
  255. ***** ^ not supported yet
  256. 126 END Concat;
  257. ***** ^ not supported yet
  258. 127
  259. 128
  260. 129 PROCEDURE Length(VAR str : ARRAY OF CHAR) : CARDINAL;
  261. ***** ^ not supported yet
  262. 130 VAR
  263. 131 StrSize, skipped : INTEGER;
  264. 132 BEGIN
  265. 133 StrSize := INTEGER(HIGH(str)+1);
  266. ***** ^ undeclared identifier
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. 134 skipped := LowLevel.ScanEQ(StrSize,0C,SYSTEM.ADR(str));
  270. ***** ^ not supported yet
  271. ***** ^ not supported yet
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. ***** ^ not supported yet
  275. 135 RETURN CARDINAL(skipped);
  276. ***** ^ not supported yet
  277. 136 END Length;
  278. ***** ^ not supported yet
  279. 137
  280. 138
  281. 139 PROCEDURE CompareStr(s1, s2 : ARRAY OF CHAR) : INTEGER;
  282. ***** ^ not supported yet
  283. 140 VAR
  284. 141 TmpAdr1, TmpAdr2 : LowLevel.Address8086;
  285. ***** ^ not supported yet
  286. 142 len1, len2, CompLen, cnt : CARDINAL;
  287. 143 result: INTEGER;
  288. 144 BEGIN
  289. 145 result := 0;
  290. 146 TmpAdr1.a := SYSTEM.ADR(s1);
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. ***** ^ not supported yet
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. 147 TmpAdr2.a := SYSTEM.ADR(s2);
  297. ***** ^ not supported yet
  298. ***** ^ not supported yet
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. 148 len1 := Length(s1);
  303. ***** ^ not supported yet
  304. ***** ^ not supported yet
  305. 149 len2 := Length(s2);
  306. ***** ^ not supported yet
  307. ***** ^ not supported yet
  308. 150 IF (HIGH(s1)+1) < len1 THEN len1 := HIGH(s1)+1 END;
  309. ***** ^ undeclared identifier
  310. ***** ^ not supported yet
  311. ***** ^ undeclared identifier
  312. ***** ^ not supported yet
  313. 151 IF (HIGH(s2)+1) < len2 THEN len2 := HIGH(s2)+1 END;
  314. ***** ^ undeclared identifier
  315. ***** ^ not supported yet
  316. ***** ^ undeclared identifier
  317. ***** ^ not supported yet
  318. 152 CompLen := len1;
  319. 153 IF CompLen > len2 THEN
  320. 154 CompLen := len2;
  321. 155 END;
  322. 156 cnt := 0;
  323. 157 WHILE (cnt < CompLen) AND (result = 0) DO
  324. 158 IF TmpAdr1.b^ # TmpAdr2.b^ THEN
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. ***** ^ not supported yet
  328. ***** ^ not supported yet
  329. 159 IF TmpAdr1.b^ > TmpAdr2.b^ THEN
  330. ***** ^ not supported yet
  331. ***** ^ not supported yet
  332. ***** ^ not supported yet
  333. ***** ^ not supported yet
  334. 160 result := 1;
  335. 161 RETURN result;
  336. 162 ELSE
  337. 163 result := -1;
  338. 164 RETURN result;
  339. 165 END;
  340. 166 ELSE
  341. 167 INC(cnt);
  342. ***** ^ undeclared identifier
  343. ***** ^ not supported yet
  344. 168 INC(TmpAdr1.off);
  345. ***** ^ undeclared identifier
  346. ***** ^ not supported yet
  347. ***** ^ not supported yet
  348. 169 INC(TmpAdr2.off);
  349. ***** ^ undeclared identifier
  350. ***** ^ not supported yet
  351. ***** ^ not supported yet
  352. 170 END;
  353. 171 END;
  354. 172 IF len1 = len2 THEN
  355. 173 result := 0;
  356. 174 ELSIF len1 > len2 THEN
  357. 175 result := 1;
  358. 176 ELSE
  359. 177 result := -1;
  360. 178 END;
  361. 179 RETURN result;
  362. 180 END CompareStr;
  363. ***** ^ not supported yet
  364. 181
  365. 182
  366. 183 BEGIN
  367. 184 Initialized := FALSE;
  368. 185 Init();
  369. ***** ^ not supported yet
  370. ***** ^ not supported yet
  371. 186 END M2Strings.
  372. ***** ^ not supported yet
  373. 185 errors