YAP
7.1.0
sysbits.h
1
// @{
2
7
/*
8
* In this routine we shall try to include the inevitably machine dependant
9
* routines. These include, for the moment : Time, A rudimentary form of
10
* signal handling, OS calls,
11
*
12
* Vitor Santos Costa, February 1987
13
*
14
*/
15
16
#include "YapConfig.h"
17
#include "YapIOConfig.h"
18
19
#if _WIN32 || defined(__MINGW32__)
20
#if !defined(MINGW_HAS_SECURE_API)
21
#define MINGW_HAS_SECURE_API 1
22
#endif
23
//#undef _POSIX_
24
#endif
25
#include "
Yap.h
"
26
#include "
YapEval.h
"
27
#include "YapHeap.h"
28
#include "YapText.h"
29
#include "Yatom.h"
30
#include "yapio.h"
31
32
// Win32 InputOutput Support
33
#if _WIN32 || defined(__MINGW32__)
34
#include <winsock2.h>
35
/* Windows */
36
#include "shlwapi.h"
37
#include <direct.h>
38
#include <io.h>
39
#include <windows.h>
40
#ifndef S_ISDIR
41
#define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
42
#endif
43
#endif
44
#ifndef BUF_SIZE
45
#ifdef MAX_PATH
46
#define BUF_SIZE MAX_PATH
47
#endif
48
#endif
49
50
#ifdef HAVE_UNISTD_H
51
#include <unistd.h>
52
#endif
53
#if HAVE_STDARG_H
54
#include <stdarg.h>
55
#endif
56
#include <stdlib.h>
57
58
#if HAVE_SYS_PARAM_Hb
59
#include <sys/param.h>
60
#endif
61
62
#if HAVE_STDARG_H
63
#include <stdarg.h>
64
#endif
65
#if HAVE_CTYPE_H
66
#include <ctype.h>
67
#endif
68
#if HAVE_SYS_PARAMS_H
69
#include <sys/params.h>
70
#endif
71
#if HAVE_SYS_TYPES_H
72
#include <sys/types.h>
73
#endif
74
#ifdef HAVE_SYS_STAT_H
75
#include <sys/stat.h>
76
#endif
77
#if HAVE_SYS_SELECT_H && !_MSC_VER && !defined(__MINGW32__)
78
#include <sys/select.h>
79
#endif
80
#if HAVE_STRING_H
81
#include <string.h>
82
#endif
83
#if HAVE_LIBGEN_H
84
#include <libgen.h>
85
#endif
86
#if HAVE_WCTYPE_H
87
#include <wctype.h>
88
#endif
89
#if HAVE_LIMITS_H
90
#include <limits.h>
91
#endif
92
#if HAVE_ERRNO_H
93
#include <errno.h>
94
#endif
95
#if HAVE_FCNTL_H
96
#include <fcntl.h>
97
#endif
98
#if !HAVE_STRNCAT
99
#define strncat(X, Y, Z) strcat(X, Y)
100
#endif
101
#if !HAVE_STRNCPY
102
#define strncpy(X, Y, Z) strcpy(X, Y)
103
#endif
104
#include "iopreds.h"
105
106
#if HAVE_SIGNAL_H
107
#include <signal.h>
108
#endif
109
#ifdef HAVE_ERRNO_H
110
#include <errno.h>
111
#endif
112
/* CYGWIN seems to include this automatically */
113
#if HAVE_FENV_H
// && !defined(__CYGWIN__)
114
#include <fenv.h>
115
#endif
116
117
#ifdef MPW
118
#define signal sigset
119
#endif
120
121
/* windows.h does not like absmi.h, this
122
should fix it for now */
123
#include <math.h>
124
#if HAVE_TIME_H
125
#include <time.h>
126
#endif
127
#if HAVE_SYS_TIME_H && !_MSC_VER
128
#include <sys/time.h>
129
#endif
130
#if HAVE_UNISTD_H
131
#include <unistd.h>
132
#endif
133
#if HAVE_SYS_RESOURCE_H
134
#include <sys/resource.h>
135
#endif
136
#if HAVE_SYS_TIME_H
137
#include <sys/time.h>
138
#endif
139
#if HAVE_SYS_WAIT_H && !defined(__MINGW32__) && !_MSC_VER
140
#include <sys/wait.h>
141
#endif
142
#if HAVE_STRING_H
143
#include <string.h>
144
#endif
145
#if HAVE_GETPWNAM
146
#include <pwd.h>
147
#endif
148
#include <ctype.h>
149
#if HAVE_SYS_STAT_H
150
#include <sys/stat.h>
151
#endif
152
#if HAVE_SYS_TYPES_H
153
#include <sys/types.h>
154
#endif
155
#if HAVE_FCNTL_H
156
#include <fcntl.h>
157
#endif
158
#if HAVE_WORDEXP_H
159
#include <wordexp.h>
160
#endif
161
#if HAVE_GLOB_H
162
#include <glob.h>
163
#endif
164
#if HAVE_LIBGEN_H
165
#include <libgen.h>
166
#endif
167
#if defined(HAVE_READLINE_READLINE_H)
168
#include <readline/readline.h>
169
#endif
170
171
#if _MSC_VER || defined(__MINGW32__)
172
#define SYSTEM_STAT _stat
173
#else
174
#define SYSTEM_STAT stat
175
#endif
176
177
extern
void
Yap_InitRandom(
void
);
178
extern
void
Yap_InitTime(
int
wid);
179
extern
void
Yap_InitOSSignals(
int
wid);
180
extern
void
Yap_InitWTime(
void
);
181
182
static
inline
char
*OsPath(
const
char
*p,
char
*buf) {
return
(
char
*)p; }
183
184
static
inline
char
*PrologPath(
const
char
*Y,
char
*X) {
return
(
char
*)Y; }
185
186
188
static
inline
void
FileError(yap_error_number type, Term where,
const
char
*format,
189
...) {
190
191
if
(FileErrors() ) {
192
va_list ap;
193
194
va_start(ap, format);
195
/* now build the error string */
196
Yap_Error(type, TermNil, format, ap);
197
va_end(ap);
198
}
199
}
200
201
202
#define isValidEnvChar(C) \
203
(((C) >= 'a' && (C) <= 'z') || ((C) >= 'A' && (C) <= 'Z') || (C) == '_')
204
YapEval.h
Yap.h
Main definitions.
os
sysbits.h
Generated by
1.9.3