flat->deep variable ref: it boots!

This commit is contained in:
Jan Nieuwenhuizen 2019-11-16 22:27:48 +01:00
parent a66a5392a6
commit a285782399
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
6 changed files with 12 additions and 12 deletions

View File

@ -172,7 +172,6 @@ struct scm *struct_ref (struct scm *x, struct scm *i);
struct scm *struct_set_x (struct scm *x, struct scm *i, struct scm *e);
/* src/variable.c */
struct scm *variable_ref (struct scm *var);
struct scm *flat_variable_ref (struct scm *var);
struct scm *variable_set_x (struct scm *var, struct scm *value);
struct scm *variable_bound_p (struct scm *var);
struct scm *lookup_handle (struct scm *name, struct scm* define_p);

View File

@ -131,6 +131,7 @@ struct scm *cell_ref (struct scm *cell, long index);
struct scm *cstring_to_list (char const *s);
struct scm *cstring_to_symbol (char const *s);
struct scm *current_module ();
struct scm *deep_variable_ref (struct scm *var);
struct scm *fdisplay_ (struct scm *, int, int);
struct scm *handle_set_x (struct scm *name, struct scm *value);
struct scm *init_symbols ();

View File

@ -44,7 +44,6 @@
(define (module-bound x)
(display "core:module-bound?\n"))
(define core:variable-ref variable-ref)
(define variable-ref flat-variable-ref)
(define (provided? x)
#f)
@ -2745,10 +2744,10 @@
(display "\n")
;; (display "===> ZEE\n")
;; (display ZEE-MODULE)
;; (display "\n")
(display "===> ZEE\n")
(display ZEE-MODULE)
(display "\n")
;; (display "===> (ZEE)\n")
;; (display (ZEE-MODULE))
;; (display "\n")
(display "===> (ZEE)\n")
(display (ZEE-MODULE))
(display "\n")

View File

@ -282,7 +282,6 @@ mes_builtins (struct scm *a) /*:((internal)) */
a = init_builtin (builtin_type, "struct-set!", 3, &struct_set_x, a);
/* src/variable.c */
a = init_builtin (builtin_type, "variable-ref", 1, &variable_ref, a);
a = init_builtin (builtin_type, "flat-variable-ref", 1, &flat_variable_ref, a);
a = init_builtin (builtin_type, "variable-set!", 2, &variable_set_x, a);
a = init_builtin (builtin_type, "variable-bound?", 1, &variable_bound_p, a);
a = init_builtin (builtin_type, "lookup-handle", 2, &lookup_handle, a);

View File

@ -725,7 +725,7 @@ eval:
}
else if (t == TVARIABLE)
{
R1 = variable_ref (R1);
R1 = deep_variable_ref (R1);
goto vm_return;
}
else if (t == TBROKEN_HEART)

View File

@ -22,18 +22,20 @@
#include "mes/mes.h"
struct scm *
variable_ref (struct scm *var)
deep_variable_ref (struct scm *var)
{
assert_variable (1, var);
struct scm *ref = var->variable;
struct scm *value = ref->cdr;
if (value == cell_undefined)
error (cell_symbol_unbound_variable, var);
if (value->type == TVARIABLE)
value = value->variable;
return value;
}
struct scm *
flat_variable_ref (struct scm *var)
variable_ref (struct scm *var)
{
assert_variable (1, var);
struct scm *value = var->variable;