File: stdinc.h

package info (click to toggle)
flying 6.20-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 752 kB
  • ctags: 1,873
  • sloc: cpp: 10,966; makefile: 189
file content (209 lines) | stat: -rw-r--r-- 5,549 bytes parent folder | download | duplicates (4)
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
#ifndef _stdinc_h
#define _stdinc_h

#define	USE_EXTERNAL_STANDARD_INCLUDES
#define	_USE_OWN_STANDARD_INCLUDES


#ifdef USE_EXTERNAL_STANDARD_INCLUDES
// ===========================================================================
//
// The main include-files are included here and therfore in every other file.
//
// ===========================================================================
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#ifndef M_PI_2
#  define M_PI_2  (M_PI/2.0)
#endif
#ifndef __TURBOC__
#	include <X11/Xos.h>
	/* define X_GETTIMEOFDAY macro, a portable gettimeofday() */
	/* copied from Xos.h for pre-X11R6 releases               */
#	if defined(SVR4) || defined(VMS) || defined(WIN32)
#		define X_GETTIMEOFDAY(t) gettimeofday(t)
#	else
#		define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
#	endif

#else
#	include <string.h>
#	include <time.h>
#endif
#include <ctype.h>

#endif


#ifdef USE_OWN_STANDARD_INCLUDES
// ===========================================================================
//
// just for information, the library functions and their usage is
// stated below. Actually it was meant to use these lines instead of
// the actual includes on very slow machines, but this is very
// unportable, therefor it is not advised to use this switch
//
// ===========================================================================

#	ifndef  _TIME_T
#		define _TIME_T
		typedef long time_t;
#	endif
#	ifndef _SIZE_T
#		define _SIZE_T
		typedef unsigned int size_t;
#	endif

# ifndef _STRUCT_TIMEVAL
#  define _STRUCT_TIMEVAL
   /* Structure returned by gettimeofday(2) system call and others */
     struct timeval {
	  unsigned long	tv_sec;		/* seconds */
	  long		tv_usec;	/* and microseconds */
     };
# endif /* _STRUCT_TIMEVAL */

   struct timezone {
	int	tz_minuteswest;	/* minutes west of Greenwich */
	int	tz_dsttime;	/* type of dst correction */
   };

extern "C" {

// -----------
// from math.h
// -----------
// acos        : vec3.C
// atan        : vec2.C vec3.C
// cos         : vec2.C vec3.C
// fabs        : hockey.C keeper.C matrix.C
// sin         : vec2.C vec3.C
// sqrt        : vec2.h vec3.h vector.h
// fmod        : real.C
	double acos(double x);
	double atan(double x);
	double cos(double x);
	double fabs(double x);
	double sin(double x);
	double sqrt(double x);
	double fmod(double x, double y);
#  define M_PI_2  1.57079632679489661923

// -------------
// from stdlib.h
// -------------
// atof        : global.C main.C
// atoi        : main.C
// exit        : [ball.C] main.C xgraph.C xmover.C xpball.C
// rand        : ball.C main.C xgraph.C
// srand       : main.C
	double atof(const char *str);
	int atoi(const char *str);
	void exit(int status);
	int rand(void);
	void srand(unsigned int seed);

// -----------
// from time.h
// -----------
// difftime    : logfile.C
// gettimeofday: xgraph.C
// time        : logfile.C
	double difftime(time_t time1, time_t time0);
	int gettimeofday(
		struct timeval *tp,
		struct timezone *tzp
	);
	time_t time(time_t *tloc);

// ------------
// from stdio.h
// ------------
// fclose      : global.C rgb.C
// fflush      : xmover.C
// fgets       : global.C logfile.C rgb.C
// fopen       : global.C logfile.C rgb.C
// fprintf     : graph.C matrix.C rgb.C vector.C xpball.C
// fread       : xmover.C
// fwrite      : xmover.C
// printf      : arcs.C ball.C [carrom.C] [curling.C] [dynobj.C] game.C
//               global.C goal.C [graph.C] [hockey.C] main.C matrix.C object.C
//               [pball.C] pcon.C pocket.C vector.C wall.C xmover.C
// putchar     : matrix.C vector.C
// rename      : logfile.C
// sprintf     : [game.C] global.C main.C pball.C
// sscanf      : rgb.C
   typedef struct {
	int		 __cnt;
	unsigned char	*__ptr;
	unsigned char	*__base;
	unsigned short	 __flag;
	unsigned char 	 __fileL;		/* low byte of file desc */
	unsigned char 	 __fileH;		/* high byte of file desc */
   } FILE;
	extern FILE __iob[];
#  define   stdout   (&__iob[1])
#  define   stderr   (&__iob[2])

	int fclose(FILE *stream);
	int fflush(FILE *stream);
	char *fgets(char *s, int n, FILE *stream);
	FILE *fopen(const char *pathname, const char *type);
	int fprintf(FILE *stream, const char *format, /* [arg,] */ ...);
	size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
	size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
	int printf(const char *format, /* [arg,] */ ...);
	int putchar(int c);
	int rename(const char *source, const char *target);
	int sprintf(char *s, const char *format, /* [arg,] */ ...);
	int sscanf(const char *s, const char *format, /* [pointer,] */ ...);


// ------------
// from ctype.h
// ------------
// isspace     : global.C
// isupper     : xgraph.C
// tolower     : xgraph.C
	int isspace(int c);
	int isupper(int c);
	int tolower(int c);



// -------------
// from string.h
// -------------
// memset      : xmover.C
// strcmp      : [global.C] graph.C logfile.C main.C rgb.C
// strlen      : global.C logfile.C rgb.C xgraph.C
// strncmp     : rgb.C
// strstr      : global.C
	void *memset(void *s, int c, size_t n);
	int strcmp(const char *s1, const char *s2);
	size_t strlen(const char *s);
	int strncmp(const char *s1, const char *s2, size_t n);
	char *strstr(const char *s1, const char *s2);

// ------------
// from errno.h
// ------------
// perror      : logfile.C
//
// local included

// -------------
// from stdarg.h
// -------------
// va_end      : matrix.C vector.C
// va_start    : matrix.C vector.C
//
// local included

};

#endif


#endif