external.h 121 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;

29
30
31
        /* Current stack frame */
        cl_object stack_frame;

Daniel Kochmański's avatar
Daniel Kochmański committed
32
33
34
35
36
37
38
39
        /* 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;
40
        cl_index stack_limit_size;
Daniel Kochmański's avatar
Daniel Kochmański committed
41
42
43
44
45
46
47
        cl_object *stack;
        cl_object *stack_top;
        cl_object *stack_limit;

        /*
         * The BinDing Stack stores the bindings of special variables.
         */
48
49
50
#ifdef ECL_THREADS
        cl_index thread_local_bindings_size;
        cl_object *thread_local_bindings;
Daniel Kochmański's avatar
Daniel Kochmański committed
51
        cl_object bindings_array;
52
#endif
Daniel Kochmański's avatar
Daniel Kochmański committed
53
        cl_index bds_size;
54
        cl_index bds_limit_size;
Daniel Kochmański's avatar
Daniel Kochmański committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
        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;
72
        cl_index frs_limit_size;
Daniel Kochmański's avatar
Daniel Kochmański committed
73
74
75
76
        struct ecl_frame *frs_org;
        struct ecl_frame *frs_top;
        struct ecl_frame *frs_limit;
        struct ecl_frame *nlj_fr;
77
        cl_index frame_id;
78

Daniel Kochmański's avatar
Daniel Kochmański committed
79
80
81
82
83
84
        /*
         * 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.
         */
85
86
        cl_index cs_size;
        cl_index cs_limit_size;
87
        cl_index cs_max_size;
Daniel Kochmański's avatar
Daniel Kochmański committed
88
89
90
91
92
        char *cs_org;
        char *cs_limit;
        char *cs_barrier;

        /* Private variables used by different parts of ECL: */
93
        /* ... the reader and printer ... */
Daniel Kochmański's avatar
Daniel Kochmański committed
94
95
96
97
98
99
        cl_object string_pool;

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

        /* ... the formatter ... */
100
#if !defined(ECL_CMU_FORMAT)
Daniel Kochmański's avatar
Daniel Kochmański committed
101
        cl_object fmt_aux_stream;
102
#endif
Daniel Kochmański's avatar
Daniel Kochmański committed
103
104
105
106

        /* ... arithmetics ... */
        /* Note: if you change the size of these registers, change also
           BIGNUM_REGISTER_SIZE in config.h */
107
108
        /* FIXME: actually use BIGNUM_REGISTER_SIZE; Also fix
           handle_all_queued_interrupt_safe in unixint.d */
Daniel Kochmański's avatar
Daniel Kochmański committed
109
110
111
        cl_object big_register[3];

        cl_object own_process;
112
113
114
115
        /* The objects in this struct need to be writeable from a
           different thread, if environment is write-protected by
           mprotect. Hence they have to be allocated seperately. */
        struct ecl_interrupt_struct *interrupt_struct;
116
        void *default_sigmask;
117

Daniel Kochmański's avatar
Daniel Kochmański committed
118
119
120
121
122
123
        /* 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;
124

Daniel Kochmański's avatar
Daniel Kochmański committed
125
        /* foreign function interface */
126
127
#ifdef HAVE_LIBFFI
        cl_index ffi_args_limit;
Daniel Kochmański's avatar
Daniel Kochmański committed
128
        struct _ffi_type **ffi_types;
129
130
131
        union ecl_ffi_values *ffi_values;
        union ecl_ffi_values **ffi_values_ptrs;
#endif
132

133
134
        /* Floating point interrupts which are trapped */
        int trap_fpe_bits;
135

136
137
        /* 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
138
        cl_object packages_to_be_created;
139
        cl_object packages_to_be_created_p;
140

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

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

149
150
151
152
153
154
struct ecl_interrupt_struct {
        cl_object pending_interrupt;
        cl_object signal_queue;
        cl_object signal_queue_spinlock;
};

155
156
157
#ifndef __GNUC__
#define __attribute__(x)
#endif
jjgarcia's avatar
jjgarcia committed
158
#if defined(ECL_THREADS)
159
160
161
# define cl_env (*ecl_process_env())
  extern ECL_API cl_env_ptr ecl_process_env(void) __attribute__((const));
  extern ECL_API cl_env_ptr ecl_process_env_unsafe(void) __attribute__((const));
162
#else
163
# define cl_env (*cl_env_p)
164
# define ecl_process_env() cl_env_p
165
# define ecl_process_env_unsafe() cl_env_p
166
  extern ECL_API cl_env_ptr cl_env_p;
167
168
169
#endif

/*
170
 * Per-process data. Modify main.d accordingly.
171
172
173
 */

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

