/resources/smarteiffel-germ/compile_to_c.h
http://github.com/tybor/Liberty · C Header · 19784 lines · 19203 code · 99 blank · 482 comment · 113 complexity · dfed47b14d35501b06183c52b4ae3d17 MD5 · raw file
Large files are truncated click here to view the full file
- #ifdef __cplusplus
- extern "C" {
- #endif
- /*
- ANSI C code generated by
- Liberty Eiffel The GNU Eiffel Compiler, Eiffel tools and libraries
- release 2016.05 (Alexander Graham Bell)
- Copyright (C), 2011-2016 - C.ADRIAN, P.REDAELLI, R.MACK
- http://www.liberty-eiffel.org
- Original SmartEiffel code:
- Copyright (C), 1994-2002 - INRIA - LORIA - ESIAL UHP Nancy 1 - FRANCE
- Copyright (C), 2003-2005 - INRIA - LORIA - IUT Charlemagne Nancy 2 - FRANCE
- D.COLNET, P.RIBET, C.ADRIAN, V.CROIZIER, F.MERIZEN
- http://smarteiffel.loria.fr
- C Compiler options used: -pipe -O2
- */
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- /*
- This file (Liberty/sys/runtime/base.h) contains all basic Eiffel
- type definitions.
- This file is automatically included in the header for all modes of
- compilation: -boost, -no_check, -require_check, -ensure_check, ...
- This file is also included in the header of any cecil file (when the
- -cecil option is used).
- This file is also included in the header file of C++ wrappers (when
- using the external "C++" clause).
- */
- #ifndef _BASE_H
- #define _BASE_H
- #if defined(_MSC_VER) && (_MSC_VER >= 1400) /* VC8+ */
- # ifndef _CRT_SECURE_NO_DEPRECATE
- # define _CRT_SECURE_NO_DEPRECATE
- # endif
- # ifndef _CRT_NONSTDC_NO_DEPRECATE
- # define _CRT_NONSTDC_NO_DEPRECATE
- # endif
- #endif /* VC8+ */
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <stdlib.h>
- #include <signal.h>
- #include <stddef.h>
- #include <stdarg.h>
- #include <limits.h>
- #include <float.h>
- #include <setjmp.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #if defined __USE_POSIX || defined __unix__ || defined _POSIX_C_SOURCE
- # include <unistd.h>
- #endif
- #if !defined(WIN32) && \
- (defined(WINVER) || defined(_WIN32_WINNT) || defined(_WIN32) || \
- defined(__WIN32__) || defined(__TOS_WIN__) || defined(_MSC_VER))
- # define WIN32 1
- #endif
- #ifdef WIN32
- # include <windows.h>
- #endif
- #ifdef SE_THREAD
- #ifdef WIN32
- # define TLS(type) __declspec(thread) type
- #else
- # ifndef O_RDONLY
- # include <sys/file.h>
- # endif
- # ifndef O_RDONLY
- # define O_RDONLY 0000
- # endif
- # define TLS(type) __thread type
- #endif
- #else
- #define TLS(type) type
- #endif
- #if defined(_MSC_VER) && (_MSC_VER < 1600) /* MSVC older than v10 */
- typedef signed char int8_t;
- typedef signed short int16_t;
- typedef signed int int32_t;
- typedef signed __int64 int64_t;
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned int uint32_t;
- typedef unsigned __int64 uint64_t;
- # define PRId8 "d"
- # define PRId16 "d"
- # define PRId32 "d"
- # define PRId64 "I64d"
- # define INT8_C(c) c
- # define INT16_C(c) c
- # define INT32_C(c) c
- # define INT64_C(c) c ## i64
- # define UINT8_C(c) c ## u
- # define UINT16_C(c) c ## u
- # define UINT32_C(c) c ## u
- # define UINT64_C(c) c ## ui64
- #elif defined(__WATCOMC__) && (__WATCOMC__ <= 1220) /* WATCOM 12.2 or lower */
- typedef signed char int8_t;
- typedef signed short int16_t;
- typedef signed long int int32_t;
- typedef signed __int64 int64_t;
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned long int uint32_t;
- typedef unsigned __int64 uint64_t;
- # define PRId8 "d"
- # define PRId16 "d"
- # define PRId32 "d"
- # define PRId64 "Ld"
- # define INT8_C(c) c
- # define INT16_C(c) c
- # define INT32_C(c) c ## L
- # define INT64_C(c) c ## i64
- # define UINT8_C(c) c ## u
- # define UINT16_C(c) c ## u
- # define UINT32_C(c) c ## UL
- # define UINT64_C(c) c ## ui64
- #elif defined(__BORLANDC__) && (__BORLANDC__ < 0x600) /* Borland before 6.0 */
- typedef signed char int8_t;
- typedef signed short int16_t;
- typedef signed long int int32_t;
- typedef signed __int64 int64_t;
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned long int uint32_t;
- typedef unsigned __int64 uint64_t;
- # define PRId8 "d"
- # define PRId16 "d"
- # define PRId32 "ld"
- # define PRId64 "I64Ld"
- # define INT8_C(c) c
- # define INT16_C(c) c
- # define INT32_C(c) c ## L
- # define INT64_C(c) c ## i64
- # define UINT8_C(c) c ## u
- # define UINT16_C(c) c ## u
- # define UINT32_C(c) c ## UL
- # define UINT64_C(c) c ## ui64
- #elif defined(__FreeBSD__) && (__FreeBSD__ < 5) /* FreeBSD before 5.0 */ && !defined (_SYS_INTTYPES_H_)
- typedef signed char int8_t;
- typedef signed short int16_t;
- typedef signed long int int32_t;
- typedef signed long long int int64_t;
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned long int uint32_t;
- typedef unsigned long long int uint64_t;
- #elif defined(__CYGWIN__) && defined(__BIT_TYPES_DEFINED__) /* Cygwin defines intxx_t in sys/types.h instead of inttypes.h */
- # include <cygwin/version.h>
- # if defined(CYGWIN_VERSION_DLL_MAJOR) && (CYGWIN_VERSION_DLL_MAJOR<1005)
- typedef unsigned char uint8_t;
- typedef __uint16_t uint16_t;
- typedef __uint32_t uint32_t;
- typedef __uint64_t uint64_t;
- # endif
- #elif defined(SASC)
- # error("Too old SAS/C compiler, sorry.");
- #elif defined(__SASC__)
- # if (__SASC__ < 750 ) /* SAS/C before 7.50 */
- typedef signed char int8_t;
- typedef signed short int16_t;
- typedef signed long int int32_t;
- typedef signed long long int int64_t;
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned long int uint32_t;
- typedef unsigned long long int uint64_t;
- # endif
- #else
- # include <inttypes.h>
- # if !defined(INT8_MAX) && defined(INT16_MAX)
- /* int8_t is not mandatory */
- typedef int_least8_t int8_t;
- # endif
- #endif
- #if !defined(PRId16)
- # define PRId8 "d"
- # define PRId16 "d"
- # define PRId32 "ld"
- # define PRId64 "lld"
- #elif !defined(PRId8)
- # define PRId8 "d"
- #endif
- #if !defined(INT16_C)
- # define INT8_C(c) c
- # define INT16_C(c) c
- # define INT32_C(c) c ## L
- # define INT64_C(c) c ## LL
- # define UINT8_C(c) c ## u
- # define UINT16_C(c) c ## u
- # define UINT32_C(c) c ## UL
- # define UINT64_C(c) c ## ULL
- #elif !defined(INT8_C)
- # define INT8_C(c) c
- # define UINT8_C(c) c ## u
- #endif
- #if !defined(INT16_MIN)
- # define INT8_MIN (-INT8_C(127)-1)
- # define INT8_MAX (INT8_C(127))
- # define INT16_MIN (-INT16_C(32767)-1)
- # define INT16_MAX (INT16_C(32767))
- # define INT32_MIN (-INT32_C(2147483647)-1)
- # define INT32_MAX (INT32_C(2147483647))
- # define INT64_MIN (-INT64_C(9223372036854775807)-1)
- # define INT64_MAX (INT64_C(9223372036854775807))
- #elif !defined(INT8_MIN)
- # define INT8_MIN (-INT8_C(127)-1)
- #endif
- /*
- C compiler specific declaration for non-returning functions. Use
- NO_RETURN void foo(int bar);
- to declare a function prototype for function that doesn't return.
- */
- #if defined __GNUC__
- # define NO_RETURN __attribute__ ((noreturn))
- #elif defined __POCC__ || defined __BORLANDC__ || defined _MSC_VER
- # define NO_RETURN __declspec(noreturn)
- #else
- # define NO_RETURN
- /* maybe some warning occur unless NO_RETURN is defined for your compiler */
- #endif
- /*
- Endian stuff
- */
- #if defined(BSD) && (BSD >= 199103)
- # include <machine/endian.h>
- #elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA)
- /* bi-endian processor, current mode should be find in machine/endian.h file */
- # include <machine/endian.h>
- #elif defined(linux)
- # include <endian.h>
- #endif
- #if !defined(BYTE_ORDER) && defined(__BYTE_ORDER)
- # define BYTE_ORDER __BYTE_ORDER
- #endif
- #if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN)
- # define LITTLE_ENDIAN __LITTLE_ENDIAN
- #endif
- #if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN)
- # define BIG_ENDIAN __BIG_ENDIAN
- #endif
- #if !defined(LITTLE_ENDIAN)
- # define LITTLE_ENDIAN 1234 /* LSB first (vax, pc) */
- #endif
- #if !defined(BIG_ENDIAN)
- # define BIG_ENDIAN 4321 /* MSB first (IBM, net) */
- #endif
- #if !defined(PDP_ENDIAN)
- # define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
- #endif
- #if !defined(BYTE_ORDER) && defined(BIT_ZERO_ON_RIGHT)
- # define BYTE_ORDER LITTLE_ENDIAN
- #elif !defined(BYTE_ORDER) && defined(BIT_ZERO_ON_LEFT)
- # define BYTE_ORDER BIG_ENDIAN
- #elif !defined(BYTE_ORDER)
- /* ARM */
- # if defined(__ARMEL__)
- # define BYTE_ORDER LITTLE_ENDIAN
- # elif defined(__ARMEB__)
- # define BYTE_ORDER BIG_ENDIAN
- # elif defined(__arm__)
- # error "ARMs are bi-endian processors. Endianness is unknown for this system, please drop an e-mail to liberty-eiffel@gnu.org"
- # endif
- /* HP RISC */
- # if defined(__hppa__) || defined(__hppa) || defined(__hp9000) || \
- defined(__hp9000s300) || defined(hp9000s300) || \
- defined(__hp9000s700) || defined(hp9000s700) || \
- defined(__hp9000s800) || defined(hp9000s800) || defined(hp9000s820)
- # define BYTE_ORDER BIG_ENDIAN
- # endif
- /* IBM */
- # if defined(ibm032) || defined(ibm370) || defined(_IBMR2) || \
- defined(IBM370) || defined(__MVS__)
- # define BYTE_ORDER BIG_ENDIAN
- # endif
- /* Intel x86 */
- # if defined(i386) || defined(__i386__) || defined(__i386) || \
- defined(_M_IX86) || defined(_X86_) || defined(__THW_INTEL) || \
- defined(sun386)
- # define BYTE_ORDER LITTLE_ENDIAN
- # endif
- /* Intel Itanium */
- # if defined(__ia64__) || defined(_IA64) || defined(__IA64__) || \
- defined(_M_IA64) || defined(_M_AMD64) || defined(_M_IX86) || defined(_AMD64_)
- # define BYTE_ORDER LITTLE_ENDIAN
- # endif
- /* Nationnal Semiconductor 32000 serie */
- # if defined(ns32000)
- # define BYTE_ORDER LITTLE_ENDIAN
- # endif
- /* Motorola 68000 */
- # if defined(mc68000) || defined(is68k) || defined(macII) || defined(m68k)
- # define BYTE_ORDER BIG_ENDIAN
- # endif
- /* MIPS */
- # if defined(MIPSEL) || defined(_MIPSEL)
- # define BYTE_ORDER LITTLE_ENDIAN
- # elif defined(MIPSEB) || defined(_MIPSEB)
- # define BYTE_ORDER BIG_ENDIAN
- # elif defined(__mips__) || defined(__mips) || defined(__MIPS__)
- # error "MIPS are bi-endian processors. Endianness is unknown for this system, please drop an e-mail to liberty-eiffel@gnu.org"
- # endif
- /* Power PC */
- /* this processor is bi-endian, how to know if little-endian is set? */
- # if defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || \
- defined(__ppc__) || defined(__ppc) || defined(_M_PPC) || \
- defined(__PPC) || defined(__PPC__)
- # define BYTE_ORDER BIG_ENDIAN
- # endif
- /* Pyramid 9810 */
- # if defined(pyr)
- # define BYTE_ORDER BIG_ENDIAN
- # endif
- /* RS/6000 */
- # if defined(__THW_RS6000) || defined(_IBMR2) || defined(_POWER) || \
- defined(_ARCH_PWR) || defined(_ARCH_PWR2)
- # define BYTE_ORDER BIG_ENDIAN
- # endif
- /* SPARC */
- # if defined(__sparc__) || defined(sparc) || defined(__sparc)
- # define BYTE_ORDER BIG_ENDIAN
- # endif
- /* CCI Tahoe */
- # if defined(tahoe)
- # define BYTE_ORDER BIG_ENDIAN
- # endif
- /* VAX */
- # if defined(vax) || defined(VAX) || defined(__vax__) || defined(_vax_) || \
- defined(__vax) || defined(__VAX)
- # define BYTE_ORDER LITTLE_ENDIAN
- # endif
- /* ELATE is a virtual OS with a little endian Virtual Processor */
- # if defined(__ELATE__)
- # define BYTE_ORDER LITTLE_ENDIAN
- # endif
- /* Miscellaneous little endian */
- # if defined(wrltitan)
- # define BYTE_ORDER LITTLE_ENDIAN
- # endif
- /* Miscellaneous big endian */
- # if defined(apollo) || defined(__convex__) || defined(_CRAY) || defined(sel)
- # define BYTE_ORDER BIG_ENDIAN
- # endif
- #endif
- #if !defined(BYTE_ORDER)
- # error "Unknown byte order. Add your system in above macros once you know your system type. Please drop an e-mail to liberty-eiffel@gnu.org"
- #endif
- #if (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN)
- # error "Only little-endian and big-endian are valid at this time. Please drop an e-mail to liberty-eiffel@gnu.org"
- #endif
- /*
- Byte swapping stuff
- */
- extern void copy_swap_16(const uint16_t *src, uint16_t *dest, int count);
- /* Because ANSI C EXIT_* are not always defined: */
- #ifndef EXIT_FAILURE
- # define EXIT_FAILURE 1
- #endif
- #ifndef EXIT_SUCCESS
- # define EXIT_SUCCESS 0
- #endif
- /*
- On Linux glibc systems, we need to use sig.* versions of jmp_buf,
- setjmp and longjmp to preserve the signal handling context.
- Currently, the way I figured to detect this is if _SIGSET_H_types has
- been defined in /usr/include/setjmp.h.
- NOTE: with gcc, -ansi is used for SmartEiffel generated files EXCEPT in
- -no_split mode. ANSI only recognizes the non-sig versions.
- */
- #if (defined(_SIGSET_H_types) && !defined(__STRICT_ANSI__))
- # define JMP_BUF sigjmp_buf
- # define SETJMP(x) sigsetjmp( (x), 1)
- # define LONGJMP siglongjmp
- #else
- # define JMP_BUF jmp_buf
- # define SETJMP(x) setjmp( (x) )
- # define LONGJMP longjmp
- #endif
- /*
- Type to store reference objects Id:
- */
- typedef int Tid;
- typedef struct S0 T0;
- struct S0{Tid id;};
- /*
- The default channel used to print runtime error messages:
- */
- #define SE_ERR stderr
- /*
- Eiffel type INTEGER_8 is #1:
- */
- typedef int8_t T1;
- #define EIF_INTEGER_8 T1
- #define M1 (INT8_C(0))
- #define EIF_INTEGER_8_BITS (CHAR_BIT)
- #define EIF_MINIMUM_INTEGER_8 (INT8_MIN)
- #define EIF_MAXIMUM_INTEGER_8 (INT8_MAX)
- /*
- Eiffel type INTEGER_16 is #10:
- */
- typedef int16_t T10;
- #define EIF_INTEGER_16 T10
- #define M10 (INT16_C(0))
- #define EIF_INTEGER_16_BITS (CHAR_BIT*sizeof(T10t))
- #define EIF_MINIMUM_INTEGER_16 (INT16_MIN) /*-32768*/
- #define EIF_MAXIMUM_INTEGER_16 (INT16_MAX) /*+32767*/
- /*
- Eiffel type INTEGER or INTEGER_32 is #2:
- */
- typedef int32_t T2;
- #define EIF_INTEGER T2
- #define EIF_INTEGER_32 T2
- #define M2 (INT32_C(0))
- #define EIF_INTEGER_BITS ((T2)(CHAR_BIT*sizeof(T2)))
- #define EIF_INTEGER_32_BITS EIF_INTEGER_BITS
- #define EIF_MINIMUM_INTEGER (INT32_MIN)
- #define EIF_MAXIMUM_INTEGER (INT32_MAX)
- /*
- Eiffel type INTEGER_64 is #11:
- */
- typedef int64_t T11;
- #define EIF_INTEGER_64 T11
- #define M11 (INT64_C(0))
- #define EIF_INTEGER_64_BITS (CHAR_BIT*sizeof(T11))
- #define EIF_MINIMUM_INTEGER_64 (INT64_MIN)
- #define EIF_MAXIMUM_INTEGER_64 (INT64_MAX)
- /*
- Eiffel type CHARACTER is #3:
- */
- typedef unsigned char T3;
- #define EIF_CHARACTER T3
- #define M3 (0)
- #define EIF_CHARACTER_BITS (CHAR_BIT)
- #define EIF_MINIMUM_CHARACTER_CODE (0)
- #define EIF_MAXIMUM_CHARACTER_CODE (255)
- #define T3code(x) ((T10)(x))
- #define T3to_integer(x) ((signed char)(x))
- #define T3to_integer_8(x) ((signed char)(x))
- #define T3to_bit(x) (x)
- /*
- Eiffel type REAL_32 is #4:
- */
- typedef float T4;
- typedef T4 real32_t;
- #define EIF_REAL_32 T4
- #define M4 (0.0)
- #define EIF_MINIMUM_REAL_32 (-(FLT_MAX))
- #define EIF_MAXIMUM_REAL_32 (FLT_MAX)
- /*
- Eiffel type REAL or REAL_64 is #5:
- */
- typedef double T5;
- typedef T5 real64_t;
- #define EIF_REAL T5
- #define EIF_REAL_64 T5
- #define M5 (0.0)
- #define EIF_MINIMUM_REAL_64 (-(DBL_MAX))
- #define EIF_MINIMUM_REAL (EIF_MINIMUM_REAL_64)
- #define EIF_MAXIMUM_REAL_64 (DBL_MAX)
- #define EIF_MAXIMUM_REAL (EIF_MAXIMUM_REAL_64)
- /*
- Eiffel type REAL_EXTENDED is #12:
- */
- typedef long double T12;
- typedef T12 real_extended_t;
- #define EIF_REAL_EXTENDED T12
- #define EIF_REAL_128 T12
- #define M12 (0.0)
- #define EIF_MINIMUM_REAL_EXTENDED (-(DBL_MAX))
- #define EIF_MAXIMUM_REAL_EXTENDED (DBL_MAX)
- /*
- Eiffel type BOOLEAN is #6:
- */
- typedef char T6;
- #define EIF_BOOLEAN T6
- #define M6 (0)
- #define EIF_BOOLEAN_BITS (CHAR_BIT)
- /*
- Eiffel type POINTER is #8:
- */
- typedef void* T8;
- #define EIF_POINTER T8
- /* Sometimes, NULL is defined as 0 */
- #define M8 ((void*)NULL)
- #define EIF_POINTER_BITS (CHAR_BIT*sizeof(void*))
- /*
- To use type STRING on the C side:
- */
- #define EIF_STRING T7*
- /*
- Some Other EIF_* defined in ETL:
- */
- #define eif_access(x) ((char*)(x))
- #define EIF_REFERENCE T0*
- #define EIF_OBJ T0*
- #define EIF_OBJECT EIF_OBJ
- #define EIF_ANY EIF_OBJ
- /*
- Wrappers for `malloc' and `calloc':
- */
- void se_check_malloc(const void*result, const char*format, ...);
- void* se_malloc(size_t size);
- void* se_calloc(size_t nmemb, size_t size);
- void* se_realloc(void* src, size_t size);
- void* se_malloc_(size_t size, void*(*alloc)(size_t));
- void* se_calloc_(size_t nmemb, size_t size, void*(*alloc)(size_t,size_t));
- /*
- die method.
- */
- void se_die(int code);
- /*
- Runtime hooks. They allow different runtime modules to be quite independant. In time, they will also allow
- thread-safe operations.
- Currently known modules:
- - boost
- - no_check
- - sedb
- - gc
- - print stack
- - profile
- - plugins
- However, currently only profile uses this method. It will be extended to other modules later.
- The currently defined hooks are described in the enum below (the names should be self-explanatory).
- */
- typedef enum {
- SE_HANDLE_EXCEPTION_SET, /* called when an exception handler is set, prior to SETJMP */
- SE_HANDLE_EXCEPTION_CLEAR, /* called when a feature with an exception handler normally returns */
- SE_HANDLE_EXCEPTION_THROWN, /* called when an exception is thrown, prior to the LONGJMP */
- SE_HANDLE_ENTER_GC, /* called when gc_start() begins */
- SE_HANDLE_EXIT_GC, /* called when gc_start() ends */
- SE_HANDLE_ENTER_PRINT_STACK, /* called when se_print_run_time_stack() begins */
- SE_HANDLE_EXIT_PRINT_STACK, /* called when se_print_run_time_stack() ends */
- SE_HANDLE_NO_MORE_MEMORY, /* called by se_alloc() and co */
- SE_HANDLE_SEDB_BREAK, /* called when sedb stops the program */
- SE_HANDLE_SEDB_CONTINUE, /* called when sedb continues the program */
- SE_HANDLE_RUNTIME_ERROR, /* called when a runtime error is raised and not caught by an exception. Cannot be raised in boost mode. */
- SE_HANDLE_DIE_WITH_CODE, /* called when the program is stopped by the die_with_code feature. The data points to the int code. */
- SE_HANDLE_NORMAL_EXIT /* called when the program correctly terminates. The data is null. */
- } se_handler_action_t;
- extern int handlers_count;
- typedef void se_runtime_handler_t(se_handler_action_t action, void*data);
- void register_handler(se_runtime_handler_t*handler);
- void _handle(se_handler_action_t action, void*data);
- #define handle(action,data) do{if(handlers_count>0)_handle(action,data);}while(0)
- #endif /* #ifndef _BASE_H */
- #define SE_BOOST 1
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- #ifndef WIN32
- # include <dirent.h>
- #endif
- #ifndef WIN32
- # include <unistd.h>
- #endif
- EIF_POINTER directory_open(EIF_POINTER path);
- EIF_POINTER directory_read_entry(EIF_POINTER dirstream);
- EIF_POINTER directory_get_entry_name(EIF_POINTER entry);
- EIF_BOOLEAN directory_close(EIF_POINTER dirstream);
- #define directory_current_working_directory (directory_cwd())
- EIF_POINTER directory_cwd(void);
- EIF_BOOLEAN directory_chdir(EIF_POINTER destination);
- EIF_BOOLEAN directory_mkdir(EIF_POINTER directory_path);
- EIF_BOOLEAN directory_rmdir(EIF_POINTER directory_path);
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- #define basic_exec_system_none 0
- #define basic_exec_system_posix 1
- #define basic_exec_system_win32 2
- #include "eiffel_exec.h"
- /***************************
- * Common macros and types *
- * basic_exec_xxx *
- ***************************/
- #if defined __USE_POSIX || defined __unix__ || defined _POSIX_C_SOURCE || defined __APPLE__
- /*# include <unistd.h> done in base.h */
- /*# include <sys/types.h> done in base.h */
- #include <sys/wait.h>
- typedef struct se_exec_data se_exec_data_t;
- struct se_exec_data {
- pid_t id; /* the launched child process id */
- int running; /* true if the process is running */
- int child; /* true if the process is the child itself (useful for duplicate) */
- int status; /* the status of the child process if finished */
- };
- extern char** environ;
- #define basic_exec_id(data) (((se_exec_data_t*)data)->id)
- #define basic_exec_is_child(data) (((se_exec_data_t*)data)->child)
- #define basic_exec_status(data) (((se_exec_data_t*)data)->status)
- #define basic_exec_alloc_pipe() (calloc(2, sizeof(int)))
- #define basic_exec_free_pipe(p) (free(p))
- #define basic_exec_alloc_data() ((se_exec_data_t*)se_malloc(sizeof(se_exec_data_t)))
- #define basic_exec_free_data(p) (free(p))
- #define basic_exec_init_pipe(p) ((EIF_BOOLEAN)(pipe(p)>=0))
- #define basic_exec_system basic_exec_system_posix
- #elif defined WIN32
- /*# include <windows.h> done in base.h */
- typedef struct se_exec_data se_exec_data_t;
- struct se_exec_data {
- PROCESS_INFORMATION process_information;
- int running;
- DWORD status;
- };
- #define basic_exec_id(data) (((se_exec_data_t*)data)->process_information.dwProcessId)
- #define basic_exec_is_child(data) (0)
- #define basic_exec_status(data) (((se_exec_data_t*)data)->status)
- #define basic_exec_alloc_pipe() (calloc(2, sizeof(HANDLE)))
- #define basic_exec_free_pipe(p) (free(p))
- #define basic_exec_alloc_data() ((se_exec_data_t*)se_malloc(sizeof(se_exec_data_t)))
- #define basic_exec_free_data(p) (free(p))
- #define basic_exec_system basic_exec_system_win32
- extern EIF_BOOLEAN basic_exec_init_pipe(HANDLE*p);
- #else
- /* Dummy implementation that always reports an error back to the Eiffel side */
- typedef int se_exec_data_t;
- #define basic_exec_id(data) (-1)
- #define basic_exec_is_child(data) (0)
- #define basic_exec_status(data) (0)
- #define basic_exec_alloc_pipe() (NULL)
- #define basic_exec_free_pipe(p) /* dummy */
- #define basic_exec_alloc_data() ((se_exec_data_t*)NULL)
- #define basic_exec_free_data(p) /* dummy */
- #define basic_exec_init_pipe(p) ((EIF_BOOLEAN)0)
- #define basic_exec_system basic_exec_system_none
- #endif
- /***********************************
- * Prototypes for common functions *
- * basic_exec_xxx *
- ***********************************/
- extern EIF_BOOLEAN basic_exec_is_finished(se_exec_data_t*data);
- extern void basic_exec_wait(se_exec_data_t*data);
- extern void basic_exec_cleanup(se_exec_data_t*data, int status);
- /*************************************************
- * Posix-specific function prototypes and macros *
- * basic_exec_posix_xxx *
- *************************************************/
- extern EIF_BOOLEAN basic_exec_posix_execute(se_exec_data_t*data, char*prog, char**args, EIF_BOOLEAN keep_env, char**add_env, int*in_fd, int*out_fd, int*err_fd);
- extern EIF_INTEGER basic_exec_posix_get_character (EIF_INTEGER fd);
- extern void basic_exec_posix_put_character(EIF_INTEGER fd, EIF_CHARACTER c);
- extern void basic_exec_posix_wait_any(se_exec_data_t*data);
- extern void basic_exec_posix_any_finished(se_exec_data_t*data);
- #if basic_exec_system == basic_exec_system_posix
- #define basic_exec_posix_flush(fd) (fsync(fd))
- #define basic_exec_posix_close(fd) (close(fd))
- #define basic_exec_posix_kill(data, sig) (kill((data)->id, (sig)))
- #define basic_exec_posix_get_in_descriptor(pipe) (((int*)pipe)[0])
- #define basic_exec_posix_get_out_descriptor(pipe) (((int*)pipe)[1])
- #else
- #define basic_exec_posix_flush(fd) /* dummy */
- #define basic_exec_posix_close(fd) /* dummy */
- #define basic_exec_posix_kill(data, sig) /* dummy */
- #define basic_exec_posix_get_in_descriptor(pipe) 0
- #define basic_exec_posix_get_out_descriptor(pipe) 0
- #endif
- /*************************************************
- * Win32-specific function prototypes and macros *
- * basic_exec_win32_xxx *
- *************************************************/
- #if basic_exec_system == basic_exec_system_win32
- #define basic_exec_win32_flush(h) FlushFileBuffers((HANDLE)h)
- #define basic_exec_win32_close(h) CloseHandle((HANDLE)h)
- #define basic_exec_win32_handle(data) ((int)((se_exec_data_t*)data)->process_information.hProcess)
- #define basic_exec_win32_maximum_wait (MAXIMUM_WAIT_OBJECTS)
- extern EIF_BOOLEAN basic_exec_win32_execute(se_exec_data_t*data, char*args, EIF_BOOLEAN keep_env, char*add_env, HANDLE*in_h, HANDLE*out_h, HANDLE*err_h);
- extern EIF_BOOLEAN basic_exec_win32_wait_any(HANDLE*handles, DWORD count, se_exec_data_t*data);
- extern EIF_BOOLEAN basic_exec_win32_any_finished(HANDLE*handles, DWORD count, se_exec_data_t*data);
- extern void basic_exec_win32_put_character(HANDLE h, EIF_CHARACTER c);
- extern EIF_INTEGER basic_exec_win32_get_character (HANDLE h);
- #define basic_exec_win32_get_in_handle(pipe) (((HANDLE*)pipe)[0])
- #define basic_exec_win32_get_out_handle(pipe) (((HANDLE*)pipe)[1])
- #else
- #define basic_exec_win32_flush(h) /* dummy */
- #define basic_exec_win32_close(h) /* dummy */
- #define basic_exec_win32_handle(data) (0)
- #define basic_exec_win32_maximum_wait (0)
- extern EIF_BOOLEAN basic_exec_win32_execute(se_exec_data_t*data, char*args, EIF_BOOLEAN keep_env, char*add_env, void*in_h, void*out_h, void*err_h);
- extern EIF_BOOLEAN basic_exec_win32_wait_any(void*handles, int count, se_exec_data_t*data);
- extern EIF_BOOLEAN basic_exec_win32_any_finished(void*handles, int count, se_exec_data_t*data);
- extern void basic_exec_win32_put_character(void*h, EIF_CHARACTER c);
- extern EIF_INTEGER basic_exec_win32_get_character (void*h);
- #define basic_exec_win32_get_in_handle(pipe) NULL
- #define basic_exec_win32_get_out_handle(pipe) NULL
- #endif
- extern void basic_exec_waitpid_init(EIF_OBJECT);
- extern EIF_INTEGER basic_exec_waitpid_fd(void);
- extern EIF_INTEGER basic_exec_waitpid_read_buffer(void*);
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- #define mbi_unsigned_32_to_integer_64(x) (((int64_t)((uint32_t)(x))))
- #define mbi_unsigned_less_than(a,b) ((((uint32_t)(a)) < ((uint32_t)(b))))
- #define mbi_unsigned_greater_than(a,b) ((((uint32_t)(a)) > ((uint32_t)(b))))
- #define mbi_unsigned_greater_or_equal(a,b) ((((uint32_t)(a)) >= ((uint32_t)(b))))
- #define mbi_storage_at(s, n) (((s)+(n)))
- EIF_BOOLEAN mbi_inc (int32_t *p);
- EIF_BOOLEAN mbi_add (int32_t a, int32_t b, int32_t *p);
- EIF_BOOLEAN mbi_add_with_inc (int32_t a, int32_t b, int32_t *p);
- EIF_BOOLEAN mbi_dec (int32_t *p);
- EIF_BOOLEAN mbi_subtract (int32_t a, int32_t b, int32_t *p);
- EIF_BOOLEAN mbi_subtract_with_dec (int32_t a, int32_t b, int32_t *p);
- EIF_INTEGER mbi_multiply (int32_t a, int32_t b, int32_t *p);
- EIF_INTEGER mbi_multiply_with_add (int32_t a, int32_t b, int32_t c, int32_t *p);
- EIF_INTEGER mbi_multiply_with_2_add (int32_t a, int32_t b, int32_t c, int32_t d, int32_t *p);
- EIF_INTEGER mbi_divide (int32_t a, int32_t b, int32_t d, int32_t *r);
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- #define basic_getenv(v) (getenv((char*)v))
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- EIF_INTEGER fstat_st_size(EIF_POINTER path);
- EIF_INTEGER_64 fstat_st_mtime(EIF_POINTER path);
- EIF_BOOLEAN fstat_st_is_file(EIF_POINTER path);
- EIF_BOOLEAN fstat_st_is_dir(EIF_POINTER path);
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- #include <errno.h>
- #define text_file_read_open(p) (fopen(((char*)(p)),"r"))
- #define text_file_write_open(p) (fopen(((char*)(p)),"w"))
- #define text_file_write_append(p) (fopen(((char*)(p)),"a"))
- #define text_file_read_write_open(p) (fopen(((char*)(p)),"r+"))
- #define text_file_read_write_append(p) (fopen(((char*)(p)),"a+"))
- #define binary_file_read_open(p) (fopen(((char*)(p)),"rb"))
- #define binary_file_write_open(p) (fopen(((char*)(p)),"wb"))
- #define binary_file_write_append(p) (fopen(((char*)(p)),"ab"))
- #define io_fclose(p) (fclose((FILE*)(p)))
- #define io_flush(p) (fflush((FILE*)(p)))
- #define io_getc(f) (getc(((FILE*)(f))))
- #define io_putc(b, f) (putc((b),((FILE*)(f))))
- #define io_ungetc(b, f) (ungetc((b), (FILE*)(f)))
- #define io_fread(b, n, f) (fread((void *)(b),(size_t)(1), (size_t)(n),(FILE*)(f)))
- #define io_fwrite(b, n, f) (fwrite((void *)(b),(size_t)(1), (size_t)(n),(FILE*)(f)))
- #define io_feof(f) (feof(((FILE*)(f))))
- #define io_rename(o, n) (rename(((char*)(o)),((char*)(n))) == 0)
- #define io_remove(f) (remove(((char*)(f))) == 0)
- #define io_fseek(f, o) (fseek((FILE*)(f),(o),SEEK_SET))
- #define io_ftell(f) ((EIF_INTEGER_64)ftell((FILE*)(f)))
- #if defined __USE_POSIX || defined __unix__ || defined _POSIX_C_SOURCE
- # define read_stdin(b, s) (read(STDIN_FILENO, b, s))
- #else
- extern int read_stdin(EIF_CHARACTER *buffer, int size);
- #endif
- extern int io_copy(char*source, char*target);
- extern int io_file_exists(char*source);
- extern int io_same_physical_file(char*path1,char*path2);
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- #define pointer_hash_code(p) (((unsigned int)(unsigned long)(p))>>1)
- #define pointer_to_natural_32(p) ((unsigned int) (p))
- #define pointer_to_any(p) ((T0*)(p))
- #define pointer_plus(p, o) (((char*)(p))+o)
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- #ifdef WIN32
- # include <time.h>
- #else
- # include <sys/time.h>
- #endif
- extern EIF_INTEGER basic_microsecond_microsecond;
- extern EIF_INTEGER_64 basic_microsecond_time;
- #define basic_microsecond_update (_basic_microsecond_update())
- void _basic_microsecond_update(void);
- /*
- -- ------------------------------------------------------------------------------------------------------------
- -- Copyright notice below. Please read.
- --
- -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
- -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
- --
- -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- -- documentation files (the "Software"), to deal in the Software without restriction, including without
- -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- -- conditions:
- --
- -- The above copyright notice and this permission notice shall be included in all copies or substantial
- -- portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- -- OR OTHER DEALINGS IN THE SOFTWARE.
- --
- -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
- -- ------------------------------------------------------------------------------------------------------------
- */
- #define sprintf_pointer(buffer, pointer) sprintf((char*)(buffer),"%p",pointer)
- void sprintf_real_64(EIF_CHARACTER* b, EIF_CHARACTER m, int32_t f, real64_t r);
- void sprintf_real_extended(EIF_CHARACTER* b, EIF_CHARACTER m, int32_t f, real_extended_t r);
- /* C Header Pass 1: */
- typedef union _se_agent se_agent;
- typedef struct _se_agent0 se_agent0;
- typedef struct S29 T29;
- typedef int T296;
- typedef struct S113 T113;
- typedef struct S126 T126;
- typedef void*T903;
- typedef struct S104 T104;
- typedef struct S283 T283;
- typedef struct S117 T117;
- typedef struct S111 T111;
- typedef struct S291 T291;
- typedef void*T281;
- typedef int T297;
- typedef struct S7 T7;
- typedef struct S909 T909;
- typedef struct S293 T293;
- typedef struct S86 T86;
- typedef struct S910 T910;
- typedef struct S295 T295;
- typedef int T554;
- typedef struct S546 T546;
- typedef struct S78 T78;
- typedef struct S911 T911;
- typedef struct S557 T557;
- typedef struct S561 T561;
- typedef struct S562 T562;
- typedef struct S563 T563;
- typedef struct S564 T564;
- typedef struct S565 T565;
- typedef struct S912 T912;
- typedef struct S913 T913;
- typedef struct S102 T102;
- typedef struct S556 T556;
- typedef int T545;
- typedef struct S464 T464;
- typedef struct S665 T665;
- typedef struct S81 T81;
- typedef struct S69 T69;
- typedef struct S467 T467;
- typedef struct S123 T123;
- typedef struct S708 T708;
- typedef struct S709 T709;
- typedef struct S704 T704;
- typedef struct S914 T914;
- typedef struct S107 T107;
- typedef struct S566 T566;
- typedef struct S710 T710;
- typedef struct S351 T351;
- typedef struct S437 T437;
- typedef struct S915 T915;
- typedef struct S333 T333;
- typedef struct S711 T711;
- typedef struct S916 T916;
- typedef struct S447 T447;
- typedef struct S790 T790;
- typedef struct S588 T588;
- typedef struct S621 T621;
- typedef struct S622 T622;
- typedef struct S623 T623;
- typedef struct S624 T624;
- typedef struct S625 T625;
- typedef struct S637 T637;
- typedef struct S638 T638;
- typedef struct S639 T639;
- typedef struct S641 T641;
- typedef struct S642 T642;
- typedef struct S646 T646;
- typedef struct S647 T647;
- typedef struct S648 T648;
- typedef struct S649 T649;
- typedef struct S650 T650;
- typedef struct S651 T651;
- typedef struct S652 T652;
- typedef struct S654 T654;
- typedef struct S655 T655;
- typedef struct S653 T653;
- typedef struct S656 T656;
- typedef struct S657 T657;
- typedef struct S658 T658;
- typedef struct S917 T917;
- typedef struct S552 T552;
- typedef struct S97 T97;
- typedef struct S91 T91;
- typedef struct S383 T383;
- typedef void*T110;
- typedef struct S95 T95;
- typedef struct S286 T286;
- typedef struct S89 T89;
- typedef struct S919 T919;
- typedef struct S920 T920;
- typedef struct S921 T921;
- typedef struct S306 T306;
- typedef struct S108 T108;
- typedef void*T116;
- typedef void*T125;
- typedef struct S124 T124;
- typedef void*T127;
- typedef struct S452 T452;
- typedef struct S923 T923;
- typedef struct S924 T924;
- typedef struct S925 T925;
- typedef struct S341 T341;
- typedef struct S120 T120;
- typedef struct S290 T290;
- typedef struct S926 T926;
- typedef struct S441 T441;
- typedef struct S929 T929;
- typedef int T587;
- typedef struct S930 T930;
- typedef struct S931 T931;
- typedef struct S932 T932;
- typedef struct S727 T727;
- typedef struct S728 T728;
- typedef struct S729 T729;
- typedef struct S318 T318;
- typedef struct S935 T935;
- typedef struct S936 T936;
- typedef struct S719 T719;
- typedef struct S551 T551;
- typedef struct S937 T937;
- typedef struct S938 T938;
- typedef struct S720 T720;
- typedef struct S939 T939;
- typedef int T940;
- typedef struct S340 T340;
- typedef struct S943 T943;
- typedef int T807;
- typedef struct S804 T804;
- typedef struct S806 T806;
- typedef int T944;
- typedef struct S945 T945;
- typedef struct S946 T946;
- typedef struct S59 T59;
- typedef struct S805 T805;
- typedef struct S947 T947;
- typedef struct S953 T953;
- typedef struct S954 T954;
- typedef int T80;
- typedef struct S955 T955;
- typedef int T957;
- typedef struct S959 T959;
- typedef struct S106 T106;
- typedef struct S962 T962;
- typedef struct S783 T783;
- typedef struct S825 T825;
- typedef struct S964 T964;
- typedef struct S966 T966;
- typedef struct S968 T968;
- typedef struct S970 T970;
- typedef struct S785 T785;
- typedef struct S491 T491;
- typedef struct S973 T973;
- typedef struct S367 T367;
- typedef struct S974 T974;
- typedef struct S407 T407;
- typedef struct S975 T975;
- typedef struct S462 T462;
- typedef struct S433 T433;
- typedef struct S395 T395;
- typedef struct S439 T439;
- typedef struct S440 T440;
- typedef struct S505 T505;
- typedef struct S514 T514;
- typedef struct S516 T516;
- typedef struct S121 T121;
- typedef struct S517 T517;
- typedef struct S458 T458;
- typedef struct S423 T423;
- typedef struct S480 T480;
- typedef struct S418 T418;
- typedef struct S449 T449;
- typedef struct S455 T455;
- typedef struct S453 T453;
- typedef struct S456 T456;
- typedef struct S396 T396;
- typedef struct S450 T450;
- typedef struct S422 T422;
- typedef struct S448 T448;
- typedef struct S451 T451;
- typedef struct S459 T459;
- typedef struct S518 T518;
- typedef struct S504 T504;
- typedef struct S292 T292;
- typedef struct S461 T461;
- typedef struct S436 T436;
- typedef struct S282…