source: project/chicken/trunk/chicken.h @ 7338

Last change on this file since 7338 was 7338, checked in by felix winkelmann, 12 years ago

error-handler expected stream port for ##sys#standard-error

File size: 79.1 KB
Line 
1/* chicken.h - General headerfile for compiler generated executables
2;
3; Copyright (c) 2000-2007, Felix L. Winkelmann
4; All rights reserved.
5;
6; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
7; conditions are met:
8;
9;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
10;     disclaimer.
11;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
12;     disclaimer in the documentation and/or other materials provided with the distribution.
13;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
14;     products derived from this software without specific prior written permission.
15;
16; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
17; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
18; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
19; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24; POSSIBILITY OF SUCH DAMAGE.
25;
26; Send bugs, suggestions and ideas to:
27;
28; felix@call-with-current-continuation.org
29;
30; Felix L. Winkelmann
31; Unter den Gleichen 1
32; 37130 Gleichen
33; Germany
34*/
35
36
37/* Configuration: */
38
39#ifndef ___CHICKEN
40#define ___CHICKEN
41
42/*
43 * N.B. This file MUST not rely upon "chicken-config.h"
44 */
45#if defined(HAVE_CONFIG_H) || defined(HAVE_CHICKEN_CONFIG_H)
46# include "chicken-config.h"
47#endif
48
49#if !defined(__GNUC__) && !defined(__WATCOMC__)
50# if HAVE_ALLOCA_H
51#  include <alloca.h>
52# else
53#  ifdef _AIX
54#   pragma alloca
55#  else
56#   ifndef alloca /* predefined by HP cc +Olibcalls */
57char *alloca ();
58#   endif
59#  endif
60# endif
61#elif (defined(__sun__) && defined(__svr4__)) || defined(__sgi__)
62# if HAVE_ALLOCA_H
63#  include <alloca.h>
64# endif
65#endif
66
67#ifdef __cplusplus
68# define C_extern                  extern "C"
69# define C_BEGIN_C_DECLS           extern "C" {
70# define C_END_C_DECLS             }
71#else
72# define C_extern                  extern
73# define C_BEGIN_C_DECLS
74# define C_END_C_DECLS
75#endif
76 
77#define C_varextern                C_extern
78#define C_fctimport
79#define C_fctexport
80#define C_externimport             C_extern
81#define C_externexport             C_extern
82#if defined(PIC)
83# if defined(__CYGWIN__) || defined(__MINGW32__)
84#  ifndef C_BUILDING_LIBCHICKEN
85#   undef  C_varextern
86#   define C_varextern             C_extern __declspec(dllimport)
87#  endif
88# elif defined(_MSC_VER)
89#  undef  C_fctimport
90#  define C_fctimport              __declspec(dllexport)
91#  undef  C_externimport
92#  undef  C_externexport
93#  define C_externimport           C_extern __declspec(dllimport)
94#  define C_externexport           C_extern __declspec(dllexport)
95#  undef  C_varextern
96#  undef  C_fctexport
97#  ifdef C_BUILDING_LIBCHICKEN
98#   define C_varextern             C_extern __declspec(dllexport)
99#   define C_fctexport             __declspec(dllexport)
100#  else
101#   define C_varextern             C_extern __declspec(dllimport)
102#   define C_fctexport             __declspec(dllimport)
103#  endif
104# elif defined(__WATCOMC__)
105#  undef  C_fctimport
106#  define C_fctimport              __declspec(dllexport)
107#  undef  C_externimport
108#  undef  C_externexport
109#  define C_externexport           C_extern __declspec(dllexport)
110#  undef  C_varextern
111#  undef  C_fctexport
112#  ifdef C_BUILDING_LIBCHICKEN
113#   define C_varextern             C_extern __declspec(dllexport)
114#   define C_fctexport             __declspec(dllexport)
115#   define C_externimport          C_extern __declspec(dllexport)
116#  else
117#   define C_varextern             C_extern __declspec(dllimport)
118#   define C_fctexport             __declspec(dllimport)
119#   define C_externimport          C_extern __declspec(dllimport)
120#  endif
121# endif
122#endif
123
124#ifdef C_ENABLE_TLS
125# if defined(__GNUC__)
126#  define C_TLS                    __thread
127# elif defined(_MSC_VER)
128#  define C_TLS                    __declspec(thread)
129# endif
130#endif
131
132#ifndef C_TLS
133# define C_TLS
134#endif
135
136#ifndef C_STACK_GROWS_DOWNWARD
137# define C_STACK_GROWS_DOWNWARD    -1
138#endif
139
140#if C_STACK_GROWS_DOWNWARD == -1
141# ifdef __hppa__
142#  undef C_STACK_GROWS_DOWNWARD
143#  define C_STACK_GROWS_DOWNWARD 0
144# else
145#  undef C_STACK_GROWS_DOWNWARD
146#  define C_STACK_GROWS_DOWNWARD 1
147# endif
148#endif
149
150#if defined(C_WINDOWS_GUI)
151# define C_MICROSOFT_WINDOWS
152#else
153# define C_GENERIC_CONSOLE
154#endif
155
156#define C_TIMER_INTERRUPTS
157
158#ifdef C_DEFAULT_TARGET_STACK_SIZE
159# define C_resize_stack(n)           C_do_resize_stack(C_DEFAULT_TARGET_STACK_SIZE)
160#else
161# define C_resize_stack(n)           C_do_resize_stack(n)
162#endif
163
164#ifndef C_SIXTY_FOUR
165# if defined (__alpha__) || defined (__sparc_v9__) || defined (__sparcv9) || defined(__ia64__) || defined(__x86_64__) || defined(__LP64__)
166#   define C_SIXTY_FOUR
167# elif defined(__mips64) && (!defined(__GNUC__) || _MIPS_SZPTR == 64)
168#   define C_SIXTY_FOUR
169# endif
170#endif
171
172#if defined(__APPLE__) && defined(__MACH__)
173# define C_MACOSX
174#elif defined(__MWERKS__) && !defined(__INTEL__)
175/* This is a rather crude way of assuming this is MacOS 9 or lower! */
176# define C_MACOS
177#endif
178
179#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
180# define C_XXXBSD
181#endif
182
183#if defined(C_MACOSX) || defined(__linux__) || defined(C_XXXBSD)
184# define C_GNU_ENV
185#endif
186
187#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__DJGPP__) || defined(__MINGW32__) || defined(__WATCOMC__)
188# define C_NONUNIX
189#endif
190
191#include <stdio.h>
192#include <stdlib.h>
193#include <stdarg.h>
194#include <ctype.h>
195#include <string.h>
196#include <setjmp.h>
197#include <limits.h>
198#include <time.h>
199
200#if !defined(C_NONUNIX) || defined(__MINGW32__) || defined(__WATCOMC__)
201# include <unistd.h>
202# include <inttypes.h>
203# include <sys/types.h>
204#endif
205
206#if defined(__MINGW32__)
207# include <sys/param.h>
208#elif defined(__linux__)
209# include <endian.h>
210#elif defined(C_MACOSX) || defined(C_XXXBSD)
211# include <machine/endian.h>
212#elif defined(__hpux__)
213# include <arpa/nameser.h>
214#elif defined(_AIX)
215# include <sys/machine.h>
216#elif defined(__sun__)
217# include <sys/isa_defs.h>
218#elif defined(__svr4__)
219# include <sys/byteorder.h>
220#endif
221
222#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && __BYTE_ORDER == __BIG_ENDIAN
223# define C_BIG_ENDIAN
224#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
225# define C_BIG_ENDIAN
226#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)
227# define C_BIG_ENDIAN
228#elif defined(__sparc__) || defined(__POWERPC__) || defined(__MC68K__) || defined(__mips__)
229# define C_BIG_ENDIAN
230#endif
231
232#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN
233# define C_LITTLE_ENDIAN
234#elif defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && BYTE_ORDER == LITTLE_ENDIAN
235# define C_LITTLE_ENDIAN
236#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
237# define C_LITTLE_ENDIAN
238#elif defined (__alpha__) || defined(_M_IX86) || defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
239# define C_LITTLE_ENDIAN
240#endif
241
242#ifdef C_MACOS
243# include <alloca.h>
244int strncasecmp(const char *one, const char *two, size_t n);
245#endif
246
247#ifdef __MINGW32__
248# include <malloc.h>
249#endif
250
251#ifdef _MSC_VER
252# include <malloc.h>
253# include <io.h>
254# define alloca            _alloca
255# define strncasecmp       strnicmp
256# define isatty            _isatty
257typedef __int8             int8_t;
258typedef unsigned __int8    uint8_t;
259typedef __int16            int16_t;
260typedef unsigned  __int16  uint16_t;
261typedef __int32            int32_t;
262typedef unsigned __int32   int32_t;
263typedef __int64            uint64_t;
264typedef unsigned __int64   uint64_t;
265# pragma warning(disable: 4101)
266#endif
267
268#ifdef __WATCOMC__
269# include <malloc.h>
270#endif
271
272/* For the easy FFI: */
273
274#define ___fixnum           int
275#define ___number           double
276#define ___bool             int
277#define ___byte             char
278#define ___scheme_value     C_word
279#define ___scheme_pointer   void *
280#define ___byte_vector      unsigned char *
281#define ___symbol           char *
282#define ___safe
283#define ___declare(x, y)
284#define ___specialize
285#define ___abstract
286#define ___discard
287#define ___in
288#define ___out
289#define ___inout
290#define ___mutable
291#define ___length(var)
292#define ___pointer
293#define ___u32              C_u32
294#define ___s32              C_s32
295#define ___u64              C_u64
296#define ___s64              C_s64
297
298
299/* Constants: */
300
301#define C_STACK_RESERVE                   4096
302#define C_DEFAULT_MAX_PENDING_FINALIZERS  2048
303
304#define C_IMMEDIATE_MARK_BITS     0x00000003
305#define C_IMMEDIATE_TYPE_BITS     0x0000000f
306
307#define C_BOOLEAN_BITS            0x00000006
308#define C_CHARACTER_BITS          0x0000000a
309#define C_SPECIAL_BITS            0x0000000e
310
311#define C_SCHEME_FALSE            ((C_word)(C_BOOLEAN_BITS | 0x00000000))
312#define C_SCHEME_TRUE             ((C_word)(C_BOOLEAN_BITS | 0x00000010))
313
314#define C_SCHEME_END_OF_LIST      ((C_word)(C_SPECIAL_BITS | 0x00000000))
315#define C_SCHEME_UNDEFINED        ((C_word)(C_SPECIAL_BITS | 0x00000010))
316#define C_SCHEME_UNBOUND          ((C_word)(C_SPECIAL_BITS | 0x00000020))
317#define C_SCHEME_END_OF_FILE      ((C_word)(C_SPECIAL_BITS | 0x00000030))
318
319#define C_FIXNUM_BIT              0x00000001
320#define C_FIXNUM_SHIFT            1
321
322#define C_CHAR_BIT_MASK           0x1fffff
323
324#ifdef C_SIXTY_FOUR
325# define C_MOST_POSITIVE_FIXNUM   0x3fffffffffffffffL
326# define C_WORD_SIZE              64
327#else
328# define C_MOST_POSITIVE_FIXNUM   0x3fffffff
329# define C_WORD_SIZE              32
330#endif
331
332#define C_MOST_NEGATIVE_FIXNUM    (-C_MOST_POSITIVE_FIXNUM - 1)
333
334#ifdef C_SIXTY_FOUR
335# define C_INT_SIGN_BIT           0x8000000000000000L
336# define C_INT_TOP_BIT            0x4000000000000000L
337# define C_HEADER_BITS_MASK       0xff00000000000000L
338# define C_HEADER_TYPE_BITS       0x0f00000000000000L
339# define C_HEADER_SIZE_MASK       0x00ffffffffffffffL
340# define C_GC_FORWARDING_BIT      0x8000000000000000L   /* header contains forwarding pointer */
341# define C_BYTEBLOCK_BIT          0x4000000000000000L   /* block contains bytes instead of slots */
342# define C_SPECIALBLOCK_BIT       0x2000000000000000L   /* 1st item is a non-value */
343# define C_8ALIGN_BIT             0x1000000000000000L   /* data is aligned to 8-byte boundary */
344
345# define C_SYMBOL_TYPE            (0x0100000000000000L)
346# define C_STRING_TYPE            (0x0200000000000000L | C_BYTEBLOCK_BIT)
347# define C_PAIR_TYPE              (0x0300000000000000L)
348# define C_CLOSURE_TYPE           (0x0400000000000000L | C_SPECIALBLOCK_BIT)
349# define C_FLONUM_TYPE            (0x0500000000000000L | C_BYTEBLOCK_BIT | C_8ALIGN_BIT)
350# define C_UNUSED_TYPE            (0x0600000000000000L)
351# define C_PORT_TYPE              (0x0700000000000000L | C_SPECIALBLOCK_BIT)
352# define C_STRUCTURE_TYPE         (0x0800000000000000L)
353# define C_POINTER_TYPE           (0x0900000000000000L | C_SPECIALBLOCK_BIT)
354# define C_BUCKET_TYPE            (0x0f00000000000000L)
355# define C_LOCATIVE_TYPE          (0x0a00000000000000L | C_SPECIALBLOCK_BIT)
356# define C_TAGGED_POINTER_TYPE    (0x0b00000000000000L | C_SPECIALBLOCK_BIT)
357# define C_SWIG_POINTER_TYPE      (0x0c00000000000000L | C_BYTEBLOCK_BIT)
358# define C_LAMBDA_INFO_TYPE       (0x0d00000000000000L | C_BYTEBLOCK_BIT)
359#else
360# define C_INT_SIGN_BIT           0x80000000
361# define C_INT_TOP_BIT            0x40000000
362# define C_HEADER_BITS_MASK       0xff000000
363# define C_HEADER_TYPE_BITS       0x0f000000
364# define C_HEADER_SIZE_MASK       0x00ffffff
365# define C_GC_FORWARDING_BIT      0x80000000
366# define C_BYTEBLOCK_BIT          0x40000000
367# define C_SPECIALBLOCK_BIT       0x20000000
368# define C_8ALIGN_BIT             0x10000000
369
370# define C_SYMBOL_TYPE            (0x01000000)
371# define C_STRING_TYPE            (0x02000000 | C_BYTEBLOCK_BIT)
372# define C_PAIR_TYPE              (0x03000000)
373# define C_CLOSURE_TYPE           (0x04000000 | C_SPECIALBLOCK_BIT)
374# ifdef C_DOUBLE_IS_32_BITS
375#  define C_FLONUM_TYPE            (0x05000000 | C_BYTEBLOCK_BIT)
376# else
377#  define C_FLONUM_TYPE            (0x05000000 | C_BYTEBLOCK_BIT | C_8ALIGN_BIT)
378# endif
379# define C_UNUSED_TYPE            (0x06000000)
380# define C_PORT_TYPE              (0x07000000 | C_SPECIALBLOCK_BIT)
381# define C_STRUCTURE_TYPE         (0x08000000)
382# define C_POINTER_TYPE           (0x09000000 | C_SPECIALBLOCK_BIT)
383# define C_BUCKET_TYPE            (0x0f000000)
384# define C_LOCATIVE_TYPE          (0x0a000000 | C_SPECIALBLOCK_BIT)
385# define C_TAGGED_POINTER_TYPE    (0x0b000000 | C_SPECIALBLOCK_BIT)
386# define C_SWIG_POINTER_TYPE      (0x0c000000 | C_BYTEBLOCK_BIT)
387# define C_LAMBDA_INFO_TYPE       (0x0d000000 | C_BYTEBLOCK_BIT)
388#endif
389
390#define C_SLOT_LOCATIVE           0
391#define C_CHAR_LOCATIVE           1
392#define C_U8_LOCATIVE             2
393#define C_S8_LOCATIVE             3
394#define C_U16_LOCATIVE            4
395#define C_S16_LOCATIVE            5
396#define C_U32_LOCATIVE            6
397#define C_S32_LOCATIVE            7
398#define C_F32_LOCATIVE            8
399#define C_F64_LOCATIVE            9
400
401#define C_VECTOR_TYPE             0x00000000
402#define C_BYTEVECTOR_TYPE         (C_VECTOR_TYPE | C_BYTEBLOCK_BIT | C_8ALIGN_BIT)
403
404#define C_SIZEOF_LIST(n)          ((n) * 3 + 1)
405#define C_SIZEOF_PAIR             3
406#define C_SIZEOF_STRING(n)        (C_bytestowords(n) + 2)
407#define C_SIZEOF_SYMBOL          4
408#define C_SIZEOF_INTERNED_SYMBOL(n) (C_SIZEOF_SYMBOL + C_SIZEOF_BUCKET + C_SIZEOF_STRING(n))
409#ifdef C_DOUBLE_IS_32_BITS
410# define C_SIZEOF_FLONUM           2
411#else
412# define C_SIZEOF_FLONUM           4
413#endif
414#define C_SIZEOF_POINTER          2
415#define C_SIZEOF_TAGGED_POINTER   3
416#define C_SIZEOF_SWIG_POINTER     3
417#define C_SIZEOF_VECTOR(n)        ((n) + 1)
418#define C_SIZEOF_BUCKET           3
419#define C_SIZEOF_LOCATIVE         5
420#define C_SIZEOF_PORT             16
421
422#define C_PAIR_TAG                (C_PAIR_TYPE | (C_SIZEOF_PAIR - 1))
423#define C_POINTER_TAG             (C_POINTER_TYPE | (C_SIZEOF_POINTER - 1))
424#define C_LOCATIVE_TAG            (C_LOCATIVE_TYPE | (C_SIZEOF_LOCATIVE - 1))
425#define C_TAGGED_POINTER_TAG      (C_TAGGED_POINTER_TYPE | (C_SIZEOF_TAGGED_POINTER - 1))
426#define C_SWIG_POINTER_TAG        (C_SWIG_POINTER_TYPE | (C_wordstobytes(C_SIZEOF_SWIG_POINTER - 1)))
427#define C_SYMBOL_TAG              (C_SYMBOL_TYPE | (C_SIZEOF_SYMBOL - 1))
428#define C_FLONUM_TAG             (C_FLONUM_TYPE | sizeof(double))
429
430#ifdef C_SIXTY_FOUR
431# define C_word                   long
432# define C_u32                    uint32_t
433# define C_s32                    int32_t
434#else
435# define C_word                   int
436# define C_u32                    unsigned int
437# define C_s32                    int
438#endif
439
440#if defined(_MSC_VER) || defined (__MINGW32__)
441# define C_s64                    __int64
442#else
443# define C_s64                    int64_t
444#endif
445
446#define C_char                    char
447#define C_uchar                   unsigned C_char
448#define C_byte                    char
449#define C_uword                   unsigned C_word
450#define C_header                  C_uword
451#define C_text(x)                 x
452
453#define C_TIMER_INTERRUPT_NUMBER  255
454
455#define C_BAD_ARGUMENT_COUNT_ERROR                    1
456#define C_BAD_MINIMUM_ARGUMENT_COUNT_ERROR            2
457#define C_BAD_ARGUMENT_TYPE_ERROR                     3
458#define C_UNBOUND_VARIABLE_ERROR                      4
459#define C_TOO_MANY_PARAMETERS_ERROR                   5
460#define C_OUT_OF_MEMORY_ERROR                         6
461#define C_DIVISION_BY_ZERO_ERROR                      7
462#define C_OUT_OF_RANGE_ERROR                          8
463#define C_NOT_A_CLOSURE_ERROR                         9
464#define C_CONTINUATION_CANT_RECEIVE_VALUES_ERROR      10
465#define C_TOO_DEEP_RECURSION_ERROR                    12
466#define C_CANT_REPRESENT_INEXACT_ERROR                13
467#define C_NOT_A_PROPER_LIST_ERROR                     14
468#define C_BAD_ARGUMENT_TYPE_NO_FIXNUM_ERROR           15
469#define C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR           16
470#define C_BAD_ARGUMENT_TYPE_NO_STRING_ERROR           17
471#define C_BAD_ARGUMENT_TYPE_NO_PAIR_ERROR             18
472#define C_BAD_ARGUMENT_TYPE_NO_LIST_ERROR             19
473#define C_BAD_ARGUMENT_TYPE_NO_CHAR_ERROR             20
474#define C_BAD_ARGUMENT_TYPE_NO_VECTOR_ERROR           21
475#define C_BAD_ARGUMENT_TYPE_NO_SYMBOL_ERROR           22
476#define C_STACK_OVERFLOW_ERROR                        23
477#define C_BAD_ARGUMENT_TYPE_BAD_STRUCT_ERROR          24
478#define C_BAD_ARGUMENT_TYPE_NO_BYTEVECTOR_ERROR       25
479#define C_LOST_LOCATIVE_ERROR                         26
480#define C_BAD_ARGUMENT_TYPE_NO_BLOCK_ERROR            27
481#define C_BAD_ARGUMENT_TYPE_NO_NUMBER_VECTOR_ERROR    28
482#define C_BAD_ARGUMENT_TYPE_NO_INTEGER_ERROR          29
483#define C_BAD_ARGUMENT_TYPE_NO_UINTEGER_ERROR         30
484#define C_BAD_ARGUMENT_TYPE_NO_POINTER_ERROR          31
485#define C_BAD_ARGUMENT_TYPE_NO_TAGGED_POINTER_ERROR   32
486#define C_RUNTIME_UNSAFE_DLOAD_SAFE_ERROR             33
487#define C_RUNTIME_SAFE_DLOAD_UNSAFE_ERROR             34
488#define C_BAD_ARGUMENT_TYPE_NO_FLONUM_ERROR           35
489
490
491#define CHICKEN_gc_root_ref(root)      (((C_GC_ROOT *)(root))->value)
492#define CHICKEN_gc_root_set(root, x)   C_mutate(&((C_GC_ROOT *)(root))->value, (x))
493
494#define CHICKEN_global_ref(root)       C_u_i_car(((C_GC_ROOT *)(root))->value)
495#define CHICKEN_global_set(root, x)    C_mutate(&C_u_i_car(((C_GC_ROOT *)(root))->value), (x))
496
497#define CHICKEN_default_toplevel       ((void *)C_default_stub_toplevel)
498
499
500/* Language specifics: */
501#if defined(__GNUC__) || defined(__INTEL_COMPILER)
502# ifndef __cplusplus
503#  define C_cblock                ({
504#  define C_cblockend             })
505#  define C_noret                 __attribute__ ((noreturn))
506#  define C_noret_decl(name)
507# endif
508# ifdef __i386__
509#  define C_regparm               __attribute__ ((regparm(3)))
510# endif
511#elif defined(_MSC_VER)
512# define C_fcall                  __fastcall
513#elif defined(__WATCOMC__)
514# define C_ccall                  __cdecl
515#endif
516
517#ifndef C_cblock
518# define C_cblock                 do{
519# define C_cblockend              }while(0)
520# define C_noret
521# define C_noret_decl(name)
522#endif
523
524#ifndef C_regparm
525# define C_regparm
526#endif
527
528#ifndef C_fcall
529# define C_fcall
530#endif
531
532#ifndef C_ccall
533# define C_ccall
534#endif
535
536#define C_c_regparm
537
538/* Types: */
539
540typedef struct C_block_struct
541{
542  C_header header;
543  C_word data[ 1 ];
544} C_SCHEME_BLOCK;
545
546typedef struct C_symbol_table_struct
547{
548  char *name;
549  unsigned int size;
550  C_word *table;
551  struct C_symbol_table_struct *next;
552} C_SYMBOL_TABLE;
553
554typedef struct C_gc_root_struct
555{
556  C_word value;
557  struct C_gc_root_struct *next, *prev;
558} C_GC_ROOT;
559
560typedef struct C_ptable_entry_struct
561{
562  C_char *id;
563  void *ptr;
564} C_PTABLE_ENTRY;
565
566#ifdef __x86_64__
567# define C_AMD64_ABI_WEIRDNESS      , ...
568#else
569# define C_AMD64_ABI_WEIRDNESS     
570#endif
571
572/* C_WORD_p<P>_<B>: List of ((2 ** P) * B) 'C_word' parameters */
573#define C_WORD_p0_0
574#define C_WORD_p1_0
575#define C_WORD_p2_0
576#define C_WORD_p3_0
577#define C_WORD_p4_0
578#define C_WORD_p5_0
579#define C_WORD_p6_0
580#define C_WORD_p7_0
581#define C_WORD_p0_1     C_word,
582#define C_WORD_p1_1     C_word, C_word,
583#define C_WORD_p2_1     C_WORD_p1_1 C_WORD_p1_1
584#define C_WORD_p3_1     C_WORD_p2_1 C_WORD_p2_1
585#define C_WORD_p4_1     C_WORD_p3_1 C_WORD_p3_1
586#define C_WORD_p5_1     C_WORD_p4_1 C_WORD_p4_1
587#define C_WORD_p6_1     C_WORD_p5_1 C_WORD_p5_1
588#define C_WORD_p7_1     C_WORD_p6_1 C_WORD_p6_1
589
590/* DECL_C_PROC_p0 (n0,  p7,p6,p5,p4,p3,p2,p1,p0):
591 *  declare function C_proc<n0>, which have <n0> 'C_word' parameters
592 *  (not counting last 'C_word C_AMD64_ABI_WEIRDNESS' one).
593 *  We must have:   n0 = SUM (i = 7 to 0, p<i> * (1 << i)).
594 * DECL_C_PROC_p<N+1> (...):
595 *  declare 2 as much functions as DECL_C_PROC_p<N>...
596 */
597#define DECL_C_PROC_p0( n0,  p7,p6,p5,p4,p3,p2,p1,p0) \
598    typedef void (C_ccall *C_proc##n0) (C_WORD_p7_##p7 C_WORD_p6_##p6 \
599                                        C_WORD_p5_##p5 C_WORD_p4_##p4 \
600                                        C_WORD_p3_##p3 C_WORD_p2_##p2 \
601                                        C_WORD_p1_##p1 C_WORD_p0_##p0 \
602                                        C_word C_AMD64_ABI_WEIRDNESS) C_noret;
603#define DECL_C_PROC_p1( n0,n1,  p7,p6,p5,p4,p3,p2,p1) \
604        DECL_C_PROC_p0 (n0,  p7,p6,p5,p4,p3,p2,p1,0) \
605        DECL_C_PROC_p0 (n1,  p7,p6,p5,p4,p3,p2,p1,1)
606#define DECL_C_PROC_p2( n0,n1,n2,n3,  p7,p6,p5,p4,p3,p2) \
607        DECL_C_PROC_p1 (n0,n1,  p7,p6,p5,p4,p3,p2,0) \
608        DECL_C_PROC_p1 (n2,n3,  p7,p6,p5,p4,p3,p2,1)
609#define DECL_C_PROC_p3( n0,n1,n2,n3,n4,n5,n6,n7,  p7,p6,p5,p4,p3) \
610        DECL_C_PROC_p2 (n0,n1,n2,n3,  p7,p6,p5,p4,p3,0) \
611        DECL_C_PROC_p2 (n4,n5,n6,n7,  p7,p6,p5,p4,p3,1)
612
613DECL_C_PROC_p1 (2,3,  0,0,0,0,0,0,1)
614DECL_C_PROC_p2 (4,5,6,7,  0,0,0,0,0,1)
615DECL_C_PROC_p3 (8,9,10,11,12,13,14,15,    0,0,0,0,1)
616DECL_C_PROC_p3 (16,17,18,19,20,21,22,23,  0,0,0,1,0)
617DECL_C_PROC_p3 (24,25,26,27,28,29,30,31,  0,0,0,1,1)
618DECL_C_PROC_p3 (32,33,34,35,36,37,38,39,  0,0,1,0,0)
619DECL_C_PROC_p3 (40,41,42,43,44,45,46,47,  0,0,1,0,1)
620DECL_C_PROC_p3 (48,49,50,51,52,53,54,55,  0,0,1,1,0)
621DECL_C_PROC_p3 (56,57,58,59,60,61,62,63,  0,0,1,1,1)
622DECL_C_PROC_p1 (64,65,  0,1,0,0,0,0,0)
623DECL_C_PROC_p0 (66,  0,1,0,0,0,0,1,0)
624DECL_C_PROC_p0 (67,  0,1,0,0,0,0,1,1)
625DECL_C_PROC_p2 (68,69,70,71,  0,1,0,0,0,1)
626DECL_C_PROC_p3 (72,73,74,75,76,77,78,79,  0,1,0,0,1)
627DECL_C_PROC_p3 (80,81,82,83,84,85,86,87,  0,1,0,1,0)
628DECL_C_PROC_p3 (88,89,90,91,92,93,94,95,  0,1,0,1,1)
629DECL_C_PROC_p3 (96,97,98,99,100,101,102,103,  0,1,1,0,0)
630DECL_C_PROC_p3 (104,105,106,107,108,109,110,111,  0,1,1,0,1)
631DECL_C_PROC_p3 (112,113,114,115,116,117,118,119,  0,1,1,1,0)
632DECL_C_PROC_p3 (120,121,122,123,124,125,126,127,  0,1,1,1,1)
633DECL_C_PROC_p0 (128,  1,0,0,0,0,0,0,0)
634
635
636/* Macros: */
637
638#define C_align4(n)                (((n) + 3) & ~3)
639#define C_align8(n)                (((n) + 7) & ~7)
640#define C_align16(n)               (((n) + 15) & ~15)
641
642/* This is word-size dependent: */
643#ifdef C_SIXTY_FOUR
644# define C_align(n)                C_align8(n)
645# define C_wordstobytes(n)         ((n) << 3)
646# define C_bytestowords(n)         (((n) + 7) >> 3)
647# define C_wordsperdouble(n)       (n)
648# define C_WORD_MIN                LONG_MIN
649# define C_WORD_MAX                LONG_MAX
650# define C_UWORD_MAX               ULONG_MAX
651#else
652# define C_align(n)                C_align4(n)
653# define C_wordstobytes(n)         ((n) << 2)
654# define C_bytestowords(n)         (((n) + 3) >> 2)
655# define C_wordsperdouble(n)       ((n) << 1)
656# define C_WORD_MIN                INT_MIN
657# define C_WORD_MAX                INT_MAX
658# define C_UWORD_MAX               UINT_MAX
659#endif
660
661#ifndef C_PROVIDE_LIBC_STUBS
662# define C_FILEPTR                  FILE *
663
664# define C_stdin                    stdin
665# define C_stdout                   stdout
666# define C_stderr                   stderr
667
668# define C_memcpy                   memcpy
669# define C_memcmp                   memcmp
670# define C_strcpy                   strcpy
671# define C_strncpy                  strncpy
672# define C_strcmp                   strcmp
673# define C_strncmp                  strncmp
674# define C_strlen                   strlen
675# define C_strcat                   strcat
676# define C_memset                   memset
677# define C_memmove                  memmove
678# define C_strncasecmp              strncasecmp
679# define C_malloc                   malloc
680# define C_calloc                   calloc
681# define C_free                     free
682# define C_strchr                   strchr
683# define C_realloc                  realloc
684# define C_strdup                   strdup
685# define C_strtol                   strtol
686# define C_strtod                   strtod
687# define C_strtoul                  strtoul
688# define C_fopen                    fopen
689# define C_fclose                   fclose
690# define C_strpbrk                  strpbrk
691# define C_gcvt                     gcvt
692# define C_sprintf                  sprintf
693# define C_snprintf                 snprintf
694# define C_printf                   printf
695# define C_fprintf                  fprintf
696# define C_fflush                   fflush
697# define C_getchar                  getchar
698# define C_exit                     exit
699# define C_dlopen                   dlopen
700# define C_dlclose                  dlclose
701# define C_dlsym                    dlsym
702# define C_fwrite                   fwrite
703# define C_fread                    fread
704# define C_fputs                    fputs
705# define C_fputc                    fputc
706# define C_putchar                  putchar
707# define C_fgetc                    fgetc
708# define C_fgets                    fgets
709# define C_ungetc                   ungetc
710# define C_system                   system
711# define C_isatty                   isatty
712# define C_fileno                   fileno
713# define C_select                   select
714# define C_signal                   signal
715# define C_getrusage                getrusage
716# define C_tolower                  tolower
717# define C_toupper                  toupper
718# define C_gettimeofday             gettimeofday
719# define C_gmtime                   gmtime
720# define C_localtime                localtime
721# define C_setjmp                   setjmp
722# define C_longjmp                  longjmp
723# define C_alloca                   alloca
724# define C_strerror                 strerror
725# define C_isalpha                  isalpha
726# define C_isdigit                  isdigit
727# define C_isspace                  isspace
728# define C_islower                  islower
729# define C_isupper                  isupper
730#else
731# include "chicken-libc-stubs.h"
732#endif
733
734#define C_return(x)                return(x)
735
736#define C_memcpy_slots(t, f, n)    C_memcpy((t), (f), (n) * sizeof(C_word))
737#define C_block_header(x)          (((C_SCHEME_BLOCK *)(x))->header)
738#define C_header_bits(x)           (C_block_header(x) & C_HEADER_BITS_MASK)
739#define C_header_size(x)           (C_block_header(x) & C_HEADER_SIZE_MASK)
740#define C_make_header(type, size)  ((C_header)(((type) & C_HEADER_BITS_MASK) | ((size) & C_HEADER_SIZE_MASK)))
741#define C_symbol_value(x)          (C_block_item(x, 0))
742#define C_block_item(x, i)         (((C_SCHEME_BLOCK *)(x))->data[ i ])
743#define C_set_block_item(x, i, y)  (C_block_item(x, i) = (y))
744#define C_save(x)                  (*(--C_temporary_stack) = (C_word)(x))
745#define C_adjust_stack(n)          (C_temporary_stack -= (n))
746#define C_rescue(x, i)             (C_temporary_stack[ i ] = (x))
747#define C_save_rest(s, c, n)       for(va_start(v, s); c-- > (n); C_save(va_arg(v, C_word)))
748#define C_rest_count(c)            ((C_temporary_stack_bottom - C_temporary_stack) - (c))
749#define C_restore                  (*(C_temporary_stack++))
750#define C_heaptop                  ((C_word **)(&C_fromspace_top))
751#define C_pick(n)                  (C_temporary_stack[ n ])
752#define C_drop(n)                  (C_temporary_stack += (n))
753#define C_alloc(n)                 ((C_word *)C_alloca((n) * sizeof(C_word)))
754#define C_stack_pointer            ((C_word *)C_alloca(0))
755#define C_stack_pointer_test       ((C_word *)C_alloca(1))
756#define C_demand_2(n)              (((C_word *)C_fromspace_top + (n)) < (C_word *)C_fromspace_limit)
757#define C_fix(n)                   (((C_word)(n) << C_FIXNUM_SHIFT) | C_FIXNUM_BIT)
758#define C_unfix(x)                 ((x) >> C_FIXNUM_SHIFT)
759#define C_make_character(c)        ((((c) & C_CHAR_BIT_MASK) << 8) | C_CHARACTER_BITS)
760#define C_character_code(x)        (((x) >> 8) & C_CHAR_BIT_MASK)
761#define C_flonum_magnitude(x)      (*((double *)(((C_SCHEME_BLOCK *)(x))->data)))
762#define C_c_string(x)              ((C_char *)(((C_SCHEME_BLOCK *)(x))->data))
763#define C_c_pointer(x)             ((void *)(x))
764#define C_c_pointer_nn(x)          ((void *)C_block_item(x, 0))
765#define C_truep(x)                 ((x) != C_SCHEME_FALSE)
766#define C_immediatep(x)            ((x) & C_IMMEDIATE_MARK_BITS)
767#define C_mk_bool(x)               ((x) ? C_SCHEME_TRUE : C_SCHEME_FALSE)
768#define C_mk_nbool(x)              ((x) ? C_SCHEME_FALSE : C_SCHEME_TRUE)
769#define C_port_file(p)             ((C_FILEPTR)C_block_item(p, 0))
770#define C_data_pointer(x)          ((void *)((C_SCHEME_BLOCK *)(x))->data)
771#define C_invert_flag(f)           (!(f))
772#define C_fitsinfixnump(n)         (((n) & C_INT_SIGN_BIT) == (((n) & C_INT_TOP_BIT) << 1))
773#define C_ufitsinfixnump(n)        (((n) & (C_INT_SIGN_BIT | (C_INT_SIGN_BIT >> 1))) == 0)
774#define C_quickflonumtruncate(n)   (C_fix((C_word)C_flonum_magnitude(n)))
775#define C_and(x, y)                (C_truep(x) ? (y) : C_SCHEME_FALSE)
776#define C_c_bytevector(x)          ((unsigned char *)C_data_pointer(x))
777#define C_c_bytevector_or_null(x)  ((unsigned char *)C_data_pointer_or_null(x))
778#define C_c_u8vector(x)            ((unsigned char *)C_data_pointer(C_u_i_cdr(x)))
779#define C_c_u8vector_or_null(x)    ((unsigned char *)C_srfi_4_vector_or_null(x))
780#define C_c_s8vector(x)            ((char *)C_data_pointer(C_u_i_cdr(x)))
781#define C_c_s8vector_or_null(x)    ((char *)C_srfi_4_vector_or_null(x))
782#define C_c_u16vector(x)           ((unsigned short *)C_data_pointer(C_u_i_cdr(x)))
783#define C_c_u16vector_or_null(x)   ((unsigned short *)C_srfi_4_vector_or_null(x))
784#define C_c_s16vector(x)           ((short *)C_data_pointer(C_u_i_cdr(x)))
785#define C_c_s16vector_or_null(x)   ((short *)C_srfi_4_vector_or_null(x))
786#define C_c_u32vector(x)           ((C_u32 *)C_data_pointer(C_u_i_cdr(x)))
787#define C_c_u32vector_or_null(x)   ((C_u32 *)C_srfi_4_vector_or_null(x))
788#define C_c_s32vector(x)           ((C_s32 *)C_data_pointer(C_u_i_cdr(x)))
789#define C_c_s32vector_or_null(x)   ((C_s32 *)C_srfi_4_vector_or_null(x))
790#define C_c_f32vector(x)           ((float *)C_data_pointer(C_u_i_cdr(x)))
791#define C_c_f32vector_or_null(x)   ((float *)C_srfi_4_vector_or_null(x))
792#define C_c_f64vector(x)           ((double *)C_data_pointer(C_u_i_cdr(x)))
793#define C_c_f64vector_or_null(x)   ((double *)C_srfi_4_vector_or_null(x))
794
795#ifdef C_STRESS_TEST
796# define C_STRESS_FAILURE          3
797# define C_stress                  (rand() % C_STRESS_FAILURE)
798#else
799# define C_stress                  1
800#endif
801
802#if C_STACK_GROWS_DOWNWARD
803# define C_demand(n)              (C_stress && ((C_word)(C_stack_pointer - C_stack_limit) > (n)))
804# define C_stack_probe(p)         (C_stress && ((C_word *)(p) >= C_stack_limit))
805# define C_stack_check            if(!C_disable_overflow_check && (C_byte*)(C_stack_pointer) + C_STACK_RESERVE < (C_byte *)C_stack_limit) C_stack_overflow()
806#else
807# define C_demand(n)              (C_stress && ((C_word)(C_stack_limit - C_stack_pointer) > (n)))
808# define C_stack_probe(p)         (C_stress && ((C_word *)(p) < C_stack_limit))
809# define C_stack_check            if(!C_disable_overflow_check && (C_byte*)(C_stack_pointer) - C_STACK_RESERVE > (C_byte *)C_stack_limit) C_stack_overflow()
810#endif
811
812#define C_zero_length_p(x)        C_mk_bool(C_header_size(x) == 0)
813#define C_boundp(x)               C_mk_bool(((C_SCHEME_BLOCK *)(x))->data[ 0 ] != C_SCHEME_UNBOUND)
814#define C_blockp(x)               C_mk_bool(!C_immediatep(x))
815#define C_forwardedp(x)           C_mk_bool((C_block_header(x) & C_GC_FORWARDING_BIT) != 0)
816#define C_immp(x)                 C_mk_bool(C_immediatep(x))
817#define C_flonump(x)              C_mk_bool(C_block_header(x) == C_FLONUM_TAG)
818#define C_stringp(x)              C_mk_bool(C_header_bits(x) == C_STRING_TYPE)
819#define C_symbolp(x)              C_mk_bool(C_block_header(x) == C_SYMBOL_TAG)
820#define C_pairp(x)                C_mk_bool(C_block_header(x) == C_PAIR_TAG)
821#define C_closurep(x)             C_mk_bool(C_header_bits(x) == C_CLOSURE_TYPE)
822#define C_vectorp(x)              C_mk_bool(C_header_bits(x) == C_VECTOR_TYPE)
823#define C_bytevectorp(x)          C_mk_bool(C_header_bits(x) == C_BYTEVECTOR_TYPE)
824#define C_portp(x)                C_mk_bool(C_header_bits(x) == C_PORT_TYPE)
825#define C_structurep(x)           C_mk_bool(C_header_bits(x) == C_STRUCTURE_TYPE)
826#define C_locativep(x)            C_mk_bool(C_block_header(x) == C_LOCATIVE_TAG)
827#define C_charp(x)                C_mk_bool(((x) & C_IMMEDIATE_TYPE_BITS) == C_CHARACTER_BITS)
828#define C_booleanp(x)             C_mk_bool(((x) & C_IMMEDIATE_TYPE_BITS) == C_BOOLEAN_BITS)
829#define C_eofp(x)                 C_mk_bool((x) == C_SCHEME_END_OF_FILE)
830#define C_undefinedp(x)           C_mk_bool((x) == C_SCHEME_UNDEFINED)
831#define C_fixnump(x)              C_mk_bool((x) & C_FIXNUM_BIT)
832#define C_nfixnump(x)             C_mk_nbool((x) & C_FIXNUM_BIT)
833#define C_pointerp(x)             C_mk_bool(C_block_header(x) == C_POINTER_TAG)
834#define C_taggedpointerp(x)       C_mk_bool(C_block_header(x) == C_TAGGED_POINTER_TAG)
835#define C_swigpointerp(x)         C_mk_bool(C_block_header(x) == C_SWIG_POINTER_TAG)
836#define C_lambdainfop(x)          C_mk_bool(C_header_bits(x) == C_LAMBDA_INFO_TYPE)
837#define C_anypointerp(x)          C_mk_bool(C_block_header(x) == C_POINTER_TAG || C_block_header(x) == C_TAGGED_POINTER_TAG || C_block_header(x) == C_SWIG_POINTER_TAG)
838#define C_specialp(x)             C_mk_bool(C_header_bits(x) & C_SPECIALBLOCK_BIT)
839#define C_byteblockp(x)           C_mk_bool(C_header_bits(x) & C_BYTEBLOCK_BIT)
840#define C_anyp(x)                 C_SCHEME_TRUE
841#define C_eqp(x, y)               C_mk_bool((x) == (y))
842#define C_vemptyp(x)              C_mk_bool(C_header_size(x) == 0)
843#define C_notvemptyp(x)           C_mk_bool(C_header_size(x) > 0)
844#define C_slot(x, i)              (((C_SCHEME_BLOCK *)(x))->data[ C_unfix(i) ])
845#define C_slot0(x)                (((C_SCHEME_BLOCK *)(x))->data[ 0 ])
846#define C_subbyte(x, i)           C_fix(((C_byte *)((C_SCHEME_BLOCK *)(x))->data)[ C_unfix(i) ] & 0xff)
847#define C_subchar(x, i)           C_make_character(((C_uchar *)((C_SCHEME_BLOCK *)(x))->data)[ C_unfix(i) ])
848#define C_setbyte(x, i, n)        (((C_byte *)((C_SCHEME_BLOCK *)(x))->data)[ C_unfix(i) ] = C_unfix(n), C_SCHEME_UNDEFINED)
849#define C_setsubchar(x, i, n)     (((C_char *)((C_SCHEME_BLOCK *)(x))->data)[ C_unfix(i) ] = C_character_code(n), C_SCHEME_UNDEFINED)
850#define C_setsubbyte(x, i, n)     (((C_char *)((C_SCHEME_BLOCK *)(x))->data)[ C_unfix(i) ] = C_unfix(n), C_SCHEME_UNDEFINED)
851#define C_fixnum_times(n1, n2)          (C_fix(C_unfix(n1) * C_unfix(n2)))
852#define C_u_fixnum_plus(n1, n2)         (((n1) - C_FIXNUM_BIT) + (n2))
853#define C_fixnum_plus(n1, n2)           (C_u_fixnum_plus(n1, n2) | C_FIXNUM_BIT)
854#define C_u_fixnum_difference(n1, n2)   ((n1) - (n2) + C_FIXNUM_BIT)
855#define C_fixnum_difference(n1, n2)     (C_u_fixnum_difference(n1, n2) | C_FIXNUM_BIT)
856#define C_fixnum_divide(n1, n2)         (C_fix(C_unfix(n1) / C_unfix(n2)))
857#define C_fixnum_modulo(n1, n2)         (C_fix(C_unfix(n1) % C_unfix(n2)))
858#define C_u_fixnum_and(n1, n2)          ((n1) & (n2))
859#define C_fixnum_and(n1, n2)            (C_u_fixnum_and(n1, n2) | C_FIXNUM_BIT)
860#define C_u_fixnum_or(n1, n2)           ((n1) | (n2))
861#define C_fixnum_or(n1, n2)             (C_u_fixnum_or(n1, n2) | C_FIXNUM_BIT)
862#define C_fixnum_xor(n1, n2)            (((n1) ^ (n2)) | C_FIXNUM_BIT)
863#define C_fixnum_not(n)                 ((~(n)) | C_FIXNUM_BIT)
864#define C_fixnum_shift_left(n1, n2)     (C_fix(C_unfix(n1) << C_unfix(n2)))
865#define C_fixnum_shift_right(n1, n2)    (((n1) >> C_unfix(n2)) | C_FIXNUM_BIT)
866#define C_u_fixnum_negate(n)            (-(n) + 2 * C_FIXNUM_BIT)
867#define C_fixnum_negate(n)              (C_u_fixnum_negate(n) | C_FIXNUM_BIT)
868#define C_fixnum_greaterp(n1, n2)       (C_mk_bool((C_word)(n1) > (C_word)(n2)))
869#define C_fixnum_lessp(n1, n2)          (C_mk_bool((C_word)(n1) < (C_word)(n2)))
870#define C_fixnum_greater_or_equal_p(n1, n2) (C_mk_bool((C_word)(n1) >= (C_word)(n2)))
871#define C_fixnum_less_or_equal_p(n1, n2)(C_mk_bool((C_word)(n1) <= (C_word)(n2)))
872#define C_u_fixnum_increase(n)          ((n) + (1 << C_FIXNUM_SHIFT))
873#define C_fixnum_increase(n)            (C_u_fixnum_increase(n) | C_FIXNUM_BIT)
874#define C_u_fixnum_decrease(n)          ((n) - (1 << C_FIXNUM_SHIFT))
875#define C_fixnum_decrease(n)            (C_u_fixnum_decrease(n) | C_FIXNUM_BIT)
876#define C_fixnum_abs(n)                 C_fix(abs(C_unfix(n)))
877
878#define C_flonum_equalp(n1, n2)         C_mk_bool(C_flonum_magnitude(n1) == C_flonum_magnitude(n2))
879#define C_flonum_greaterp(n1, n2)       C_mk_bool(C_flonum_magnitude(n1) > C_flonum_magnitude(n2))
880#define C_flonum_lessp(n1, n2)          C_mk_bool(C_flonum_magnitude(n1) < C_flonum_magnitude(n2))
881#define C_flonum_greater_or_equal_p(n1, n2) C_mk_bool(C_flonum_magnitude(n1) >= C_flonum_magnitude(n2))
882#define C_flonum_less_or_equal_p(n1, n2) C_mk_bool(C_flonum_magnitude(n1) <= C_flonum_magnitude(n2))
883
884#define C_display_fixnum(p, n)          (C_fprintf(C_port_file(p), C_text("%d"), C_unfix(n)), C_SCHEME_UNDEFINED)
885#define C_display_char(p, c)            (C_fputc(C_character_code(c), C_port_file(p)), C_SCHEME_UNDEFINED)
886#define C_display_string(p, s)          (C_fwrite(((C_SCHEME_BLOCK *)(s))->data, sizeof(C_char), C_header_size(s), \
887                                         C_port_file(p)), C_SCHEME_UNDEFINED)
888#define C_fix_to_char(x)                (C_make_character(C_unfix(x)))
889#define C_char_to_fix(x)                (C_fix(C_character_code(x)))
890#define C_math_result(x)                (C_temporary_flonum = (x), C_SCHEME_UNDEFINED)
891#define C_substring_copy(s1, s2, start1, end1, start2) \
892                                        (C_memcpy((C_char *)C_data_pointer(s2) + C_unfix(start2), \
893                                                  (C_char *)C_data_pointer(s1) + C_unfix(start1), \
894                                                  C_unfix(end1) - C_unfix(start1) ), C_SCHEME_UNDEFINED)
895#define C_substring_compare(s1, s2, start1, start2, len) \
896                                        C_mk_bool(C_memcmp((C_char *)C_data_pointer(s1) + C_unfix(start1), \
897                                                           (C_char *)C_data_pointer(s2) + C_unfix(start2), \
898                                                           C_unfix(len) ) == 0)
899#define C_substring_compare_case_insensitive(s1, s2, start1, start2, len) \
900                                        C_mk_bool(C_strncasecmp((C_char *)C_data_pointer(s1) + C_unfix(start1), \
901                                                                (C_char *)C_data_pointer(s2) + C_unfix(start2), \
902                                                                C_unfix(len) ) == 0)
903#define C_subvector_copy(v1, v2, start1, end1, start2) \
904                                        (C_memcpy_slots((C_char *)C_data_pointer(v2) + C_unfix(start2), \
905                                                  (C_char *)C_data_pointer(v1) + C_unfix(start1), \
906                                                  C_unfix(end1) - C_unfix(start1) ), C_SCHEME_UNDEFINED)
907#define C_words(n)                      C_fix(C_bytestowords(C_unfix(n)))
908#define C_bytes(n)                      C_fix(C_wordstobytes(C_unfix(n)))
909#define C_random_fixnum(n)              C_fix(rand() % C_unfix(n))
910#define C_randomize(n)                  (srand(C_unfix(n)), C_SCHEME_UNDEFINED)
911#define C_block_size(x)                 C_fix(C_header_size(x))
912#define C_pointer_address(x)            ((C_byte *)C_u_i_car(x))
913#define C_block_address(ptr, n, x)      C_a_unsigned_int_to_num(ptr, n, x)
914#define C_offset_pointer(x, y)          (C_pointer_address(x) + (y))
915#define C_kontinue(k, r)                ((C_proc2)(void *)C_u_i_car(k))(2, (k), (r))
916#define C_fetch_byte(x, p)              (((unsigned C_byte *)((C_SCHEME_BLOCK *)(x))->data)[ p ])
917#define C_poke_integer(x, i, n)         (C_set_block_item(x, C_unfix(i), C_num_to_int(n)), C_SCHEME_UNDEFINED)
918#define C_pointer_to_block(p, x)        (C_set_block_item(p, 0, (C_word)C_data_pointer(x)), C_SCHEME_UNDEFINED)
919#define C_null_pointerp(x)              C_mk_bool((void *)C_u_i_car(x) == NULL)
920#define C_update_pointer(p, ptr)        (C_set_block_item(ptr, 0, C_num_to_unsigned_int(p)), C_SCHEME_UNDEFINED)
921#define C_copy_pointer(from, to)        (C_set_block_item(to, 0, C_u_i_car(from)), C_SCHEME_UNDEFINED)
922
923#define C_direct_return(dk, x)          (C_kontinue(dk, x), C_SCHEME_UNDEFINED)
924
925#ifdef C_SIXTY_FOUR
926# define C_poke_integer_32(x, i, n)     (((C_s32 *)C_data_pointer(x))[ C_unfix(i) ] = C_unfix(n), C_SCHEME_UNDEFINED)
927#else
928# define C_poke_integer_32              C_poke_integer
929#endif
930
931#define C_copy_memory(to, from, n)      (C_memcpy(C_data_pointer(to), C_data_pointer(from), C_unfix(n)), C_SCHEME_UNDEFINED)
932#define C_set_memory(to, c, n)          (C_memset(C_data_pointer(to), C_character_code(c), C_unfix(n)), C_SCHEME_UNDEFINED)
933#define C_string_compare(to, from, n)   C_fix(C_strncmp(C_c_string(to), C_c_string(from), C_unfix(n)))
934#define C_string_compare_case_insensitive(from, to, n) \
935                                        C_fix(C_strncasecmp(C_c_string(from), C_c_string(to), C_unfix(n)))
936#define C_rename_file(old, new)         C_fix(rename(C_c_string(old), C_c_string(new)))
937#define C_delete_file(fname)            C_fix(remove(C_c_string(fname)))
938#define C_poke_double(b, i, n)          (((double *)C_data_pointer(b))[ C_unfix(i) ] = C_c_double(n), C_SCHEME_UNDEFINED)
939#define C_poke_c_string(b, i, from)     (C_strcpy((char *)C_block_item(b, C_unfix(i)), C_data_pointer(from)), C_SCHEME_UNDEFINED)
940#define C_peek_fixnum(b, i)             C_fix(C_block_item(b, C_unfix(i)))
941#define C_peek_byte(ptr, i)             C_fix(((unsigned char *)C_u_i_car(ptr))[ C_unfix(i) ])
942#define C_dupstr(s)                     C_strdup(C_data_pointer(s))
943#define C_poke_pointer(b, i, x)         (C_set_block_item(b, C_unfix(i), (C_word)C_data_pointer(x)), C_SCHEME_UNDEFINED)
944#define C_poke_pointer_or_null(b, i, x) (C_set_block_item(b, C_unfix(i), (C_word)C_data_pointer_or_null(x)), C_SCHEME_UNDEFINED)
945#define C_qfree(ptr)                    (C_free(C_c_pointer_nn(ptr)), C_SCHEME_UNDEFINED)
946
947#if defined(__MWERKS__) && !defined(__INTEL__)
948# define C_tty_portp(p)                 C_SCHEME_FALSE
949#else
950# define C_tty_portp(p)                 C_mk_bool(isatty(fileno(C_port_file(p))))
951#endif
952
953#define C_emit_eval_trace_info(x, y, z) C_emit_trace_info2("<eval>", x, y, z)
954#define C_emit_syntax_trace_info(x, y, z) C_emit_trace_info2("<syntax>", x, y, z)
955
956/* These expect C_VECTOR_TYPE to be 0: */
957#define C_vector_to_structure(v)        (((C_SCHEME_BLOCK *)(v))->header |= C_STRUCTURE_TYPE, C_SCHEME_UNDEFINED)
958#define C_vector_to_closure(v)          (((C_SCHEME_BLOCK *)(v))->header |= C_CLOSURE_TYPE, C_SCHEME_UNDEFINED)
959#define C_string_to_bytevector(s)       (((C_SCHEME_BLOCK *)(s))->header = C_header_size(s) | C_BYTEVECTOR_TYPE, C_SCHEME_UNDEFINED)
960#define C_string_to_lambdainfo(s)       (((C_SCHEME_BLOCK *)(s))->header = C_header_size(s) | C_LAMBDA_INFO_TYPE, C_SCHEME_UNDEFINED)
961
962#ifdef C_TIMER_INTERRUPTS
963# ifdef PARANOIA
964#  define C_check_for_interrupt         C_paranoid_check_for_interrupt()
965# else
966#  define C_check_for_interrupt         if(--C_timer_interrupt_counter <= 0) C_raise_interrupt(C_TIMER_INTERRUPT_NUMBER)
967# endif
968#else
969# define C_check_for_interrupt
970#endif
971
972#if defined(__GNUC__) || defined(__INTEL_COMPILER)
973# define C_a_i(a, n)                    ({C_word *tmp = *a; *a += (n); tmp;})
974# define C_a_i_cons(a, n, car, cdr)     ({C_word tmp = (C_word)(*a); (*a)[0] = C_PAIR_TYPE | 2; *a += 3; \
975                                          C_set_block_item(tmp, 0, car); C_set_block_item(tmp, 1, cdr); tmp;})
976#else
977# define C_a_i_cons(a, n, car, cdr)     C_pair(a, car, cdr)
978#endif /* __GNUC__ */
979
980#define C_a_i_data_mpointer(ptr, n, x)  C_mpointer(ptr, C_data_pointer(x))
981#define C_a_int_to_num(ptr, n, i)       C_int_to_num(ptr, i)
982#define C_a_unsigned_int_to_num(ptr, n, i)  C_unsigned_int_to_num(ptr, i)
983#define C_a_double_to_num(ptr, n)       C_double_to_number(C_flonum(ptr, n))
984#define C_a_i_vector                    C_vector
985#define C_list                          C_a_i_list
986#define C_i_setslot(x, i, y)            (C_mutate(&C_block_item(x, C_unfix(i)), y), C_SCHEME_UNDEFINED)
987#define C_i_set_i_slot(x, i, y)         (C_set_block_item(x, C_unfix(i), y), C_SCHEME_UNDEFINED)
988#define C_u_i_set_car(p, x)             (C_mutate(&C_u_i_car(p), x), C_SCHEME_UNDEFINED)
989#define C_u_i_set_cdr(p, x)             (C_mutate(&C_u_i_cdr(p), x), C_SCHEME_UNDEFINED)
990
991#define C_i_not(x)                      (C_truep(x) ? C_SCHEME_FALSE : C_SCHEME_TRUE)
992#define C_i_equalp(x, y)                C_mk_bool(C_equalp((x), (y)))
993#define C_i_fixnumevenp(x)              C_mk_nbool((x) & 0x00000002)
994#define C_i_fixnumoddp(x)               C_mk_bool((x) & 0x00000002)
995#define C_i_nullp(x)                    C_mk_bool((x) == C_SCHEME_END_OF_LIST)
996#define C_i_structurep(x, s)            C_mk_bool(!C_immediatep(x) && C_header_bits(x) == C_STRUCTURE_TYPE && C_block_item(x, 0) == (s))
997
998#define C_u_i_char_alphabeticp(x)       C_mk_bool(C_isalpha(C_character_code(x)))
999#define C_u_i_char_numericp(x)          C_mk_bool(C_isdigit(C_character_code(x)))
1000#define C_u_i_char_whitespacep(x)       C_mk_bool(C_isspace(C_character_code(x)))
1001#define C_u_i_char_upper_casep(x)       C_mk_bool(C_isupper(C_character_code(x)))
1002#define C_u_i_char_lower_casep(x)       C_mk_bool(C_islower(C_character_code(x)))
1003
1004#define C_u_i_char_upcase(x)            C_make_character(C_toupper(C_character_code(x)))
1005#define C_u_i_char_downcase(x)          C_make_character(C_tolower(C_character_code(x)))
1006
1007#define C_i_list_ref(lst, i)            C_i_car(C_i_list_tail(lst, i))
1008#define C_u_i_list_ref(lst, i)          C_u_i_car(C_i_list_tail(lst, i))
1009
1010#define C_u_i_car(x)                    C_block_item(x, 0)
1011#define C_u_i_cdr(x)                    C_block_item(x, 1)
1012#define C_u_i_caar(x)                   C_u_i_car( C_u_i_car( x ) )
1013#define C_u_i_cadr(x)                   C_u_i_car( C_u_i_cdr( x ) )
1014#define C_u_i_cdar(x)                   C_u_i_cdr( C_u_i_car( x ) )
1015#define C_u_i_cddr(x)                   C_u_i_cdr( C_u_i_cdr( x ) )
1016#define C_u_i_caaar(x)                  C_u_i_car( C_u_i_caar( x ) )
1017#define C_u_i_caadr(x)                  C_u_i_car( C_u_i_cadr( x ) )
1018#define C_u_i_cadar(x)                  C_u_i_car( C_u_i_cdar( x ) )
1019#define C_u_i_caddr(x)                  C_u_i_car( C_u_i_cddr( x ) )
1020#define C_u_i_cdaar(x)                  C_u_i_cdr( C_u_i_caar( x ) )
1021#define C_u_i_cdadr(x)                  C_u_i_cdr( C_u_i_cadr( x ) )
1022#define C_u_i_cddar(x)                  C_u_i_cdr( C_u_i_cdar( x ) )
1023#define C_u_i_cdddr(x)                  C_u_i_cdr( C_u_i_cddr( x ) )
1024#define C_u_i_caaaar(x)                 C_u_i_car( C_u_i_caaar( x ) )
1025#define C_u_i_caaadr(x)                 C_u_i_car( C_u_i_caadr( x ) )
1026#define C_u_i_caadar(x)                 C_u_i_car( C_u_i_cadar( x ) )
1027#define C_u_i_caaddr(x)                 C_u_i_car( C_u_i_caddr( x ) )
1028#define C_u_i_cadaar(x)                 C_u_i_car( C_u_i_cdaar( x ) )
1029#define C_u_i_cadadr(x)                 C_u_i_car( C_u_i_cdadr( x ) )
1030#define C_u_i_caddar(x)                 C_u_i_car( C_u_i_cddar( x ) )
1031#define C_u_i_cadddr(x)                 C_u_i_car( C_u_i_cdddr( x ) )
1032#define C_u_i_cdaaar(x)                 C_u_i_cdr( C_u_i_caaar( x ) )
1033#define C_u_i_cdaadr(x)                 C_u_i_cdr( C_u_i_caadr( x ) )
1034#define C_u_i_cdadar(x)                 C_u_i_cdr( C_u_i_cadar( x ) )
1035#define C_u_i_cdaddr(x)                 C_u_i_cdr( C_u_i_caddr( x ) )
1036#define C_u_i_cddaar(x)                 C_u_i_cdr( C_u_i_cdaar( x ) )
1037#define C_u_i_cddadr(x)                 C_u_i_cdr( C_u_i_cdadr( x ) )
1038#define C_u_i_cdddar(x)                 C_u_i_cdr( C_u_i_cddar( x ) )
1039#define C_u_i_cddddr(x)                 C_u_i_cdr( C_u_i_cdddr( x ) )
1040
1041#define C_a_i_times( ptr, n, x, y)      C_2_times( ptr, x, y)
1042#define C_a_i_plus(  ptr, n, x, y)      C_2_plus(  ptr, x, y)
1043#define C_a_i_minus( ptr, n, x, y)      C_2_minus( ptr, x, y)
1044#define C_a_i_divide(ptr, n, x, y)      C_2_divide(ptr, x, y)
1045
1046#if defined(__GNUC__) || defined(__INTEL_COMPILER)
1047# define C_i_not_pair_p(x)              ({C_word tmp = (x); C_mk_bool(C_immediatep(tmp) || C_block_header(tmp) != C_PAIR_TAG);})
1048#else
1049# define C_i_not_pair_p                 C_i_not_pair_p_2
1050#endif
1051
1052#define C_i_check_exact(x)              C_i_check_exact_2(x, C_SCHEME_FALSE)
1053#define C_i_check_number(x)             C_i_check_number_2(x, C_SCHEME_FALSE)
1054#define C_i_check_string(x)             C_i_check_string_2(x, C_SCHEME_FALSE)
1055#define C_i_check_bytevector(x)         C_i_check_bytevector_2(x, C_SCHEME_FALSE)
1056#define C_i_check_symbol(x)             C_i_check_symbol_2(x, C_SCHEME_FALSE)
1057#define C_i_check_list(x)               C_i_check_list_2(x, C_SCHEME_FALSE)
1058#define C_i_check_pair(x)               C_i_check_pair_2(x, C_SCHEME_FALSE)
1059#define C_i_check_vector(x)             C_i_check_vector_2(x, C_SCHEME_FALSE)
1060#define C_i_check_structure(x, st)      C_i_check_structure_2(x, (st), C_SCHEME_FALSE)
1061#define C_i_check_char(x)               C_i_check_char_2(x, C_SCHEME_FALSE)
1062
1063#define C_u_i_8vector_length(x)         C_fix(C_header_size(C_block_item(x, 1)))
1064#define C_u_i_16vector_length(x)        C_fix(C_header_size(C_block_item(x, 1)) >> 1)
1065#define C_u_i_32vector_length(x)        C_fix(C_header_size(C_block_item(x, 1)) >> 2)
1066#define C_u_i_64vector_length(x)        C_fix(C_header_size(C_block_item(x, 1)) >> 3)
1067
1068#define C_u_i_u8vector_ref(x, i)        C_fix(((unsigned char *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ])
1069#define C_u_i_s8vector_ref(x, i)        C_fix(((char *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ])
1070#define C_u_i_u16vector_ref(x, i)       C_fix(((unsigned short *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ])
1071#define C_u_i_s16vector_ref(x, i)       C_fix(((short *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ])
1072#define C_u_i_u32vector_ref(x, i)       C_fix(((C_u32 *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ])
1073#define C_u_i_s32vector_ref(x, i)       C_fix(((C_u32 *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ])
1074#define C_a_i_u32vector_ref(ptr, c, x, i)  C_unsigned_int_to_num(ptr, ((C_u32 *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ])
1075#define C_a_i_s32vector_ref(ptr, c, x, i)  C_int_to_num(ptr, ((C_s32 *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ])
1076
1077#define C_u_i_u8vector_set(x, i, v)     ((((unsigned char *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ] = C_unfix(v)), C_SCHEME_UNDEFINED)
1078#define C_u_i_s8vector_set(x, i, v)     ((((char *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ] = C_unfix(v)), C_SCHEME_UNDEFINED)
1079#define C_u_i_u16vector_set(x, i, v)    ((((unsigned short *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ] = C_unfix(v)), C_SCHEME_UNDEFINED)
1080#define C_u_i_s16vector_set(x, i, v)    ((((short *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ] = C_unfix(v)), C_SCHEME_UNDEFINED)
1081#define C_u_i_u32vector_set(x, i, v)    ((((C_u32 *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ] = C_num_to_unsigned_int(v)), C_SCHEME_UNDEFINED)
1082#define C_u_i_s32vector_set(x, i, v)    ((((C_s32 *)C_data_pointer(C_block_item((x), 1)))[ C_unfix(i) ] = C_num_to_int(v)), C_SCHEME_UNDEFINED)
1083
1084#define C_u_i_bit_setp(x, i)            C_mk_bool((C_unfix(x) & (1 << C_unfix(i))) != 0)
1085
1086#ifdef C_BIG_ENDIAN
1087# ifdef C_SIXTY_FOUR
1088#  define C_lihdr(x, y, z)              ((C_LAMBDA_INFO_TYPE >> 56) & 0xff), \
1089                                        0, 0, 0, 0, (x), (y), (z)
1090# else
1091#  define C_lihdr(x, y, z)              ((C_LAMBDA_INFO_TYPE >> 24) & 0xff), \
1092                                        (x), (y), (z)
1093# endif
1094#else
1095# ifdef C_SIXTY_FOUR
1096#  define C_lihdr(x, y, z)              (z), (y), (x), 0, 0, 0, 0, \
1097                                        ((C_LAMBDA_INFO_TYPE >> 56) & 0xff)
1098# else
1099#  define C_lihdr(x, y, z)              (z), (y), (x), \
1100                                        ((C_LAMBDA_INFO_TYPE >> 24) & 0xff)
1101# endif
1102#endif
1103
1104#define C_end_of_main
1105
1106#if !defined(C_EMBEDDED) && !defined(C_SHARED)
1107# ifndef C_WINDOWS_GUI
1108#  define C_main_entry_point            int main(int argc, char *argv[]) { return CHICKEN_main(argc, argv, (void*)C_toplevel); } C_end_of_main
1109# else
1110#  define C_main_entry_point            \
1111  int WINAPI WinMain(HINSTANCE me, HINSTANCE you, LPSTR cmdline, int show) \
1112  { return CHICKEN_main(0, NULL, (void *)C_toplevel); } C_end_of_main
1113# endif
1114#else
1115# define C_main_entry_point
1116#endif
1117
1118
1119/* Variables: */
1120
1121C_varextern C_TLS time_t C_startup_time_seconds;
1122C_varextern C_TLS C_word
1123  *C_temporary_stack,
1124  *C_temporary_stack_bottom,
1125  *C_stack_limit;
1126C_varextern C_TLS long
1127  C_timer_interrupt_counter,
1128  C_initial_timer_interrupt_period;
1129C_varextern C_TLS C_byte
1130  *C_fromspace_top,
1131  *C_fromspace_limit;
1132C_varextern C_TLS double C_temporary_flonum;
1133C_varextern C_TLS jmp_buf C_restart;
1134C_varextern C_TLS void *C_restart_address;
1135C_varextern C_TLS int C_entry_point_status;
1136
1137C_varextern C_TLS void (C_fcall *C_restart_trampoline)(void *proc) C_regparm C_noret;
1138C_varextern C_TLS void (*C_pre_gc_hook)(int mode);
1139C_varextern C_TLS void (*C_post_gc_hook)(int mode, long ms);
1140C_varextern C_TLS void (*C_panic_hook)(C_char *msg);
1141
1142C_varextern C_TLS int
1143  C_abort_on_thread_exceptions,
1144  C_interrupts_enabled,
1145  C_disable_overflow_check,
1146  C_enable_gcweak,
1147  C_heap_size_is_fixed,
1148  C_max_pending_finalizers,
1149  C_trace_buffer_size,
1150  C_main_argc;
1151C_varextern C_TLS C_uword
1152  C_heap_growth,
1153  C_heap_shrinkage;
1154C_varextern C_TLS char 
1155  **C_main_argv,
1156  *C_dlerror;
1157C_varextern C_TLS C_uword C_maximal_heap_size;
1158C_varextern C_TLS int (*C_gc_mutation_hook)(C_word *slot, C_word val);
1159C_varextern C_TLS void (*C_gc_trace_hook)(C_word *var, int mode);
1160C_varextern C_TLS C_word (*C_get_unbound_variable_value_hook)(C_word sym);
1161
1162
1163/* Prototypes: */
1164
1165C_BEGIN_C_DECLS
1166
1167C_fctexport int CHICKEN_main(int argc, char *argv[], void *toplevel);
1168C_fctexport int CHICKEN_initialize(int heap, int stack, int symbols, void *toplevel);
1169C_fctexport C_word CHICKEN_run(void *toplevel);
1170C_fctexport C_word CHICKEN_continue(C_word k);
1171C_fctexport void *CHICKEN_new_gc_root();
1172C_fctexport void CHICKEN_delete_gc_root(void *root);
1173C_fctexport void *CHICKEN_global_lookup(char *name);
1174C_fctexport int CHICKEN_is_running();
1175C_fctexport void CHICKEN_interrupt();
1176
1177C_fctexport void C_check_nursery_minimum(C_word size);
1178C_fctexport int C_fcall C_save_callback_continuation(C_word **ptr, C_word k);
1179C_fctexport C_word C_fcall C_restore_callback_continuation(void);
1180C_fctexport C_word C_fcall C_restore_callback_continuation2(int level);
1181C_fctexport C_word C_fcall C_callback(C_word closure, int argc);
1182C_fctexport C_word C_fcall C_callback_wrapper(void *proc, int argc);
1183C_fctexport void C_fcall C_callback_adjust_stack_limits(C_word *base); /* DEPRECATED */
1184C_fctexport void C_fcall C_callback_adjust_stack(C_word *base, int size);
1185C_fctexport void CHICKEN_parse_command_line(int argc, char *argv[], C_word *heap, C_word *stack, C_word *symbols);
1186C_fctexport void C_fcall C_toplevel_entry(C_char *name) C_regparm;
1187C_fctexport C_word C_fcall C_enable_interrupts(void) C_regparm;
1188C_fctexport C_word C_fcall C_disable_interrupts(void) C_regparm;
1189C_fctexport void C_fcall C_paranoid_check_for_interrupt(void) C_regparm;
1190C_fctexport double C_fcall C_c_double(C_word x) C_regparm;
1191C_fctexport C_word C_fcall C_num_to_int(C_word x) C_regparm;
1192C_fctexport C_s64 C_fcall C_num_to_int64(C_word x) C_regparm;
1193C_fctexport C_uword C_fcall C_num_to_unsigned_int(C_word x) C_regparm;
1194C_fctexport C_word C_fcall C_int_to_num(C_word **ptr, C_word n) C_regparm;
1195C_fctexport C_word C_fcall C_unsigned_int_to_num(C_word **ptr, C_uword n) C_regparm;
1196C_fctexport C_word C_fcall C_long_to_num(C_word **ptr, long n) C_regparm;
1197C_fctexport C_word C_fcall C_unsigned_long_to_num(C_word **ptr, unsigned long n) C_regparm;
1198C_fctexport long C_fcall C_num_to_long(C_word x) C_regparm;
1199C_fctexport unsigned long C_fcall C_num_to_unsigned_long(C_word x) C_regparm;
1200C_fctexport C_word C_fcall C_flonum_in_int_range_p(C_word n) C_regparm;
1201C_fctexport C_word C_fcall C_flonum_in_uint_range_p(C_word n) C_regparm;
1202C_fctexport C_word C_fcall C_double_to_number(C_word n) C_regparm;
1203C_fctexport char *C_fcall C_string_or_null(C_word x) C_regparm;
1204C_fctexport void *C_fcall C_data_pointer_or_null(C_word x) C_regparm;
1205C_fctexport void *C_fcall C_srfi_4_vector_or_null(C_word x) C_regparm;
1206C_fctexport void *C_fcall C_c_pointer_or_null(C_word x) C_regparm;
1207C_fctexport void *C_fcall C_scheme_or_c_pointer(C_word x) C_regparm;
1208C_fctexport C_word C_fcall C_flonum_in_fixnum_range_p(C_word n) C_regparm;
1209C_fctexport void C_zap_strings(C_word str);
1210C_fctexport void C_set_or_change_heap_size(C_word heap, int reintern);
1211C_fctexport void C_do_resize_stack(C_word stack);
1212C_fctexport C_word C_resize_pending_finalizers(C_word size);
1213C_fctexport void C_initialize_lf(C_word *lf, int count);
1214C_fctexport void *C_register_lf(C_word *lf, int count);
1215C_fctexport void *C_register_lf2(C_word *lf, int count, C_PTABLE_ENTRY *ptable);
1216C_fctexport void C_unregister_lf(void *handle);
1217C_fctexport C_char *C_dump_trace(int start);
1218C_fctexport void C_fcall C_clear_trace_buffer(void) C_regparm;
1219C_fctexport C_word C_fetch_trace(C_word start, C_word buffer);
1220C_fctexport C_word C_fcall C_string(C_word **ptr, int len, C_char *str) C_regparm;
1221C_fctexport C_word C_fcall C_static_string(C_word **ptr, int len, C_char *str) C_regparm;
1222C_fctexport C_word C_fcall C_static_lambda_info(C_word **ptr, int len, C_char *str) C_regparm;
1223C_fctexport C_word C_fcall C_bytevector(C_word **ptr, int len, C_char *str) C_regparm;
1224C_fctexport C_word C_fcall C_pbytevector(int len, C_char *str) C_regparm;
1225C_fctexport C_word C_fcall C_string_aligned8(C_word **ptr, int len, C_char *str) C_regparm;
1226C_fctexport C_word C_fcall C_string2(C_word **ptr, C_char *str) C_regparm;
1227C_fctexport C_word C_fcall C_string2_safe(C_word **ptr, int max, C_char *str) C_regparm;
1228C_fctexport C_word C_fcall C_intern(C_word **ptr, int len, C_char *str) C_regparm;
1229C_fctexport C_word C_fcall C_intern_in(C_word **ptr, int len, C_char *str, C_SYMBOL_TABLE *stable) C_regparm;
1230C_fctexport C_word C_fcall C_h_intern(C_word *slot, int len, C_char *str) C_regparm;
1231C_fctexport C_word C_fcall C_h_intern_in(C_word *slot, int len, C_char *str, C_SYMBOL_TABLE *stable) C_regparm;
1232C_fctexport C_word C_fcall C_intern2(C_word **ptr, C_char *str) C_regparm;
1233C_fctexport C_word C_fcall C_intern3(C_word **ptr, C_char *str, C_word value) C_regparm;
1234C_fctexport C_word C_fcall C_restore_rest(C_word *ptr, int num) C_regparm;
1235C_fctexport C_word C_fcall C_restore_rest_vector(C_word *ptr, int num) C_regparm;
1236C_fctexport void C_bad_memory(void) C_noret;
1237C_fctexport void C_bad_memory_2(void) C_noret;
1238C_fctexport void C_bad_argc(int c, int n) C_noret;
1239C_fctexport void C_bad_min_argc(int c, int n) C_noret;
1240C_fctexport void C_bad_argc_2(int c, int n, C_word closure) C_noret;
1241C_fctexport void C_bad_min_argc_2(int c, int n, C_word closure) C_noret;
1242C_fctexport void C_stack_overflow(void) C_noret;
1243C_fctexport void C_unbound_error(C_word sym) C_noret;
1244C_fctexport void C_no_closure_error(C_word x) C_noret;
1245C_fctexport C_word C_closure(C_word **ptr, int cells, C_word proc, ...);
1246C_fctexport C_word C_fcall C_pair(C_word **ptr, C_word car, C_word cdr) C_regparm;
1247C_fctexport C_word C_fcall C_h_pair(C_word car, C_word cdr) C_regparm;
1248C_fctexport C_word C_fcall C_flonum(C_word **ptr, double n) C_regparm;
1249C_fctexport C_word C_fcall C_number(C_word **ptr, double n) C_regparm;
1250C_fctexport C_word C_fcall C_mpointer(C_word **ptr, void *mp) C_regparm;
1251C_fctexport C_word C_fcall C_mpointer_or_false(C_word **ptr, void *mp) C_regparm;
1252C_fctexport C_word C_fcall C_mpointer(C_word **ptr, void *mp) C_regparm;
1253C_fctexport C_word C_fcall C_mpointer_or_false(C_word **ptr, void *mp) C_regparm;
1254C_fctexport C_word C_fcall C_taggedmpointer(C_word **ptr, C_word tag, void *mp) C_regparm;
1255C_fctexport C_word C_fcall C_taggedmpointer_or_false(C_word **ptr, C_word tag, void *mp) C_regparm;
1256C_fctexport C_word C_fcall C_swigmpointer(C_word **ptr, void *mp, void *sdata) C_regparm;
1257C_fctexport C_word C_vector(C_word **ptr, int n, ...);
1258C_fctexport C_word C_h_vector(int n, ...);
1259C_fctexport C_word C_structure(C_word **ptr, int n, ...);
1260C_fctexport C_word C_h_structure(int n, ...);
1261C_fctexport C_word C_fcall C_mutate(C_word *slot, C_word val) C_regparm;
1262C_fctexport void C_fcall C_reclaim(void *trampoline, void *proc) C_regparm C_noret;
1263C_fctexport void C_save_and_reclaim(void *trampoline, void *proc, int n, ...) C_noret;
1264C_fctexport void C_fcall C_rereclaim(long size) C_regparm; /* deprecated */
1265C_fctexport void C_fcall C_rereclaim2(C_uword size, int double_plus) C_regparm;
1266C_fctexport C_word C_fcall C_retrieve(C_word sym) C_regparm;
1267C_fctexport C_word C_fcall C_retrieve2(C_word val, char *name) C_regparm;
1268C_fctexport void *C_fcall C_retrieve_proc(C_word closure) C_regparm;
1269C_fctexport C_word C_fcall C_permanentp(C_word x) C_regparm;
1270C_fctexport int C_in_stackp(C_word x) C_regparm;
1271C_fctexport int C_fcall C_in_heapp(C_word x) C_regparm;
1272C_fctexport int C_fcall C_in_fromspacep(C_word x) C_regparm;
1273C_fctexport void C_fcall C_trace(C_char *name) C_regparm;
1274C_fctexport C_word C_fcall C_emit_trace_info(C_word x, C_word y, C_word t) C_regparm;
1275C_fctexport C_word C_fcall C_emit_trace_info2(char *raw, C_word x, C_word y, C_word t) C_regparm;
1276C_fctexport C_word C_fcall C_hash_string(C_word str) C_regparm;
1277C_fctexport C_word C_fcall C_hash_string_ci(C_word str) C_regparm;
1278C_fctexport C_word C_halt(C_word msg);
1279C_fctexport C_word C_message(C_word msg);
1280C_fctexport C_word C_fcall C_equalp(C_word x, C_word y) C_regparm;
1281C_fctexport C_word C_fcall C_set_gc_report(C_word flag) C_regparm;
1282C_fctexport C_word C_fcall C_start_timer(void) C_regparm;
1283C_fctexport C_word C_exit_runtime(C_word code);
1284C_fctexport C_word C_fcall C_display_flonum(C_word port, C_word n) C_regparm;
1285C_fctexport C_word C_fcall C_read_char(C_word port) C_regparm;
1286C_fctexport C_word C_fcall C_peek_char(C_word port) C_regparm;
1287C_fctexport C_word C_fcall C_execute_shell_command(C_word string) C_regparm;
1288C_fctexport C_word C_fcall C_char_ready_p(C_word port) C_regparm;
1289C_fctexport C_word C_fcall C_flush_output(C_word port) C_regparm;
1290C_fctexport C_word C_fcall C_fudge(C_word fudge_factor) C_regparm;
1291C_fctexport void C_fcall C_raise_interrupt(int reason) C_regparm;
1292C_fctexport C_word C_fcall C_set_initial_timer_interrupt_period(C_word n) C_regparm;
1293C_fctexport C_word C_fcall C_establish_signal_handler(C_word signum, C_word reason) C_regparm;
1294C_fctexport C_word C_fcall C_fits_in_int_p(C_word x) C_regparm;
1295C_fctexport C_word C_fcall C_fits_in_unsigned_int_p(C_word x) C_regparm;
1296C_fctexport C_word C_fcall C_copy_block(C_word from, C_word to) C_regparm;
1297C_fctexport C_word C_fcall C_evict_block(C_word from, C_word ptr) C_regparm;
1298C_fctexport void C_fcall C_gc_protect(C_word **addr, int n) C_regparm;
1299C_fctexport void C_fcall C_gc_unprotect(int n) C_regparm;
1300C_fctexport C_SYMBOL_TABLE *C_new_symbol_table(char *name, unsigned int size) C_regparm;
1301C_fctexport void C_delete_symbol_table(C_SYMBOL_TABLE *st) C_regparm;
1302C_fctexport void C_set_symbol_table(C_SYMBOL_TABLE *st) C_regparm;
1303C_fctexport C_SYMBOL_TABLE *C_find_symbol_table(char *name) C_regparm;
1304C_fctexport C_word C_find_symbol(C_word str, C_SYMBOL_TABLE *stable) C_regparm;
1305C_fctexport C_word C_fcall C_lookup_symbol(C_word sym) C_regparm;
1306C_fctexport C_word C_enumerate_symbols(C_SYMBOL_TABLE *stable, C_word pos) C_regparm;
1307C_fctexport void C_do_register_finalizer(C_word x, C_word proc);
1308C_fctexport int C_do_unregister_finalizer(C_word x);
1309C_fctexport C_word C_dbg_hook(C_word x);
1310
1311C_fctimport void C_ccall C_toplevel(C_word c, C_word self, C_word k) C_noret;
1312C_fctexport void C_ccall C_stop_timer(C_word c, C_word closure, C_word k) C_noret;
1313C_fctexport void C_ccall C_apply(C_word c, C_word closure, C_word k, C_word fn, ...) C_noret;
1314C_fctexport void C_ccall C_do_apply(C_word n, C_word closure, C_word k) C_noret;
1315C_fctexport void C_ccall C_call_cc(C_word c, C_word closure, C_word k, C_word cont) C_noret;
1316C_fctexport void C_ccall C_continuation_graft(C_word c, C_word closure, C_word k, C_word kk, C_word proc) C_noret;
1317C_fctexport void C_ccall C_values(C_word c, C_word closure, C_word k, ...) C_noret;
1318C_fctexport void C_ccall C_apply_values(C_word c, C_word closure, C_word k, C_word lst) C_noret;
1319C_fctexport void C_ccall C_call_with_values(C_word c, C_word closure, C_word k, C_word thunk, C_word kont) C_noret;
1320C_fctexport void C_ccall C_u_call_with_values(C_word c, C_word closure, C_word k, C_word thunk, C_word kont) C_noret;
1321C_fctexport void C_ccall C_times(C_word c, C_word closure, C_word k, ...) C_noret;
1322C_fctexport void C_ccall C_plus(C_word c, C_word closure, C_word k, ...) C_noret;
1323C_fctexport void C_ccall C_minus(C_word c, C_word closure, C_word k, C_word n1, ...) C_noret;
1324C_fctexport void C_ccall C_divide(C_word c, C_word closure, C_word k, C_word n1, ...) C_noret;
1325C_fctexport void C_ccall C_nequalp(C_word c, C_word closure, C_word k, ...) C_noret;
1326C_fctexport void C_ccall C_greaterp(C_word c, C_word closure, C_word k, ...) C_noret;
1327C_fctexport void C_ccall C_lessp(C_word c, C_word closure, C_word k, ...) C_noret;
1328C_fctexport void C_ccall C_greater_or_equal_p(C_word c, C_word closure, C_word k, ...) C_noret;
1329C_fctexport void C_ccall C_less_or_equal_p(C_word c, C_word closure, C_word k, ...) C_noret;
1330C_fctexport void C_ccall C_expt(C_word c, C_word closure, C_word k, C_word n1, C_word n2) C_noret;
1331C_fctexport void C_ccall C_gc(C_word c, C_word closure, C_word k, ...) C_noret;
1332C_fctexport void C_ccall C_open_file_port(C_word c, C_word closure, C_word k, C_word port, C_word channel, C_word mode) C_noret;
1333C_fctexport void C_ccall C_allocate_vector(C_word c, C_word closure, C_word k, C_word size, C_word type, C_word init, C_word align8) C_noret;
1334C_fctexport void C_ccall C_string_to_symbol(C_word c, C_word closure, C_word k, C_word string) C_noret;
1335C_fctexport void C_ccall C_build_symbol(C_word c, C_word closure, C_word k, C_word string) C_noret;
1336C_fctexport void C_ccall C_cons_flonum(C_word c, C_word closure, C_word k) C_noret;
1337C_fctexport void C_ccall C_flonum_fraction(C_word c, C_word closure, C_word k, C_word n) C_noret;
1338C_fctexport void C_ccall C_exact_to_inexact(C_word c, C_word closure, C_word k, C_word n) C_noret;
1339C_fctexport void C_ccall C_flonum_floor(C_word c, C_word closure, C_word k, C_word n) C_noret;
1340C_fctexport void C_ccall C_flonum_ceiling(C_word c, C_word closure, C_word k, C_word n) C_noret;
1341C_fctexport void C_ccall C_flonum_truncate(C_word c, C_word closure, C_word k, C_word n) C_noret;
1342C_fctexport void C_ccall C_flonum_round(C_word c, C_word closure, C_word k, C_word n) C_noret;
1343C_fctexport void C_ccall C_quotient(C_word c, C_word closure, C_word k, C_word n1, C_word n2) C_noret;
1344C_fctexport void C_ccall C_string_to_number(C_word c, C_word closure, C_word k, C_word str, ...) C_noret;
1345C_fctexport void C_ccall C_number_to_string(C_word c, C_word closure, C_word k, C_word num, ...) C_noret;
1346C_fctexport void C_ccall C_get_argv(C_word c, C_word closure, C_word k) C_noret;
1347C_fctexport void C_ccall C_make_structure(C_word c, C_word closure, C_word k, C_word type, ...) C_noret;
1348C_fctexport void C_ccall C_make_symbol(C_word c, C_word closure, C_word k, C_word name) C_noret;
1349C_fctexport void C_ccall C_make_pointer(C_word c, C_word closure, C_word k) C_noret;
1350C_fctexport void C_ccall C_make_tagged_pointer(C_word c, C_word closure, C_word k, C_word tag) C_noret;
1351C_fctexport void C_ccall C_ensure_heap_reserve(C_word c, C_word closure, C_word k, C_word n) C_noret;
1352C_fctexport void C_ccall C_return_to_host(C_word c, C_word closure, C_word k) C_noret;
1353C_fctexport void C_ccall C_file_info(C_word c, C_word closure, C_word k, C_word port) C_noret;
1354C_fctexport void C_ccall C_get_environment_variable(C_word c, C_word closure, C_word k, C_word name) C_noret;
1355C_fctexport void C_ccall C_get_symbol_table_info(C_word c, C_word closure, C_word k) C_noret;
1356C_fctexport void C_ccall C_get_memory_info(C_word c, C_word closure, C_word k) C_noret;
1357C_fctexport void C_ccall C_context_switch(C_word c, C_word closure, C_word k, C_word state) C_noret;
1358C_fctexport void C_ccall C_peek_signed_integer(C_word c, C_word closure, C_word k, C_word v, C_word index) C_noret;
1359C_fctexport void C_ccall C_peek_unsigned_integer(C_word c, C_word closure, C_word k, C_word v, C_word index) C_noret;
1360C_fctexport void C_ccall C_decode_seconds(C_word c, C_word closure, C_word k, C_word secs, C_word mode) C_noret;
1361C_fctexport void C_ccall C_software_type(C_word c, C_word closure, C_word k) C_noret;
1362C_fctexport void C_ccall C_machine_type(C_word c, C_word closure, C_word k) C_noret;
1363C_fctexport void C_ccall C_machine_byte_order(C_word c, C_word closure, C_word k) C_noret;
1364C_fctexport void C_ccall C_software_version(C_word c, C_word closure, C_word k) C_noret;
1365C_fctexport void C_ccall C_build_platform(C_word c, C_word closure, C_word k) C_noret;
1366C_fctexport void C_ccall C_c_runtime(C_word c, C_word closure, C_word k) C_noret;
1367C_fctexport void C_ccall C_register_finalizer(C_word c, C_word closure, C_word k, C_word x, C_word proc) C_noret;
1368C_fctexport void C_ccall C_set_dlopen_flags(C_word c, C_word closure, C_word k, C_word now, C_word global) C_noret;
1369C_fctexport void C_ccall C_dload(C_word c, C_word closure, C_word k, C_word name, C_word entry, C_word reloadable) C_noret;
1370C_fctexport void C_ccall C_become(C_word c, C_word closure, C_word k, C_word table) C_noret;
1371C_fctexport void C_ccall C_cpu_time(C_word c, C_word closure, C_word k) C_noret;
1372C_fctexport void C_ccall C_locative_ref(C_word c, C_word closure, C_word k, C_word loc) C_noret;
1373C_fctexport void C_ccall C_call_with_cthulhu(C_word c, C_word self, C_word k, C_word proc) C_noret;
1374C_fctexport void C_ccall C_copy_closure(C_word c, C_word closure, C_word k, C_word proc) C_noret;
1375
1376#if !defined(__GNUC__) && !defined(__INTEL_COMPILER)
1377C_fctexport C_word *C_a_i(C_word **a, int n);
1378#endif
1379
1380C_fctexport time_t C_fcall C_seconds(long *ms) C_regparm;
1381C_fctexport C_word C_a_i_list(C_word **a, int c, ...);
1382C_fctexport C_word C_h_list(int c, ...);
1383C_fctexport C_word C_a_i_string(C_word **a, int c, ...);
1384C_fctexport C_word C_a_i_record(C_word **a, int c, ...);
1385C_fctexport C_word C_a_i_port(C_word **a, int c);
1386C_fctexport C_word C_fcall C_a_i_bytevector(C_word **a, int c, C_word x) C_regparm;
1387C_fctexport C_word C_fcall C_i_eqvp(C_word x, C_word y) C_regparm;
1388C_fctexport C_word C_fcall C_i_symbolp(C_word x) C_regparm;
1389C_fctexport C_word C_fcall C_i_pairp(C_word x) C_regparm;
1390C_fctexport C_word C_fcall C_i_vectorp(C_word x) C_regparm;
1391C_fctexport C_word C_fcall C_i_closurep(C_word x) C_regparm;
1392C_fctexport C_word C_fcall C_i_portp(C_word x) C_regparm;
1393C_fctexport C_word C_fcall C_i_stringp(C_word x) C_regparm;
1394C_fctexport C_word C_fcall C_i_numberp(C_word x) C_regparm;
1395C_fctexport C_word C_fcall C_i_integerp(C_word x) C_regparm;
1396C_fctexport C_word C_fcall C_i_flonump(C_word x) C_regparm;
1397C_fctexport C_word C_fcall C_i_finitep(C_word x) C_regparm;
1398C_fctexport C_word C_fcall C_i_locativep(C_word x) C_regparm;
1399C_fctexport C_word C_fcall C_i_fixnum_min(C_word x, C_word y) C_regparm;
1400C_fctexport C_word C_fcall C_i_fixnum_max(C_word x, C_word y) C_regparm;
1401C_fctexport C_word C_fcall C_i_flonum_min(C_word x, C_word y) C_regparm;
1402C_fctexport C_word C_fcall C_i_flonum_max(C_word x, C_word y) C_regparm;
1403C_fctexport C_word C_fcall C_a_i_abs(C_word **a, int c, C_word n) C_regparm;
1404C_fctexport C_word C_fcall C_i_listp(C_word x) C_regparm;
1405C_fctexport C_word C_fcall C_i_string_equal_p(C_word x, C_word y) C_regparm;
1406C_fctexport C_word C_fcall C_i_string_ci_equal_p(C_word x, C_word y) C_regparm;
1407C_fctexport C_word C_fcall C_u_i_string_equal_p(C_word x, C_word y) C_regparm;
1408C_fctexport C_word C_fcall C_i_set_car(C_word p, C_word x) C_regparm;
1409C_fctexport C_word C_fcall C_i_set_cdr(C_word p, C_word x) C_regparm;
1410C_fctexport C_word C_fcall C_i_vector_set(C_word v, C_word i, C_word x) C_regparm;
1411C_fctexport C_word C_fcall C_i_exactp(C_word x) C_regparm;
1412C_fctexport C_word C_fcall C_u_i_exactp(C_word x) C_regparm;
1413C_fctexport C_word C_fcall C_i_inexactp(C_word x) C_regparm;
1414C_fctexport C_word C_fcall C_u_i_inexactp(C_word x) C_regparm;
1415C_fctexport C_word C_fcall C_i_zerop(C_word x) C_regparm;
1416C_fctexport C_word C_fcall C_u_i_zerop(C_word x) C_regparm;
1417C_fctexport C_word C_fcall C_i_positivep(C_word x) C_regparm;
1418C_fctexport C_word C_fcall C_u_i_positivep(C_word x) C_regparm;
1419C_fctexport C_word C_fcall C_i_negativep(C_word x) C_regparm;
1420C_fctexport C_word C_fcall C_u_i_negativep(C_word x) C_regparm;
1421C_fctexport C_word C_fcall C_i_car(C_word x) C_regparm;
1422C_fctexport C_word C_fcall C_i_cdr(C_word x) C_regparm;
1423C_fctexport C_word C_fcall C_i_cadr(C_word x) C_regparm;
1424C_fctexport C_word C_fcall C_i_cddr(C_word x) C_regparm;
1425C_fctexport C_word C_fcall C_i_caddr(C_word x) C_regparm;
1426C_fctexport C_word C_fcall C_i_cdddr(C_word x) C_regparm;
1427C_fctexport C_word C_fcall C_i_cadddr(C_word x) C_regparm;
1428C_fctexport C_word C_fcall C_i_cddddr(C_word x) C_regparm;
1429C_fctexport C_word C_fcall C_i_list_tail(C_word lst, C_word i) C_regparm;
1430C_fctexport C_word C_fcall C_i_evenp(C_word x) C_regparm;
1431C_fctexport C_word C_fcall C_u_i_evenp(C_word x) C_regparm;
1432C_fctexport C_word C_fcall C_i_oddp(C_word x) C_regparm;
1433C_fctexport C_word C_fcall C_u_i_oddp(C_word x) C_regparm;
1434C_fctexport C_word C_fcall C_i_vector_ref(C_word v, C_word i) C_regparm;
1435C_fctexport C_word C_fcall C_i_block_ref(C_word x, C_word i) C_regparm;
1436C_fctexport C_word C_fcall C_i_string_set(C_word s, C_word i, C_word c) C_regparm;
1437C_fctexport C_word C_fcall C_i_string_ref(C_word s, C_word i) C_regparm;
1438C_fctexport C_word C_fcall C_i_vector_length(C_word v) C_regparm;
1439C_fctexport C_word C_fcall C_i_string_length(C_word s) C_regparm;
1440C_fctexport C_word C_fcall C_i_assq(C_word x, C_word lst) C_regparm;
1441C_fctexport C_word C_fcall C_u_i_assq(C_word x, C_word lst) C_regparm;
1442C_fctexport C_word C_fcall C_i_assv(C_word x, C_word lst) C_regparm;
1443C_fctexport C_word C_fcall C_i_assoc(C_word x, C_word lst) C_regparm;
1444C_fctexport C_word C_fcall C_i_memq(C_word x, C_word lst) C_regparm;
1445C_fctexport C_word C_fcall C_u_i_memq(C_word x, C_word lst) C_regparm;
1446C_fctexport C_word C_fcall C_i_memv(C_word x, C_word lst) C_regparm;
1447C_fctexport C_word C_fcall C_i_member(C_word x, C_word lst) C_regparm;
1448C_fctexport C_word C_fcall C_i_length(C_word lst) C_regparm;
1449C_fctexport C_word C_fcall C_i_inexact_to_exact(C_word n) C_regparm;
1450C_fctexport C_word C_fcall C_i_check_exact_2(C_word x, C_word loc) C_regparm;
1451C_fctexport C_word C_fcall C_i_check_number_2(C_word x, C_word loc) C_regparm;
1452C_fctexport C_word C_fcall C_i_check_string_2(C_word x, C_word loc) C_regparm;
1453C_fctexport C_word C_fcall C_i_check_bytevector_2(C_word x, C_word loc) C_regparm;
1454C_fctexport C_word C_fcall C_i_check_symbol_2(C_word x, C_word loc) C_regparm;
1455C_fctexport C_word C_fcall C_i_check_list_2(C_word x, C_word loc) C_regparm;
1456C_fctexport C_word C_fcall C_i_check_pair_2(C_word x, C_word loc) C_regparm;
1457C_fctexport C_word C_fcall C_i_check_vector_2(C_word x, C_word loc) C_regparm;
1458C_fctexport C_word C_fcall C_i_check_structure_2(C_word x, C_word st, C_word loc) C_regparm;
1459C_fctexport C_word C_fcall C_i_check_char_2(C_word x, C_word loc) C_regparm;
1460C_fctexport C_word C_fcall C_2_times(C_word **ptr, C_word x, C_word y) C_regparm;
1461C_fctexport C_word C_fcall C_2_plus(C_word **ptr, C_word x, C_word y) C_regparm;
1462C_fctexport C_word C_fcall C_2_minus(C_word **ptr, C_word x, C_word y) C_regparm;
1463C_fctexport C_word C_fcall C_2_divide(C_word **ptr, C_word x, C_word y) C_regparm;
1464C_fctexport C_word C_fcall C_i_nequalp(C_word x, C_word y) C_regparm;
1465C_fctexport C_word C_fcall C_i_greaterp(C_word x, C_word y) C_regparm;
1466C_fctexport C_word C_fcall C_i_lessp(C_word x, C_word y) C_regparm;
1467C_fctexport C_word C_fcall C_i_greater_or_equalp(C_word x, C_word y) C_regparm;
1468C_fctexport C_word C_fcall C_i_less_or_equalp(C_word x, C_word y) C_regparm;
1469C_fctexport C_word C_fcall C_i_not_pair_p_2(C_word x) C_regparm;
1470C_fctexport C_word C_fcall C_i_null_list_p(C_word x) C_regparm;
1471C_fctexport C_word C_fcall C_i_string_null_p(C_word x) C_regparm;
1472C_fctexport C_word C_fcall C_string_to_pbytevector(C_word x) C_regparm;
1473C_fctexport C_word C_fcall C_i_null_pointerp(C_word x) C_regparm;
1474C_fctexport C_word C_fcall C_i_fixnum_arithmetic_shift(C_word n, C_word c) C_regparm; 
1475C_fctexport C_word C_fcall C_i_locative_set(C_word loc, C_word x) C_regparm;
1476C_fctexport C_word C_fcall C_i_locative_to_object(C_word loc) C_regparm;
1477C_fctexport C_word C_fcall C_a_i_make_locative(C_word **a, int c, C_word type, C_word object, C_word index, C_word weak) C_regparm;
1478C_fctexport C_word C_fcall C_a_i_flonum_plus(C_word **a, int c, C_word n1, C_word n2) C_regparm;
1479C_fctexport C_word C_fcall C_a_i_flonum_difference(C_word **a, int c, C_word n1, C_word n2) C_regparm;
1480C_fctexport C_word C_fcall C_a_i_flonum_times(C_word **a, int c, C_word n1, C_word n2) C_regparm;
1481C_fctexport C_word C_fcall C_a_i_flonum_quotient(C_word **a, int c, C_word n1, C_word n2) C_regparm;
1482C_fctexport C_word C_fcall C_a_i_flonum_negate(C_word **a, int c, C_word n1) C_regparm;
1483C_fctexport C_word C_fcall C_a_i_bitwise_and(C_word **a, int c, C_word n1, C_word n2) C_regparm;
1484C_fctexport C_word C_fcall C_a_i_bitwise_ior(C_word **a, int c, C_word n1, C_word n2) C_regparm;
1485C_fctexport C_word C_fcall C_a_i_bitwise_not(C_word **a, int c, C_word n1) C_regparm;
1486C_fctexport C_word C_fcall C_i_bit_setp(C_word n, C_word i) C_regparm;
1487C_fctexport C_word C_fcall C_a_i_bitwise_xor(C_word **a, int c, C_word n1, C_word n2) C_regparm;
1488C_fctexport C_word C_fcall C_a_i_arithmetic_shift(C_word **a, int c, C_word n1, C_word n2) C_regparm;
1489C_fctexport C_word C_fcall C_a_i_exp(C_word **a, int c, C_word n) C_regparm;
1490C_fctexport C_word C_fcall C_a_i_log(C_word **a, int c, C_word n) C_regparm;
1491C_fctexport C_word C_fcall C_a_i_sin(C_word **a, int c, C_word n) C_regparm;
1492C_fctexport C_word C_fcall C_a_i_cos(C_word **a, int c, C_word n) C_regparm;
1493C_fctexport C_word C_fcall C_a_i_tan(C_word **a, int c, C_word n) C_regparm;
1494C_fctexport C_word C_fcall C_a_i_asin(C_word **a, int c, C_word n) C_regparm;
1495C_fctexport C_word C_fcall C_a_i_acos(C_word **a, int c, C_word n) C_regparm;
1496C_fctexport C_word C_fcall C_a_i_atan(C_word **a, int c, C_word n) C_regparm;
1497C_fctexport C_word C_fcall C_a_i_atan2(C_word **a, int c, C_word n1, C_word n2) C_regparm;
1498C_fctexport C_word C_fcall C_a_i_sqrt(C_word **a, int c, C_word n) C_regparm;
1499C_fctexport C_word C_fcall C_i_o_fixnum_plus(C_word x, C_word y) C_regparm;
1500C_fctexport C_word C_fcall C_i_o_fixnum_difference(C_word x, C_word y) C_regparm;
1501
1502C_fctexport C_word C_fcall C_i_foreign_char_argumentp(C_word x) C_regparm;
1503C_fctexport C_word C_fcall C_i_foreign_fixnum_argumentp(C_word x) C_regparm;
1504C_fctexport C_word C_fcall C_i_foreign_flonum_argumentp(C_word x) C_regparm;
1505C_fctexport C_word C_fcall C_i_foreign_block_argumentp(C_word x) C_regparm;
1506C_fctexport C_word C_fcall C_i_foreign_number_vector_argumentp(C_word t, C_word x) C_regparm;
1507C_fctexport C_word C_fcall C_i_foreign_string_argumentp(C_word x) C_regparm;
1508C_fctexport C_word C_fcall C_i_foreign_symbol_argumentp(C_word x) C_regparm;
1509C_fctexport C_word C_fcall C_i_foreign_tagged_pointer_argumentp(C_word x, C_word t) C_regparm;
1510C_fctexport C_word C_fcall C_i_foreign_pointer_argumentp(C_word x) C_regparm;
1511C_fctexport C_word C_fcall C_i_foreign_scheme_or_c_pointer_argumentp(C_word x) C_regparm;
1512C_fctexport C_word C_fcall C_i_foreign_integer_argumentp(C_word x) C_regparm;
1513C_fctexport C_word C_fcall C_i_foreign_unsigned_integer_argumentp(C_word x) C_regparm;
1514
1515C_fctexport C_char *C_lookup_procedure_id(void *ptr);
1516C_fctexport void *C_lookup_procedure_ptr(C_char *id);
1517C_fctexport C_word C_dunload(C_word name);
1518
1519#ifdef C_SIXTY_FOUR
1520C_fctexport void C_ccall C_peek_signed_integer_32(C_word c, C_word closure, C_word k, C_word v, C_word index) C_noret;
1521C_fctexport void C_ccall C_peek_unsigned_integer_32(C_word c, C_word closure, C_word k, C_word v, C_word index) C_noret;
1522#else
1523# define C_peek_signed_integer_32    C_peek_signed_integer
1524# define C_peek_unsigned_integer_32  C_peek_unsigned_integer
1525#endif
1526
1527C_fctexport C_word C_fcall C_decode_literal(C_word **ptr, C_char *str) C_regparm;
1528
1529/* defined in eval.scm: */
1530C_fctexport  void  CHICKEN_get_error_message(char *buf,int bufsize);
1531C_fctexport  int  CHICKEN_load(char * filename);
1532C_fctexport  int  CHICKEN_read(char * str,C_word *result);
1533C_fctexport  int  CHICKEN_apply_to_string(C_word func,C_word args,char *buf,int bufsize);
1534C_fctexport  int  CHICKEN_apply(C_word func,C_word args,C_word *result);
1535C_fctexport  int  CHICKEN_eval_string_to_string(char *str,char *buf,int bufsize);
1536C_fctexport  int  CHICKEN_eval_to_string(C_word exp,char *buf,int bufsize);
1537C_fctexport  int  CHICKEN_eval_string(char * str,C_word *result);
1538C_fctexport  int  CHICKEN_eval(C_word exp,C_word *result);
1539C_fctexport  int  CHICKEN_yield();
1540
1541C_fctexport void C_default_stub_toplevel(C_word c,C_word d,C_word k) C_noret;
1542
1543C_END_C_DECLS
1544
1545#endif /* ___CHICKEN */
Note: See TracBrowser for help on using the repository browser.