From 9e684b9886f82079ef1e8137b8f60db60b8b66b2 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sun, 16 Aug 2020 17:36:55 +0200 Subject: [PATCH] boot: Add gc test. * scaffold/boot/gc.test: New file. * build-aux/check-boot.sh (TESTS): Add it. * include/mes/symbols.h (cell_symbol_program): New symbol. * src/symbol.c (init_symbols_): Initialize it. * src/mes.c (main): Add it to environment. --- build-aux/check-boot.sh | 1 + include/mes/symbols.h | 5 +++-- scaffold/boot/gc.scm | 30 ++++++++++++++++++++++++++++++ src/mes.c | 1 + src/symbol.c | 1 + 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 scaffold/boot/gc.scm diff --git a/build-aux/check-boot.sh b/build-aux/check-boot.sh index 1f1686a5..d81a450f 100755 --- a/build-aux/check-boot.sh +++ b/build-aux/check-boot.sh @@ -110,6 +110,7 @@ scaffold/boot/50-primitive-load.scm scaffold/boot/53-closure-display.scm scaffold/boot/60-let-syntax.scm scaffold/boot/call-cc.scm +scaffold/boot/gc.scm scaffold/boot/memory.scm scaffold/boot/numbers.scm " diff --git a/include/mes/symbols.h b/include/mes/symbols.h index 4df57801..89e61860 100644 --- a/include/mes/symbols.h +++ b/include/mes/symbols.h @@ -138,10 +138,11 @@ SCM cell_type_values; SCM cell_type_variable; SCM cell_type_vector; SCM cell_type_broken_heart; +SCM cell_symbol_program; SCM cell_symbol_test; -// CONSTANT SYMBOL_MAX 119 -#define SYMBOL_MAX 119 +// CONSTANT SYMBOL_MAX 120 +#define SYMBOL_MAX 120 // CONSTANT CELL_UNSPECIFIED 7 #define CELL_UNSPECIFIED 7 diff --git a/scaffold/boot/gc.scm b/scaffold/boot/gc.scm new file mode 100644 index 00000000..24389ea5 --- /dev/null +++ b/scaffold/boot/gc.scm @@ -0,0 +1,30 @@ +;;; GNU Mes --- Maxwell Equations of Software +;;; Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen +;;; +;;; 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 . + +(core:display "program:") +(core:write %program) +(core:display "\n") +(gc) +(core:display "1 program:") +(core:write %program) +(core:display "\n") +(gc) +(core:display "2 program:") +(core:write %program) +(core:display "\n") +(gc) diff --git a/src/mes.c b/src/mes.c index cabcedd8..90831590 100644 --- a/src/mes.c +++ b/src/mes.c @@ -196,6 +196,7 @@ main (int argc, char **argv, char **envp) module_printer (M0); SCM program = read_boot (); + R0 = acons (cell_symbol_program, program, R0); push_cc (R2, cell_unspecified, R0, cell_unspecified); if (g_debug > 2) diff --git a/src/symbol.c b/src/symbol.c index 5ac98546..60fcacc7 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -178,6 +178,7 @@ init_symbols_ () /*:((internal)) */ cell_type_variable = init_symbol (g_symbol, TSYMBOL, ""); cell_type_vector = init_symbol (g_symbol, TSYMBOL, ""); cell_type_broken_heart = init_symbol (g_symbol, TSYMBOL, ""); + cell_symbol_program = init_symbol (g_symbol, TSYMBOL, "%program"); cell_symbol_test = init_symbol (g_symbol, TSYMBOL, "%%test"); }