core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
|
|
|
* GNU Mes --- Maxwell Equations of Software
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
*
|
|
|
|
* This file is part of GNU Mes.
|
|
|
|
*
|
|
|
|
* GNU Mes is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* GNU Mes is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mes/lib.h"
|
|
|
|
#include "mes/mes.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
assert_defined (struct scm *x, struct scm *e) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
|
|
|
if (e == cell_undefined)
|
|
|
|
return error (cell_symbol_unbound_variable, x);
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
check_formals (struct scm *f, struct scm *formals, struct scm *args) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
|
|
|
long flen;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (formals->type == TNUMBER)
|
|
|
|
flen = formals->value;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
else
|
|
|
|
flen = length__ (formals);
|
|
|
|
long alen = length__ (args);
|
|
|
|
if (alen != flen && alen != -1 && flen != -1)
|
|
|
|
{
|
|
|
|
char *s = "apply: wrong number of arguments; expected: ";
|
|
|
|
eputs (s);
|
|
|
|
eputs (itoa (flen));
|
|
|
|
eputs (", got: ");
|
|
|
|
eputs (itoa (alen));
|
|
|
|
eputs ("\n");
|
|
|
|
write_error_ (f);
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *e = make_string0 (s);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return error (cell_symbol_wrong_number_of_args, cons (e, f));
|
|
|
|
}
|
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
check_apply (struct scm *f, struct scm *e) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
|
|
|
char *type = 0;
|
|
|
|
if (f == cell_f || f == cell_t)
|
|
|
|
type = "bool";
|
|
|
|
if (f == cell_nil)
|
|
|
|
type = "nil";
|
|
|
|
if (f == cell_unspecified)
|
|
|
|
type = "*unspecified*";
|
|
|
|
if (f == cell_undefined)
|
|
|
|
type = "*undefined*";
|
2020-10-18 10:34:32 +01:00
|
|
|
if (f->type == TCHAR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
type = "char";
|
2020-10-18 10:34:32 +01:00
|
|
|
if (f->type == TNUMBER)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
type = "number";
|
2020-10-18 10:34:32 +01:00
|
|
|
if (f->type == TSTRING)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
type = "string";
|
2020-10-18 10:34:32 +01:00
|
|
|
if (f->type == TSTRUCT && builtin_p (f) == cell_f)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
type = "#<...>";
|
2020-10-18 10:34:32 +01:00
|
|
|
if (f->type == TBROKEN_HEART)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
type = "<3";
|
|
|
|
|
|
|
|
if (type != 0)
|
|
|
|
{
|
|
|
|
char *s = "cannot apply: ";
|
|
|
|
eputs (s);
|
|
|
|
eputs (type);
|
|
|
|
eputs ("[");
|
|
|
|
write_error_ (e);
|
|
|
|
eputs ("]\n");
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *e = make_string0 (s);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return error (cell_symbol_wrong_type_arg, cons (e, f));
|
|
|
|
}
|
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
pairlis (struct scm *x, struct scm *y, struct scm *a)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
|
|
|
if (x == cell_nil)
|
|
|
|
return a;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (x->type != TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return cons (cons (x, y), a);
|
|
|
|
return cons (cons (car (x), car (y)), pairlis (cdr (x), cdr (y), a));
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
set_car_x (struct scm *x, struct scm *e)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (x->type != TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
error (cell_symbol_not_a_pair, cons (x, cstring_to_symbol ("set-car!")));
|
2020-10-18 10:34:32 +01:00
|
|
|
x->car = e;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
set_cdr_x (struct scm *x, struct scm *e)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (x->type != TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
error (cell_symbol_not_a_pair, cons (x, cstring_to_symbol ("set-cdr!")));
|
2020-10-18 10:34:32 +01:00
|
|
|
x->cdr = e;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
set_env_x (struct scm *x, struct scm *e, struct scm *a)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *p;
|
|
|
|
if (x->type == TVARIABLE)
|
|
|
|
p = x->variable;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
else
|
|
|
|
p = assert_defined (x, module_variable (a, x));
|
2020-10-18 10:34:32 +01:00
|
|
|
if (p->type != TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
error (cell_symbol_not_a_pair, cons (p, x));
|
|
|
|
return set_cdr_x (p, e);
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
call_lambda (struct scm *e, struct scm *x, struct scm *aa, struct scm *a) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *cl = cons (cons (cell_closure, x), x);
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = e;
|
|
|
|
R0 = cl;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
make_closure_ (struct scm *args, struct scm *body, struct scm *a) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-05-17 23:40:50 +01:00
|
|
|
return make_cell (TCLOSURE, cell_f, cons (cons (cell_circular, a), cons (args, body)));
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
make_variable_ (struct scm *var) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-05-17 23:40:50 +01:00
|
|
|
return make_cell (TVARIABLE, var, 0);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
macro_get_handle (struct scm *name) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (name->type == TSYMBOL)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return hashq_get_handle (g_macros, name, cell_nil);
|
|
|
|
return cell_f;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
get_macro (struct scm *name) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *m = macro_get_handle (name);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
if (m != cell_f)
|
2020-07-17 13:30:01 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *d = m->cdr;
|
|
|
|
return d->macro;
|
2020-07-17 13:30:01 +01:00
|
|
|
}
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return cell_f;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
macro_set_x (struct scm *name, struct scm *value) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
|
|
|
return hashq_set_x (g_macros, name, value);
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
push_cc (struct scm *p1, struct scm *p2, struct scm *a, struct scm *c) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *x = R3;
|
2020-05-17 21:32:53 +01:00
|
|
|
R3 = c;
|
|
|
|
R2 = p2;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_push_frame ();
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = p1;
|
|
|
|
R0 = a;
|
|
|
|
R3 = x;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
add_formals (struct scm *formals, struct scm *x)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
while (x->type == TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
formals = cons (x->car, formals);
|
|
|
|
x = x->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
if (x->type == TSYMBOL)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
formals = cons (x, formals);
|
|
|
|
return formals;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2020-10-18 10:34:32 +01:00
|
|
|
formal_p (struct scm *x, struct scm *formals) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (formals->type == TSYMBOL)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
|
|
|
if (x == formals)
|
2020-05-31 14:03:10 +01:00
|
|
|
return 1;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
else
|
2020-05-31 14:03:10 +01:00
|
|
|
return 0;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
while (formals->type == TPAIR)
|
2020-07-16 18:39:34 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (formals->car == x)
|
2020-07-16 18:39:34 +01:00
|
|
|
break;
|
2020-10-18 10:34:32 +01:00
|
|
|
formals = formals->cdr;
|
2020-07-16 18:39:34 +01:00
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
if (formals->type == TSYMBOL)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return formals == x;
|
2020-10-18 10:34:32 +01:00
|
|
|
return formals->type == TPAIR;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
expand_variable_ (struct scm *x, struct scm *formals, int top_p) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
struct scm *a;
|
|
|
|
struct scm *f;
|
|
|
|
struct scm *v;
|
2020-10-18 10:34:32 +01:00
|
|
|
while (x->type == TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
a = x->car;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (a->type == TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (a->car == cell_symbol_lambda)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
f = a->cdr->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
formals = add_formals (formals, f);
|
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
else if (a->car == cell_symbol_define || a->car == cell_symbol_define_macro)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
f = a->cdr->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
formals = add_formals (formals, f);
|
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
if (a->car != cell_symbol_quote)
|
2020-07-17 13:30:01 +01:00
|
|
|
expand_variable_ (a, formals, 0);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-07-17 13:30:01 +01:00
|
|
|
if (a == cell_symbol_lambda)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
f = x->cdr->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
formals = add_formals (formals, f);
|
2020-10-18 10:34:32 +01:00
|
|
|
x = x->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
2020-07-17 13:30:01 +01:00
|
|
|
else if (a == cell_symbol_define || a == cell_symbol_define_macro)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
f = x->cdr->car;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (top_p != 0 && f->type == TPAIR)
|
|
|
|
f = f->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
formals = add_formals (formals, f);
|
2020-10-18 10:34:32 +01:00
|
|
|
x = x->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
2020-07-17 13:30:01 +01:00
|
|
|
else if (a == cell_symbol_quote)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return cell_unspecified;
|
2020-10-18 10:34:32 +01:00
|
|
|
else if (a->type == TSYMBOL
|
2020-07-17 13:30:01 +01:00
|
|
|
&& a != cell_symbol_boot_module
|
|
|
|
&& a != cell_symbol_current_module
|
|
|
|
&& a != cell_symbol_primitive_load
|
2020-10-18 10:34:32 +01:00
|
|
|
&& formal_p (x->car, formals) == 0)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
v = module_variable (R0, a);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
if (v != cell_f)
|
2020-10-18 10:34:32 +01:00
|
|
|
x->car = make_variable_ (v);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
x = x->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
top_p = 0;
|
|
|
|
}
|
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
expand_variable (struct scm *x, struct scm *formals) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
|
|
|
return expand_variable_ (x, formals, 1);
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
apply_builtin (struct scm *fn, struct scm *x) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *a = builtin_arity (fn);
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
struct scm *d;
|
2020-10-18 10:34:32 +01:00
|
|
|
int arity = a->value;
|
2020-07-16 19:53:11 +01:00
|
|
|
if ((arity > 0 || arity == -1) && x != cell_nil)
|
2020-07-17 13:30:01 +01:00
|
|
|
{
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
a = x->car;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (a->type == TVALUES)
|
|
|
|
x = cons (a->cdr->car, x->cdr);
|
2020-07-17 13:30:01 +01:00
|
|
|
}
|
2020-07-16 19:53:11 +01:00
|
|
|
if ((arity > 1 || arity == -1) && x != cell_nil)
|
2020-07-17 13:30:01 +01:00
|
|
|
{
|
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 12:38:38 +00:00
|
|
|
a = x->car;
|
|
|
|
d = x->cdr;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (d->type == TPAIR)
|
|
|
|
if (d->car->type == TVALUES)
|
|
|
|
x = cons (a, cons (d->car->cdr->car, d));
|
2020-07-17 13:30:01 +01:00
|
|
|
}
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
|
|
|
|
if (arity == 0)
|
2020-08-18 22:01:53 +01:00
|
|
|
return apply_builtin0 (fn);
|
|
|
|
if (arity == 1)
|
2020-10-18 10:34:32 +01:00
|
|
|
return apply_builtin1 (fn, x->car);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
else if (arity == 2)
|
2020-10-18 10:34:32 +01:00
|
|
|
return apply_builtin2 (fn, x->car, x->cdr->car);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
else if (arity == 3)
|
2020-10-18 10:34:32 +01:00
|
|
|
return apply_builtin3 (fn, x->car, x->cdr->car, x->cdr->cdr->car);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
else if (arity == -1)
|
2020-08-18 22:01:53 +01:00
|
|
|
return apply_builtin1 (fn, x);
|
|
|
|
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
eval_apply ()
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *aa;
|
|
|
|
struct scm *args;
|
|
|
|
struct scm *body;
|
|
|
|
struct scm *cl;
|
|
|
|
struct scm *entry;
|
|
|
|
struct scm *expanders;
|
|
|
|
struct scm *formals;
|
|
|
|
struct scm *input;
|
|
|
|
struct scm *name;
|
|
|
|
struct scm *macro;
|
|
|
|
struct scm *p;
|
|
|
|
struct scm *program;
|
|
|
|
struct scm *sc_expand;
|
|
|
|
struct scm *v;
|
|
|
|
struct scm *x;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
int global_p;
|
|
|
|
int macro_p;
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *a;
|
|
|
|
struct scm *c;
|
|
|
|
struct scm *d;
|
2020-07-17 13:30:01 +01:00
|
|
|
int t;
|
|
|
|
long i;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
|
|
|
|
eval_apply:
|
2020-05-17 21:32:53 +01:00
|
|
|
if (R3 == cell_vm_evlis2)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto evlis2;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_evlis3)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto evlis3;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_eval_check_func)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_check_func;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_eval2)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval2;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_apply2)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto apply2;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_if_expr)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto if_expr;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_begin_eval)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin_eval;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_eval_set_x)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_set_x;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_macro_expand_car)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand_car;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_return)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_macro_expand_cdr)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand_cdr;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_eval_define)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_define;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_macro_expand)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_macro_expand_lambda)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand_lambda;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_eval_pmatch_car)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_pmatch_car;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_begin_expand_macro)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin_expand_macro;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_macro_expand_define)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand_define;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_begin_expand_eval)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin_expand_eval;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_call_with_current_continuation2)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto call_with_current_continuation2;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_macro_expand_set_x)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand_set_x;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_eval_pmatch_cdr)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_pmatch_cdr;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_macro_expand_define_macro)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand_define_macro;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_begin_primitive_load)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin_primitive_load;
|
|
|
|
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_evlis)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto evlis;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_apply)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto apply;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_eval)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_eval_macro_expand_eval)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_macro_expand_eval;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_eval_macro_expand_expand)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_macro_expand_expand;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_begin)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_begin_expand)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin_expand;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_begin_expand_primitive_load)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin_expand_primitive_load;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_if)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_if;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_vm_call_with_values2)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto call_with_values2;
|
2020-05-17 21:32:53 +01:00
|
|
|
else if (R3 == cell_unspecified)
|
|
|
|
return R1;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
else
|
2020-07-18 07:12:41 +01:00
|
|
|
assert_msg (0, "eval/apply unknown continuation");
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
|
|
|
|
evlis:
|
2020-05-17 21:32:53 +01:00
|
|
|
if (R1 == cell_nil)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->type != TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->car, R1, R0, cell_vm_evlis2);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
evlis2:
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R2->cdr, R1, R0, cell_vm_evlis3);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto evlis;
|
|
|
|
evlis3:
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = cons (R2, R1);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
|
|
|
|
apply:
|
2021-05-16 12:27:12 +01:00
|
|
|
g_stack_array[g_stack + GC_FRAME_PROCEDURE] = R1->car;
|
2020-10-18 10:34:32 +01:00
|
|
|
a = R1->car;
|
|
|
|
t = a->type;
|
|
|
|
if (t == TSTRUCT && builtin_p (R1->car) == cell_t)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
check_formals (R1->car, builtin_arity (R1->car), R1->cdr);
|
|
|
|
R1 = apply_builtin (R1->car, R1->cdr);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
else if (t == TCLOSURE)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
cl = R1->car->closure;
|
|
|
|
body = cl->cdr->cdr;
|
|
|
|
formals = cl->cdr->car;
|
|
|
|
args = R1->cdr;
|
|
|
|
aa = cl->car->cdr;
|
|
|
|
aa = aa->cdr;
|
|
|
|
check_formals (R1->car, formals, R1->cdr);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
p = pairlis (formals, args, aa);
|
2020-05-17 21:32:53 +01:00
|
|
|
call_lambda (body, p, aa, R0);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin;
|
|
|
|
}
|
|
|
|
else if (t == TCONTINUATION)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
a = R1->car;
|
|
|
|
v = a->continuation;
|
|
|
|
if (v->length != 0)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
for (i = 0; i < v->length; i = i + 1)
|
|
|
|
g_stack_array[STACK_SIZE - v->length + i] = vector_ref_ (v, i);
|
|
|
|
g_stack = STACK_SIZE - v->length;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
2020-05-17 21:32:53 +01:00
|
|
|
x = R1;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_pop_frame ();
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = x->cdr->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_apply;
|
|
|
|
}
|
|
|
|
else if (t == TSPECIAL)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
c = R1->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
if (c == cell_vm_apply)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (cons (R1->cdr->car, R1->cdr->cdr->car), R1, R0, cell_vm_return);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto apply;
|
|
|
|
}
|
|
|
|
else if (c == cell_vm_eval)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr->car, R1, R1->cdr->cdr->car, cell_vm_return);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
}
|
|
|
|
else if (c == cell_vm_begin_expand)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (cons (R1->cdr->car, cell_nil), R1, R1->cdr->cdr->car, cell_vm_return);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin_expand;
|
|
|
|
}
|
|
|
|
else
|
2020-10-18 10:34:32 +01:00
|
|
|
check_apply (cell_f, R1->car);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
else if (t == TSYMBOL)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
c = R1->car;
|
2020-08-18 10:06:15 +01:00
|
|
|
if (c == cell_symbol_call_with_current_continuation)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = R1->cdr;
|
2020-08-18 10:06:15 +01:00
|
|
|
goto call_with_current_continuation;
|
|
|
|
}
|
|
|
|
if (c == cell_symbol_call_with_values)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = R1->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto call_with_values;
|
|
|
|
}
|
2020-08-18 10:06:15 +01:00
|
|
|
if (c == cell_symbol_current_module)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R0;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
}
|
2020-08-18 10:06:15 +01:00
|
|
|
if (c == cell_symbol_boot_module)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = M0;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (t == TPAIR)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->car->car == cell_symbol_lambda)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
formals = R1->car->cdr->car;
|
|
|
|
args = R1->cdr;
|
|
|
|
body = R1->car->cdr->cdr;
|
|
|
|
p = pairlis (formals, R1->cdr, R0);
|
2020-05-17 21:32:53 +01:00
|
|
|
check_formals (R1, formals, args);
|
|
|
|
call_lambda (body, p, p, R0);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin;
|
|
|
|
}
|
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->car, R1, R0, cell_vm_apply2);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
apply2:
|
2020-10-18 10:34:32 +01:00
|
|
|
check_apply (R1, R2->car);
|
|
|
|
R1 = cons (R1, R2->cdr);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto apply;
|
|
|
|
|
|
|
|
eval:
|
2020-10-18 10:34:32 +01:00
|
|
|
t = R1->type;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
if (t == TPAIR)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
c = R1->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
if (c == cell_symbol_pmatch_car)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr->car, R1, R0, cell_vm_eval_pmatch_car);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
eval_pmatch_car:
|
2020-05-17 21:32:53 +01:00
|
|
|
x = R1;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_pop_frame ();
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = x->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_apply;
|
|
|
|
}
|
|
|
|
else if (c == cell_symbol_pmatch_cdr)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr->car, R1, R0, cell_vm_eval_pmatch_cdr);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
eval_pmatch_cdr:
|
2020-05-17 21:32:53 +01:00
|
|
|
x = R1;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_pop_frame ();
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = x->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_apply;
|
|
|
|
}
|
|
|
|
else if (c == cell_symbol_quote)
|
|
|
|
{
|
2020-05-17 21:32:53 +01:00
|
|
|
x = R1;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_pop_frame ();
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = x->cdr->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_apply;
|
|
|
|
}
|
|
|
|
else if (c == cell_symbol_begin)
|
|
|
|
goto begin;
|
|
|
|
else if (c == cell_symbol_lambda)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = make_closure_ (R1->cdr->car, R1->cdr->cdr, R0);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
else if (c == cell_symbol_if)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = R1->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_if;
|
|
|
|
}
|
|
|
|
else if (c == cell_symbol_set_x)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr->cdr->car, R1, R0, cell_vm_eval_set_x);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
eval_set_x:
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = set_env_x (R2->cdr->car, R1, R0);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
else if (c == cell_vm_macro_expand)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr->car, R1, R0, cell_vm_eval_macro_expand_eval);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
eval_macro_expand_eval:
|
2020-05-17 21:32:53 +01:00
|
|
|
push_cc (R1, R2, R0, cell_vm_eval_macro_expand_expand);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand;
|
|
|
|
eval_macro_expand_expand:
|
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->type == TPAIR)
|
|
|
|
if (R1->car == cell_symbol_define || R1->car == cell_symbol_define_macro)
|
2020-07-16 20:10:27 +01:00
|
|
|
{
|
2020-07-17 13:30:01 +01:00
|
|
|
global_p = 0;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R0->car->car != cell_closure)
|
2020-07-17 13:30:01 +01:00
|
|
|
global_p = 1;
|
|
|
|
macro_p = 0;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->car == cell_symbol_define_macro)
|
2020-07-17 13:30:01 +01:00
|
|
|
macro_p = 1;
|
2020-07-16 20:10:27 +01:00
|
|
|
if (global_p != 0)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
name = R1->cdr->car;
|
|
|
|
aa = R1->cdr->car;
|
|
|
|
if (aa->type == TPAIR)
|
|
|
|
name = name->car;
|
2020-07-16 20:10:27 +01:00
|
|
|
if (macro_p != 0)
|
|
|
|
{
|
|
|
|
entry = assq (name, g_macros);
|
|
|
|
if (entry == cell_f)
|
|
|
|
macro_set_x (name, cell_f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
entry = module_variable (R0, name);
|
|
|
|
if (entry == cell_f)
|
|
|
|
module_define_x (M0, name, cell_f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
R2 = R1;
|
2020-10-18 10:34:32 +01:00
|
|
|
aa = R1->cdr->car;
|
|
|
|
if (aa->type != TPAIR)
|
2020-07-16 20:10:27 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr->cdr->car, R2, cons (cons (R1->cdr->car, R1->cdr->car), R0), cell_vm_eval_define);
|
2020-07-16 20:10:27 +01:00
|
|
|
goto eval;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
p = pairlis (R1->cdr->car, R1->cdr->car, R0);
|
|
|
|
formals = R1->cdr->car->cdr;
|
|
|
|
body = R1->cdr->cdr;
|
2020-07-16 20:10:27 +01:00
|
|
|
|
2020-07-18 07:53:42 +01:00
|
|
|
if (macro_p != 0 || global_p != 0)
|
2020-07-16 20:10:27 +01:00
|
|
|
expand_variable (body, formals);
|
|
|
|
R1 = cons (cell_symbol_lambda, cons (formals, body));
|
|
|
|
push_cc (R1, R2, p, cell_vm_eval_define);
|
|
|
|
goto eval;
|
|
|
|
}
|
|
|
|
eval_define:
|
2020-10-18 10:34:32 +01:00
|
|
|
name = R2->cdr->car;
|
|
|
|
aa = R2->cdr->car;
|
|
|
|
if (aa->type == TPAIR)
|
|
|
|
name = name->car;
|
2020-07-16 20:10:27 +01:00
|
|
|
if (macro_p != 0)
|
|
|
|
{
|
|
|
|
entry = macro_get_handle (name);
|
|
|
|
R1 = make_macro (name, R1);
|
|
|
|
set_cdr_x (entry, R1);
|
|
|
|
}
|
|
|
|
else if (global_p != 0)
|
|
|
|
{
|
|
|
|
entry = module_variable (R0, name);
|
|
|
|
set_cdr_x (entry, R1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
entry = cons (name, R1);
|
|
|
|
aa = cons (entry, cell_nil);
|
|
|
|
set_cdr_x (aa, cdr (R0));
|
|
|
|
set_cdr_x (R0, aa);
|
|
|
|
cl = module_variable (R0, cell_closure);
|
|
|
|
set_cdr_x (cl, aa);
|
|
|
|
}
|
|
|
|
R1 = cell_unspecified;
|
|
|
|
goto vm_return;
|
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->car, R1, R0, cell_vm_eval_check_func);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_check ();
|
|
|
|
goto eval;
|
|
|
|
eval_check_func:
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R2->cdr, R2, R0, cell_vm_eval2);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto evlis;
|
|
|
|
eval2:
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = cons (R2->car, R1);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto apply;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (t == TSYMBOL)
|
|
|
|
{
|
2020-05-17 21:32:53 +01:00
|
|
|
if (R1 == cell_symbol_boot_module)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
2020-05-17 21:32:53 +01:00
|
|
|
if (R1 == cell_symbol_current_module)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
2020-05-17 21:32:53 +01:00
|
|
|
if (R1 == cell_symbol_begin)
|
2020-08-18 09:40:55 +01:00
|
|
|
goto vm_return;
|
2020-08-18 10:06:15 +01:00
|
|
|
if (R1 == cell_symbol_call_with_current_continuation)
|
|
|
|
goto vm_return;
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = assert_defined (R1, module_ref (R0, R1));
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
else if (t == TVARIABLE)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
x = R1->variable;
|
|
|
|
R1 = x->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
else if (t == TBROKEN_HEART)
|
2020-05-17 21:32:53 +01:00
|
|
|
error (cell_symbol_system_error, R1);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
else
|
|
|
|
goto vm_return;
|
|
|
|
|
|
|
|
macro_expand:
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->type != TPAIR || R1->car == cell_symbol_quote)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->car == cell_symbol_lambda)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr->cdr, R1, R0, cell_vm_macro_expand_lambda);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand;
|
|
|
|
macro_expand_lambda:
|
2020-10-18 10:34:32 +01:00
|
|
|
R2->cdr->cdr = R1;
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->type == TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
macro = get_macro (R1->car);
|
2020-07-16 20:10:27 +01:00
|
|
|
if (macro != cell_f)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = cons (macro, R1->cdr);
|
2020-07-16 20:10:27 +01:00
|
|
|
push_cc (R1, cell_nil, R0, cell_vm_macro_expand);
|
|
|
|
goto apply;
|
|
|
|
}
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->car == cell_symbol_define || R1->car == cell_symbol_define_macro)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr->cdr, R1, R0, cell_vm_macro_expand_define);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand;
|
|
|
|
macro_expand_define:
|
2020-10-18 10:34:32 +01:00
|
|
|
R2->cdr->cdr = R1;
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->car == cell_symbol_define_macro)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-05-17 21:32:53 +01:00
|
|
|
push_cc (R1, R1, R0, cell_vm_macro_expand_define_macro);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
macro_expand_define_macro:
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->car == cell_symbol_set_x)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr->cdr, R1, R0, cell_vm_macro_expand_set_x);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand;
|
|
|
|
macro_expand_set_x:
|
2020-10-18 10:34:32 +01:00
|
|
|
R2->cdr->cdr = R1;
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->type == TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
a = R1->car;
|
|
|
|
if (a->type == TSYMBOL && a != cell_symbol_begin)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-07-16 20:10:27 +01:00
|
|
|
macro = macro_get_handle (cell_symbol_portable_macro_expand);
|
|
|
|
if (macro != cell_f)
|
|
|
|
{
|
|
|
|
expanders = module_ref (R0, cell_symbol_sc_expander_alist);
|
|
|
|
if (expanders != cell_undefined)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
macro = assq (R1->car, expanders);
|
2020-07-16 20:10:27 +01:00
|
|
|
if (macro != cell_f)
|
|
|
|
{
|
|
|
|
sc_expand = module_ref (R0, cell_symbol_macro_expand);
|
|
|
|
R2 = R1;
|
|
|
|
if (sc_expand != cell_undefined && sc_expand != cell_f)
|
|
|
|
{
|
|
|
|
R1 = cons (sc_expand, cons (R1, cell_nil));
|
|
|
|
goto apply;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->car, R1, R0, cell_vm_macro_expand_car);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand;
|
|
|
|
|
|
|
|
macro_expand_car:
|
2020-10-18 10:34:32 +01:00
|
|
|
R2->car = R1;
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->cdr == cell_nil)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->cdr, R1, R0, cell_vm_macro_expand_cdr);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand;
|
|
|
|
|
|
|
|
macro_expand_cdr:
|
2020-10-18 10:34:32 +01:00
|
|
|
R2->cdr = R1;
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
|
|
|
|
goto vm_return;
|
|
|
|
|
|
|
|
begin:
|
|
|
|
x = cell_unspecified;
|
2020-05-17 21:32:53 +01:00
|
|
|
while (R1 != cell_nil)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
|
|
|
gc_check ();
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->type == TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->car->car == cell_symbol_primitive_load)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
program = cons (R1->car, cell_nil);
|
2020-05-17 21:32:53 +01:00
|
|
|
push_cc (program, R1, R0, cell_vm_begin_primitive_load);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto begin_expand;
|
|
|
|
begin_primitive_load:
|
2020-10-18 10:34:32 +01:00
|
|
|
R2->car = R1;
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->type == TPAIR)
|
2020-07-17 13:30:01 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
a = R1->car;
|
|
|
|
if (a->type == TPAIR)
|
2020-07-17 13:30:01 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
if (a->car == cell_symbol_begin)
|
|
|
|
R1 = append2 (a->cdr, R1->cdr);
|
2020-07-17 13:30:01 +01:00
|
|
|
}
|
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->cdr == cell_nil)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = R1->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->car, R1, R0, cell_vm_begin_eval);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
begin_eval:
|
2020-05-17 21:32:53 +01:00
|
|
|
x = R1;
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = R2->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = x;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
|
|
|
|
|
|
|
|
begin_expand:
|
|
|
|
x = cell_unspecified;
|
2020-05-17 21:32:53 +01:00
|
|
|
while (R1 != cell_nil)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-07-18 19:40:06 +01:00
|
|
|
begin_expand_while:
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_check ();
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->type == TPAIR)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
a = R1->car;
|
|
|
|
if (a->type == TPAIR)
|
|
|
|
if (R1->car->car == cell_symbol_begin)
|
|
|
|
R1 = append2 (R1->car->cdr, R1->cdr);
|
|
|
|
if (R1->car->car == cell_symbol_primitive_load)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->car->cdr->car, R1, R0, cell_vm_begin_expand_primitive_load);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
begin_expand_primitive_load:
|
2020-10-18 10:34:32 +01:00
|
|
|
if ((R1->type == TNUMBER) && R1->value == 0)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
0;
|
2020-10-18 10:34:32 +01:00
|
|
|
else if (R1->type == TSTRING)
|
2020-05-17 21:32:53 +01:00
|
|
|
input = set_current_input_port (open_input_file (R1));
|
2020-10-18 10:34:32 +01:00
|
|
|
else if (R1->type == TPORT)
|
2020-05-17 21:32:53 +01:00
|
|
|
input = set_current_input_port (R1);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
else
|
2020-07-18 07:12:41 +01:00
|
|
|
{
|
|
|
|
eputs ("begin_expand failed, R1=");
|
|
|
|
display_error_ (R1);
|
|
|
|
assert_msg (0, "begin-expand-boom 0");
|
|
|
|
}
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
|
2020-05-17 21:32:53 +01:00
|
|
|
push_cc (input, R2, R0, cell_vm_return);
|
|
|
|
x = read_input_file_env (R0);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
if (g_debug > 5)
|
2020-05-17 21:32:53 +01:00
|
|
|
module_printer (M0);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_pop_frame ();
|
2020-05-17 21:32:53 +01:00
|
|
|
input = R1;
|
|
|
|
R1 = x;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
set_current_input_port (input);
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = cons (cell_symbol_begin, R1);
|
2020-10-18 10:34:32 +01:00
|
|
|
R2->car = R1;
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
2020-07-18 19:40:06 +01:00
|
|
|
goto begin_expand_while;
|
|
|
|
continue; /* FIXME: M2-PLanet */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->car, R1, R0, cell_vm_begin_expand_macro);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto macro_expand;
|
|
|
|
begin_expand_macro:
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1 != R2->car)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
R2->car = R1;
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
2020-07-18 19:40:06 +01:00
|
|
|
goto begin_expand_while;
|
|
|
|
continue; /* FIXME: M2-PLanet */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = R2;
|
2020-10-18 10:34:32 +01:00
|
|
|
expand_variable (R1->car, cell_nil);
|
|
|
|
push_cc (R1->car, R1, R0, cell_vm_begin_expand_eval);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
begin_expand_eval:
|
2020-05-17 21:32:53 +01:00
|
|
|
x = R1;
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = R2->cdr;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
}
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = x;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
|
|
|
|
vm_if:
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (R1->car, R1, R0, cell_vm_if_expr);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
if_expr:
|
2020-05-17 21:32:53 +01:00
|
|
|
x = R1;
|
|
|
|
R1 = R2;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
if (x != cell_f)
|
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = R1->cdr->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
}
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->cdr->cdr != cell_nil)
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-10-18 10:34:32 +01:00
|
|
|
R1 = R1->cdr->cdr->car;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval;
|
|
|
|
}
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = cell_unspecified;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
|
|
|
|
call_with_current_continuation:
|
|
|
|
gc_push_frame ();
|
core: Remove macros from cell creation: make_char .. make_string.
* src/gc.c (make_char, make_continuation, make_macro, make_number,
make_ref, make_string0, make_string_port): New function.
(make_string): Move from string.c.
* include/mes/macros.h (MAKE_CHAR, MAKE_CONTINUATION, MAKE_MACRO,
MAKE_NUMBER, MAKE_REF, MAKE_STRING0, MAKE_STRING_PORT): Remove macro.
Update users.
* include/mes/m2.h: Likewise.
2020-05-18 21:35:12 +01:00
|
|
|
x = make_continuation (g_continuations);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
g_continuations = g_continuations + 1;
|
2020-08-16 15:54:18 +01:00
|
|
|
v = make_vector_ (STACK_SIZE - g_stack, cell_unspecified);
|
2020-07-17 13:30:01 +01:00
|
|
|
for (i = g_stack; i < STACK_SIZE; i = i + 1)
|
|
|
|
vector_set_x_ (v, i - g_stack, g_stack_array[i]);
|
2020-10-18 10:34:32 +01:00
|
|
|
x->continuation = v;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_pop_frame ();
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (cons (R1->car, cons (x, cell_nil)), x, R0, cell_vm_call_with_current_continuation2);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto apply;
|
|
|
|
call_with_current_continuation2:
|
2020-08-16 15:54:18 +01:00
|
|
|
v = make_vector_ (STACK_SIZE - g_stack, cell_unspecified);
|
2020-07-17 13:30:01 +01:00
|
|
|
for (i = g_stack; i < STACK_SIZE; i = i + 1)
|
|
|
|
vector_set_x_ (v, i - g_stack, g_stack_array[i]);
|
2020-10-18 10:34:32 +01:00
|
|
|
R2->continuation = v;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto vm_return;
|
|
|
|
|
|
|
|
call_with_values:
|
2020-10-18 10:34:32 +01:00
|
|
|
push_cc (cons (R1->car, cell_nil), R1, R0, cell_vm_call_with_values2);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto apply;
|
|
|
|
call_with_values2:
|
2020-10-18 10:34:32 +01:00
|
|
|
if (R1->type == TVALUES)
|
|
|
|
R1 = R1->cdr;
|
|
|
|
R1 = cons (R2->cdr->car, R1);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto apply;
|
|
|
|
|
|
|
|
vm_return:
|
2020-05-17 21:32:53 +01:00
|
|
|
x = R1;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
gc_pop_frame ();
|
2020-05-17 21:32:53 +01:00
|
|
|
R1 = x;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
goto eval_apply;
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:34:32 +01:00
|
|
|
struct scm *
|
|
|
|
apply (struct scm *f, struct scm *x, struct scm *a) /*:((internal)) */
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
{
|
2020-05-17 21:32:53 +01:00
|
|
|
push_cc (cons (f, x), cell_unspecified, R0, cell_unspecified);
|
|
|
|
R3 = cell_vm_apply;
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
return eval_apply ();
|
|
|
|
}
|