Daniel Kochmański's avatar
Daniel Kochmański committed
188
        cl_object pathname_translations;
189
        cl_object library_pathname;
190

Daniel Kochmański's avatar
Daniel Kochmański committed
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
        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;
        cl_object longfloat_zero;
        cl_object longfloat_minus_zero;
214

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

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

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

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

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

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

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

        cl_object rehash_size;
        cl_object rehash_threshold;
254

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

258
extern ECL_API struct cl_core_struct cl_core;
259

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

262
263
extern ECL_API cl_object ecl_alloc_object(cl_type t);
extern ECL_API cl_object ecl_alloc_instance(cl_index slots);
264
extern ECL_API cl_object ecl_cons(cl_object a, cl_object d);
265
extern ECL_API cl_object ecl_list1(cl_object a);
266
#ifdef GBC_BOEHM
267
extern ECL_API cl_object si_gc(cl_narg narg, ...);
268
269
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
270
271
extern ECL_API void *ecl_alloc_unprotected(cl_index n);
extern ECL_API void *ecl_alloc_atomic_unprotected(cl_index n);
272
273
extern ECL_API void *ecl_alloc(cl_index n);
extern ECL_API void *ecl_alloc_atomic(cl_index n);
274
275
extern ECL_API void *ecl_alloc_uncollectable(size_t size);
extern ECL_API void ecl_free_uncollectable(void *);
276
277
278
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)
279
#define ecl_register_static_root(x) ecl_register_root(x)
280
extern ECL_API cl_object ecl_alloc_compact_object(cl_type t, cl_index extra_space);
281
282
283

extern ECL_API cl_object si_make_weak_pointer(cl_object o);
extern ECL_API cl_object si_weak_pointer_value(cl_object o);
284
#else
285
286
287
288
289
290
291
292
293
294
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, ...));
295
296
extern ECL_API void *ecl_alloc(cl_index n);
extern ECL_API void *ecl_alloc_align(cl_index size, cl_index align);
297
298
extern ECL_API void *ecl_alloc_uncollectable(size_t size);
extern ECL_API void ecl_free_uncollectable(void *);
299
300
301
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)
302
#define ecl_register_static_root(x) ecl_register_root(x);
jjgarcia's avatar
jjgarcia committed
303
304
305
#endif /* GBC_BOEHM */

/* all_symbols */
306

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

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

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

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

326
327
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
328
329
330
331


/* array.c */

332
333
334
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);
335
336
337
338

/* 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);

339
340
341
342
343
344
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);
345
extern ECL_API cl_object si_array_raw_data(cl_object array);
346
extern ECL_API cl_object si_array_element_type_byte_size(cl_object type);
347
348
349
350
351
352
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);
353
354
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, ...));
355
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);
356
extern ECL_API cl_object si_copy_subarray(cl_object dest, cl_object start0, cl_object orig, cl_object start1, cl_object length);
357
extern ECL_API cl_object si_fill_array_with_elt(cl_object array, cl_object elt, cl_object start, cl_object end);
358

359
extern ECL_API void FEwrong_dimensions(cl_object a, cl_index rank) ecl_attr_noreturn;
360
extern ECL_API cl_index ecl_to_index(cl_object n);
361
extern ECL_API cl_index ecl_array_dimension(cl_object x, cl_index n);
362
extern ECL_API cl_index ecl_array_rank(cl_object x);
363
364
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);
365
366
367
368
369
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);
370
extern ECL_API cl_object ecl_alloc_simple_vector(cl_index l, cl_elttype aet);
371
372
373
374
375
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
376

377
#ifdef ECL_THREADS
378
extern ECL_API cl_object mp_compare_and_swap_svref(cl_object x, cl_object index, cl_object old_val, cl_object new_val);
379
380
extern ECL_API cl_object mp_atomic_incf_svref(cl_object x, cl_object index, cl_object increment);
#endif
jjgarcia's avatar
jjgarcia committed
381
382
383

/* assignment.c */

