1 /*  Part of XPCE --- The SWI-Prolog GUI toolkit
2 
3     Author:        Jan Wielemaker and Anjo Anjewierden
4     E-mail:        jan@swi.psy.uva.nl
5     WWW:           http://www.swi.psy.uva.nl/projects/xpce/
6     Copyright (c)  1985-2002, University of Amsterdam
7     All rights reserved.
8 
9     Redistribution and use in source and binary forms, with or without
10     modification, are permitted provided that the following conditions
11     are met:
12 
13     1. Redistributions of source code must retain the above copyright
14        notice, this list of conditions and the following disclaimer.
15 
16     2. Redistributions in binary form must reproduce the above copyright
17        notice, this list of conditions and the following disclaimer in
18        the documentation and/or other materials provided with the
19        distribution.
20 
21     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25     COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32     POSSIBILITY OF SUCH DAMAGE.
33 */
34 
35 #ifndef XOS_INCLUDED
36 #define XOS_INCLUDED
37 
38 #ifndef __XOS__
39 #define __XOS__ 1
40 #endif
41 
42 #include <direct.h>
43 
44 #ifndef __XOS_KERNEL__
45 #define malloc(size)		_xos_malloc(size)
46 #define realloc(buf, size)	_xos_realloc(buf, size)
47 #define chdir(path)		_xos_chdir(path)
48 #define open			_xos_open
49 #define fopen(path, mode)	_xos_fopen(path, mode)
50 #define opendir(path)		_xos_opendir(path)
51 #define readdir(dp)		_xos_readdir(dp)
52 #define stat(path, buf)		_xos_stat(path, buf)
53 #define access(path, mode)	_xos_access(path, mode)
54 #define getcwd(buf, size)	_xos_getcwd(buf, size)
55 #define unlink(path)		_xos_unlink(path)
56 #define remove(path)		_xos_remove(path)
57 #define rename(old, new)	_xos_rename(old, new)
58 #define chmod(path, mode)	_xos_chmod(path, mode)
59 #define mkdir(path)		_xos_mkdir(path)
60 #define rmdir(path)		_xos_rmdir(path)
61 #endif
62 
63 void *		_xos_malloc(size_t bytes);
64 void *		_xos_realloc(void *mem, size_t bytes);
65 int		_xos_chdir(const char *path);
66 int		_xos_open(const char *path, int access, ...);
67 FILE *		_xos_fopen(const char *path, const char *mode);
68 DIR *		_xos_opendir(const char *path);
69 struct dirent *	_xos_readdir(DIR *dp);
70 int		_xos_access(const char *path, int mode);
71 int		_xos_stat(const char *path, struct stat *buf);
72 char *		_xos_getcwd(char *buffer, size_t bytes);
73 int		_xos_unlink(const char *path);
74 int		_xos_remove(const char *path);
75 int		_xos_rename(const char *old, const char *new);
76 int		_xos_chmod(const char *path, int mode);
77 int		_xos_mkdir(const char *path);
78 int		_xos_rmdir(const char *path);
79 
80 char *		_xos_canonical_filename(const char *in, char *out);
81 char *		_xos_os_filename(const char *in, char *out);
82 char *		_xos_limited_os_filename(const char *in, char *out);
83 
84 #endif /*XOS_INCLUDED*/
85