ADDTESTN.LST 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. Listing:
  2. 1
  3. 2 MODULE AddTestN; (* Add Benchmark *)
  4. 3 IMPORT InitCompilerMods;
  5. 4
  6. 5 FROM NumTypes IMPORT Real8;
  7. 6 FROM ModBase3 IMPORT DBFile, CloseDBF, DBFieldDescriptor,
  8. 7 AppendBlank, WriteDBRec,InitDBF,BuildDBF,
  9. 8 DefaultFixUp,Replace;
  10. 9
  11. 10 FROM DBIndxes IMPORT DBIndex, BuildIndex, OpenIndex, CloseIndex,
  12. 11 AddRecord, FindPositionN,AddToUpdateList,InitIndex;
  13. 12 FROM Timing IMPORT BeginTimer, ShowUsage;
  14. 13 FROM StringIO IMPORT PrintMessage;
  15. 14
  16. 15 FROM InOut IMPORT WriteCard;
  17. 16 FROM Rand IMPORT RandomInit, RandomCard,RandomReal;
  18. 17 IMPORT StrConv;
  19. 18 (* FROM Lib IMPORT RAND;*)
  20. 19
  21. 20
  22. 21 PROCEDURE RandStr(VAR S : ARRAY OF CHAR);
  23. ***** ^ not supported yet
  24. 22 (* Generate a string of random letters with a random length *)
  25. 23 VAR
  26. 24 key:Real8;
  27. 25 BEGIN
  28. 26 (* StrConv.RealToStr((*RandomReal*)VAL(
  29. 27 LONGREAL,RAND()) * 100000.0,2,10,S); *)
  30. 28 StrConv.RealToStr((RandomReal() * 10000000.0),2,10,S);
  31. ***** ^ not supported yet
  32. ***** ^ not supported yet
  33. ***** ^ not supported yet
  34. ***** ^ not supported yet
  35. ***** ^ not supported yet
  36. 29 END RandStr;
  37. ***** ^ not supported yet
  38. 30
  39. 31 CONST
  40. 32 KeyLen = 10;
  41. 33 Buffers = 400;
  42. 34 TYPE
  43. 35 KeyStr = ARRAY [0..KeyLen-1] OF CHAR;
  44. ***** ^ not supported yet
  45. ***** ^ not supported yet
  46. 36
  47. 37 VAR
  48. 38 DBF : DBFile;
  49. 39 Fields : ARRAY [1..2] OF DBFieldDescriptor;
  50. ***** ^ not supported yet
  51. ***** ^ not supported yet
  52. 40 NDX : DBIndex;
  53. 41 I : CARDINAL;
  54. 42 Name : KeyStr;
  55. ***** ^ not supported yet
  56. 43 Found : BOOLEAN;
  57. 44
  58. 45 BEGIN
  59. 46 BeginTimer(); (* start timer counting *)
  60. ***** ^ not supported yet
  61. ***** ^ not supported yet
  62. 47 RandomInit(1);
  63. ***** ^ not supported yet
  64. ***** ^ not supported yet
  65. 48 WITH Fields[1] DO
  66. ***** ^ not supported yet
  67. ***** ^ not supported yet
  68. 49 name := "NUMBER";
  69. ***** ^ undeclared identifier
  70. ***** ^ not supported yet
  71. 50 size := 10;
  72. ***** ^ undeclared identifier
  73. 51 decplaces :=2;
  74. ***** ^ undeclared identifier
  75. 52 fldtype := 'N';
  76. ***** ^ undeclared identifier
  77. 53 END (* with *);
  78. ***** ^ not supported yet
  79. 54 WITH Fields[2] DO
  80. ***** ^ not supported yet
  81. ***** ^ not supported yet
  82. 55 name := "PHONE";
  83. ***** ^ undeclared identifier
  84. ***** ^ not supported yet
  85. 56 size := 13;
  86. ***** ^ undeclared identifier
  87. 57 fldtype := 'C';
  88. ***** ^ undeclared identifier
  89. 58 END (* with *);
  90. ***** ^ not supported yet
  91. 59 InitDBF('ModBasen.DBF', DBF,40000,FALSE,TRUE,FALSE,DefaultFixUp);
  92. ***** ^ not supported yet
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. 60 InitIndex('ModBasen.NDX',NDX,DBF,Buffers,FALSE,TRUE);
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. ***** ^ not supported yet
  101. ***** ^ not supported yet
  102. 61 PrintMessage(BuildDBF( Fields,2, DBF)); (* Create empty DBF file *)
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. ***** ^ not supported yet
  106. ***** ^ not supported yet
  107. 62 PrintMessage(BuildIndex(NDX, 'NUMBER')); (* create initial empty index *)
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. ***** ^ not supported yet
  112. 63 AddToUpdateList(DBF,NDX);
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. ***** ^ not supported yet
  116. 64 FOR I := 1 TO 2000 DO
  117. 65 WriteCard(I, 8);
  118. ***** ^ not supported yet
  119. ***** ^ not supported yet
  120. 66 REPEAT (* generate random keys *)
  121. 67 RandStr(Name);
  122. ***** ^ not supported yet
  123. ***** ^ not supported yet
  124. 68 FindPositionN(NDX, Name, Found);
  125. ***** ^ not supported yet
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. ***** ^ not supported yet
  129. 69 UNTIL NOT Found; (* until not already added *)
  130. 70 AppendBlank(DBF);
  131. ***** ^ not supported yet
  132. ***** ^ not supported yet
  133. 71 Replace(DBF, 1, Name); (* store key in record *)
  134. ***** ^ not supported yet
  135. ***** ^ not supported yet
  136. ***** ^ not supported yet
  137. 72 WriteDBRec(DBF); (* add record to data file *)
  138. ***** ^ not supported yet
  139. ***** ^ not supported yet
  140. 73 (* AddRecord(DBF, NDX); *)
  141. 74 (* (* all ok now but good for diag*)
  142. 75 FindPositionN(NDX, Name, Found);
  143. 76 IF NOT Found THEN
  144. 77 HALT;
  145. 78 END (* if *);
  146. 79 *)
  147. 80 END (* for *);
  148. 81 CloseIndex(NDX);
  149. ***** ^ not supported yet
  150. ***** ^ not supported yet
  151. 82 CloseDBF(DBF);
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. 83 ShowUsage('add test'); (* display elaped time in seconds *)
  155. ***** ^ not supported yet
  156. ***** ^ not supported yet
  157. 84 END AddTestN.
  158. 85
  159. 72 errors