384
385
386
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);
387
extern ECL_API cl_object si_fset _ECL_ARGS((cl_narg narg, cl_object fun, cl_object def, ...));
388
389
390
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);
391
392
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);
393

394
extern ECL_API void ecl_clear_compiler_properties(cl_object sym);
jjgarcia's avatar
jjgarcia committed
395

396
#ifdef ECL_THREADS
397
extern ECL_API cl_object mp_compare_and_swap_symbol_value(cl_object x, cl_object old_val, cl_object new_val);
398
399
400
extern ECL_API cl_object mp_atomic_incf_symbol_value(cl_object x, cl_object increment);
#endif

jjgarcia's avatar
jjgarcia committed
401
402
/* big.c */

Daniel Kochmański's avatar
Daniel Kochmański committed
403
404
405
#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]
406
extern ECL_API cl_object _ecl_fix_times_fix(cl_fixnum x, cl_fixnum y);
407
408
extern ECL_API cl_object _ecl_big_register_copy(cl_object x);
extern ECL_API cl_object _ecl_big_register_normalize(cl_object x);
409
410
411
412
413
414
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);
415
416
417
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);
418
extern ECL_API cl_object _ecl_big_gcd(cl_object x, cl_object y);
419
420
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);
421
extern ECL_API cl_object _ecl_big_negate(cl_object x);
422
extern ECL_API void _ecl_big_register_free(cl_object x);
423
extern ECL_API cl_object bignum1(cl_fixnum val);
jjgarcia's avatar
jjgarcia committed
424
425
426
427


/* cfun.c */

428
429
430
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);
431
extern ECL_API cl_object si_compiled_function_file(cl_object fun);
432

433
434
435
436
437
438
439
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);
440
extern ECL_API void ecl_set_function_source_file_info(cl_object fun, cl_object source, cl_object position);
441
442
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
443
444
445
446


/* character.c */

447
448
449
450
451
452
453
454
455
456
457
458
459
460
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, ...));
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476

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);
477
extern ECL_API int ecl_string_case(cl_object s);
478

479
480
481
482
483
484
485
486
487
488
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);
489
490

extern ECL_API int ecl_base_string_case(cl_object s);
491
492
493
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);
494
495
496
497
498
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
499
500
501

/* clos.c */

502
extern ECL_API cl_object cl_find_class _ECL_ARGS((cl_narg narg, cl_object name, ...));
503
extern ECL_API cl_object cl_class_of(cl_object x);
jjgarcia's avatar
jjgarcia committed
504
505
506

/* cmpaux.c */

507
508
509
510
511
512
513
514
515
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);
516
517
518
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*/;
519
520
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);
521

jjgarcia's avatar
jjgarcia committed
522
523
/* compiler.c */

524
525
526
527
528
529
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);
530
extern ECL_API cl_object si_process_declarations _ECL_ARGS((cl_narg narg, cl_object body, ...));
531

532
extern ECL_API cl_object si_eval_with_env _ECL_ARGS((cl_narg narg, cl_object form, ...));
jjgarcia's avatar
jjgarcia committed
533
534
535

/* interpreter.c */

536
extern ECL_API cl_object si_interpreter_stack _ECL_ARGS((cl_narg narg));
537
extern ECL_API cl_object ecl_stack_frame_open(cl_env_ptr env, cl_object f, cl_index size);
538
539
540
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);
541
extern ECL_API void ecl_stack_frame_close(cl_object f);
jgarcia's avatar
jgarcia committed
542
#define si_apply_from_stack_frame ecl_apply_from_stack_frame
543

544
545
extern ECL_API void FEstack_underflow(void) ecl_attr_noreturn;
extern ECL_API void FEstack_advance(void) ecl_attr_noreturn;
546
547
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);
548
549
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);
550
extern ECL_API cl_object ecl_interpret(cl_object frame, cl_object env, cl_object bytecodes);
551
552
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
553

554
555
/* disassembler.c */

556
557
extern ECL_API cl_object si_bc_disassemble(cl_object v);
extern ECL_API cl_object si_bc_split(cl_object v);
558
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
559
560
561

/* error.c */

562
563
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, ...));
564

