1 /*
2 ** sysspec.h
3 ** Header file for sysspec.c
4 ** BYTEmark (tm)
5 ** BYTE's Native Mode Benchmarks
6 ** Rick Grehan, BYTE Magazine
7 **
8 ** Creation:
9 ** Revision: 3/95
10 **
11 ** DISCLAIMER
12 ** The source, executable, and documentation files that comprise
13 ** the BYTEmark benchmarks are made available on an "as is" basis.
14 ** This means that we at BYTE Magazine have made every reasonable
15 ** effort to verify that the there are no errors in the source and
16 ** executable code.  We cannot, however, guarantee that the programs
17 ** are error-free.  Consequently, McGraw-HIll and BYTE Magazine make
18 ** no claims in regard to the fitness of the source code, executable
19 ** code, and documentation of the BYTEmark.
20 **  Furthermore, BYTE Magazine, McGraw-Hill, and all employees
21 ** of McGraw-Hill cannot be held responsible for any damages resulting
22 ** from the use of this code or the results obtained from using
23 ** this code.
24 */
25 
26 /*
27 ** Standard includes
28 */
29 #include <stdlib.h>
30 #include <stdio.h>
31 #include <time.h>
32 #include <string.h>
33 
34 #include "nmglobal.h"
35 
36 #if !defined(MAC) && !defined(__STDC__)
37 #include <malloc.h>
38 #endif
39 
40 
41 /*
42 ** System-specific includes
43 */
44 
45 #ifdef DOS16MEM
46 #include "dos.h"
47 #endif
48 
49 /* #include "time.h"
50 #include "io.h"
51 #include "fcntl.h"
52 #include "sys\stat.h" */
53 /* Removed for MSVC++
54 #include "alloc.h"
55 */
56 
57 /*
58 ** MAC Time Manager routines (from Code Warrior)
59 */
60 #ifdef MACTIMEMGR
61 #include <memory.h>
62 #include <lowmem.h>
63 #include <Types.h>
64 #include <Timer.h>
65 extern struct TMTask myTMTask;
66 extern long MacHSTdelay,MacHSTohead;
67 #endif
68 
69 /*
70 ** Windows 3.1 timer defines
71 */
72 #ifdef WIN31TIMER
73 #include <windows.h>
74 #include <toolhelp.h>
75 TIMERINFO win31tinfo;
76 HANDLE hThlp;
77 FARPROC lpfn;
78 #endif
79 
80 /**************
81 ** EXTERNALS **
82 **************/
83 extern ulong mem_array[2][MEM_ARRAY_SIZE];
84 extern int mem_array_ents;
85 extern int global_align;
86 
87 /****************************
88 **   FUNCTION PROTOTYPES   **
89 ****************************/
90 
91 farvoid *AllocateMemory(unsigned long nbytes,
92                 int *errorcode);
93 
94 void FreeMemory(farvoid *mempointer,
95                 int *errorcode);
96 
97 void MoveMemory( farvoid *destination,
98                 farvoid *source,
99                 unsigned long nbytes);
100 
101 #ifdef DOS16MEM
102 void FarDOSmemmove(farvoid *destination,
103                 farvoid *source,
104                 unsigned long nbytes);
105 #endif
106 
107 void InitMemArray(void);
108 
109 int AddMemArray(ulong true_addr, ulong adj_addr);
110 
111 int RemoveMemArray(ulong adj_addr,ulong *true_addr);
112 
113 void ReportError(char *context, int errorcode);
114 
115 void ErrorExit();
116 
117 void CreateFile(char *filename,
118                 int *errorcode);
119 
120 #ifdef DOS16
121 int bmOpenFile(char *fname,
122                 int *errorcode);
123 
124 void CloseFile(int fhandle,
125                 int *errorcode);
126 
127 void readfile(int fhandle,
128                 unsigned long offset,
129                 unsigned long nbytes,
130                 void *buffer,
131                 int *errorcode);
132 
133 void writefile(int fhandle,
134                 unsigned long offset,
135                 unsigned long nbytes,
136                 void *buffer,
137                 int *errorcode);
138 #endif
139 
140 #ifdef LINUX
141 FILE *bmOpenFile(char *fname,
142                 int *errorcode);
143 
144 void CloseFile(FILE *fhandle,
145                 int *errorcode);
146 
147 void readfile(FILE *fhandle,
148                 unsigned long offset,
149                 unsigned long nbytes,
150                 void *buffer,
151                 int *errorcode);
152 
153 void writefile(FILE *fhandle,
154                 unsigned long offset,
155                 unsigned long nbytes,
156                 void *buffer,
157                 int *errorcode);
158 
159 #endif
160 
161 unsigned long StartStopwatch();
162 
163 unsigned long StopStopwatch(unsigned long startticks);
164 
165 unsigned long TicksToSecs(unsigned long tickamount);
166 
167 double TicksToFracSecs(unsigned long tickamount);
168 
169