Cyclone Scheme  0.28.0
runtime.h
Go to the documentation of this file.
1 
9 #ifndef CYCLONE_RUNTIME_H
10 #define CYCLONE_RUNTIME_H
11 
12 
17 extern const object boolean_t;
22 extern const object boolean_f;
27 extern const object quote_void;
32 extern const object Cyc_EOF;
33 
38 extern const object Cyc_VOID;
39 
44 extern const object Cyc_RECORD_MARKER;
45 
49 void GC(void *, closure, object *, int);
50 
54 void gc_init_heap(long heap_size);
55 
69 #define Cyc_check_num_args(data, fnc_name, num_args, args) { \
70  object l = Cyc_length(data, args); \
71  if (num_args > obj_obj2int(l)) { \
72  char buf[128]; \
73  snprintf(buf, 127, "Expected %d arguments to %s but received %ld", \
74  num_args, fnc_name, obj_obj2int(l)); \
75  Cyc_rt_raise_msg(data, buf); \
76  } \
77 }
78 
79 #define Cyc_check_argc(data, fnc_name, argc, expected) { \
80  if (expected > argc) { \
81  char buf[128]; \
82  snprintf(buf, 127, "Expected %d arguments to %s but received %ld", \
83  expected, fnc_name, argc); \
84  Cyc_rt_raise_msg(data, buf); \
85  } \
86 }
87 
93 #define Cyc_verify_mutable(data, obj) { \
94  if (immutable(obj)) Cyc_immutable_obj_error(data, obj); }
95 
101 #define Cyc_verify_immutable(data, obj) { \
102  if (boolean_f == Cyc_is_immutable(obj)) Cyc_mutable_obj_error(data, obj); }
103 
111 #define Cyc_check_type(data, fnc_test, tag, obj) { \
112  if ((boolean_f == fnc_test(obj))) Cyc_invalid_type_error(data, tag, obj); }
113 #define Cyc_check_type2(data, fnc_test, tag, obj) { \
114  if ((boolean_f == fnc_test(data, obj))) Cyc_invalid_type_error(data, tag, obj); }
115 
121 #define Cyc_check_pair_or_null(d,obj) { if (obj != NULL) { Cyc_check_pair(d,obj); }}
122 
127 #define Cyc_check_pair(d,obj) Cyc_check_type(d,Cyc_is_pair, pair_tag, obj)
128 
133 #define Cyc_check_proc(d,obj) Cyc_check_type2(d,Cyc_is_procedure, closureN_tag, obj)
134 
139 #define Cyc_check_num(d,obj) Cyc_check_type(d,Cyc_is_number, integer_tag, obj)
140 
145 #define Cyc_check_fixnum(d,obj) Cyc_check_type(d,Cyc_is_fixnum, integer_tag, obj)
146 
151 #define Cyc_check_int(d,obj) Cyc_check_type(d,Cyc_is_integer, integer_tag, obj)
152 
157 #define Cyc_check_double(d,obj) Cyc_check_type(d,Cyc_is_double, double_tag, obj)
158 
163 #define Cyc_check_str(d,obj) Cyc_check_type(d,Cyc_is_string, string_tag, obj)
164 
169 #define Cyc_check_sym(d,obj) Cyc_check_type(d,Cyc_is_symbol, symbol_tag, obj)
170 
175 #define Cyc_check_vec(d,obj) Cyc_check_type(d,Cyc_is_vector, vector_tag, obj)
176 
181 #define Cyc_check_bvec(d,obj) Cyc_check_type(d,Cyc_is_bytevector, bytevector_tag, obj)
182 
187 #define Cyc_check_port(d,obj) Cyc_check_type(d,Cyc_is_port, port_tag, obj)
188 
193 #define Cyc_check_mutex(d,obj) Cyc_check_type(d,Cyc_is_mutex, mutex_tag, obj)
194 
199 #define Cyc_check_cond_var(d,obj) Cyc_check_type(d,Cyc_is_cond_var, cond_var_tag, obj)
200 
205 #define Cyc_check_atomic(d,obj) Cyc_check_type(d,Cyc_is_atomic, atomic_tag, obj)
206 
211 #define Cyc_check_opaque(d,obj) Cyc_check_type(d,Cyc_is_opaque, c_opaque_tag, obj)
212 void Cyc_invalid_type_error(void *data, int tag, object found);
213 void Cyc_immutable_obj_error(void *data, object obj);
214 void Cyc_mutable_obj_error(void *data, object obj);
215 void Cyc_check_obj(void *data, int tag, object obj);
216 void Cyc_check_bounds(void *data, const char *label, int len, int index);
218 /* END error checking */
219 
220 extern long global_stack_size;
221 extern long global_heap_size;
222 
223 char **get_env_variables();
224 void pack_env_variables(void *data, object k);
225 void set_env_variables(char **vars);
226 
227 object cell_get(object cell);
228 
229 #define global_set(glo,value) Cyc_global_set(data, NULL, (object *)&glo, value)
230 #define global_set_id(id,glo,value) Cyc_global_set(data, id, (object *)&glo, value)
231 object Cyc_global_set(void *thd, object sym, object * glo, object value);
232 
233 #define global_set_cps(thd,k,glo,value) Cyc_global_set_cps(thd, k, NULL, (object *)&glo, value)
234 #define global_set_cps_id(thd,k,id,glo,value) Cyc_global_set_cps(thd, k, id, (object *)&glo, value)
235 object Cyc_global_set_cps(void *thd, object cont, object sym, object * glo, object value);
236 
252 #define load_varargs(var, args_var, start, count) \
253  list var = ((count) > 0) ? alloca(sizeof(pair_type)*(count)) : NULL; \
254  { \
255  int i; \
256  object tmp; \
257  if ((count) > 0) { \
258  for (i = 0; i < (count); i++) { \
259  tmp = args_var[start + i]; \
260  var[i].hdr.mark = gc_color_red; \
261  var[i].hdr.grayed = 0; \
262  var[i].hdr.immutable = 0; \
263  var[i].tag = pair_tag; \
264  var[i].pair_car = tmp; \
265  var[i].pair_cdr = (i == ((count)-1)) ? NULL : &var[i + 1]; \
266  } \
267  } \
268  }
269 /* Prototypes for primitive functions. */
270 
277 object apply(void *data, object cont, object func, object args);
278 void Cyc_apply(void *data, object cont, int argc, object *args);
279 void dispatch_apply_va(void *data, object clo, int argc, object *args);
280 object apply_va(void *data, object cont, int argc, object func, ...);
281 void dispatch(void *data, int argc, function_type func, object clo, object cont,
282  object args);
283 
291 object Cyc_string_cmp(void *data, object str1, object str2);
292 void dispatch_string_91append(void *data, object clo, int _argc, object *args);
293 object Cyc_string2number_(void *d, object cont, object str);
294 object Cyc_string2number2_(void *data, object cont, int argc, object str, ...);
295 int binstr2int(const char *str);
296 int octstr2int(const char *str);
297 object Cyc_string_append(void *data, object cont, int argc, object str1, ...);
298 object Cyc_string_length(void *data, object str);
299 object Cyc_string_byte_length(void *data, object str);
300 object Cyc_substring(void *data, object cont, object str, object start,
301  object end);
302 object Cyc_string_ref(void *data, object str, object k);
303 object Cyc_string_set(void *data, object str, object k, object chr);
311 object Cyc_char2integer(object chr);
312 object Cyc_char_eq_op(void *data, object a, object b);
313 object Cyc_char_gt_op(void *data, object a, object b);
314 object Cyc_char_lt_op(void *data, object a, object b);
315 object Cyc_char_gte_op(void *data, object a, object b);
316 object Cyc_char_lte_op(void *data, object a, object b);
324 object Cyc_symbol2string(void *d, object cont, object sym);
325 object Cyc_string2symbol(void *d, object str);
333 extern object Cyc_global_variables;
334 cvar_type *mcvar(object * var);
335 object Cyc_get_global_variables();
336 object Cyc_get_cvar(object var);
337 object Cyc_set_cvar(object var, object value);
345 object Cyc_display(void *data, object, FILE * port);
346 void dispatch_display_va(void *data, object clo, int argc, object *args);
347 object Cyc_display_va(void *data, int argc, object x, ...);
348 object Cyc_display_va_list(void *data, object x, object opts);
349 object Cyc_write_char(void *data, object c, object port);
350 object Cyc_write(void *data, object, FILE * port);
351 void dispatch_write_va(void *data, object clo, int argc, object *args);
352 object Cyc_write_va(void *data, int argc, object x, ...);
353 object Cyc_write_va_list(void *data, object x, object opts);
354 port_type Cyc_stdout(void);
355 port_type Cyc_stdin(void);
356 port_type Cyc_stderr(void);
357 port_type Cyc_io_open_input_file(void *data, object str);
358 port_type Cyc_io_open_output_file(void *data, object str);
359 port_type Cyc_io_open_binary_input_file(void *data, object str);
360 port_type Cyc_io_open_binary_output_file(void *data, object str);
362 port_type *Cyc_io_open_input_string(void *data, object str);
363 port_type *Cyc_io_open_input_bytevector(void *data, object bv);
364 void Cyc_io_get_output_string(void *data, object cont, object port);
365 void Cyc_io_get_output_bytevector(void *data, object cont, object port);
366 object Cyc_io_close_port(void *data, object port);
367 object Cyc_io_close_input_port(void *data, object port);
368 object Cyc_io_close_output_port(void *data, object port);
369 object Cyc_io_flush_output_port(void *data, object port);
370 object Cyc_io_read_char(void *data, object cont, object port);
371 object Cyc_io_peek_char(void *data, object cont, object port);
372 object Cyc_write_u8(void *data, object c, object port);
373 object Cyc_io_read_u8(void *data, object cont, object port);
374 object Cyc_io_peek_u8(void *data, object cont, object port);
375 object Cyc_write_bytevector(void *data, object bvec, object port, object start, object end);
376 object Cyc_io_read_line(void *data, object cont, object port);
377 void Cyc_io_read_token(void *data, object cont, object port);
390 #define return_inexact_double_op_no_cps(data, ptr, OP, z) \
391  double unboxed; \
392  Cyc_check_num(data, z); \
393  if (obj_is_int(z)) { \
394  unboxed = OP(obj_obj2int(z)); \
395  } else if (type_of(z) == integer_tag) { \
396  unboxed = OP(((integer_type *)z)->value); \
397  } else if (type_of(z) == bignum_tag) { \
398  unboxed = OP(mp_get_double(&bignum_value(z))); \
399  } else { \
400  unboxed = OP(((double_type *)z)->value); \
401  } \
402  assign_double(ptr, unboxed); \
403  return ptr;
404 
408 #define return_inexact_double_op(data, cont, OP, z) \
409  make_double(d, 0.0); \
410  Cyc_check_num(data, z); \
411  if (obj_is_int(z)) { \
412  d.value = OP(obj_obj2int(z)); \
413  } else if (type_of(z) == integer_tag) { \
414  d.value = OP(((integer_type *)z)->value); \
415  } else if (type_of(z) == bignum_tag) { \
416  d.value = OP(mp_get_double(&bignum_value(z))); \
417  } else { \
418  d.value = OP(((double_type *)z)->value); \
419  } \
420  return_closcall1(data, cont, &d)
421 
425 #define return_inexact_double_or_cplx_op_no_cps(data, ptr, OP, CPLX_OP, z) \
426  double unboxed; \
427  Cyc_check_num(data, z); \
428  if (obj_is_int(z)) { \
429  unboxed = OP(obj_obj2int(z)); \
430  } else if (type_of(z) == integer_tag) { \
431  unboxed = OP(((integer_type *)z)->value); \
432  } else if (type_of(z) == bignum_tag) { \
433  unboxed = OP(mp_get_double(&bignum_value(z))); \
434  } else if (type_of(z) == complex_num_tag) { \
435  double complex unboxed = CPLX_OP(complex_num_value(z)); \
436  assign_complex_num(ptr, unboxed); \
437  return ptr; \
438  } else { \
439  unboxed = OP(((double_type *)z)->value); \
440  } \
441  assign_double(ptr, unboxed); \
442  return ptr;
443 
447 #define return_inexact_double_or_cplx_op(data, cont, OP, CPLX_OP, z) \
448  make_double(d, 0.0); \
449  Cyc_check_num(data, z); \
450  if (obj_is_int(z)) { \
451  d.value = OP(obj_obj2int(z)); \
452  } else if (type_of(z) == integer_tag) { \
453  d.value = OP(((integer_type *)z)->value); \
454  } else if (type_of(z) == bignum_tag) { \
455  d.value = OP(mp_get_double(&bignum_value(z))); \
456  } else if (type_of(z) == complex_num_tag) { \
457  complex_num_type cn; \
458  double complex unboxed = CPLX_OP(complex_num_value(z)); \
459  assign_complex_num((&cn), unboxed); \
460  return_closcall1(data, cont, &cn); \
461  } else { \
462  d.value = OP(((double_type *)z)->value); \
463  } \
464  return_closcall1(data, cont, &d)
465 
469 #define return_exact_double_op(data, cont, OP, z) \
470  int i = 0; \
471  Cyc_check_num(data, z); \
472  if (obj_is_int(z)) { \
473  i = obj_obj2int(z); \
474  } else if (type_of(z) == integer_tag) { \
475  i = (int)OP(((integer_type *)z)->value); \
476  } else if (type_of(z) == bignum_tag) { \
477  return_closcall1(data, cont, z); \
478  } else { \
479  i = (int)OP(((double_type *)z)->value); \
480  } \
481  return_closcall1(data, cont, obj_int2obj(i))
482 
486 #define return_exact_double_op_no_cps(data, ptr, OP, z) \
487  int i = 0; \
488  Cyc_check_num(data, z); \
489  if (obj_is_int(z)) { \
490  i = obj_obj2int(z); \
491  } else if (type_of(z) == integer_tag) { \
492  i = (int)OP(((integer_type *)z)->value); \
493  } else if (type_of(z) == bignum_tag) { \
494  return z; \
495  } else { \
496  i = (int)OP(((double_type *)z)->value); \
497  } \
498  return obj_int2obj(i);
499 
503 #define unbox_number(n) \
504  ((obj_is_int(n) ? obj_obj2int(n) : \
505  ((type_of(n) == integer_tag) ? \
506  ((integer_type *)n)->value : \
507  ((double_type *)n)->value)))
508 
509 object Cyc_num_eq(void *, object cont, int argc, object n, ...);
510 object Cyc_num_gt(void *, object cont, int argc, object n, ...);
511 object Cyc_num_lt(void *, object cont, int argc, object n, ...);
512 object Cyc_num_gte(void *, object cont, int argc, object n, ...);
513 object Cyc_num_lte(void *, object cont, int argc, object n, ...);
514 int Cyc_num_eq_op(void *, object x, object y);
515 int Cyc_num_gt_op(void *, object x, object y);
516 int Cyc_num_lt_op(void *, object x, object y);
517 int Cyc_num_gte_op(void *, object x, object y);
518 int Cyc_num_lte_op(void *, object x, object y);
519 object Cyc_num_fast_eq_op(void *data, object x, object y);
520 object Cyc_num_fast_gt_op(void *data, object x, object y);
521 object Cyc_num_fast_lt_op(void *data, object x, object y);
522 object Cyc_num_fast_gte_op(void *data, object x, object y);
523 object Cyc_num_fast_lte_op(void *data, object x, object y);
524 object Cyc_num_cmp_va_list(void *data, int argc,
525  int (fn_op(void *, object, object)), object n,
526  va_list ns);
527 void Cyc_expt(void *data, object cont, object x, object y);
528 void Cyc_remainder(void *data, object cont, object num1, object num2);
529 object Cyc_number2string2(void *data, object cont, int argc, object n, ...);
530 object Cyc_integer2char(void *data, object n);
531 object Cyc_sum_op(void *data, common_type * x, object y);
532 object Cyc_sub_op(void *data, common_type * x, object y);
533 object Cyc_mul_op(void *data, common_type * x, object y);
534 object Cyc_div_op(void *data, common_type * x, object y);
535 object Cyc_sum(void *data, object cont, int argc, object n, ...);
536 object Cyc_sub(void *data, object cont, int argc, object n, ...);
537 object Cyc_mul(void *data, object cont, int argc, object n, ...);
538 object Cyc_div(void *data, object cont, int argc, object n, ...);
539 // Future idea, there may be uses for this in addition to if statements:
540 #define Cyc_if(c,t,e) ((boolean_f != c) ? (t) : (e))
541 object Cyc_fast_sum(void *data, object ptr, object x, object y);
542 object Cyc_fast_sub(void *data, object ptr, object x, object y);
543 object Cyc_fast_mul(void *data, object ptr, object x, object y);
544 object Cyc_fast_div(void *data, object ptr, object x, object y);
545 object Cyc_fast_list_2(object ptr, object x, object y);
546 object Cyc_fast_list_3(object ptr, object a1, object a2, object a3);
547 object Cyc_fast_list_4(object ptr, object a1, object a2, object a3, object a4);
548 object Cyc_fast_vector_2(object ptr, object a1, object a2);
549 object Cyc_fast_vector_3(object ptr, object a1, object a2, object a3);
550 object Cyc_fast_vector_4(object ptr, object a1, object a2, object a3, object a4);
551 object Cyc_fast_vector_5(object ptr, object a1, object a2, object a3, object a4, object a5);
552 object Cyc_bit_unset(void *data, object n1, object n2);
553 object Cyc_bit_set(void *data, object n1, object n2);
554 object Cyc_num_op_va_list(void *data, int argc,
555  object(fn_op(void *, common_type *, object)),
556  int default_no_args, int default_one_arg, object n,
557  va_list ns, common_type * buf);
558 object Cyc_num_op_args(void *data, int argc,
559  object(fn_op(void *, common_type *, object)),
560  int default_no_args, int default_one_arg,
561  object *args,
562  common_type * buf);
563 void Cyc_int2bignum(int n, mp_int *bn);
564 object Cyc_bignum_normalize(void *data, object n);
565 int Cyc_bignum_cmp(bn_cmp_type type, object x, int tx, object y, int ty);
566 void Cyc_make_rectangular(void *data, object k, object r, object i);
567 double MRG32k3a (double seed);
573 //object Cyc_eq(object x, object y);
574 object Cyc_eqv(object x, object y);
575 #define Cyc_eq(x, y) (make_boolean(x == y))
576 int equal(object, object);
577 object equalp(object, object);
578 object Cyc_has_cycle(object lst);
579 object Cyc_is_list(object lst);
580 //object Cyc_is_boolean(object o);
581 #define Cyc_is_boolean(o) (make_boolean(o == boolean_f || o == boolean_t))
582 #define Cyc_is_pair(o) ((is_object_type(o) && ((list) o)->tag == pair_tag) ? boolean_t : boolean_f)
583 #define Cyc_is_null(o) (make_boolean(o == NULL))
584 //TODO: convert all of these to macros (if it makes sense, most should), and remove them from runtime.c:
585 object Cyc_is_number(object o);
586 object Cyc_is_real(object o);
587 object Cyc_is_integer(object o);
588 #define Cyc_is_fixnum(o) (make_boolean(obj_is_int(o)))
589 //object Cyc_is_fixnum(object o);
590 #define Cyc_is_double(o) (make_boolean(is_object_type(o) && ((list) o)->tag == double_tag))
591 #define Cyc_is_bignum(o) (make_boolean(is_object_type(o) && ((list) o)->tag == bignum_tag))
592 //object Cyc_is_complex(object o);
593 #define Cyc_is_complex(o) (make_boolean(is_object_type(o) && ((list) o)->tag == complex_num_tag))
594 //object Cyc_is_bignum(object o);
595 //object Cyc_is_vector(object o);
596 //object Cyc_is_bytevector(object o);
597 //object Cyc_is_port(object o);
598 //object Cyc_is_mutex(object o);
599 //object Cyc_is_cond_var(object o);
600 //object Cyc_is_symbol(object o);
601 //object Cyc_is_string(object o);
602 object Cyc_is_record(object o);
603 #define Cyc_is_vector_not_record_type(o) \
604  (make_boolean(is_object_type(o) && \
605  ((vector) o)->tag == vector_tag && \
606  ( ((vector) o)->num_elements == 0 || \
607  ((vector) o)->elements[0] != Cyc_RECORD_MARKER ) \
608  ))
609 #define Cyc_is_vector(o) (make_boolean(is_object_type(o) && ((vector) o)->tag == vector_tag))
610 #define Cyc_is_bytevector(o) (make_boolean(is_object_type(o) && ((list) o)->tag == bytevector_tag))
611 #define Cyc_is_port(o) (make_boolean(is_object_type(o) && ((list) o)->tag == port_tag))
612 #define Cyc_is_mutex(o) (make_boolean(is_object_type(o) && ((list) o)->tag == mutex_tag))
613 #define Cyc_is_atomic(o) (make_boolean(is_object_type(o) && ((list) o)->tag == atomic_tag))
614 #define Cyc_is_cond_var(o) (make_boolean(is_object_type(o) && ((list) o)->tag == cond_var_tag))
615 #define Cyc_is_symbol(o) (make_boolean(is_object_type(o) && ((list) o)->tag == symbol_tag))
616 #define Cyc_is_string(o) (make_boolean(is_object_type(o) && ((list) o)->tag == string_tag))
617 //object Cyc_is_char(object o);
618 #define Cyc_is_char(o) (make_boolean(obj_is_char(o)))
619 object Cyc_is_procedure(void *data, object o);
620 //object Cyc_is_macro(object o);
621 //object Cyc_is_eof_object(object o);
622 //object Cyc_is_cvar(object o);
623 //object Cyc_is_opaque(object o);
624 #define Cyc_is_macro(o) (make_boolean(is_object_type(o) && ((list) o)->tag == macro_tag))
625 #define Cyc_is_eof_object(o) (make_boolean(is_object_type(o) && ((list) o)->tag == eof_tag))
626 #define Cyc_is_void_object(o) (make_boolean(is_object_type(o) && ((list) o)->tag == void_tag))
627 #define Cyc_is_cvar(o) (make_boolean(is_object_type(o) && ((list) o)->tag == cvar_tag))
628 #define Cyc_is_opaque(o) (make_boolean(is_object_type(o) && ((list) o)->tag == c_opaque_tag))
629 object Cyc_is_immutable(object obj);
637 object Cyc_vector_length(void *data, object v);
638 object Cyc_vector_ref(void *d, object v, object k);
639 #define Cyc_vector_ref_unsafe(d, v, k) \
640  ((vector) v)->elements[obj_obj2int(k)]
641 object Cyc_vector_set(void *d, object v, object k, object obj);
642 object Cyc_vector_set_unsafe(void *d, object v, object k, object obj);
643 object Cyc_vector_set_cps(void *d, object cont, object v, object k, object obj);
644 object Cyc_vector_set_unsafe_cps(void *d, object cont, object v, object k, object obj);
645 object Cyc_make_vector(void *data, object cont, int argc, object len, ...);
653 object Cyc_make_bytevector(void *data, object cont, int argc, object len, ...);
654 object Cyc_bytevector(void *data, object cont, int argc, object bval, ...);
655 object Cyc_bytevector_length(void *data, object bv);
656 object Cyc_bytevector_append(void *data, object cont, int _argc, object bv,
657  ...);
658 object Cyc_bytevector_copy(void *data, object cont, object bv, object start,
659  object end);
660 object Cyc_bytevector_u8_ref(void *data, object bv, object k);
661 object Cyc_bytevector_u8_set(void *data, object bv, object k, object b);
662 object Cyc_utf82string(void *data, object cont, object bv, object start,
663  object end);
664 object Cyc_string2utf8(void *data, object cont, object str, object start,
665  object end);
673 extern int _cyc_argc;
674 extern char **_cyc_argv;
675 object Cyc_installation_dir(void *data, object cont, object type);
676 object Cyc_compilation_environment(void *data, object cont, object var);
677 object Cyc_command_line_arguments(void *data, object cont);
678 object Cyc_system(object cmd);
679 void Cyc_halt(void *data, object clo, int argc, object *args);
680 object __halt(object obj);
681 object Cyc_io_delete_file(void *data, object filename);
682 object Cyc_io_file_exists(void *data, object filename);
683 time_t Cyc_file_last_modified_time(char *path);
694 object Cyc_spawn_thread(object thunk);
696 void Cyc_end_thread(gc_thread_data * thd);
697 void Cyc_exit_thread(void *data, object _, int argc, object *args);
698 object Cyc_thread_sleep(void *data, object timeout);
706 object Cyc_trigger_minor_gc(void *data, object cont);
707 object copy2heap(void *data, object obj);
717 //void Cyc_st_add(void *data, char *frame); migrated from runtime.c
723 #define Cyc_st_add(data, frame) \
724 { \
725  gc_thread_data *thd = (gc_thread_data *) data; \
726  /* Do not allow recursion to remove older frames */ \
727  if ((char *)frame != thd->stack_prev_frame) { \
728  thd->stack_prev_frame = frame; \
729  thd->stack_traces[thd->stack_trace_idx] = frame; \
730  thd->stack_trace_idx = (thd->stack_trace_idx + 1) % MAX_STACK_TRACES; \
731  } \
732 }
733 
734 void Cyc_st_print(void *data, FILE * out);
745 extern const object primitive_Cyc_91global_91vars;
746 extern const object primitive_Cyc_91get_91cvar;
747 extern const object primitive_Cyc_91set_91cvar_67;
748 extern const object primitive_Cyc_91cvar_127;
749 extern const object primitive_Cyc_91opaque_127;
750 extern const object primitive_Cyc_91has_91cycle_127;
751 extern const object primitive_Cyc_91spawn_91thread_67;
752 extern const object primitive_Cyc_91end_91thread_67;
753 extern const object primitive__87;
754 extern const object primitive__91;
755 extern const object primitive__85;
756 extern const object primitive__95;
757 extern const object primitive__123;
758 extern const object primitive__125;
759 extern const object primitive__121;
760 extern const object primitive__125_123;
761 extern const object primitive__121_123;
762 extern const object primitive_apply;
763 extern const object primitive__75halt;
764 extern const object primitive_exit;
767 extern const object primitive_cons;
768 extern const object primitive_cell_91get;
769 extern const object primitive_set_91global_67;
770 extern const object primitive_set_91cell_67;
771 extern const object primitive_cell;
772 extern const object primitive_eq_127;
773 extern const object primitive_eqv_127;
774 extern const object primitive_equal_127;
775 extern const object primitive_assq;
776 extern const object primitive_assv;
777 extern const object primitive_memq;
778 extern const object primitive_memv;
779 extern const object primitive_length;
780 extern const object primitive_vector_91length;
781 extern const object primitive_bytevector_91length;
782 extern const object primitive_set_91car_67;
783 extern const object primitive_set_91cdr_67;
784 extern const object primitive_car;
785 extern const object primitive_cdr;
786 extern const object primitive_caar;
787 extern const object primitive_cadr;
788 extern const object primitive_cdar;
789 extern const object primitive_cddr;
790 extern const object primitive_caaar;
791 extern const object primitive_caadr;
792 extern const object primitive_cadar;
793 extern const object primitive_caddr;
794 extern const object primitive_cdaar;
795 extern const object primitive_cdadr;
796 extern const object primitive_cddar;
797 extern const object primitive_cdddr;
798 extern const object primitive_caaaar;
799 extern const object primitive_caaadr;
800 extern const object primitive_caadar;
801 extern const object primitive_caaddr;
802 extern const object primitive_cadaar;
803 extern const object primitive_cadadr;
804 extern const object primitive_caddar;
805 extern const object primitive_cadddr;
806 extern const object primitive_cdaaar;
807 extern const object primitive_cdaadr;
808 extern const object primitive_cdadar;
809 extern const object primitive_cdaddr;
810 extern const object primitive_cddaar;
811 extern const object primitive_cddadr;
812 extern const object primitive_cdddar;
813 extern const object primitive_cddddr;
814 extern const object primitive_char_91_125integer;
815 extern const object primitive_integer_91_125char;
816 extern const object primitive_string_91_125number;
817 extern const object primitive_string_91cmp;
818 extern const object primitive_string_91append;
819 extern const object primitive_list_91_125string;
820 extern const object primitive_string_91_125symbol;
821 extern const object primitive_symbol_91_125string;
822 extern const object primitive_number_91_125string;
823 extern const object primitive_string_91length;
824 extern const object primitive_substring;
825 extern const object primitive_make_91bytevector;
826 extern const object primitive_make_91vector;
827 extern const object primitive_list_91_125vector;
828 extern const object primitive_vector_91ref;
829 extern const object primitive_vector_91set_67;
830 extern const object primitive_bytevector;
831 extern const object primitive_bytevector_91append;
832 extern const object primitive_Cyc_91bytevector_91copy;
833 extern const object primitive_Cyc_91string_91_125utf8;
834 extern const object primitive_Cyc_91utf8_91_125string;
835 extern const object primitive_bytevector_91u8_91ref;
836 extern const object primitive_bytevector_91u8_91set_67;
837 extern const object primitive_string_91ref;
838 extern const object primitive_string_91set_67;
839 extern const object primitive_Cyc_91installation_91dir;
841 extern const object primitive_command_91line_91arguments;
842 extern const object primitive_system;
843 extern const object primitive_boolean_127;
844 extern const object primitive_char_127;
845 extern const object primitive_eof_91object_127;
846 extern const object primitive_null_127;
847 extern const object primitive_number_127;
848 extern const object primitive_real_127;
849 extern const object primitive_integer_127;
850 extern const object primitive_pair_127;
851 extern const object primitive_procedure_127;
852 extern const object primitive_macro_127;
853 extern const object primitive_Cyc_91macro_127;
854 extern const object primitive_port_127;
855 extern const object primitive_vector_127;
856 extern const object primitive_bytevector_127;
857 extern const object primitive_string_127;
858 extern const object primitive_symbol_127;
859 extern const object primitive_open_91input_91file;
860 extern const object primitive_open_91output_91file;
861 extern const object primitive_open_91binary_91input_91file;
862 extern const object primitive_open_91binary_91output_91file;
863 extern const object primitive_close_91port;
864 extern const object primitive_close_91input_91port;
865 extern const object primitive_close_91output_91port;
866 extern const object primitive_Cyc_91flush_91output_91port;
867 extern const object primitive_file_91exists_127;
868 extern const object primitive_delete_91file;
869 extern const object primitive_read_91char;
870 extern const object primitive_peek_91char;
871 extern const object primitive_Cyc_91read_91line;
872 extern const object primitive_Cyc_91write_91char;
873 extern const object primitive_Cyc_91write;
874 extern const object primitive_Cyc_91display;
875 extern const object primitive_call_95cc;
876 /* -------------------------------------------- */
887 extern object Cyc_glo_eval_from_c;
888 extern object Cyc_glo_call_cc;
889 
890 #define __glo_eval_91from_91c_scheme_eval Cyc_glo_eval_from_c
891 #define __glo_call_95cc_scheme_base Cyc_glo_call_cc
892 
898 object Cyc_default_exception_handler(void *data, object _, int argc, object *args);
899 
900 object Cyc_current_exception_handler(void *data);
901 void Cyc_rt_raise(void *data, object err);
902 void Cyc_rt_raise2(void *data, const char *msg, object err);
903 void Cyc_rt_raise_msg(void *data, const char *err);
917 object add_symbol(symbol_type * psym);
918 object find_or_add_symbol(const char *name);
927 object is_library_loaded(const char *name);
928 object register_library(const char *name);
937 extern list global_table;
938 void add_global(const char *identifier, object * glo);
950 #define CYC_UTF8_ACCEPT 0
951 
953 #define CYC_UTF8_REJECT 1
954 
958 #define Cyc_utf8_encode_char(dest, dest_size, char_value) \
959  Cyc_utf8_encode(dest, dest_size, &char_value, 1)
960 
961 int Cyc_utf8_encode(char *dest, int sz, uint32_t *src, int srcsz);
962 int Cyc_utf8_count_code_points(uint8_t* s);
963 uint32_t Cyc_utf8_validate_stream(uint32_t *state, char *str, size_t len);
964 uint32_t Cyc_utf8_validate(char *str, size_t len);
972 //object Cyc_car(void *data, object lis);
973 //object Cyc_cdr(void *data, object lis);
974 static inline object Cyc_car(void *data, object lis)
975 {
976  Cyc_check_pair(data, lis);
977  return car(lis);
978 }
979 
980 static inline object Cyc_cdr(void *data, object lis)
981 {
982  Cyc_check_pair(data, lis);
983  return cdr(lis);
984 }
985 // Unsafe car/cdr
986 #define Cyc_car_unsafe(d, lis) car(lis)
987 #define Cyc_cdr_unsafe(d, lis) cdr(lis)
988 
989 list malloc_make_pair(object, object);
990 object Cyc_set_cell(void *, object l, object val);
991 object Cyc_set_car(void *, object l, object val);
992 object Cyc_set_cdr(void *, object l, object val);
993 object Cyc_set_car_cps(void *, object cont, object l, object val);
994 object Cyc_set_cdr_cps(void *, object cont, object l, object val);
995 object Cyc_length(void *d, object l);
996 object Cyc_length_unsafe(void *d, object l);
997 object Cyc_list2vector(void *data, object cont, object l);
998 object Cyc_list2string(void *d, object cont, object lst);
999 object memberp(void *data, object x, list l);
1000 object memqp(void *data, object x, list l);
1001 list assq(void *data, object x, list l);
1002 list assoc(void *data, object x, list l);
1003 list assoc_cdr(void *data, object x, list l);
1007 #endif /* CYCLONE_RUNTIME_H */
Cyc_vector_set_cps
object Cyc_vector_set_cps(void *d, object cont, object v, object k, object obj)
Definition: runtime.c:2130
Cyc_num_fast_gte_op
object Cyc_num_fast_gte_op(void *data, object x, object y)
Cyc_set_cell
object Cyc_set_cell(void *, object l, object val)
Definition: runtime.c:1989
Cyc_set_cdr
object Cyc_set_cdr(void *, object l, object val)
Definition: runtime.c:2010
Cyc_fast_list_3
object Cyc_fast_list_3(object ptr, object a1, object a2, object a3)
Definition: runtime.c:1496
primitive_memq
const object primitive_memq
Definition: runtime.c:6568
primitive_Cyc_91utf8_91_125string
const object primitive_Cyc_91utf8_91_125string
Definition: runtime.c:6638
global_heap_size
long global_heap_size
primitive_port_127
const object primitive_port_127
Definition: runtime.c:6653
primitive_string_91cmp
const object primitive_string_91cmp
Definition: runtime.c:6621
primitive__87
const object primitive__87
Definition: runtime.c:6542
Cyc_immutable_obj_error
void Cyc_immutable_obj_error(void *data, object obj)
Definition: runtime.c:69
primitive_cddar
const object primitive_cddar
Definition: runtime.c:6589
primitive_real_127
const object primitive_real_127
Definition: runtime.c:6646
Cyc_is_integer
object Cyc_is_integer(object o)
Definition: runtime.c:1919
Cyc_get_global_variables
object Cyc_get_global_variables()
Definition: runtime.c:873
Cyc_check_obj
void Cyc_check_obj(void *data, int tag, object obj)
Definition: runtime.c:79
primitive_close_91port
const object primitive_close_91port
Definition: runtime.c:6661
primitive_cdar
const object primitive_cdar
Definition: runtime.c:6581
closure0_type
A closed-over function with no variables.
Definition: types.h:1405
primitive_caar
const object primitive_caar
Definition: runtime.c:6579
Cyc_list2vector
object Cyc_list2vector(void *data, object cont, object l)
Definition: runtime.c:3389
assoc_cdr
list assoc_cdr(void *data, object x, list l)
Definition: runtime.c:1474
cdr
#define cdr(x)
Definition: types.h:1327
primitive_Cyc_91write_91char
const object primitive_Cyc_91write_91char
Definition: runtime.c:6671
primitive_Cyc_91flush_91output_91port
const object primitive_Cyc_91flush_91output_91port
Definition: runtime.c:6664
Cyc_expt
void Cyc_expt(void *data, object cont, object x, object y)
Definition: runtime.c:4379
Cyc_num_lte_op
int Cyc_num_lte_op(void *, object x, object y)
primitive_procedure_127
const object primitive_procedure_127
Definition: runtime.c:6649
Cyc_list2string
object Cyc_list2string(void *d, object cont, object lst)
Definition: runtime.c:2357
pack_env_variables
void pack_env_variables(void *data, object k)
Definition: runtime.c:214
Cyc_fast_sum
object Cyc_fast_sum(void *data, object ptr, object x, object y)
Definition: runtime.c:3663
Cyc_int2bignum
void Cyc_int2bignum(int n, mp_int *bn)
Definition: runtime.c:1723
primitive_string_91length
const object primitive_string_91length
Definition: runtime.c:6610
primitive_cdadar
const object primitive_cdadar
Definition: runtime.c:6601
Cyc_io_read_char
object Cyc_io_read_char(void *data, object cont, object port)
Definition: runtime.c:7783
primitive_open_91input_91file
const object primitive_open_91input_91file
Definition: runtime.c:6657
primitive_cell
const object primitive_cell
Definition: runtime.c:6562
primitive_integer_127
const object primitive_integer_127
Definition: runtime.c:6647
Cyc_bytevector_length
object Cyc_bytevector_length(void *data, object bv)
Definition: runtime.c:3379
primitive_caddar
const object primitive_caddar
Definition: runtime.c:6597
Cyc_halt
void Cyc_halt(void *data, object clo, int argc, object *args)
Definition: runtime.c:3476
primitive_cdaadr
const object primitive_cdaadr
Definition: runtime.c:6600
primitive_caaar
const object primitive_caaar
Definition: runtime.c:6583
Cyc_fast_mul
object Cyc_fast_mul(void *data, object ptr, object x, object y)
Definition: runtime.c:3864
primitive_cadaar
const object primitive_cadaar
Definition: runtime.c:6595
primitive_cdddr
const object primitive_cdddr
Definition: runtime.c:6590
primitive_caaadr
const object primitive_caaadr
Definition: runtime.c:6592
primitive_list_91_125string
const object primitive_list_91_125string
Definition: runtime.c:6623
Cyc_eqv
object Cyc_eqv(object x, object y)
Definition: runtime.c:1963
Cyc_string_ref
object Cyc_string_ref(void *data, object str, object k)
Definition: runtime.c:2744
Cyc_write_va
object Cyc_write_va(void *data, int argc, object x,...)
Definition: runtime.c:1210
primitive_Cyc_91macro_127
const object primitive_Cyc_91macro_127
Definition: runtime.c:6651
primitive_cdaddr
const object primitive_cdaddr
Definition: runtime.c:6602
register_library
object register_library(const char *name)
Definition: runtime.c:504
primitive__125
const object primitive__125
Definition: runtime.c:6547
bn_cmp_type
bn_cmp_type
Definition: types.h:922
primitive_Cyc_91read_91line
const object primitive_Cyc_91read_91line
Definition: runtime.c:6670
Cyc_string2symbol
object Cyc_string2symbol(void *d, object str)
Definition: runtime.c:2346
MRG32k3a
double MRG32k3a(double seed)
Definition: runtime.c:6958
Cyc_stdout
port_type Cyc_stdout(void)
Definition: runtime.c:4517
Cyc_string_set
object Cyc_string_set(void *data, object str, object k, object chr)
Definition: runtime.c:2650
port_type
The port object type.
Definition: types.h:1096
primitive_symbol_127
const object primitive_symbol_127
Definition: runtime.c:6656
Cyc_sub_op
object Cyc_sub_op(void *data, common_type *x, object y)
Cyc_char2integer
object Cyc_char2integer(object chr)
Definition: runtime.c:3462
Cyc_apply
void Cyc_apply(void *data, object cont, int argc, object *args)
Definition: runtime.c:5771
Cyc_io_close_output_port
object Cyc_io_close_output_port(void *data, object port)
Definition: runtime.c:4590
car
#define car(x)
Definition: types.h:1325
Cyc_fast_vector_3
object Cyc_fast_vector_3(object ptr, object a1, object a2, object a3)
Definition: runtime.c:1529
Cyc_io_get_output_string
void Cyc_io_get_output_string(void *data, object cont, object port)
Definition: mstreams.c:94
Cyc_char_gt_op
object Cyc_char_gt_op(void *data, object a, object b)
Cyc_bytevector_append
object Cyc_bytevector_append(void *data, object cont, int _argc, object bv,...)
Definition: runtime.c:3130
find_or_add_symbol
object find_or_add_symbol(const char *name)
Definition: runtime.c:482
Cyc_num_op_args
object Cyc_num_op_args(void *data, int argc, object(fn_op(void *, common_type *, object)), int default_no_args, int default_one_arg, object *args, common_type *buf)
Definition: runtime.c:4177
Cyc_compilation_environment
object Cyc_compilation_environment(void *data, object cont, object var)
Definition: runtime.c:2876
Cyc_file_last_modified_time
time_t Cyc_file_last_modified_time(char *path)
Definition: runtime.c:4661
dispatch_apply_va
void dispatch_apply_va(void *data, object clo, int argc, object *args)
Definition: runtime.c:5650
primitive_delete_91file
const object primitive_delete_91file
Definition: runtime.c:6667
primitive_open_91output_91file
const object primitive_open_91output_91file
Definition: runtime.c:6658
Cyc_display_va
object Cyc_display_va(void *data, int argc, object x,...)
Definition: runtime.c:998
Cyc_start_trampoline
void Cyc_start_trampoline(gc_thread_data *thd)
Definition: runtime.c:5831
Cyc_rt_raise_msg
void Cyc_rt_raise_msg(void *data, const char *err)
Raise an exception from the runtime code.
Definition: runtime.c:770
Cyc_num_fast_lte_op
object Cyc_num_fast_lte_op(void *data, object x, object y)
Cyc_thread_sleep
object Cyc_thread_sleep(void *data, object timeout)
Accept a number of seconds to sleep according to SRFI-18.
Definition: runtime.c:6835
Cyc_io_open_output_string
port_type * Cyc_io_open_output_string(void *data)
Definition: mstreams.c:78
Cyc_io_open_binary_output_file
port_type Cyc_io_open_binary_output_file(void *data, object str)
Definition: runtime.c:4578
Cyc_num_cmp_va_list
object Cyc_num_cmp_va_list(void *data, int argc, int(fn_op(void *, object, object)), object n, va_list ns)
Definition: runtime.c:1651
pair_type
The pair (cons) type.
Definition: types.h:1247
primitive_cddaar
const object primitive_cddaar
Definition: runtime.c:6603
gc_thread_data_t
Definition: types.h:322
Cyc_global_set_cps
object Cyc_global_set_cps(void *thd, object cont, object sym, object *glo, object value)
Definition: runtime.c:367
Cyc_set_cvar
object Cyc_set_cvar(object var, object value)
Definition: runtime.c:886
memqp
object memqp(void *data, object x, list l)
Definition: runtime.c:1433
primitive_set_91car_67
const object primitive_set_91car_67
Definition: runtime.c:6575
Cyc_write
object Cyc_write(void *data, object, FILE *port)
Definition: runtime.c:1350
Cyc_substring
object Cyc_substring(void *data, object cont, object str, object start, object end)
Definition: runtime.c:2780
get_env_variables
char ** get_env_variables()
Definition: runtime.c:209
Cyc_io_delete_file
object Cyc_io_delete_file(void *data, object filename)
Definition: runtime.c:4637
binstr2int
int binstr2int(const char *str)
Definition: runtime.c:2547
Cyc_string2utf8
object Cyc_string2utf8(void *data, object cont, object str, object start, object end)
Definition: runtime.c:3246
Cyc_char_lte_op
object Cyc_char_lte_op(void *data, object a, object b)
Cyc_spawn_thread
object Cyc_spawn_thread(object thunk)
Definition: runtime.c:6769
Cyc_num_gt_op
int Cyc_num_gt_op(void *, object x, object y)
primitive_vector_91set_67
const object primitive_vector_91set_67
Definition: runtime.c:6574
Cyc_write_bytevector
object Cyc_write_bytevector(void *data, object bvec, object port, object start, object end)
Definition: runtime.c:1389
Cyc_length
object Cyc_length(void *d, object l)
Definition: runtime.c:2217
primitive_cddr
const object primitive_cddr
Definition: runtime.c:6582
primitive_string_127
const object primitive_string_127
Definition: runtime.c:6652
primitive_apply
const object primitive_apply
Definition: runtime.c:6551
primitive_Cyc_91write
const object primitive_Cyc_91write
Definition: runtime.c:6672
primitive_cons
const object primitive_cons
Definition: runtime.c:6558
Cyc_is_record
object Cyc_is_record(object o)
Definition: runtime.c:1930
primitive__121_123
const object primitive__121_123
Definition: runtime.c:6550
Cyc_RECORD_MARKER
const object Cyc_RECORD_MARKER
Definition: runtime.c:202
dispatch_string_91append
void dispatch_string_91append(void *data, object clo, int _argc, object *args)
Definition: runtime.c:2576
primitive_null_127
const object primitive_null_127
Definition: runtime.c:6644
Cyc_remainder
void Cyc_remainder(void *data, object cont, object num1, object num2)
Definition: runtime.c:4441
Cyc_io_close_port
object Cyc_io_close_port(void *data, object port)
Definition: runtime.c:4595
Cyc_bignum_cmp
int Cyc_bignum_cmp(bn_cmp_type type, object x, int tx, object y, int ty)
Definition: runtime.c:1731
Cyc_system
object Cyc_system(object cmd)
Definition: runtime.c:3441
Cyc_display_va_list
object Cyc_display_va_list(void *data, object x, object opts)
Definition: runtime.c:1012
Cyc_bytevector_u8_ref
object Cyc_bytevector_u8_ref(void *data, object bv, object k)
Definition: runtime.c:3339
Cyc_set_globals_changed
void Cyc_set_globals_changed(gc_thread_data *thd)
Definition: runtime.c:548
primitive_caddr
const object primitive_caddr
Definition: runtime.c:6586
add_symbol
object add_symbol(symbol_type *psym)
Definition: runtime.c:459
primitive_car
const object primitive_car
Definition: runtime.c:6577
cvar_type
C-variable integration type - wrapper around a Cyclone object pointer.
Definition: types.h:677
Cyc_string2number_
object Cyc_string2number_(void *d, object cont, object str)
Definition: runtime.c:2513
Cyc_is_list
object Cyc_is_list(object lst)
Definition: runtime.c:939
Cyc_bytevector_u8_set
object Cyc_bytevector_u8_set(void *data, object bv, object k, object b)
Definition: runtime.c:3359
Cyc_make_bytevector
object Cyc_make_bytevector(void *data, object cont, int argc, object len,...)
Definition: runtime.c:3004
Cyc_make_vector
object Cyc_make_vector(void *data, object cont, int argc, object len,...)
Definition: runtime.c:2941
primitive_make_91bytevector
const object primitive_make_91bytevector
Definition: runtime.c:6627
equal
int equal(object, object)
Definition: runtime.c:778
primitive_string_91ref
const object primitive_string_91ref
Definition: runtime.c:6612
Cyc_mutable_obj_error
void Cyc_mutable_obj_error(void *data, object obj)
Definition: runtime.c:74
Cyc_global_variables
object Cyc_global_variables
Definition: runtime.c:192
primitive__95
const object primitive__95
Definition: runtime.c:6545
primitive_Cyc_91display
const object primitive_Cyc_91display
Definition: runtime.c:6673
Cyc_write_u8
object Cyc_write_u8(void *data, object c, object port)
Definition: runtime.c:1374
primitive_Cyc_91set_91cvar_67
const object primitive_Cyc_91set_91cvar_67
Definition: runtime.c:6535
malloc_make_pair
list malloc_make_pair(object, object)
Definition: runtime.c:4669
quote_void
const object quote_void
Definition: runtime.c:398
Cyc_char_eq_op
object Cyc_char_eq_op(void *data, object a, object b)
primitive_set_91cdr_67
const object primitive_set_91cdr_67
Definition: runtime.c:6576
primitive_Cyc_91default_91exception_91handler
const object primitive_Cyc_91default_91exception_91handler
Definition: runtime.c:6556
Cyc_fast_vector_2
object Cyc_fast_vector_2(object ptr, object a1, object a2)
Definition: runtime.c:1515
primitive_open_91binary_91output_91file
const object primitive_open_91binary_91output_91file
Definition: runtime.c:6660
primitive_cdr
const object primitive_cdr
Definition: runtime.c:6578
add_global
void add_global(const char *identifier, object *glo)
Definition: runtime.c:521
primitive_string_91append
const object primitive_string_91append
Definition: runtime.c:6622
primitive_number_91_125string
const object primitive_number_91_125string
Definition: runtime.c:6626
primitive_Cyc_91bytevector_91copy
const object primitive_Cyc_91bytevector_91copy
Definition: runtime.c:6631
Cyc_glo_call_cc
object Cyc_glo_call_cc
Definition: runtime.c:670
Cyc_num_gt
object Cyc_num_gt(void *, object cont, int argc, object n,...)
primitive_close_91input_91port
const object primitive_close_91input_91port
Definition: runtime.c:6662
primitive__121
const object primitive__121
Definition: runtime.c:6548
Cyc_write_va_list
object Cyc_write_va_list(void *data, object x, object opts)
Definition: runtime.c:1224
Cyc_io_read_line
object Cyc_io_read_line(void *data, object cont, object port)
Definition: runtime.c:7826
gc_init_heap
void gc_init_heap(long heap_size)
Perform one-time heap initializations for the program.
Definition: runtime.c:319
Cyc_io_read_u8
object Cyc_io_read_u8(void *data, object cont, object port)
Definition: runtime.c:7807
Cyc_io_file_exists
object Cyc_io_file_exists(void *data, object filename)
Definition: runtime.c:4647
primitive_Cyc_91end_91thread_67
const object primitive_Cyc_91end_91thread_67
Definition: runtime.c:6541
_cyc_argv
char ** _cyc_argv
Definition: runtime.c:194
primitive_file_91exists_127
const object primitive_file_91exists_127
Definition: runtime.c:6666
primitive_caadar
const object primitive_caadar
Definition: runtime.c:6593
Cyc_end_thread
void Cyc_end_thread(gc_thread_data *thd)
Definition: runtime.c:6805
global_stack_size
long global_stack_size
primitive__123
const object primitive__123
Definition: runtime.c:6546
primitive_Cyc_91opaque_127
const object primitive_Cyc_91opaque_127
Definition: runtime.c:6537
primitive_equal_127
const object primitive_equal_127
Definition: runtime.c:6565
Cyc_VOID
const object Cyc_VOID
Definition: runtime.c:201
primitive_open_91binary_91input_91file
const object primitive_open_91binary_91input_91file
Definition: runtime.c:6659
primitive_char_127
const object primitive_char_127
Definition: runtime.c:6642
Cyc_string2number2_
object Cyc_string2number2_(void *data, object cont, int argc, object str,...)
Definition: runtime.c:2407
Cyc_is_immutable
object Cyc_is_immutable(object obj)
Definition: runtime.c:1975
primitive_vector_91length
const object primitive_vector_91length
Definition: runtime.c:6572
Cyc_make_rectangular
void Cyc_make_rectangular(void *data, object k, object r, object i)
Definition: runtime.c:6928
primitive_caaaar
const object primitive_caaaar
Definition: runtime.c:6591
Cyc_set_car_cps
object Cyc_set_car_cps(void *, object cont, object l, object val)
Definition: runtime.c:2062
primitive_call_95cc
const object primitive_call_95cc
Definition: runtime.c:6674
Cyc_io_open_output_file
port_type Cyc_io_open_output_file(void *data, object str)
Definition: runtime.c:4566
primitive_eof_91object_127
const object primitive_eof_91object_127
Definition: runtime.c:6643
__halt
object __halt(object obj)
Definition: runtime.c:3496
dispatch_display_va
void dispatch_display_va(void *data, object clo, int argc, object *args)
Definition: runtime.c:986
cell_get
object cell_get(object cell)
Definition: runtime.c:343
Cyc_integer2char
object Cyc_integer2char(void *data, object n)
Definition: runtime.c:3467
apply_va
object apply_va(void *data, object cont, int argc, object func,...)
Definition: runtime.c:5679
primitive_read_91char
const object primitive_read_91char
Definition: runtime.c:6668
Cyc_io_close_input_port
object Cyc_io_close_input_port(void *data, object port)
Definition: runtime.c:4585
Cyc_number2string2
object Cyc_number2string2(void *data, object cont, int argc, object n,...)
Definition: runtime.c:2262
symbol_type
Symbols are similar to strings, but only one instance of each unique symbol is created,...
Definition: types.h:788
Cyc_mul_op
object Cyc_mul_op(void *data, common_type *x, object y)
primitive_eq_127
const object primitive_eq_127
Definition: runtime.c:6563
primitive__75halt
const object primitive__75halt
Definition: runtime.c:6552
Cyc_fast_vector_5
object Cyc_fast_vector_5(object ptr, object a1, object a2, object a3, object a4, object a5)
Definition: runtime.c:1560
Cyc_vector_set_unsafe_cps
object Cyc_vector_set_unsafe_cps(void *d, object cont, object v, object k, object obj)
Definition: runtime.c:2158
primitive_bytevector_91u8_91set_67
const object primitive_bytevector_91u8_91set_67
Definition: runtime.c:6634
assq
list assq(void *data, object x, list l)
Definition: runtime.c:1443
octstr2int
int octstr2int(const char *str)
Definition: runtime.c:2558
Cyc_rt_raise2
void Cyc_rt_raise2(void *data, const char *msg, object err)
Raise an exception from the runtime code.
Definition: runtime.c:752
primitive_cadddr
const object primitive_cadddr
Definition: runtime.c:6598
primitive_vector_127
const object primitive_vector_127
Definition: runtime.c:6654
primitive_bytevector_91u8_91ref
const object primitive_bytevector_91u8_91ref
Definition: runtime.c:6633
Cyc_vector_set
object Cyc_vector_set(void *d, object v, object k, object obj)
Definition: runtime.c:2022
primitive_cdddar
const object primitive_cdddar
Definition: runtime.c:6605
primitive_string_91_125number
const object primitive_string_91_125number
Definition: runtime.c:6609
Cyc_is_number
object Cyc_is_number(object o)
Definition: runtime.c:1896
Cyc_string_length
object Cyc_string_length(void *data, object str)
Definition: runtime.c:2638
primitive_assv
const object primitive_assv
Definition: runtime.c:6567
primitive_vector_91ref
const object primitive_vector_91ref
Definition: runtime.c:6573
Cyc_is_real
object Cyc_is_real(object o)
Definition: runtime.c:1907
primitive_system
const object primitive_system
Definition: runtime.c:6620
Cyc_set_car
object Cyc_set_car(void *, object l, object val)
Definition: runtime.c:1998
Cyc_fast_div
object Cyc_fast_div(void *data, object ptr, object x, object y)
Definition: runtime.c:3964
primitive_bytevector
const object primitive_bytevector
Definition: runtime.c:6629
primitive_exit
const object primitive_exit
Definition: runtime.c:6553
Cyc_num_lt
object Cyc_num_lt(void *, object cont, int argc, object n,...)
Cyc_num_op_va_list
object Cyc_num_op_va_list(void *data, int argc, object(fn_op(void *, common_type *, object)), int default_no_args, int default_one_arg, object n, va_list ns, common_type *buf)
Definition: runtime.c:4277
primitive_list_91_125vector
const object primitive_list_91_125vector
Definition: runtime.c:6640
Cyc_io_read_token
void Cyc_io_read_token(void *data, object cont, object port)
Read next token from the input port.
Definition: runtime.c:7886
Cyc_string_cmp
object Cyc_string_cmp(void *data, object str1, object str2)
Definition: runtime.c:2568
primitive_memv
const object primitive_memv
Definition: runtime.c:6569
primitive_macro_127
const object primitive_macro_127
Definition: runtime.c:6650
Cyc_has_cycle
object Cyc_has_cycle(object lst)
Definition: runtime.c:906
primitive_cdaaar
const object primitive_cdaaar
Definition: runtime.c:6599
primitive__125_123
const object primitive__125_123
Definition: runtime.c:6549
Cyc_display
object Cyc_display(void *data, object, FILE *port)
Definition: runtime.c:1026
Cyc_char_lt_op
object Cyc_char_lt_op(void *data, object a, object b)
Cyc_io_open_binary_input_file
port_type Cyc_io_open_binary_input_file(void *data, object str)
Definition: runtime.c:4571
Cyc_char_gte_op
object Cyc_char_gte_op(void *data, object a, object b)
common_type
A union of all the constant-size objects.
Definition: types.h:1497
primitive_cadr
const object primitive_cadr
Definition: runtime.c:6580
primitive_Cyc_91installation_91dir
const object primitive_Cyc_91installation_91dir
Definition: runtime.c:6614
primitive_Cyc_91string_91_125utf8
const object primitive_Cyc_91string_91_125utf8
Definition: runtime.c:6636
Cyc_fast_sub
object Cyc_fast_sub(void *data, object ptr, object x, object y)
Definition: runtime.c:3764
Cyc_string_byte_length
object Cyc_string_byte_length(void *data, object str)
Definition: runtime.c:2644
primitive_set_91global_67
const object primitive_set_91global_67
Definition: runtime.c:6560
primitive_bytevector_127
const object primitive_bytevector_127
Definition: runtime.c:6655
boolean_t
const object boolean_t
Definition: runtime.c:396
primitive_eqv_127
const object primitive_eqv_127
Definition: runtime.c:6564
primitive_close_91output_91port
const object primitive_close_91output_91port
Definition: runtime.c:6663
primitive_boolean_127
const object primitive_boolean_127
Definition: runtime.c:6641
Cyc_num_gte_op
int Cyc_num_gte_op(void *, object x, object y)
primitive_string_91_125symbol
const object primitive_string_91_125symbol
Definition: runtime.c:6624
Cyc_mul
object Cyc_mul(void *data, object cont, int argc, object n,...)
primitive__91
const object primitive__91
Definition: runtime.c:6543
Cyc_utf8_validate
uint32_t Cyc_utf8_validate(char *str, size_t len)
Simplified version of Cyc_utf8_validate_stream that must always be called with a complete string buff...
Definition: runtime.c:8149
Cyc_EOF
const object Cyc_EOF
Definition: runtime.c:200
Cyc_default_exception_handler
object Cyc_default_exception_handler(void *data, object _, int argc, object *args)
The default exception handler.
Definition: runtime.c:680
primitive_cadar
const object primitive_cadar
Definition: runtime.c:6585
Cyc_num_lt_op
int Cyc_num_lt_op(void *, object x, object y)
Cyc_glo_eval_from_c
object Cyc_glo_eval_from_c
Definition: runtime.c:671
Cyc_io_open_input_bytevector
port_type * Cyc_io_open_input_bytevector(void *data, object bv)
Definition: mstreams.c:57
primitive_integer_91_125char
const object primitive_integer_91_125char
Definition: runtime.c:6608
Cyc_num_fast_gt_op
object Cyc_num_fast_gt_op(void *data, object x, object y)
Cyc_trigger_minor_gc
object Cyc_trigger_minor_gc(void *data, object cont)
Trigger a minor GC for the calling thread.
Definition: runtime.c:6018
Cyc_stdin
port_type Cyc_stdin(void)
Definition: runtime.c:4523
Cyc_invalid_type_error
void Cyc_invalid_type_error(void *data, int tag, object found)
Definition: runtime.c:57
Cyc_symbol2string
object Cyc_symbol2string(void *d, object cont, object sym)
Definition: runtime.c:2337
Cyc_div
object Cyc_div(void *data, object cont, int argc, object n,...)
Definition: runtime.c:4153
primitive_char_91_125integer
const object primitive_char_91_125integer
Definition: runtime.c:6607
primitive_symbol_91_125string
const object primitive_symbol_91_125string
Definition: runtime.c:6625
primitive__85
const object primitive__85
Definition: runtime.c:6544
primitive_Cyc_91cvar_127
const object primitive_Cyc_91cvar_127
Definition: runtime.c:6536
primitive_peek_91char
const object primitive_peek_91char
Definition: runtime.c:6669
Cyc_io_peek_char
object Cyc_io_peek_char(void *data, object cont, object port)
Definition: runtime.c:7688
Cyc_utf82string
object Cyc_utf82string(void *data, object cont, object bv, object start, object end)
Definition: runtime.c:3212
Cyc_sub
object Cyc_sub(void *data, object cont, int argc, object n,...)
primitive_caadr
const object primitive_caadr
Definition: runtime.c:6584
Cyc_num_fast_lt_op
object Cyc_num_fast_lt_op(void *data, object x, object y)
set_env_variables
void set_env_variables(char **vars)
Definition: runtime.c:260
Cyc_num_eq_op
int Cyc_num_eq_op(void *, object x, object y)
Cyc_fast_list_2
object Cyc_fast_list_2(object ptr, object x, object y)
Definition: runtime.c:1488
Cyc_io_flush_output_port
object Cyc_io_flush_output_port(void *data, object port)
Definition: runtime.c:4623
Cyc_sum
object Cyc_sum(void *data, object cont, int argc, object n,...)
Cyc_num_gte
object Cyc_num_gte(void *, object cont, int argc, object n,...)
Cyc_bytevector_copy
object Cyc_bytevector_copy(void *data, object cont, object bv, object start, object end)
Definition: runtime.c:3166
primitive_make_91vector
const object primitive_make_91vector
Definition: runtime.c:6628
primitive_bytevector_91length
const object primitive_bytevector_91length
Definition: runtime.c:6571
primitive_assq
const object primitive_assq
Definition: runtime.c:6566
Cyc_check_bounds
void Cyc_check_bounds(void *data, const char *label, int len, int index)
Definition: runtime.c:86
GC
void GC(void *, closure, object *, int)
Definition: runtime.c:6182
primitive_Cyc_91has_91cycle_127
const object primitive_Cyc_91has_91cycle_127
Definition: runtime.c:6538
dispatch_write_va
void dispatch_write_va(void *data, object clo, int argc, object *args)
Definition: runtime.c:1198
memberp
object memberp(void *data, object x, list l)
Definition: runtime.c:1423
Cyc_write_char
object Cyc_write_char(void *data, object c, object port)
Definition: runtime.c:1357
Cyc_bit_unset
object Cyc_bit_unset(void *data, object n1, object n2)
Definition: runtime.c:6907
Cyc_rt_raise
void Cyc_rt_raise(void *data, object err)
Raise an exception from the runtime code.
Definition: runtime.c:735
Cyc_io_open_input_string
port_type * Cyc_io_open_input_string(void *data, object str)
Definition: mstreams.c:36
Cyc_is_procedure
object Cyc_is_procedure(void *data, object o)
Definition: runtime.c:1942
Cyc_global_set
object Cyc_global_set(void *thd, object sym, object *glo, object value)
Definition: runtime.c:349
Cyc_get_cvar
object Cyc_get_cvar(object var)
Definition: runtime.c:878
copy2heap
object copy2heap(void *data, object obj)
Copy given object to the heap, if it is from the stack. This function is intended to be called direct...
Definition: runtime.c:6855
primitive_set_91cell_67
const object primitive_set_91cell_67
Definition: runtime.c:6561
Cyc_io_get_output_bytevector
void Cyc_io_get_output_bytevector(void *data, object cont, object port)
Definition: mstreams.c:111
Cyc_st_print
void Cyc_st_print(void *data, FILE *out)
Print the contents of the given thread's stack trace buffer.
Definition: runtime.c:407
primitive_cddddr
const object primitive_cddddr
Definition: runtime.c:6606
Cyc_length_unsafe
object Cyc_length_unsafe(void *d, object l)
Definition: runtime.c:2230
dispatch
void dispatch(void *data, int argc, function_type func, object clo, object cont, object args)
Definition: runtime.c:6258
function_type
void(* function_type)(void *data, object clo, int argc, object *args)
Definition: types.h:666
assoc
list assoc(void *data, object x, list l)
Definition: runtime.c:1457
global_table
list global_table
Definition: runtime.c:519
Cyc_fast_vector_4
object Cyc_fast_vector_4(object ptr, object a1, object a2, object a3, object a4)
Definition: runtime.c:1544
primitive_caaddr
const object primitive_caaddr
Definition: runtime.c:6594
primitive_length
const object primitive_length
Definition: runtime.c:6570
_cyc_argc
int _cyc_argc
Definition: runtime.c:193
primitive_Cyc_91spawn_91thread_67
const object primitive_Cyc_91spawn_91thread_67
Definition: runtime.c:6539
boolean_f
const object boolean_f
Definition: runtime.c:397
Cyc_num_eq
object Cyc_num_eq(void *, object cont, int argc, object n,...)
primitive_cdadr
const object primitive_cdadr
Definition: runtime.c:6588
Cyc_bignum_normalize
object Cyc_bignum_normalize(void *data, object n)
Definition: runtime.c:1702
Cyc_fast_list_4
object Cyc_fast_list_4(object ptr, object a1, object a2, object a3, object a4)
Definition: runtime.c:1505
primitive_cell_91get
const object primitive_cell_91get
Definition: runtime.c:6559
Cyc_io_peek_u8
object Cyc_io_peek_u8(void *data, object cont, object port)
Definition: runtime.c:7743
Cyc_check_pair
#define Cyc_check_pair(d, obj)
Definition: runtime.h:127
Cyc_exit_thread
void Cyc_exit_thread(void *data, object _, int argc, object *args)
Definition: runtime.c:6814
Cyc_num_lte
object Cyc_num_lte(void *, object cont, int argc, object n,...)
is_library_loaded
object is_library_loaded(const char *name)
Definition: runtime.c:495
primitive_string_91set_67
const object primitive_string_91set_67
Definition: runtime.c:6613
primitive_Cyc_91get_91cvar
const object primitive_Cyc_91get_91cvar
Definition: runtime.c:6534
Cyc_vector_length
object Cyc_vector_length(void *data, object v)
Definition: runtime.c:2207
Cyc_installation_dir
object Cyc_installation_dir(void *data, object cont, object type)
Definition: runtime.c:2841
primitive_bytevector_91append
const object primitive_bytevector_91append
Definition: runtime.c:6630
primitive_pair_127
const object primitive_pair_127
Definition: runtime.c:6648
Cyc_io_open_input_file
port_type Cyc_io_open_input_file(void *data, object str)
Definition: runtime.c:4561
Cyc_num_fast_eq_op
object Cyc_num_fast_eq_op(void *data, object x, object y)
primitive_cdaar
const object primitive_cdaar
Definition: runtime.c:6587
Cyc_vector_set_unsafe
object Cyc_vector_set_unsafe(void *d, object v, object k, object obj)
Definition: runtime.c:2041
primitive_cadadr
const object primitive_cadadr
Definition: runtime.c:6596
primitive_number_127
const object primitive_number_127
Definition: runtime.c:6645
Cyc_div_op
object Cyc_div_op(void *data, common_type *x, object y)
Definition: runtime.c:4055
Cyc_current_exception_handler
object Cyc_current_exception_handler(void *data)
Return the current exception handler.
Definition: runtime.c:720
Cyc_command_line_arguments
object Cyc_command_line_arguments(void *data, object cont)
Definition: runtime.c:2921
primitive_substring
const object primitive_substring
Definition: runtime.c:6611
Cyc_utf8_count_code_points
int Cyc_utf8_count_code_points(uint8_t *s)
Count the number of code points in a string. Based on example code from Bjoern Hoehrmann.
Definition: runtime.c:8082
primitive_Cyc_91current_91exception_91handler
const object primitive_Cyc_91current_91exception_91handler
Definition: runtime.c:6554
Cyc_utf8_encode
int Cyc_utf8_encode(char *dest, int sz, uint32_t *src, int srcsz)
Definition: runtime.c:8194
primitive_cddadr
const object primitive_cddadr
Definition: runtime.c:6604
Cyc_vector_ref
object Cyc_vector_ref(void *d, object v, object k)
Definition: runtime.c:2176
Cyc_set_cdr_cps
object Cyc_set_cdr_cps(void *, object cont, object l, object val)
Definition: runtime.c:2095
primitive_Cyc_91compilation_91environment
const object primitive_Cyc_91compilation_91environment
Definition: runtime.c:6616
apply
object apply(void *data, object cont, object func, object args)
Definition: runtime.c:5694
Cyc_utf8_validate_stream
uint32_t Cyc_utf8_validate_stream(uint32_t *state, char *str, size_t len)
Use this when validating from a stream, as it may be that the stream stopped in the middle of a codep...
Definition: runtime.c:8129
primitive_Cyc_91global_91vars
const object primitive_Cyc_91global_91vars
Definition: runtime.c:6533
mcvar
cvar_type * mcvar(object *var)
Definition: runtime.c:4681
Cyc_bytevector
object Cyc_bytevector(void *data, object cont, int argc, object bval,...)
Definition: runtime.c:3073
Cyc_bit_set
object Cyc_bit_set(void *data, object n1, object n2)
Definition: runtime.c:6915
primitive_command_91line_91arguments
const object primitive_command_91line_91arguments
Definition: runtime.c:6618
Cyc_string_append
object Cyc_string_append(void *data, object cont, int argc, object str1,...)
Definition: runtime.c:2603
equalp
object equalp(object, object)
Definition: runtime.c:1593
Cyc_sum_op
object Cyc_sum_op(void *data, common_type *x, object y)
Cyc_stderr
port_type Cyc_stderr(void)
Definition: runtime.c:4529