PageRenderTime 69ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 2ms

/src/lispbibl.d

https://github.com/ynd/clisp-branch--ynd-devel
D | 12025 lines | 7981 code | 741 blank | 3303 comment | 1075 complexity | c404e42f858ad768575a5be350bf7543 MD5 | raw file
Possible License(s): LGPL-2.0, GPL-2.0, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * Main include-file for CLISP
  3. * Bruno Haible 1990-2008
  4. * Marcus Daniels 11.11.1994
  5. * Sam Steingold 1998-2008
  6. * German comments translated into English: Stefan Kain 2001-09-24
  7. Flags intended to be set through CFLAGS:
  8. Readline library:
  9. NO_READLINE
  10. Termcap/ncurses library:
  11. NO_TERMCAP_NCURSES
  12. Internationalization:
  13. NO_GETTEXT, UNICODE
  14. Fault handling:
  15. NO_SIGSEGV
  16. Foreign function interface:
  17. DYNAMIC_FFI
  18. Dynamic loading of modules:
  19. DYNAMIC_MODULES
  20. Safety level:
  21. SAFETY={0,1,2,3}
  22. Exploit GCC global register variables:
  23. USE_GCC_REGISTER_VARIABLES
  24. Debugging (turned on by --with-debug configure option):
  25. DEBUG_GCSAFETY (requires G++)
  26. DEBUG_OS_ERROR
  27. DEBUG_SPVW
  28. DEBUG_BYTECODE
  29. DEBUG_BACKTRACE
  30. DEBUG_COMPILER
  31. Flags that may be set through CFLAGS, in order to override the defaults:
  32. Object representation (on 32-bit platforms only):
  33. TYPECODES, HEAPCODES, STANDARD_HEAPCODES, LINUX_NOEXEC_HEAPCODES, WIDE
  34. Advanced memory management:
  35. NO_SINGLEMAP, NO_TRIVIALMAP, NO_MULTIMAP_FILE, NO_MULTIMAP_SHM,
  36. NO_VIRTUAL_MEMORY, CONS_HEAP_GROWS_DOWN, CONS_HEAP_GROWS_UP,
  37. NO_MORRIS_GC, NO_GENERATIONAL_GC
  38. String representation:
  39. NO_SMALL_SSTRING
  40. Implementation is prepared for the following computers,
  41. operating systems and c-compilers
  42. (Only a rough listing, check the file PLATFORMS for further details.)
  43. Machine Producer Operating system C-Compiler recognized through
  44. AMIGA Commodore AMIGA-OS (AMIGADOS) GNU amiga or AMIGA, __GNUC__, maybe MC68000 or AMIGA3000
  45. any any UNIX GNU unix, __GNUC__, ...
  46. any any UNIX CC unix, ...
  47. Amiga 3000 Commodore Amiga UNIX 2.1 SVR4.0 GNU unix, __unix__, AMIX, __AMIX__, __svr4__, m68k, __m68k__, __motorola__, __GNUC__
  48. SUN-3 Sun SUN-OS3 (UNIX BSD 4.2) GNU sun, unix, mc68020, __GNUC__
  49. SUN-3 Sun SUN-OS4 (UNIX SUNOS 4.1) GNU sun, unix, mc68020, __GNUC__
  50. SUN-386 Sun SUN-OS4 (UNIX SUNOS 4.0) GNU sun, unix, sun386, i386, __GNUC__
  51. SUN-386 Sun SUN-OS4 (UNIX SUNOS 4.0) CC sun, unix, sun386, i386
  52. SUN-4 Sun SUN-OS4 (UNIX SUNOS 4.1) GNU sun, unix, sparc, __GNUC__
  53. SUN-4 Sun SUN-OS4 (UNIX SUNOS 4.1) CC sun, unix, sparc
  54. SUN-4 Sun SUN-OS5 (UNIX Solaris) GCC sun, unix, sparc, __GNUC__
  55. UltraSparc Sun Solaris 7 (UNIX SUNOS 5.7) CC sun, unix, __sparc, __sparcv9
  56. UltraSparc Sun Solaris 7 (UNIX SUNOS 5.7) GCC sun, unix, __sparc, __arch64__, __GNUC__
  57. IBM-PC/386 any SUN-OS5 (UNIX Solaris) GCC sun, unix, __svr4__, i386, __GNUC__
  58. HP9000-300 Hewlett-Packard NetBSD 0.9 (UNIX BSD 4.3) GNU unix, __NetBSD__, mc68000, __GNUC__
  59. HP9000-300 Hewlett-Packard HP-UX 8.0 (UNIX SYS V) GNU [__]hpux, [__]unix, [__]hp9000s300, mc68000, __GNUC__
  60. HP9000-800 Hewlett-Packard HP-UX 8.0 (UNIX SYS V) GNU [__]hpux, [__]unix, [__]hp9000s800
  61. IRIS Silicon Graphics IRIX (UNIX SYS V 3.2) GNU unix, SVR3, mips, sgi, __GNUC__
  62. IRIS Silicon Graphics IRIX (UNIX SYS V) cc -ansi [__]unix, [__]SVR3, [__]mips, [__]sgi
  63. IRIS Silicon Graphics IRIX 5 (UNIX SYS V 4) GNU [__]unix, [__]SYSTYPE_SVR4, [__]mips, [__]host_mips, [__]MIPSEB, [__]sgi, __DSO__, [__]_MODERN_C, __GNUC__
  64. DECstation 5000 RISC/OS (Ultrix V4.2A) GNU unix, [__]mips, [__]ultrix
  65. DG-UX 88k Data General DG/UX GNU unix, m88000, DGUX
  66. DEC Alpha DEC OSF/1 1.3 cc [unix,] __unix__, __osf__, __alpha
  67. DEC Alpha DEC OSF/1 1.3 GNU unix, __unix__, __osf__, __alpha, __alpha__, _LONGLONG
  68. Apple MacII Apple A/UX (UNIX SYS V 2) GNU [__]unix, [__]AUX, [__]macII, [__]m68k, mc68020, mc68881, __GNUC__
  69. NeXT NeXT NeXTstep 3.1 (UNIX) cc NeXT, m68k
  70. PowerPC Apple Mach 3.0 + MkLinux GNU unix, __powerpc__, __PPC__, _ARCH_PPC, _CALL_SYSV, __ELF__, __linux__
  71. PowerPC Apple Mach + Rhapsody cc __MACH__, __APPLE__, __ppc[__], __GNUC__, __APPLE_CC__
  72. PowerPC Apple Mach + MacOS X cc __MACH__, __APPLE__, __ppc__, __GNUC__, __APPLE_CC__
  73. Sequent Sequent PTX 3.2.0 V2.1.0 i386 (SYS V) GNU unix, i386, _SEQUENT_, __GNUC__
  74. Sequent Sequent PTX V4.1.3 GNU unix, i386, _SEQUENT_, __svr4__, __GNUC__
  75. Convex C2 Convex ConvexOS 10.1 GNU __convex__, __GNUC__
  76. IBM RS/6000 IBM AIX 3.2 GNU _AIX, _AIX32, _IBMR2, __CHAR_UNSIGNED__, __GNUC__
  77. IBM-PC/386 any LINUX (free UNIX) GNU unix, linux, i386, __GNUC__
  78. IBM-PC/386 any LINUX (free UNIX) Intel 5.0 __unix__, __linux__, __INTEL_COMPILER, __ICC, __USLC__
  79. IBM-PC/386 any 386BSD 0.1 (UNIX BSD 4.2) GNU unix, __386BSD__, i386, __GNUC__
  80. IBM-PC/386 any NetBSD 0.9 (UNIX BSD 4.3) GNU unix, __NetBSD__, i386, __GNUC__
  81. IBM-PC/386 any FreeBSD 4.0 (UNIX BSD 4.4) GNU unix, __FreeBSD__, i386, __GNUC__
  82. IBM-PC/386 any EMX 0.9c (UNIXlike on OS/2) GNU [unix,] i386, __GNUC__, __EMX__
  83. IBM-PC/386 any Cygwin32 on WinNT/Win95 GNU _WIN32, __WINNT__, __CYGWIN32__, __POSIX__, _X86_, i386, __GNUC__
  84. IBM-PC/386 any Mingw32 on WinNT/Win95 GNU _WIN32, __WINNT__, __MINGW32__, _X86_, i386, __GNUC__
  85. IBM-PC/386 any WinNT/Win95 MSVC _WIN32, _M_IX86, _MSC_VER
  86. IBM-PC/386 any WinNT/Win95 Borland 5.0 __WIN32__, _M_IX86, __TURBOC__, __BORLANDC__
  87. IBM-PC/386 any WinNT/Win95 and Cygwin32 GNU _WIN32, __WINNT__, __CYGWIN32__, __POSIX__, __i386__, _X86_, __GNUC__
  88. IBM-PC/586 any BeOS 5 GNU __BEOS__, __INTEL__, __i386__, _X86_, __GNUC__
  89. IBM-PC/586 any HP NUE/ski, Linux GNU unix, linux, __ia64[__], __GNUC__, __LP64__
  90. RM400 Siemens-Nixdorf SINIX-N 5.42 c89 unix, mips, MIPSEB, host_mips, sinix, SNI, _XPG_IV
  91. Acorn Risc PC RISC OS 3.x GNU [__]arm, [__]riscos, __GNUC__
  92. Acorn Risc PC RISC OS 3.x Norcroft [__]arm, [__]riscos
  93. APPLE IIGS Apple ?? ??
  94. For ANSI-C-Compiler: use pre-processors comment5, varbrace
  95. (and maybe gcc-cpp, ccpaux).
  96. this machine: WIN32 or GENERIC_UNIX */
  97. #if (defined(__unix) || defined(__unix__) || defined(_AIX) || defined(sinix) || defined(__MACH__) || defined(__POSIX__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__BEOS__)) && !defined(unix)
  98. #define unix
  99. #endif
  100. #if (defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__))) || (defined(__WIN32__) && defined(__BORLANDC__))
  101. #undef WIN32 /* because of __MINGW32__ */
  102. #define WIN32
  103. #endif
  104. #if !defined(WIN32)
  105. #if defined(unix)
  106. #define GENERIC_UNIX
  107. #else
  108. #error "Unknown machine type -- set machine again!"
  109. #endif
  110. #endif
  111. /* additional specification of the machine: */
  112. #if defined(WIN32)
  113. /* declare availability of typical PC facilities,
  114. like a console with a graphics mode that differs from the text mode,
  115. or a keyboard with function keys F1..F12. */
  116. #define PC386 /* IBMPC-compatible with 80386/80486-processor */
  117. #endif
  118. #ifdef GENERIC_UNIX
  119. #if (defined(sun) && defined(unix) && defined(sun386))
  120. #define SUN386
  121. #endif
  122. #if (defined(unix) && (defined(linux) || defined(__CYGWIN32__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)) && (defined(i386) || defined(__i386__) || defined(__x86_64__) || defined(__amd64__)))
  123. #define PC386
  124. #endif
  125. #if (defined(sun) && defined(unix) && defined(mc68020))
  126. #define SUN3
  127. #endif
  128. #if (defined(sun) && defined(unix) && defined(sparc))
  129. #define SUN4
  130. #endif
  131. #if defined(sparc) || defined(__sparc__)
  132. /* maybe SUN4_29 if only addresses <2^29 are supported */
  133. #endif
  134. #if defined(hp9000s800) || defined(__hp9000s800)
  135. #define HP8XX
  136. #endif
  137. #endif
  138. /* Determine the processor:
  139. MC680X0 == all processors of the Motorola 68000 series
  140. MC680Y0 == all processors of the Motorola 68000 series, starting at MC68020
  141. SPARC == the Sun SPARC processor
  142. HPPA == all processors of the HP Precision Architecture
  143. MIPS == all processors of the MIPS series
  144. M88000 == all processors of the Motorola 88000 series
  145. POWERPC == the IBM RS/6000 and PowerPC processor family
  146. I80386 == all processors of the Intel 8086 series, starting at 80386,
  147. nowadays called IA32
  148. VAX == the VAX processor
  149. ARM == the ARM processor
  150. DECALPHA == the DEC Alpha superchip
  151. IA64 == the Intel IA-64 latecomer chip
  152. AMD64 == the AMD hammer chip
  153. S390 == the IBM S/390 processor */
  154. #if defined(__vax__)
  155. #define VAX
  156. #endif
  157. #if defined(arm) || defined(__arm) || defined(__arm__)
  158. #define ARM
  159. #endif
  160. #ifdef WIN32
  161. #if defined(_M_IX86) || defined(_X86_)
  162. #define I80386
  163. #endif
  164. #endif
  165. #ifdef GENERIC_UNIX
  166. #if defined(m68k) || defined(__m68k__) || defined(mc68000)
  167. #define MC680X0
  168. #endif
  169. #if defined(mc68020) || defined(__mc68020__) || (defined(m68k) && defined(NeXT))
  170. #define MC680X0
  171. #define MC680Y0
  172. #endif
  173. #if defined(i386) || defined(__i386) || defined(__i386__) || defined(_I386)
  174. #define I80386
  175. #endif
  176. #if defined(sparc) || defined(__sparc__)
  177. #define SPARC
  178. #if defined(__sparcv9) || defined(__arch64__)
  179. #define SPARC64
  180. #endif
  181. #endif
  182. #if defined(mips) || defined(__mips) || defined(__mips__)
  183. #define MIPS
  184. #if defined(_MIPS_SZLONG)
  185. #if (_MIPS_SZLONG == 64)
  186. /* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */
  187. #define MIPS64
  188. #endif
  189. #endif
  190. #endif
  191. #if defined(HP8XX) || defined(hppa) || defined(__hppa) || defined(__hppa__)
  192. #define HPPA
  193. #endif
  194. #if defined(m88000) || defined(__m88k__)
  195. #define M88000
  196. #endif
  197. #if defined(_IBMR2) || defined(__powerpc) || defined(__ppc) || defined(__ppc__) || defined(__powerpc__)
  198. #define POWERPC
  199. #endif
  200. #ifdef __alpha
  201. #define DECALPHA
  202. #endif
  203. #ifdef __ia64__
  204. #define IA64
  205. #endif
  206. #if defined(__x86_64__) || defined(__amd64__)
  207. #define AMD64
  208. #endif
  209. #ifdef __s390__
  210. #define S390
  211. #endif
  212. #endif
  213. /* Selection of the operating system */
  214. #ifdef WIN32
  215. /* Windows NT, Windows 95 */
  216. #define WIN32_NATIVE /* native NT API, no DOS calls */
  217. #endif
  218. #ifdef GENERIC_UNIX
  219. #define UNIX
  220. #ifdef __linux__
  221. #define UNIX_LINUX /* Linux (Linus Torvalds Unix) */
  222. #endif
  223. #ifdef __GNU__
  224. #define UNIX_HURD /* the GNU system (Hurd + glibc) */
  225. #endif
  226. #ifdef __NetBSD__
  227. #define UNIX_NETBSD
  228. #endif
  229. #if defined(__FreeBSD__) || defined(__DragonFly__)
  230. /* FreeBSD or its fork called DragonFly BSD. */
  231. #define UNIX_FREEBSD
  232. #endif
  233. #ifdef __OpenBSD__
  234. #define UNIX_OPENBSD
  235. #endif
  236. #if defined(hpux) || defined(__hpux)
  237. #define UNIX_HPUX /* HP-UX */
  238. #endif
  239. #if defined(SVR3) || defined(__SVR3) || defined(SVR4) || defined(__SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4) || defined(__svr4__) || defined(USG) || defined(UNIX_HPUX) /* ?? */
  240. #define UNIX_SYSV /* UNIX System V */
  241. #endif
  242. #if defined(UNIX_SYSV) && (defined(sgi) || defined(__sgi))
  243. #define UNIX_IRIX /* Irix */
  244. #if defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4)
  245. #define UNIX_IRIX5 /* Irix 5 */
  246. #endif
  247. #endif
  248. #if defined(MIPS) && (defined(ultrix) || defined(__ultrix))
  249. #define UNIX_DEC_ULTRIX /* DEC's (or IBM's ?) RISC/OS Ultrix on DEC MIPS */
  250. #ifdef __GNUC__
  251. #define UNIX_DEC_ULTRIX_GCCBUG /* work around a bug in GCC 2.3.3 */
  252. #endif
  253. #endif
  254. #if defined(MIPS) && defined(sinix) /* && defined(SNI) */
  255. #define UNIX_SINIX /* Siemens is nix */
  256. #endif
  257. #if defined(USL) || (defined(__svr4__) && defined(I80386) && !defined(__sun))
  258. /* A couple of Unices for 386s (all running under different names)
  259. derive from USL SysV R 4:
  260. 386 UHC UNIX System V release 4
  261. Consensys System V 4.2
  262. Onsite System V 4.2
  263. SINIX-Z
  264. DYNIX/ptx V4.1.3
  265. SunOS 5 */
  266. #define UNIX_SYSV_USL /* Unix System V R 4 by AT&T's subsidiary USL */
  267. #define UNIX_SYSV_UHC_1 /* treat like HPPA && UNIX_HPUX */
  268. #ifdef SNI
  269. #define UNIX_SINIX /* Siemens is nix */
  270. #endif
  271. #endif
  272. #if defined(_SEQUENT_) && !defined(__svr4__)
  273. #define UNIX_SYSV_PTX /* Dynix/ptx v. 2 or 3 */
  274. #endif
  275. #ifdef _AIX
  276. #define UNIX_AIX /* IBM AIX */
  277. #endif
  278. #ifdef DGUX
  279. #define UNIX_DGUX /* Data General DG/UX */
  280. #endif
  281. #ifdef __osf__
  282. #define UNIX_OSF /* OSF/1 */
  283. #endif
  284. #ifdef AUX
  285. #define UNIX_AUX /* Apple A/UX, a spiced-up SVR2 */
  286. #endif
  287. #ifdef NeXT
  288. #define UNIX_NEXTSTEP /* NeXTstep */
  289. #endif
  290. #if defined(__APPLE__) && defined(__MACH__)
  291. #define UNIX_MACOSX /* MacOS X */
  292. #endif
  293. #ifdef AMIX
  294. #define UNIX_AMIX /* Amiga UNIX */
  295. #endif
  296. #ifdef __CYGWIN32__
  297. #define UNIX_CYGWIN32 /* Cygwin32 (UNIXlike on WinNT/Win95) */
  298. #endif
  299. #ifdef __BEOS__
  300. #define UNIX_BEOS /* BeOS (UNIXlike) */
  301. #endif
  302. #endif
  303. %% #ifdef WIN32_NATIVE
  304. %% puts("#define WIN32_NATIVE");
  305. %% #endif
  306. %% #ifdef UNIX
  307. %% puts("#define UNIX");
  308. %% #endif
  309. /* Determine properties of compiler and environment: */
  310. #if defined(UNIX) || defined(__MINGW32__)
  311. #include "config.h" /* configuration generated by configure */
  312. #include "intparam.h" /* integer-type characteristics created by the machine */
  313. #include "floatparam.h" /* floating-point type characteristics */
  314. #elif defined(WIN32) && !defined(__MINGW32__)
  315. #include "version.h" /* defines PACKAGE_* */
  316. #define char_bitsize 8
  317. #define short_bitsize 16
  318. #define int_bitsize 32
  319. #if defined(I80386)
  320. #define long_bitsize 32
  321. #elif defined(DECALPHA)
  322. #define long_bitsize 64
  323. #endif
  324. #if defined(I80386)
  325. #define pointer_bitsize 32
  326. #elif defined(DECALPHA)
  327. #define pointer_bitsize 64
  328. #endif
  329. #define alignment_long 4
  330. #if defined(I80386) || defined(VAX) || defined(ARM) || defined(DECALPHA)
  331. #define short_little_endian
  332. #define long_little_endian
  333. #endif
  334. #define stack_grows_down
  335. #define CODE_ADDRESS_RANGE 0
  336. #define MALLOC_ADDRESS_RANGE 0
  337. #define SHLIB_ADDRESS_RANGE 0
  338. #define STACK_ADDRESS_RANGE ~0UL
  339. #define ICONV_CONST
  340. #else
  341. #error "where is the configuration for your platform?"
  342. #endif
  343. /* A more precise classification of the operating system: */
  344. #if defined(UNIX) && defined(SIGNALBLOCK_BSD) && !defined(SIGNALBLOCK_SYSV)
  345. #define UNIX_BSD /* BSD Unix */
  346. #endif
  347. #if (defined(SUN3) || defined(SUN386) || defined(SUN4)) && defined(HAVE_MMAP) && defined(HAVE_VADVISE)
  348. #define UNIX_SUNOS4 /* Sun OS Version 4 */
  349. #endif
  350. #if (defined(SUN4) || (defined(I80386) && defined(__svr4__) && defined(__sun))) && !defined(HAVE_VADVISE) /* && !defined(HAVE_GETPAGESIZE) */
  351. #define UNIX_SUNOS5 /* Sun OS Version 5.[1-5] (Solaris 2) */
  352. #endif
  353. #if defined(UNIX_MACOSX) && !defined(HAVE_MSYNC)
  354. #define UNIX_RHAPSODY /* MacOS X Server, a.k.a. Rhapsody */
  355. #endif
  356. #if defined(UNIX_MACOSX) && defined(HAVE_MSYNC)
  357. #define UNIX_DARWIN /* MacOS X, a.k.a. Darwin */
  358. #endif
  359. /* Choose the character set: */
  360. #if defined(UNIX) || defined(WIN32)
  361. #define ISOLATIN_CHS /* ISO 8859-1, see isolatin.chs */
  362. /* Most Unix systems today support the ISO Latin-1 character set, in
  363. particular because they have X11 and the X11 fonts are in ISO Latin-1.
  364. Exceptions below.
  365. On Win32, the standard character set is ISO-8859-1. Only the DOS box
  366. displays CP437, but we convert from ISO-8859-1 to CP437 in the
  367. low-level output routine full_write(). */
  368. #endif
  369. #ifdef UNIX_BEOS
  370. /* The default encoding on BeOS is UTF-8, not ISO 8859-1.
  371. If compiling with Unicode support, we use it. Else fall back to ASCII. */
  372. #undef ISOLATIN_CHS
  373. #ifdef UNICODE
  374. #define UTF8_CHS /* UTF-8 */
  375. #endif
  376. #endif
  377. #ifdef HP8XX
  378. #undef ISOLATIN_CHS
  379. #define HPROMAN8_CHS /* HP-Roman8, see hproman8.chs */
  380. /* under X-Term however: #define ISOLATIN_CHS ?? */
  381. #endif
  382. #ifdef UNIX_NEXTSTEP
  383. #undef ISOLATIN_CHS
  384. #define NEXTSTEP_CHS /* NeXTstep, see nextstep.chs */
  385. #endif
  386. #if !(defined(ISOLATIN_CHS) || defined(HPROMAN8_CHS) || defined(NEXTSTEP_CHS))
  387. #define ASCII_CHS /* Default: plain ASCII charset without special chars */
  388. #endif
  389. /* Choose the compiler: */
  390. #if defined(__GNUC__)
  391. #define GNU
  392. #endif
  393. #if defined(__STDC__) || defined(__BORLANDC__) || defined(__cplusplus)
  394. /* ANSI C compilers define __STDC__ (but some define __STDC__=0 !).
  395. Borland C has an ANSI preprocessor and compiler, but fails to define
  396. __STDC__.
  397. HP aCC is an example of a C++ compiler which defines __cplusplus but
  398. not __STDC__. */
  399. #define ANSI
  400. #endif
  401. #if defined(_MSC_VER)
  402. #define MICROSOFT
  403. #endif
  404. #if defined(__BORLANDC__)
  405. #define BORLAND
  406. #endif
  407. #if defined(__INTEL_COMPILER)
  408. #define INTEL
  409. #endif
  410. /* Selection of floating-point capabilities:
  411. FAST_DOUBLE should be defined if there is a floating-point coprocessor
  412. with a 'double'-type IEEE-Floating-Points with 64 Bits.
  413. FAST_FLOAT should be defined if there is a floating-point co-processor
  414. with a 'float'-type IEEE-Floating-Points with 32 Bits,
  415. and a C-Compiler that generates 'float'-operations
  416. instead of 'double'-operations */
  417. #if (float_mant_bits == 24) && (float_rounds == rounds_to_nearest) && float_rounds_correctly && !defined(FLOAT_OVERFLOW_EXCEPTION) && !defined(FLOAT_UNDERFLOW_EXCEPTION) && !defined(FLOAT_INEXACT_EXCEPTION)
  418. #define FAST_FLOAT
  419. #endif
  420. #if (double_mant_bits == 53) && (double_rounds == rounds_to_nearest) && double_rounds_correctly && !defined(DOUBLE_OVERFLOW_EXCEPTION) && !defined(DOUBLE_UNDERFLOW_EXCEPTION) && !defined(DOUBLE_INEXACT_EXCEPTION)
  421. #define FAST_DOUBLE
  422. #endif
  423. #ifdef ARM
  424. /* The processor is little-endian w.r.t. integer types but stores 'double'
  425. floats in big-endian word order! */
  426. #undef FAST_DOUBLE
  427. #endif
  428. #ifdef NO_FAST_DOUBLE
  429. #undef FAST_DOUBLE
  430. #endif
  431. #ifdef NO_FAST_FLOAT
  432. #undef FAST_FLOAT
  433. #endif
  434. /* Selection of the language: */
  435. #ifdef ENGLISH
  436. #undef ENGLISH
  437. #define ENGLISH 1
  438. #define LANGUAGE_STATIC
  439. #endif
  440. /* Selection of the safety-level:
  441. SAFETY=0 : all optimizations are turned on
  442. SAFETY=1 : all optimizations on, but keep STACKCHECKs
  443. SAFETY=2 : only simple assembler-support
  444. SAFETY=3 : no optimizations */
  445. #ifndef SAFETY
  446. #define SAFETY 0
  447. #endif
  448. #if SAFETY >= 3
  449. #define NO_ASM
  450. #define NO_ARI_ASM
  451. #define NO_FAST_DISPATCH
  452. #endif
  453. /* We don't support pre-ANSI-C compilers any more. */
  454. #if !defined(ANSI)
  455. #error "An ANSI C or C++ compiler is required to compile CLISP!"
  456. #endif
  457. /* gcc-2.7.2 has a bug: it interpretes `const' as meaning `not modified by
  458. other parts of the program', and thus miscompiles at least justify_empty_2
  459. and pr_enter_1 in io.d. */
  460. #if defined(GNU) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 7)
  461. #undef const
  462. #define const
  463. #define __const const
  464. /* We define __const to const, not to empty, to avoid warnings on
  465. UNIX_RHAPSODY, which unconditionally defines __const to const when
  466. <sys/cdefs.h> is included via <setjmp.h> below. */
  467. #ifdef MULTITHREAD
  468. #warning "Multithreading will not be efficient because of a workaround to a gcc bug."
  469. #warning "Get a newer version of gcc."
  470. #endif
  471. #endif
  472. /* A property of the processor:
  473. The sequence in which words/long-words are being put into bytes */
  474. #if defined(short_little_endian) || defined(int_little_endian) || defined(long_little_endian)
  475. /* Z80, VAX, I80386, DECALPHA, MIPSEL, IA64, AMD64, ...:
  476. Low Byte is the lowest, High Byte in a higher address */
  477. #if defined(BIG_ENDIAN_P)
  478. #error "Bogus BIG_ENDIAN_P -- set BIG_ENDIAN_P again!"
  479. #endif
  480. #define BIG_ENDIAN_P 0
  481. #endif
  482. #if defined(short_big_endian) || defined(int_big_endian) || defined(long_big_endian)
  483. /* MC680X0, SPARC, HPPA, MIPSEB, M88000, POWERPC, S390, ...:
  484. High Byte is the lowest, Low Byte is a higher adress (easier to read) */
  485. #if defined(BIG_ENDIAN_P)
  486. #error "Bogus BIG_ENDIAN_P -- set BIG_ENDIAN_P again"
  487. #endif
  488. #define BIG_ENDIAN_P 1
  489. #endif
  490. #if !defined(BIG_ENDIAN_P)
  491. #error "Bogus BIG_ENDIAN_P -- set BIG_ENDIAN_P again!"
  492. #endif
  493. %% export_def(BIG_ENDIAN_P);
  494. /* A property of the processor (and C compiler): The alignment of C functions.
  495. (See gcc's machine descriptions, macro FUNCTION_BOUNDARY, for information.) */
  496. #if defined(IA64)
  497. #define C_CODE_ALIGNMENT 16
  498. #define log2_C_CODE_ALIGNMENT 4
  499. #endif
  500. #if defined(DECALPHA)
  501. #define C_CODE_ALIGNMENT 8
  502. #define log2_C_CODE_ALIGNMENT 3
  503. #endif
  504. #if (defined(I80386) && defined(GNU)) || defined(SPARC) || defined(MIPS) || defined(M88000) || defined(POWERPC) || defined(ARM) || defined(AMD64) || defined(S390)
  505. /* When using gcc on i386, this assumes that -malign-functions has not been
  506. used to specify an alignment smaller than 4 bytes. */
  507. #define C_CODE_ALIGNMENT 4
  508. #define log2_C_CODE_ALIGNMENT 2
  509. #endif
  510. #if defined(HPPA)
  511. /* A function pointer on hppa is either
  512. - a code pointer == 0 mod 4, or
  513. - a pointer to a two-word structure (first word: a code pointer,
  514. second word: a value which will be put in register %r19),
  515. incremented by 2, hence == 2 mod 4.
  516. The current compilers only emit the second kind of function pointers,
  517. hence we can assume that all function pointers are == 2 mod 4. */
  518. #define C_CODE_ALIGNMENT 2
  519. #define log2_C_CODE_ALIGNMENT 1
  520. #endif
  521. #if defined(MC680X0)
  522. #define C_CODE_ALIGNMENT 2
  523. #define log2_C_CODE_ALIGNMENT 1
  524. #endif
  525. #if !defined(C_CODE_ALIGNMENT) /* e.g. (defined(I80386) && defined(MICROSOFT)) */
  526. #define C_CODE_ALIGNMENT 1
  527. #define log2_C_CODE_ALIGNMENT 0
  528. #endif
  529. /* Flags for the system's include files. */
  530. #ifdef MULTITHREAD
  531. #if defined(UNIX_GNU) || defined(UNIX_SUNOS5)
  532. #define _REENTRANT
  533. #endif
  534. #if defined(__GNUC__)
  535. #define per_thread __thread
  536. #else
  537. #error "how does your compiler specify per-thread storage class?"
  538. #endif
  539. #else
  540. #define per_thread
  541. #endif
  542. /* Width of object representation:
  543. WIDE means than an object (pointer) occupies 64 bits (instead of 32 bits).
  544. WIDE_HARD means on a 64-bit platform.
  545. WIDE_SOFT means on a 32-bit platform, each object pointer occupies 2 words.
  546. WIDE_AUXI means on a 32-bit platform, each object occupies 2 words, the
  547. pointer and some auxiliary word. */
  548. #if defined(DECALPHA) || defined(MIPS64) || defined(SPARC64) || defined(IA64) || defined(AMD64)
  549. #define WIDE_HARD
  550. #endif
  551. #if defined(WIDE_SOFT_LARGEFIXNUM) && !defined(WIDE_SOFT)
  552. #define WIDE_SOFT
  553. #endif
  554. #if defined(WIDE) && !(defined(WIDE_HARD) || defined(WIDE_SOFT) || defined(WIDE_AUXI))
  555. #define WIDE_SOFT
  556. #endif
  557. #if (defined(WIDE_HARD) || defined(WIDE_SOFT) || defined(WIDE_AUXI)) && !defined(WIDE)
  558. #define WIDE
  559. #endif
  560. /* Now: defined(WIDE) == defined(WIDE_HARD) || defined(WIDE_SOFT) || defined(WIDE_AUXI) */
  561. /* Global register declarations.
  562. Speed benefit: Just putting the STACK into a register, brought 5% of speed
  563. around 1992. Now, with an AMD Athlon CPU from 2000, with good caches, it
  564. still brings 4%.
  565. The declarations must occur before any system include files define any
  566. inline function, which is the case on UNIX_DGUX and UNIX_GNU.
  567. Only GCC supports global register variables. Not Apple's variant of GCC.
  568. And only the C frontend, not the C++ frontend, understands the syntax.
  569. And gcc-3.0 to 3.3.3 has severe bugs with global register variables, see
  570. CLISP bugs 710737 and 723097 and
  571. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7871
  572. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10684
  573. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14937
  574. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14938
  575. Likewise, gcc-4.2 has severe bugs with global register variables, see
  576. CLISP bug 1836142 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34300
  577. Likewise for gcc-4.3-20080215 and probably future versions of GCC as well.
  578. Therefore for these versions of gcc enable the global register variables
  579. only when USE_GCC_REGISTER_VARIABLES is explicitly defined. */
  580. #if defined(GNU) && !(__APPLE_CC__ > 1) && !defined(__cplusplus) && !(__GNUC__ == 3 && (__GNUC_MINOR__ < 3 || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 4))) && !(((__GNUC__ == 4 && __GNUC_MINOR__ >= 2) || __GNUC__ > 4) && !defined(USE_GCC_REGISTER_VARIABLES)) && !defined(MULTITHREAD) && (SAFETY < 2) && !defined(USE_JITC)
  581. /* Overview of use of registers in gcc terminology:
  582. fixed: mentioned in FIXED_REGISTERS
  583. used: mentioned in CALL_USED_REGISTERS but not FIXED_REGISTERS
  584. (i.e. caller-saved)
  585. save: otherwise (i.e. call-preserved, callee-saved)
  586. STACK mv_count value1 back_trace
  587. MC680X0 used
  588. I80386 save
  589. SPARC (gcc2) fixed fixed fixed used
  590. MIPS
  591. HPPA save save save save
  592. M88000 save save save
  593. ARM save
  594. DECALPHA save save save
  595. IA64
  596. AMD64
  597. S390 save
  598. Special notes:
  599. - gcc3/Sparc (Linux & Solaris) handles registers differently from gcc2. FIXME
  600. - If STACK is in a "used"/"save" register, it needs to be saved into
  601. saved_STACK upon begin_call(), so that asynchronous interrupts will
  602. be able to restore it.
  603. - All of the "used" registers need to be backed up upon begin_call()
  604. and restored during end_call().
  605. - All of the "save" registers need to be backed up upon begin_callback()
  606. and restored during end_callback().
  607. - When the interpreter does a longjmp(), the registers STACK, mv_count,
  608. value1 may need to be temporarily saved. This is highly machine
  609. dependent and is indicated by the NEED_temp_xxxx macros.
  610. * Register for STACK. */
  611. #if defined(MC680X0)
  612. #define STACK_register "a4" /* highest address register after sp=A7,fp=A6/A5 */
  613. #endif
  614. #if defined(I80386) && !defined(UNIX_BEOS) && !defined(DYNAMIC_MODULES)
  615. /* On BeOS, everything is compiled as PIC, hence %ebx is already booked.
  616. If DYNAMIC_MODULES is defined, external modules are compiled as PIC,
  617. which is why %ebx is already in use. */
  618. #if (__GNUC__ >= 2) /* The register names have changed */
  619. #define STACK_register "%ebx" /* one of the call-saved registers without special hardware commands */
  620. #else
  621. #define STACK_register "bx"
  622. #endif
  623. #endif
  624. #if defined(SPARC)
  625. #define STACK_register "%g5" /* a global register */
  626. #endif
  627. #if defined(HPPA) && (__GNUC__*100 + __GNUC_MINOR__ >= 2*100+7) /* gcc versions earlier than 2.7 had bugs */
  628. #define STACK_register "%r10" /* one of the general registers %r5..%r18 */
  629. #endif
  630. #if defined(M88000)
  631. #define STACK_register "%r14" /* one of the general registers %r14..%r25 */
  632. #endif
  633. #if defined(ARM)
  634. #define STACK_register "%r8" /* one of the general registers %r4..%r8 */
  635. #endif
  636. #if defined(DECALPHA)
  637. #define STACK_register "$9" /* one of the general registers $9..$14 */
  638. #endif
  639. #if defined(S390) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
  640. /* global register assignment did not work on s390 until gcc 3.1 */
  641. #define STACK_register "9" /* one of the general registers %r8..%r9 */
  642. #endif
  643. /* What about NEED_temp_STACK ?? Needed if STACK is in a "used" register??
  644. Register for mv_count. */
  645. #if defined(SPARC)
  646. #define mv_count_register "%g6"
  647. #if defined(UNIX_NETBSD)
  648. #define NEED_temp_mv_count
  649. #endif
  650. #endif
  651. #if defined(HPPA)
  652. #define mv_count_register "%r11" /* one of the general registers %r5..%r18 */
  653. #define NEED_temp_mv_count
  654. #endif
  655. #if defined(M88000)
  656. #define mv_count_register "%r15" /* one of the general registers %r14..%r25 */
  657. #define NEED_temp_mv_count
  658. #endif
  659. #if defined(DECALPHA)
  660. #define mv_count_register "$10" /* one of the general registers $9..$14 */
  661. #define NEED_temp_mv_count
  662. #endif
  663. /* Register for value1. */
  664. #if !(defined(WIDE) && !defined(WIDE_HARD))
  665. #if defined(SPARC)
  666. #define value1_register "%g7"
  667. #if defined(UNIX_NETBSD)
  668. #define NEED_temp_value1
  669. #endif
  670. #endif
  671. #if defined(HPPA)
  672. #define value1_register "%r12" /* one of the general registers %r5..%r18 */
  673. #define NEED_temp_value1
  674. #endif
  675. #if defined(M88000)
  676. #define value1_register "%r16" /* one of the general registers %r14..%r25 */
  677. #define NEED_temp_value1
  678. #endif
  679. #if defined(DECALPHA)
  680. #define value1_register "$11" /* one of the general registers $9..$14 */
  681. #define NEED_temp_value1
  682. #endif
  683. #endif
  684. /* Register for back_trace. */
  685. #if !(defined(WIDE) && !defined(WIDE_HARD))
  686. #if defined(SPARC)
  687. #define back_trace_register "%g4" /* a global register */
  688. /* %g4 seems to be a scratch-register as of lately with gcc 2.3
  689. This causes problems with libc.so.1.6.1 (and higher) (in getwd())
  690. That's why HAVE_SAVED_back_trace has been defined above. */
  691. #endif
  692. #if defined(HPPA)
  693. #define back_trace_register "%r13" /* one of the general registers %r5..%r18 */
  694. #endif
  695. #endif
  696. /* Declare the registers now (before any system include file which could
  697. contain some inline functions). */
  698. #ifdef STACK_register
  699. register long STACK_reg __asm__(STACK_register);
  700. #endif
  701. #ifdef mv_count_register
  702. register long mv_count_reg __asm__(mv_count_register);
  703. #endif
  704. #ifdef value1_register
  705. register long value1_reg __asm__(value1_register);
  706. #endif
  707. #ifdef back_trace_register
  708. register long back_trace_reg __asm__(back_trace_register);
  709. #endif
  710. /* Saving "save" registers. */
  711. #if (defined(I80386) || defined(HPPA) || defined(M88000) || defined(ARM) || defined(DECALPHA) || defined(S390)) && (defined(STACK_register) || defined(mv_count_register) || defined(value1_register) || defined(back_trace_register))
  712. #define HAVE_SAVED_REGISTERS
  713. struct registers {
  714. #ifdef STACK_register
  715. long STACK_register_contents;
  716. #endif
  717. #ifdef mv_count_register
  718. long mv_count_register_contents;
  719. #endif
  720. #ifdef value1_register
  721. long value1_register_contents;
  722. #endif
  723. #ifdef back_trace_register
  724. long back_trace_register_contents;
  725. #endif
  726. };
  727. extern per_thread struct registers * callback_saved_registers;
  728. #ifdef STACK_register
  729. #define SAVE_STACK_register(registers) \
  730. registers->STACK_register_contents = STACK_reg
  731. #define RESTORE_STACK_register(registers) \
  732. STACK_reg = registers->STACK_register_contents
  733. #else
  734. #define SAVE_STACK_register(registers)
  735. #define RESTORE_STACK_register(registers)
  736. #endif
  737. #ifdef mv_count_register
  738. #define SAVE_mv_count_register(registers) \
  739. registers->mv_count_register_contents = mv_count_reg
  740. #define RESTORE_mv_count_register(registers) \
  741. mv_count_reg = registers->mv_count_register_contents
  742. #else
  743. #define SAVE_mv_count_register(registers)
  744. #define RESTORE_mv_count_register(registers)
  745. #endif
  746. #ifdef value1_register
  747. #define SAVE_value1_register(registers) \
  748. registers->value1_register_contents = value1_reg
  749. #define RESTORE_value1_register(registers) \
  750. value1_reg = registers->value1_register_contents
  751. #else
  752. #define SAVE_value1_register(registers)
  753. #define RESTORE_value1_register(registers)
  754. #endif
  755. #ifdef back_trace_register
  756. #define SAVE_back_trace_register(registers) \
  757. registers->back_trace_register_contents = back_trace_reg
  758. #define RESTORE_back_trace_register(registers) \
  759. back_trace_reg = registers->back_trace_register_contents
  760. #else
  761. #define SAVE_back_trace_register(registers)
  762. #define RESTORE_back_trace_register(registers)
  763. #endif
  764. #define SAVE_REGISTERS(inner_statement) \
  765. do { \
  766. var struct registers * registers = alloca(sizeof(struct registers)); \
  767. SAVE_STACK_register(registers); \
  768. SAVE_mv_count_register(registers); \
  769. SAVE_value1_register(registers); \
  770. SAVE_back_trace_register(registers); \
  771. inner_statement; \
  772. { var gcv_object_t* top_of_frame = STACK; \
  773. pushSTACK(fake_gcv_object((aint)callback_saved_registers)); \
  774. finish_frame(CALLBACK); \
  775. } \
  776. callback_saved_registers = registers; \
  777. } while(0)
  778. #define RESTORE_REGISTERS(inner_statement) \
  779. do { \
  780. var struct registers * registers = callback_saved_registers; \
  781. if (!(framecode(STACK_0) == CALLBACK_frame_info)) abort(); \
  782. callback_saved_registers = (struct registers *)(aint)as_oint(STACK_1);\
  783. skipSTACK(2); \
  784. inner_statement; \
  785. RESTORE_STACK_register(registers); \
  786. RESTORE_mv_count_register(registers); \
  787. RESTORE_value1_register(registers); \
  788. RESTORE_back_trace_register(registers); \
  789. } while(0)
  790. #endif
  791. /* Saving the STACK (for asynchronous interrupts).
  792. If STACK is a global variable or lies in a register which is left
  793. untouched by operating system and library (this is the case on SUN4),
  794. we don't need to worry about it. */
  795. #if defined(STACK_register) && !defined(SUN4)
  796. #define HAVE_SAVED_STACK
  797. #endif
  798. /* Saving "used" registers. */
  799. #if defined(mv_count_register) && 0
  800. #define HAVE_SAVED_mv_count
  801. #endif
  802. #if defined(value1_register) && 0
  803. #define HAVE_SAVED_value1
  804. #endif
  805. #if defined(back_trace_register) && defined(SPARC)
  806. #define HAVE_SAVED_back_trace
  807. #endif
  808. #endif
  809. #ifndef HAVE_SAVED_REGISTERS
  810. #define SAVE_REGISTERS(inner_statement)
  811. #define RESTORE_REGISTERS(inner_statement)
  812. #endif
  813. %% #ifdef HAVE_SAVED_REGISTERS
  814. %% puts("#ifndef IN_MODULE_CC");
  815. %% #ifdef STACK_register
  816. %% printf("register long STACK_reg __asm__(\"%s\");\n",STACK_register);
  817. %% #endif
  818. %% #ifdef mv_count_register
  819. %% printf("register long mv_count_reg __asm__(\"%s\");\n",mv_count_register);
  820. %% #endif
  821. %% #ifdef value1_register
  822. %% printf("register long value1_reg __asm__(\"%s\");\n",value1_register);
  823. %% #endif
  824. %% #ifdef back_trace_register
  825. %% printf("register long back_trace_reg __asm__(\"%s\");\n",back_trace_register);
  826. %% #endif
  827. %% printf("struct registers { ");
  828. %% #ifdef STACK_register
  829. %% printf("long STACK_register_contents; ");
  830. %% #endif
  831. %% #ifdef mv_count_register
  832. %% printf("long mv_count_register_contents; ");
  833. %% #endif
  834. %% #ifdef value1_register
  835. %% printf("long value1_register_contents; ");
  836. %% #endif
  837. %% #ifdef back_trace_register
  838. %% printf("long back_trace_register_contents; ");
  839. %% #endif
  840. %% puts("};");
  841. %% puts("extern struct registers * callback_saved_registers;");
  842. %% puts("#endif");
  843. %% #endif
  844. #define VALUES_IF(cond) \
  845. do { value1 = (cond) ? T : NIL; mv_count = 1; } while (0)
  846. %% export_def(VALUES_IF(C));
  847. #define VALUES0 \
  848. do { value1 = NIL; mv_count = 0; } while (0)
  849. %% export_def(VALUES0);
  850. #define VALUES1(A) \
  851. do { value1 = (A); mv_count = 1; } while (0)
  852. %% export_def(VALUES1(A));
  853. #define VALUES2(A,B) \
  854. do { value1 = (A); value2 = (B); mv_count = 2; } while (0)
  855. %% export_def(VALUES2(A,B));
  856. #define VALUES3(A,B,C) \
  857. do { value1 = (A); value2 = (B); value3 = (C); mv_count = 3; } while (0)
  858. %% export_def(VALUES3(A,B,C));
  859. /* ###################### Macros for C #################### */
  860. #if !defined(return_void)
  861. /* To return a type of value void: return_void(...); */
  862. #ifdef GNU
  863. #define return_void return /* 'return void;' is admissible */
  864. #else
  865. /* In general it is not legal to return `void' values. */
  866. #define return_void /* Don't use 'return' for expressions of type 'void'. */
  867. #endif
  868. #endif
  869. #if defined(GNU) && defined(__GNUG__)
  870. /* Although legal, g++ warns about 'return void;'. Shut up the warning. */
  871. #undef return_void
  872. #define return_void
  873. #endif
  874. #if !defined(GNU) && !defined(inline)
  875. #define inline /* inline foo() {...} --> foo() {...} */
  876. #endif
  877. %% puts("#if !defined(__GNUC__) && !defined(inline)");
  878. %% puts("#define inline");
  879. %% puts("#endif");
  880. /* Definitions for C++-Compilers: */
  881. #ifdef __cplusplus
  882. #define BEGIN_DECLS extern "C" {
  883. #define END_DECLS }
  884. #else
  885. #define BEGIN_DECLS
  886. #define END_DECLS
  887. #endif
  888. %% export_def(BEGIN_DECLS);
  889. %% export_def(END_DECLS);
  890. /* Empty macro-arguments:
  891. Some compilers (ie. cc under HP-UX) seem to interpret a macro call
  892. foo(arg1,...,argn,) as equivalent to foo(arg1,...,argn), which will
  893. yield an error. _EMA_ stands for "empty macro argument".
  894. It will be inserted by CC_NEED_DEEMA,
  895. each time between comma and closing parentheses.
  896. It is also needed when potentially empty arguments
  897. are returned to other macros */
  898. #define _EMA_
  899. /* Concatenation of two macro-expanded tokens:
  900. Example:
  901. #undef x
  902. #define y 16
  903. CONCAT(x,y) ==> 'x16' (not 'xy' !) */
  904. #define CONCAT_(xxx,yyy) xxx##yyy
  905. #define CONCAT3_(aaa,bbb,ccc) aaa##bbb##ccc
  906. #define CONCAT4_(aaa,bbb,ccc,ddd) aaa##bbb##ccc##ddd
  907. #define CONCAT5_(aaa,bbb,ccc,ddd,eee) aaa##bbb##ccc##ddd##eee
  908. #define CONCAT6_(aaa,bbb,ccc,ddd,eee,fff) aaa##bbb##ccc##ddd##eee##fff
  909. #define CONCAT7_(aaa,bbb,ccc,ddd,eee,fff,ggg) aaa##bbb##ccc##ddd##eee##fff##ggg
  910. #define CONCAT(xxx,yyy) CONCAT_(xxx,yyy)
  911. #define CONCAT3(aaa,bbb,ccc) CONCAT3_(aaa,bbb,ccc)
  912. #define CONCAT4(aaa,bbb,ccc,ddd) CONCAT4_(aaa,bbb,ccc,ddd)
  913. #define CONCAT5(aaa,bbb,ccc,ddd,eee) CONCAT5_(aaa,bbb,ccc,ddd,eee)
  914. #define CONCAT6(aaa,bbb,ccc,ddd,eee,fff) CONCAT6_(aaa,bbb,ccc,ddd,eee,fff)
  915. #define CONCAT7(aaa,bbb,ccc,ddd,eee,fff,ggg) CONCAT7_(aaa,bbb,ccc,ddd,eee,fff,ggg)
  916. %% puts("#define CONCAT_(xxx,yyy) xxx##yyy");
  917. %% puts("#define CONCAT3_(aaa,bbb,ccc) aaa##bbb##ccc");
  918. %% #if notused
  919. %% puts("#define CONCAT4_(aaa,bbb,ccc,ddd) aaa##bbb##ccc##ddd");
  920. %% puts("#define CONCAT5_(aaa,bbb,ccc,ddd,eee) aaa##bbb##ccc##ddd##eee");
  921. %% #endif
  922. %% puts("#define CONCAT(xxx,yyy) CONCAT_(xxx,yyy)");
  923. %% puts("#define CONCAT3(aaa,bbb,ccc) CONCAT3_(aaa,bbb,ccc)");
  924. %% #if notused
  925. %% puts("#define CONCAT4(aaa,bbb,ccc,ddd) CONCAT4_(aaa,bbb,ccc,ddd)");
  926. %% puts("#define CONCAT5(aaa,bbb,ccc,ddd,eee) CONCAT5_(aaa,bbb,ccc,ddd,eee)");
  927. %% #endif
  928. /* Generation of goto-tag macros:
  929. GENTAG(end) ==> end116
  930. This allows a macro defining marks to be used more than once per function
  931. but still only once per source-line. */
  932. #define GENTAG(xxx) CONCAT(xxx,__LINE__)
  933. /* Converting tokens to strings:
  934. STRING(token) ==> "token" */
  935. #define STRING(token) #token
  936. #define STRINGIFY(token) STRING(token)
  937. %% puts("#define STRING(token) #token");
  938. %% puts("#define STRINGIFY(token) STRING(token)");
  939. /* Storage-Class-Specifier in top-level-declarations:
  940. for variables:
  941. global globally visible variable
  942. local variable that is only visible in the file (local)
  943. extern pointer to a variable that's defined externally
  944. for functions:
  945. global globally visible function
  946. local function that is only visible in the file (local)
  947. extern pointer to a function that's defined externally
  948. extern_C pointer to a c-function that's defined externally
  949. nonreturning function that will never return
  950. maygc function that can trigger GC */
  951. #define global
  952. #define local static
  953. /* #define extern extern */
  954. #ifdef __cplusplus
  955. #define extern_C extern "C"
  956. #else
  957. #define extern_C extern
  958. #endif
  959. /* Declaration of a function that will never return (nonreturning function)
  960. nonreturning_function(extern,abort,(void)); == extern void abort (void); */
  961. #if defined(GNU) && !(__APPLE_CC__ > 1)
  962. #if (__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))
  963. /* Note:
  964. storclass __attribute__((__noreturn__)) void funname arguments
  965. works in gcc 2.95 or newer, and in g++ 2.7.2 or newer.
  966. storclass void __attribute__((__noreturn__)) funname arguments
  967. works in gcc 2.7.2 or newer and in g++ 2.7.2 or newer.
  968. storclass void funname arguments __attribute__((__noreturn__))
  969. works in gcc 2.7.2 or newer and in g++ 2.7.2 or newer, but
  970. only when followed by a semicolon, not in a function definition. */
  971. #define nonreturning_function(storclass,funname,arguments) \
  972. storclass void __attribute__((__noreturn__)) funname arguments
  973. #else
  974. #define nonreturning_function(storclass,funname,arguments) \
  975. storclass void funname arguments
  976. #endif
  977. #elif defined(MICROSOFT)
  978. #define nonreturning_function(storclass,funname,arguments) \
  979. __declspec(noreturn) storclass void funname arguments
  980. #else
  981. #define nonreturning_function(storclass,funname,arguments) \
  982. storclass void funname arguments
  983. #endif
  984. %% export_def(nonreturning_function(storclass,funname,arguments));
  985. /* A function that can trigger GC is declared either as
  986. - maygc, if (1) all callers must assume the worst case: that it triggers GC,
  987. and (2) the function uses only the 'object's passed as arguments and
  988. on the STACK, but no objects stored in other non-GCsafe locations.
  989. - /*maygc*/ otherwise. If (1) is not fulfilled, the functions begins
  990. with an appropriate GCTRIGGER_IF statement. If (2) is not
  991. fulfilled, the GCTRIGGER call needs to mention all other
  992. non-GCsafe locations whose values are used by the function,
  993. such as 'value1' or 'mv_space'. */
  994. #define maygc
  995. /* Storage-Class-Specifier in declarations at the beginning of a block:
  996. var will lead a variable declaration
  997. used by utils/varbrace to allow declarations mixed with other statements */
  998. #define var
  999. /* Ignore C++ keyword. */
  1000. #define export export_sym
  1001. /* Swap the contents of two variables: swap(register int, x1, x2); */
  1002. #define swap(swap_type,swap_var1,swap_var2) \
  1003. do { var swap_type swap_temp; \
  1004. swap_temp = swap_var1; swap_var1 = swap_var2; swap_var2 = swap_temp; \
  1005. } while(0)
  1006. /* Marking a program line that may not be reached: NOTREACHED; */
  1007. #define NOTREACHED error_notreached(__FILE__,__LINE__)
  1008. %% puts("#define NOTREACHED error_notreached(__FILE__,__LINE__)");
  1009. /* Asserting an arithmetic expression: ASSERT(expr); */
  1010. #define ASSERT(expr) do { if (!(expr)) NOTREACHED; } while(0)
  1011. %% puts("#define ASSERT(expr) do { if (!(expr)) NOTREACHED; } while(0)");
  1012. /* alloca() */
  1013. #ifdef GNU
  1014. #define alloca __builtin_alloca
  1015. #elif defined(MICROSOFT)
  1016. #include <malloc.h>
  1017. #define alloca _alloca
  1018. #elif defined(HAVE_ALLOCA_H)
  1019. #include <alloca.h>
  1020. #ifndef alloca /* Manche definieren 'alloca' als Macro... */
  1021. #if !(defined(UNIX_OSF) || defined(UNIX_DEC_ULTRIX))
  1022. /* OSF/1 V3 declares `alloca' as returning char*, but in OSF/1 V4
  1023. it returns void*. I don't know how to distinguish the two. */
  1024. extern_C void* alloca (int size); /* see MALLOC(3V) */
  1025. #endif
  1026. #endif
  1027. #elif defined(_AIX)
  1028. #pragma alloca /* AIX requires this to be the first thing in the file. */
  1029. #elif defined(BORLAND)
  1030. #include <malloc.h> /* defines 'alloca' as macro */
  1031. #elif !defined(NO_ALLOCA)
  1032. extern_C void* alloca (int size); /* see MALLOC(3V) */
  1033. #endif
  1034. %% #ifdef GNU
  1035. %% emit_define("alloca","__builtin_alloca");
  1036. %% #elif defined(MICROSOFT)
  1037. %% puts("#include <malloc.h>");
  1038. %% emit_define("alloca","_alloca");
  1039. %% #elif defined(HAVE_ALLOCA_H)
  1040. %% puts("#include <alloca.h>");
  1041. %% #ifndef alloca
  1042. %% #if !(defined(UNIX_OSF) || defined(UNIX_DEC_ULTRIX))
  1043. %% puts("extern void* alloca (int size);");
  1044. %% #endif
  1045. %% #endif
  1046. %% #elif defined(_AIX)
  1047. %% puts("#pragma alloca");
  1048. %% #elif !defined(NO_ALLOCA)
  1049. %% puts("extern void* alloca (int size);");
  1050. %% #endif
  1051. #define MALLOC(size,type) (type*)malloc((size)*sizeof(type))
  1052. /* Literal constants of 64-bit integer types
  1053. LL(nnnn) = nnnn parsed as a sint64
  1054. ULL(nnnn) = nnnn parsed as a uint64 */
  1055. #if defined(HAVE_LONG_LONG_INT)
  1056. #define LL(nnnn) nnnn##LL
  1057. #define ULL(nnnn) nnnn##ULL
  1058. #elif defined(MICROSOFT)
  1059. #define LL(nnnn) nnnn##i64
  1060. #define ULL(nnnn) nnnn##ui64
  1061. #endif
  1062. %% #if defined(HAVE_LONG_LONG_INT)
  1063. %% puts("#define LL(nnnn) nnnn##LL");
  1064. %% puts("#define ULL(nnnn) nnnn##ULL");
  1065. %% #elif defined(MICROSOFT)
  1066. %% puts("#define LL(nnnn) nnnn##i64");
  1067. %% puts("#define ULL(nnnn) nnnn##ui64");
  1068. %% #endif
  1069. /* Synonyms for Byte, Word, Longword:
  1070. SBYTE = signed 8 bit integer
  1071. UBYTE = unsigned 8 bit int
  1072. SWORD = signed 16 bit int
  1073. UWORD = unsigned 16 bit int
  1074. SLONG = signed 32 bit int
  1075. ULONG = unsigned 32 bit int
  1076. On the other hand, "char" is only used as an element of a string
  1077. You never really compute with a "char"; it might depend on
  1078. __CHAR_UNSIGNED___! */
  1079. #if (char_bitsize==8)
  1080. #ifdef __CHAR_UNSIGNED__
  1081. typedef signed char SBYTE;
  1082. #else
  1083. typedef char SBYTE;
  1084. #endif
  1085. typedef unsigned char UBYTE;
  1086. #else
  1087. #error "No 8 bit integer type? -- Which Interger-type has 8 Bit?"
  1088. #endif
  1089. #if (short_bitsize==16)
  1090. typedef short SWORD;
  1091. typedef unsigned short UWORD;
  1092. #else
  1093. #error "No 16 bit integer type? -- Which Integer-type has 16 Bit?"
  1094. #endif
  1095. #if (long_bitsize==32)
  1096. typedef long SLONG;
  1097. typedef unsigned long ULONG;
  1098. #elif (int_bitsize==32)
  1099. typedef int SLONG;
  1100. typedef unsigned int ULONG;
  1101. #else
  1102. #error "No 32 bit integer type? -- Which Integer-type has 32 Bit?"
  1103. #endif
  1104. #if (long_bitsize==64)
  1105. typedef long SLONGLONG;
  1106. typedef unsigned long ULONGLONG;
  1107. #ifndef HAVE_LONG_LONG_INT
  1108. #define HAVE_LONG_LONG_INT
  1109. #endif
  1110. #elif defined(MICROSOFT)
  1111. typedef __int64 SLONGLONG;
  1112. typedef unsigned __int64 ULONGLONG;
  1113. #define HAVE_LONG_LONG_INT
  1114. #elif defined(HAVE_LONG_LONG_INT)
  1115. #if defined(long_long_bitsize) && (long_long_bitsize==64)
  1116. typedef long long SLONGLONG;
  1117. typedef unsigned long long ULONGLONG;
  1118. #else /* useless type */
  1119. #undef HAVE_LONG_LONG_INT
  1120. #endif
  1121. #endif
  1122. #if defined(WIDE) && !defined(HAVE_LONG_LONG_INT)
  1123. #error "No 64 bit integer type? -- Which Integer-type has 64 Bit?"
  1124. #endif
  1125. %% #ifdef __CHAR_UNSIGNED__
  1126. %% emit_typedef("signed char","SBYTE");
  1127. %% #else
  1128. %% emit_typedef("char","SBYTE");
  1129. %% #endif
  1130. %% emit_typedef("unsigned char","UBYTE");
  1131. %% emit_typedef("short","SWORD");
  1132. %% emit_typedef("unsigned short","UWORD");
  1133. %% #if (long_bitsize==32)
  1134. %% emit_typedef("long","SLONG");
  1135. %% emit_typedef("unsigned long","ULONG");
  1136. %% #elif (int_bitsize==32)
  1137. %% emit_typedef("int","SLONG");
  1138. %% emit_typedef("unsigned int","ULONG");
  1139. %% #endif
  1140. %% #if (long_bitsize==64)
  1141. %% emit_typedef("long","SLONGLONG");
  1142. %% emit_typedef("unsigned long","ULONGLONG");
  1143. %% #elif defined(MICROSOFT)
  1144. %% emit_typedef("__int64","SLONGLONG");
  1145. %% emit_typedef("unsigned __int64","ULONGLONG");
  1146. %% #elif defined(HAVE_LONG_LONG_INT)
  1147. %% emit_typedef("long long","SLONGLONG");
  1148. %% emit_typedef("unsigned long long","ULONGLONG");
  1149. %% #endif
  1150. #include <stdbool.h> /* boolean values */
  1151. %% #ifdef HAVE_STDBOOL_H
  1152. %% puts("#include <stdbool.h>");
  1153. %% #else
  1154. %% print_file("stdbool.h");
  1155. %% #endif
  1156. /* Type for signed values, results of comparisons, tertiary enums
  1157. with values +1, 0, -1 */
  1158. typedef signed int signean;
  1159. #define signean_plus 1 /* +1 */
  1160. #define signean_null 0 /* 0 */
  1161. #define signean_minus -1 /* -1 */
  1162. /* Null pointers */
  1163. #ifdef __cplusplus
  1164. #undef NULL
  1165. #define NULL 0
  1166. #elif !(defined(INTEL) || defined(_AIX))
  1167. #undef NULL
  1168. #define NULL ((void*) 0L)
  1169. #endif
  1170. %% puts("#undef NULL");
  1171. %% export_def(NULL);
  1172. #include <stdio.h> /* libc i/o */
  1173. /* A more precise classification of the operating system:
  1174. (This test works only after at least one system header has been included.) */
  1175. #if (__GLIBC__ >= 2)
  1176. #define UNIX_GNU /* glibc2 (may be UNIX_LINUX, UNIX_HURD or UNIX_FREEBSD) */
  1177. #endif
  1178. /* Determine the offset of a component 'ident' in a struct of the type 'type':
  1179. See 0 as pointer to 'type', put a struct 'type' there and determine the
  1180. address of its component 'ident' and return it as number: */
  1181. #if defined(HAVE_OFFSETOF) || defined(__MINGW32__) || (defined(BORLAND) && defined(WIN32)) || defined(MICROSOFT)
  1182. #include <stddef.h>
  1183. #else
  1184. #undef offsetof
  1185. #define o

Large files files are truncated, but you can click here to view the full file