forked from adesutherland/CMS-370-BREXX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
os.h
319 lines (281 loc) · 6.46 KB
/
os.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
/* Modified for VM/370 CMS and GCC by Robert O'Hara, July 2010. */
/*
* $Id: os.h,v 1.10 2009/06/02 09:41:43 bnv Exp $
* $Log: os.h,v $
* Revision 1.10 2009/06/02 09:41:43 bnv
* MVS/CMS corrections
*
* Revision 1.9 2008/07/14 13:09:21 bnv
* MVS,CMS support
*
* Revision 1.8 2006/01/26 10:29:52 bnv
* Corrected for Windows CE
*
* Revision 1.7 2003/11/04 09:48:17 bnv
* REMOVED: the mkstemp
* mkstemp was openning the file and returing the file handle
*
* Revision 1.6 2003/02/12 16:38:39 bnv
* Added: pragma to disable the signed/unsigned comparison warning
*
* Revision 1.5 2002/08/22 12:30:34 bnv
* Added: UNIX define
*
* Revision 1.4 2002/06/11 12:37:56 bnv
* Added: CDECL
*
* Revision 1.3 2002/06/06 08:22:54 bnv
* Added: MKTEMP
*
* Revision 1.2 2001/06/25 18:52:04 bnv
* Header -> Id
*
* Revision 1.1 1999/11/29 14:58:00 bnv
* Initial revision
*
*/
#ifndef __OS_H__
#define __OS_H__
/* ----------- Definitions depending on the OS system ---------- */
/*
* The following definitions should be supplied from the
* make.cnf file
*
* General
* ALIGN - Align the code in 4-bytes (used for RISC machines)
* RMLAST - If the last newline should be remove from the
* Redirected commands
* INLINE - Use inline in some routines to speed up the code.
* GREEK - Support for the GREEK character set.
*
* LUSEOPTION Is not used!
*
* __DEBUG__ Active the internal debugging
*
* Operating system
* MSDOS - Compiled for a MSDOS operating system
* WIN32 - Compiled for a WIN32 system
* WCE - For a PalmTop version Windows CE
*
* Compiler
* __BORLANDC__ For the Borland C++ compiler
* GCC - GNU C compiler
* MSC_VER - Microsoft C
*/
/* ======== Operating system specifics ========= */
#ifdef WCE
# define OS "WINCE"
# define SHELL "SHELL"
# define FILESEP '\\'
# define PATHSEP ';'
# define ALIGN 1
# define WIN 1
# pragma warning(disable : 4018) /* signed unsigned comparison warning */
#elif defined(MSDOS)
# define OS "MSDOS"
# define SHELL "COMSPEC"
# define FILESEP '\\'
# define PATHSEP ';'
# define HAS_TERMINALIO
# define HAS_STDIO
# define HAS_STRING /* For BorlandC use special Strings */
# define HAS_CTYPE
# define HAS_XTOY
# define HAS_SIGNAL
#elif defined(WIN)
# define OS "WIN"
# define SHELL "COMSPEC"
# define FILESEP '\\'
# define PATHSEP ';'
# define HAS_STRING
# define HAS_CTYPE
# define HAS_XTOY
#elif __CMS__
# define VMCMS 1
# define SHELL "SHELL"
# define OS "CMS"
# define FILESEP '.'
# define PATHSEP ':'
# define HAS_TERMINALIO
# define HAS_STDIO
# define HAS_STRING
# define HAS_CTYPE
# define HAS_XTOY
# define HAS_SIGNAL
#elif __MVS__
# define VMCMS 1
# define SHELL "SHELL"
# define OS "MVS"
# define FILESEP '.'
# define PATHSEP ':'
# define HAS_TERMINALIO
# define HAS_STDIO
# define HAS_STRING
# define HAS_CTYPE
# define HAS_XTOY
# define HAS_SIGNAL
#else
# define UNIX 1
# define OS "UNIX"
# define SHELL "SHELL"
# define FILESEP '/'
# define PATHSEP ':'
# define HAS_TERMINALIO
# define HAS_STDIO
# define HAS_STRING
# define HAS_CTYPE
# define HAS_XTOY
# define HAS_SIGNAL
#endif
#ifdef WCE
# define __CDECL __cdecl
#else
# define __CDECL
#endif
#ifndef __BORLANDC__
# define huge
#endif
/* --------------- NON UNICODE ----------------- */
#ifndef WIN
# ifndef UNICODE
# ifndef TCHAR
# define TCHAR char
# define LPTSTR char*
# endif
# ifndef TEXT
# define TEXT(x) (x)
# endif
# endif
#endif
/* -------------- Terminal I/O ----------------- */
#ifdef HAS_TERMINALIO
# define PUTS puts
# define PUTCHAR putchar
//# define PUTINT(a,b,c) ;
#else
# define PUTS Bputs
# define PUTINT Bputint
# define PUTCHAR Bputch
# define GETCHAR WReadKey
#endif
/* -------------------- I/O -------------------- */
#ifdef HAS_STDIO
/* --- Use the standard I/O --- */
# define STDIN stdin
# define STDOUT stdout
# define STDERR stderr
# define FILEP FILE*
# define FOPEN fopen
# define FEOF feof
# define FTELL ftell
# define FSEEK fseek
# define FFLUSH fflush
# define FCLOSE fclose
# define FPUTC fputc
# define FPUTS fputs
# define FGETC fgetc
# define PRINTF printf
# ifdef WIN
# define GETCWD _getcwd
# define CHDIR _chdir
# else
# define GETCWD getcwd
# define CHDIR chdir
# endif
#else
/* --- Use the home made I/O --- */
# define STDIN NULL
# define STDOUT NULL
# define STDERR NULL
# define FILEP BFILE*
# define FOPEN Bfopen
# define FCLOSE Bfclose
# define FEOF Bfeof
# define FTELL Bftell
# define FSEEK Bfseek
# define FFLUSH Bfflush
# define FPUTC Bfputc
# define FPUTS Bfputs
# define FGETC Bfgetc
# define PRINTF Bprintf
# define GETCWD Bgetcwd
# define CHDIR Bchdir
#endif
/* ---------------- Unicode Ops ------------------ */
#ifdef UNICODE
# define SPRINTF swprintf
#else
# define SPRINTF sprintf
#endif
/* ---------------- Memory Ops ------------------- */
#ifdef __BORLANDC__ /* For the HUGE/LARGE memory model */
# define MEMMOVE memmove
# define MEMCPY _fmemcpy
# define MEMCMP _fmemcmp
# define MEMCHR _fmemchr
# define MEMSET _fmemset
#else
# define MEMMOVE memmove
# define MEMCPY memcpy
# define MEMCMP memcmp
# define MEMCHR memchr
# define MEMSET memset
#endif
/* ----------------- Strings --------------------- */
#ifdef __BORLANDC__ /* For the HUGE/LARGE memory model */
# define STRCPY _fstrcpy
# define STRCMP _fstrcmp
# define STRCAT _fstrcat
# define STRCHR _fstrchr
# define STRLEN _fstrlen
# define STRSTR _fstrstr
# define MKTEMP mktemp
#elif defined(HAS_STRING)
# define STRCPY strcpy
# define STRCMP strcmp
# define STRCAT strcat
# define STRCHR strchr
# define STRLEN strlen
# define STRSTR strstr
# define MKTEMP mktemp
#else
# define STRCPY Bstrcpy
# define STRCMP Bstrcmp
# define STRCAT Bstrcat
# define STRCHR Bstrchr
# define STRLEN Bstrlen
# define STRSTR Bstrstr
#endif
/* ----------------- Ctype ------------------------- */
#ifdef HAS_CTYPE
# define ISSPACE isspace
# define ISDIGIT isdigit
# define ISXDIGIT isxdigit
# define ISALPHA isalpha
#else
# define ISSPACE Bisspace
# define ISDIGIT Bisdigit
# define ISXDIGIT Bisxdigit
# define ISALPHA Bisalpha
#endif
/* ----------------- Conversions ------------------- */
#ifdef HAS_XTOY
# define LTOA ltoa
# define GCVT gcvt
# define FCVT fcvt
# define ECVT ecvt
#elif defined(WCE)
# define LTOA _ltoa
# define GCVT _gcvt
# define FCVT _fcvt
# define ECVT _ecvt
#else
# error "No home made conversions!"
#endif
/* ------------------- Signal ---------------------- */
#ifdef HAS_SIGNAL
# define SIGNAL signal
#else
# define SIGNAL WSignal
#endif
#endif