Commit | Line | Data |
---|---|---|
0f2d19dd JB |
1 | /* classes: h_files */ |
2 | ||
0527e687 DH |
3 | #ifndef SCM__SCM_H |
4 | #define SCM__SCM_H | |
5 | ||
86cfb42d | 6 | /* Copyright (C) 1995,1996,2000,2001, 2002, 2006, 2008, 2009 Free Software Foundation, Inc. |
0527e687 | 7 | * |
d3cf93bc | 8 | * This library is free software; you can redistribute it and/or |
53befeb7 NJ |
9 | * modify it under the terms of the GNU Lesser General Public License |
10 | * as published by the Free Software Foundation; either version 3 of | |
11 | * the License, or (at your option) any later version. | |
0527e687 | 12 | * |
53befeb7 NJ |
13 | * This library is distributed in the hope that it will be useful, but |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
d3cf93bc NJ |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. | |
0527e687 | 17 | * |
d3cf93bc NJ |
18 | * You should have received a copy of the GNU Lesser General Public |
19 | * License along with this library; if not, write to the Free Software | |
53befeb7 NJ |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
21 | * 02110-1301 USA | |
d3cf93bc | 22 | */ |
0527e687 | 23 | |
0f2d19dd JB |
24 | \f |
25 | ||
b49ed9c9 RB |
26 | /********************************************************************** |
27 | This file is Guile's central private header. | |
20e6290e | 28 | |
b49ed9c9 RB |
29 | When included by other files, this file should preceed any include |
30 | other than __scm.h. See __scm.h for details regarding the purpose of | |
31 | and differences between _scm.h and __scm.h. | |
32 | **********************************************************************/ | |
176067df | 33 | |
9a5fa6e9 NJ |
34 | #if defined(__ia64) && !defined(__ia64__) |
35 | # define __ia64__ | |
36 | #endif | |
176067df | 37 | |
b49ed9c9 RB |
38 | #if HAVE_CONFIG_H |
39 | # include <config.h> | |
40 | #endif | |
176067df | 41 | |
cbee5075 NJ |
42 | /* Undefine HAVE_STRUCT_TIMESPEC, because the libguile C code doesn't |
43 | need it anymore, and because on MinGW: | |
44 | ||
45 | - the definition of struct timespec is provided (if at all) by | |
46 | pthread.h | |
47 | ||
48 | - pthread.h will _not_ define struct timespec if | |
49 | HAVE_STRUCT_TIMESPEC is 1, because then it thinks that it doesn't | |
50 | need to. | |
51 | ||
52 | The libguile C code doesn't need HAVE_STRUCT_TIMESPEC anymore, | |
53 | because the value of HAVE_STRUCT_TIMESPEC has already been | |
54 | incorporated in how scm_t_timespec is defined (in scmconfig.h), and | |
55 | the rest of the libguile C code now just uses scm_t_timespec. | |
56 | */ | |
57 | #ifdef HAVE_STRUCT_TIMESPEC | |
58 | #undef HAVE_STRUCT_TIMESPEC | |
59 | #endif | |
60 | ||
b49ed9c9 | 61 | #include <errno.h> |
86cfb42d | 62 | #include <verify.h> |
b49ed9c9 | 63 | #include "libguile/__scm.h" |
462a6f1f | 64 | |
20e6290e JB |
65 | /* Include headers for those files central to the implementation. The |
66 | rest should be explicitly #included in the C files themselves. */ | |
a0599745 MD |
67 | #include "libguile/error.h" /* Everyone signals errors. */ |
68 | #include "libguile/print.h" /* Everyone needs to print. */ | |
69 | #include "libguile/pairs.h" /* Everyone conses. */ | |
70 | #include "libguile/list.h" /* Everyone makes lists. */ | |
71 | #include "libguile/gc.h" /* Everyone allocates. */ | |
72 | #include "libguile/gsubr.h" /* Everyone defines global functions. */ | |
73 | #include "libguile/procs.h" /* Same. */ | |
74 | #include "libguile/numbers.h" /* Everyone deals with fixnums. */ | |
75 | #include "libguile/symbols.h" /* For length, chars, values, miscellany. */ | |
76 | #include "libguile/boolean.h" /* Everyone wonders about the truth. */ | |
3d7f708f | 77 | #include "libguile/threads.h" /* You are not alone. */ |
a0599745 | 78 | #include "libguile/snarf.h" /* Everyone snarfs. */ |
86d31dfe MV |
79 | #include "libguile/variable.h" |
80 | #include "libguile/modules.h" | |
0f633e66 | 81 | #include "libguile/inline.h" |
c6054fea | 82 | #include "libguile/strings.h" |
0f2d19dd | 83 | |
e1a191a8 | 84 | #ifndef SCM_SYSCALL |
0f2d19dd JB |
85 | #ifdef vms |
86 | # ifndef __GNUC__ | |
87 | # include <ssdef.h> | |
88 | # define SCM_SYSCALL(line) do{errno = 0;line;} \ | |
89 | while(EVMSERR==errno && (vaxc$errno>>3)==(SS$_CONTROLC>>3)) | |
90 | # endif /* ndef __GNUC__ */ | |
91 | #endif /* def vms */ | |
e1a191a8 | 92 | #endif /* ndef SCM_SYSCALL */ |
0f2d19dd JB |
93 | |
94 | #ifndef SCM_SYSCALL | |
95 | # ifdef EINTR | |
96 | # if (EINTR > 0) | |
97 | # define SCM_SYSCALL(line) do{errno = 0;line;}while(EINTR==errno) | |
98 | # endif /* (EINTR > 0) */ | |
99 | # endif /* def EINTR */ | |
100 | #endif /* ndef SCM_SYSCALL */ | |
101 | ||
102 | #ifndef SCM_SYSCALL | |
e1a191a8 | 103 | # define SCM_SYSCALL(line) line; |
0f2d19dd JB |
104 | #endif /* ndef SCM_SYSCALL */ |
105 | ||
0f2d19dd JB |
106 | \f |
107 | ||
e412e180 | 108 | #ifndef min |
34d19ef6 | 109 | #define min(A, B) ((A) <= (B) ? (A) : (B)) |
e412e180 MD |
110 | #endif |
111 | #ifndef max | |
34d19ef6 | 112 | #define max(A, B) ((A) >= (B) ? (A) : (B)) |
e412e180 | 113 | #endif |
462a6f1f | 114 | |
2b829bbb KR |
115 | |
116 | ||
d05bcb2e | 117 | #if GUILE_USE_64_CALLS && HAVE_STAT64 |
2b829bbb KR |
118 | #define CHOOSE_LARGEFILE(foo,foo64) foo64 |
119 | #else | |
120 | #define CHOOSE_LARGEFILE(foo,foo64) foo | |
121 | #endif | |
122 | ||
123 | /* These names are a bit long, but they make it clear what they represent. */ | |
450be18d LC |
124 | #if SCM_HAVE_STRUCT_DIRENT64 == 1 |
125 | # define dirent_or_dirent64 CHOOSE_LARGEFILE(dirent,dirent64) | |
126 | #else | |
127 | # define dirent_or_dirent64 dirent | |
128 | #endif | |
2b829bbb KR |
129 | #define fstat_or_fstat64 CHOOSE_LARGEFILE(fstat,fstat64) |
130 | #define ftruncate_or_ftruncate64 CHOOSE_LARGEFILE(ftruncate,ftruncate64) | |
22acb298 | 131 | #define lseek_or_lseek64 CHOOSE_LARGEFILE(lseek,lseek64) |
2b829bbb KR |
132 | #define lstat_or_lstat64 CHOOSE_LARGEFILE(lstat,lstat64) |
133 | #define off_t_or_off64_t CHOOSE_LARGEFILE(off_t,off64_t) | |
134 | #define open_or_open64 CHOOSE_LARGEFILE(open,open64) | |
135 | #define readdir_or_readdir64 CHOOSE_LARGEFILE(readdir,readdir64) | |
450be18d LC |
136 | #if SCM_HAVE_READDIR64_R == 1 |
137 | # define readdir_r_or_readdir64_r CHOOSE_LARGEFILE(readdir_r,readdir64_r) | |
138 | #else | |
139 | # define readdir_r_or_readdir64_r readdir_r | |
140 | #endif | |
2b829bbb KR |
141 | #define stat_or_stat64 CHOOSE_LARGEFILE(stat,stat64) |
142 | #define truncate_or_truncate64 CHOOSE_LARGEFILE(truncate,truncate64) | |
143 | #define scm_from_off_t_or_off64_t CHOOSE_LARGEFILE(scm_from_off_t,scm_from_int64) | |
144 | #define scm_from_ino_t_or_ino64_t CHOOSE_LARGEFILE(scm_from_ulong,scm_from_uint64) | |
145 | #define scm_from_blkcnt_t_or_blkcnt64_t CHOOSE_LARGEFILE(scm_from_ulong,scm_from_uint64) | |
146 | #define scm_to_off_t_or_off64_t CHOOSE_LARGEFILE(scm_to_off_t,scm_to_int64) | |
147 | ||
148 | #if SIZEOF_OFF_T == 4 | |
22acb298 KR |
149 | # define scm_to_off_t scm_to_int32 |
150 | # define scm_from_off_t scm_from_int32 | |
151 | #elif SIZEOF_OFF_T == 8 | |
152 | # define scm_to_off_t scm_to_int64 | |
153 | # define scm_from_off_t scm_from_int64 | |
154 | #else | |
155 | # error sizeof(off_t) is not 4 or 8. | |
2b829bbb | 156 | #endif |
8ab3d8a0 KR |
157 | #define scm_to_off64_t scm_to_int64 |
158 | #define scm_from_off64_t scm_from_int64 | |
2b829bbb KR |
159 | |
160 | ||
86cfb42d AW |
161 | /* The endianness marker in objcode. */ |
162 | #ifdef WORDS_BIGENDIAN | |
163 | # define SCM_OBJCODE_ENDIANNESS "BE" | |
164 | #else | |
165 | # define SCM_OBJCODE_ENDIANNESS "LE" | |
166 | #endif | |
167 | ||
168 | #define _SCM_CPP_STRINGIFY(x) # x | |
169 | #define SCM_CPP_STRINGIFY(x) _SCM_CPP_STRINGIFY (x) | |
170 | ||
171 | /* The word size marker in objcode. */ | |
172 | #define SCM_OBJCODE_WORD_SIZE SCM_CPP_STRINGIFY (SIZEOF_VOID_P) | |
173 | ||
aaae0d5a | 174 | /* Major and minor versions must be single characters. */ |
6e5c02b8 | 175 | #define SCM_OBJCODE_MAJOR_VERSION 0 |
df435c83 | 176 | #define SCM_OBJCODE_MINOR_VERSION L |
6e5c02b8 AW |
177 | #define SCM_OBJCODE_MAJOR_VERSION_STRING \ |
178 | SCM_CPP_STRINGIFY(SCM_OBJCODE_MAJOR_VERSION) | |
179 | #define SCM_OBJCODE_MINOR_VERSION_STRING \ | |
180 | SCM_CPP_STRINGIFY(SCM_OBJCODE_MINOR_VERSION) | |
181 | #define SCM_OBJCODE_VERSION_STRING \ | |
182 | SCM_OBJCODE_MAJOR_VERSION_STRING "." SCM_OBJCODE_MINOR_VERSION_STRING | |
183 | #define SCM_OBJCODE_MACHINE_VERSION_STRING \ | |
184 | SCM_OBJCODE_VERSION_STRING "-" SCM_OBJCODE_ENDIANNESS "-" SCM_OBJCODE_WORD_SIZE | |
185 | ||
86cfb42d | 186 | /* The objcode magic header. */ |
6e5c02b8 AW |
187 | #define SCM_OBJCODE_COOKIE \ |
188 | "GOOF-" SCM_OBJCODE_MACHINE_VERSION_STRING "---" | |
86cfb42d AW |
189 | |
190 | ||
0527e687 | 191 | #endif /* SCM__SCM_H */ |
89e00824 ML |
192 | |
193 | /* | |
194 | Local Variables: | |
195 | c-file-style: "gnu" | |
196 | End: | |
197 | */ |