source: project/chicken/branches/release/chicken.h @ 7931

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

merged from prerelease branch rev. 7930 - release version 3.0.0; fixed wrong version numbers in some files

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