external.h 118 KB
Newer Older
1
2
3
/* -*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*- */
/* vim: set filetype=c tabstop=8 shiftwidth=4 expandtab: */

4
5
6
#ifndef ECL_EXTERNAL_H
#define ECL_EXTERNAL_H

7
8
9
10
#ifdef __cplusplus
extern "C" {
#endif

11
#define _ECL_ARGS(x) x
12

13
14
15
16
/*
 * Per-thread data.
 */

17
typedef struct cl_env_struct *cl_env_ptr;
18
struct cl_env_struct {
Daniel Kochmański's avatar
Daniel Kochmański committed
19
20
        /* Flag for disabling interrupts while we call C library functions. */
        volatile int disable_interrupts;
21

Daniel Kochmański's avatar
Daniel Kochmański committed
22
23
24
        /* Array where values are returned by functions. */
        cl_index nvalues;
        cl_object values[ECL_MULTIPLE_VALUES_LIMIT];
25

26
27
28
        /* Environment for calling closures, CLOS generic functions, etc */
        cl_object function;

Daniel Kochmański's avatar
Daniel Kochmański committed
29
30
31
32
33
34
35
36
        /* The four stacks in ECL. */

        /*
         * The lisp stack, which is used mainly for keeping the arguments of a
         * function before it is invoked, and also by the compiler and by the
         * reader when they are building some data structure.
         */
        cl_index stack_size;
37
        cl_index stack_limit_size;
Daniel Kochmański's avatar
Daniel Kochmański committed
38
39
40
41
42
43
44
        cl_object *stack;
        cl_object *stack_top;
        cl_object *stack_limit;

        /*
         * The BinDing Stack stores the bindings of special variables.
         */
45
46
47
#ifdef ECL_THREADS
        cl_index thread_local_bindings_size;
        cl_object *thread_local_bindings;
Daniel Kochmański's avatar
Daniel Kochmański committed
48
        cl_object bindings_array;
49
#endif
Daniel Kochmański's avatar
Daniel Kochmański committed
50
        cl_index bds_size;
51
        cl_index bds_limit_size;
Daniel Kochmański's avatar
Daniel Kochmański committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
        struct ecl_bds_frame *bds_org;
        struct ecl_bds_frame *bds_top;
        struct ecl_bds_frame *bds_limit;

        /*
         * The Invocation History Stack (IHS) keeps a list of the names of the
         * functions that are invoked, together with their lexical
         * environments.
         */
        struct ecl_ihs_frame *ihs_top;

        /*
         * The FRames Stack (FRS) is a list of frames or jump points, and it
         * is used by different high-level constructs (BLOCK, TAGBODY, CATCH...)
         * to set return points.
         */
        cl_index frs_size;
69
        cl_index frs_limit_size;
Daniel Kochmański's avatar
Daniel Kochmański committed
70
71
72
73
        struct ecl_frame *frs_org;
        struct ecl_frame *frs_top;
        struct ecl_frame *frs_limit;
        struct ecl_frame *nlj_fr;
74
        cl_index frame_id;
75

Daniel Kochmański's avatar
Daniel Kochmański committed
76
77
78
79
80
81
        /*
         * The following pointers to the C Stack are used to ensure that a
         * recursive function does not enter an infinite loop and exhausts all
         * memory. They will eventually disappear, because most operating
         * systems already take care of this.
         */
82
83
        cl_index cs_size;
        cl_index cs_limit_size;
84
        cl_index cs_max_size;
Daniel Kochmański's avatar
Daniel Kochmański committed
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
        char *cs_org;
        char *cs_limit;
        char *cs_barrier;

        /* Private variables used by different parts of ECL: */
        /* ... the reader ... */
        cl_object string_pool;

        /* ... the compiler ... */
        struct cl_compiler_env *c_env;

        /* ... the formatter ... */
        cl_object fmt_aux_stream;

        /* ... arithmetics ... */
        /* Note: if you change the size of these registers, change also
           BIGNUM_REGISTER_SIZE in config.h */
        cl_object big_register[3];

        cl_object own_process;
        cl_object pending_interrupt;
        cl_object signal_queue;
        cl_object signal_queue_spinlock;
108
        void *default_sigmask;
109

Daniel Kochmański's avatar
Daniel Kochmański committed
110
111
112
113
114
115
        /* The following is a hash table for caching invocations of
           generic functions. In a multithreaded environment we must
           queue operations in which the hash is cleared from updated
           generic functions. */
        struct ecl_cache *method_cache;
        struct ecl_cache *slot_cache;
116

Daniel Kochmański's avatar
Daniel Kochmański committed
117
        /* foreign function interface */
118
119
#ifdef HAVE_LIBFFI
        cl_index ffi_args_limit;
Daniel Kochmański's avatar
Daniel Kochmański committed
120
        struct _ffi_type **ffi_types;
121
122
123
        union ecl_ffi_values *ffi_values;
        union ecl_ffi_values **ffi_values_ptrs;
#endif
124

Daniel Kochmański's avatar
Daniel Kochmański committed
125
126
127
        /* Alternative stack for processing signals */
        void *altstack;
        cl_index altstack_size;
128
129
130

        /* Floating point interrupts which are trapped */
        int trap_fpe_bits;
131

Daniel Kochmański's avatar
Daniel Kochmański committed
132
133
        /* Old exception filter. Needed by windows. */
        void *old_exception_filter;
134
135
136

        /* List of packages interned when loading a FASL but which have
         * to be explicitely created by the compiled code itself. */
Daniel Kochmański's avatar
Daniel Kochmański committed
137
        cl_object packages_to_be_created;
138
        cl_object packages_to_be_created_p;
139

Daniel Kochmański's avatar
Daniel Kochmański committed
140
141
        /* Segmentation fault address */
        void *fault_address;
142
143

#ifdef ECL_THREADS
Daniel Kochmański's avatar
Daniel Kochmański committed
144
        int cleanup;
145
#endif
jjgarcia's avatar
jjgarcia committed
146
147
};

148
149
150
#ifndef __GNUC__
#define __attribute__(x)
#endif
jjgarcia's avatar
jjgarcia committed
151
#if defined(ECL_THREADS)
152
# ifdef WITH___THREAD
153
#  define cl_env (*cl_env_p)
154
#  define ecl_process_env() cl_env_p
155
   extern __thread cl_env_ptr cl_env_p;
156
# else
157
158
#  define cl_env (*ecl_process_env())
   extern ECL_API cl_env_ptr ecl_process_env(void) __attribute__((const));
159
# endif
160
#else
161
# define cl_env (*cl_env_p)
162
# define ecl_process_env() cl_env_p
163
  extern ECL_API cl_env_ptr cl_env_p;
164
165
166
#endif

/*
167
 * Per-process data. Modify main.d accordingly.
168
169
170
 */

struct cl_core_struct {
Daniel Kochmański's avatar
Daniel Kochmański committed
171
172
173
174
175
        cl_object packages;
        cl_object lisp_package;
        cl_object user_package;
        cl_object keyword_package;
        cl_object system_package;
176
        cl_object ext_package;
Daniel Kochmański's avatar
Daniel Kochmański committed
177
        cl_object clos_package;
jgarcia's avatar
jgarcia committed
178
# ifdef ECL_CLOS_STREAMS
Daniel Kochmański's avatar
Daniel Kochmański committed
179
        cl_object gray_package;
jgarcia's avatar
jgarcia committed
180
# endif
Daniel Kochmański's avatar
Daniel Kochmański committed
181
        cl_object mp_package;
182
        cl_object c_package;
Daniel Kochmański's avatar
Daniel Kochmański committed
183
        cl_object ffi_package;
184

Daniel Kochmański's avatar
Daniel Kochmański committed
185
        cl_object pathname_translations;
186
        cl_object library_pathname;
187

Daniel Kochmański's avatar
Daniel Kochmański committed
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
        cl_object terminal_io;
        cl_object null_stream;
        cl_object standard_input;
        cl_object standard_output;
        cl_object error_output;
        cl_object standard_readtable;
        cl_object dispatch_reader;
        cl_object default_dispatch_macro;

        cl_object char_names;
        cl_object null_string;

        cl_object plus_half;
        cl_object minus_half;
        cl_object imag_unit;
        cl_object minus_imag_unit;
        cl_object imag_two;
        cl_object singlefloat_zero;
        cl_object doublefloat_zero;
        cl_object singlefloat_minus_zero;
        cl_object doublefloat_minus_zero;
209
#ifdef ECL_LONG_FLOAT
Daniel Kochmański's avatar
Daniel Kochmański committed
210
211
        cl_object longfloat_zero;
        cl_object longfloat_minus_zero;
212
#endif
213

Daniel Kochmański's avatar
Daniel Kochmański committed
214
215
216
        cl_object gensym_prefix;
        cl_object gentemp_prefix;
        cl_object gentemp_counter;
217

Daniel Kochmański's avatar
Daniel Kochmański committed
218
        cl_object Jan1st1970UT;
219

Daniel Kochmański's avatar
Daniel Kochmański committed
220
221
        cl_object system_properties;
        cl_object setf_definitions;
222
223

#ifdef ECL_THREADS
Daniel Kochmański's avatar
Daniel Kochmański committed
224
225
226
        cl_object processes;
        cl_object processes_spinlock;
        cl_object global_lock;
227
        cl_object error_lock;
228
        cl_object global_env_lock;
229
#endif
Daniel Kochmański's avatar
Daniel Kochmański committed
230
        cl_object libraries;
231

232
        size_t max_heap_size;
Daniel Kochmański's avatar
Daniel Kochmański committed
233
234
235
236
        cl_object bytes_consed;
        cl_object gc_counter;
        bool gc_stats;
        int path_max;
237
238
#ifdef GBC_BOEHM
        char *safety_region;
239
#endif
240
241
        void *default_sigmask;
        cl_index default_sigmask_bytes;
242
243
244
245
246

#ifdef ECL_THREADS
        cl_index last_var_index;
        cl_object reused_indices;
#endif
Daniel Kochmański's avatar
Daniel Kochmański committed
247
        cl_object slash;
248

Daniel Kochmański's avatar
Daniel Kochmański committed
249
        cl_object compiler_dispatch;
250
251
252

        cl_object rehash_size;
        cl_object rehash_threshold;
253

Daniel Kochmański's avatar
Daniel Kochmański committed
254
        cl_object known_signals;
jjgarcia's avatar
jjgarcia committed
255
256
};

257
extern ECL_API struct cl_core_struct cl_core;
258

259
/* alloc.c / alloc_2.c */
jjgarcia's avatar
jjgarcia committed
260

261
262
extern ECL_API cl_object ecl_alloc_object(cl_type t);
extern ECL_API cl_object ecl_alloc_instance(cl_index slots);
263
extern ECL_API cl_object ecl_cons(cl_object a, cl_object d);
264
extern ECL_API cl_object ecl_list1(cl_object a);
265
#ifdef GBC_BOEHM
266
extern ECL_API cl_object si_gc(cl_narg narg, ...);
267
268
extern ECL_API cl_object si_gc_dump(void);
extern ECL_API cl_object si_gc_stats(cl_object enable);
Samium Gromoff's avatar
Samium Gromoff committed
269
270
extern ECL_API void *ecl_alloc_unprotected(cl_index n);
extern ECL_API void *ecl_alloc_atomic_unprotected(cl_index n);
271
272
extern ECL_API void *ecl_alloc(cl_index n);
extern ECL_API void *ecl_alloc_atomic(cl_index n);
273
274
extern ECL_API void *ecl_alloc_uncollectable(size_t size);
extern ECL_API void ecl_free_uncollectable(void *);
275
276
277
extern ECL_API void ecl_dealloc(void *);
#define ecl_alloc_align(s,d) ecl_alloc(s)
#define ecl_alloc_atomic_align(s,d) ecl_alloc_atomic(s)
278
#define ecl_register_static_root(x) ecl_register_root(x)
279
extern ECL_API cl_object ecl_alloc_compact_object(cl_type t, cl_index extra_space);
280
281
282

extern ECL_API cl_object si_make_weak_pointer(cl_object o);
extern ECL_API cl_object si_weak_pointer_value(cl_object o);
283
#else
284
285
286
287
288
289
290
291
292
293
extern ECL_API cl_object si_allocate _ECL_ARGS((cl_narg narg, cl_object type, cl_object qty, ...));
extern ECL_API cl_object si_maximum_allocatable_pages _ECL_ARGS((cl_narg narg, cl_object type));
extern ECL_API cl_object si_allocated_pages _ECL_ARGS((cl_narg narg, cl_object type));
extern ECL_API cl_object si_alloc_contpage _ECL_ARGS((cl_narg narg, cl_object qty, ...));
extern ECL_API cl_object si_allocated_contiguous_pages _ECL_ARGS((cl_narg narg));
extern ECL_API cl_object si_maximum_contiguous_pages _ECL_ARGS((cl_narg narg));
extern ECL_API cl_object si_allocate_contiguous_pages _ECL_ARGS((cl_narg narg, cl_object qty, ...));
extern ECL_API cl_object si_get_hole_size _ECL_ARGS((cl_narg narg));
extern ECL_API cl_object si_set_hole_size _ECL_ARGS((cl_narg narg, cl_object size));
extern ECL_API cl_object si_ignore_maximum_pages _ECL_ARGS((cl_narg narg, ...));
294
295
extern ECL_API void *ecl_alloc(cl_index n);
extern ECL_API void *ecl_alloc_align(cl_index size, cl_index align);
296
297
extern ECL_API void *ecl_alloc_uncollectable(size_t size);
extern ECL_API void ecl_free_uncollectable(void *);
298
299
300
extern ECL_API void ecl_dealloc(void *p);
#define ecl_alloc_atomic(x) ecl_alloc(x)
#define ecl_alloc_atomic_align(x,s) ecl_alloc_align(x,s)
301
#define ecl_register_static_root(x) ecl_register_root(x);
jjgarcia's avatar
jjgarcia committed
302
303
304
#endif /* GBC_BOEHM */

/* all_symbols */
305

306
extern ECL_API cl_object si_mangle_name _ECL_ARGS((cl_narg narg, cl_object symbol, ...));
307

308
typedef union {
Daniel Kochmański's avatar
Daniel Kochmański committed
309
310
311
312
313
314
315
316
        struct {
                const char *name;
                int type;
                void *fun;
                short narg;
                cl_object value;
        } init;
        struct ecl_symbol data;
317
} cl_symbol_initializer;
318
319
extern ECL_API cl_symbol_initializer cl_symbols[];
extern ECL_API cl_index cl_num_symbols_in_core;
jjgarcia's avatar
jjgarcia committed
320

321
322
#define ECL_SYM(name,code) ((cl_object)(cl_symbols+(code)))

jjgarcia's avatar
jjgarcia committed
323
324
/* apply.c */

325
326
extern ECL_API cl_object APPLY_fixed(cl_narg n, cl_object (*f)(), cl_object *x);
extern ECL_API cl_object APPLY(cl_narg n, cl_objectfn, cl_object *x);
jjgarcia's avatar
jjgarcia committed
327
328
329
330


/* array.c */

331
332
333
extern ECL_API cl_object cl_row_major_aref(cl_object x, cl_object i);
extern ECL_API cl_object si_row_major_aset(cl_object x, cl_object i, cl_object v);
extern ECL_API cl_object si_make_vector(cl_object etype, cl_object dim, cl_object adj, cl_object fillp, cl_object displ, cl_object disploff);
334
335
336
337

/* for open-coding the access while preserving the bounds and type check: */
extern ECL_API void *ecl_row_major_ptr(cl_object arr, cl_index index, cl_index bytes);

338
339
340
341
342
343
extern ECL_API cl_object cl_array_element_type(cl_object a);
extern ECL_API cl_object cl_array_rank(cl_object a);
extern ECL_API cl_object cl_array_dimension(cl_object a, cl_object index);
extern ECL_API cl_object cl_array_total_size(cl_object a);
extern ECL_API cl_object cl_adjustable_array_p(cl_object a);
extern ECL_API cl_object cl_array_displacement(cl_object a);
344
extern ECL_API cl_object si_array_raw_data(cl_object array);
345
extern ECL_API cl_object si_array_element_type_byte_size(cl_object type);
346
347
348
349
350
351
extern ECL_API cl_object cl_svref(cl_object x, cl_object index);
extern ECL_API cl_object si_svset(cl_object x, cl_object index, cl_object v);
extern ECL_API cl_object cl_array_has_fill_pointer_p(cl_object a);
extern ECL_API cl_object cl_fill_pointer(cl_object a);
extern ECL_API cl_object si_fill_pointer_set(cl_object a, cl_object fp);
extern ECL_API cl_object si_replace_array(cl_object old_obj, cl_object new_obj);
352
353
extern ECL_API cl_object cl_aref _ECL_ARGS((cl_narg narg, cl_object x, ...));
extern ECL_API cl_object si_aset _ECL_ARGS((cl_narg narg, cl_object x, ...));
354
extern ECL_API cl_object si_make_pure_array(cl_object etype, cl_object dims, cl_object adj, cl_object fillp, cl_object displ, cl_object disploff);
355
extern ECL_API cl_object si_copy_subarray(cl_object dest, cl_object start0, cl_object orig, cl_object start1, cl_object length);
356
extern ECL_API cl_object si_fill_array_with_elt(cl_object array, cl_object elt, cl_object start, cl_object end);
357

358
extern ECL_API void FEwrong_dimensions(cl_object a, cl_index rank) ecl_attr_noreturn;
359
extern ECL_API cl_index ecl_to_index(cl_object n);
360
extern ECL_API cl_index ecl_array_dimension(cl_object x, cl_index n);
361
extern ECL_API cl_index ecl_array_rank(cl_object x);
362
363
extern ECL_API cl_object ecl_aref_unsafe(cl_object x, cl_index index);
extern ECL_API cl_object ecl_aset_unsafe(cl_object x, cl_index index, cl_object value);
364
365
366
367
368
extern ECL_API cl_object ecl_aref(cl_object x, cl_index index);
extern ECL_API cl_object ecl_aref1(cl_object v, cl_index index);
extern ECL_API cl_object ecl_aset(cl_object x, cl_index index, cl_object value);
extern ECL_API cl_object ecl_aset1(cl_object v, cl_index index, cl_object val);
extern ECL_API void ecl_array_allocself(cl_object x);
369
extern ECL_API cl_object ecl_alloc_simple_vector(cl_index l, cl_elttype aet);
370
371
372
373
374
extern ECL_API cl_elttype ecl_array_elttype(cl_object x);
extern ECL_API cl_elttype ecl_symbol_to_elttype(cl_object x);
extern ECL_API cl_object ecl_elttype_to_symbol(cl_elttype aet);
extern ECL_API void ecl_copy_subarray(cl_object dest, cl_index i0, cl_object orig, cl_index i1, cl_index l);
extern ECL_API void ecl_reverse_subarray(cl_object dest, cl_index i0, cl_index i1);
jjgarcia's avatar
jjgarcia committed
375
376
377
378


/* assignment.c */

379
380
381
extern ECL_API cl_object cl_set(cl_object var, cl_object val);
extern ECL_API cl_object cl_makunbound(cl_object sym);
extern ECL_API cl_object cl_fmakunbound(cl_object sym);
382
extern ECL_API cl_object si_fset _ECL_ARGS((cl_narg narg, cl_object fun, cl_object def, ...));
383
384
385
extern ECL_API cl_object si_get_sysprop(cl_object sym, cl_object prop);
extern ECL_API cl_object si_put_sysprop(cl_object sym, cl_object prop, cl_object value);
extern ECL_API cl_object si_rem_sysprop(cl_object sym, cl_object prop);
386
387
extern ECL_API cl_object ecl_setf_definition(cl_object fname, cl_object createp);
extern ECL_API cl_object si_setf_definition(cl_object fname, cl_object createp);
388

389
extern ECL_API void ecl_clear_compiler_properties(cl_object sym);
jjgarcia's avatar
jjgarcia committed
390
391
392

/* big.c */

Daniel Kochmański's avatar
Daniel Kochmański committed
393
394
395
#define _ecl_big_register0()    ecl_process_env()->big_register[0]
#define _ecl_big_register1()    ecl_process_env()->big_register[1]
#define _ecl_big_register2()    ecl_process_env()->big_register[2]
396
extern ECL_API cl_object _ecl_fix_times_fix(cl_fixnum x, cl_fixnum y);
397
398
extern ECL_API cl_object _ecl_big_register_copy(cl_object x);
extern ECL_API cl_object _ecl_big_register_normalize(cl_object x);
399
400
401
402
403
404
extern ECL_API cl_object _ecl_big_times_fix(cl_object x, cl_fixnum y);
extern ECL_API cl_object _ecl_big_times_big(cl_object x, cl_object y);
extern ECL_API cl_object _ecl_big_plus_fix(cl_object x, cl_fixnum y);
extern ECL_API cl_object _ecl_big_plus_big(cl_object x, cl_object y);
extern ECL_API cl_object _ecl_fix_minus_big(cl_fixnum x, cl_object y);
extern ECL_API cl_object _ecl_big_minus_big(cl_object x, cl_object y);
405
406
407
extern ECL_API cl_object _ecl_fix_divided_by_big(cl_fixnum x, cl_object y);
extern ECL_API cl_object _ecl_big_divided_by_fix(cl_object x, cl_fixnum y);
extern ECL_API cl_object _ecl_big_divided_by_big(cl_object x, cl_object y);
408
extern ECL_API cl_object _ecl_big_gcd(cl_object x, cl_object y);
409
410
extern ECL_API cl_object _ecl_big_ceiling(cl_object x, cl_object y, cl_object *r);
extern ECL_API cl_object _ecl_big_floor(cl_object x, cl_object y, cl_object *r);
411
extern ECL_API cl_object _ecl_big_negate(cl_object x);
412
extern ECL_API void _ecl_big_register_free(cl_object x);
413
extern ECL_API cl_object bignum1(cl_fixnum val);
jjgarcia's avatar
jjgarcia committed
414
415
416
417


/* cfun.c */

418
419
420
extern ECL_API cl_object si_compiled_function_name(cl_object fun);
extern ECL_API cl_object si_compiled_function_block(cl_object fun);
extern ECL_API cl_object cl_function_lambda_expression(cl_object fun);
421
extern ECL_API cl_object si_compiled_function_file(cl_object fun);
422

423
424
425
426
427
428
429
extern ECL_API cl_object ecl_make_cfun(cl_objectfn_fixed c_function, cl_object name, cl_object block, int narg);
extern ECL_API cl_object ecl_make_cfun_va(cl_objectfn c_function, cl_object name, cl_object block);
extern ECL_API cl_object ecl_make_cclosure_va(cl_objectfn c_function, cl_object env, cl_object block);
extern ECL_API void ecl_def_c_function(cl_object sym, cl_objectfn_fixed c_function, int narg);
extern ECL_API void ecl_def_c_macro(cl_object sym, cl_objectfn_fixed c_function, int narg);
extern ECL_API void ecl_def_c_macro_va(cl_object sym, cl_objectfn c_function);
extern ECL_API void ecl_def_c_function_va(cl_object sym, cl_objectfn c_function);
430
extern ECL_API void ecl_set_function_source_file_info(cl_object fun, cl_object source, cl_object position);
431
432
extern ECL_API void ecl_cmp_defmacro(cl_object data);
extern ECL_API void ecl_cmp_defun(cl_object data);
jjgarcia's avatar
jjgarcia committed
433
434
435
436


/* character.c */

437
438
439
440
441
442
443
444
445
446
447
448
449
450
extern ECL_API cl_object cl_digit_char_p _ECL_ARGS((cl_narg narg, cl_object c, ...));
extern ECL_API cl_object cl_charE _ECL_ARGS((cl_narg narg, cl_object c, ...));
extern ECL_API cl_object cl_charNE _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_charL _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_charG _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_charLE _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_charGE _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_char_equal _ECL_ARGS((cl_narg narg, cl_object c, ...));
extern ECL_API cl_object cl_char_not_equal _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_char_lessp _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_char_greaterp _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_char_not_greaterp _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_char_not_lessp _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_digit_char _ECL_ARGS((cl_narg narg, cl_object w, ...));
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466

extern ECL_API cl_object cl_alpha_char_p(cl_object c);
extern ECL_API cl_object cl_alphanumericp(cl_object c);
extern ECL_API cl_object cl_both_case_p(cl_object c);
extern ECL_API cl_object cl_char_code(cl_object c);
extern ECL_API cl_object cl_char_downcase(cl_object c);
extern ECL_API cl_object cl_char_int(cl_object c);
extern ECL_API cl_object cl_char_name(cl_object c);
extern ECL_API cl_object cl_char_upcase(cl_object c);
extern ECL_API cl_object cl_character(cl_object x);
extern ECL_API cl_object cl_code_char(cl_object c);
extern ECL_API cl_object cl_graphic_char_p(cl_object c);
extern ECL_API cl_object cl_lower_case_p(cl_object c);
extern ECL_API cl_object cl_name_char(cl_object s);
extern ECL_API cl_object cl_standard_char_p(cl_object c);
extern ECL_API cl_object cl_upper_case_p(cl_object c);
467
extern ECL_API int ecl_string_case(cl_object s);
468

469
470
471
472
473
474
475
476
477
478
extern ECL_API bool ecl_alpha_char_p(ecl_character c);
extern ECL_API bool ecl_alphanumericp(ecl_character c);
extern ECL_API bool ecl_both_case_p(ecl_character c);
extern ECL_API ecl_character ecl_char_downcase(ecl_character c);
extern ECL_API ecl_character ecl_char_upcase(ecl_character c);
extern ECL_API bool ecl_graphic_char_p(ecl_character c);
extern ECL_API bool ecl_lower_case_p(ecl_character c);
extern ECL_API bool ecl_standard_char_p(ecl_character c);
extern ECL_API bool ecl_base_char_p(ecl_character c);
extern ECL_API bool ecl_upper_case_p(ecl_character c);
479
480

extern ECL_API int ecl_base_string_case(cl_object s);
481
482
483
extern ECL_API ecl_character ecl_char_code(cl_object c);
extern ECL_API ecl_base_char ecl_base_char_code(cl_object c);
extern ECL_API int ecl_digitp(ecl_character i, int r);
484
485
486
487
488
extern ECL_API bool ecl_char_eq(cl_object x, cl_object y);
extern ECL_API int ecl_char_cmp(cl_object x, cl_object y);
extern ECL_API bool ecl_char_equal(cl_object x, cl_object y);
extern ECL_API int ecl_char_compare(cl_object x, cl_object y);
extern ECL_API short ecl_digit_char(cl_fixnum w, cl_fixnum r);
jjgarcia's avatar
jjgarcia committed
489
490
491

/* clos.c */

492
extern ECL_API cl_object cl_find_class _ECL_ARGS((cl_narg narg, cl_object name, ...));
493
extern ECL_API cl_object cl_class_of(cl_object x);
jjgarcia's avatar
jjgarcia committed
494
495
496

/* cmpaux.c */

497
498
499
500
501
502
503
504
505
extern ECL_API cl_object si_specialp(cl_object sym);

extern ECL_API cl_fixnum ecl_ifloor(cl_fixnum x, cl_fixnum y);
extern ECL_API cl_fixnum ecl_imod(cl_fixnum x, cl_fixnum y);
extern ECL_API char ecl_to_char(cl_object x);
extern ECL_API cl_fixnum ecl_to_fixnum(cl_object x);
extern ECL_API cl_index ecl_to_unsigned_integer(cl_object x);
extern ECL_API int ecl_aref_bv(cl_object x, cl_index index);
extern ECL_API int ecl_aset_bv(cl_object x, cl_index index, int value);
506
507
508
extern ECL_API void cl_throw(cl_object tag) /*ecl_attr_noreturn*/;
extern ECL_API void cl_return_from(cl_object block_id, cl_object block_name) /*ecl_attr_noreturn*/;
extern ECL_API void cl_go(cl_object tag_id, cl_object label) /*ecl_attr_noreturn*/;
509
510
extern ECL_API void cl_parse_key(ecl_va_list args, int nkey, cl_object *keys, cl_object *vars, cl_object *rest, bool allow_other_keys);
extern ECL_API cl_object cl_grab_rest_args(ecl_va_list args);
511

jjgarcia's avatar
jjgarcia committed
512
513
/* compiler.c */

514
515
516
517
518
519
extern ECL_API cl_object si_macrolet_function(cl_object form, cl_object env);
extern ECL_API cl_object si_process_lambda_list(cl_object lambda_list, cl_object context);
extern ECL_API cl_object si_process_lambda(cl_object lambda);
extern ECL_API cl_object si_make_lambda(cl_object name, cl_object body);
extern ECL_API cl_object si_function_block_name(cl_object name);
extern ECL_API cl_object si_valid_function_name_p(cl_object name);
520
extern ECL_API cl_object si_process_declarations _ECL_ARGS((cl_narg narg, cl_object body, ...));
521

522
extern ECL_API cl_object si_eval_with_env _ECL_ARGS((cl_narg narg, cl_object form, ...));
jjgarcia's avatar
jjgarcia committed
523
524
525

/* interpreter.c */

526
extern ECL_API cl_object si_interpreter_stack _ECL_ARGS((cl_narg narg));
527
extern ECL_API cl_object ecl_stack_frame_open(cl_env_ptr env, cl_object f, cl_index size);
528
529
530
extern ECL_API void ecl_stack_frame_push(cl_object f, cl_object o);
extern ECL_API void ecl_stack_frame_push_values(cl_object f);
extern ECL_API cl_object ecl_stack_frame_pop_values(cl_object f);
531
extern ECL_API void ecl_stack_frame_close(cl_object f);
jgarcia's avatar
jgarcia committed
532
#define si_apply_from_stack_frame ecl_apply_from_stack_frame
533

534
535
extern ECL_API void FEstack_underflow(void) ecl_attr_noreturn;
extern ECL_API void FEstack_advance(void) ecl_attr_noreturn;
536
537
extern ECL_API cl_object *ecl_stack_grow(cl_env_ptr env);
extern ECL_API cl_object *ecl_stack_set_size(cl_env_ptr env, cl_index new_size);
538
539
extern ECL_API cl_index ecl_stack_push_values(cl_env_ptr env);
extern ECL_API void ecl_stack_pop_values(cl_env_ptr env, cl_index n);
540
extern ECL_API cl_object ecl_interpret(cl_object frame, cl_object env, cl_object bytecodes);
541
542
extern ECL_API cl_object _ecl_bytecodes_dispatch(cl_narg narg, ...);
extern ECL_API cl_object _ecl_bclosure_dispatch(cl_narg narg, ...);
jjgarcia's avatar
jjgarcia committed
543

544
545
/* disassembler.c */

546
547
extern ECL_API cl_object si_bc_disassemble(cl_object v);
extern ECL_API cl_object si_bc_split(cl_object v);
548
extern ECL_API cl_object si_bc_join(cl_object lex, cl_object code, cl_object data, cl_object name);
jjgarcia's avatar
jjgarcia committed
549
550
551

/* error.c */

552
553
extern ECL_API cl_object cl_error _ECL_ARGS((cl_narg narg, cl_object eformat, ...)) ecl_attr_noreturn;
extern ECL_API cl_object cl_cerror _ECL_ARGS((cl_narg narg, cl_object cformat, cl_object eformat, ...));
554

555
extern ECL_API void ecl_internal_error(const char *s) ecl_attr_noreturn;
556
557
558
#ifdef ECL_THREADS
extern ECL_API void ecl_thread_internal_error(const char *s) ecl_attr_noreturn;
#endif
559
extern ECL_API void ecl_unrecoverable_error(cl_env_ptr the_env, const char *message) ecl_attr_noreturn;
560
561
562
563
564
extern ECL_API void ecl_cs_overflow(void) /*ecl_attr_noreturn*/;
extern ECL_API void FEprogram_error(const char *s, int narg, ...) ecl_attr_noreturn;
extern ECL_API void FEprogram_error_noreturn(const char *s, int narg, ...) ecl_attr_noreturn;
extern ECL_API void FEcontrol_error(const char *s, int narg, ...) ecl_attr_noreturn;
extern ECL_API void FEreader_error(const char *s, cl_object stream, int narg, ...) ecl_attr_noreturn;
jjgarcia's avatar
jjgarcia committed
565
#define FEparse_error FEreader_error
566
567
568
569
570
extern ECL_API void FEerror(const char *s, int narg, ...) ecl_attr_noreturn;
extern ECL_API void FEcannot_open(cl_object fn) ecl_attr_noreturn;
extern ECL_API void FEend_of_file(cl_object strm) ecl_attr_noreturn;
extern ECL_API void FEclosed_stream(cl_object strm) ecl_attr_noreturn;
extern ECL_API void FEwrong_type_argument(cl_object type, cl_object value) ecl_attr_noreturn;
571
extern ECL_API void FEwrong_type_only_arg(cl_object function, cl_object type, cl_object value) ecl_attr_noreturn;
572
extern ECL_API void FEwrong_type_nth_arg(cl_object function, cl_narg narg, cl_object value, cl_object type) ecl_attr_noreturn;
573
extern ECL_API void FEwrong_type_key_arg(cl_object function, cl_object keyo, cl_object type, cl_object value) ecl_attr_noreturn;
574
575
extern ECL_API void FEwrong_num_arguments(cl_object fun) ecl_attr_noreturn;
extern ECL_API void FEwrong_num_arguments_anonym(void) ecl_attr_noreturn;
576
extern ECL_API void FEwrong_index(cl_object function, cl_object a, int which, cl_object ndx, cl_index nonincl_limit) ecl_attr_noreturn;
577
578
579
extern ECL_API void FEunbound_variable(cl_object sym) ecl_attr_noreturn;
extern ECL_API void FEinvalid_macro_call(cl_object obj) ecl_attr_noreturn;
extern ECL_API void FEinvalid_variable(const char *s, cl_object obj) ecl_attr_noreturn;
580
extern ECL_API void FEillegal_variable_name(cl_object) ecl_attr_noreturn;
581
extern ECL_API void FEassignment_to_constant(cl_object v) ecl_attr_noreturn;
582
extern ECL_API void FEbinding_a_constant(cl_object v) ecl_attr_noreturn;
583
584
585
extern ECL_API void FEundefined_function(cl_object fname) ecl_attr_noreturn;
extern ECL_API void FEinvalid_function(cl_object obj) ecl_attr_noreturn;
extern ECL_API void FEinvalid_function_name(cl_object obj) ecl_attr_noreturn;
586
extern ECL_API void FEprint_not_readable(cl_object obj) ecl_attr_noreturn;
587
extern ECL_API cl_object CEerror(cl_object c, const char *err_str, int narg, ...);
588
extern ECL_API void FElibc_error(const char *msg, int narg, ...) ecl_attr_noreturn;
589
#if defined(ECL_MS_WINDOWS_HOST) || defined(cygwin)
590
extern ECL_API void FEwin32_error(const char *msg, int narg, ...) ecl_attr_noreturn;
591
#endif
592
593
extern ECL_API cl_object si_signal_type_error(cl_object value, cl_object type) ecl_attr_noreturn;

jjgarcia's avatar
jjgarcia committed
594
595
596

/* eval.c */

597
598
599
extern ECL_API cl_object cl_funcall _ECL_ARGS((cl_narg narg, cl_object fun, ...));
extern ECL_API cl_object cl_apply _ECL_ARGS((cl_narg narg, cl_object fun, cl_object arg, ...));
extern ECL_API cl_object si_safe_eval _ECL_ARGS((cl_narg narg, cl_object form, cl_object env, ...));
600
#define cl_safe_eval(form,env,value) si_safe_eval(3,form,env,value)
601
extern ECL_API cl_object *_ecl_va_sp(cl_narg narg);
602
603
extern ECL_API cl_object si_unlink_symbol(cl_object s);
extern ECL_API cl_object cl_eval(cl_object form);
604
extern ECL_API cl_object cl_constantp _ECL_ARGS((cl_narg narg, cl_object arg, ...));
605
606

#define funcall cl_funcall
607
extern ECL_API cl_object cl_apply_from_stack(cl_index narg, cl_object fun);
608
extern ECL_API cl_object ecl_apply_from_stack_frame(cl_object f, cl_object o);
609
extern ECL_API cl_objectfn ecl_function_dispatch(cl_env_ptr env, cl_object f);
610
extern ECL_API cl_object _ecl_link_call(cl_object sym, cl_objectfn *pLK, cl_object cblock, int narg, ecl_va_list args);
jjgarcia's avatar
jjgarcia committed
611

612
613
614
615
/* ffi/cdata.d */
extern ECL_API cl_object si_get_cdata(cl_object filename);
extern ECL_API cl_object si_add_cdata(cl_object filename, cl_object cdata);

616
/* ffi/libraries.d */
617
extern ECL_API cl_object ecl_make_codeblock();
618
619
620
extern ECL_API cl_object ecl_library_open(cl_object filename, bool force_reload);
extern ECL_API void *ecl_library_symbol(cl_object block, const char *symbol, bool lock);
extern ECL_API cl_object ecl_library_error(cl_object block);
621
extern ECL_API bool ecl_library_close(cl_object block);
622
623
extern ECL_API void ecl_library_close_all(void);

624
/* ffi/mmap.d */
625
extern ECL_API cl_object si_mmap _ECL_ARGS((cl_narg narg, cl_object filename, ...));
626
627
628
extern ECL_API cl_object si_munmap(cl_object map);
extern ECL_API cl_object si_mmap_array(cl_object map);

629
630
631
632
/* ffi/backtrace.d */
extern ECL_API cl_object si_dump_c_backtrace(cl_object size);
extern ECL_API cl_object si_backtrace(cl_object start, cl_object end);

jjgarcia's avatar
jjgarcia committed
633
634
/* ffi.c */

635
extern ECL_API cl_object si_allocate_foreign_data(cl_object tag, cl_object size);
636
extern ECL_API cl_object si_foreign_elt_type_p(cl_object f);
637
extern ECL_API cl_object si_foreign_data_p(cl_object f);
638
extern ECL_API cl_object si_foreign_data_address(cl_object f);
639
extern ECL_API cl_object si_foreign_data_equal(cl_object f1, cl_object f2);
640
641
642
643
644
645
646
647
648
649
650
extern ECL_API cl_object si_foreign_data_pointer(cl_object f, cl_object ndx, cl_object size, cl_object tag);
extern ECL_API cl_object si_foreign_data_ref(cl_object f, cl_object ndx, cl_object size, cl_object tag);
extern ECL_API cl_object si_foreign_data_ref_elt(cl_object f, cl_object ndx, cl_object tag);
extern ECL_API cl_object si_foreign_data_set(cl_object f, cl_object ndx, cl_object value);
extern ECL_API cl_object si_foreign_data_set_elt(cl_object f, cl_object ndx, cl_object tag, cl_object value);
extern ECL_API cl_object si_foreign_data_tag(cl_object x);
extern ECL_API cl_object si_foreign_data_recast(cl_object f, cl_object size, cl_object tag);
extern ECL_API cl_object si_free_foreign_data(cl_object x);
extern ECL_API cl_object si_make_foreign_data_from_array(cl_object x);
extern ECL_API cl_object si_null_pointer_p(cl_object f);
extern ECL_API cl_object si_size_of_foreign_elt_type(cl_object tag);
651
extern ECL_API cl_object si_alignment_of_foreign_elt_type(cl_object tag);
652
extern ECL_API cl_object si_load_foreign_module(cl_object module);
653
extern ECL_API cl_object si_unload_foreign_module(cl_object module);
654
655
656
extern ECL_API cl_object si_find_foreign_symbol(cl_object var, cl_object module, cl_object type, cl_object size);
extern ECL_API cl_object si_call_cfun(cl_narg, cl_object fun, cl_object return_type, cl_object arg_types, cl_object args, ...);
extern ECL_API cl_object si_make_dynamic_callback(cl_narg, cl_object fun, cl_object sym, cl_object return_type, cl_object arg_types, ...);
657
extern ECL_API cl_object si_free_ffi_closure(cl_object closure);
658

659
/* Only foreign data types can be coerced to a pointer */
660
#define ecl_make_pointer(x) ecl_make_foreign_data(ECL_NIL,0,(x))
661
#define ecl_to_pointer(x) ecl_foreign_data_pointer_safe(x)
662
663
664
665
666
extern ECL_API cl_object ecl_make_foreign_data(cl_object tag, cl_index size, void *data);
extern ECL_API cl_object ecl_allocate_foreign_data(cl_object tag, cl_index size);
extern ECL_API void *ecl_foreign_data_pointer_safe(cl_object f);
extern ECL_API char *ecl_base_string_pointer_safe(cl_object f);
extern ECL_API cl_object ecl_null_terminated_base_string(cl_object s);
667
668
extern ECL_API cl_object ecl_foreign_data_ref_elt(void *p, enum ecl_ffi_tag type);
extern ECL_API void ecl_foreign_data_set_elt(void *p, enum ecl_ffi_tag type, cl_object value);
jjgarcia's avatar
jjgarcia committed
669

jjgarcia's avatar
jjgarcia committed
670
671
/* file.c */

Daniel Kochmański's avatar
Daniel Kochmański committed
672
673
674
#define ECL_LISTEN_NO_CHAR      0
#define ECL_LISTEN_AVAILABLE    1
#define ECL_LISTEN_EOF          -1
675

676
677
678
679
680
681
682
683
extern ECL_API cl_object cl_make_synonym_stream(cl_object sym);
extern ECL_API cl_object cl_synonym_stream_symbol(cl_object strm);
extern ECL_API cl_object cl_make_two_way_stream(cl_object strm1, cl_object strm2);
extern ECL_API cl_object cl_two_way_stream_input_stream(cl_object strm);
extern ECL_API cl_object cl_two_way_stream_output_stream(cl_object strm);
extern ECL_API cl_object cl_make_echo_stream(cl_object strm1, cl_object strm2);
extern ECL_API cl_object cl_echo_stream_input_stream(cl_object strm);
extern ECL_API cl_object cl_echo_stream_output_stream(cl_object strm);
684
extern ECL_API cl_object cl_make_string_output_stream _ECL_ARGS((cl_narg narg, ...));
685
686
687
688
689
690
691
692
693
694
695
extern ECL_API cl_object cl_get_output_stream_string(cl_object strm);
extern ECL_API cl_object cl_streamp(cl_object strm);
extern ECL_API cl_object cl_input_stream_p(cl_object strm);
extern ECL_API cl_object cl_output_stream_p(cl_object strm);
extern ECL_API cl_object cl_stream_element_type(cl_object strm);
extern ECL_API cl_object cl_stream_external_format(cl_object strm);
extern ECL_API cl_object cl_file_length(cl_object strm);
extern ECL_API cl_object si_get_string_input_stream_index(cl_object strm);
extern ECL_API cl_object si_make_string_output_stream_from_string(cl_object strng);
extern ECL_API cl_object si_copy_stream(cl_object in, cl_object out);
extern ECL_API cl_object cl_open_stream_p(cl_object strm);
696
extern ECL_API cl_object cl_make_broadcast_stream _ECL_ARGS((cl_narg narg, ...));
697
extern ECL_API cl_object cl_broadcast_stream_streams(cl_object strm);
698
extern ECL_API cl_object cl_make_concatenated_stream _ECL_ARGS((cl_narg narg, ...));
699
extern ECL_API cl_object cl_concatenated_stream_streams(cl_object strm);
700
701
702
703
704
705
extern ECL_API cl_object cl_make_string_input_stream _ECL_ARGS((cl_narg narg, cl_object strng, ...));
extern ECL_API cl_object si_make_sequence_input_stream _ECL_ARGS((cl_narg narg, cl_object vector, ...));
extern ECL_API cl_object si_make_sequence_output_stream _ECL_ARGS((cl_narg narg, cl_object vector, ...));
extern ECL_API cl_object cl_close _ECL_ARGS((cl_narg narg, cl_object strm, ...));
extern ECL_API cl_object cl_open _ECL_ARGS((cl_narg narg, cl_object filename, ...));
extern ECL_API cl_object cl_file_position _ECL_ARGS((cl_narg narg, cl_object file_stream, ...));
706
707
708
709
710
711
extern ECL_API cl_object cl_file_string_length(cl_object stream, cl_object string);
extern ECL_API cl_object si_do_write_sequence(cl_object string, cl_object stream, cl_object start, cl_object end);
extern ECL_API cl_object si_do_read_sequence(cl_object string, cl_object stream, cl_object start, cl_object end);
extern ECL_API cl_object si_file_column(cl_object strm);
extern ECL_API cl_object cl_interactive_stream_p(cl_object strm);
extern ECL_API cl_object si_set_buffering_mode(cl_object strm, cl_object mode);
712
extern ECL_API cl_object si_stream_external_format_set(cl_object strm, cl_object format);
713
714
715

extern ECL_API bool ecl_input_stream_p(cl_object strm);
extern ECL_API bool ecl_output_stream_p(cl_object strm);
716
717
extern ECL_API cl_object ecl_stream_element_type(cl_object strm);
extern ECL_API bool ecl_interactive_stream_p(cl_object strm);
718
extern ECL_API cl_object ecl_open_stream(cl_object fn, enum ecl_smmode smm, cl_object if_exists, cl_object if_does_not_exist, cl_fixnum byte_size, int flags, cl_object external_format);
719
extern ECL_API cl_object ecl_make_string_input_stream(cl_object strng, cl_index istart, cl_index iend);
720
extern ECL_API cl_object ecl_make_string_output_stream(cl_index line_length, int extended);
721
722
extern ECL_API cl_object ecl_read_byte(cl_object strm);
extern ECL_API void ecl_write_byte(cl_object byte, cl_object strm);
723
724
725
726
727
extern ECL_API ecl_character ecl_read_char_noeof(cl_object strm);
extern ECL_API ecl_character ecl_read_char(cl_object strm);
extern ECL_API void ecl_unread_char(ecl_character c, cl_object strm);
extern ECL_API ecl_character ecl_peek_char(cl_object strm);
extern ECL_API ecl_character ecl_write_char(ecl_character c, cl_object strm);
728
729
extern ECL_API void writestr_stream(const char *s, cl_object strm);
extern ECL_API void ecl_force_output(cl_object strm);
730
extern ECL_API void ecl_finish_output(cl_object strm);
731
732
733
734
735
extern ECL_API void ecl_clear_input(cl_object strm);
extern ECL_API void ecl_clear_output(cl_object strm);
extern ECL_API bool ecl_listen_stream(cl_object strm);
extern ECL_API cl_object ecl_file_position(cl_object strm);
extern ECL_API cl_object ecl_file_position_set(cl_object strm, cl_object disp);
736
extern ECL_API cl_object ecl_file_length(cl_object strm);
737
extern ECL_API int ecl_file_column(cl_object strm);
738
extern ECL_API cl_fixnum ecl_normalize_stream_element_type(cl_object element);
739
740
extern ECL_API cl_object ecl_make_stream_from_fd(cl_object fname, int fd, enum ecl_smmode smm, cl_fixnum byte_size, int flags, cl_object external_format);
extern ECL_API cl_object ecl_make_stream_from_FILE(cl_object fname, void *fd, enum ecl_smmode smm, cl_fixnum byte_size, int flags, cl_object external_format);
Samium Gromoff's avatar
Samium Gromoff committed
741
extern ECL_API cl_object si_file_stream_fd(cl_object s);
742
extern ECL_API int ecl_stream_to_handle(cl_object s, bool output);
jjgarcia's avatar
jjgarcia committed
743

744
745
/* finalize.c */

746
extern ECL_API void ecl_set_finalizer_unprotected(cl_object o, cl_object finalizer);
747
748
extern ECL_API cl_object si_get_finalizer(cl_object o);
extern ECL_API cl_object si_set_finalizer(cl_object o, cl_object finalizer);
jjgarcia's avatar
jjgarcia committed
749
750
751

/* format.c */

752
extern ECL_API cl_object cl_format _ECL_ARGS((cl_narg narg, cl_object stream, cl_object string, ...));
jjgarcia's avatar
jjgarcia committed
753
754
755
756

/* gbc.c */

#if !defined(GBC_BOEHM)
757
758
759
extern ECL_API cl_object si_room_report _ECL_ARGS((cl_narg narg));
extern ECL_API cl_object si_reset_gc_count _ECL_ARGS((cl_narg narg));
extern ECL_API cl_object si_gc_time _ECL_ARGS((cl_narg narg));
760
extern ECL_API cl_object si_gc(cl_object area);
jjgarcia's avatar
jjgarcia committed
761
762
763
#define GC_enabled() GC_enable
#define GC_enable() GC_enable = TRUE;
#define GC_disable() GC_enable = FALSE;
764
765
766
767
768
extern ECL_API bool GC_enable;
extern ECL_API cl_object (*GC_enter_hook)(void);
extern ECL_API cl_object (*GC_exit_hook)(void);
extern ECL_API void ecl_register_root(cl_object *p);
extern ECL_API void ecl_gc(cl_type t);
jjgarcia's avatar
jjgarcia committed
769
770
771
#endif

#ifdef GBC_BOEHM
772
773
774
#define GC_enabled() !GC_is_disabled()
#define GC_enable() GC_enable()
#define GC_disable() GC_disable()
775
extern ECL_API void ecl_register_root(cl_object *p);
776
#endif /* GBC_BOEHM */
jjgarcia's avatar
jjgarcia committed
777
778
779
780


/* gfun.c */

781
extern ECL_API void _ecl_set_method_hash_size(cl_env_ptr env, cl_index size);
782
783
784
extern ECL_API cl_object si_clear_gfun_hash(cl_object what);
extern ECL_API cl_object clos_set_funcallable_instance_function(cl_object x, cl_object function_or_t);
extern ECL_API cl_object si_generic_function_p(cl_object instance);
785

786
extern ECL_API cl_object _ecl_standard_dispatch(cl_object frame, cl_object fun);
jjgarcia's avatar
jjgarcia committed
787
788
789
790


/* hash.c */

791
extern ECL_API cl_object cl__make_hash_table(cl_object test, cl_object size, cl_object rehash_size, cl_object rehash_threshold);
792
793
794
795
796
797
798
799
800
801
802
803
extern ECL_API cl_object cl_hash_table_p(cl_object ht);
extern ECL_API cl_object si_hash_set(cl_object key, cl_object ht, cl_object val);
extern ECL_API cl_object cl_remhash(cl_object key, cl_object ht);
extern ECL_API cl_object cl_clrhash(cl_object ht);
extern ECL_API cl_object cl_hash_table_count(cl_object ht);
extern ECL_API cl_object cl_sxhash(cl_object key);
extern ECL_API cl_object cl_maphash(cl_object fun, cl_object ht);
extern ECL_API cl_object cl_hash_table_rehash_size(cl_object ht);
extern ECL_API cl_object cl_hash_table_rehash_threshold(cl_object ht);
extern ECL_API cl_object cl_hash_table_size(cl_object ht);
extern ECL_API cl_object cl_hash_table_test(cl_object ht);
extern ECL_API cl_object si_hash_table_iterator(cl_object ht);
804
805
extern ECL_API cl_object cl_make_hash_table _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_gethash _ECL_ARGS((cl_narg narg, cl_object key, cl_object ht, ...));
806
extern ECL_API cl_object si_copy_hash_table(cl_object orig);
807
808
809
extern ECL_API cl_object si_hash_eql _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object si_hash_equal _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object si_hash_equalp _ECL_ARGS((cl_narg narg, ...));
810
811
extern ECL_API cl_object si_hash_table_content(cl_object ht);
extern ECL_API cl_object si_hash_table_fill(cl_object ht, cl_object values);
Juan Jose Garcia Ripoll's avatar
Juan Jose Garcia Ripoll committed
812
extern ECL_API cl_object si_hash_table_weakness(cl_object ht);
813
extern ECL_API cl_object si_hash_table_synchronized_p(cl_object ht);
814

815
extern ECL_API cl_object ecl_sethash(cl_object key, cl_object hashtable, cl_object value);
816
817
818
extern ECL_API cl_object ecl_gethash(cl_object key, cl_object hash);
extern ECL_API cl_object ecl_gethash_safe(cl_object key, cl_object hash, cl_object def);
extern ECL_API bool ecl_remhash(cl_object key, cl_object hash);
819
extern ECL_API cl_object _ecl_sethash(cl_object key, cl_object hashtable, cl_object value);
820
extern ECL_API cl_index ecl_hash_table_count(cl_object hash);
jjgarcia's avatar
jjgarcia committed
821
822
823

/* instance.c */

824
825
826
827
extern ECL_API cl_object si_allocate_raw_instance(cl_object orig, cl_object clas, cl_object size);
extern ECL_API cl_object si_instance_class(cl_object x);
extern ECL_API cl_object si_instance_class_set(cl_object x, cl_object y);
extern ECL_API cl_object si_instance_ref(cl_object x, cl_object index);
828
extern ECL_API cl_object clos_safe_instance_ref(cl_object x, cl_object index);
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
extern ECL_API cl_object si_instance_set(cl_object x, cl_object index, cl_object value);
extern ECL_API cl_object si_instancep(cl_object x);
extern ECL_API cl_object si_unbound(void);
extern ECL_API cl_object si_sl_boundp(cl_object x);
extern ECL_API cl_object si_sl_makunbound(cl_object x, cl_object index);
extern ECL_API cl_object si_instance_sig(cl_object x);
extern ECL_API cl_object si_instance_sig_set(cl_object x);

extern ECL_API cl_object ecl_allocate_instance(cl_object clas, cl_index size);
extern ECL_API cl_object ecl_instance_ref(cl_object x, cl_fixnum i);
extern ECL_API cl_object ecl_instance_set(cl_object x, cl_fixnum i, cl_object v);
extern ECL_API cl_object si_copy_instance(cl_object x);

extern ECL_API cl_object ecl_slot_value(cl_object x, const char *slot);
extern ECL_API cl_object ecl_slot_value_set(cl_object x, const char *slot, cl_object y);
jjgarcia's avatar
jjgarcia committed
844
845
846
847


/* list.c */

jjgarcia's avatar
jjgarcia committed
848
849
850
851
852
#define cl_rest cl_cdr
#define cl_first cl_car
#define cl_second cl_cadr
#define cl_third cl_caddr
#define cl_fourth cl_cadddr
853

854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
extern ECL_API cl_object cl_fifth(cl_object x);
extern ECL_API cl_object cl_sixth(cl_object x);
extern ECL_API cl_object cl_seventh(cl_object x);
extern ECL_API cl_object cl_eighth(cl_object x);
extern ECL_API cl_object cl_ninth(cl_object x);
extern ECL_API cl_object cl_tenth(cl_object x);
extern ECL_API cl_object cl_endp(cl_object x);
extern ECL_API cl_object cl_list_length(cl_object x);
extern ECL_API cl_object cl_nth(cl_object n, cl_object x);
extern ECL_API cl_object cl_nthcdr(cl_object n, cl_object x);
extern ECL_API cl_object cl_copy_list(cl_object x);
extern ECL_API cl_object cl_copy_alist(cl_object x);
extern ECL_API cl_object cl_copy_tree(cl_object x);
extern ECL_API cl_object cl_revappend(cl_object x, cl_object y);
extern ECL_API cl_object cl_ldiff(cl_object x, cl_object y);
extern ECL_API cl_object cl_rplaca(cl_object x, cl_object v);
extern ECL_API cl_object cl_rplacd(cl_object x, cl_object v);
extern ECL_API cl_object cl_tailp(cl_object y, cl_object x);
extern ECL_API cl_object si_memq(cl_object x, cl_object l);
extern ECL_API cl_object cl_nreconc(cl_object x, cl_object y);
extern ECL_API cl_object cl_cons(cl_object x, cl_object y);
extern ECL_API cl_object cl_acons(cl_object x, cl_object y, cl_object z);
876
877
878
879
880
881
882
883
884
885
886
887
888
889
extern ECL_API cl_object cl_list _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_listX _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_append _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_tree_equal _ECL_ARGS((cl_narg narg, cl_object x, cl_object y, ...));
extern ECL_API cl_object cl_last _ECL_ARGS((cl_narg narg, cl_object x, ...));
extern ECL_API cl_object cl_make_list _ECL_ARGS((cl_narg narg, cl_object size, ...));
extern ECL_API cl_object cl_nconc _ECL_ARGS((cl_narg narg, ...));
extern ECL_API cl_object cl_butlast _ECL_ARGS((cl_narg narg, cl_object lis, ...));
extern ECL_API cl_object cl_nbutlast _ECL_ARGS((cl_narg narg, cl_object lis, ...));
extern ECL_API cl_object cl_subst _ECL_ARGS((cl_narg narg, cl_object new_obj, cl_object old_obj, cl_object tree, ...));
extern ECL_API cl_object cl_nsubst _ECL_ARGS((cl_narg narg, cl_object new_obj, cl_object old_obj, cl_object tree, ...));
extern ECL_API cl_object cl_sublis _ECL_ARGS((cl_narg narg, cl_object alist, cl_object tree, ...));
extern ECL_API cl_object cl_nsublis _ECL_ARGS((cl_narg narg, cl_object alist, cl_object tree, ...));
extern ECL_API cl_object cl_member _ECL_ARGS((cl_narg narg, cl_object item, cl_object list, ...));
890
extern ECL_API cl_object si_member1 (cl_object item, cl_object list, cl_object test, cl_object test_not, cl_object key);
891
892
893
894
extern ECL_API cl_object cl_adjoin _ECL_ARGS((cl_narg narg, cl_object item, cl_object list, ...));
extern ECL_API cl_object cl_pairlis _ECL_ARGS((cl_narg narg, cl_object keys, cl_object data, ...));
extern ECL_API cl_object cl_rassoc _ECL_ARGS((cl_narg narg, cl_object item, cl_object alist, ...));
extern ECL_API cl_object cl_assoc _ECL_ARGS((cl_narg narg, cl_object item, cl_object alist, ...));
895
extern ECL_API cl_object si_proper_list_p(cl_object V1);
896

897
898
899
extern ECL_API cl_object ecl_last(cl_object x, cl_index n);
extern ECL_API cl_object ecl_butlast(cl_object x, cl_index n);
extern ECL_API cl_object ecl_nbutlast(cl_object x, cl_index n);
900
901
902
903
904
905
906
907
908
909
910
911
912
extern ECL_API cl_object ecl_append(cl_object x, cl_object y);
extern ECL_API bool ecl_endp(cl_object x);
extern ECL_API cl_object ecl_nth(cl_fixnum n, cl_object x);
extern ECL_API cl_object ecl_nthcdr(cl_fixnum n, cl_object x);
extern ECL_API cl_object ecl_nconc(cl_object x, cl_object y);
extern ECL_API bool ecl_member_eq(cl_object x, cl_object l);
extern ECL_API cl_object ecl_memql(cl_object x, cl_object l);
extern ECL_API cl_object ecl_member(cl_object x, cl_object l);
extern ECL_API cl_object ecl_assq(cl_object x, cl_object l);
extern ECL_API cl_object ecl_assql(cl_object x, cl_object l);
extern ECL_API cl_object ecl_assoc(cl_object x, cl_object l);
extern ECL_API cl_object ecl_assqlp(cl_object x, cl_object l);
extern ECL_API cl_object ecl_remove_eq(cl_object x, cl_object l);
913
extern ECL_API cl_object ecl_delete_eq(cl_object x, cl_object l);
914
915
#define si_cons_car cl_car
#define si_cons_cdr cl_cdr
jjgarcia's avatar
jjgarcia committed
916
917
918
919


/* load.c */

920
extern ECL_API cl_object si_load_bytecodes(cl_object file, cl_object verbose, cl_object print, cl_object format);
921
922
extern ECL_API cl_object si_load_source(cl_object file, cl_object verbose, cl_object print, cl_object format);
extern ECL_API cl_object si_load_binary(cl_object file, cl_object verbose, cl_object print, cl_object format);
923
extern ECL_API cl_object cl_load _ECL_ARGS((cl_narg narg, cl_object pathname, ...));
924

jjgarcia's avatar
jjgarcia committed
925
926
/* macros.c */

927
928
929
extern ECL_API cl_object cl_macroexpand _ECL_ARGS((cl_narg narg, cl_object form, ...));
extern ECL_API cl_object cl_macroexpand_1 _ECL_ARGS((cl_narg narg, cl_object form, ...));
extern ECL_API cl_object cl_macro_function _ECL_ARGS((cl_narg narg, cl_object sym, ...));
jjgarcia's avatar
jjgarcia committed
930
931
932
933


/* main.c */

934
935
936
937
extern ECL_API cl_object si_argc(void);
extern ECL_API cl_object si_argv(cl_object index);
extern ECL_API cl_object si_getenv(cl_object var);
extern ECL_API cl_object si_setenv(cl_object var, cl_object value);
938
extern ECL_API cl_object si_environ(void);
939
extern ECL_API cl_object si_pointer(cl_object x);
940
941
extern ECL_API cl_object si_quit _ECL_ARGS((cl_narg narg, ...)) /*ecl_attr_noreturn*/;
extern ECL_API cl_object si_exit _ECL_ARGS((cl_narg narg, ...)) ecl_attr_noreturn;
942

943
typedef enum {
Daniel Kochmański's avatar
Daniel Kochmański committed
944
945
946
947
948
949
        ECL_OPT_INCREMENTAL_GC = 0,
        ECL_OPT_TRAP_SIGSEGV,
        ECL_OPT_TRAP_SIGFPE,
        ECL_OPT_TRAP_SIGINT,
        ECL_OPT_TRAP_SIGILL,
        ECL_OPT_TRAP_SIGBUS,
Juan Jose Garcia Ripoll's avatar
Juan Jose Garcia Ripoll committed
950
        ECL_OPT_TRAP_SIGPIPE,
Daniel Kochmański's avatar
Daniel Kochmański committed
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
        ECL_OPT_TRAP_INTERRUPT_SIGNAL,
        ECL_OPT_SIGNAL_HANDLING_THREAD,
        ECL_OPT_SIGNAL_QUEUE_SIZE,
        ECL_OPT_BOOTED,
        ECL_OPT_BIND_STACK_SIZE,
        ECL_OPT_BIND_STACK_SAFETY_AREA,
        ECL_OPT_FRAME_STACK_SIZE,
        ECL_OPT_FRAME_STACK_SAFETY_AREA,
        ECL_OPT_LISP_STACK_SIZE,
        ECL_OPT_LISP_STACK_SAFETY_AREA,
        ECL_OPT_C_STACK_SIZE,
        ECL_OPT_C_STACK_SAFETY_AREA,
        ECL_OPT_SIGALTSTACK_SIZE,
        ECL_OPT_HEAP_SIZE,
        ECL_OPT_HEAP_SAFETY_AREA,
966
        ECL_OPT_THREAD_INTERRUPT_SIGNAL,
967
        ECL_OPT_SET_GMP_MEMORY_FUNCTIONS,
Daniel Kochmański's avatar
Daniel Kochmański committed
968
969
        ECL_OPT_USE_SETMODE_ON_FILES,
        ECL_OPT_LIMIT
970
} ecl_option;
971

972
extern ECL_API const char *ecl_self;
973
974
extern ECL_API void ecl_set_option(int option, cl_fixnum value);
extern ECL_API cl_fixnum ecl_get_option(int option);
975
extern ECL_API int cl_boot