kerneltest/e32test/bench/t_dhry.cpp
changeset 0 a41df078684a
child 109 b3a1d9898418
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32test\bench\t_dhry.cpp
       
    15 // *      "DHRYSTONE" Benchmark Program
       
    16 // *      Version:        C/1
       
    17 // *      Date:           12/01/84, RESULTS updated 10/22/85
       
    18 // *      Author:         Reinhold P. Weicker,  CACM Vol 27, No 10, 10/84 pg. 1013
       
    19 // *                      Translated from ADA by Rick Richardson
       
    20 // *                      Every method to preserve ADA-likeness has been used,
       
    21 // *                      at the expense of C-ness.
       
    22 // *      Compile:        cc -O dry.c -o drynr                    : No registers
       
    23 // *                      cc -O -DREG=register dry.c -o dryr      : Registers
       
    24 // *      Defines:        Defines are provided for old C compiler's
       
    25 // *                      which don't have enums, and can't assign structures.
       
    26 // *                      The time(2) function is library dependant; One is
       
    27 // *                      provided for CI-C86.  Your compiler may be different.
       
    28 // *                      The LOOPS define is initially set for 50000 loops.
       
    29 // *                      If you have a machine with large integers and is
       
    30 // *                      very fast, please change this number to 500000 to
       
    31 // *                      get better accuracy.  Please select the way to
       
    32 // *                      measure the execution time using the TIME define.
       
    33 // *                      For single user machines, time(2) is adequate. For
       
    34 // *                      multi-user machines where you cannot get single-user
       
    35 // *                      access, use the times(2) function.  If you have
       
    36 // *                      neither, use a stopwatch in the dead of night.
       
    37 // *                      Use a "printf" at the point marked "start timer"
       
    38 // *                      to begin your timings. DO NOT use the UNIX "time(1)"
       
    39 // *                      command, as this will measure the total time to
       
    40 // *                      run this program, which will (erroneously) include
       
    41 // *                      the time to malloc(3) storage and to compute the
       
    42 // *                      time it takes to do nothing.
       
    43 // *      Run:            drynr; dryr
       
    44 // *      Results:        If you get any new machine/OS results, please send to:
       
    45 // *                      {ihnp4,vax135,..}!houxm!vaximile!rer
       
    46 // *                      and thanks to all that do.  Space prevents listing
       
    47 // *                      the names of those who have provided some of these
       
    48 // *                      results.
       
    49 // *      Note:           I order the list in increasing performance of the
       
    50 // *                      "with registers" benchmark.  If the compiler doesn't
       
    51 // *                      provide register variables, then the benchmark
       
    52 // *                      is the same for both REG and NOREG.  I'm not going
       
    53 // *                      to list a compiler in a better place because if it
       
    54 // *                      had register variables it might do better. No
       
    55 // *                      register variables is a big loss in my book.
       
    56 // *      PLEASE:         Send complete information about the machine type,
       
    57 // *                      clock speed, OS and C manufacturer/version.  If
       
    58 // *                      the machine is modified, tell me what was done.
       
    59 // *                      Otherwise, I won't include it in this list.  My
       
    60 // *                      favorite flame on this subject was a machine that
       
    61 // *                      was listed as an IBM PC/XT 8086-9.54Mhz.  That must
       
    62 // *                      have been some kind of co-processor board that ran
       
    63 // *                      the benchmark, not the XT.  Tell me what it was!
       
    64 // * MACHINE      MICROPROCESSOR  OPERATING       COMPILER        DHRYSTONES/SEC.
       
    65 // * TYPE                         SYSTEM                          NO REG  REGS
       
    66 // * IBM PC/XT    8088-4.77Mhz    PC/IX           cc               257     287
       
    67 // * Cosmos       68000-8Mhz      UniSoft         cc               305     322
       
    68 // * IBM PC/XT    8088-4.77Mhz    VENIX/86 2.0    cc               297     324
       
    69 // * IBM PC       8088-4.77Mhz    MSDOS 2.0       b16cc 2.0        310     340
       
    70 // * IBM PC       8088-4.77Mhz    MSDOS 2.0       CI-C86 2.20M     390     390
       
    71 // * IBM PC/XT    8088-4.77Mhz    PCDOS 2.1       Lattice 2.15     403      -  @
       
    72 // * PDP-11/34    -               UNIX V7M        cc               387     438
       
    73 // * Onyx C8002   Z8000-4Mhz      IS/1 1.1 (V7)   cc               476     511
       
    74 // * ATT PC6300   8086-8Mhz       MSDOS 2.11      b16cc 2.0        632     684
       
    75 // * IBM PC/AT    80286-6Mhz      PCDOS 3.0       CI-C86 2.1       666     684
       
    76 // * Macintosh    68000-7.8Mhz 2M Mac Rom         Mac C 32 bit int 694     704
       
    77 // * Macintosh    68000-7.7Mhz    -               MegaMax C 2.0    661     709
       
    78 // * NEC PC9801F  8086-8Mhz       PCDOS 2.11      Lattice 2.15     768      -  @
       
    79 // * ATT PC6300   8086-8Mhz       MSDOS 2.11      CI-C86 2.20M     769     769
       
    80 // * ATT 3B2/300  WE32000-?Mhz    UNIX 5.0.2      cc               735     806
       
    81 // * IBM PC/AT    80286-6Mhz      PCDOS 3.0       MS 3.0(large)    833     847 LM
       
    82 // * VAX 11/750   -               Unix 4.2bsd     cc               862     877
       
    83 // * IBM PC/AT    80286-6Mhz      PCDOS 3.0       MS 3.0(small)   1063    1086
       
    84 // * ATT PC7300   68010-10Mhz     UNIX 5.2        cc              1041    1111
       
    85 // * ATT PC6300+  80286-6Mhz      MSDOS 3.1       b16cc 2.0       1111    1219
       
    86 // * Sun2/120     68010-10Mhz     Sun 4.2BSD      cc              1136    1219
       
    87 // * IBM PC/AT    80286-6Mhz      PCDOS 3.0       CI-C86 2.20M    1219    1219
       
    88 // * MASSCOMP 500 68010-10MHz     RTU V3.0        cc (V3.2)       1156    1238
       
    89 // * Cyb DataMate 68010-12.5Mhz   Uniplus 5.0     Unisoft cc      1162    1250
       
    90 // * PDP 11/70    -               UNIX 5.2        cc              1162    1250
       
    91 // * IBM PC/AT    80286-6Mhz      PCDOS 3.1       Lattice 2.15    1250      -  @
       
    92 // * IBM PC/AT    80286-7.5Mhz    VENIX/86 2.1    cc              1190    1315 *
       
    93 // * Sun2/120     68010-10Mhz     Standalone      cc              1219    1315
       
    94 // * ATT 3B2/400  WE32100-?Mhz    UNIX 5.2        cc              1315    1315
       
    95 // * HP-110       8086-5.33Mhz    MSDOS 2.11      Aztec-C         1282    1351 ?
       
    96 // * IBM PC/AT    80286-6Mhz      ?               ?               1250    1388 ?
       
    97 // * ATT PC6300+  80286-6Mhz      MSDOS 3.1       CI-C86 2.20M    1428    1428
       
    98 // * Cyb DataMate 68010-12.5Mhz   Uniplus 5.0     Unisoft cc      1470    1562 S
       
    99 // * VAX 11/780   -               UNIX 5.2        cc              1515    1562
       
   100 // * MicroVAX-II  -               -               -               1562    1612
       
   101 // * ATT 3B20     -               UNIX 5.2        cc              1515    1724
       
   102 // * HP9000-500   B series CPU    HP-UX 4.02      cc              1724    -
       
   103 // * IBM PC/STD   80286-8Mhz      ?               ?               1724    1785
       
   104 // * Gould PN6005 -               UTX 1.1(4.2BSD) cc              1675    1964
       
   105 // * VAX 11/785   -               UNIX 5.2        cc              2083    2083
       
   106 // * VAX 11/785   -               VMS             VAX-11 C 2.0    2083    2083
       
   107 // * SUN 3/75     68020-16.67Mhz  SUN 4.2 V3      cc              3333    3571
       
   108 // * Sun 3/180    68020-16.67Mhz  Sun 4.2         cc              3333    3846
       
   109 // * MC 5400      68020-16.67MHz  RTU V3.0        cc (V4.0)       3952    4054
       
   110 // * SUN-3/160C   68020-16.67Mhz  Sun3.0ALPHA1 Un*x               3333    4166
       
   111 // * Gould PN9080 -               UTX-32 1.1c     cc              -       4629
       
   112 // * MC 5600/5700 68020-16.67MHz  RTU V3.0        cc (V4.0)       4504    4746 %
       
   113 // * VAX 8600     -               VMS             VAX-11 C 2.0    7142    7142
       
   114 // * Amdahl 470 V/8               ?               ?               -      15015
       
   115 // * Amdahl 580   -               UTS 5.0 Rel 1.2 cc Ver. 1.5    23076   23076
       
   116 // * Amdahl 5860                  ?               ?               -      28355
       
   117 // *   *  15Mhz crystal substituted for original 12Mhz;
       
   118 // *   +  This Macintosh was upgraded from 128K to 512K in such a way that
       
   119 // *      the new 384K of memory is not slowed down by video generator accesses.
       
   120 // *   %  Single processor; MC == MASSCOMP
       
   121 // *   &  Seattle Telecom STD-286 board
       
   122 // *   @  vanilla Lattice compiler used with MicroPro standard library
       
   123 // *   S  Shorts used instead of ints
       
   124 // *   LM Large Memory Model. (Otherwise, all 80x8x results are small model)
       
   125 // *   ?  I don't trust results marked with '?'.  These were sent to me with
       
   126 // *      either incomplete information, or with times that just don't make sense.
       
   127 // *      If anybody can confirm these figures, please respond.
       
   128 // *      The following program contains statements of a high-level programming
       
   129 // *      language (C) in a distribution considered representative:
       
   130 // *      assignments                     53%
       
   131 // *      control statements              32%
       
   132 // *      procedure, function calls       15%
       
   133 // *      100 statements are dynamically executed.  The program is balanced with
       
   134 // *      respect to the three aspects:
       
   135 // *              - statement type
       
   136 // *              - operand type (for simple data types)
       
   137 // *              - operand access
       
   138 // *                      operand global, local, parameter, or constant.
       
   139 // *      The combination of these three aspects is balanced only approximately.
       
   140 // *      The program does not compute anything meaningfull, but it is
       
   141 // *      syntactically and semantically correct.
       
   142 // 
       
   143 //
       
   144 
       
   145 
       
   146 #include <e32test.h>
       
   147 #include <e32std.h>
       
   148 #include <e32std_private.h>
       
   149 
       
   150 //Accuracy of timings and human fatigue controlled by next two lines
       
   151 #if defined(__EPOC32)
       
   152 #define LOOPS   50000 /* Use this for slow or 16 bit machines */
       
   153 #else
       
   154 #define LOOPS 10000000 /* Use this for faster machines */
       
   155 #endif
       
   156 
       
   157 // Compiler dependent options
       
   158 #undef  NOENUM /* Define if compiler has no enum's */
       
   159 #undef  NOSTRUCTASSIGN /* Define if compiler can't assign structures */
       
   160 
       
   161 // define only one of the next three defines
       
   162 #define NOTIME /* Define if no time() function in library */
       
   163 //#define TIMES /* Use times(2) time function */
       
   164 //#define TIME /* Use time(2) time function */
       
   165 
       
   166 // define the granularity of your times(2) function (when used)
       
   167 //#define HZ 60 /* times(2) returns 1/60 second (most) */
       
   168 //#define HZ 100 /* times(2) returns 1/100 second (WECo) */
       
   169 
       
   170 
       
   171 
       
   172 #ifdef  NOSTRUCTASSIGN
       
   173 #define structassign(d,s)      memcpy(&(d),&(s),sizeof(d))
       
   174 #else
       
   175 #define structassign(d,s)      d=s
       
   176 #endif
       
   177 
       
   178 #ifdef  NOENUM
       
   179 #define Ident1 1
       
   180 #define Ident2 2
       
   181 #define Ident3 3
       
   182 #define Ident4 4
       
   183 #define Ident5 5
       
   184 typedef int Enumeration;
       
   185 #else
       
   186 typedef enum {Ident1, Ident2, Ident3, Ident4, Ident5} Enumeration;
       
   187 #endif
       
   188 
       
   189 typedef int OneToThirty;
       
   190 typedef int OneToFifty;
       
   191 typedef char CapitalLetter;
       
   192 typedef char String30[31];
       
   193 typedef int Array1Dim[51];
       
   194 typedef int Array2Dim[51][51];
       
   195 
       
   196 struct Record
       
   197 	{
       
   198 	struct Record *PtrComp;
       
   199 	Enumeration Discr;
       
   200 	Enumeration EnumComp;
       
   201 	OneToFifty IntComp;
       
   202 	String30 StringComp;
       
   203 	};
       
   204 
       
   205 typedef struct Record RecordType;
       
   206 typedef RecordType* RecordPtr;
       
   207 typedef int boolean;
       
   208 
       
   209 #define NULL 0
       
   210 #define TRUE 1
       
   211 #define FALSE 0
       
   212 
       
   213 #ifndef REG
       
   214 #define REG
       
   215 #endif
       
   216 
       
   217 extern Enumeration Func1(CapitalLetter,CapitalLetter);
       
   218 extern boolean Func2(String30, String30);
       
   219 
       
   220 #ifdef TIMES
       
   221 #include <sys/types.h>
       
   222 #include <sys/times.h>
       
   223 #endif
       
   224 
       
   225 int strcmp(const char* aSrc, const char* aDst);
       
   226 char* strcpy(char* aDest, const char* aSrc);
       
   227 void Proc0();
       
   228 void Proc1(REG RecordPtr);
       
   229 void Proc2(OneToFifty*);
       
   230 void Proc3(RecordPtr*);
       
   231 void Proc4();
       
   232 void Proc5();
       
   233 void Proc6(REG Enumeration, REG Enumeration*);
       
   234 void Proc7(OneToFifty, OneToFifty, OneToFifty*);
       
   235 void Proc8(Array1Dim, Array2Dim, OneToFifty, OneToFifty);
       
   236 #ifdef NOTIME
       
   237 TInt64 time();
       
   238 #endif
       
   239 LOCAL_D RTest test(_L("DHRY"));
       
   240 
       
   241 GLDEF_C TInt E32Main()
       
   242 	{
       
   243 	test.Title();
       
   244 	test.Start(_L("Running dhrystone benchmark"));
       
   245 	Proc0();
       
   246 	test.End();
       
   247 	return(KErrNone);
       
   248 	}
       
   249 
       
   250 /*
       
   251  * Package 1
       
   252  */
       
   253 int IntGlob;
       
   254 boolean BoolGlob;
       
   255 char Char1Glob;
       
   256 char Char2Glob;
       
   257 Array1Dim Array1Glob;
       
   258 Array2Dim Array2Glob;
       
   259 RecordPtr PtrGlb;
       
   260 RecordPtr PtrGlbNext;
       
   261 
       
   262 void Proc0()
       
   263 	{
       
   264 	OneToFifty IntLoc1;
       
   265 	REG OneToFifty IntLoc2;
       
   266 	OneToFifty IntLoc3=1;
       
   267 	REG char CharIndex;
       
   268 	Enumeration EnumLoc;
       
   269 	String30 String1Loc;
       
   270 	String30 String2Loc;
       
   271 
       
   272 #ifdef NOTIME
       
   273 	TInt64 starttime;
       
   274 	TInt64 benchtime;
       
   275 	TInt64 nulltime;
       
   276 	register unsigned int i;
       
   277 	starttime=time();
       
   278 	for (i = 0; i < LOOPS; ++i)
       
   279 		;
       
   280 	nulltime = time()-starttime; /* Computes overhead of looping */
       
   281 #endif
       
   282 #ifdef TIME
       
   283 	REG char CharLoc;
       
   284 	long time();
       
   285 	long starttime;
       
   286 	long benchtime;
       
   287 	long nulltime;
       
   288 	register unsigned int i;
       
   289 	starttime = time(0);
       
   290 	for (i = 0; i < LOOPS; ++i)
       
   291 		;
       
   292 	nulltime = time(0) - starttime; /* Computes overhead of looping */
       
   293 #endif
       
   294 #ifdef TIMES
       
   295 	REG char CharLoc;
       
   296 	time_t starttime;
       
   297 	time_t benchtime;
       
   298 	time_t nulltime;
       
   299 	struct tms tms;
       
   300 	register unsigned int i;
       
   301 	times(&tms); starttime = tms.tms_utime;
       
   302 	for (i = 0; i < LOOPS; ++i)
       
   303 		;
       
   304 	times(&tms);
       
   305 	nulltime = tms.tms_utime - starttime; /* Computes overhead of looping */
       
   306 #endif
       
   307 
       
   308 //	PtrGlbNext = (RecordPtr) malloc(sizeof(RecordType));
       
   309 	PtrGlbNext = (RecordPtr) new Record;
       
   310 //	PtrGlb = (RecordPtr) malloc(sizeof(RecordType));
       
   311 	PtrGlb = (RecordPtr) new Record;
       
   312 	PtrGlb->PtrComp = PtrGlbNext;
       
   313 	PtrGlb->Discr = Ident1;
       
   314 	PtrGlb->EnumComp = Ident3;
       
   315 	PtrGlb->IntComp = 40;
       
   316 	strcpy(String2Loc, "DHRYSTONE PROGRAM, SOME STRING");
       
   317 
       
   318 // Start the timer
       
   319 #ifdef NOTIME
       
   320         starttime = time();
       
   321 #endif
       
   322 #ifdef TIME
       
   323         starttime = time(0);
       
   324 #endif
       
   325 #ifdef TIMES
       
   326         times(&tms); starttime = tms.tms_utime;
       
   327 #endif
       
   328 for (i = 0; i < LOOPS; ++i)
       
   329 {
       
   330 
       
   331         Proc5();
       
   332         Proc4();
       
   333         IntLoc1 = 2;
       
   334         IntLoc2 = 3;
       
   335         strcpy(String2Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
       
   336         EnumLoc = Ident2;
       
   337         BoolGlob = ! Func2(String1Loc, String2Loc);
       
   338         while (IntLoc1 < IntLoc2)
       
   339         {
       
   340                 IntLoc3 = 5 * IntLoc1 - IntLoc2;
       
   341                 Proc7(IntLoc1, IntLoc2, &IntLoc3);
       
   342                 ++IntLoc1;
       
   343         }
       
   344         Proc8(Array1Glob, Array2Glob, IntLoc1, IntLoc3);
       
   345         Proc1(PtrGlb);
       
   346         for (CharIndex = 'A'; CharIndex <= Char2Glob; ++CharIndex)
       
   347                 if (EnumLoc == Func1(CharIndex, 'C'))
       
   348                         Proc6(Ident1, &EnumLoc);
       
   349         IntLoc3 = IntLoc2 * IntLoc1;
       
   350         IntLoc2 = IntLoc3 / IntLoc1;
       
   351         IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1;
       
   352         Proc2(&IntLoc1);
       
   353 
       
   354 /*****************
       
   355 -- Stop Timer --
       
   356 *****************/
       
   357 }
       
   358 #ifdef TIME
       
   359 benchtime = time(0) - starttime - nulltime;
       
   360 printf("Dhrystone time for %ld passes = %ld\n", (long) LOOPS, benchtime);
       
   361 printf("This machine benchmarks at %ld dhrystones/second\n",
       
   362         ((long) LOOPS) / benchtime);
       
   363 #endif
       
   364 #ifdef TIMES
       
   365         times(&tms);
       
   366         benchtime = tms.tms_utime - starttime - nulltime;
       
   367 printf("Dhrystone time for %ld passes = %ld\n", (long) LOOPS, benchtime/HZ);
       
   368 printf("This machine benchmarks at %ld dhrystones/second\n",
       
   369         ((long) LOOPS) * HZ / benchtime);
       
   370 #endif
       
   371 #ifdef NOTIME
       
   372 TInt64 timenow = time();
       
   373 benchtime = (timenow - starttime - nulltime)/1000000;
       
   374 TInt bench=I64INT(benchtime);
       
   375 test.Printf(_L("Dhrystone time for %d passes = %d\n"), LOOPS, bench);
       
   376 test.Printf(_L("This machine benchmarks at %d dhrystones per second\n"), LOOPS/bench);
       
   377 test.Printf(_L("Press any key to exit (or wait 20 seconds)"));
       
   378 	{
       
   379 	TRequestStatus keyStat;
       
   380 	test.Console()->Read(keyStat);
       
   381 	RTimer timer;
       
   382 	test(timer.CreateLocal()==KErrNone);
       
   383 	TRequestStatus timerStat;
       
   384 	timer.After(timerStat,20*1000000);
       
   385 	User::WaitForRequest(timerStat,keyStat);
       
   386 	TInt key = 0;
       
   387 	if(keyStat!=KRequestPending)
       
   388 		key = test.Console()->KeyCode();
       
   389 	timer.Cancel();
       
   390 	test.Console()->ReadCancel();
       
   391 	User::WaitForAnyRequest();
       
   392 	}
       
   393 #endif
       
   394 }
       
   395 
       
   396 void Proc1 (REG RecordPtr PtrParIn)
       
   397 {
       
   398 #define NextRecord      (*(PtrParIn->PtrComp))
       
   399 
       
   400         structassign(NextRecord, *PtrGlb);
       
   401         PtrParIn->IntComp = 5;
       
   402         NextRecord.IntComp = PtrParIn->IntComp;
       
   403         NextRecord.PtrComp = PtrParIn->PtrComp;
       
   404         Proc3((RecordPtr*)NextRecord.PtrComp); //Jane - has to cast this
       
   405         if (NextRecord.Discr == Ident1)
       
   406         {
       
   407                 NextRecord.IntComp = 6;
       
   408                 Proc6(PtrParIn->EnumComp, &NextRecord.EnumComp);
       
   409                 NextRecord.PtrComp = PtrGlb->PtrComp;
       
   410                 Proc7(NextRecord.IntComp, 10, &NextRecord.IntComp);
       
   411         }
       
   412         else
       
   413                 structassign(*PtrParIn, NextRecord);
       
   414 
       
   415 #undef  NextRecord
       
   416 }
       
   417 
       
   418 void Proc2(OneToFifty* IntParIO)
       
   419 {
       
   420         REG OneToFifty IntLoc=0;
       
   421         REG Enumeration EnumLoc=Ident3;
       
   422 
       
   423         IntLoc = *IntParIO + 10;
       
   424         for(;;)
       
   425         {
       
   426                 if (Char1Glob == 'A')
       
   427                 {
       
   428                         --IntLoc;
       
   429                         *IntParIO = IntLoc - IntGlob;
       
   430                         EnumLoc = Ident1;
       
   431                 }
       
   432                 if (EnumLoc == Ident1)
       
   433                         break;
       
   434         }
       
   435 }
       
   436 
       
   437 void Proc3(RecordPtr* PtrParOut)
       
   438 {
       
   439         if (PtrGlb != NULL)
       
   440                 *PtrParOut = PtrGlb->PtrComp;
       
   441         else
       
   442                 IntGlob = 100;
       
   443         Proc7(10, IntGlob, &PtrGlb->IntComp);
       
   444 }
       
   445 
       
   446 void Proc4()
       
   447 {
       
   448         REG boolean     BoolLoc;
       
   449 
       
   450         BoolLoc = Char1Glob == 'A';
       
   451         BoolLoc |= BoolGlob;
       
   452         Char2Glob = 'B';
       
   453 }
       
   454 
       
   455 void Proc5()
       
   456 {
       
   457         Char1Glob = 'A';
       
   458         BoolGlob = FALSE;
       
   459 }
       
   460 
       
   461 extern boolean Func3(REG Enumeration EnumParIn);
       
   462 
       
   463 void Proc6(REG Enumeration EnumParIn, REG Enumeration* EnumParOut)
       
   464 
       
   465 {
       
   466         *EnumParOut = EnumParIn;
       
   467         if (! Func3(EnumParIn) )
       
   468                 *EnumParOut = Ident4;
       
   469         switch (EnumParIn)
       
   470         {
       
   471         case Ident1:    *EnumParOut = Ident1; break;
       
   472         case Ident2:    if (IntGlob > 100) *EnumParOut = Ident1;
       
   473                         else *EnumParOut = Ident4;
       
   474                         break;
       
   475         case Ident3:    *EnumParOut = Ident2; break;
       
   476         case Ident4:    break;
       
   477         case Ident5:    *EnumParOut = Ident3;
       
   478         }
       
   479 }
       
   480 
       
   481 void Proc7(OneToFifty IntParI1, OneToFifty IntParI2, OneToFifty* IntParOut)
       
   482 {
       
   483         REG OneToFifty  IntLoc;
       
   484 
       
   485         IntLoc = IntParI1 + 2;
       
   486         *IntParOut = IntParI2 + IntLoc;
       
   487 }
       
   488 
       
   489 void Proc8(Array1Dim Array1Par, Array2Dim Array2Par, OneToFifty IntParI1, OneToFifty IntParI2)
       
   490 {
       
   491         REG OneToFifty  IntLoc;
       
   492         REG OneToFifty  IntIndex;
       
   493 
       
   494         IntLoc = IntParI1 + 5;
       
   495         Array1Par[IntLoc] = IntParI2;
       
   496         Array1Par[IntLoc+1] = Array1Par[IntLoc];
       
   497         Array1Par[IntLoc+30] = IntLoc;
       
   498         for (IntIndex = IntLoc; IntIndex <= (IntLoc+1); ++IntIndex)
       
   499                 Array2Par[IntLoc][IntIndex] = IntLoc;
       
   500         ++Array2Par[IntLoc][IntLoc-1];
       
   501         Array2Par[IntLoc+20][IntLoc] = Array1Par[IntLoc];
       
   502         IntGlob = 5;
       
   503 }
       
   504 
       
   505 Enumeration Func1(CapitalLetter CharPar1, CapitalLetter CharPar2)
       
   506 
       
   507 {
       
   508         REG CapitalLetter       CharLoc1;
       
   509         REG CapitalLetter       CharLoc2;
       
   510 
       
   511         CharLoc1 = CharPar1;
       
   512         CharLoc2 = CharLoc1;
       
   513         if (CharLoc2 != CharPar2)
       
   514                 return (Ident1);
       
   515         else
       
   516                 return (Ident2);
       
   517 }
       
   518 
       
   519 boolean Func2(String30 StrParI1, String30 StrParI2)
       
   520 {
       
   521         REG OneToThirty IntLoc=0;
       
   522         REG CapitalLetter CharLoc=0;
       
   523 
       
   524         IntLoc = 1;
       
   525         while (IntLoc <= 1)
       
   526                 if (Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1)
       
   527                 {
       
   528                         CharLoc = 'A';
       
   529                         ++IntLoc;
       
   530                 }
       
   531         if (CharLoc >= 'W' && CharLoc <= 'Z')
       
   532                 IntLoc = 7;
       
   533         if (CharLoc == 'X')
       
   534                 return(TRUE);
       
   535         else
       
   536         {
       
   537                 if (strcmp(StrParI1, StrParI2) > 0)
       
   538                 {
       
   539                         IntLoc += 7;
       
   540                         return (TRUE);
       
   541                 }
       
   542                 else
       
   543                         return (FALSE);
       
   544         }
       
   545 }
       
   546 
       
   547 boolean Func3(REG Enumeration EnumParIn)
       
   548 {
       
   549         REG Enumeration EnumLoc;
       
   550 
       
   551         EnumLoc = EnumParIn;
       
   552         if (EnumLoc == Ident3) return (TRUE);
       
   553         return (FALSE);
       
   554 }
       
   555 
       
   556 #ifdef  NOSTRUCTASSIGN
       
   557 memcpy(d, s, l)
       
   558 register char   *d;
       
   559 register char   *s;
       
   560 int     l;
       
   561 {
       
   562         while (l--) *d++ = *s++;
       
   563 }
       
   564 #endif
       
   565 
       
   566 /*
       
   567  *      Library function for compilers with no time(2) function in the
       
   568  *      library.
       
   569  */
       
   570 #ifdef  NOTIME
       
   571 
       
   572 TInt64 time()
       
   573 //
       
   574 // EPOC32 time function - don't use around midnight
       
   575 //
       
   576 	{           
       
   577 //        long    t;
       
   578 //        struct regval {unsigned int ax,bx,cx,dx,si,di,ds,es; } regs;
       
   579 //        regs.ax = 0x2c00;
       
   580 //       sysint21(&regs, &regs);
       
   581 //       t = ((regs.cx>>8)*60L + (regs.cx & 0xff))*60L + (regs.dx>>8);
       
   582 //        if (p) *p = t;
       
   583 //        return t;
       
   584 
       
   585 
       
   586 	TTime timeNow;
       
   587 	timeNow.HomeTime();
       
   588 	return(timeNow.Int64());
       
   589 	}
       
   590 
       
   591 
       
   592 #endif
       
   593 
       
   594 char* strcpy(char* aDst, const char* aSrc)
       
   595 	{
       
   596 
       
   597 	char* cp = aDst;
       
   598 	while((*cp++ = *aSrc++)!=0)
       
   599 		;               /* Copy src over dst */
       
   600 
       
   601 	return(aDst);
       
   602 	}
       
   603 
       
   604 int strcmp(const char* aSrc, const char* aDst)
       
   605 	{
       
   606 	int ret=0 ;
       
   607 
       
   608 	while( (ret = *(unsigned char*)aSrc - *(unsigned char*)aDst)==0 && *aDst)
       
   609 		++aSrc, ++aDst;
       
   610 
       
   611 	if (ret<0)
       
   612 		ret=-1 ;
       
   613 	else if (ret>0)
       
   614 		ret=1 ;
       
   615 
       
   616 	return(ret);
       
   617 	}