/test/language/unclassified/test_overload01.h

http://github.com/tybor/Liberty · C Header · 773 lines · 501 code · 63 blank · 209 comment · 101 complexity · 145a757e7d3c57f182eb5065270fd325 MD5 · raw file

  1. #ifdef __cplusplus
  2. extern "C" {
  3. #endif
  4. /*
  5. ANSI C code generated by SmartEiffel The GNU Eiffel Compiler, Eiffel tools and libraries
  6. Release 2.4 (??? June ??th 2008) [????]
  7. Copyright (C), 1994-2002 - INRIA - LORIA - ESIAL UHP Nancy 1 - FRANCE
  8. Copyright (C), 2003-2005 - INRIA - LORIA - IUT Charlemagne Nancy 2 - FRANCE
  9. D.COLNET, P.RIBET, C.ADRIAN, V.CROIZIER F.MERIZEN - SmartEiffel@loria.fr
  10. http://SmartEiffel.loria.fr
  11. C Compiler options used: -pipe -Os
  12. */
  13. /*
  14. -- ------------------------------------------------------------------------------------------------------------
  15. -- Copyright notice below. Please read.
  16. --
  17. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  18. -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  19. --
  20. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  21. --
  22. -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  23. -- documentation files (the "Software"), to deal in the Software without restriction, including without
  24. -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25. -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
  26. -- conditions:
  27. --
  28. -- The above copyright notice and this permission notice shall be included in all copies or substantial
  29. -- portions of the Software.
  30. --
  31. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  32. -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
  33. -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  34. -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  35. -- OR OTHER DEALINGS IN THE SOFTWARE.
  36. --
  37. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  38. -- ------------------------------------------------------------------------------------------------------------
  39. */
  40. /*
  41. This file (SmartEiffel/sys/runtime/base.h) contains all basic Eiffel
  42. type definitions.
  43. This file is automatically included in the header for all modes of
  44. compilation: -boost, -no_check, -require_check, -ensure_check, ...
  45. This file is also included in the header of any cecil file (when the
  46. -cecil option is used).
  47. This file is also included in the header file of C++ wrappers (when
  48. using the external "C++" clause).
  49. */
  50. #ifndef _BASE_H
  51. #define _BASE_H
  52. #if defined(_MSC_VER) && (_MSC_VER >= 1400) /* VC8+ */
  53. # ifndef _CRT_SECURE_NO_DEPRECATE
  54. # define _CRT_SECURE_NO_DEPRECATE
  55. # endif
  56. # ifndef _CRT_NONSTDC_NO_DEPRECATE
  57. # define _CRT_NONSTDC_NO_DEPRECATE
  58. # endif
  59. #endif /* VC8+ */
  60. #include <stdio.h>
  61. #include <string.h>
  62. #include <math.h>
  63. #include <stdlib.h>
  64. #include <signal.h>
  65. #include <stddef.h>
  66. #include <stdarg.h>
  67. #include <limits.h>
  68. #include <float.h>
  69. #include <setjmp.h>
  70. #include <sys/types.h>
  71. #include <sys/stat.h>
  72. #include <fcntl.h>
  73. #if defined __USE_POSIX || defined __unix__ || defined _POSIX_C_SOURCE
  74. # include <unistd.h>
  75. #endif
  76. #if !defined(WIN32) && \
  77. (defined(WINVER) || defined(_WIN32_WINNT) || defined(_WIN32) || \
  78. defined(__WIN32__) || defined(__TOS_WIN__) || defined(_MSC_VER))
  79. # define WIN32 1
  80. #endif
  81. #ifdef WIN32
  82. # include <windows.h>
  83. #else
  84. # ifndef O_RDONLY
  85. # include <sys/file.h>
  86. # endif
  87. # ifndef O_RDONLY
  88. # define O_RDONLY 0000
  89. # endif
  90. #endif
  91. #if defined(_MSC_VER) && (_MSC_VER < 1600) /* MSVC older than v10 */
  92. typedef signed char int8_t;
  93. typedef signed short int16_t;
  94. typedef signed int int32_t;
  95. typedef signed __int64 int64_t;
  96. typedef unsigned char uint8_t;
  97. typedef unsigned short uint16_t;
  98. typedef unsigned int uint32_t;
  99. typedef unsigned __int64 uint64_t;
  100. # define PRId8 "d"
  101. # define PRId16 "d"
  102. # define PRId32 "d"
  103. # define PRId64 "I64d"
  104. # define INT8_C(c) c
  105. # define INT16_C(c) c
  106. # define INT32_C(c) c
  107. # define INT64_C(c) c ## i64
  108. #elif defined(__WATCOMC__) && (__WATCOMC__ <= 1220) /* WATCOM 12.2 or lower */
  109. typedef signed char int8_t;
  110. typedef signed short int16_t;
  111. typedef signed long int int32_t;
  112. typedef signed __int64 int64_t;
  113. typedef unsigned char uint8_t;
  114. typedef unsigned short uint16_t;
  115. typedef unsigned long int uint32_t;
  116. typedef unsigned __int64 uint64_t;
  117. # define PRId8 "d"
  118. # define PRId16 "d"
  119. # define PRId32 "d"
  120. # define PRId64 "Ld"
  121. # define INT8_C(c) c
  122. # define INT16_C(c) c
  123. # define INT32_C(c) c ## L
  124. # define INT64_C(c) c ## i64
  125. #elif defined(__BORLANDC__) && (__BORLANDC__ < 0x600) /* Borland before 6.0 */
  126. typedef signed char int8_t;
  127. typedef signed short int16_t;
  128. typedef signed long int int32_t;
  129. typedef signed __int64 int64_t;
  130. typedef unsigned char uint8_t;
  131. typedef unsigned short uint16_t;
  132. typedef unsigned long int uint32_t;
  133. typedef unsigned __int64 uint64_t;
  134. # define PRId8 "d"
  135. # define PRId16 "d"
  136. # define PRId32 "ld"
  137. # define PRId64 "I64Ld"
  138. # define INT8_C(c) c
  139. # define INT16_C(c) c
  140. # define INT32_C(c) c ## L
  141. # define INT64_C(c) c ## i64
  142. #elif defined(__FreeBSD__) && (__FreeBSD__ < 5) /* FreeBSD before 5.0 */ && !defined (_SYS_INTTYPES_H_)
  143. typedef signed char int8_t;
  144. typedef signed short int16_t;
  145. typedef signed long int int32_t;
  146. typedef signed long long int int64_t;
  147. typedef unsigned char uint8_t;
  148. typedef unsigned short uint16_t;
  149. typedef unsigned long int uint32_t;
  150. typedef unsigned long long int uint64_t;
  151. #elif defined(__CYGWIN__) && defined(__BIT_TYPES_DEFINED__) /* Cygwin defines intxx_t in sys/types.h instead of inttypes.h */
  152. # include <cygwin/version.h>
  153. # if defined(CYGWIN_VERSION_DLL_MAJOR) && (CYGWIN_VERSION_DLL_MAJOR<1005)
  154. typedef unsigned char uint8_t;
  155. typedef __uint16_t uint16_t;
  156. typedef __uint32_t uint32_t;
  157. typedef __uint64_t uint64_t;
  158. # endif
  159. #elif defined(SASC)
  160. # error("Too old SAS/C compiler, sorry.");
  161. #elif defined(__SASC__)
  162. # if (__SASC__ < 750 ) /* SAS/C before 7.50 */
  163. typedef signed char int8_t;
  164. typedef signed short int16_t;
  165. typedef signed long int int32_t;
  166. typedef signed long long int int64_t;
  167. typedef unsigned char uint8_t;
  168. typedef unsigned short uint16_t;
  169. typedef unsigned long int uint32_t;
  170. typedef unsigned long long int uint64_t;
  171. # endif
  172. #else
  173. # include <inttypes.h>
  174. # if !defined(INT8_MAX) && defined(INT16_MAX)
  175. /* int8_t is not mandatory */
  176. typedef int_least8_t int8_t;
  177. # endif
  178. #endif
  179. #if !defined(PRId16)
  180. # define PRId8 "d"
  181. # define PRId16 "d"
  182. # define PRId32 "ld"
  183. # define PRId64 "lld"
  184. #elif !defined(PRId8)
  185. # define PRId8 "d"
  186. #endif
  187. #if !defined(INT16_C)
  188. # define INT8_C(c) c
  189. # define INT16_C(c) c
  190. # define INT32_C(c) c ## L
  191. # define INT64_C(c) c ## LL
  192. #elif !defined(INT8_C)
  193. # define INT8_C(c) c
  194. #endif
  195. #if !defined(INT16_MIN)
  196. # define INT8_MIN (-INT8_C(127)-1)
  197. # define INT8_MAX (INT8_C(127))
  198. # define INT16_MIN (-INT16_C(32767)-1)
  199. # define INT16_MAX (INT16_C(32767))
  200. # define INT32_MIN (-INT32_C(2147483647)-1)
  201. # define INT32_MAX (INT32_C(2147483647))
  202. # define INT64_MIN (-INT64_C(9223372036854775807)-1)
  203. # define INT64_MAX (INT64_C(9223372036854775807))
  204. #elif !defined(INT8_MIN)
  205. # define INT8_MIN (-INT8_C(127)-1)
  206. #endif
  207. /*
  208. Endian stuff
  209. */
  210. #if defined(BSD) && (BSD >= 199103)
  211. # include <machine/endian.h>
  212. #elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA)
  213. /* bi-endian processor, current mode should be find in machine/endian.h file */
  214. # include <machine/endian.h>
  215. #elif defined(linux)
  216. # include <endian.h>
  217. #endif
  218. #if !defined(BYTE_ORDER) && defined(__BYTE_ORDER)
  219. # define BYTE_ORDER __BYTE_ORDER
  220. #endif
  221. #if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN)
  222. # define LITTLE_ENDIAN __LITTLE_ENDIAN
  223. #endif
  224. #if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN)
  225. # define BIG_ENDIAN __BIG_ENDIAN
  226. #endif
  227. #if !defined(LITTLE_ENDIAN)
  228. # define LITTLE_ENDIAN 1234 /* LSB first (vax, pc) */
  229. #endif
  230. #if !defined(BIG_ENDIAN)
  231. # define BIG_ENDIAN 4321 /* MSB first (IBM, net) */
  232. #endif
  233. #if !defined(PDP_ENDIAN)
  234. # define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
  235. #endif
  236. #if !defined(BYTE_ORDER) && defined(BIT_ZERO_ON_RIGHT)
  237. # define BYTE_ORDER LITTLE_ENDIAN
  238. #elif !defined(BYTE_ORDER) && defined(BIT_ZERO_ON_LEFT)
  239. # define BYTE_ORDER BIG_ENDIAN
  240. #elif !defined(BYTE_ORDER)
  241. /* ARM */
  242. # if defined(__ARMEL__)
  243. # define BYTE_ORDER LITTLE_ENDIAN
  244. # elif defined(__ARMEB__)
  245. # define BYTE_ORDER BIG_ENDIAN
  246. # elif defined(__arm__)
  247. # error "ARMs are bi-endian processors. Endianness is unknown for this system, please drop an e-mail to SmartEiffel@loria.fr"
  248. # endif
  249. /* HP RISC */
  250. # if defined(__hppa__) || defined(__hppa) || defined(__hp9000) || \
  251. defined(__hp9000s300) || defined(hp9000s300) || \
  252. defined(__hp9000s700) || defined(hp9000s700) || \
  253. defined(__hp9000s800) || defined(hp9000s800) || defined(hp9000s820)
  254. # define BYTE_ORDER BIG_ENDIAN
  255. # endif
  256. /* IBM */
  257. # if defined(ibm032) || defined(ibm370) || defined(_IBMR2) || \
  258. defined(IBM370) || defined(__MVS__)
  259. # define BYTE_ORDER BIG_ENDIAN
  260. # endif
  261. /* Intel x86 */
  262. # if defined(i386) || defined(__i386__) || defined(__i386) || \
  263. defined(_M_IX86) || defined(_X86_) || defined(__THW_INTEL) || \
  264. defined(sun386)
  265. # define BYTE_ORDER LITTLE_ENDIAN
  266. # endif
  267. /* Intel Itanium */
  268. # if defined(__ia64__) || defined(_IA64) || defined(__IA64__) || \
  269. defined(_M_IA64)
  270. # define BYTE_ORDER LITTLE_ENDIAN
  271. # endif
  272. /* Nationnal Semiconductor 32000 serie */
  273. # if defined(ns32000)
  274. # define BYTE_ORDER LITTLE_ENDIAN
  275. # endif
  276. /* Motorola 68000 */
  277. # if defined(mc68000) || defined(is68k) || defined(macII) || defined(m68k)
  278. # define BYTE_ORDER BIG_ENDIAN
  279. # endif
  280. /* MIPS */
  281. # if defined(MIPSEL) || defined(_MIPSEL)
  282. # define BYTE_ORDER LITTLE_ENDIAN
  283. # elif defined(MIPSEB) || defined(_MIPSEB)
  284. # define BYTE_ORDER BIG_ENDIAN
  285. # elif defined(__mips__) || defined(__mips) || defined(__MIPS__)
  286. # error "MIPS are bi-endian processors. Endianness is unknown for this system, please drop an e-mail to SmartEiffel@loria.fr"
  287. # endif
  288. /* Power PC */
  289. /* this processor is bi-endian, how to know if little-endian is set? */
  290. # if defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || \
  291. defined(__ppc__) || defined(__ppc) || defined(_M_PPC) || \
  292. defined(__PPC) || defined(__PPC__)
  293. # define BYTE_ORDER BIG_ENDIAN
  294. # endif
  295. /* Pyramid 9810 */
  296. # if defined(pyr)
  297. # define BYTE_ORDER BIG_ENDIAN
  298. # endif
  299. /* RS/6000 */
  300. # if defined(__THW_RS6000) || defined(_IBMR2) || defined(_POWER) || \
  301. defined(_ARCH_PWR) || defined(_ARCH_PWR2)
  302. # define BYTE_ORDER BIG_ENDIAN
  303. # endif
  304. /* SPARC */
  305. # if defined(__sparc__) || defined(sparc) || defined(__sparc)
  306. # define BYTE_ORDER BIG_ENDIAN
  307. # endif
  308. /* CCI Tahoe */
  309. # if defined(tahoe)
  310. # define BYTE_ORDER BIG_ENDIAN
  311. # endif
  312. /* VAX */
  313. # if defined(vax) || defined(VAX) || defined(__vax__) || defined(_vax_) || \
  314. defined(__vax) || defined(__VAX)
  315. # define BYTE_ORDER LITTLE_ENDIAN
  316. # endif
  317. /* ELATE is a virtual OS with a little endian Virtual Processor */
  318. # if defined(__ELATE__)
  319. # define BYTE_ORDER LITTLE_ENDIAN
  320. # endif
  321. /* Miscellaneous little endian */
  322. # if defined(wrltitan)
  323. # define BYTE_ORDER LITTLE_ENDIAN
  324. # endif
  325. /* Miscellaneous big endian */
  326. # if defined(apollo) || defined(__convex__) || defined(_CRAY) || defined(sel)
  327. # define BYTE_ORDER BIG_ENDIAN
  328. # endif
  329. #endif
  330. #if !defined(BYTE_ORDER)
  331. # error "Unknown byte order. Add your system in above macros once you know your system type. Please drop an e-mail to SmartEiffel@loria.fr"
  332. #endif
  333. #if (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN)
  334. # error "Only little-endian and big-endian are valid at this time. Please drop an e-mail to SmartEiffel@loria.fr"
  335. #endif
  336. /*
  337. Byte swapping stuff
  338. */
  339. extern void copy_swap_16(const uint16_t *src, uint16_t *dest, int count);
  340. /* Because ANSI C EXIT_* are not always defined: */
  341. #ifndef EXIT_FAILURE
  342. # define EXIT_FAILURE 1
  343. #endif
  344. #ifndef EXIT_SUCCESS
  345. # define EXIT_SUCCESS 0
  346. #endif
  347. /*
  348. On Linux glibc systems, we need to use sig.* versions of jmp_buf,
  349. setjmp and longjmp to preserve the signal handling context.
  350. Currently, the way I figured to detect this is if _SIGSET_H_types has
  351. been defined in /usr/include/setjmp.h.
  352. NOTE: with gcc, -ansi is used for SmartEiffel generated files EXCEPT in
  353. -no_split mode. ANSI only recognizes the non-sig versions.
  354. */
  355. #if (defined(_SIGSET_H_types) && !defined(__STRICT_ANSI__))
  356. # define JMP_BUF sigjmp_buf
  357. # define SETJMP(x) sigsetjmp( (x), 1)
  358. # define LONGJMP siglongjmp
  359. #else
  360. # define JMP_BUF jmp_buf
  361. # define SETJMP(x) setjmp( (x) )
  362. # define LONGJMP longjmp
  363. #endif
  364. /*
  365. Type to store reference objects Id:
  366. */
  367. typedef int Tid;
  368. typedef struct S0 T0;
  369. struct S0{Tid id;};
  370. /*
  371. The default channel used to print runtime error messages:
  372. */
  373. #define SE_ERR stderr
  374. /*
  375. Eiffel type INTEGER_8 is #1:
  376. */
  377. typedef int8_t T1;
  378. #define EIF_INTEGER_8 T1
  379. #define M1 (INT8_C(0))
  380. #define EIF_INTEGER_8_BITS (CHAR_BIT)
  381. #define EIF_MINIMUM_INTEGER_8 (INT8_MIN)
  382. #define EIF_MAXIMUM_INTEGER_8 (INT8_MAX)
  383. /*
  384. Eiffel type INTEGER_16 is #10:
  385. */
  386. typedef int16_t T10;
  387. #define EIF_INTEGER_16 T10
  388. #define M10 (INT16_C(0))
  389. #define EIF_INTEGER_16_BITS (CHAR_BIT*sizeof(T10t))
  390. #define EIF_MINIMUM_INTEGER_16 (INT16_MIN) /*-32768*/
  391. #define EIF_MAXIMUM_INTEGER_16 (INT16_MAX) /*+32767*/
  392. /*
  393. Eiffel type INTEGER or INTEGER_32 is #2:
  394. */
  395. typedef int32_t T2;
  396. #define EIF_INTEGER T2
  397. #define EIF_INTEGER_32 T2
  398. #define M2 (INT32_C(0))
  399. #define EIF_INTEGER_BITS ((T2)(CHAR_BIT*sizeof(T2)))
  400. #define EIF_INTEGER_32_BITS EIF_INTEGER_BITS
  401. #define EIF_MINIMUM_INTEGER (INT32_MIN)
  402. #define EIF_MAXIMUM_INTEGER (INT32_MAX)
  403. /*
  404. Eiffel type INTEGER_64 is #11:
  405. */
  406. typedef int64_t T11;
  407. #define EIF_INTEGER_64 T11
  408. #define M11 (INT64_C(0))
  409. #define EIF_INTEGER_64_BITS (CHAR_BIT*sizeof(T11))
  410. #define EIF_MINIMUM_INTEGER_64 (INT64_MIN)
  411. #define EIF_MAXIMUM_INTEGER_64 (INT64_MAX)
  412. /*
  413. Eiffel type CHARACTER is #3:
  414. */
  415. typedef unsigned char T3;
  416. #define EIF_CHARACTER T3
  417. #define M3 (0)
  418. #define EIF_CHARACTER_BITS (CHAR_BIT)
  419. #define EIF_MINIMUM_CHARACTER_CODE (0)
  420. #define EIF_MAXIMUM_CHARACTER_CODE (255)
  421. #define T3code(x) ((T10)(x))
  422. #define T3to_integer(x) ((signed char)(x))
  423. #define T3to_integer_8(x) ((signed char)(x))
  424. #define T3to_bit(x) (x)
  425. /*
  426. Eiffel type REAL_32 is #4:
  427. */
  428. typedef float T4;
  429. typedef T4 real32_t;
  430. #define EIF_REAL_32 T4
  431. #define M4 (0.0)
  432. #define EIF_MINIMUM_REAL_32 (-(FLT_MAX))
  433. #define EIF_MAXIMUM_REAL_32 (FLT_MAX)
  434. /*
  435. Eiffel type REAL or REAL_64 is #5:
  436. */
  437. typedef double T5;
  438. typedef T5 real64_t;
  439. #define EIF_REAL_64 T5
  440. #define M5 (0.0)
  441. #define EIF_MINIMUM_REAL_64 (-(DBL_MAX))
  442. #define EIF_MINIMUM_REAL (EIF_MINIMUM_REAL_64)
  443. #define EIF_MAXIMUM_REAL_64 (DBL_MAX)
  444. #define EIF_MAXIMUM_REAL (EIF_MAXIMUM_REAL_64)
  445. /*
  446. Eiffel type REAL_EXTENDED is #12:
  447. */
  448. typedef long double T12;
  449. typedef T12 real_extended_t;
  450. #define EIF_REAL_EXTENDED T12
  451. #define M12 (0.0)
  452. #define EIF_MINIMUM_REAL_EXTENDED (-(DBL_MAX))
  453. #define EIF_MAXIMUM_REAL_EXTENDED (DBL_MAX)
  454. /*
  455. Eiffel type BOOLEAN is #6:
  456. */
  457. typedef char T6;
  458. #define EIF_BOOLEAN T6
  459. #define M6 (0)
  460. #define EIF_BOOLEAN_BITS (CHAR_BIT)
  461. /*
  462. Eiffel type POINTER is #8:
  463. */
  464. typedef void* T8;
  465. #define EIF_POINTER T8
  466. /* Sometimes, NULL is defined as 0 */
  467. #define M8 ((void*)NULL)
  468. #define EIF_POINTER_BITS (CHAR_BIT*sizeof(void*))
  469. /*
  470. To use type STRING on the C side:
  471. */
  472. #define EIF_STRING T7*
  473. /*
  474. Some Other EIF_* defined in ETL:
  475. */
  476. #define eif_access(x) ((char*)(x))
  477. #define EIF_REFERENCE T0*
  478. #define EIF_OBJ T0*
  479. #define EIF_OBJECT EIF_OBJ
  480. /*
  481. Wrappers for `malloc' and `calloc':
  482. */
  483. void* se_malloc(size_t size);
  484. void* se_calloc(size_t nmemb, size_t size);
  485. void* se_realloc(void* src, size_t size);
  486. /*
  487. die method.
  488. */
  489. void se_die(int code);
  490. /*
  491. Runtime hooks. They allow different runtime modules to be quite independant. In time, they will also allow
  492. thread-safe operations.
  493. Currently known modules:
  494. - boost
  495. - no_check
  496. - sedb
  497. - gc
  498. - print stack
  499. - profile
  500. - plugins
  501. However, currently only profile uses this method. It will be extended to other modules later.
  502. The currently defined hooks are described in the enum below (the names should be self-explanatory).
  503. */
  504. typedef enum {
  505. SE_HANDLE_EXCEPTION_SET, /* called when an exception handler is set, prior to SETJMP */
  506. SE_HANDLE_EXCEPTION_CLEAR, /* called when a feature with an exception handler normally returns */
  507. SE_HANDLE_EXCEPTION_THROWN, /* called when an exception is thrown, prior to the LONGJMP */
  508. SE_HANDLE_ENTER_GC, /* called when gc_start() begins */
  509. SE_HANDLE_EXIT_GC, /* called when gc_start() ends */
  510. SE_HANDLE_ENTER_PRINT_STACK, /* called when se_print_run_time_stack() begins */
  511. SE_HANDLE_EXIT_PRINT_STACK, /* called when se_print_run_time_stack() ends */
  512. SE_HANDLE_NO_MORE_MEMORY, /* called by se_alloc() and co */
  513. SE_HANDLE_SEDB_BREAK, /* called when sedb stops the program */
  514. SE_HANDLE_SEDB_CONTINUE, /* called when sedb continues the program */
  515. SE_HANDLE_RUNTIME_ERROR, /* called when a runtime error is raised and not caught by an exception. Cannot be raised in boost mode. */
  516. SE_HANDLE_DIE_WITH_CODE, /* called when the program is stopped by the die_with_code feature. The data points to the int code. */
  517. SE_HANDLE_NORMAL_EXIT /* called when the program correctly terminates. The data is null. */
  518. } se_handler_action_t;
  519. extern int handlers_count;
  520. typedef void se_runtime_handler_t(se_handler_action_t action, void*data);
  521. void register_handler(se_runtime_handler_t*handler);
  522. void _handle(se_handler_action_t action, void*data);
  523. #define handle(action,data) do{if(handlers_count>0)_handle(action,data);}while(0)
  524. #endif /* #ifndef _BASE_H */
  525. #define SE_BOOST 1
  526. /*
  527. -- ------------------------------------------------------------------------------------------------------------
  528. -- Copyright notice below. Please read.
  529. --
  530. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  531. -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  532. --
  533. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  534. --
  535. -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  536. -- documentation files (the "Software"), to deal in the Software without restriction, including without
  537. -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  538. -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
  539. -- conditions:
  540. --
  541. -- The above copyright notice and this permission notice shall be included in all copies or substantial
  542. -- portions of the Software.
  543. --
  544. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  545. -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
  546. -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  547. -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  548. -- OR OTHER DEALINGS IN THE SOFTWARE.
  549. --
  550. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  551. -- ------------------------------------------------------------------------------------------------------------
  552. */
  553. #include <errno.h>
  554. #define text_file_read_open(p) (fopen(((char*)(p)),"r"))
  555. #define text_file_write_open(p) (fopen(((char*)(p)),"w"))
  556. #define text_file_write_append(p) (fopen(((char*)(p)),"a"))
  557. #define text_file_read_write_open(p) (fopen(((char*)(p)),"r+"))
  558. #define text_file_read_write_append(p) (fopen(((char*)(p)),"a+"))
  559. #define binary_file_read_open(p) (fopen(((char*)(p)),"rb"))
  560. #define binary_file_write_open(p) (fopen(((char*)(p)),"wb"))
  561. #define binary_file_write_append(p) (fopen(((char*)(p)),"ab"))
  562. #define io_fclose(p) (fclose((FILE*)(p)))
  563. #define io_flush(p) (fflush((FILE*)(p)))
  564. #define io_getc(f) (getc(((FILE*)(f))))
  565. #define io_putc(b, f) (putc((b),((FILE*)(f))))
  566. #define io_ungetc(b, f) (ungetc((b), (FILE*)(f)))
  567. #define io_fread(b, n, f) (fread((void *)(b),(size_t)(1), (size_t)(n),(FILE*)(f)))
  568. #define io_fwrite(b, n, f) (fwrite((void *)(b),(size_t)(1), (size_t)(n),(FILE*)(f)))
  569. #define io_feof(f) (feof(((FILE*)(f))))
  570. #define io_rename(o, n) (rename(((char*)(o)),((char*)(n))))
  571. #define io_remove(f) (remove(((char*)(f))))
  572. #define io_fseek(f, o) (fseek((FILE*)(f),(o),SEEK_SET))
  573. #define io_ftell(f) ((EIF_INTEGER_64)ftell((FILE*)(f)))
  574. #if defined __USE_POSIX || defined __unix__ || defined _POSIX_C_SOURCE
  575. # define read_stdin(b, s) (read(STDIN_FILENO, b, s))
  576. #else
  577. extern int read_stdin(EIF_CHARACTER *buffer, int size);
  578. #endif
  579. extern void io_copy(char*source, char*target);
  580. extern int io_file_exists(char*source);
  581. extern int io_same_physical_file(char*path1,char*path2);
  582. /* C Header Pass 1: */
  583. typedef struct S53 T53;
  584. typedef struct S7 T7;
  585. typedef struct S49 T49;
  586. typedef struct S25 T25;
  587. /* C Header Pass 2: */
  588. typedef T3*T9;
  589. #define M9 NULL
  590. /* C Header Pass 3: */
  591. /* C Header Pass 4: */
  592. struct S53{T2 _value;};
  593. extern T53 M53;
  594. struct S7{T9 _storage;T2 _count;T2 _capacity;};
  595. extern T7 M7;
  596. struct S49{T2 _buffer_position;T9 _buffer;T2 _capacity;};
  597. extern T49 M49;
  598. struct S25{T2 _assertion_level;T8 _external_object;};
  599. extern T25 M25;
  600. extern char*s26_0;
  601. extern char*s26_212160365;
  602. extern char*s26_48390502;
  603. extern char*s26_1690381566;
  604. extern char*s26_1992063831;
  605. extern char*s26_1325941860;
  606. extern char*s26_113001857;
  607. extern char*s26_2167877;
  608. extern char*s26_718083334;
  609. extern char*s26_1075456615;
  610. extern char*s26_265093627;
  611. extern char*s26_1682790378;
  612. /*
  613. -- ------------------------------------------------------------------------------------------------------------
  614. -- Copyright notice below. Please read.
  615. --
  616. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  617. -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  618. --
  619. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  620. --
  621. -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  622. -- documentation files (the "Software"), to deal in the Software without restriction, including without
  623. -- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  624. -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
  625. -- conditions:
  626. --
  627. -- The above copyright notice and this permission notice shall be included in all copies or substantial
  628. -- portions of the Software.
  629. --
  630. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  631. -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
  632. -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  633. -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  634. -- OR OTHER DEALINGS IN THE SOFTWARE.
  635. --
  636. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  637. -- ------------------------------------------------------------------------------------------------------------
  638. */
  639. #define SE_BOOST 1
  640. void se_print_run_time_stack (void);
  641. void se_signal_handler(int sig);
  642. /*INTEGER_32*/void r2append_in(T2 C,T0* a1);
  643. /*INTEGER_32*/T3 r2decimal_digit(T2 C);
  644. /*INTEGER_32*/T2 r2max(T2 C,T2 a1);
  645. /*NATIVE_ARRAY[CHARACTER]*/T9 r9realloc(T9 C,T2 a1,T2 a2);
  646. /*NATIVE_ARRAY[CHARACTER]*/void r9copy_from(T9 C,T9 a1,T2 a2);
  647. /*NATIVE_ARRAY[CHARACTER]*/void r9clear_all(T9 C,T2 a1);
  648. /*STRING*/void r7swap(T7* C,T2 a1,T2 a2);
  649. /*STRING*/T3 r7item(T7* C,T2 a1);
  650. /*STRING*/void r7copy(T7* C,T0* a1);
  651. /*STRING*/void r7put(T7* C,T3 a1,T2 a2);
  652. /*STRING*/void r7extend(T7* C,T3 a1);
  653. /*STRING*/void r7ensure_capacity(T7* C,T2 a1);
  654. /*COUNTER*/void r53increment(T53* C);
  655. extern T0*oBC13std_output;
  656. extern int fBC13std_output;
  657. /*STD_OUTPUT*/T0* r49std_output(void);
  658. /*STD_OUTPUT*/void r49filtered_flush(T49* C);
  659. /*STD_OUTPUT*/void r49filtered_put_character(T49* C,T3 a1);
  660. /*STD_OUTPUT*/void r49se_atexit(void);
  661. /*STD_OUTPUT*/void r49make(T49* C);
  662. /*STD_OUTPUT*/void r49write_buffer(T49* C);
  663. /*STD_OUTPUT*/void r49flush(T49* C);
  664. /*STD_OUTPUT*/void r49put_string(T49* C,T0* a1);
  665. /*TEST_OVERLOAD01*/void r25default_create(T25* C);
  666. /*TEST_OVERLOAD01*/T0* r25std_output(void);
  667. extern T0*oBC26assert_counter;
  668. /*TEST_OVERLOAD01*/T0* r25assertion_flag(T25* C);
  669. /*TEST_OVERLOAD01*/void r25label_assert(T25* C,T0* a1,T6 a2);
  670. /*TEST_OVERLOAD01*/T2 r25value(T25* C);
  671. /* Extra external prototype for line 44 of /home/cyril/SmartEiffel/se/trunk/test_suite/language/unclassified/test_overload01.e:*/
  672. void cpp25cpp_set_value(T8 a1,T2 a2);
  673. /*TEST_OVERLOAD01*/void r25cpp_set_value(T8 a1,T2 a2);
  674. /* Extra external prototype for line 51 of /home/cyril/SmartEiffel/se/trunk/test_suite/language/unclassified/test_overload01.e:*/
  675. T8 cpp25cpp_new(void);
  676. /*TEST_OVERLOAD01*/T8 r25cpp_new(void);
  677. /* Extra external prototype for line 37 of /home/cyril/SmartEiffel/se/trunk/test_suite/language/unclassified/test_overload01.e:*/
  678. T2 cpp25cpp_value(T8 a1);
  679. /*TEST_OVERLOAD01*/T2 r25cpp_value(T8 a1);
  680. /*TEST_OVERLOAD01*/void r25set_value(T25* C,T2 a1);
  681. extern T0*ms26_718083334;
  682. extern T0*ms26_2167877;
  683. extern T0*ms26_1992063831;
  684. extern T0*ms26_1325941860;
  685. extern T0*ms26_0;
  686. extern T0*ms26_1690381566;
  687. extern T0*ms26_113001857;
  688. extern T0*ms26_265093627;
  689. extern T0*ms26_212160365;
  690. extern T0*ms26_48390502;
  691. extern T0*ms26_1682790378;
  692. extern T0*ms26_1075456615;
  693. T0*se_ms(int c,char*e);
  694. T0*se_string(char*e);
  695. void se_msi1(void);
  696. extern T25*eiffel_root_object;
  697. extern int se_argc;
  698. extern char**se_argv;
  699. #define SE_MAXID 164
  700. extern T7*g[];
  701. void se_atexit(void);
  702. void initialize_eiffel_runtime(int argc,char*argv[]);
  703. int main(int argc,char*argv[]);
  704. #ifdef __cplusplus
  705. }
  706. #endif