core: Remove set-env! as builtin.

* src/eval-apply.c (set_x): Rename from set_env_x.  Drop environment
parameter.
* include/mes/mes.h: Declare it.
* include/mes/builtins.h (set_env_x): Remove declaration.
* src/builtins.c (mes_builtins): Remove registration.
This commit is contained in:
Jan Nieuwenhuizen 2019-11-15 16:26:55 +01:00 committed by Jan (janneke) Nieuwenhuizen
parent 629698e172
commit b7705b49c7
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
4 changed files with 4 additions and 5 deletions

View File

@ -53,7 +53,6 @@ struct scm *write_port_ (struct scm *x, struct scm *p);
struct scm *pairlis (struct scm *x, struct scm *y, struct scm *a);
struct scm *set_car_x (struct scm *x, struct scm *e);
struct scm *set_cdr_x (struct scm *x, struct scm *e);
struct scm *set_env_x (struct scm *x, struct scm *e, struct scm *a);
struct scm *add_formals (struct scm *formals, struct scm *x);
struct scm *eval_apply ();
/* src/gc.c */

View File

@ -147,6 +147,7 @@ struct scm *make_string_port (struct scm *x);
struct scm *make_vector_ (long k, struct scm *e);
struct scm *mes_builtins (struct scm *a);
struct scm *push_cc (struct scm *p1, struct scm *p2, struct scm *a, struct scm *c);
struct scm *set_x (struct scm *x, struct scm *e);
struct scm *struct_ref_ (struct scm *x, long i);
struct scm *struct_set_x_ (struct scm *x, long i, struct scm *e);
struct scm *vector_ref_ (struct scm *x, long i);

View File

@ -163,7 +163,6 @@ mes_builtins (struct scm *a) /*:((internal)) */
a = init_builtin (builtin_type, "pairlis", 3, &pairlis, a);
a = init_builtin (builtin_type, "set-car!", 2, &set_car_x, a);
a = init_builtin (builtin_type, "set-cdr!", 2, &set_cdr_x, a);
a = init_builtin (builtin_type, "set-env!", 3, &set_env_x, a);
a = init_builtin (builtin_type, "add-formals", 2, &add_formals, a);
a = init_builtin (builtin_type, "eval-apply", 0, &eval_apply, a);
/* src/gc.c */

View File

@ -113,14 +113,14 @@ set_cdr_x (struct scm *x, struct scm *e)
}
struct scm *
set_env_x (struct scm *x, struct scm *e, struct scm *a)
set_x (struct scm *x, struct scm *e) /*:((internal)) */
{
struct scm *p;
if (x->type == TVARIABLE)
p = x->variable;
else
{
p = lookup_variable (a, x, cell_f);
p = lookup_variable (R0, x, cell_f);
if (p == cell_f || p-> cdr == cell_undefined)
error (cell_symbol_unbound_variable, x);
}
@ -577,7 +577,7 @@ eval:
push_cc (R1->cdr->cdr->car, R1, R0, cell_vm_eval_set_x);
goto eval;
eval_set_x:
R1 = set_env_x (R2->cdr->car, R1, R0);
R1 = set_x (R2->cdr->car, R1);
goto vm_return;
}
else if (c == cell_vm_macro_expand)