1 | /*
|
---|
2 | * Copyright 1997-2003 by The XFree86 Project, Inc
|
---|
3 | *
|
---|
4 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
5 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
6 | * the above copyright notice appear in all copies and that both that
|
---|
7 | * copyright notice and this permission notice appear in supporting
|
---|
8 | * documentation, and that the names of the above listed copyright holders
|
---|
9 | * not be used in advertising or publicity pertaining to distribution of
|
---|
10 | * the software without specific, written prior permission. The above listed
|
---|
11 | * copyright holders make no representations about the suitability of this
|
---|
12 | * software for any purpose. It is provided "as is" without express or
|
---|
13 | * implied warranty.
|
---|
14 | *
|
---|
15 | * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
|
---|
16 | * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
17 | * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE
|
---|
18 | * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
|
---|
19 | * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
|
---|
20 | * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
---|
21 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
22 | *
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifndef _XF86_ANSIC_H
|
---|
26 | #define _XF86_ANSIC_H
|
---|
27 |
|
---|
28 | /* Handle <stdarg.h> */
|
---|
29 |
|
---|
30 | #ifndef __OS2ELF__
|
---|
31 | # include <stdarg.h>
|
---|
32 | #else /* __OS2ELF__ */
|
---|
33 | /* EMX/gcc_elf under OS/2 does not have native header files */
|
---|
34 | # if !defined (_VA_LIST)
|
---|
35 | # define _VA_LIST
|
---|
36 | typedef char *va_list;
|
---|
37 | # endif
|
---|
38 | # define _VA_ROUND(t) ((sizeof (t) + 3) & -4)
|
---|
39 | # if !defined (va_start)
|
---|
40 | # define va_start(ap,v) ap = (va_list)&v + ((sizeof (v) + 3) & -4)
|
---|
41 | # define va_end(ap) (ap = 0, (void)0)
|
---|
42 | # define va_arg(ap,t) (ap += _VA_ROUND (t), *(t *)(ap - _VA_ROUND (t)))
|
---|
43 | # endif
|
---|
44 | #endif /* __OS2ELF__ */
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * The first set of definitions are required both for modules and
|
---|
48 | * libc_wrapper.c.
|
---|
49 | */
|
---|
50 |
|
---|
51 | #if !defined(SYSV) && !defined(SVR4) && !defined(Lynx) || \
|
---|
52 | defined(__SCO__) || defined(__UNIXWARE__)
|
---|
53 | #define HAVE_VSSCANF
|
---|
54 | #define HAVE_VFSCANF
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | #ifndef NULL
|
---|
58 | #if (defined(SVR4) || defined(SYSV)) && !defined(__GNUC__)
|
---|
59 | #define NULL 0
|
---|
60 | #else
|
---|
61 | #define NULL ((void *)0)
|
---|
62 | #endif
|
---|
63 | #endif
|
---|
64 | #ifndef EOF
|
---|
65 | #define EOF (-1)
|
---|
66 | #endif
|
---|
67 |
|
---|
68 | #ifndef PATH_MAX
|
---|
69 | #define PATH_MAX 1024
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | /* <limits.h> stuff */
|
---|
73 | #define x_BITSPERBYTE 8
|
---|
74 | #define x_BITS(type) (x_BITSPERBYTE * (int)sizeof(type))
|
---|
75 | #define x_SHORTBITS x_BITS(short)
|
---|
76 | #define x_INTBITS x_BITS(int)
|
---|
77 | #define x_LONGBITS x_BITS(long)
|
---|
78 | #ifndef SHRT_MIN
|
---|
79 | #define SHRT_MIN ((short)(1 << (x_SHORTBITS - 1)))
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | #ifndef FONTMODULE
|
---|
83 | #include "misc.h"
|
---|
84 | #endif
|
---|
85 | #include "xf86_libc.h"
|
---|
86 | #ifndef SHRT_MAX
|
---|
87 | #define SHRT_MAX ((short)~SHRT_MIN)
|
---|
88 | #endif
|
---|
89 | #ifndef USHRT_MAX
|
---|
90 | #define USHRT_MAX ((unsigned short)~0)
|
---|
91 | #endif
|
---|
92 | #ifndef MINSHORT
|
---|
93 | #define MINSHORT SHRT_MIN
|
---|
94 | #endif
|
---|
95 | #ifndef MAXSHORT
|
---|
96 | #define MAXSHORT SHRT_MAX
|
---|
97 | #endif
|
---|
98 | #ifndef INT_MIN
|
---|
99 | #define INT_MIN (1 << (x_INTBITS - 1))
|
---|
100 | #endif
|
---|
101 | #ifndef INT_MAX
|
---|
102 | #define INT_MAX (~INT_MIN)
|
---|
103 | #endif
|
---|
104 | #ifndef UINT_MAX
|
---|
105 | #define UINT_MAX (~0)
|
---|
106 | #endif
|
---|
107 | #ifndef MININT
|
---|
108 | #define MININT INT_MIN
|
---|
109 | #endif
|
---|
110 | #ifndef MAXINT
|
---|
111 | #define MAXINT INT_MAX
|
---|
112 | #endif
|
---|
113 | #ifndef LONG_MIN
|
---|
114 | #define LONG_MIN ((long)(1 << (x_LONGBITS - 1)))
|
---|
115 | #endif
|
---|
116 | #ifndef LONG_MAX
|
---|
117 | #define LONG_MAX ((long)~LONG_MIN)
|
---|
118 | #endif
|
---|
119 | #ifndef ULONG_MAX
|
---|
120 | #define ULONG_MAX ((unsigned long)~0UL)
|
---|
121 | #endif
|
---|
122 | #ifndef MINLONG
|
---|
123 | #define MINLONG LONG_MIN
|
---|
124 | #endif
|
---|
125 | #ifndef MAXLONG
|
---|
126 | #define MAXLONG LONG_MAX
|
---|
127 | #endif
|
---|
128 |
|
---|
129 | /*
|
---|
130 | * ANSI C compilers only.
|
---|
131 | */
|
---|
132 |
|
---|
133 | /* ANSI C emulation library */
|
---|
134 |
|
---|
135 | extern void xf86abort(void);
|
---|
136 | extern int xf86abs(int);
|
---|
137 | extern double xf86acos(double);
|
---|
138 | extern double xf86asin(double);
|
---|
139 | extern double xf86atan(double);
|
---|
140 | extern double xf86atan2(double,double);
|
---|
141 | extern double xf86atof(const char*);
|
---|
142 | extern int xf86atoi(const char*);
|
---|
143 | extern long xf86atol(const char*);
|
---|
144 | extern void *xf86bsearch(const void *, const void *, xf86size_t, xf86size_t,
|
---|
145 | int (*)(const void *, const void *));
|
---|
146 | extern double xf86ceil(double);
|
---|
147 | extern void* xf86calloc(xf86size_t,xf86size_t);
|
---|
148 | extern void xf86clearerr(XF86FILE*);
|
---|
149 | extern double xf86cos(double);
|
---|
150 | extern void xf86exit(int);
|
---|
151 | extern double xf86exp(double);
|
---|
152 | extern double xf86fabs(double);
|
---|
153 | extern int xf86fclose(XF86FILE*);
|
---|
154 | extern int xf86feof(XF86FILE*);
|
---|
155 | extern int xf86ferror(XF86FILE*);
|
---|
156 | extern int xf86fflush(XF86FILE*);
|
---|
157 | extern int xf86fgetc(XF86FILE*);
|
---|
158 | extern int xf86getc(XF86FILE*);
|
---|
159 | extern int xf86fgetpos(XF86FILE*,XF86fpos_t*);
|
---|
160 | extern char* xf86fgets(char*,INT32,XF86FILE*);
|
---|
161 | extern int xf86finite(double);
|
---|
162 | extern double xf86floor(double);
|
---|
163 | extern double xf86fmod(double,double);
|
---|
164 | extern XF86FILE* xf86fopen(const char*,const char*);
|
---|
165 | extern double xf86frexp(double, int*);
|
---|
166 | extern int xf86printf(const char*,...);
|
---|
167 | extern int xf86fprintf(XF86FILE*,const char*,...);
|
---|
168 | extern int xf86fputc(int,XF86FILE*);
|
---|
169 | extern int xf86fputs(const char*,XF86FILE*);
|
---|
170 | extern xf86size_t xf86fread(void*,xf86size_t,xf86size_t,XF86FILE*);
|
---|
171 | extern void xf86free(void*);
|
---|
172 | extern XF86FILE* xf86freopen(const char*,const char*,XF86FILE*);
|
---|
173 | #if defined(HAVE_VFSCANF) || !defined(NEED_XF86_PROTOTYPES)
|
---|
174 | extern int xf86fscanf(XF86FILE*,const char*,...);
|
---|
175 | #else
|
---|
176 | extern int xf86fscanf(/*XF86FILE*,const char*,char *,char *,char *,char *,
|
---|
177 | char *,char *,char *,char *,char *,char * */);
|
---|
178 | #endif
|
---|
179 | extern int xf86fseek(XF86FILE*,long,int);
|
---|
180 | extern int xf86fsetpos(XF86FILE*,const XF86fpos_t*);
|
---|
181 | extern long xf86ftell(XF86FILE*);
|
---|
182 | extern xf86size_t xf86fwrite(const void*,xf86size_t,xf86size_t,XF86FILE*);
|
---|
183 | extern char* xf86getenv(const char*);
|
---|
184 | extern int xf86isalnum(int);
|
---|
185 | extern int xf86isalpha(int);
|
---|
186 | extern int xf86iscntrl(int);
|
---|
187 | extern int xf86isdigit(int);
|
---|
188 | extern int xf86isgraph(int);
|
---|
189 | extern int xf86islower(int);
|
---|
190 | extern int xf86isprint(int);
|
---|
191 | extern int xf86ispunct(int);
|
---|
192 | extern int xf86isspace(int);
|
---|
193 | extern int xf86isupper(int);
|
---|
194 | extern int xf86isxdigit(int);
|
---|
195 | extern long xf86labs(long);
|
---|
196 | extern double xf86ldexp(double,int);
|
---|
197 | extern double xf86log(double);
|
---|
198 | extern double xf86log10(double);
|
---|
199 | extern void* xf86malloc(xf86size_t);
|
---|
200 | extern void* xf86memchr(const void*,int,xf86size_t);
|
---|
201 | extern int xf86memcmp(const void*,const void*,xf86size_t);
|
---|
202 | extern void* xf86memcpy(void*,const void*,xf86size_t);
|
---|
203 | extern void* xf86memmove(void*,const void*,xf86size_t);
|
---|
204 | extern void* xf86memset(void*,int,xf86size_t);
|
---|
205 | extern double xf86modf(double,double*);
|
---|
206 | extern void xf86perror(const char*);
|
---|
207 | extern double xf86pow(double,double);
|
---|
208 | extern void xf86qsort(void*, xf86size_t, xf86size_t,
|
---|
209 | int(*)(const void*, const void*));
|
---|
210 | extern void* xf86realloc(void*,xf86size_t);
|
---|
211 | extern long xf86random(void);
|
---|
212 | extern int xf86remove(const char*);
|
---|
213 | extern int xf86rename(const char*,const char*);
|
---|
214 | extern void xf86rewind(XF86FILE*);
|
---|
215 | extern int xf86setbuf(XF86FILE*,char*);
|
---|
216 | extern int xf86setvbuf(XF86FILE*,char*,int,xf86size_t);
|
---|
217 | extern double xf86sin(double);
|
---|
218 | extern int xf86sprintf(char*,const char*,...);
|
---|
219 | extern int xf86snprintf(char*,xf86size_t,const char*,...);
|
---|
220 | extern double xf86sqrt(double);
|
---|
221 | #if defined(HAVE_VSSCANF) || !defined(NEED_XF86_PROTOTYPES)
|
---|
222 | extern int xf86sscanf(char*,const char*,...);
|
---|
223 | #else
|
---|
224 | extern int xf86sscanf(/*char*,const char*,char *,char *,char *,char *,
|
---|
225 | char *,char *,char *,char *,char *,char * */);
|
---|
226 | #endif
|
---|
227 | extern char* xf86strcat(char*,const char*);
|
---|
228 | extern char* xf86strchr(const char*, int c);
|
---|
229 | extern int xf86strcmp(const char*,const char*);
|
---|
230 | extern int xf86strcasecmp(const char*,const char*);
|
---|
231 | extern char* xf86strcpy(char*,const char*);
|
---|
232 | extern xf86size_t xf86strcspn(const char*,const char*);
|
---|
233 | extern char* xf86strerror(int);
|
---|
234 | extern xf86size_t xf86strlcat(char*,const char*,xf86size_t);
|
---|
235 | extern xf86size_t xf86strlcpy(char*,const char*,xf86size_t);
|
---|
236 | extern xf86size_t xf86strlen(const char*);
|
---|
237 | extern char* xf86strncat(char *, const char *, xf86size_t);
|
---|
238 | extern int xf86strncmp(const char*,const char*,xf86size_t);
|
---|
239 | extern int xf86strncasecmp(const char*,const char*,xf86size_t);
|
---|
240 | extern char* xf86strncpy(char*,const char*,xf86size_t);
|
---|
241 | extern char* xf86strpbrk(const char*,const char*);
|
---|
242 | extern char* xf86strrchr(const char*,int);
|
---|
243 | extern xf86size_t xf86strspn(const char*,const char*);
|
---|
244 | extern char* xf86strstr(const char*,const char*);
|
---|
245 | extern double xf86strtod(const char*,char**);
|
---|
246 | extern char* xf86strtok(char*,const char*);
|
---|
247 | extern long xf86strtol(const char*,char**,int);
|
---|
248 | extern unsigned long xf86strtoul(const char*,char**,int);
|
---|
249 | extern double xf86tan(double);
|
---|
250 | extern XF86FILE* xf86tmpfile(void);
|
---|
251 | extern char* xf86tmpnam(char*);
|
---|
252 | extern int xf86tolower(int);
|
---|
253 | extern int xf86toupper(int);
|
---|
254 | extern int xf86ungetc(int,XF86FILE*);
|
---|
255 | extern int xf86vfprintf(XF86FILE*,const char*,va_list);
|
---|
256 | extern int xf86vsprintf(char*,const char*,va_list);
|
---|
257 | extern int xf86vsnprintf(char*,xf86size_t,const char*,va_list);
|
---|
258 |
|
---|
259 | extern int xf86open(const char*, int,...);
|
---|
260 | extern int xf86close(int);
|
---|
261 | extern long xf86lseek(int, long, int);
|
---|
262 | extern int xf86ioctl(int, unsigned long, pointer);
|
---|
263 | extern xf86ssize_t xf86read(int, void *, xf86size_t);
|
---|
264 | extern xf86ssize_t xf86write(int, const void *, xf86size_t);
|
---|
265 | extern void* xf86mmap(void*, xf86size_t, int, int, int, xf86size_t /* off_t */);
|
---|
266 | extern int xf86munmap(void*, xf86size_t);
|
---|
267 | extern int xf86stat(const char *, struct xf86stat *);
|
---|
268 | extern int xf86fstat(int, struct xf86stat *);
|
---|
269 | extern int xf86access(const char *, int);
|
---|
270 | extern int xf86errno;
|
---|
271 | extern int xf86GetErrno(void);
|
---|
272 |
|
---|
273 | extern double xf86HUGE_VAL;
|
---|
274 |
|
---|
275 | extern double xf86hypot(double,double);
|
---|
276 |
|
---|
277 | /* non-ANSI C functions */
|
---|
278 | extern XF86DIR* xf86opendir(const char*);
|
---|
279 | extern int xf86closedir(XF86DIR*);
|
---|
280 | extern XF86DIRENT* xf86readdir(XF86DIR*);
|
---|
281 | extern void xf86rewinddir(XF86DIR*);
|
---|
282 | extern void xf86bcopy(const void*,void*,xf86size_t);
|
---|
283 | extern int xf86ffs(int);
|
---|
284 | extern char* xf86strdup(const char*);
|
---|
285 | extern void xf86bzero(void*,unsigned int);
|
---|
286 | extern int xf86execl(const char *, const char *, ...);
|
---|
287 | extern long xf86fpossize(void);
|
---|
288 | extern int xf86chmod(const char *, xf86mode_t);
|
---|
289 | extern int xf86chown(const char *, xf86uid_t, xf86gid_t);
|
---|
290 | extern xf86uid_t xf86geteuid(void);
|
---|
291 | extern xf86gid_t xf86getegid(void);
|
---|
292 | extern int xf86getpid(void);
|
---|
293 | extern int xf86mknod(const char *, xf86mode_t, xf86dev_t);
|
---|
294 | extern int xf86mkdir(const char *, xf86mode_t);
|
---|
295 | unsigned int xf86sleep(unsigned int seconds);
|
---|
296 | /* sysv IPC */
|
---|
297 | extern int xf86shmget(xf86key_t key, int size, int xf86shmflg);
|
---|
298 | extern char * xf86shmat(int id, char *addr, int xf86shmflg);
|
---|
299 | extern int xf86shmdt(char *addr);
|
---|
300 | extern int xf86shmctl(int id, int xf86cmd, pointer buf);
|
---|
301 |
|
---|
302 | extern int xf86setjmp(xf86jmp_buf env);
|
---|
303 | extern int xf86setjmp0(xf86jmp_buf env);
|
---|
304 | extern int xf86setjmp1(xf86jmp_buf env, int);
|
---|
305 | extern int xf86setjmp1_arg2(void);
|
---|
306 | extern int xf86setjmperror(xf86jmp_buf env);
|
---|
307 | extern int xf86getjmptype(void);
|
---|
308 | extern void xf86longjmp(xf86jmp_buf env, int val);
|
---|
309 | #define xf86setjmp_macro(env) \
|
---|
310 | (xf86getjmptype() == 0 ? xf86setjmp0((env)) : \
|
---|
311 | (xf86getjmptype() == 1 ? xf86setjmp1((env), xf86setjmp1_arg2()) : \
|
---|
312 | xf86setjmperror((env))))
|
---|
313 |
|
---|
314 | /*
|
---|
315 | * These things are always required by drivers (but not by libc_wrapper.c),
|
---|
316 | * even for a static server because some OSs don't provide them.
|
---|
317 | */
|
---|
318 |
|
---|
319 | extern int xf86getpagesize(void);
|
---|
320 | extern void xf86usleep(unsigned long);
|
---|
321 | extern void xf86getsecs(long *, long *);
|
---|
322 | #ifndef DONT_DEFINE_WRAPPERS
|
---|
323 | #undef getpagesize
|
---|
324 | #define getpagesize() xf86getpagesize()
|
---|
325 | #undef usleep
|
---|
326 | #define usleep(ul) xf86usleep(ul)
|
---|
327 | #undef getsecs
|
---|
328 | #define getsecs(a, b) xf86getsecs(a, b)
|
---|
329 | #endif
|
---|
330 | #endif /* _XF86_ANSIC_H */
|
---|