File: os.h

package info (click to toggle)
fweb 1.62-14.1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 7,400 kB
  • sloc: ansic: 41,945; makefile: 411; sh: 152
file content (523 lines) | stat: -rw-r--r-- 6,777 bytes parent folder | download | duplicates (9)
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
#if(0)
  FTANGLE v1.60,
 created with UNIX on "Thursday, September 24, 1998 at 16:12." 
  COMMAND LINE: "Web/ftangle Web/os -A -# --F -= 1.62/Web/os.h"
  RUN TIME:     "Friday, September 25, 1998 at 8:02."
  WEB FILE:     "Web/os.web"
  CHANGE FILE:  (none)
#endif



#ifndef OS_H_
#define OS_H_

#ifdef HAVE_CONFIG_H
#include "config.h" 
#endif 




#include "custom.h" 




#if OLD_PROTOTYPES
#define PROTO(args) () 
#else
#define PROTO(args) args 
#endif 



#if(0)

#if(NUM_VA_ARGS == 1)
#undef NUM_VA_ARGS
#define NUM_VA_ARGS 2
#endif
#endif

#if VARIABLE_ARGUMENTS
#define ELLIPSIS ,... 

#define VA_ARGS
#define VA_start
#if(NUM_VA_ARGS == 1)
#define VA_ALIST(args) (va_alist) 
#define VA_DCL(args) va_dcl
#define VA_START(a,n) va_start(a)
#else
#define VA_ALIST(args) args 
#define VA_DCL(args) args
#define VA_START(a,n) va_start(a,n)
#endif
#define VA_LIST(a) va_list a;
#else
#define ELLIPSIS 

#define VA_ARGS ,arg_ptr
#define arg_ptr arg1,arg2,arg3,arg4,arg5,arg6,\
arg7,arg8,arg9,arg10,arg11,arg12,arg13
#define VA_start outer_char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,\
*arg7,*arg8,*arg9,*arg10,*arg11,*arg12,*arg13;
#define VA_ALIST(args) args
#define VA_DCL(args) args
#define VA_LIST(a)
#define VA_START(a,n)
#ifdef va_arg
#undef va_arg
#define va_arg(a,type) (type)"KLUDGE for va_arg"
#endif
#define va_end(a)
#define vprintf printf
#define vsprintf sprintf
#endif 



#if !NO_VOID  

#define VOID void
#define SRTN void
#else
#define VOID 
#define void char
#define SRTN int
#endif 

#if KEEP_CONST
#define CONST const
#else
#define CONST
#endif



#if OLD_PROTOTYPES

#define FCN(args) args
#define C0(cmnt) ;
#define C1(cmnt) ;
#define C2(cmnt) ;VA_start
#else



#define FCN(args) (

#define C0(cmnt) , 

#define C1(cmnt) ) 

#define C2(cmnt) ,...) 
#endif 





#ifndef ANSI_CTYPE_H
#define ANSI_CTYPE_H 0
#endif

#ifndef ANSI_SPRINTF
#define ANSI_SPRINTF 0
#endif

#ifndef ANSI_SSCANF
#define ANSI_SSCANF 0
#endif

#ifndef ANSI_SYSTEM
#define ANSI_SYSTEM 0
#endif

#ifndef DEBUG_XCHR
#define DEBUG_XCHR 0
#endif

#ifndef FCN_CALLS
#define FCN_CALLS 0
#endif

#ifndef FANCY_SPLIT
#define FANCY_SPLIT 0
#endif

#ifndef HAVE_ERROR
#define HAVE_ERROR 0
#endif

#ifndef HAVE_GETENV
#define HAVE_GETENV 0
#endif

#ifndef HAVE_GETTIMEOFDAY
#define HAVE_GETTIMEOFDAY 0
#endif

#ifndef HAVE_LIMITS_H
#define HAVE_LIMITS_H 0
#endif

#ifndef HAVE_SYS_TIMEB_H
#define HAVE_SYS_TIMEB_H 0
#endif

#ifndef HAVE_STDARG_H
#define HAVE_STDARG_H 0
#endif

#ifndef HAVE_STDDEF_H
#define HAVE_STDDEF_H 0
#endif

#ifndef HAVE_STDLIB_H
#define HAVE_STDLIB_H 0
#endif

#ifndef HAVE_STD_PROTOTYPES
#define HAVE_STD_PROTOTYPES 0
#endif

#ifndef HAVE_STRERROR
#define HAVE_STRERROR 0
#endif

#ifndef HAVE_VALUES_H
#define HAVE_VALUES_H 0
#endif

#ifndef HUGE_POINTERS
#define HUGE_POINTERS 0
#endif

#ifndef KEEP_CONST
#define KEEP_CONST 0
#endif

#ifndef NEW_DIFFTIME
#define NEW_DIFFTIME 0
#endif

#ifndef NO_VOID
#define NO_VOID 0
#endif

#ifndef NON_ANSI_CALLOC
#define NON_ANSI_CALLOC 0
#endif

#ifndef OLD_PROTOTYPES
#define OLD_PROTOTYPES 0
#endif

#ifndef PRINT_AVAILABLE_MEMORY
#define PRINT_AVAILABLE_MEMORY 0
#endif

#ifndef SIZE_T_DEFINED
#define SIZE_T_DEFINED 0
#endif

#ifndef TIMING
#define TIMING 0
#endif