565
extern ECL_API void ecl_internal_error(const char *s) ecl_attr_noreturn;
566
567
568
#ifdef ECL_THREADS
extern ECL_API void ecl_thread_internal_error(const char *s) ecl_attr_noreturn;
#endif
569
extern ECL_API void ecl_unrecoverable_error(cl_env_ptr the_env, const char *message) ecl_attr_noreturn;
570
571
572
573
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 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
574
#define FEparse_error FEreader_error
575
576
577
578
579
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;
580
extern ECL_API void FEwrong_type_only_arg(cl_object function, cl_object type, cl_object value) ecl_attr_noreturn;
581
extern ECL_API void FEwrong_type_nth_arg(cl_object function, cl_narg narg, cl_object value, cl_object type) ecl_attr_noreturn;
582
extern ECL_API void FEwrong_type_key_arg(cl_object function, cl_object keyo, cl_object type, cl_object value) ecl_attr_noreturn;
583
584
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;
585
extern ECL_API void FEwrong_index(cl_object function, cl_object a, int which, cl_object ndx, cl_index nonincl_limit) ecl_attr_noreturn;
586
587
588
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;
589
extern ECL_API void FEillegal_variable_name(cl_object) ecl_attr_noreturn;
590
extern ECL_API void FEassignment_to_constant(cl_object v) ecl_attr_noreturn;
591
extern ECL_API void FEbinding_a_constant(cl_object v) ecl_attr_noreturn;
592
593
594
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;
595
extern ECL_API void FEprint_not_readable(cl_object obj) ecl_attr_noreturn;
596
extern ECL_API cl_object CEerror(cl_object c, const char *err_str, int narg, ...);
597
extern ECL_API void FElibc_error(const char *msg, int narg, ...) ecl_attr_noreturn;
598
#if defined(ECL_MS_WINDOWS_HOST) || defined(cygwin)
599
extern ECL_API void FEwin32_error(const char *msg, int narg, ...) ecl_attr_noreturn;
600
#endif
601
602
extern ECL_API cl_object si_signal_type_error(cl_object value, cl_object type) ecl_attr_noreturn;

jjgarcia's avatar
jjgarcia committed
603
604
605

/* eval.c */

606
607
608
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, ...));
609
#define cl_safe_eval(form,env,value) si_safe_eval(3,form,env,value)
610
extern ECL_API cl_object *_ecl_va_sp(cl_narg narg);
611
612
extern ECL_API cl_object si_unlink_symbol(cl_object s);
extern ECL_API cl_object cl_eval(cl_object form);
613
extern ECL_API cl_object cl_constantp _ECL_ARGS((cl_narg narg, cl_object arg, ...));
614
615

#define funcall cl_funcall
616
extern ECL_API cl_object cl_apply_from_stack(cl_index narg, cl_object fun);
617
extern ECL_API cl_object ecl_apply_from_stack_frame(cl_object f, cl_object o);
618
extern ECL_API cl_objectfn ecl_function_dispatch(cl_env_ptr env, cl_object f);
619
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
620

621
622
623
624
/* 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);

625
/* ffi/libraries.d */
626
extern ECL_API cl_object ecl_make_codeblock();
627
628
629
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);
630
extern ECL_API bool ecl_library_close(cl_object block);
631
632
extern ECL_API void ecl_library_close_all(void);

633
/* ffi/mmap.d */
634
extern ECL_API cl_object si_mmap _ECL_ARGS((cl_narg narg, cl_object filename, ...));
635
636
637
extern ECL_API cl_object si_munmap(cl_object map);
extern ECL_API cl_object si_mmap_array(cl_object map);

638
639
640
/* ffi/backtrace.d */
extern ECL_API cl_object si_dump_c_backtrace(cl_object size);

jjgarcia's avatar
jjgarcia committed
641
642
/* ffi.c */

643
extern ECL_API cl_object si_allocate_foreign_data(cl_object tag, cl_object size);
644
extern ECL_API cl_object si_foreign_elt_type_p(cl_object f);
645
extern ECL_API cl_object si_foreign_data_p(cl_object f);
646
extern ECL_API cl_object si_foreign_data_address(cl_object f);
647
extern ECL_API cl_object si_foreign_data_equal(cl_object f1, cl_object f2);
648
649
650
651
652
653
654
655
656
657
658
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);
659
extern ECL_API cl_object si_alignment_of_foreign_elt_type(cl_object tag);
660
extern ECL_API cl_object si_load_foreign_module(cl_object module);
661
extern ECL_API cl_object si_unload_foreign_module(cl_object module);
662
663
664
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, ...);
665
extern ECL_API cl_object si_free_ffi_closure(cl_object closure);
666

