| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- Listing:
- 1
- 2 MODULE AddTestN; (* Add Benchmark *)
- 3 IMPORT InitCompilerMods;
- 4
- 5 FROM NumTypes IMPORT Real8;
- 6 FROM ModBase3 IMPORT DBFile, CloseDBF, DBFieldDescriptor,
- 7 AppendBlank, WriteDBRec,InitDBF,BuildDBF,
- 8 DefaultFixUp,Replace;
- 9
- 10 FROM DBIndxes IMPORT DBIndex, BuildIndex, OpenIndex, CloseIndex,
- 11 AddRecord, FindPositionN,AddToUpdateList,InitIndex;
- 12 FROM Timing IMPORT BeginTimer, ShowUsage;
- 13 FROM StringIO IMPORT PrintMessage;
- 14
- 15 FROM InOut IMPORT WriteCard;
- 16 FROM Rand IMPORT RandomInit, RandomCard,RandomReal;
- 17 IMPORT StrConv;
- 18 (* FROM Lib IMPORT RAND;*)
- 19
- 20
- 21 PROCEDURE RandStr(VAR S : ARRAY OF CHAR);
- ***** ^ not supported yet
- 22 (* Generate a string of random letters with a random length *)
- 23 VAR
- 24 key:Real8;
- 25 BEGIN
- 26 (* StrConv.RealToStr((*RandomReal*)VAL(
- 27 LONGREAL,RAND()) * 100000.0,2,10,S); *)
- 28 StrConv.RealToStr((RandomReal() * 10000000.0),2,10,S);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 29 END RandStr;
- ***** ^ not supported yet
- 30
- 31 CONST
- 32 KeyLen = 10;
- 33 Buffers = 400;
- 34 TYPE
- 35 KeyStr = ARRAY [0..KeyLen-1] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 36
- 37 VAR
- 38 DBF : DBFile;
- 39 Fields : ARRAY [1..2] OF DBFieldDescriptor;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 40 NDX : DBIndex;
- 41 I : CARDINAL;
- 42 Name : KeyStr;
- ***** ^ not supported yet
- 43 Found : BOOLEAN;
- 44
- 45 BEGIN
- 46 BeginTimer(); (* start timer counting *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- 47 RandomInit(1);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 48 WITH Fields[1] DO
- ***** ^ not supported yet
- ***** ^ not supported yet
- 49 name := "NUMBER";
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 50 size := 10;
- ***** ^ undeclared identifier
- 51 decplaces :=2;
- ***** ^ undeclared identifier
- 52 fldtype := 'N';
- ***** ^ undeclared identifier
- 53 END (* with *);
- ***** ^ not supported yet
- 54 WITH Fields[2] DO
- ***** ^ not supported yet
- ***** ^ not supported yet
- 55 name := "PHONE";
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 56 size := 13;
- ***** ^ undeclared identifier
- 57 fldtype := 'C';
- ***** ^ undeclared identifier
- 58 END (* with *);
- ***** ^ not supported yet
- 59 InitDBF('ModBasen.DBF', DBF,40000,FALSE,TRUE,FALSE,DefaultFixUp);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 60 InitIndex('ModBasen.NDX',NDX,DBF,Buffers,FALSE,TRUE);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 61 PrintMessage(BuildDBF( Fields,2, DBF)); (* Create empty DBF file *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 62 PrintMessage(BuildIndex(NDX, 'NUMBER')); (* create initial empty index *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 63 AddToUpdateList(DBF,NDX);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 64 FOR I := 1 TO 2000 DO
- 65 WriteCard(I, 8);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 66 REPEAT (* generate random keys *)
- 67 RandStr(Name);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 68 FindPositionN(NDX, Name, Found);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 69 UNTIL NOT Found; (* until not already added *)
- 70 AppendBlank(DBF);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 71 Replace(DBF, 1, Name); (* store key in record *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 72 WriteDBRec(DBF); (* add record to data file *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- 73 (* AddRecord(DBF, NDX); *)
- 74 (* (* all ok now but good for diag*)
- 75 FindPositionN(NDX, Name, Found);
- 76 IF NOT Found THEN
- 77 HALT;
- 78 END (* if *);
- 79 *)
- 80 END (* for *);
- 81 CloseIndex(NDX);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 82 CloseDBF(DBF);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 83 ShowUsage('add test'); (* display elaped time in seconds *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- 84 END AddTestN.
- 85
- 72 errors
|