From 65b90873da8327531374291fa7a783f8d3de42ca Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Wed, 30 Dec 2020 18:40:19 +0100 Subject: [PATCH] primitive-load:fubar --- mes/module/mes/boot-00.scm | 2 ++ mes/module/mes/boot-01.scm | 2 ++ mes/module/mes/boot-02.scm | 2 ++ mes/module/mes/boot-03.scm | 2 ++ scaffold/boot/50-string-join.scm | 1 + src/eval-apply.c | 16 ++++++++++++++-- tests/base.test | 2 +- tests/boot.test | 2 +- tests/srfi-9.test | 10 +--------- 9 files changed, 26 insertions(+), 13 deletions(-) diff --git a/mes/module/mes/boot-00.scm b/mes/module/mes/boot-00.scm index cf080ffa..e98ea6e0 100644 --- a/mes/module/mes/boot-00.scm +++ b/mes/module/mes/boot-00.scm @@ -30,3 +30,5 @@ (define-macro (cond-expand . clauses) (cons 'begin (cond-expand-expander clauses))) ;; end boot-00.scm + +(primitive-load 0) diff --git a/mes/module/mes/boot-01.scm b/mes/module/mes/boot-01.scm index 00a739d6..8e0a9406 100644 --- a/mes/module/mes/boot-01.scm +++ b/mes/module/mes/boot-01.scm @@ -66,3 +66,5 @@ (if (null? (cdr rest)) (car rest) (append2 (car rest) (apply append (cdr rest)))))) ;; end boot-01.scm + +(primitive-load 0) diff --git a/mes/module/mes/boot-02.scm b/mes/module/mes/boot-02.scm index 40e10ab1..dbc5f731 100644 --- a/mes/module/mes/boot-02.scm +++ b/mes/module/mes/boot-02.scm @@ -101,3 +101,5 @@ #t) ;; end boot-02.scm + +(primitive-load 0) diff --git a/mes/module/mes/boot-03.scm b/mes/module/mes/boot-03.scm index a7fde082..ca1887c3 100644 --- a/mes/module/mes/boot-03.scm +++ b/mes/module/mes/boot-03.scm @@ -166,3 +166,5 @@ (mes-use-module (mes let)) (mes-use-module (mes scm)) ;; end boot-03.scm + +(primitive-load 0) diff --git a/scaffold/boot/50-string-join.scm b/scaffold/boot/50-string-join.scm index a7398fca..01fe5100 100644 --- a/scaffold/boot/50-string-join.scm +++ b/scaffold/boot/50-string-join.scm @@ -45,6 +45,7 @@ (if (null? (cdr lst)) (car lst) (string-append (car lst) infix (string-join (cdr lst) infix)))) +(core:display "string-join\n") (if (string=? (string-join '("foo" "bar") "/") "foo/bar") (exit 0)) (exit 1) diff --git a/src/eval-apply.c b/src/eval-apply.c index f3404ebb..11cc32a7 100644 --- a/src/eval-apply.c +++ b/src/eval-apply.c @@ -864,8 +864,15 @@ begin_expand: push_cc (R1->car->cdr->car, R1, R0, cell_vm_begin_expand_primitive_load); goto eval; begin_expand_primitive_load: - if ((R1->type == TNUMBER) && R1->value == 0) + if ((R1->type == TNUMBER) && R1->value == 33) 0; + else if ((R1->type == TNUMBER) && R1->value == 0) + { + 0; /* orig */ + R1 = read_input_file_env (R0); + goto begin_expand_while; + continue; /* FIXME: M2-PLanet */ + } else if (R1->type == TSTRING) input = set_current_input_port (open_input_file (R1)); else if (R1->type == TPORT) @@ -877,10 +884,15 @@ begin_expand: assert_msg (0, "begin-expand-boom 0"); } - push_cc (input, R2, R0, cell_vm_primitive_load_return); + if ((R1->type == TNUMBER) && R1->value == 0) + push_cc (input, R2, R0, cell_vm_return); + else + push_cc (input, R2, R0, cell_vm_primitive_load_return); x = read_input_file_env (R0); if (g_debug > 5) hash_table_printer (R0); + if ((R1->type == TNUMBER) && R1->value == 0) + gc_pop_frame (); input = R1; R1 = x; set_current_input_port (input); diff --git a/tests/base.test b/tests/base.test index 37a459ec..00e9f178 100755 --- a/tests/base.test +++ b/tests/base.test @@ -1,7 +1,7 @@ #! /bin/sh # -*-scheme-*- if [ "$MES" != guile ]; then - MES_BOOT=boot-03.scm exec ${MES-mes} < $0 + MES_BOOT=boot-02.scm exec ${MES-bin/mes} < $0 fi exec ${MES-mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests boot)' -s "$0" "$@" !# diff --git a/tests/boot.test b/tests/boot.test index 97a0ee18..97f22066 100755 --- a/tests/boot.test +++ b/tests/boot.test @@ -1,7 +1,7 @@ #! /bin/sh # -*-scheme-*- if [ "$MES" != guile ]; then - MES_BOOT=boot-02.scm exec ${MES-mes} < $0 + MES_BOOT=boot-02.scm exec ${MES-bin/mes} < $0 fi exec ${MES-mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests boot)' -s "$0" "$@" !# diff --git a/tests/srfi-9.test b/tests/srfi-9.test index 89d090bc..1a840c2e 100755 --- a/tests/srfi-9.test +++ b/tests/srfi-9.test @@ -38,15 +38,7 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests ;; bootstrap test (primitive-load "module/mes/test.scm") (primitive-load "mes/module/srfi/srfi-9-struct.mes") - (primitive-load "mes/module/srfi/srfi-9/gnu-struct.mes") - (define-macro (mes-use-module . rest) #t) - - ;; (primitive-load "mes/module/srfi/srfi-9-vector.mes") - ;; (primitive-load "mes/module/srfi/srfi-9/gnu-vector.mes") - - (mes-use-module (srfi srfi-9)) - (mes-use-module (srfi srfi-9 gnu)) - (mes-use-module (mes test))) + (primitive-load "mes/module/srfi/srfi-9/gnu-struct.mes")) (else)) (pass-if "first dummy" #t)