From b0275be36829bdc09623022b5dd168d39c1d1090 Mon Sep 17 00:00:00 2001 From: alex-eg Date: Fri, 9 Oct 2026 17:47:25 +0300 Subject: [PATCH] print the public interface in declaration order read-public-interface has returned the forms in order since 2512d52, and --public-interface still reversed them as it had to before. --- sexc.scm | 3 +-- tests/modules/Makefile | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sexc.scm b/sexc.scm index fb51749..793f223 100644 --- a/sexc.scm +++ b/sexc.scm @@ -269,8 +269,7 @@ status, which is ours to pass on." (write-to-file-or-stdout output (fn - (map pp (reverse - (read-public-interface input))))) + (map pp (read-public-interface input)))) (return #f)) ;; The file name in a #line directive now comes from the form's diff --git a/tests/modules/Makefile b/tests/modules/Makefile index 659563e..1bd6210 100644 --- a/tests/modules/Makefile +++ b/tests/modules/Makefile @@ -21,6 +21,9 @@ # app cannot see -- private to greet, or from a module greet imports # without `pub' -- crosses behind a pointer, declared and no more. # +# The interface prints as importers get it: the declarations first, then +# the pub forms in the order they were written. +# # The app's dependency rule names both modules: greet, which it imports, # and ledger, which only greet does but which decides what the app is # told of it. @@ -30,6 +33,9 @@ SEXC ?= ../../sexc EXPECTED = hello, world\nhello, sex\n2 greetings\ntext times \ntext times \nmood 1\nclosure 15 21 201\nvec2 7 7\nvec2(3 4)\ntally 2\nboard 42\nledger 2\ncolour 123 check: + @if [ "`$(SEXC) --public-interface greet.sex | head -3`" != "`printf '(record cell)\n(record ledger)\n(include stdio.h)'`" ]; then \ + echo "modules FAILED, the interface begins:"; $(SEXC) --public-interface greet.sex | head -3; exit 1; \ + fi @$(SEXC) ledger.sex -c -o ledger.o @$(SEXC) greet.sex -c -o greet.o @$(SEXC) greet-app.sex -o greet-app --depfile=greet-app.d -- greet.o ledger.o