cl_object si_get_limit(cl_object type) { cl_env_ptr env = ecl_process_env(); cl_index output; if (type == ECL_SYM("EXT::FRAME-STACK",1669)) { output = env->frs_size; } else if (type == ECL_SYM("EXT::BINDING-STACK",1668)) { output = env->bds_size; } else if (type == ECL_SYM("EXT::C-STACK",1671)) { output = env->cs_size; } else if (type == ECL_SYM("EXT::LISP-STACK",1670)) { output = env->stack_size; } else { output = cl_core.max_heap_size; } { #line 633 const cl_env_ptr the_env = ecl_process_env(); #line 633 #line 633 cl_object __value0 = ecl_make_unsigned_integer(output); #line 633 the_env->nvalues = 1; #line 633 return __value0; #line 633 } }
cl_object mp_get_rwlock_write_wait(cl_object lock) { cl_env_ptr env = ecl_process_env(); if (ecl_t_of(lock) != t_rwlock) FEerror_not_a_rwlock(lock); #ifdef ECL_RWLOCK { int rc = pthread_rwlock_wrlock(&lock->rwlock.mutex); if (rc != 0) { FEunknown_rwlock_error(lock, rc); } { #line 213 const cl_env_ptr the_env = ecl_process_env(); #line 213 #line 213 cl_object __value0 = ECL_T; #line 213 the_env->nvalues = 1; #line 213 return __value0; #line 213 } } #else return mp_get_lock_wait(lock->rwlock.mutex); #endif }
/* (SI:PUT-F plist value indicator) returns the new property list with value for property indicator. It will be used in SETF for GETF. */ cl_object si_put_f(cl_object place, cl_object value, cl_object indicator) { cl_object l; #ifdef ECL_SAFE assert_type_proper_list(place); #endif /* This loop guarantees finishing for circular lists */ for (l = place; CONSP(l); ) { cl_object cdr_l = ECL_CONS_CDR(l); if (!CONSP(cdr_l)) break; if (ECL_CONS_CAR(l) == indicator) { ECL_RPLACA(cdr_l, value); { #line 214 const cl_env_ptr the_env = ecl_process_env(); #line 214 #line 214 cl_object __value0 = place; #line 214 the_env->nvalues = 1; #line 214 return __value0; #line 214 } ; } l = ECL_CONS_CDR(cdr_l); } if (l != ECL_NIL) FEtype_error_plist(place); place = CONS(value, place); { #line 221 const cl_env_ptr the_env = ecl_process_env(); #line 221 #line 221 cl_object __value0 = CONS(indicator, place); #line 221 the_env->nvalues = 1; #line 221 return __value0; #line 221 } ; }
cl_object si_float_to_digits(cl_object digits, cl_object number, cl_object position, cl_object relativep) { cl_fixnum k; float_approx approx[1]; setup(number, approx); change_precision(approx, position, relativep); k = scale(approx); if (Null(digits)) digits = si_make_vector(ECL_SYM("BASE-CHAR",120), ecl_make_fixnum(10), ECL_T /* adjustable */, ecl_make_fixnum(0) /* fill pointer */, ECL_NIL /* displacement */, ECL_NIL /* displ. offset */); generate(digits, approx); { #line 218 const cl_env_ptr the_env = ecl_process_env(); #line 218 #line 218 cl_object __value0 = ecl_make_fixnum(k); #line 218 cl_object __value1 = digits; #line 218 the_env->nvalues = 2; #line 218 the_env->values[1] = __value1; #line 218 return __value0; #line 218 } }
/* (SI:REM-F plist indicator) returns two values: * the new property list in which property indcator is removed * T if really removed NIL otherwise. It will be used for macro REMF. */ cl_object si_rem_f(cl_object plist, cl_object indicator) { cl_env_ptr the_env = ecl_process_env(); bool found = remf(&plist, indicator); ecl_return2(the_env, plist, (found? ECL_T : ECL_NIL)); }
ECL_DLLEXPORT void init_fas_CODE(cl_object flag) { const cl_env_ptr cl_env_copy = ecl_process_env(); cl_object value0; cl_object *VVtemp; if (flag != OBJNULL){ Cblock = flag; #ifndef ECL_DYNAMIC_VV flag->cblock.data = VV; #endif flag->cblock.data_size = VM; flag->cblock.temp_data_size = VMtemp; flag->cblock.data_text = compiler_data_text; flag->cblock.data_text_size = compiler_data_text_size; flag->cblock.cfuns_size = compiler_cfuns_size; flag->cblock.cfuns = compiler_cfuns; flag->cblock.source = make_constant_base_string("/home/tucker/Repo/my-code/lisp/misc.lisp"); return;} #ifdef ECL_DYNAMIC_VV VV = Cblock->cblock.data; #endif Cblock->cblock.data_text = "@EcLtAg:init_fas_CODE@"; VVtemp = Cblock->cblock.temp_data; ECL_DEFINE_SETF_FUNCTIONS ecl_function_dispatch(cl_env_copy,VV[2])(10, VVtemp[0], ECL_NIL, ECL_NIL, VVtemp[1], ECL_NIL, ECL_NIL, VVtemp[2], ECL_NIL, ECL_NIL, ECL_NIL) /* DODEFPACKAGE */; ecl_cmp_defun(VV[3]); /* SEQ */ ecl_function_dispatch(cl_env_copy,VV[4])(3, VV[0], ECL_SYM("FUNCTION",396), VVtemp[3]) /* SET-DOCUMENTATION */; ecl_cmp_defun(VV[8]); /* INTERLEAVE */ }
cl_object cl_denominator(cl_object x) { switch (ecl_t_of(x)) { case t_ratio: x = x->ratio.den; break; case t_fixnum: case t_bignum: x = ecl_make_fixnum(1); break; default: FEwrong_type_nth_arg(ecl_make_fixnum(/*NUMERATOR*/608),1,x,ecl_make_fixnum(/*RATIONAL*/687)); } { #line 116 const cl_env_ptr the_env = ecl_process_env(); #line 116 #line 116 cl_object __value0 = x; #line 116 the_env->nvalues = 1; #line 116 return __value0; #line 116 } }
cl_object cl_copy_alist(cl_object x) { cl_object copy; if (ecl_unlikely(!LISTP(x))) { FEwrong_type_only_arg(ecl_make_fixnum(/*COPY-ALIST*/256), x, ecl_make_fixnum(/*LIST*/481)); } copy = ECL_NIL; if (!Null(x)) { cl_object tail = copy = duplicate_pairs(x); while (x = ECL_CONS_CDR(x), !Null(x)) { if (!LISTP(x)) { FEtype_error_list(x); } else { cl_object cons = duplicate_pairs(x); tail = ECL_RPLACD(tail, cons); tail = cons; } } } { #line 473 const cl_env_ptr the_env = ecl_process_env(); #line 473 #line 473 cl_object __value0 = copy; #line 473 the_env->nvalues = 1; #line 473 return __value0; #line 473 } ; }
cl_object si_foreign_data_set_elt(cl_object f, cl_object andx, cl_object type, cl_object value) { cl_index ndx = ecl_to_size(andx); cl_index limit = f->foreign.size; enum ecl_ffi_tag tag = ecl_foreign_type_code(type); if (ecl_unlikely(ndx >= limit || ndx + ecl_foreign_type_table[tag].size > limit)) { FEerror("Out of bounds reference into foreign data type ~A.", 1, f); } if (ecl_unlikely(ecl_t_of(f) != t_foreign)) { FEwrong_type_nth_arg(ecl_make_fixnum(/*SI::FOREIGN-DATA-SET-ELT*/1354), 1, f, ecl_make_fixnum(/*SI::FOREIGN-DATA*/1345)); } ecl_foreign_data_set_elt((void*)(f->foreign.data + ndx), tag, value); { #line 655 const cl_env_ptr the_env = ecl_process_env(); #line 655 #line 655 cl_object __value0 = value; #line 655 the_env->nvalues = 1; #line 655 return __value0; #line 655 } }
cl_object si_foreign_data_set(cl_object f, cl_object andx, cl_object value) { cl_index ndx = ecl_to_size(andx); cl_index size, limit; if (ecl_unlikely(ecl_t_of(f) != t_foreign)) { FEwrong_type_nth_arg(ecl_make_fixnum(/*SI::FOREIGN-DATA-SET*/1353), 1, f, ecl_make_fixnum(/*SI::FOREIGN-DATA*/1345)); } if (ecl_unlikely(ecl_t_of(value) != t_foreign)) { FEwrong_type_nth_arg(ecl_make_fixnum(/*SI::FOREIGN-DATA-SET*/1353), 3, value, ecl_make_fixnum(/*SI::FOREIGN-DATA*/1345)); } size = value->foreign.size; limit = f->foreign.size; if (ecl_unlikely(ndx >= limit || (limit - ndx) < size)) { FEerror("Out of bounds reference into foreign data type ~A.", 1, f); } memcpy(f->foreign.data + ndx, value->foreign.data, size); { #line 397 const cl_env_ptr the_env = ecl_process_env(); #line 397 #line 397 cl_object __value0 = value; #line 397 the_env->nvalues = 1; #line 397 return __value0; #line 397 } }
cl_object si_foreign_data_ref(cl_object f, cl_object andx, cl_object asize, cl_object tag) { cl_index ndx = ecl_to_size(andx); cl_index size = ecl_to_size(asize); cl_object output; if (ecl_unlikely(ecl_t_of(f) != t_foreign)) { FEwrong_type_nth_arg(ecl_make_fixnum(/*SI::FOREIGN-DATA-REF*/1351), 1, f, ecl_make_fixnum(/*SI::FOREIGN-DATA*/1345)); } if (ecl_unlikely(ndx >= f->foreign.size || (f->foreign.size - ndx) < size)) { FEerror("Out of bounds reference into foreign data type ~A.", 1, f); } output = ecl_allocate_foreign_data(tag, size); memcpy(output->foreign.data, f->foreign.data + ndx, size); { #line 374 const cl_env_ptr the_env = ecl_process_env(); #line 374 #line 374 cl_object __value0 = output; #line 374 the_env->nvalues = 1; #line 374 return __value0; #line 374 } }
cl_object si_foreign_data_pointer(cl_object f, cl_object andx, cl_object asize, cl_object tag) { cl_index ndx = ecl_to_size(andx); cl_index size = ecl_to_size(asize); cl_object output; if (ecl_unlikely(ecl_t_of(f) != t_foreign)) { FEwrong_type_only_arg(ecl_make_fixnum(/*SI::FOREIGN-DATA-POINTER*/1349), f, ecl_make_fixnum(/*SI::FOREIGN-DATA*/1345)); } if (ecl_unlikely(ndx >= f->foreign.size || (f->foreign.size - ndx) < size)) { FEerror("Out of bounds reference into foreign data type ~A.", 1, f); } output = ecl_alloc_object(t_foreign); output->foreign.tag = tag; output->foreign.size = size; output->foreign.data = f->foreign.data + ndx; { #line 355 const cl_env_ptr the_env = ecl_process_env(); #line 355 #line 355 cl_object __value0 = output; #line 355 the_env->nvalues = 1; #line 355 return __value0; #line 355 } }
cl_object si_foreign_data_equal(cl_object f1, cl_object f2) { if (ecl_unlikely(!ECL_FOREIGN_DATA_P(f1))) { FEwrong_type_only_arg(ecl_make_fixnum(/*SI::FOREIGN-DATA-ADDRESS*/1346), f1, ecl_make_fixnum(/*SI::FOREIGN-DATA*/1345)); } if (ecl_unlikely(!ECL_FOREIGN_DATA_P(f2))) { FEwrong_type_only_arg(ecl_make_fixnum(/*SI::FOREIGN-DATA-ADDRESS*/1346), f2, ecl_make_fixnum(/*SI::FOREIGN-DATA*/1345)); } { #line 333 const cl_env_ptr the_env = ecl_process_env(); #line 333 #line 333 cl_object __value0 = ((f1->foreign.data == f2->foreign.data)? ECL_T : ECL_NIL); #line 333 the_env->nvalues = 1; #line 333 return __value0; #line 333 } }
cl_object si_make_foreign_data_from_array(cl_object array) { cl_object tag; if (ecl_unlikely(ecl_t_of(array) != t_array && ecl_t_of(array) != t_vector)) { FEwrong_type_only_arg(ecl_make_fixnum(/*SI::MAKE-FOREIGN-DATA-FROM-ARRAY*/1358), array, ecl_make_fixnum(/*ARRAY*/96)); } tag = ecl_aet_to_ffi_table[array->array.elttype]; if (ecl_unlikely(Null(tag))) { FEerror("Cannot make foreign object from array " "with element type ~S.", 1, ecl_elttype_to_symbol(array->array.elttype)); } { #line 293 const cl_env_ptr the_env = ecl_process_env(); #line 293 #line 293 cl_object __value0 = ecl_make_foreign_data(tag, 0, array->array.self.bc); #line 293 the_env->nvalues = 1; #line 293 return __value0; #line 293 } ; }
cl_object si_allocate_foreign_data(cl_object tag, cl_object size) { cl_object output = ecl_alloc_object(t_foreign); cl_index bytes = ecl_to_size(size); output->foreign.tag = tag; output->foreign.size = bytes; /* FIXME! Should be atomic uncollectable or malloc, but we do not export * that garbage collector interface and malloc may be overwritten * by the GC library */ output->foreign.data = bytes? ecl_alloc_uncollectable(bytes) : NULL; { #line 260 const cl_env_ptr the_env = ecl_process_env(); #line 260 #line 260 cl_object __value0 = output; #line 260 the_env->nvalues = 1; #line 260 return __value0; #line 260 } }
cl_object cl_copy_list(cl_object x) { cl_object copy; if (ecl_unlikely(!LISTP(x))) { FEwrong_type_only_arg(ecl_make_fixnum(/*COPY-LIST*/257), x, ecl_make_fixnum(/*LIST*/481)); } copy = ECL_NIL; if (!Null(x)) { cl_object tail = copy = ecl_list1(CAR(x)); while (x = ECL_CONS_CDR(x), CONSP(x)) { cl_object cons = ecl_list1(ECL_CONS_CAR(x)); ECL_RPLACD(tail, cons); tail = cons; } ECL_RPLACD(tail, x); } { #line 441 const cl_env_ptr the_env = ecl_process_env(); #line 441 #line 441 cl_object __value0 = copy; #line 441 the_env->nvalues = 1; #line 441 return __value0; #line 441 } ; }
cl_object mp_giveup_rwlock_read(cl_object lock) { /* Must be called with interrupts disabled. */ if (ecl_t_of(lock) != t_rwlock) FEerror_not_a_rwlock(lock); #ifdef ECL_RWLOCK { int rc = pthread_rwlock_unlock(&lock->rwlock.mutex); if (rc) FEunknown_rwlock_error(lock, rc); { #line 113 const cl_env_ptr the_env = ecl_process_env(); #line 113 #line 113 cl_object __value0 = ECL_T; #line 113 the_env->nvalues = 1; #line 113 return __value0; #line 113 } ; } #else return mp_giveup_lock(lock->rwlock.mutex); #endif }
cl_object cl_numerator(cl_object x) { switch (ecl_t_of(x)) { case t_ratio: x = x->ratio.num; break; case t_fixnum: case t_bignum: break; default: FEwrong_type_nth_arg(ecl_make_fixnum(/*NUMERATOR*/608),1,x,ecl_make_fixnum(/*RATIONAL*/687)); } { #line 99 const cl_env_ptr the_env = ecl_process_env(); #line 99 #line 99 cl_object __value0 = x; #line 99 the_env->nvalues = 1; #line 99 return __value0; #line 99 } }
cl_object si_proper_list_p(cl_object x) { cl_fixnum n; cl_object fast, slow, test = ECL_T; /* INV: A list's length always fits in a fixnum */ fast = slow = x; for (n = 0; !Null(fast); n++, fast = ECL_CONS_CDR(fast)) { if (!LISTP(fast)) { test = ECL_NIL; break; } if (n & 1) { /* Circular list? */ if (slow == fast) { test = ECL_NIL; break; } slow = ECL_CONS_CDR(slow); } } { #line 333 const cl_env_ptr the_env = ecl_process_env(); #line 333 #line 333 cl_object __value0 = test; #line 333 the_env->nvalues = 1; #line 333 return __value0; #line 333 } ; }
cl_object si_compiled_function_block(cl_object fun) { cl_object output; switch(ecl_t_of(fun)) { case t_cfun: output = fun->cfun.block; break; case t_cfunfixed: output = fun->cfunfixed.block; break; case t_cclosure: output = fun->cclosure.block; break; default: FEerror("~S is not a C compiled function.", 1, fun); } { #line 182 const cl_env_ptr the_env = ecl_process_env(); #line 182 #line 182 cl_object __value0 = output; #line 182 the_env->nvalues = 1; #line 182 return __value0; #line 182 } }
cl_object cl_realpart(cl_object x) { switch (ecl_t_of(x)) { case t_fixnum: case t_bignum: case t_ratio: case t_singlefloat: case t_doublefloat: #ifdef ECL_LONG_FLOAT case t_longfloat: #endif break; case t_complex: x = x->complex.real; break; default: FEwrong_type_nth_arg(ecl_make_fixnum(/*REALPART*/705),1,x,ecl_make_fixnum(/*NUMBER*/606)); } { #line 445 const cl_env_ptr the_env = ecl_process_env(); #line 445 #line 445 cl_object __value0 = x; #line 445 the_env->nvalues = 1; #line 445 return __value0; #line 445 } }
void ecl_cs_overflow(void) { static const char *stack_overflow_msg = "\n;;;\n;;; Stack overflow.\n" ";;; Jumping to the outermost toplevel prompt\n" ";;;\n\n"; cl_env_ptr env = ecl_process_env(); cl_index safety_area = ecl_option_values[ECL_OPT_C_STACK_SAFETY_AREA]; cl_index size = env->cs_size; #ifdef ECL_DOWN_STACK if (env->cs_limit > env->cs_org - size) env->cs_limit -= safety_area; #else if (env->cs_limit < env->cs_org + size) env->cs_limit += safety_area; #endif else ecl_unrecoverable_error(env, stack_overflow_msg); cl_cerror(6, make_constant_base_string("Extend stack size"), ECL_SYM("EXT::STACK-OVERFLOW",1665), ECL_SYM(":SIZE",1308), ecl_make_fixnum(size), ECL_SYM(":TYPE",1318), ECL_SYM("EXT::C-STACK",1671)); size += size / 2; cs_set_size(env, size); }
cl_object cl_scale_float(cl_object x, cl_object y) { const cl_env_ptr the_env = ecl_process_env(); cl_fixnum k; if (ECL_FIXNUMP(y)) { k = ecl_fixnum(y); } else { FEwrong_type_nth_arg(ecl_make_fixnum(/*SCALE-FLOAT*/737),2,y,ecl_make_fixnum(/*FIXNUM*/372)); } switch (ecl_t_of(x)) { case t_singlefloat: x = ecl_make_single_float(ldexpf(ecl_single_float(x), k)); break; case t_doublefloat: x = ecl_make_double_float(ldexp(ecl_double_float(x), k)); break; #ifdef ECL_LONG_FLOAT case t_longfloat: x = ecl_make_long_float(ldexpl(ecl_long_float(x), k)); break; #endif default: FEwrong_type_nth_arg(ecl_make_fixnum(/*SCALE-FLOAT*/737),1,x,ecl_make_fixnum(/*FLOAT*/374)); } ecl_return1(the_env, x); }
cl_object cl_rem(cl_object x, cl_object y) { const cl_env_ptr the_env = ecl_process_env(); cl_truncate(2, x, y); ecl_return1(the_env, the_env->values[1]); }
cl_object si::call-cfun(cl_narg narg, ...) { #line 940 // ------------------------------2 #line 940 const cl_env_ptr the_env = ecl_process_env(); #line 940 cl_object cc_type; #line 940 va_list ARGS; va_start(ARGS, narg); cl_object fun = va_arg(ARGS,cl_object); cl_object return_type = va_arg(ARGS,cl_object); cl_object arg_types = va_arg(ARGS,cl_object); cl_object args = va_arg(ARGS,cl_object); #line 940 // ------------------------------3 void *cfun = ecl_foreign_data_pointer_safe(fun); cl_object object; volatile cl_index sp; ffi_cif cif; #line 946 // ------------------------------4 #line 946 #line 946 if (ecl_unlikely(narg < 4|| narg > 5)) FEwrong_num_arguments(ecl_make_fixnum(1589)); #line 946 if (narg > 4) { #line 946 cc_type = va_arg(ARGS,cl_object); #line 946 } else { #line 946 cc_type = ECL_SYM(":DEFAULT",1215); #line 946 } #line 946 // ------------------------------5 { sp = ECL_STACK_INDEX(the_env); prepare_cif(the_env, &cif, return_type, arg_types, args, cc_type, NULL); ffi_call(&cif, cfun, the_env->ffi_values, (void **)the_env->ffi_values_ptrs); object = ecl_foreign_data_ref_elt(the_env->ffi_values, ecl_foreign_type_code(return_type)); ECL_STACK_SET_INDEX(the_env, sp); { #line 953 #line 953 cl_object __value0 = object; #line 953 the_env->nvalues = 1; #line 953 return __value0; #line 953 } } }
cl_object mp_rwlock_name(cl_object lock) { const cl_env_ptr env = ecl_process_env(); if (ecl_t_of(lock) != t_rwlock) FEerror_not_a_rwlock(lock); ecl_return1(env, lock->rwlock.name); }
cl_object cl_mod(cl_object x, cl_object y) { const cl_env_ptr the_env = ecl_process_env(); /* INV: #'floor always outputs two values */ cl_floor(2, x, y); ecl_return1(the_env, the_env->values[1]); }
cl_object cl_float_precision(cl_object x) { const cl_env_ptr the_env = ecl_process_env(); int precision; switch (ecl_t_of(x)) { case t_singlefloat: { float f = ecl_single_float(x); if (f == 0.0) { precision = 0; } else { int exp; frexpf(f, &exp); if (exp >= FLT_MIN_EXP) { precision = FLT_MANT_DIG; } else { precision = FLT_MANT_DIG - (FLT_MIN_EXP - exp); } } break; } case t_doublefloat: { double f = ecl_double_float(x); if (f == 0.0) { precision = 0; } else { int exp; frexp(f, &exp); if (exp >= DBL_MIN_EXP) { precision = DBL_MANT_DIG; } else { precision = DBL_MANT_DIG - (DBL_MIN_EXP - exp); } } break; } #ifdef ECL_LONG_FLOAT case t_longfloat: { long double f = ecl_long_float(x); if (f == 0.0) { precision = 0; } else { int exp; frexp(f, &exp); if (exp >= LDBL_MIN_EXP) { precision = LDBL_MANT_DIG; } else { precision = LDBL_MANT_DIG - (LDBL_MIN_EXP - exp); } } break; } #endif default: FEwrong_type_nth_arg(ecl_make_fixnum(/*FLOAT-PRECISION*/376),1,x,ecl_make_fixnum(/*FLOAT*/374)); } ecl_return1(the_env, ecl_make_fixnum(precision)); }
cl_object si_frs_top() { cl_env_ptr env = ecl_process_env(); { #line 563 const cl_env_ptr the_env = ecl_process_env(); #line 563 #line 563 cl_object __value0 = ecl_make_fixnum(env->frs_top - env->frs_org); #line 563 the_env->nvalues = 1; #line 563 return __value0; #line 563 } }
cl_object si_ihs_top(void) { cl_env_ptr env = ecl_process_env(); { #line 425 const cl_env_ptr the_env = ecl_process_env(); #line 425 #line 425 cl_object __value0 = ecl_make_fixnum(env->ihs_top->index); #line 425 the_env->nvalues = 1; #line 425 return __value0; #line 425 } }