CHKIND.LST 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. Listing:
  2. 1
  3. 2 IMPLEMENTATION MODULE ChkInd;
  4. 3 (*
  5. 4 * ModBase
  6. 5 * Release 3.0
  7. 6 * By Don Fletcher & John McMonagle
  8. 7 * (c) Copyright 1986 - 1991 PMI
  9. 8 * P.O. Box 8402
  10. 9 * Green Bay Wi 53308
  11. 10 * All Rights Reserved
  12. 11 *
  13. 12 *)
  14. 13
  15. 14 FROM DBIndxes IMPORT
  16. 15 FindPositionCh, OpenIndex, BuildIndex, DBIndex, NextRecord, PrevRecord,
  17. 16 CurrentRec,CurrentKeyCh,GoTop;
  18. 17
  19. 18 FROM StrConv IMPORT
  20. 19 CardinalToStr;
  21. 20
  22. 21
  23. 22 FROM StringIO IMPORT
  24. 23 ReadStr, WriteStr, WriteEol;
  25. 24
  26. 25 FROM M2Strings IMPORT
  27. 26 Assign, CompareStr,Concat;
  28. 27
  29. 28 FROM BigSets IMPORT InitSet,InSet,InclSet;
  30. 29
  31. 30 FROM Storage IMPORT ALLOCATE, DEALLOCATE;
  32. 31
  33. 32 CONST
  34. 33 inp = 0;
  35. 34 outp = 1;
  36. 35 prn = 4;
  37. 36 stderror = 2;
  38. 37
  39. 38 PROCEDURE NDXChk(VAR ndx:DBIndex);
  40. 39 VAR
  41. 40 LastKey,KeyStr : ARRAY[ 0 .. 127 ] OF CHAR;
  42. ***** ^ not supported yet
  43. ***** ^ not supported yet
  44. 41 str,string :ARRAY[0..79] OF CHAR;
  45. ***** ^ not supported yet
  46. ***** ^ not supported yet
  47. 42 cardrec, Keys :CARDINAL;
  48. 43 CurRec : LONGINT;
  49. 44 ok,
  50. 45 error,
  51. 46 dumbool : BOOLEAN;
  52. 47 set : POINTER TO ARRAY[0..4095] OF BITSET;
  53. ***** ^ not supported yet
  54. ***** ^ undeclared identifier
  55. 48
  56. 49 BEGIN
  57. 50 NEW( set);
  58. ***** ^ undeclared identifier
  59. ***** ^ not supported yet
  60. 51 error:=FALSE;
  61. 52 Keys:=1;
  62. 53 InitSet(set^);
  63. ***** ^ not supported yet
  64. ***** ^ not supported yet
  65. 54 GoTop( ndx );
  66. ***** ^ not supported yet
  67. ***** ^ not supported yet
  68. 55 InclSet(set^,VAL(CARDINAL,CurrentRec(ndx)));
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. ***** ^ undeclared identifier
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. 56 CurrentKeyCh( ndx, LastKey );
  75. ***** ^ not supported yet
  76. ***** ^ not supported yet
  77. ***** ^ not supported yet
  78. 57
  79. 58 WHILE NextRecord( ndx, CurRec ) DO
  80. ***** ^ not supported yet
  81. ***** ^ not supported yet
  82. ***** ^ not supported yet
  83. 59 cardrec:=VAL(CARDINAL,CurRec);
  84. ***** ^ undeclared identifier
  85. ***** ^ not supported yet
  86. 60 CurrentKeyCh(ndx,KeyStr);
  87. ***** ^ not supported yet
  88. ***** ^ not supported yet
  89. ***** ^ not supported yet
  90. 61 IF InSet(set^,cardrec)
  91. ***** ^ not supported yet
  92. ***** ^ not supported yet
  93. ***** ^ not supported yet
  94. 62 THEN
  95. 63 error:=TRUE;
  96. 64 Concat('duplicate entry for ',KeyStr,str);
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. ***** ^ not supported yet
  101. 65 Concat(str,' record number ',str);
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. ***** ^ not supported yet
  106. 66 CardinalToStr(cardrec,1,string);
  107. ***** ^ not supported yet
  108. ***** ^ not supported yet
  109. 67 Concat(str,string,str);
  110. ***** ^ not supported yet
  111. ***** ^ not supported yet
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. 68 WriteEol(prn,str);
  115. ***** ^ not supported yet
  116. ***** ^ not supported yet
  117. 69 HALT;
  118. ***** ^ undeclared identifier
  119. 70 ELSE
  120. 71 InclSet(set^,cardrec);
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. ***** ^ not supported yet
  124. 72 END;
  125. 73 INC(Keys);
  126. ***** ^ undeclared identifier
  127. ***** ^ not supported yet
  128. 74 IF CompareStr( LastKey, KeyStr ) > 0
  129. ***** ^ not supported yet
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. 75 THEN
  133. 76 WriteEol(prn,'sort error in index');
  134. ***** ^ not supported yet
  135. ***** ^ not supported yet
  136. 77 error:=TRUE;
  137. 78 HALT;
  138. ***** ^ undeclared identifier
  139. 79 END (* if *);
  140. 80 Assign( KeyStr, LastKey );
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. ***** ^ not supported yet
  144. 81 END (* while *);
  145. 82 FOR cardrec:=1 TO Keys DO
  146. 83 IF NOT InSet(set^,cardrec)
  147. ***** ^ not supported yet
  148. ***** ^ not supported yet
  149. ***** ^ not supported yet
  150. 84 THEN
  151. 85 CardinalToStr(cardrec,1,string);
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. 86 Concat('record number not in index ',string,str);
  155. ***** ^ not supported yet
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. ***** ^ not supported yet
  159. 87 WriteEol(prn,str);
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. 88 HALT;
  163. ***** ^ undeclared identifier
  164. 89 END;
  165. 90 END (* for *);
  166. 91
  167. 92
  168. 93 IF error
  169. 94 THEN
  170. 95 CardinalToStr(Keys,8,LastKey);
  171. ***** ^ not supported yet
  172. ***** ^ not supported yet
  173. 96 WriteStr( prn, LastKey );
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. 97 WriteEol( prn ,' keys found.');
  177. ***** ^ not supported yet
  178. ***** ^ not supported yet
  179. 98 WriteEol( prn, 'SORTING ERRORS FOUND');
  180. ***** ^ not supported yet
  181. ***** ^ not supported yet
  182. 99 END;
  183. 100 DISPOSE(set);
  184. ***** ^ undeclared identifier
  185. ***** ^ not supported yet
  186. 101 END NDXChk;
  187. ***** ^ not supported yet
  188. 102 END ChkInd.
  189. ***** ^ not supported yet
  190. 86 errors