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 2c6f5dc3b9
commit 9091d70aad
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 *pairlis (struct scm *x, struct scm *y, struct scm *a);
struct scm *set_car_x (struct scm *x, struct scm *e); 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_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 *add_formals (struct scm *formals, struct scm *x);
struct scm *eval_apply (); struct scm *eval_apply ();
/* src/gc.c */ /* 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 *make_vector_ (long k, struct scm *e);
struct scm *mes_builtins (struct scm *a); 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 *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_ref_ (struct scm *x, long i);
struct scm *struct_set_x_ (struct scm *x, long i, struct scm *e); struct scm *struct_set_x_ (struct scm *x, long i, struct scm *e);
struct scm *vector_ref_ (struct scm *x, long i); 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, "pairlis", 3, &pairlis, a);
a = init_builtin (builtin_type, "set-car!", 2, &set_car_x, 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-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, "add-formals", 2, &add_formals, a);
a = init_builtin (builtin_type, "eval-apply", 0, &eval_apply, a); a = init_builtin (builtin_type, "eval-apply", 0, &eval_apply, a);
/* src/gc.c */ /* src/gc.c */

View File

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