home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / sys / runtime / base.h next >
C/C++ Source or Header  |  1999-06-05  |  3KB  |  121 lines

  1. /*
  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 
  8. -- another product.
  9. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  10. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  11. --                       http://www.loria.fr/SmallEiffel
  12. --
  13. */
  14. /*
  15.   This file (base.h) is automatically included in the header for all modes 
  16.   of compilation : -boost, -no_check, -require_check, ...
  17.   This file is also included in the header of any cecil file.
  18. */
  19. #include <stdio.h>
  20. #include <string.h>
  21. #include <math.h>
  22. #include <stdlib.h>
  23. #include <signal.h>
  24. #include <stddef.h>
  25. #include <stdarg.h>
  26. #include <limits.h>
  27. #include <float.h>
  28. #include <setjmp.h>
  29. #include <sys/types.h>
  30. #include <sys/stat.h>
  31. #include <fcntl.h>
  32. #ifndef O_RDONLY
  33. #include <sys/file.h>
  34. #endif
  35. #ifndef O_RDONLY
  36. #define O_RDONLY 0000
  37. #endif
  38.  
  39. /* 
  40.    On Linux glibc systems, we need to use sig.* versions of jmp_buf,
  41.    setjmp and longjmp to preserve the signal handling context.
  42.    Currently, the way I figured to detect this is if _SIGSET_H_types has
  43.    been defined in /usr/include/setjmp.h.
  44. */
  45. #ifdef _SIGSET_H_types
  46. # define JMP_BUF    sigjmp_buf
  47. # define SETJMP(x)  sigsetjmp( (x), 1)
  48. # define LONGJMP    siglongjmp
  49. #else
  50. # define JMP_BUF    jmp_buf
  51. # define SETJMP(x)  setjmp( (x) )
  52. # define LONGJMP    longjmp
  53. #endif
  54.  
  55. /* 
  56.    Type to store reference objects Id :
  57.  */
  58. typedef int Tid;
  59.  
  60. typedef struct S0 T0;
  61.  
  62. struct S0{
  63.   Tid id;
  64. };
  65.  
  66. /* 
  67.    The default channel used to print runtime error messages :
  68. */
  69. #define SE_ERR stderr
  70.  
  71. /* 
  72.    Eiffel type INTEGER is #2 :
  73. */
  74. typedef int T2;
  75. #define M2 (0)
  76. #define T2BITS (CHAR_BIT*sizeof(int))
  77. #define T2MIN INT_MIN
  78. #define T2MAX INT_MAX
  79.  
  80. /*
  81.   Eiffel type CHARACTER is #3 :
  82. */
  83. typedef char T3;
  84. #define M3 (0)
  85. #define T3BITS CHAR_BIT
  86. #define T3MIN (0)
  87. #define T3MAX (255)
  88.  
  89. /*
  90.   Eiffel type REAL is #4 :
  91. */
  92. typedef float T4;
  93. #define M4 (0.0)
  94. #define T4BITS (CHAR_BIT*sizeof(float))
  95. #define T4MIN (-(FLT_MAX))
  96. #define T4MAX FLT_MAX
  97.  
  98. /*
  99.   Eiffel type DOUBLE is #5 :
  100. */
  101. typedef double T5;
  102. #define M5 (0.0)
  103. #define T5BITS (CHAR_BIT*sizeof(double))
  104. #define T5MIN (-(DBL_MAX))
  105. #define T5MAX DBL_MAX
  106.  
  107. /*
  108.   Eiffel type BOOLEAN is #6 :
  109. */
  110. typedef int T6;
  111. #define M6 (0)
  112. #define T6BITS (CHAR_BIT*sizeof(int))
  113.  
  114. /* 
  115.    Eiffel type POINTER is #8 :
  116. */
  117. typedef void* T8;
  118. #define M8 (NULL)
  119. #define T8BITS (CHAR_BIT*sizeof(void*))
  120.  
  121.