static sexp sexp_make_cnd_op (sexp ctx, sexp self, sexp_sint_t n, sexp test, sexp pass, sexp fail) { sexp res = sexp_alloc_type(ctx, cnd, SEXP_CND); sexp_cnd_test(res) = test; sexp_cnd_pass(res) = pass; sexp_cnd_fail(res) = fail; return res; }
sexp sexp_bytes_to_string (sexp ctx, sexp vec) { sexp res; #if SEXP_USE_PACKED_STRINGS res = sexp_c_string(ctx, sexp_bytes_data(vec), sexp_bytes_length(vec)); #else res = sexp_alloc_type(ctx, string, SEXP_STRING); sexp_string_bytes(res) = vec; sexp_string_offset(res) = 0; sexp_string_size(res) = sexp_bytes_length(vec); #endif return res; }
static sexp sexp_copy_lambda (sexp ctx, sexp self, sexp_sint_t n, sexp lambda) { sexp res = sexp_alloc_type(ctx, lambda, SEXP_LAMBDA); sexp_lambda_name(res) = sexp_lambda_name(lambda); sexp_lambda_params(res) = sexp_lambda_params(lambda); sexp_lambda_body(res) = sexp_lambda_body(lambda); sexp_lambda_locals(res) = sexp_lambda_locals(lambda); sexp_lambda_fv(res) = sexp_lambda_fv(lambda); sexp_lambda_sv(res) = sexp_lambda_sv(lambda); sexp_lambda_defs(res) = sexp_lambda_defs(lambda); sexp_lambda_return_type(res) = sexp_lambda_return_type(lambda); sexp_lambda_param_types(res) = sexp_lambda_param_types(lambda); return res; }
static sexp sexp_make_lambda_op (sexp ctx, sexp self, sexp_sint_t n, sexp name, sexp params, sexp body, sexp locals) { sexp res = sexp_alloc_type(ctx, lambda, SEXP_LAMBDA); sexp_lambda_name(res) = name; sexp_lambda_params(res) = params; sexp_lambda_body(res) = body; sexp_lambda_locals(res) = locals; sexp_lambda_fv(res) = SEXP_NULL; sexp_lambda_sv(res) = SEXP_NULL; sexp_lambda_defs(res) = SEXP_NULL; sexp_lambda_return_type(res) = SEXP_FALSE; sexp_lambda_param_types(res) = SEXP_NULL; return res; }
static sexp sexp_make_lit_op (sexp ctx, sexp self, sexp_sint_t n, sexp value) { sexp res = sexp_alloc_type(ctx, lit, SEXP_LIT); sexp_lit_value(res) = value; return res; }
static sexp sexp_make_seq (sexp ctx, sexp self, sexp_sint_t n, sexp ls) { sexp res = sexp_alloc_type(ctx, seq, SEXP_SEQ); sexp_seq_ls(res) = ls; return res; }
static sexp sexp_make_ref_op (sexp ctx, sexp self, sexp_sint_t n, sexp name, sexp cell) { sexp res = sexp_alloc_type(ctx, ref, SEXP_REF); sexp_ref_name(res) = name; sexp_ref_cell(res) = cell; return res; }
static sexp sexp_make_set_op (sexp ctx, sexp self, sexp_sint_t n, sexp var, sexp value) { sexp res = sexp_alloc_type(ctx, set, SEXP_SET); sexp_set_var(res) = var; sexp_set_value(res) = value; return res; }
static sexp copy_opcode (sexp ctx, struct sexp_opcode_struct *op) { sexp res = sexp_alloc_type(ctx, opcode, SEXP_OPCODE); memcpy(&(res->value), op, sizeof(op[0])); return res; }
static sexp sexp_make_macro_op (sexp ctx, sexp self, sexp_sint_t n, sexp proc, sexp env) { sexp res = sexp_alloc_type(ctx, macro, SEXP_MACRO); sexp_macro_proc(res) = proc; sexp_macro_env(res) = env; return res; }