2 -- This file is free software, which comes along with SmallEiffel. This
3 -- software is distributed in the hope that it will be useful, but WITHOUT
4 -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5 -- FITNESS FOR A PARTICULAR PURPOSE. You can modify it as you want, provided
6 -- this header is kept unaltered, and a notification of the changes is added.
7 -- You are allowed to redistribute it and sell it, alone or as a part of
9 -- Copyright (C) 1994-2002 LORIA - INRIA - U.H.P. Nancy 1 - FRANCE
10 -- Dominique COLNET and Suzanne COLLIN - SmallEiffel@loria.fr
11 -- http://SmallEiffel.loria.fr
15 This file (SmallEiffel/sys/runtime/base.h) contains all basic Eiffel
17 This file is automatically included in the header for all modes of
18 compilation: -boost, -no_check, -require_check, -ensure_check, ...
19 This file is also included in the header of any cecil file (when the
20 -cecil option is used).
21 This file is also included in the header file of C++ wrappers (when
22 using the external "C++" clause).
34 #include <sys/types.h>
48 /* Because ANSI C EXIT_* are not always defined: */
50 #define EXIT_FAILURE 1
53 #define EXIT_SUCCESS 0
57 On Linux glibc systems, we need to use sig.* versions of jmp_buf,
58 setjmp and longjmp to preserve the signal handling context.
59 Currently, the way I figured to detect this is if _SIGSET_H_types has
60 been defined in /usr/include/setjmp.h.
62 #ifdef _SIGSET_H_types
63 #define JMP_BUF sigjmp_buf
64 #define SETJMP(x) sigsetjmp( (x), 1)
65 #define LONGJMP siglongjmp
67 #define JMP_BUF jmp_buf
68 #define SETJMP(x) setjmp( (x) )
69 #define LONGJMP longjmp
73 Type to store reference objects Id:
80 The default channel used to print runtime error messages:
85 Eiffel type INTEGER is #2:
88 #define EIF_INTEGER T2
90 #define EIF_INTEGER_BITS (CHAR_BIT*sizeof(int))
91 #define EIF_MINIMUM_INTEGER (INT_MIN)
92 #define EIF_MAXIMUM_INTEGER (INT_MAX)
95 Eiffel type CHARACTER is #3:
97 typedef unsigned char T3
;
98 #define EIF_CHARACTER T3
100 #define EIF_CHARACTER_BITS (CHAR_BIT)
101 #define EIF_MINIMUM_CHARACTER_CODE (0)
102 #define EIF_MAXIMUM_CHARACTER_CODE (255)
103 #define T3code(x) ((T2)(x))
104 #define T3to_integer(x) ((T2)((char)(x)))
105 #define T3to_bit(x) (x)
108 Eiffel type REAL is #4:
113 #define EIF_REAL_BITS (CHAR_BIT*sizeof(float))
114 #define EIF_MINIMUM_REAL (-(FLT_MAX))
115 #define EIF_MAXIMUM_REAL (FLT_MAX)
116 #define T2toT4(x) ((T4)(x))
119 Eiffel type DOUBLE is #5:
122 #define EIF_DOUBLE T5
124 #define EIF_DOUBLE_BITS (CHAR_BIT*sizeof(double))
125 #define EIF_MINIMUM_DOUBLE (-(DBL_MAX))
126 #define EIF_MAXIMUM_DOUBLE (DBL_MAX)
127 #define T2toT5(x) ((T5)(x))
128 #define T4toT5(x) ((T5)(x))
131 Eiffel type BOOLEAN is #6:
134 #define EIF_BOOLEAN T6
136 #define EIF_BOOLEAN_BITS (CHAR_BIT)
139 Eiffel type POINTER is #8:
142 #define EIF_POINTER T8
144 #define EIF_POINTER_BITS (CHAR_BIT*sizeof(void*))
147 To use type STRING on the C side:
149 #define EIF_STRING T7*
152 Some Other EIF_* defined in ETL:
154 #define eif_access(x) ((char*)(x))
155 #define EIF_REFERENCE T0*
157 #define EIF_OBJECT EIF_OBJ
160 Wrappers for `malloc' and `calloc':
162 void* se_malloc(size_t size
);
163 void* se_calloc(size_t nmemb
, size_t size
);
164 extern void*eiffel_root_object
;
167 /* Available Eiffel routines via -cecil:
169 void* EVENTMAKER_make_quit(int C
);
170 void* EVENTMAKER_make_mbdown(int C
,T2 a1
,T2 a2
,T2 a3
,T2 a4
);
171 void* EVENTMAKER_make_keydown(int C
,T2 a1
,T2 a2
);