Commit | Line | Data |
---|---|---|
0f2d19dd JB |
1 | /* classes: h_files */ |
2 | ||
0527e687 DH |
3 | #ifndef SCM__SCM_H |
4 | #define SCM__SCM_H | |
5 | ||
2b829bbb | 6 | /* Copyright (C) 1995,1996,2000,2001, 2002, 2006 Free Software Foundation, Inc. |
0527e687 | 7 | * |
0f2d19dd JB |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2, or (at your option) | |
11 | * any later version. | |
0527e687 | 12 | * |
0f2d19dd JB |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
0527e687 | 17 | * |
0f2d19dd JB |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this software; see the file COPYING. If not, write to | |
92205699 MV |
20 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 | * Boston, MA 02110-1301 USA | |
0f2d19dd JB |
22 | * |
23 | * As a special exception, the Free Software Foundation gives permission | |
24 | * for additional uses of the text contained in its release of GUILE. | |
25 | * | |
26 | * The exception is that, if you link the GUILE library with other files | |
27 | * to produce an executable, this does not by itself cause the | |
28 | * resulting executable to be covered by the GNU General Public License. | |
29 | * Your use of that executable is in no way restricted on account of | |
30 | * linking the GUILE library code into it. | |
31 | * | |
32 | * This exception does not however invalidate any other reasons why | |
33 | * the executable file might be covered by the GNU General Public License. | |
34 | * | |
35 | * This exception applies only to the code released by the | |
36 | * Free Software Foundation under the name GUILE. If you copy | |
37 | * code from other Free Software Foundation releases into a copy of | |
38 | * GUILE, as the General Public License permits, the exception does | |
39 | * not apply to the code that you add in this way. To avoid misleading | |
40 | * anyone as to the status of such modified files, you must delete | |
41 | * this exception notice from them. | |
42 | * | |
43 | * If you write modifications of your own for GUILE, it is your choice | |
44 | * whether to permit this exception to apply to your modifications. | |
82892bed | 45 | * If you do not wish that, delete this exception notice. */ |
0527e687 | 46 | |
0f2d19dd JB |
47 | \f |
48 | ||
b49ed9c9 RB |
49 | /********************************************************************** |
50 | This file is Guile's central private header. | |
20e6290e | 51 | |
b49ed9c9 RB |
52 | When included by other files, this file should preceed any include |
53 | other than __scm.h. See __scm.h for details regarding the purpose of | |
54 | and differences between _scm.h and __scm.h. | |
55 | **********************************************************************/ | |
176067df | 56 | |
9a5fa6e9 NJ |
57 | #if defined(__ia64) && !defined(__ia64__) |
58 | # define __ia64__ | |
59 | #endif | |
176067df | 60 | |
b49ed9c9 RB |
61 | #if HAVE_CONFIG_H |
62 | # include <config.h> | |
63 | #endif | |
176067df | 64 | |
b49ed9c9 RB |
65 | #include <errno.h> |
66 | #include "libguile/__scm.h" | |
462a6f1f | 67 | |
20e6290e JB |
68 | /* Include headers for those files central to the implementation. The |
69 | rest should be explicitly #included in the C files themselves. */ | |
a0599745 MD |
70 | #include "libguile/error.h" /* Everyone signals errors. */ |
71 | #include "libguile/print.h" /* Everyone needs to print. */ | |
72 | #include "libguile/pairs.h" /* Everyone conses. */ | |
73 | #include "libguile/list.h" /* Everyone makes lists. */ | |
74 | #include "libguile/gc.h" /* Everyone allocates. */ | |
75 | #include "libguile/gsubr.h" /* Everyone defines global functions. */ | |
76 | #include "libguile/procs.h" /* Same. */ | |
77 | #include "libguile/numbers.h" /* Everyone deals with fixnums. */ | |
78 | #include "libguile/symbols.h" /* For length, chars, values, miscellany. */ | |
79 | #include "libguile/boolean.h" /* Everyone wonders about the truth. */ | |
3d7f708f | 80 | #include "libguile/threads.h" /* You are not alone. */ |
a0599745 | 81 | #include "libguile/snarf.h" /* Everyone snarfs. */ |
86d31dfe MV |
82 | #include "libguile/variable.h" |
83 | #include "libguile/modules.h" | |
0f633e66 | 84 | #include "libguile/inline.h" |
0f2d19dd | 85 | |
e1a191a8 GH |
86 | /* SCM_SYSCALL retries system calls that have been interrupted (EINTR). |
87 | However this can be avoided if the operating system can restart | |
88 | system calls automatically. We assume this is the case if | |
89 | sigaction is available and SA_RESTART is defined; they will be used | |
90 | when installing signal handlers. | |
91 | */ | |
92 | ||
08b8c694 | 93 | #ifdef HAVE_RESTARTABLE_SYSCALLS |
17403ebc RB |
94 | #if ! SCM_USE_PTHREAD_THREADS /* However, don't assume SA_RESTART |
95 | works with pthreads... */ | |
e1a191a8 GH |
96 | #define SCM_SYSCALL(line) line |
97 | #endif | |
845944c3 | 98 | #endif |
e1a191a8 GH |
99 | |
100 | #ifndef SCM_SYSCALL | |
0f2d19dd JB |
101 | #ifdef vms |
102 | # ifndef __GNUC__ | |
103 | # include <ssdef.h> | |
104 | # define SCM_SYSCALL(line) do{errno = 0;line;} \ | |
105 | while(EVMSERR==errno && (vaxc$errno>>3)==(SS$_CONTROLC>>3)) | |
106 | # endif /* ndef __GNUC__ */ | |
107 | #endif /* def vms */ | |
e1a191a8 | 108 | #endif /* ndef SCM_SYSCALL */ |
0f2d19dd JB |
109 | |
110 | #ifndef SCM_SYSCALL | |
111 | # ifdef EINTR | |
112 | # if (EINTR > 0) | |
113 | # define SCM_SYSCALL(line) do{errno = 0;line;}while(EINTR==errno) | |
114 | # endif /* (EINTR > 0) */ | |
115 | # endif /* def EINTR */ | |
116 | #endif /* ndef SCM_SYSCALL */ | |
117 | ||
118 | #ifndef SCM_SYSCALL | |
e1a191a8 | 119 | # define SCM_SYSCALL(line) line; |
0f2d19dd JB |
120 | #endif /* ndef SCM_SYSCALL */ |
121 | ||
82893676 | 122 | #if !defined (MSDOS) && !defined (__MINGW32__) |
0f2d19dd JB |
123 | # ifdef ARM_ULIB |
124 | extern volatile int errno; | |
125 | # else | |
126 | extern int errno; | |
127 | # endif /* def ARM_ULIB */ | |
82893676 | 128 | #endif /* ndef MSDOS && ndef __MINGW32__*/ |
0f2d19dd JB |
129 | |
130 | \f | |
131 | ||
e412e180 | 132 | #ifndef min |
34d19ef6 | 133 | #define min(A, B) ((A) <= (B) ? (A) : (B)) |
e412e180 MD |
134 | #endif |
135 | #ifndef max | |
34d19ef6 | 136 | #define max(A, B) ((A) >= (B) ? (A) : (B)) |
e412e180 | 137 | #endif |
462a6f1f | 138 | |
2b829bbb KR |
139 | |
140 | ||
141 | #if HAVE_STAT64 | |
142 | #define CHOOSE_LARGEFILE(foo,foo64) foo64 | |
143 | #else | |
144 | #define CHOOSE_LARGEFILE(foo,foo64) foo | |
145 | #endif | |
146 | ||
147 | /* These names are a bit long, but they make it clear what they represent. */ | |
148 | #define dirent_or_dirent64 CHOOSE_LARGEFILE(dirent,dirent64) | |
149 | #define fstat_or_fstat64 CHOOSE_LARGEFILE(fstat,fstat64) | |
150 | #define ftruncate_or_ftruncate64 CHOOSE_LARGEFILE(ftruncate,ftruncate64) | |
22acb298 | 151 | #define lseek_or_lseek64 CHOOSE_LARGEFILE(lseek,lseek64) |
2b829bbb KR |
152 | #define lstat_or_lstat64 CHOOSE_LARGEFILE(lstat,lstat64) |
153 | #define off_t_or_off64_t CHOOSE_LARGEFILE(off_t,off64_t) | |
154 | #define open_or_open64 CHOOSE_LARGEFILE(open,open64) | |
155 | #define readdir_or_readdir64 CHOOSE_LARGEFILE(readdir,readdir64) | |
156 | #define readdir_r_or_readdir64_r CHOOSE_LARGEFILE(readdir_r,readdir64_r) | |
157 | #define stat_or_stat64 CHOOSE_LARGEFILE(stat,stat64) | |
158 | #define truncate_or_truncate64 CHOOSE_LARGEFILE(truncate,truncate64) | |
159 | #define scm_from_off_t_or_off64_t CHOOSE_LARGEFILE(scm_from_off_t,scm_from_int64) | |
160 | #define scm_from_ino_t_or_ino64_t CHOOSE_LARGEFILE(scm_from_ulong,scm_from_uint64) | |
161 | #define scm_from_blkcnt_t_or_blkcnt64_t CHOOSE_LARGEFILE(scm_from_ulong,scm_from_uint64) | |
162 | #define scm_to_off_t_or_off64_t CHOOSE_LARGEFILE(scm_to_off_t,scm_to_int64) | |
163 | ||
164 | #if SIZEOF_OFF_T == 4 | |
22acb298 KR |
165 | # define scm_to_off_t scm_to_int32 |
166 | # define scm_from_off_t scm_from_int32 | |
167 | #elif SIZEOF_OFF_T == 8 | |
168 | # define scm_to_off_t scm_to_int64 | |
169 | # define scm_from_off_t scm_from_int64 | |
170 | #else | |
171 | # error sizeof(off_t) is not 4 or 8. | |
2b829bbb | 172 | #endif |
8ab3d8a0 KR |
173 | #define scm_to_off64_t scm_to_int64 |
174 | #define scm_from_off64_t scm_from_int64 | |
2b829bbb KR |
175 | |
176 | ||
0527e687 | 177 | #endif /* SCM__SCM_H */ |
89e00824 ML |
178 | |
179 | /* | |
180 | Local Variables: | |
181 | c-file-style: "gnu" | |
182 | End: | |
183 | */ |