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 | #include <stdarg.h>
|
---|
29 |
|
---|
30 | /*
|
---|
31 | * The first set of definitions are required both for modules and
|
---|
32 | * libc_wrapper.c.
|
---|
33 | */
|
---|
34 |
|
---|
35 | #if !defined(SYSV) && !defined(SVR4) && !defined(Lynx) || \
|
---|
36 | defined(__SCO__) || defined(__UNIXWARE__)
|
---|
37 | #define HAVE_VSSCANF
|
---|
38 | #define HAVE_VFSCANF
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | #ifndef NULL
|
---|
42 | #if (defined(SVR4) || defined(SYSV)) && !defined(__GNUC__)
|
---|
43 | #define NULL 0
|
---|
44 | #else
|
---|
45 | #define NULL ((void *)0)
|
---|
46 | #endif
|
---|
47 | #endif
|
---|
48 | #ifndef EOF
|
---|
49 | #define EOF (-1)
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | #ifndef PATH_MAX
|
---|
53 | #define PATH_MAX 1024
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | /* <limits.h> stuff */
|
---|
57 | #define x_BITSPERBYTE 8
|
---|
58 | #define x_BITS(type) (x_BITSPERBYTE * (int)sizeof(type))
|
---|
59 | #define x_SHORTBITS x_BITS(short)
|
---|
60 | #define x_INTBITS x_BITS(int)
|
---|
61 | #define x_LONGBITS x_BITS(long)
|
---|
62 | #ifndef SHRT_MIN
|
---|
63 | #define SHRT_MIN ((short)(1 << (x_SHORTBITS - 1)))
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | #ifndef FONTMODULE
|
---|
67 | #include "misc.h"
|
---|
68 | #endif
|
---|
69 | #include "xf86_libc.h"
|
---|
70 | #ifndef SHRT_MAX
|
---|
71 | #define SHRT_MAX ((short)~SHRT_MIN)
|
---|
72 | #endif
|
---|
73 | #ifndef USHRT_MAX
|
---|
74 | #define USHRT_MAX ((unsigned short)~0)
|
---|
75 | #endif
|
---|
76 | #ifndef MINSHORT
|
---|
77 | #define MINSHORT SHRT_MIN
|
---|
78 | #endif
|
---|
79 | #ifndef MAXSHORT
|
---|
80 | #define MAXSHORT SHRT_MAX
|
---|
81 | #endif
|
---|
82 | #ifndef INT_MIN
|
---|
83 | #define INT_MIN (1 << (x_INTBITS - 1))
|
---|
84 | #endif
|
---|
85 | #ifndef INT_MAX
|
---|
86 | #define INT_MAX (~INT_MIN)
|
---|
87 | #endif
|
---|
88 | #ifndef UINT_MAX
|
---|
89 | #define UINT_MAX (~0)
|
---|
90 | #endif
|
---|
91 | #ifndef MININT
|
---|
92 | #define MININT INT_MIN
|
---|
93 | #endif
|
---|
94 | #ifndef MAXINT
|
---|
95 | #define MAXINT INT_MAX
|
---|
96 | #endif
|
---|
97 | #ifndef LONG_MIN
|
---|
98 | #define LONG_MIN ((long)(1 << (x_LONGBITS - 1)))
|
---|
99 | #endif
|
---|
100 | #ifndef LONG_MAX
|
---|
101 | #define LONG_MAX ((long)~LONG_MIN)
|
---|
102 | #endif
|
---|
103 | #ifndef ULONG_MAX
|
---|
104 | #define ULONG_MAX ((unsigned long)~0UL)
|
---|
105 | #endif
|
---|
106 | #ifndef MINLONG
|
---|
107 | #define MINLONG LONG_MIN
|
---|
108 | #endif
|
---|
109 | #ifndef MAXLONG
|
---|
110 | #define MAXLONG LONG_MAX
|
---|
111 | #endif
|
---|
112 |
|
---|
113 | /*
|
---|
114 | * ANSI C compilers only.
|
---|
115 | */
|
---|
116 |
|
---|
117 | /* ANSI C emulation library */
|
---|
118 |
|
---|
119 | extern void xf86abort(void);
|
---|
120 | extern int xf86abs(int);
|
---|
121 | extern double xf86acos(double);
|
---|
122 | extern double xf86asin(double);
|
---|
123 | extern double xf86atan(double);
|
---|
124 | extern double xf86atan2(double,double);
|
---|
125 | extern double xf86atof(const char*);
|
---|
126 | extern int xf86atoi(const char*);
|
---|
127 | extern long xf86atol(const char*);
|
---|
128 | extern void *xf86bsearch(const void *, const void *, xf86size_t, xf86size_t,
|
---|
129 | int (*)(const void *, const void *));
|
---|
130 | extern double xf86ceil(double);
|
---|
131 | extern void* xf86calloc(xf86size_t,xf86size_t);
|
---|
132 | extern void xf86clearerr(XF86FILE*);
|
---|
133 | extern double xf86cos(double);
|
---|
134 | extern void xf86exit(int);
|
---|
135 | extern double xf86exp(double);
|
---|
136 | extern double xf86fabs(double);
|
---|
137 | extern int xf86fclose(XF86FILE*);
|
---|
138 | extern int xf86feof(XF86FILE*);
|
---|
139 | extern int xf86ferror(XF86FILE*);
|
---|
140 | extern int xf86fflush(XF86FILE*);
|
---|
141 | extern int xf86fgetc(XF86FILE*);
|
---|
142 | extern int xf86getc(XF86FILE*);
|
---|
143 | extern int xf86fgetpos(XF86FILE*,XF86fpos_t*);
|
---|
144 | extern char* xf86fgets(char*,INT32,XF86FILE*);
|
---|
145 | extern int xf86finite(double);
|
---|
146 | extern double xf86floor(double);
|
---|
147 | extern double xf86fmod(double,double);
|
---|
148 | extern XF86FILE* xf86fopen(const char*,const char*);
|
---|
149 | extern double xf86frexp(double, int*);
|
---|
150 | extern int xf86printf(const char*,...);
|
---|
151 | extern int xf86fprintf(XF86FILE*,const char*,...);
|
---|
152 | extern int xf86fputc(int,XF86FILE*);
|
---|
153 | extern int xf86fputs(const char*,XF86FILE*);
|
---|
154 | extern xf86size_t xf86fread(void*,xf86size_t,xf86size_t,XF86FILE*);
|
---|
155 | extern void xf86free(void*);
|
---|
156 | extern XF86FILE* xf86freopen(const char*,const char*,XF86FILE*);
|
---|
157 | #if defined(HAVE_VFSCANF) || !defined(NEED_XF86_PROTOTYPES)
|
---|
158 | extern int xf86fscanf(XF86FILE*,const char*,...);
|
---|
159 | #else
|
---|
160 | extern int xf86fscanf(/*XF86FILE*,const char*,char *,char *,char *,char *,
|
---|
161 | char *,char *,char *,char *,char *,char * */);
|
---|
162 | #endif
|
---|
163 | extern int xf86fseek(XF86FILE*,long,int);
|
---|
164 | extern int xf86fsetpos(XF86FILE*,const XF86fpos_t*);
|
---|
165 | extern long xf86ftell(XF86FILE*);
|
---|
166 | extern xf86size_t xf86fwrite(const void*,xf86size_t,xf86size_t,XF86FILE*);
|
---|
167 | extern char* xf86getenv(const char*);
|
---|
168 | extern int xf86isalnum(int);
|
---|
169 | extern int xf86isalpha(int);
|
---|
170 | extern int xf86iscntrl(int);
|
---|
171 | extern int xf86isdigit(int);
|
---|
172 | extern int xf86isgraph(int);
|
---|
173 | extern int xf86islower(int);
|
---|
174 | extern int xf86isprint(int);
|
---|
175 | extern int xf86ispunct(int);
|
---|
176 | extern int xf86isspace(int);
|
---|
177 | extern int xf86isupper(int);
|
---|
178 | extern int xf86isxdigit(int);
|
---|
179 | extern long xf86labs(long);
|
---|
180 | extern double xf86ldexp(double,int);
|
---|
181 | extern double xf86log(double);
|
---|
182 | extern double xf86log10(double);
|
---|
183 | extern void* xf86malloc(xf86size_t);
|
---|
184 | extern void* xf86memchr(const void*,int,xf86size_t);
|
---|
185 | extern int xf86memcmp(const void*,const void*,xf86size_t);
|
---|
186 | extern void* xf86memcpy(void*,const void*,xf86size_t);
|
---|
187 | extern void* xf86memmove(void*,const void*,xf86size_t);
|
---|
188 | extern void* xf86memset(void*,int,xf86size_t);
|
---|
189 | extern double xf86modf(double,double*);
|
---|
190 | extern void xf86perror(const char*);
|
---|
191 | extern double xf86pow(double,double);
|
---|
192 | extern void xf86qsort(void*, xf86size_t, xf86size_t,
|
---|
193 | int(*)(const void*, const void*));
|
---|
194 | extern void* xf86realloc(void*,xf86size_t);
|
---|
195 | extern long xf86random(void);
|
---|
196 | extern int xf86remove(const char*);
|
---|
197 | extern int xf86rename(const char*,const char*);
|
---|
198 | extern void xf86rewind(XF86FILE*);
|
---|
199 | extern int xf86setbuf(XF86FILE*,char*);
|
---|
200 | extern int xf86setvbuf(XF86FILE*,char*,int,xf86size_t);
|
---|
201 | extern double xf86sin(double);
|
---|
202 | extern int xf86sprintf(char*,const char*,...);
|
---|
203 | extern int xf86snprintf(char*,xf86size_t,const char*,...);
|
---|
204 | extern double xf86sqrt(double);
|
---|
205 | #if defined(HAVE_VSSCANF) || !defined(NEED_XF86_PROTOTYPES)
|
---|
206 | extern int xf86sscanf(char*,const char*,...);
|
---|
207 | #else
|
---|
208 | extern int xf86sscanf(/*char*,const char*,char *,char *,char *,char *,
|
---|
209 | char *,char *,char *,char *,char *,char * */);
|
---|
210 | #endif
|
---|
211 | extern char* xf86strcat(char*,const char*);
|
---|
212 | extern char* xf86strchr(const char*, int c);
|
---|
213 | extern int xf86strcmp(const char*,const char*);
|
---|
214 | extern int xf86strcasecmp(const char*,const char*);
|
---|
215 | extern char* xf86strcpy(char*,const char*);
|
---|
216 | extern xf86size_t xf86strcspn(const char*,const char*);
|
---|
217 | extern char* xf86strerror(int);
|
---|
218 | extern xf86size_t xf86strlcat(char*,const char*,xf86size_t);
|
---|
219 | extern xf86size_t xf86strlcpy(char*,const char*,xf86size_t);
|
---|
220 | extern xf86size_t xf86strlen(const char*);
|
---|
221 | extern char* xf86strncat(char *, const char *, xf86size_t);
|
---|
222 | extern int xf86strncmp(const char*,const char*,xf86size_t);
|
---|
223 | extern int xf86strncasecmp(const char*,const char*,xf86size_t);
|
---|
224 | extern char* xf86strncpy(char*,const char*,xf86size_t);
|
---|
225 | extern char* xf86strpbrk(const char*,const char*);
|
---|
226 | extern char* xf86strrchr(const char*,int);
|
---|
227 | extern xf86size_t xf86strspn(const char*,const char*);
|
---|
228 | extern char* xf86strstr(const char*,const char*);
|
---|
229 | extern double xf86strtod(const char*,char**);
|
---|
230 | extern char* xf86strtok(char*,const char*);
|
---|
231 | extern long xf86strtol(const char*,char**,int);
|
---|
232 | extern unsigned long xf86strtoul(const char*,char**,int);
|
---|
233 | extern double xf86tan(double);
|
---|
234 | extern XF86FILE* xf86tmpfile(void);
|
---|
235 | extern char* xf86tmpnam(char*);
|
---|
236 | extern int xf86tolower(int);
|
---|
237 | extern int xf86toupper(int);
|
---|
238 | extern int xf86ungetc(int,XF86FILE*);
|
---|
239 | extern int xf86vfprintf(XF86FILE*,const char*,va_list);
|
---|
240 | extern int xf86vsprintf(char*,const char*,va_list);
|
---|
241 | extern int xf86vsnprintf(char*,xf86size_t,const char*,va_list);
|
---|
242 |
|
---|
243 | extern int xf86open(const char*, int,...);
|
---|
244 | extern int xf86close(int);
|
---|
245 | extern long xf86lseek(int, long, int);
|
---|
246 | extern int xf86ioctl(int, unsigned long, pointer);
|
---|
247 | extern xf86ssize_t xf86read(int, void *, xf86size_t);
|
---|
248 | extern xf86ssize_t xf86write(int, const void *, xf86size_t);
|
---|
249 | extern void* xf86mmap(void*, xf86size_t, int, int, int, xf86size_t /* off_t */);
|
---|
250 | extern int xf86munmap(void*, xf86size_t);
|
---|
251 | extern int xf86stat(const char *, struct xf86stat *);
|
---|
252 | extern int xf86fstat(int, struct xf86stat *);
|
---|
253 | extern int xf86access(const char *, int);
|
---|
254 | extern int xf86errno;
|
---|
255 | extern int xf86GetErrno(void);
|
---|
256 |
|
---|
257 | extern double xf86HUGE_VAL;
|
---|
258 |
|
---|
259 | extern double xf86hypot(double,double);
|
---|
260 |
|
---|
261 | /* non-ANSI C functions */
|
---|
262 | extern XF86DIR* xf86opendir(const char*);
|
---|
263 | extern int xf86closedir(XF86DIR*);
|
---|
264 | extern XF86DIRENT* xf86readdir(XF86DIR*);
|
---|
265 | extern void xf86rewinddir(XF86DIR*);
|
---|
266 | extern void xf86bcopy(const void*,void*,xf86size_t);
|
---|
267 | extern int xf86ffs(int);
|
---|
268 | extern char* xf86strdup(const char*);
|
---|
269 | extern void xf86bzero(void*,unsigned int);
|
---|
270 | extern int xf86execl(const char *, const char *, ...);
|
---|
271 | extern long xf86fpossize(void);
|
---|
272 | extern int xf86chmod(const char *, xf86mode_t);
|
---|
273 | extern int xf86chown(const char *, xf86uid_t, xf86gid_t);
|
---|
274 | extern xf86uid_t xf86geteuid(void);
|
---|
275 | extern xf86gid_t xf86getegid(void);
|
---|
276 | extern int xf86getpid(void);
|
---|
277 | extern int xf86mknod(const char *, xf86mode_t, xf86dev_t);
|
---|
278 | extern int xf86mkdir(const char *, xf86mode_t);
|
---|
279 | unsigned int xf86sleep(unsigned int seconds);
|
---|
280 | /* sysv IPC */
|
---|
281 | extern int xf86shmget(xf86key_t key, int size, int xf86shmflg);
|
---|
282 | extern char * xf86shmat(int id, char *addr, int xf86shmflg);
|
---|
283 | extern int xf86shmdt(char *addr);
|
---|
284 | extern int xf86shmctl(int id, int xf86cmd, pointer buf);
|
---|
285 |
|
---|
286 | extern int xf86setjmp(xf86jmp_buf env);
|
---|
287 | extern int xf86setjmp0(xf86jmp_buf env);
|
---|
288 | extern int xf86setjmp1(xf86jmp_buf env, int);
|
---|
289 | extern int xf86setjmp1_arg2(void);
|
---|
290 | extern int xf86setjmperror(xf86jmp_buf env);
|
---|
291 | extern int xf86getjmptype(void);
|
---|
292 | extern void xf86longjmp(xf86jmp_buf env, int val);
|
---|
293 | #define xf86setjmp_macro(env) \
|
---|
294 | (xf86getjmptype() == 0 ? xf86setjmp0((env)) : \
|
---|
295 | (xf86getjmptype() == 1 ? xf86setjmp1((env), xf86setjmp1_arg2()) : \
|
---|
296 | xf86setjmperror((env))))
|
---|
297 |
|
---|
298 | /*
|
---|
299 | * These things are always required by drivers (but not by libc_wrapper.c),
|
---|
300 | * even for a static server because some OSs don't provide them.
|
---|
301 | */
|
---|
302 |
|
---|
303 | extern int xf86getpagesize(void);
|
---|
304 | extern void xf86usleep(unsigned long);
|
---|
305 | extern void xf86getsecs(long *, long *);
|
---|
306 | #ifndef DONT_DEFINE_WRAPPERS
|
---|
307 | #undef getpagesize
|
---|
308 | #define getpagesize() xf86getpagesize()
|
---|
309 | #undef usleep
|
---|
310 | #define usleep(ul) xf86usleep(ul)
|
---|
311 | #undef getsecs
|
---|
312 | #define getsecs(a, b) xf86getsecs(a, b)
|
---|
313 | #endif
|
---|
314 | #endif /* _XF86_ANSIC_H */
|
---|