core: Replace special cell_boot_module with initial-module builtin.
* src/module.c (initial_module): New builtin. * include/mes/builtins.h: Declare it. * src/builtins.c (mes_builtins): Register it. * include/mes/symbols.h (cell_boot_module): Remove. * src/symbol.c (init_symbols_): Update. (init_symbols): Likewise. * src/eval-apply.c (eval_apply): Likewise. (expand_variable_): Likewise. * tests/macro.test (make-fluid): Likewise. * mes/module/mes/fluids.mes (make-fluid): Likewise.
This commit is contained in:
parent
ea9d231335
commit
15153f7ace
|
@ -102,6 +102,7 @@ struct scm *logxor (struct scm *x);
|
|||
struct scm *ash (struct scm *n, struct scm *count);
|
||||
/* src/module.c */
|
||||
struct scm *module_define_x (struct scm *module, struct scm *name, struct scm *value);
|
||||
struct scm *initial_module ();
|
||||
/* src/posix.c */
|
||||
struct scm *abort_ ();
|
||||
struct scm *exit_ (struct scm *x);
|
||||
|
|
|
@ -86,7 +86,6 @@ struct scm *cell_symbol_portable_macro_expand;
|
|||
struct scm *cell_symbol_sc_expander_alist;
|
||||
struct scm *cell_symbol_call_with_values;
|
||||
struct scm *cell_symbol_call_with_current_continuation;
|
||||
struct scm *cell_symbol_boot_module;
|
||||
struct scm *cell_symbol_current_module;
|
||||
struct scm *cell_symbol_primitive_load;
|
||||
struct scm *cell_symbol_car;
|
||||
|
@ -137,14 +136,14 @@ struct scm *cell_type_broken_heart;
|
|||
struct scm *cell_symbol_program;
|
||||
struct scm *cell_symbol_test;
|
||||
|
||||
// CONSTANT SYMBOL_MAX 114
|
||||
#define SYMBOL_MAX 114
|
||||
// CONSTANT SYMBOL_MAX 113
|
||||
#define SYMBOL_MAX 113
|
||||
|
||||
// CONSTANT CELL_UNSPECIFIED 7
|
||||
#define CELL_UNSPECIFIED 7
|
||||
|
||||
// CONSTANT CELL_SYMBOL_RECORD_TYPE 82
|
||||
#define CELL_SYMBOL_RECORD_TYPE 82
|
||||
// CONSTANT CELL_SYMBOL_RECORD_TYPE 81
|
||||
#define CELL_SYMBOL_RECORD_TYPE 81
|
||||
|
||||
|
||||
#endif /* __MES_SYMBOLS_H */
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
((lambda (fluid)
|
||||
`(begin
|
||||
(module-define!
|
||||
(boot-module)
|
||||
(initial-module)
|
||||
',fluid
|
||||
((lambda (v)
|
||||
(lambda ( . rest)
|
||||
|
|
|
@ -212,6 +212,7 @@ mes_builtins (struct scm *a) /*:((internal)) */
|
|||
a = init_builtin (builtin_type, "ash", 2, &ash, a);
|
||||
/* src/module.c */
|
||||
a = init_builtin (builtin_type, "module-define!", 3, &module_define_x, a);
|
||||
a = init_builtin (builtin_type, "initial-module", 0, &initial_module, a);
|
||||
/* src/posix.c */
|
||||
a = init_builtin (builtin_type, "abort", 0, &abort_, a);
|
||||
a = init_builtin (builtin_type, "exit", 1, &exit_, a);
|
||||
|
|
|
@ -260,7 +260,6 @@ expand_variable_ (struct scm *x, struct scm *formals, int top_p) /*:((int
|
|||
else if (a == cell_symbol_quote)
|
||||
return cell_unspecified;
|
||||
else if (a->type == TSYMBOL
|
||||
&& a != cell_symbol_boot_module
|
||||
&& a != cell_symbol_current_module
|
||||
&& a != cell_symbol_primitive_load
|
||||
&& formal_p (x->car, formals) == 0)
|
||||
|
@ -508,11 +507,6 @@ apply:
|
|||
R1 = R0;
|
||||
goto vm_return;
|
||||
}
|
||||
if (c == cell_symbol_boot_module)
|
||||
{
|
||||
R1 = M0;
|
||||
goto vm_return;
|
||||
}
|
||||
}
|
||||
else if (t == TPAIR)
|
||||
{
|
||||
|
@ -682,8 +676,6 @@ eval:
|
|||
}
|
||||
else if (t == TSYMBOL)
|
||||
{
|
||||
if (R1 == cell_symbol_boot_module)
|
||||
goto vm_return;
|
||||
if (R1 == cell_symbol_current_module)
|
||||
goto vm_return;
|
||||
if (R1 == cell_symbol_begin)
|
||||
|
|
1
src/gc.c
1
src/gc.c
|
@ -731,6 +731,7 @@ gc_dump_state ()
|
|||
gc_dump_register ("R1", R1);
|
||||
gc_dump_register ("R2", R2);
|
||||
gc_dump_register ("R3", R3);
|
||||
gc_dump_register ("M0", M0);
|
||||
gc_dump_register ("g_symbols", g_symbols);
|
||||
gc_dump_register ("g_symbol_max", g_symbol_max);
|
||||
gc_dump_register ("g_macros", g_macros);
|
||||
|
|
|
@ -33,6 +33,12 @@ make_initial_module (struct scm *a) /*:((internal)) */
|
|||
return module;
|
||||
}
|
||||
|
||||
struct scm *
|
||||
initial_module ()
|
||||
{
|
||||
return M0;
|
||||
}
|
||||
|
||||
struct scm *
|
||||
module_define_x (struct scm *module, struct scm *name, struct scm *value)
|
||||
{
|
||||
|
|
|
@ -122,7 +122,6 @@ init_symbols_ () /*:((internal)) */
|
|||
cell_symbol_sc_expander_alist = init_symbol (g_symbol, TSYMBOL, "*sc-expander-alist*");
|
||||
cell_symbol_call_with_values = init_symbol (g_symbol, TSYMBOL, "call-with-values");
|
||||
cell_symbol_call_with_current_continuation = init_symbol (g_symbol, TSYMBOL, "call-with-current-continuation");
|
||||
cell_symbol_boot_module = init_symbol (g_symbol, TSYMBOL, "boot-module");
|
||||
cell_symbol_current_module = init_symbol (g_symbol, TSYMBOL, "current-module");
|
||||
cell_symbol_primitive_load = init_symbol (g_symbol, TSYMBOL, "primitive-load");
|
||||
cell_symbol_car = init_symbol (g_symbol, TSYMBOL, "car");
|
||||
|
@ -192,7 +191,6 @@ init_symbols () /*:((internal)) */
|
|||
|
||||
struct scm *a = cell_nil;
|
||||
a = acons (cell_symbol_call_with_values, cell_symbol_call_with_values, a);
|
||||
a = acons (cell_symbol_boot_module, cell_symbol_boot_module, a);
|
||||
a = acons (cell_symbol_current_module, cell_symbol_current_module, a);
|
||||
|
||||
a = acons (cell_symbol_mes_version, make_string0 (MES_VERSION), a);
|
||||
|
|
|
@ -69,7 +69,7 @@ exec ${MES-mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests macr
|
|||
'begin
|
||||
(list
|
||||
'module-define!
|
||||
(list 'boot-module)
|
||||
(list 'initial-module)
|
||||
(list 'quote fluid)
|
||||
(list
|
||||
(lambda (v)
|
||||
|
|
Loading…
Reference in New Issue