MIX.LST 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. Listing:
  2. 1 MODULE Mix; (* Random changes *)
  3. 2 (* IMPORT PMD;*)
  4. 3 IMPORT InitCompilerMods;
  5. 4 FROM DBIndxes IMPORT DBIndex, InitIndex, CloseIndex, FindPositionCh,
  6. 5 AddToUpdateList;
  7. 6 FROM DBFields IMPORT Replace;
  8. 7 FROM ModBase3 IMPORT DBFile,InitDBF,OpenDBF,ReadDBRec,WriteDBRec,
  9. 8 NumberRecords,LockRec,UnLockRec,DefaultFixUp;
  10. 9 FROM ErrorManager IMPORT WARN;
  11. 10 FROM Timing IMPORT BeginTimer, ShowUsage;
  12. 11
  13. 12 FROM Rand IMPORT RandomInit, RandomCard,Randomize;
  14. 13 (* FROM Lib IMPORT RANDOM;*)
  15. 14 IMPORT StringIO;
  16. 15 IMPORT StrConv,OS2KBD;
  17. 16 VAR
  18. 17 counter:CARDINAL;
  19. 18 string:ARRAY[0..79] OF CHAR;
  20. ***** ^ not supported yet
  21. ***** ^ not supported yet
  22. 19
  23. 20 PROCEDURE KeyPressed():BOOLEAN;
  24. 21 VAR r:CARDINAL;
  25. 22 k:OS2KBD.CharDataType;
  26. ***** ^ not supported yet
  27. 23 BEGIN
  28. 24 k.asciiCharCode:=0C;
  29. ***** ^ not supported yet
  30. ***** ^ not supported yet
  31. 25 k.scanCode:=0;
  32. ***** ^ not supported yet
  33. ***** ^ not supported yet
  34. 26 k.NLSShiftStatus:=0;
  35. ***** ^ not supported yet
  36. ***** ^ not supported yet
  37. 27 r :=OS2KBD.KBDPEEK(k,0);
  38. ***** ^ not supported yet
  39. ***** ^ not supported yet
  40. ***** ^ not supported yet
  41. ***** ^ not supported yet
  42. 28 RETURN (k.scanCode#BYTE(0)) OR (k.asciiCharCode#0C);
  43. ***** ^ not supported yet
  44. ***** ^ not supported yet
  45. ***** ^ undeclared identifier
  46. ***** ^ not supported yet
  47. ***** ^ not supported yet
  48. ***** ^ not supported yet
  49. 29 END KeyPressed;
  50. ***** ^ not supported yet
  51. 30
  52. 31 PROCEDURE RandStr(VAR S : ARRAY OF CHAR);
  53. ***** ^ not supported yet
  54. 32 (* Generate a string of random letters with a random length *)
  55. 33 VAR
  56. 34 I : CARDINAL;
  57. 35 Len : CARDINAL;
  58. 36 BEGIN
  59. 37 Len := 1 + (*RandomCard*)RandomCard(HIGH(S)+1) ; (* random 1 to 30 Len *)
  60. ***** ^ not supported yet
  61. ***** ^ undeclared identifier
  62. ***** ^ not supported yet
  63. ***** ^ not supported yet
  64. 38 FOR I := 0 TO Len - 1 DO
  65. 39 S[I] := CHR((*RandomCard*)RandomCard(26)+65); (* random letters *)
  66. ***** ^ not supported yet
  67. ***** ^ not supported yet
  68. ***** ^ undeclared identifier
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. ***** ^ not supported yet
  72. 40 END (* for *);
  73. 41 FOR I := Len TO HIGH(S) DO (* ModBase requires space padded keys *)
  74. ***** ^ undeclared identifier
  75. ***** ^ not supported yet
  76. 42 S[I] := ' '; (* instead of a 0C terminated string *)
  77. ***** ^ not supported yet
  78. ***** ^ not supported yet
  79. 43 END (* if *);
  80. 44 END RandStr;
  81. ***** ^ not supported yet
  82. 45
  83. 46 CONST
  84. 47 KeyLen = 30;
  85. 48 Buffers = 400;
  86. 49
  87. 50 TYPE
  88. 51 KeyStr = ARRAY [0..KeyLen-1] OF CHAR;
  89. ***** ^ not supported yet
  90. ***** ^ not supported yet
  91. 52
  92. 53 VAR
  93. 54 DBF : DBFile;
  94. 55 NDX : DBIndex;
  95. 56 Name : KeyStr;
  96. ***** ^ not supported yet
  97. 57 Found : BOOLEAN;
  98. 58 rec:LONGINT;
  99. 59 res:CARDINAL;
  100. 60 BEGIN
  101. 61 Randomize;
  102. ***** ^ not supported yet
  103. 62 res:=OS2KBD.KBDFLUSHBUFFER(0);
  104. ***** ^ not supported yet
  105. ***** ^ not supported yet
  106. ***** ^ not supported yet
  107. 63 counter:=0;
  108. 64 InitDBF('Modbase.DBF',DBF,0,FALSE,FALSE,FALSE,DefaultFixUp);
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. ***** ^ not supported yet
  112. ***** ^ not supported yet
  113. 65 IF OpenDBF(DBF) THEN END;
  114. ***** ^ not supported yet
  115. ***** ^ not supported yet
  116. 66 InitIndex("ModBase.NDX", NDX,DBF, Buffers,FALSE,TRUE,FALSE);
  117. ***** ^ not supported yet
  118. ***** ^ not supported yet
  119. ***** ^ not supported yet
  120. ***** ^ not supported yet
  121. ***** ^ not supported yet
  122. 67 AddToUpdateList(DBF,NDX);
  123. ***** ^ not supported yet
  124. ***** ^ not supported yet
  125. ***** ^ not supported yet
  126. 68 REPEAT
  127. 69 rec:=VAL(LONGINT,RandomCard(VAL(CARDINAL,NumberRecords(DBF)))+1);
  128. ***** ^ undeclared identifier
  129. ***** ^ not supported yet
  130. ***** ^ undeclared identifier
  131. ***** ^ not supported yet
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. 70 RandStr(Name);
  135. ***** ^ not supported yet
  136. ***** ^ not supported yet
  137. 71 IF LockRec(DBF,rec)#0 THEN WARN('Unable to lock record in mix') END;
  138. ***** ^ not supported yet
  139. ***** ^ not supported yet
  140. ***** ^ not supported yet
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. 72 ReadDBRec(DBF,rec);
  144. ***** ^ not supported yet
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. 73 Replace(DBF,1,Name);
  148. ***** ^ not supported yet
  149. ***** ^ not supported yet
  150. ***** ^ not supported yet
  151. 74 WriteDBRec(DBF);
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. 75 IF UnLockRec(DBF,rec) #0 THEN WARN('Unable to unlock record in mix') END;
  155. ***** ^ not supported yet
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. ***** ^ not supported yet
  159. ***** ^ not supported yet
  160. 76 StrConv.CardinalToStr(counter,8,string);
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. ***** ^ not supported yet
  164. 77 StringIO.WriteStr(StringIO.outp,string);
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. ***** ^ not supported yet
  168. ***** ^ not supported yet
  169. ***** ^ not supported yet
  170. 78 INC(counter);
  171. ***** ^ undeclared identifier
  172. ***** ^ not supported yet
  173. 79 UNTIL (counter=65000) OR KeyPressed(); (* until not in index *)
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. 80 CloseIndex(NDX);
  177. ***** ^ not supported yet
  178. ***** ^ not supported yet
  179. 81 DEC(counter);
  180. ***** ^ undeclared identifier
  181. ***** ^ not supported yet
  182. 82 res:=OS2KBD.KBDFLUSHBUFFER(0);
  183. ***** ^ not supported yet
  184. ***** ^ not supported yet
  185. ***** ^ not supported yet
  186. 83 END Mix.
  187. 84
  188. 102 errors