#ifndef TRANSLATE_ASCII
#define TRANSLATE_ASCII 0
#endif

#ifndef UNIX_PATH
#define UNIX_PATH 0
#endif



#if HAVE_STDARG_H
#include <stdarg.h>
#else
#include <varargs.h>
#endif

#if HAVE_STDLIB_H
#include <stdlib.h>
#endif

#if !HAVE_STD_PROTOTYPES
#include "stdlib0.h"
#endif

#if HAVE_STDDEF_H
#include <stddef.h>
#endif

#if HAVE_LIMITS_H
#include <limits.h> 
#else
#if HAVE_VALUES_H
#define INT_MAX MAXINT
#define LONG_MAX MAXLONG
#else
#define INT_MAX 0x7FFF
#define LONG_MAX INT_MAX
#endif

#define INT_MIN (~(INT_MAX))
#define LONG_MIN (~(LONG_MAX))
#define ULONG_MAX (MAXLONG | (~(MAXLONG)))

#endif

#if HAVE_FLOAT_H
#include <float.h>
#else
#ifndef DBL_DIG
#define DBL_DIG 10
#endif
#endif

#if !NON_ANSI_CALLOC
#define CALLOC calloc
#define REALLOC(old_ptr, new_size, old_size) realloc(old_ptr, new_size)
#define FREE free
#endif 





#define UL(num) ((unsigned long)(num))

#include <stdio.h> 
#include <errno.h>


#define FWRITE(buf,len,fp) fwrite((CONST void *)(buf),(size_t)(len),\
    (size_t)(1),fp)

#define WRITE1(buf,len) \
 {\
 int _k;\
 outer_char *_p;\
 for(_p= buf,_k= (int)(len); _k>0; _k--)\
   {\
   PUTC(*_p);\
   _p++;\
   }\
 }


#if STDC_HEADERS || HAVE_STRING_H
#include <string.h> 

#if !STDC_HEADERS && HAVE_MEMORY_H
#include <memory.h>
#endif
#else
#include <strings.h>
#endif

#include <ctype.h> 





#if !ANSI_CTYPE_H
#undef isalpha
#undef isupper
#undef islower

#define isupper(c) ('A' <= (unsigned)(c) && (unsigned)(c) <= 'Z')
#define islower(c) ('a' <= (unsigned)(c) && (unsigned)(c) <= 'z')
#define isalpha(c) (isupper(c) || islower(c))
#endif

#include <setjmp.h> 









#ifndef TIMING_WIDTH
#define TIMING_WIDTH 1 
#endif 

#include <time.h> 


#if TIMING




#if HAVE_GETTIMEOFDAY

#include <sys/time.h>
#undef NEW_DIFFTIME
#define NEW_DIFFTIME 1
#define TIME_T struct timeval
#ifdef _COMMON_h
struct timezone tz_dummy;
#endif
int gettimeofday PROTO((struct timeval*tp,struct timezone*tzp));
#define TIME(p) gettimeofday(p, &tz_dummy)
#else
#if HAVE_SYS_TIMEB_H

#include <sys/timeb.h>
#undef NEW_DIFFTIME
#define NEW_DIFFTIME 1
#define TIME_T struct timeb
#define TIME(p) ftime(p)
#else 
#define TIME_T time_t
#define TIME(p) time(p)
#endif 
#endif 

#if NEW_DIFFTIME
#define DIFFTIME diff_time 



#else
#define DIFFTIME difftime 
#endif 

clock_t clock PROTO((VOID));

#ifndef CLOCKS_PER_SEC
#ifdef CLK_TCK
#define CLOCKS_PER_SEC CLK_TCK 
#else
#define CLOCKS_PER_SEC 1000000 

#endif 
#endif 

#endif 



#ifndef THE_SYSTEM
#define THE_SYSTEM "UNKNOWN"
#endif

#ifndef LOCAL_BANNER
#define LOCAL_BANNER ""
#endif

#ifndef NULL_FILE_NAME
#define NULL_FILE_NAME "null"
#endif

#ifndef C_EXT
#define C_EXT "c"
#endif

#ifndef M_EXT
#define M_EXT "mk"
#endif

#ifndef X_EXT
#define X_EXT "sty"
#endif

#ifndef Cpp_EXT
#define Cpp_EXT "c++"
#endif

#ifndef R_EXT
#define R_EXT "r"
#endif

#ifndef R90_EXT
#define R90_EXT "r90"
#endif

#ifndef N_EXT
#define N_EXT "f"
#endif

#ifndef N90_EXT
#define N90_EXT "f90"
#endif

#ifndef VARIABLE_ARGUMENTS
#define VARIABLE_ARGUMENTS 0
#endif

#if VARIABLE_ARGUMENTS
#ifndef NUM_VA_ARGS
#define NUM_VA_ARGS 2
#endif
#endif

#ifndef PREFIX_END_CHAR
#define PREFIX_END_CHAR '/'
#endif




#ifndef _strmac_
#include "strmac.h" 
#endif 



#define UNUSED(var) var



#define HUGE_FCN_PTR

#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE 
#endif

#include <math.h> 
#ifdef HUGE
#undef HUGE 
#endif

#if HUGE_POINTERS 
#define HUGE huge 
#else
#define HUGE 
#endif 



#define PLUS



#define CAST(type,var) var
#define _Xx(fmt) fmt




#define beep Fbeep






#endif