667
/* Only foreign data types can be coerced to a pointer */
668
#define ecl_make_pointer(x) ecl_make_foreign_data(ECL_NIL,0,(x))
669
#define ecl_to_pointer(x) ecl_foreign_data_pointer_safe(x)
670
671
672
673
674
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);
675
676
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
677

jjgarcia's avatar
jjgarcia committed
678
679
/* file.c */

Daniel Kochmański's avatar
Daniel Kochmański committed
680
681
682
#define ECL_LISTEN_NO_CHAR      0
#define ECL_LISTEN_AVAILABLE    1
#define ECL_LISTEN_EOF          -1
683

684
685
686
687
688
689
690
691
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);
692
extern ECL_API cl_object cl_make_string_output_stream _ECL_ARGS((cl_narg narg, ...));
693
694
695
696
697
698
699
700
701
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);
702
extern ECL_API cl_object si_copy_stream(cl_object in, cl_object out, cl_object wait);
703
extern ECL_API cl_object cl_open_stream_p(cl_object strm);
704
extern ECL_API cl_object cl_make_broadcast_stream _ECL_ARGS((cl_narg narg, ...));
705
extern ECL_API cl_object cl_broadcast_stream_streams(cl_object strm);
706
extern ECL_API cl_object cl_make_concatenated_stream _ECL_ARGS((cl_narg narg, ...));
707
extern ECL_API cl_object cl_concatenated_stream_streams(cl_object strm);
708
709
710
711
712
713
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, ...));
714
715
716
717
718
719
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);
720
extern ECL_API cl_object si_stream_external_format_set(cl_object strm, cl_object format);
721
722
723

extern ECL_API bool ecl_input_stream_p(cl_object strm);
extern ECL_API bool ecl_output_stream_p(cl_object strm);
724
725
extern ECL_API cl_object ecl_stream_element_type(cl_object strm);
extern ECL_API bool ecl_interactive_stream_p(cl_object strm);
726
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);
727
extern ECL_API cl_object ecl_make_string_input_stream(cl_object strng, cl_index istart, cl_index iend);
728
extern ECL_API cl_object ecl_make_string_output_stream(cl_index line_length, int extended);
729
730
extern ECL_API cl_object ecl_read_byte(cl_object strm);
extern ECL_API void ecl_write_byte(cl_object byte, cl_object strm);
731
732
733
734
735
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);
736
737
extern ECL_API void writestr_stream(const char *s, cl_object strm);
extern ECL_API void ecl_force_output(cl_object strm);
738
extern ECL_API void ecl_finish_output(cl_object strm);
739
740
741
742
743
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);
744
extern ECL_API cl_object ecl_file_length(cl_object strm);
745
extern ECL_API int ecl_file_column(cl_object strm);
746
extern ECL_API cl_fixnum ecl_normalize_stream_element_type(cl_object element);
747
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);
748
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);
Samium Gromoff's avatar
Samium Gromoff committed
749
extern ECL_API cl_object si_file_stream_fd(cl_object s);
750
extern ECL_API int ecl_stream_to_handle(cl_object s, bool output);
jjgarcia's avatar
jjgarcia committed
751

752
753
/* finalize.c */

754
extern ECL_API void ecl_set_finalizer_unprotected(cl_object o, cl_object finalizer);
755
756
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
757
758
759

/* format.c */

760
extern ECL_API cl_object cl_format _ECL_ARGS((cl_narg narg, cl_object stream, cl_object string, ...));
jjgarcia's avatar
jjgarcia committed
761
762
763
764

/* gbc.c */

#if !defined(GBC_BOEHM)
765
766
767
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));
768
extern ECL_API cl_object si_gc(cl_object area);
jjgarcia's avatar
jjgarcia committed
769
770
771
#define GC_enabled() GC_enable
#define GC_enable() GC_enable = TRUE;
#define GC_disable() GC_enable = FALSE;
772
773
774
775
776
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
777
778
779
#endif

