__scm.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. /* classes: h_files */
  2. #ifndef SCM___SCM_H
  3. #define SCM___SCM_H
  4. /* Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2, or (at your option)
  9. * any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this software; see the file COPYING. If not, write to
  18. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19. * Boston, MA 02110-1301 USA
  20. *
  21. * As a special exception, the Free Software Foundation gives permission
  22. * for additional uses of the text contained in its release of GUILE.
  23. *
  24. * The exception is that, if you link the GUILE library with other files
  25. * to produce an executable, this does not by itself cause the
  26. * resulting executable to be covered by the GNU General Public License.
  27. * Your use of that executable is in no way restricted on account of
  28. * linking the GUILE library code into it.
  29. *
  30. * This exception does not however invalidate any other reasons why
  31. * the executable file might be covered by the GNU General Public License.
  32. *
  33. * This exception applies only to the code released by the
  34. * Free Software Foundation under the name GUILE. If you copy
  35. * code from other Free Software Foundation releases into a copy of
  36. * GUILE, as the General Public License permits, the exception does
  37. * not apply to the code that you add in this way. To avoid misleading
  38. * anyone as to the status of such modified files, you must delete
  39. * this exception notice from them.
  40. *
  41. * If you write modifications of your own for GUILE, it is your choice
  42. * whether to permit this exception to apply to your modifications.
  43. * If you do not wish that, delete this exception notice. */
  44. /* "What's the difference between _scm.h and __scm.h?"
  45. _scm.h is not installed; it's only visible to the libguile sources
  46. themselves.
  47. __scm.h is installed, and is #included by <libguile.h>. If both
  48. the client and libguile need some piece of information, and it
  49. doesn't fit well into the header file for any particular module, it
  50. should go in __scm.h. */
  51. /* {Compiler hints}
  52. *
  53. * The following macros are used to provide additional information for the
  54. * compiler, which may help to do better error checking and code
  55. * optimization. A second benefit of these macros is, that they also provide
  56. * additional information to the developers.
  57. */
  58. /* The macro SCM_NORETURN indicates that a function will never return.
  59. * Examples:
  60. * 1) int foo (char arg) SCM_NORETURN;
  61. */
  62. #ifdef __GNUC__
  63. #define SCM_NORETURN __attribute__ ((noreturn))
  64. #else
  65. #define SCM_NORETURN
  66. #endif
  67. /* The macro SCM_UNUSED indicates that a function, function argument or
  68. * variable may potentially be unused.
  69. * Examples:
  70. * 1) static int unused_function (char arg) SCM_UNUSED;
  71. * 2) int foo (char unused_argument SCM_UNUSED);
  72. * 3) int unused_variable SCM_UNUSED;
  73. */
  74. #ifdef __GNUC__
  75. #define SCM_UNUSED __attribute__ ((unused))
  76. #else
  77. #define SCM_UNUSED
  78. #endif
  79. /* {Supported Options}
  80. *
  81. * These may be defined or undefined.
  82. */
  83. /* Old async mechanism */
  84. /* #define GUILE_OLD_ASYNC_CLICK */
  85. /* #define GUILE_DEBUG_FREELIST */
  86. /* If the compile FLAG `SCM_CAUTIOUS' is #defined then the number of
  87. * arguments is always checked for application of closures. If the
  88. * compile FLAG `SCM_RECKLESS' is #defined then they are not checked.
  89. * Otherwise, number of argument checks for closures are made only when
  90. * the function position (whose value is the closure) of a combination is
  91. * not an ILOC or GLOC. When the function position of a combination is a
  92. * symbol it will be checked only the first time it is evaluated because
  93. * it will then be replaced with an ILOC or GLOC.
  94. */
  95. #undef SCM_RECKLESS
  96. #define SCM_CAUTIOUS
  97. /* After looking up a local for the first time, rewrite the
  98. * code graph, caching its position.
  99. */
  100. #define MEMOIZE_LOCALS
  101. /* All the number support there is.
  102. */
  103. #define BIGNUMS
  104. /* GC should relinquish empty cons-pair arenas. */
  105. /* cmm:FIXME look at this after done mangling the GC */
  106. /* #define GC_FREE_SEGMENTS */
  107. /* Provide a scheme-accessible count-down timer that
  108. * generates a pseudo-interrupt.
  109. */
  110. #define TICKS
  111. /* Use engineering notation when converting numbers strings?
  112. */
  113. #undef ENGNOT
  114. /* {Unsupported Options}
  115. *
  116. * These must be defined as given here.
  117. */
  118. #define CCLO
  119. /* Guile Scheme supports the #f/() distinction; Guile Lisp won't. We
  120. have horrible plans for their unification. */
  121. #undef SICP
  122. /* Random options (not yet supported or in final form). */
  123. #define STACK_CHECKING
  124. #undef NO_CEVAL_STACK_CHECKING
  125. /* What did the configure script discover about the outside world? */
  126. #include "libguile/scmconfig.h"
  127. /* {Debugging Options}
  128. *
  129. * These compile time options determine whether to include code that is only
  130. * useful for debugging guile itself or C level extensions to guile. The
  131. * common prefix for all option macros of this kind is "SCM_DEBUG_". It is
  132. * guaranteed that a macro named SCM_DEBUG_XXX is defined to be either 0 or 1,
  133. * i. e. there is no need to test for the undefined case. This allows to use
  134. * these definitions comfortably in macro code, as in the following example:
  135. * #define FOO do { if (SCM_DEBUG_XXX) bar(); else baz(); } while (0)
  136. * Any sane compiler will remove the unused branch without any performance
  137. * penalty for the resulting code.
  138. *
  139. * Note: Some SCM_DEBUG_XXX options are not settable at configure time.
  140. * To change the value of such options you will have to edit this header
  141. * file or give suitable options to make, like:
  142. * make all CFLAGS="-DSCM_DEBUG_XXX=1 ..."
  143. */
  144. /* The value of SCM_DEBUG determines the default for most of the not yet
  145. * defined debugging options. This allows, for example, to enable most of the
  146. * debugging options by simply defining SCM_DEBUG as 1.
  147. */
  148. #ifndef SCM_DEBUG
  149. #define SCM_DEBUG 0
  150. #endif
  151. /* If SCM_DEBUG_CELL_ACCESSES is set to 1, cell accesses will perform
  152. * exhaustive parameter checking: It will be verified that cell parameters
  153. * actually point to a valid heap cell. Note: If this option is enabled,
  154. * guile will run about ten times slower than normally.
  155. */
  156. #ifndef SCM_DEBUG_CELL_ACCESSES
  157. #define SCM_DEBUG_CELL_ACCESSES SCM_DEBUG
  158. #endif
  159. /* If SCM_DEBUG_DEPRECATED is set to 1, deprecated code is not compiled. This
  160. * can be used by developers to get rid of references to deprecated code.
  161. */
  162. #ifndef SCM_DEBUG_DEPRECATED
  163. #define SCM_DEBUG_DEPRECATED SCM_DEBUG
  164. #endif
  165. /* If SCM_DEBUG_INTERRUPTS is set to 1, with every deferring and allowing of
  166. * interrupts a consistency check will be performed.
  167. */
  168. #ifndef SCM_DEBUG_INTERRUPTS
  169. #define SCM_DEBUG_INTERRUPTS SCM_DEBUG
  170. #endif
  171. /* If SCM_DEBUG_PAIR_ACCESSES is set to 1, accesses to cons cells will be
  172. * exhaustively checked. Note: If this option is enabled, guile will run
  173. * slower than normally.
  174. */
  175. #ifndef SCM_DEBUG_PAIR_ACCESSES
  176. #define SCM_DEBUG_PAIR_ACCESSES SCM_DEBUG
  177. #endif
  178. /* If SCM_DEBUG_REST_ARGUMENT is set to 1, functions that take rest arguments
  179. * will check whether the rest arguments are actually passed as a proper list.
  180. * Otherwise, if SCM_DEBUG_REST_ARGUMENT is 0, functions that take rest
  181. * arguments will take it for granted that these are passed as a proper list.
  182. */
  183. #ifndef SCM_DEBUG_REST_ARGUMENT
  184. #define SCM_DEBUG_REST_ARGUMENT SCM_DEBUG
  185. #endif
  186. /* Use this for _compile time_ type checking only, since the compiled result
  187. * will be quite inefficient. The right way to make use of this option is to
  188. * do a 'make clean; make CFLAGS=-DSCM_DEBUG_TYPING_STRICTNESS=1', fix your
  189. * errors, and then do 'make clean; make'.
  190. */
  191. #ifndef SCM_DEBUG_TYPING_STRICTNESS
  192. #define SCM_DEBUG_TYPING_STRICTNESS 1
  193. #endif
  194. /* If SCM_ENABLE_VCELLS is set to 1, a couple of functions that deal
  195. * with vcells are defined for compatability reasons. Supporting
  196. * vcells reduces performance however.
  197. *
  198. * We use a dedicated macro instead of just SCM_DEBUG_DEPRECATED so
  199. * that code the belongs to the `vcell' feature is easier to find.
  200. */
  201. #define SCM_ENABLE_VCELLS !SCM_DEBUG_DEPRECATED
  202. #ifdef HAVE_LONG_LONGS
  203. /* Some auto-generated .h files contain unused prototypes
  204. * that need these typedefs.
  205. */
  206. #if (SCM_DEBUG_DEPRECATED == 0)
  207. typedef long long long_long;
  208. typedef unsigned long long ulong_long;
  209. #endif
  210. #endif /* HAVE_LONG_LONGS */
  211. /* {Architecture and compiler properties}
  212. *
  213. * Guile as of today can only work on systems which fulfill at least the
  214. * following requirements:
  215. * - long ints have at least 32 bits.
  216. * Guile's type system is based on this assumption.
  217. * - long ints consist of at least four characters.
  218. * It is assumed that cells, i. e. pairs of long ints, are eight character
  219. * aligned, because three bits of a cell pointer are used for type data.
  220. * - sizeof (void*) == sizeof (long int)
  221. * Pointers are stored in SCM objects, and sometimes SCM objects are passed
  222. * as void*. Thus, there has to be a one-to-one correspondence.
  223. * - numbers are encoded using two's complement.
  224. * The implementation of the bitwise scheme level operations is based on
  225. * this assumption.
  226. * - ... add more
  227. */
  228. #ifndef HAVE_PTRDIFF_T
  229. typedef long ptrdiff_t;
  230. #endif
  231. #ifdef HAVE_LIMITS_H
  232. # include <limits.h>
  233. #endif
  234. #ifdef CHAR_BIT
  235. # define SCM_CHAR_BIT CHAR_BIT
  236. #else
  237. # define SCM_CHAR_BIT 8
  238. #endif
  239. #ifdef LONG_BIT
  240. # define SCM_LONG_BIT LONG_BIT
  241. #else
  242. # define SCM_LONG_BIT (SCM_CHAR_BIT * sizeof (long) / sizeof (char))
  243. #endif
  244. #ifdef UCHAR_MAX
  245. # define SCM_CHAR_CODE_LIMIT (UCHAR_MAX + 1L)
  246. #else
  247. # define SCM_CHAR_CODE_LIMIT 256L
  248. #endif
  249. #ifdef STDC_HEADERS
  250. # include <stdlib.h>
  251. # if HAVE_SYS_TYPES_H
  252. # include <sys/types.h>
  253. # endif
  254. # if HAVE_SYS_STDTYPES_H
  255. # include <sys/stdtypes.h>
  256. # endif
  257. # include <stddef.h>
  258. #endif /* def STDC_HEADERS */
  259. #if (SCM_DEBUG_DEPRECATED == 0)
  260. # define scm_sizet size_t
  261. #endif
  262. #include "libguile/tags.h"
  263. #ifdef vms
  264. # ifndef CHEAP_CONTINUATIONS
  265. typedef int jmp_buf[17];
  266. extern int setjump(jmp_buf env);
  267. extern int longjump(jmp_buf env, int ret);
  268. # define setjmp setjump
  269. # define longjmp longjump
  270. # else
  271. # include <setjmp.h>
  272. # endif
  273. #else /* ndef vms */
  274. # ifdef _CRAY1
  275. typedef int jmp_buf[112];
  276. extern int setjump(jmp_buf env);
  277. extern int longjump(jmp_buf env, int ret);
  278. # define setjmp setjump
  279. # define longjmp longjump
  280. # else /* ndef _CRAY1 */
  281. # include <setjmp.h>
  282. # endif /* ndef _CRAY1 */
  283. #endif /* ndef vms */
  284. /* James Clark came up with this neat one instruction fix for
  285. * continuations on the SPARC. It flushes the register windows so
  286. * that all the state of the process is contained in the stack.
  287. */
  288. #if defined (sparc) || defined (__sparc__) || defined (__sparc)
  289. # define SCM_FLUSH_REGISTER_WINDOWS asm("ta 3")
  290. #else
  291. # define SCM_FLUSH_REGISTER_WINDOWS /* empty */
  292. #endif
  293. /* If stack is not longword aligned then
  294. */
  295. /* #define SHORT_ALIGN */
  296. #ifdef THINK_C
  297. # define SHORT_ALIGN
  298. #endif
  299. #ifdef MSDOS
  300. # define SHORT_ALIGN
  301. #endif
  302. #ifdef atarist
  303. # define SHORT_ALIGN
  304. #endif
  305. #ifdef SHORT_ALIGN
  306. typedef short SCM_STACKITEM;
  307. #else
  308. typedef long SCM_STACKITEM;
  309. #endif
  310. #ifndef USE_THREADS
  311. #define SCM_CRITICAL_SECTION_START
  312. #define SCM_CRITICAL_SECTION_END
  313. #define SCM_THREAD_SWITCHING_CODE
  314. #endif
  315. #ifdef GUILE_OLD_ASYNC_CLICK
  316. extern unsigned int scm_async_clock;
  317. #define SCM_ASYNC_TICK \
  318. do { \
  319. if (0 == --scm_async_clock) \
  320. scm_async_click (); \
  321. } while(0)
  322. #else
  323. extern int scm_asyncs_pending_p;
  324. #define SCM_ASYNC_TICK /*fixme* should change names */ \
  325. do { \
  326. if (scm_asyncs_pending_p) \
  327. scm_async_click (); \
  328. } while (0)
  329. #endif
  330. #if (SCM_DEBUG_INTERRUPTS == 1)
  331. #include <stdio.h>
  332. #define SCM_CHECK_NOT_DISABLED \
  333. do { \
  334. if (scm_ints_disabled) \
  335. fprintf(stderr, "ints already disabled (at %s:%d)\n", \
  336. __FILE__, __LINE__); \
  337. } while (0)
  338. #define SCM_CHECK_NOT_ENABLED \
  339. do { \
  340. if (!scm_ints_disabled) \
  341. fprintf(stderr, "ints already enabled (at %s:%d)\n", \
  342. __FILE__, __LINE__); \
  343. } while (0)
  344. #else
  345. #define SCM_CHECK_NOT_DISABLED
  346. #define SCM_CHECK_NOT_ENABLED
  347. #endif
  348. /* Anthony Green writes:
  349. When the compiler sees...
  350. DEFER_INTS;
  351. [critical code here]
  352. ALLOW_INTS;
  353. ...it doesn't actually promise to keep the critical code within the
  354. boundries of the DEFER/ALLOW_INTS instructions. It may very well
  355. schedule it outside of the magic defined in those macros.
  356. However, GCC's volatile asm feature forms a barrier over which code is
  357. never moved. So if you add...
  358. asm ("");
  359. ...to each of the DEFER_INTS and ALLOW_INTS macros, the critical
  360. code will always remain in place. asm's without inputs or outputs
  361. are implicitly volatile. */
  362. #ifdef __GNUC__
  363. #define SCM_FENCE asm /* volatile */ ("")
  364. #else
  365. #define SCM_FENCE
  366. #endif
  367. #define SCM_DEFER_INTS \
  368. do { \
  369. SCM_FENCE; \
  370. SCM_CHECK_NOT_DISABLED; \
  371. SCM_CRITICAL_SECTION_START; \
  372. SCM_FENCE; \
  373. scm_ints_disabled = 1; \
  374. SCM_FENCE; \
  375. } while (0)
  376. #define SCM_ALLOW_INTS_ONLY \
  377. do { \
  378. SCM_CRITICAL_SECTION_END; \
  379. scm_ints_disabled = 0; \
  380. } while (0)
  381. #define SCM_ALLOW_INTS \
  382. do { \
  383. SCM_FENCE; \
  384. SCM_CHECK_NOT_ENABLED; \
  385. SCM_CRITICAL_SECTION_END; \
  386. SCM_FENCE; \
  387. scm_ints_disabled = 0; \
  388. SCM_FENCE; \
  389. SCM_THREAD_SWITCHING_CODE; \
  390. SCM_FENCE; \
  391. } while (0)
  392. #define SCM_REDEFER_INTS \
  393. do { \
  394. SCM_FENCE; \
  395. SCM_CRITICAL_SECTION_START; \
  396. ++scm_ints_disabled; \
  397. SCM_FENCE; \
  398. } while (0)
  399. #define SCM_REALLOW_INTS \
  400. do { \
  401. SCM_FENCE; \
  402. SCM_CRITICAL_SECTION_END; \
  403. SCM_FENCE; \
  404. --scm_ints_disabled; \
  405. SCM_FENCE; \
  406. } while (0)
  407. #define SCM_TICK \
  408. do { \
  409. SCM_ASYNC_TICK; \
  410. SCM_THREAD_SWITCHING_CODE; \
  411. } while (0)
  412. /* Classification of critical sections
  413. *
  414. * When Guile moves to POSIX threads, it won't be possible to prevent
  415. * context switching. In fact, the whole idea of context switching is
  416. * bogus if threads are run by different processors. Therefore, we
  417. * must ultimately eliminate all critical sections or enforce them by
  418. * use of mutecis.
  419. *
  420. * All instances of SCM_DEFER_INTS and SCM_ALLOW_INTS should therefore
  421. * be classified and replaced by one of the delimiters below. If you
  422. * understand what this is all about, I'd like to encourage you to
  423. * help with this task. The set of classes below must of course be
  424. * incrementally augmented.
  425. *
  426. * MDJ 980419 <djurfeldt@nada.kth.se>
  427. */
  428. /* A sections
  429. *
  430. * Allocation of a cell with type tag in the CAR.
  431. *
  432. * With POSIX threads, each thread will have a private pool of free
  433. * cells. Therefore, this type of section can be removed. But! It
  434. * is important that the CDR is initialized first (with the CAR still
  435. * indicating a free cell) so that we can guarantee a consistent heap
  436. * at all times.
  437. */
  438. #define SCM_ENTER_A_SECTION SCM_CRITICAL_SECTION_START
  439. #define SCM_EXIT_A_SECTION SCM_CRITICAL_SECTION_END
  440. /** SCM_ASSERT
  441. **
  442. **/
  443. #ifdef SCM_RECKLESS
  444. #define SCM_ASSERT(_cond, _arg, _pos, _subr)
  445. #define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg)
  446. #define SCM_ASRTGO(_cond, _label)
  447. #else
  448. #define SCM_ASSERT(_cond, _arg, _pos, _subr) \
  449. if (!(_cond)) \
  450. scm_wrong_type_arg (_subr, _pos, _arg)
  451. #define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg) \
  452. if (!(_cond)) \
  453. scm_wrong_type_arg_msg(_subr, _pos, _arg, _msg)
  454. #define SCM_ASRTGO(_cond, _label) \
  455. if (!(_cond)) \
  456. goto _label
  457. #endif
  458. /*
  459. * SCM_WTA_DISPATCH
  460. */
  461. /* Dirk:FIXME:: In all of the SCM_WTA_DISPATCH_* macros it is assumed that
  462. * 'gf' is zero if uninitialized. It would be cleaner if some valid SCM value
  463. * like SCM_BOOL_F or SCM_UNDEFINED was chosen.
  464. */
  465. extern SCM scm_call_generic_0 (SCM gf);
  466. #define SCM_WTA_DISPATCH_0(gf, subr) \
  467. return (SCM_UNPACK (gf) \
  468. ? scm_call_generic_0 ((gf)) \
  469. : (scm_error_num_args_subr ((subr)), SCM_UNSPECIFIED))
  470. #define SCM_GASSERT0(cond, gf, subr) \
  471. if (!(cond)) SCM_WTA_DISPATCH_0((gf), (subr))
  472. extern SCM scm_call_generic_1 (SCM gf, SCM a1);
  473. #define SCM_WTA_DISPATCH_1(gf, a1, pos, subr) \
  474. return (SCM_UNPACK (gf) \
  475. ? scm_call_generic_1 ((gf), (a1)) \
  476. : (scm_wrong_type_arg ((subr), (pos), (a1)), SCM_UNSPECIFIED))
  477. #define SCM_GASSERT1(cond, gf, a1, pos, subr) \
  478. if (!(cond)) SCM_WTA_DISPATCH_1((gf), (a1), (pos), (subr))
  479. extern SCM scm_call_generic_2 (SCM gf, SCM a1, SCM a2);
  480. #define SCM_WTA_DISPATCH_2(gf, a1, a2, pos, subr) \
  481. return (SCM_UNPACK (gf) \
  482. ? scm_call_generic_2 ((gf), (a1), (a2)) \
  483. : (scm_wrong_type_arg ((subr), (pos), \
  484. (pos) == SCM_ARG1 ? (a1) : (a2)), \
  485. SCM_UNSPECIFIED))
  486. #define SCM_GASSERT2(cond, gf, a1, a2, pos, subr) \
  487. if (!(cond)) SCM_WTA_DISPATCH_2((gf), (a1), (a2), (pos), (subr))
  488. extern SCM scm_apply_generic (SCM gf, SCM args);
  489. #define SCM_WTA_DISPATCH_n(gf, args, pos, subr) \
  490. return (SCM_UNPACK (gf) \
  491. ? scm_apply_generic ((gf), (args)) \
  492. : (scm_wrong_type_arg ((subr), (pos), \
  493. scm_list_ref ((args), \
  494. SCM_MAKINUM ((pos) - 1))), \
  495. SCM_UNSPECIFIED))
  496. #define SCM_GASSERTn(cond, gf, args, pos, subr) \
  497. if (!(cond)) SCM_WTA_DISPATCH_n((gf), (args), (pos), (subr))
  498. #ifndef SCM_MAGIC_SNARFER
  499. /* Let these macros pass through if
  500. we are snarfing; thus we can tell the
  501. difference between the use of an actual
  502. number vs. the use of one of these macros --
  503. actual numbers in SCM_VALIDATE_* and SCM_ASSERT
  504. constructs must match the formal argument name,
  505. but using SCM_ARG* avoids the test */
  506. #define SCM_ARGn 0
  507. #define SCM_ARG1 1
  508. #define SCM_ARG2 2
  509. #define SCM_ARG3 3
  510. #define SCM_ARG4 4
  511. #define SCM_ARG5 5
  512. #define SCM_ARG6 6
  513. #define SCM_ARG7 7
  514. #if (SCM_DEBUG_DEPRECATED == 0)
  515. /* Use SCM_WRONG_NUM_ARGS instead of: */
  516. #define SCM_WNA 8
  517. /* Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of: */
  518. #define SCM_OUTOFRANGE 10
  519. /* Use scm_memory_error instead of: */
  520. #define SCM_NALLOC 11
  521. #define SCM_HUP_SIGNAL 14
  522. #define SCM_INT_SIGNAL 15
  523. #define SCM_FPE_SIGNAL 16
  524. #define SCM_BUS_SIGNAL 17
  525. #define SCM_SEGV_SIGNAL 18
  526. #define SCM_ALRM_SIGNAL 19
  527. #define SCM_GC_SIGNAL 20
  528. #define SCM_TICK_SIGNAL 21
  529. #define SCM_SIG_ORD(X) ((X) - SCM_HUP_SIGNAL)
  530. #define SCM_ORD_SIG(X) ((X) + SCM_HUP_SIGNAL)
  531. #define SCM_NUM_SIGS (SCM_SIG_ORD (SCM_TICK_SIGNAL) + 1)
  532. #endif /* SCM_DEBUG_DEPRECATED == 0 */
  533. #endif /* SCM_MAGIC_SNARFER */
  534. /* SCM_EXIT_SUCCESS is the default code to return from SCM if no errors
  535. * were encountered. SCM_EXIT_FAILURE is the default code to return from
  536. * SCM if errors were encountered. The return code can be explicitly
  537. * specified in a SCM program with (scm_quit <n>).
  538. */
  539. #ifndef SCM_EXIT_SUCCESS
  540. #ifdef vms
  541. #define SCM_EXIT_SUCCESS 1
  542. #else
  543. #define SCM_EXIT_SUCCESS 0
  544. #endif /* def vms */
  545. #endif /* ndef SCM_EXIT_SUCCESS */
  546. #ifndef SCM_EXIT_FAILURE
  547. #ifdef vms
  548. #define SCM_EXIT_FAILURE 2
  549. #else
  550. #define SCM_EXIT_FAILURE 1
  551. #endif /* def vms */
  552. #endif /* ndef SCM_EXIT_FAILURE */
  553. #endif /* SCM___SCM_H */
  554. /*
  555. Local Variables:
  556. c-file-style: "gnu"
  557. End:
  558. */