AUTOMIX.LST 7.4 KB

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