#ifdef GBC_BOEHM
780
781
782
#define GC_enabled() !GC_is_disabled()
#define GC_enable() GC_enable()
#define GC_disable() GC_disable()
783
extern ECL_API void ecl_register_root(cl_object *p);
784
#endif /* GBC_BOEHM */
jjgarcia's avatar
jjgarcia committed
785
786
787
788


/* gfun.c */

789
extern ECL_API void _ecl_set_method_hash_size(cl_env_ptr env, cl_index size);
790
791
792
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);
793

794
extern ECL_API cl_object _ecl_standard_dispatch(cl_object frame, cl_object fun);
jjgarcia's avatar
jjgarcia committed
795
796
797
798


/* hash.c */

799
extern ECL_API cl_object cl__make_hash_table(cl_object test, cl_object size, cl_object rehash_size, cl_object rehash_threshold);
800
801
802
803
804
805
806
807
808
809
810
811
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);
812
813
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, ...));
814
extern ECL_API cl_object si_copy_hash_table(cl_object orig);
815
816
817
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, ...));
818
819
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
820
extern ECL_API cl_object si_hash_table_weakness(cl_object ht);
821
extern ECL_API cl_object si_hash_table_synchronized_p(cl_object ht);
822

823
extern ECL_API cl_object ecl_sethash(cl_object key, cl_object hashtable, cl_object value);
824
825
826
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);
827
extern ECL_API cl_object _ecl_sethash(cl_object key, cl_object hashtable, cl_object value);
828
extern ECL_API cl_index ecl_hash_table_count(cl_object hash);
jjgarcia's avatar
jjgarcia committed
829
830
831

/* instance.c */

832
833
834
835
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);
836
extern ECL_API cl_object clos_safe_instance_ref(cl_object x, cl_object index);
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
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
852

853
#ifdef ECL_THREADS
854
855
extern ECL_API cl_object ecl_compare_and_swap_instance(cl_object x, cl_fixnum i, cl_object old_val, cl_object new_val);
extern ECL_API cl_object mp_compare_and_swap_instance(cl_object x, cl_object index, cl_object old_val, cl_object new_val);
856
857
858
extern ECL_API cl_object ecl_atomic_incf_instance(cl_object x, cl_fixnum i, cl_object increment);
extern ECL_API cl_object mp_atomic_incf_instance(cl_object x, cl_object index, cl_object increment);
#endif
jjgarcia's avatar
jjgarcia committed
859
860
861

/* list.c */

jjgarcia's avatar
jjgarcia committed
862
863
864
865
866
#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
867

868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
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);
890
891
892
893
894
895
896
897
898
899
900
901
902
903
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, ...));
904
extern ECL_API cl_object si_member1 (cl_object item, cl_object list, cl_object test, cl_object test_not, cl_object key);
905
906
907
908
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, ...));
909
extern ECL_API cl_object si_proper_list_p(cl_object V1);
910

911
912
913
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);
914
915
916
917
918
919
920
921
922
923
924
925
926
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);
927
extern ECL_API cl_object ecl_delete_eq(cl_object x, cl_object l);
928
929
#define si_cons_car cl_car
#define si_cons_cdr cl_cdr
jjgarcia's avatar
jjgarcia committed
930

931
#ifdef ECL_THREADS
932
extern ECL_API cl_object mp_compare_and_swap_car(cl_object x, cl_object old_val, cl_object new_val);
933
extern ECL_API cl_object mp_atomic_incf_car(cl_object x, cl_object increment);
934
extern ECL_API cl_object mp_compare_and_swap_cdr(cl_object x, cl_object old_val, cl_object new_val);
935
936
extern ECL_API cl_object mp_atomic_incf_cdr(cl_object x, cl_object increment);
#endif
jjgarcia's avatar
jjgarcia committed
937
938
939

/* load.c */

940
extern ECL_API cl_object si_load_bytecodes(cl_object file, cl_object verbose, cl_object print, cl_object format);
941
942
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);
943
extern ECL_API cl_object cl_load _ECL_ARGS((cl_narg narg, cl_object pathname, ...));
944

jjgarcia's avatar
jjgarcia committed
945
946
/* macros.c */

947
948
949
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
950
951
952
953


/* main.c */

jgarcia's avatar