diff -Nru scheme9-2013.01.09/CHANGES scheme9-2013.11.26/CHANGES --- scheme9-2013.01.09/CHANGES 2013-01-09 18:23:22.000000000 +0000 +++ scheme9-2013.11.26/CHANGES 2013-11-26 11:03:47.000000000 +0000 @@ -1,6 +1,25 @@ Change Log +2013-11-26 + Added ARGV primitive to core system. See below. (s9.c) +2013-11-24 + Added ENVIRON and SYSTEM primitives to the core interpreter. (s9.c) + Mostly to use minimal S9 in web programming. +2013-04-10 + Added a workaround for plan9's atol() function, which + interprets leading '0' as octal. Thanks, Bakul Shah! (s9.c) +2013-02-09 + Fix: FORMAT-TIME emitted wrong month name with ~@m. Thanks, + Doug Currie! (ext/) +2013-01-22 + Fix: S9E would abort when exiting from the [^L][e] prompt using + backspace. (contrib/) +2013-01-17 + Added COLLECT procedure. (lib/) +2013-01-14 + Fix: SYNTAX-RULES could abort while matching an ellipsis against + an atom. (lib/) 2013-01-09 S9E: Fixed highlighting of marked regions in side-scrolled lines. (contrib/) diff -Nru scheme9-2013.01.09/LICENSE scheme9-2013.11.26/LICENSE --- scheme9-2013.01.09/LICENSE 2012-11-24 12:24:58.000000000 +0000 +++ scheme9-2013.11.26/LICENSE 2013-01-14 13:06:26.000000000 +0000 @@ -1,7 +1,7 @@ Scheme 9 from Empty Space A Portable Scheme Interpreter with a Unix Interface -By Nils M Holm, 2007-2012 +By Nils M Holm, 2007-2013 This code is free. FREE! What's so hard to understand about this? It is in public domain. Neither mine nor yours. Do whatever you diff -Nru scheme9-2013.01.09/Makefile scheme9-2013.11.26/Makefile --- scheme9-2013.01.09/Makefile 2013-01-10 08:20:48.000000000 +0000 +++ scheme9-2013.11.26/Makefile 2013-11-27 15:53:27.000000000 +0000 @@ -10,8 +10,10 @@ CC= gcc CFLAGS= -g -Wall -ansi -pedantic -O2 -# Uncomment the following, if you get "wrong interpreter" errors on OSX +# You may try one of the following, if you get "wrong interpreter" errors #LDFLAGS+= -Wl,-no_pie +#LDFLAGS+= -no_pie +#LDFLAGS+= -fno_pie # Which OS are we using (unix or plan9)? OSDEF= -Dunix diff -Nru scheme9-2013.01.09/Makefile.ORIG scheme9-2013.11.26/Makefile.ORIG --- scheme9-2013.01.09/Makefile.ORIG 2012-12-06 09:10:39.000000000 +0000 +++ scheme9-2013.11.26/Makefile.ORIG 2013-11-27 11:58:20.000000000 +0000 @@ -10,8 +10,10 @@ CC= gcc CFLAGS= -g -Wall -ansi -pedantic -O2 -# Uncomment the following, if you get "wrong interpreter" errors on OSX +# You may try one of the following, if you get "wrong interpreter" errors #LDFLAGS+= -Wl,-no_pie +#LDFLAGS+= -no_pie +#LDFLAGS+= -fno_pie # Which OS are we using (unix or plan9)? OSDEF= -Dunix diff -Nru scheme9-2013.01.09/README scheme9-2013.11.26/README --- scheme9-2013.01.09/README 2013-01-03 08:47:54.000000000 +0000 +++ scheme9-2013.11.26/README 2013-11-27 12:04:20.000000000 +0000 @@ -7,9 +7,9 @@ S9fES is a mature, portable, and comprehensible public-domain interpreter for R4RS Scheme offering + - decimal-based real number arithmetics; - support for low-level Unix programming; - cursor addressing with Curses; - - decimal-based real number arithmetics; - basic networking procedures; - loads of useful library functions; - an experimental Scheme-centric full-screen editor. @@ -37,6 +37,19 @@ - VECTOR-COPY and VECTOR-APPEND from SRFI-43 + ***** NOTE ***************************************************** + + If you are planning to use image files (which the S9 default + setup does!), you will have to disable both address space layout + randomization (ASLR) and position-independent code (PIE) for the + S9 executable. This is because the image file contains pointers + to functions in the interpreter executable, and either of the + above techniques will invalidate these pointers, resulting in + fatal "wrong interpreter" errors when the S9 system starts up. + + **************************************************************** + + QUICK START You can run the interpreter in its build directory without @@ -77,11 +90,6 @@ (Be sure to re-compile S9fES (make clean; make) after changing PREFIX, because it is used to set up some internal paths). - OSX - - Basically as on generic Unix, but you may have to enable some - extra LDFLAGS in the Makefile. - Plan 9 To compile S9fES on Plan 9 from Bell Labs, just type "mk", but diff -Nru scheme9-2013.01.09/Todo scheme9-2013.11.26/Todo --- scheme9-2013.01.09/Todo 2013-01-10 08:19:06.000000000 +0000 +++ scheme9-2013.11.26/Todo 2013-01-18 16:56:31.000000000 +0000 @@ -1,5 +1,6 @@ - - S9E: [^L][!] (shell) command. + - S9E: + - [^L][!] (shell) command. - macro tests diff -Nru scheme9-2013.01.09/_checksums scheme9-2013.11.26/_checksums --- scheme9-2013.01.09/_checksums 2013-01-10 08:19:44.000000000 +0000 +++ scheme9-2013.11.26/_checksums 2013-11-27 15:53:20.000000000 +0000 @@ -1,8 +1,8 @@ -2C135A51919F9A91 008B 0062 ./CHANGES -D9417D3BD625973C 0003 0057 ./LICENSE -CC9EB1F33CA5910C 0012 0037 ./Makefile -00A5BCCE6FC615FC 0010 0075 ./README -C4AA71D05B90CB23 0001 00CB ./Todo +38519FE9C4297EE3 008C 00EC ./CHANGES +D9417E3BD625973C 0003 0057 ./LICENSE +63B487D4B08FED34 0012 0060 ./Makefile +CC422B628E52D837 0011 0058 ./README +4AA71D05B908EEFC 0001 00CF ./Todo 3D13B5B1A44697F4 004C 0144 ./contrib/format.scm 8AA8DAD6D888BEE4 0015 01E5 ./contrib/format.txt 5C5C9843E47C67EA 0013 0000 ./contrib/format-test.scm @@ -22,7 +22,7 @@ 6BE6C7DFB6D14040 0011 0055 ./contrib/S9Book CD26C7DFB6D58530 0011 0055 ./contrib/S9Book-bw F2EB9D931E12289B 0023 00E0 ./contrib/s9e.help -B492E6969CC6971B 00A7 0099 ./contrib/s9e.scm +71A715045D564A6A 00A7 0118 ./contrib/s9e.scm 83396F4181A5F5AB 0003 0083 ./contrib/queens.scm 1BCB4C7F63C387AD 0001 0156 ./contrib/s9e-config 9F23CAB09872C33C 003B 019D ./ext/unix.c @@ -34,7 +34,7 @@ 001C83C0F97DD612 0005 003D ./ext/unix-time-to-time.scm FC47E26A5DD297D6 0004 0097 ./ext/time-to-unix-time.scm 7D16654AC1A21B95 0003 0168 ./ext/dirname.scm -B0E6E7231DD000CE 000A 0079 ./ext/format-time.scm +1446A61E676DDC6B 000A 00A6 ./ext/format-time.scm 76A0F8AE20E4E0F2 0002 011D ./ext/append-to-output-file.scm 6EFEC094EAFDF1A6 0013 00B7 ./ext/parse-optionsb.scm 4AAC9925C11CC582 0002 01EC ./ext/search-path.scm @@ -103,7 +103,7 @@ 4881F4166E56561D 0002 00C5 ./lib/string-unsplit.scm 3AA339944668D664 0002 011F ./lib/sieve.scm 3668C2F89C7E0BE6 0002 0155 ./lib/displaystar.scm -A79CBFE316F0325E 0002 01EC ./lib/list-tools.scm +A4FB74BB5F8127BD 0003 000E ./lib/list-tools.scm 99927DA8039D4E00 0002 0085 ./lib/syntax-extensions.scm 9B6A1D528AEF1325 0002 001A ./lib/math-tools.scm 87217C4B50B52E10 0002 002D ./lib/set-tools.scm @@ -116,7 +116,7 @@ 2FE3B73F32006978 0004 0111 ./lib/string-find-last.scm 4D3E4114BE66FA93 0006 0117 ./lib/name-to-file-name.scm E7FA470A5C642025 0005 00E0 ./lib/and-letstar.scm -191FB13DD77E11E3 0010 01DB ./lib/syntax-rules.scm +A434AF23C132273A 0011 0028 ./lib/syntax-rules.scm E2B518332B57CB01 0005 01BD ./lib/string-position.scm 49B299EEB9014474 0006 004C ./lib/string-last-position.scm 8B94F0939E838778 0008 0145 ./lib/split-url.scm @@ -160,7 +160,7 @@ D627A21D04DB670B 0002 01E5 ./lib/when.scm C8936007B7CF54E7 0003 0104 ./lib/while.scm 4EADB24DDCF158A3 000E 00CF ./lib/hash-table.scm -54F2EE08C6BC5C52 0001 00F7 ./lib/_template +54F2EE08C6BC5C62 0001 00F7 ./lib/_template 69963A1EC80E59EC 0002 01F4 ./lib/tree-map.scm A4A24646B27FD6D7 000D 0059 ./lib/char-canvas.scm 92F137470D6C80D6 0002 002D ./lib/listq.scm @@ -181,35 +181,36 @@ CC38B0B085124128 0002 00D7 ./lib/take.scm ABC8E61499CC5122 0002 008D ./lib/choose.scm BED403AA053F23CC 0008 004F ./lib/char-plot.scm -7993C3AF6D81926B 00E0 00F8 ./s9.c +E8239ACC6FF06797 0003 0003 ./lib/collect.scm +77401F10FF8489E0 00E2 0065 ./s9.c 268BBEB769AA932C 0001 00A1 ./mkfile -29DDC833239D900A 001F 000C ./s9.1 +E5C3AFB333C67FCE 001F 01EC ./s9.1 E1732E033D0A3AA7 0022 0001 ./s9-real.c FCB7B80F5228950B 001A 0066 ./s9.h 4F3144D68686E09A 000C 008C ./util/rpp.c 46E388DA334DE03F 0001 00BA ./util/rp_html 49DAF738AC72AD07 007D 015B ./util/test.scm -1E2CB1C2B694E328 0038 0195 ./util/libtest.scm +681BB2A956E28007 0039 0035 ./util/libtest.scm 4D1E4254E01E02DF 0003 01D4 ./util/libtest.sh 2100DB65718ACD92 0001 0145 ./util/dirhead -5FD2504569857CCE 0013 0104 ./util/descriptions +04000A194E995E94 0013 013E ./util/descriptions 8469A9689C73E578 0001 0045 ./util/dirtail 374FAFB4A32B0D73 0007 00FB ./util/srtest.scm -CFF0687DC4BECE23 0011 0082 ./util/make-html +F25D9DBA0BAEDD56 0011 008C ./util/make-html 25E39FFACEA37D58 0004 00A6 ./util/s9.css 9075AF153CA942A7 0004 00AA ./util/make-docs 8C9D2B5BF9A28792 0001 0146 ./util/libhead 8469A9689C73E578 0001 0045 ./util/libtail 37F03EEF92CF7BDB 0018 00BB ./util/make-help-links 66768FFC85FC5CDE 0008 0136 ./util/stress-tests.tgz -D20FCA743FBF2649 0021 01E3 ./util/systest.scm +838FB5B0D92AF447 0022 01C1 ./util/systest.scm 010F2AB76061134F 0003 00E5 ./util/check-descr.scm -7904A2B29C6125E6 000F 007B ./util/categories.html +9D467ADBF439C3DB 000F 0091 ./util/categories.html 921E23C8B0BB59F3 0005 0137 ./util/make-cats.scm 2ED0434E34498AB3 005B 00E5 ./util/realtest.scm 05E9A9689C73DBA4 0001 0035 ./util/pagetail 840D61984B29A271 0001 0088 ./util/pagehead -DDB770A35B4A9D33 0023 0164 ./s9.1.txt +627B4D96BC9A4C5D 0025 001C ./s9.1.txt DEC4353681FA1518 0002 008E ./config.scm 1BB33C11D940F9F3 0004 00E4 ./prog/c2html1.scm EFF07203A73202D4 0012 001C ./prog/s9resolve.scm @@ -389,7 +390,7 @@ 523B1244EA20929B 0001 0124 ./help/read-line EF41CA6D8191865B 0002 0069 ./help/remove 9D81B54122E38363 0001 00D9 ./help/replace -B921684CFEF01D68 0002 001B ./help/runstar +4692AC1B02C878D6 0002 006D ./help/runstar 8E5488E9AD91C6BE 0001 00EE ./help/mode-to-string 9E99EF2D701CBBF3 0003 0034 ./help/string-find B37AD5C68D27CF06 0001 0167 ./help/string-split @@ -409,7 +410,7 @@ FA16D1F3B8DB2C7E 0001 00E9 ./help/sys_errno 49E17F8CF5FBEACF 0001 0079 ./help/sqrt 2F30936CC619F3B3 0001 0136 ./help/string-parse -D350E1D141374F06 0002 01C3 ./help/format-time +D2C0E1D141374F06 0002 01C3 ./help/format-time 49F259B5E49143BC 0001 0135 ./help/sys_execv E62237738116D451 0001 0122 ./help/sys_exit 06A72210662C30D5 0001 00CA ./help/unsort @@ -464,7 +465,7 @@ 2F7FD4580DE5F80E 0001 015C ./help/sys_setuid 85506A0DCF96929E 0003 017B ./help/sys_stat 21AA7BAC84405A40 0001 009D ./help/sys_unlink -1A03C731F5ABA462 0001 0152 ./help/s9e +1A0EF36F442BA462 0001 016D ./help/s9e 0B704D4FA8083C42 0001 01A2 ./help/append-to-output-file F26199D4586AF6EE 0008 011F ./help/parse-optionsb 56ED9D297DDE5CFA 0002 0186 ./help/spawn-command @@ -586,9 +587,14 @@ EE5ACA15C955F75A 0001 0151 ./help/vector-append 7C0C57673223CDF8 0001 00DC ./help/nase FEC0CFEFFA31F712 0002 01FD ./help/vector-copy +1AF760A893CE5833 0001 009E ./help/system +3637646FA0493CB7 0001 00D7 ./help/environ +2EC1027750EC3C80 0001 0180 ./help/queens +BF32658E140676F2 0001 018F ./help/collect +A60DB03982A42D1B 0001 00EF ./help/argv 1638010AD47E5B59 0044 011B ./edoc/s9-real.c.edoc 10BB9A2482038008 0031 0074 ./edoc/s9-real.scm.edoc -A188F6F8970DD980 01E9 0186 ./edoc/s9.c.edoc +51AC63F2097759B7 01EC 016F ./edoc/s9.c.edoc ABED8A976B6661E0 004F 005B ./edoc/s9.h.edoc 26E6CB5E1931140C 0057 0101 ./edoc/s9.scm.edoc 4FE22583BA6C82C9 0007 01DF ./edoc/Makefile @@ -607,7 +613,7 @@ DEFA195FD5C35167 0009 00AA ./edoc/toc.edoc F24268E9CF15D003 0008 0118 ./edoc/cover.lt 904214C27CAD2524 0002 010D ./edoc/f06.tr -B5602DC53673BBA6 0024 00FB ./edoc/syntax-rules.scm.edoc +7CC2C12EFC553AB1 0024 0148 ./edoc/syntax-rules.scm.edoc FC256250C3DDB53F 0009 0012 ./edoc/preface.edoc 766412F174D5F224 0002 0139 ./edoc/f05.tr E07AB7B7DB496EB4 0001 00C1 ./edoc/pngwrite diff -Nru scheme9-2013.01.09/contrib/s9e.scm scheme9-2013.11.26/contrib/s9e.scm --- scheme9-2013.01.09/contrib/s9e.scm 2013-01-09 10:08:57.000000000 +0000 +++ scheme9-2013.11.26/contrib/s9e.scm 2013-01-22 19:19:50.000000000 +0000 @@ -1378,6 +1378,7 @@ (define (auto-complete buf) (if-writable buf + (drop-mark buf) (let ((line (buf-cur-line buf))) (if (or (zero? (buffer-x buf)) (char=? #\space (string-ref line (- (buffer-x buf) 1)))) @@ -1535,7 +1536,10 @@ (yesno buf))) (color-info) (let* ((file (get-line (statline-pos) 0 "" "edit: ")) - (file (if (string=? "" file) "." file))) + (file (if (and file + (string=? "" file)) + "." + file))) (cond ((not file)) ((directory? file) (let ((file (select-file buf file))) diff -Nru scheme9-2013.01.09/debian/changelog scheme9-2013.11.26/debian/changelog --- scheme9-2013.01.09/debian/changelog 2013-01-15 09:06:52.000000000 +0000 +++ scheme9-2013.11.26/debian/changelog 2014-01-17 10:27:21.000000000 +0000 @@ -1,3 +1,16 @@ +scheme9 (2013.11.26-1) unstable; urgency=medium + + * New Upstream Version + * debian/control: + - Bump standards version (no changes required) + - Update debian repo urls + * Update quilt patches + - forward-port patches (tiny change to comment in context of diff) + - gbp-pq import/export + - add patch for fread status + + -- Barak A. Pearlmutter Fri, 17 Jan 2014 10:26:40 +0000 + scheme9 (2013.01.09-2) unstable; urgency=low * Add s9 prefix to names of generically named binaries: diff -Nru scheme9-2013.01.09/debian/control scheme9-2013.11.26/debian/control --- scheme9-2013.01.09/debian/control 2012-09-27 11:18:13.000000000 +0000 +++ scheme9-2013.11.26/debian/control 2014-01-17 10:27:21.000000000 +0000 @@ -5,10 +5,10 @@ Build-Depends: debhelper (>= 9), libncurses5-dev | libncurses-dev | ncurses-dev, libx11-dev -Standards-Version: 3.9.3 +Standards-Version: 3.9.5 Homepage: http://t3x.org/ -Vcs-Git: git://git.debian.org/git/collab-maint/scheme9.git -Vcs-Browser: http://git.debian.org/?p=collab-maint/scheme9.git +Vcs-Git: git://anonscm.debian.org/collab-maint/scheme9.git +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/scheme9.git Package: scheme9 Architecture: any diff -Nru scheme9-2013.01.09/debian/patches/0001-recombobulate-Makefile.patch scheme9-2013.11.26/debian/patches/0001-recombobulate-Makefile.patch --- scheme9-2013.01.09/debian/patches/0001-recombobulate-Makefile.patch 2013-01-14 15:10:03.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/0001-recombobulate-Makefile.patch 2014-01-17 10:27:21.000000000 +0000 @@ -3,11 +3,11 @@ Subject: recombobulate Makefile --- - Makefile | 29 +++++++++++++++++++++-------- + Makefile | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile -index d22075d..f5add4d 100644 +index 698929c..18a4a94 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ @@ -19,7 +19,7 @@ # Override default compiler and flags CC= gcc -@@ -53,14 +53,21 @@ DEFS= $(OSDEF) \ +@@ -55,14 +55,21 @@ DEFS= $(OSDEF) \ -DCURSES_RESET # Where to install the stuff @@ -45,7 +45,7 @@ lib/matcher.scm all: default s9e -@@ -77,8 +84,14 @@ s9.o: s9.c s9-real.c s9.h +@@ -79,8 +86,14 @@ s9.o: s9.c s9-real.c s9.h s9.image: s9 s9.scm s9-real.scm ext/unix.scm ext/curses.scm config.scm $(BUILD_ENV) ./s9 -i - -n $(EXTRA_SCM) -l config.scm -d s9.image @@ -62,7 +62,7 @@ unix.o: ext/unix.c s9.h $(CC) $(CFLAGS) $(DEFS) -I . -o unix.o -c ext/unix.c -@@ -127,7 +140,7 @@ install-s9: s9 s9.scm s9.image s9.1.gz +@@ -129,7 +142,7 @@ install-s9: s9 s9.scm s9.image s9.1.gz install -d -m 0755 $(LIBDIR)/help install -d -m 0755 $(MANDIR) install $C -m 0755 s9 $(BINDIR) diff -Nru scheme9-2013.01.09/debian/patches/0002-use-CFLAGS.patch scheme9-2013.11.26/debian/patches/0002-use-CFLAGS.patch --- scheme9-2013.01.09/debian/patches/0002-use-CFLAGS.patch 2013-01-14 15:10:03.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/0002-use-CFLAGS.patch 2014-01-17 10:27:21.000000000 +0000 @@ -5,11 +5,11 @@ Don't specify -O2 and -g (on by default) so they can be overwritten by builder, e.g., dpkg-buildflags. --- - Makefile | 4 ++-- + Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile -index f5add4d..e71e7b5 100644 +index 18a4a94..c225941 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ PREFIX=$(prefix) @@ -19,9 +19,9 @@ -CFLAGS= -g -Wall -ansi -pedantic -O2 +CFLAGS+= -Wall -ansi -pedantic - # Uncomment the following, if you get "wrong interpreter" errors on OSX + # You may try one of the following, if you get "wrong interpreter" errors #LDFLAGS+= -Wl,-no_pie -@@ -75,7 +75,7 @@ all: default s9e +@@ -77,7 +77,7 @@ all: default s9e s9e: s9e-core.image s9: s9.o s9.h $(EXTRA_OBJS) diff -Nru scheme9-2013.01.09/debian/patches/0003-use-CPPFLAGS.patch scheme9-2013.11.26/debian/patches/0003-use-CPPFLAGS.patch --- scheme9-2013.01.09/debian/patches/0003-use-CPPFLAGS.patch 2013-01-14 15:10:03.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/0003-use-CPPFLAGS.patch 2014-01-17 10:27:21.000000000 +0000 @@ -5,14 +5,14 @@ Need CPPFLAGS during compilation to call hardened routines during hardened build. See lintian tag hardening-no-fortify-functions. --- - Makefile | 1 + + Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile -index e71e7b5..7764263 100644 +index c225941..f3c0937 100644 --- a/Makefile +++ b/Makefile -@@ -45,6 +45,7 @@ EXTRA_SCM+= -l s9-real.scm +@@ -47,6 +47,7 @@ EXTRA_SCM+= -l s9-real.scm # # (requires the Curses extension) DEFS= $(OSDEF) \ diff -Nru scheme9-2013.01.09/debian/patches/0004-parallel-install.patch scheme9-2013.11.26/debian/patches/0004-parallel-install.patch --- scheme9-2013.01.09/debian/patches/0004-parallel-install.patch 2013-01-14 15:10:03.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/0004-parallel-install.patch 2014-01-17 10:27:21.000000000 +0000 @@ -6,14 +6,14 @@ installation stanza creates any directories it targets. This might result in multiple creation; that is okay. --- - Makefile | 4 ++++ + Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile -index 7764263..b25cd1d 100644 +index f3c0937..de1f746 100644 --- a/Makefile +++ b/Makefile -@@ -153,6 +153,7 @@ install-s9: s9 s9.scm s9.image s9.1.gz +@@ -155,6 +155,7 @@ install-s9: s9 s9.scm s9.image s9.1.gz (cd $(LIBDIR) && ./make-help-links && rm make-help-links) install-util: @@ -21,7 +21,7 @@ sed -e "s|^#! /usr/local|#! $(PREFIX)|" \ $(BINDIR)/s9help sed -e "s|^#! /usr/local|#! $(PREFIX)|" \ -@@ -167,6 +168,8 @@ install-util: +@@ -169,6 +170,8 @@ install-util: $(BINDIR)/scmpp install-s9e: s9e-core.image @@ -30,7 +30,7 @@ ln -fs $(BINDIR)/s9 $(BINDIR)/s9e-core install $C -m 0644 s9e-core.image $(LIBDIR) sed -e "s|^#! /usr/local|#! $(PREFIX)|" \ -@@ -174,6 +177,7 @@ install-s9e: s9e-core.image +@@ -176,6 +179,7 @@ install-s9e: s9e-core.image -chmod +x $(BINDIR)/s9e install-progs: diff -Nru scheme9-2013.01.09/debian/patches/0005-maxpathlen-for-hurd.patch scheme9-2013.11.26/debian/patches/0005-maxpathlen-for-hurd.patch --- scheme9-2013.01.09/debian/patches/0005-maxpathlen-for-hurd.patch 2013-01-14 15:10:03.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/0005-maxpathlen-for-hurd.patch 2014-01-17 10:27:21.000000000 +0000 @@ -3,7 +3,7 @@ Subject: maxpathlen for hurd --- - s9.h | 5 +++++ + s9.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/s9.h b/s9.h diff -Nru scheme9-2013.01.09/debian/patches/0006-search-path-in-test-script.patch scheme9-2013.11.26/debian/patches/0006-search-path-in-test-script.patch --- scheme9-2013.01.09/debian/patches/0006-search-path-in-test-script.patch 2013-01-14 15:10:03.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/0006-search-path-in-test-script.patch 2014-01-17 10:27:21.000000000 +0000 @@ -3,7 +3,7 @@ Subject: search path in test script --- - util/libtest.sh | 2 ++ + util/libtest.sh | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 util/libtest.sh diff -Nru scheme9-2013.01.09/debian/patches/0007-bin-symlink.patch scheme9-2013.11.26/debian/patches/0007-bin-symlink.patch --- scheme9-2013.01.09/debian/patches/0007-bin-symlink.patch 2013-01-14 15:10:03.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/0007-bin-symlink.patch 2014-01-17 10:27:21.000000000 +0000 @@ -6,14 +6,14 @@ absolute prefix, which is wrong when DESTDIR is turned on, and problematic if the target bin directory is moved. --- - Makefile | 2 +- + Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index b25cd1d..fe63716 100644 +index de1f746..3cb0df0 100644 --- a/Makefile +++ b/Makefile -@@ -170,7 +170,7 @@ install-util: +@@ -172,7 +172,7 @@ install-util: install-s9e: s9e-core.image install -d -m 0755 $(BINDIR) install -d -m 0755 $(LIBDIR) diff -Nru scheme9-2013.01.09/debian/patches/0008-fread-checks.patch scheme9-2013.11.26/debian/patches/0008-fread-checks.patch --- scheme9-2013.01.09/debian/patches/0008-fread-checks.patch 1970-01-01 00:00:00.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/0008-fread-checks.patch 2014-01-17 10:27:21.000000000 +0000 @@ -0,0 +1,49 @@ +From: "Barak A. Pearlmutter" +Date: Fri, 17 Jan 2014 10:18:26 +0000 +Subject: fread checks + +--- + s9.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/s9.c b/s9.c +index d6dba36..ecdd556 100644 +--- a/s9.c ++++ b/s9.c +@@ -4842,7 +4842,9 @@ int load_image(char *p) { + f = fopen(p, "rb"); + if (f == NULL) + return -1; +- fread(&m, sizeof(m), 1, f); ++ if (fread(&m, sizeof(m), 1, f) != 1) { ++ return -1; ++ } + if (memcmp(m.id, "S9", 2)) { + error("error in image file (magic match failed)", name); + ok = 0; +@@ -4870,8 +4872,12 @@ int load_image(char *p) { + ok = 0; + } + memset(Tag, 0, Cons_pool_size); +- fread(&image_nodes, sizeof(int), 1, f); +- fread(&image_vcells, sizeof(int), 1, f); ++ if (fread(&image_nodes, sizeof(int), 1, f) != 1) { ++ return -1; ++ } ++ if (fread(&image_vcells, sizeof(int), 1, f) != 1) { ++ return -1; ++ } + while (image_nodes > Cons_pool_size) { + if ( Memory_limit_kn && + Cons_pool_size + Cons_segment_size > Memory_limit_kn +@@ -4895,7 +4901,9 @@ int load_image(char *p) { + v = Image_vars; + i = 0; + while (v[i]) { +- fread(v[i], sizeof(cell), 1, f); ++ if (fread(v[i], sizeof(cell), 1, f) != 1) { ++ return -1; ++ } + i++; + } + if ( ok && diff -Nru scheme9-2013.01.09/debian/patches/debian-changes scheme9-2013.11.26/debian/patches/debian-changes --- scheme9-2013.01.09/debian/patches/debian-changes 2013-01-15 09:07:08.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/debian-changes 2014-01-17 10:27:41.000000000 +0000 @@ -2,8 +2,8 @@ which quilt does not handle very well. For this reason the patch is kept as a git commit, rather than a quilt patch. --- /dev/null -+++ scheme9-2013.01.09/s9.1.in -@@ -0,0 +1,750 @@ ++++ scheme9-2013.11.26/s9.1.in +@@ -0,0 +1,771 @@ +.\" S9(1) Manual Page +.\" By Nils M Holm, 2007-2012 +.ll 70 @@ -192,6 +192,14 @@ +These S9fES procedures are not in R4RS: +.sp +.ne 3 ++.B "(argv integer) ==> string | #f ++.in +4 ++Retrieve the value of the given command line argument. Return ++\fB#f\fP, if there are less than \fIinteger\fP+1 arguments. ++Arguments start at 0. ++.in -4 ++.sp ++.ne 3 +.B "(bit\-op integer1 integer2 integer3 ...) ==> integer | #f +.in +4 +Implement a variety of bitwise operations. See the @@ -218,6 +226,13 @@ +.in -4 +.sp +.ne 3 ++.B "(environ string) ==> string | #f ++.in +4 ++Retrieve the value of the given environment variable. Return ++\fB#f\fP, if the variable is undefined. ++.in -4 ++.sp ++.ne 3 +.B "(error string) ==> undefined +.br +.B "(error string object) ==> undefined @@ -390,6 +405,12 @@ +.in -4 +.sp +.ne 3 ++.B "(system string) ==> number ++.in +4 ++Run the given shell command and return its exit code. ++.in -4 ++.sp ++.ne 3 +.B "(trace symbol ...) ==> list | #t +.br +.B "(trace #t) ==> list | #t diff -Nru scheme9-2013.01.09/debian/patches/series scheme9-2013.11.26/debian/patches/series --- scheme9-2013.01.09/debian/patches/series 2013-01-15 09:07:08.000000000 +0000 +++ scheme9-2013.11.26/debian/patches/series 2014-01-17 10:27:41.000000000 +0000 @@ -5,4 +5,5 @@ 0005-maxpathlen-for-hurd.patch 0006-search-path-in-test-script.patch 0007-bin-symlink.patch +0008-fread-checks.patch debian-changes diff -Nru scheme9-2013.01.09/ext/format-time.scm scheme9-2013.11.26/ext/format-time.scm --- scheme9-2013.01.09/ext/format-time.scm 2010-12-08 07:02:14.000000000 +0000 +++ scheme9-2013.11.26/ext/format-time.scm 2013-02-09 08:46:12.000000000 +0000 @@ -28,7 +28,7 @@ ; ; Example: (format-time "~w ~4y-~@m-~2d ~2h:~2m:~2s" ; '(1 2009 3 9 8 53 20)) -; ==> "Tue 2009-Apr-09 08:53:20" +; ==> "Tue 2009-Mar-09 08:53:20" (load-from-library "proper-timep.scm") @@ -80,8 +80,9 @@ (number->string (list-ref t 2))) (at - (vector-ref months - (list-ref t 2))) + (vector-ref + months + (- (list-ref t 2) 1))) (else (number->string (list-ref t 5))))) diff -Nru scheme9-2013.01.09/help/argv scheme9-2013.11.26/help/argv --- scheme9-2013.01.09/help/argv 1970-01-01 00:00:00.000000000 +0000 +++ scheme9-2013.11.26/help/argv 2013-11-26 11:01:47.000000000 +0000 @@ -0,0 +1,7 @@ +S9fES (argv integer) ==> string | #f + +Return the value of the command line argument at the given position. +If the there are less than INTEGER+1 arguments, return #F. The first +argument is at position 0. + +(argv 0) ==> "first-argument" diff -Nru scheme9-2013.01.09/help/collect scheme9-2013.11.26/help/collect --- scheme9-2013.01.09/help/collect 1970-01-01 00:00:00.000000000 +0000 +++ scheme9-2013.11.26/help/collect 2013-11-26 11:02:13.000000000 +0000 @@ -0,0 +1,9 @@ +S9 LIB (collect procedure list) ==> list + +Collect elements from LIST as long as two subsequent elements +E1 and E2 satisfy the predicate (PROCEDURE E1 E2). When two +subsequent elements do not satisfy the predicate, start a new +output list. Concatenate all output lists in the result. + +(collect eq? '(a a a b c c)) ==> ((a a a) (b) (c c)) +(collect < '(1 2 3 3 4 5 4)) ==> ((1 2 3) (3 4 5) (4)) diff -Nru scheme9-2013.01.09/help/environ scheme9-2013.11.26/help/environ --- scheme9-2013.01.09/help/environ 1970-01-01 00:00:00.000000000 +0000 +++ scheme9-2013.11.26/help/environ 2013-11-24 16:57:16.000000000 +0000 @@ -0,0 +1,7 @@ +S9fES (environ string) ==> string | #f + +Return the value of the environment variable STRING. If +the variable is undefined, return #F. + +(environ "HOME") ==> "/u/home/nmh" +(environ "nonexistent") ==> #f diff -Nru scheme9-2013.01.09/help/format-time scheme9-2013.11.26/help/format-time --- scheme9-2013.01.09/help/format-time 2012-11-27 15:32:07.000000000 +0000 +++ scheme9-2013.11.26/help/format-time 2013-11-26 11:02:22.000000000 +0000 @@ -24,4 +24,4 @@ (format-time "~w ~4y-~@m-~2d ~2h:~2m:~2s" '(1 2009 3 9 8 53 20)) - ==> "Tue 2009-Apr-09 08:53:20" + ==> "Tue 2009-Mar-09 08:53:20" diff -Nru scheme9-2013.01.09/help/queens scheme9-2013.11.26/help/queens --- scheme9-2013.01.09/help/queens 1970-01-01 00:00:00.000000000 +0000 +++ scheme9-2013.11.26/help/queens 2013-11-26 11:02:21.000000000 +0000 @@ -0,0 +1,15 @@ +S9 LIB (queens n) ==> list + +Solve the N-Queens puzzle using AMK. All solutions for the +given board size will be returned, where the offset in each +list is an X position on the board and the value at that +offset is the corresponding Y position. E.g., the board +(2 0 3 1) would look like this: + +. . & . 3 +& . . . 2 +. . . & 1 +. & . . 0 +0 1 2 3 + +(queens 4) ==> ((2 0 3 1) (1 3 0 2)) diff -Nru scheme9-2013.01.09/help/runstar scheme9-2013.11.26/help/runstar --- scheme9-2013.01.09/help/runstar 2012-11-27 15:31:49.000000000 +0000 +++ scheme9-2013.11.26/help/runstar 2013-11-26 11:02:13.000000000 +0000 @@ -11,5 +11,7 @@ [1] http://www.lulu.com/shop/nils-m-holm/logic-programming-in-scheme/\ paperback/product-18693432.html -(run* (vq) (appendo vq (_) '(a b c))) - ==> (() (a) (a b) (a b c)) +(run* (q) (fresh (h t) + (== q (list h t)) + (appendo h t '(1 2 3)))) + ==> ((() (1 2 3)) ((1) (2 3)) ((1 2) (3)) ((1 2 3) ())) diff -Nru scheme9-2013.01.09/help/s9e scheme9-2013.11.26/help/s9e --- scheme9-2013.01.09/help/s9e 2012-11-27 15:32:06.000000000 +0000 +++ scheme9-2013.11.26/help/s9e 2013-11-26 11:02:21.000000000 +0000 @@ -8,3 +8,7 @@ be read-only. (s9e "foo.scm") + +; Todo: +t expanded tabs +e diff -Nru scheme9-2013.01.09/help/system scheme9-2013.11.26/help/system --- scheme9-2013.01.09/help/system 1970-01-01 00:00:00.000000000 +0000 +++ scheme9-2013.11.26/help/system 2013-11-24 16:54:04.000000000 +0000 @@ -0,0 +1,6 @@ +S9fES (system string) ==> integer + +Run the command STRING and return its exit status. + +(system "ls") ==> 0 +(system "ls nonexistent") ==> 1 diff -Nru scheme9-2013.01.09/lib/_template scheme9-2013.11.26/lib/_template --- scheme9-2013.01.09/lib/_template 2012-11-08 10:52:06.000000000 +0000 +++ scheme9-2013.11.26/lib/_template 2013-01-17 15:44:25.000000000 +0000 @@ -1,5 +1,5 @@ ; Scheme 9 from Empty Space, Function Library -; By Nils M Holm, 2012 +; By Nils M Holm, 2013 ; Placed in the Public Domain ; ; (name argument ...) ==> type diff -Nru scheme9-2013.01.09/lib/collect.scm scheme9-2013.11.26/lib/collect.scm --- scheme9-2013.01.09/lib/collect.scm 1970-01-01 00:00:00.000000000 +0000 +++ scheme9-2013.11.26/lib/collect.scm 2013-01-17 15:55:37.000000000 +0000 @@ -0,0 +1,31 @@ +; Scheme 9 from Empty Space, Function Library +; By Nils M Holm, 2013 +; Placed in the Public Domain +; +; (collect procedure list) ==> list +; +; Collect elements from LIST as long as two subsequent elements +; E1 and E2 satisfy the predicate (PROCEDURE E1 E2). When two +; subsequent elements do not satisfy the predicate, start a new +; output list. Concatenate all output lists in the result. +; +; Example: (collect eq? '(a a a b c c)) ==> ((a a a) (b) (c c)) +; (collect < '(1 2 3 3 4 5 4)) ==> ((1 2 3) (3 4 5) (4)) + +(define (collect p a) + (let collect ((in a) + (out '()) + (res '())) + (cond ((null? in) + (reverse! res)) + ((and (pair? (cdr in)) + (p (car in) (cadr in))) + (collect (cdr in) + (cons (car in) out) + res)) + (else + (let ((out (reverse! (cons (car in) out)))) + (collect (cdr in) + '() + (cons out res))))))) + diff -Nru scheme9-2013.01.09/lib/list-tools.scm scheme9-2013.11.26/lib/list-tools.scm --- scheme9-2013.01.09/lib/list-tools.scm 2012-11-01 12:07:30.000000000 +0000 +++ scheme9-2013.11.26/lib/list-tools.scm 2013-01-17 16:01:11.000000000 +0000 @@ -6,6 +6,7 @@ (load-from-library "assp.scm") (load-from-library "combine.scm") +(load-from-library "collect.scm") (load-from-library "count.scm") (load-from-library "depth.scm") (load-from-library "equal-cip.scm") diff -Nru scheme9-2013.01.09/lib/syntax-rules.scm scheme9-2013.11.26/lib/syntax-rules.scm --- scheme9-2013.01.09/lib/syntax-rules.scm 2012-11-04 14:51:17.000000000 +0000 +++ scheme9-2013.11.26/lib/syntax-rules.scm 2013-01-14 08:50:54.000000000 +0000 @@ -31,7 +31,9 @@ ((pair? pattern) (cond ((and (pair? (cdr pattern)) - (eq? '... (cadr pattern))) + (eq? '... (cadr pattern)) + (or (pair? form) + (null? form))) (let ((e* (map (lambda (x) (match x (car pattern) keywords '())) form))) diff -Nru scheme9-2013.01.09/s9.1 scheme9-2013.11.26/s9.1 --- scheme9-2013.01.09/s9.1 2012-11-27 15:29:50.000000000 +0000 +++ scheme9-2013.11.26/s9.1 2013-11-26 10:59:41.000000000 +0000 @@ -186,6 +186,14 @@ These S9fES procedures are not in R4RS: .sp .ne 3 +.B "(argv integer) ==> string | #f +.in +4 +Retrieve the value of the given command line argument. Return +\fB#f\fP, if there are less than \fIinteger\fP+1 arguments. +Arguments start at 0. +.in -4 +.sp +.ne 3 .B "(bit-op integer1 integer2 integer3 ...) ==> integer | #f .in +4 Implement a variety of bitwise operations. See the @@ -212,6 +220,13 @@ .in -4 .sp .ne 3 +.B "(environ string) ==> string | #f +.in +4 +Retrieve the value of the given environment variable. Return +\fB#f\fP, if the variable is undefined. +.in -4 +.sp +.ne 3 .B "(error string) ==> undefined .br .B "(error string object) ==> undefined @@ -384,6 +399,12 @@ .in -4 .sp .ne 3 +.B "(system string) ==> number +.in +4 +Run the given shell command and return its exit code. +.in -4 +.sp +.ne 3 .B "(trace symbol ...) ==> list | #t .br .B "(trace #t) ==> list | #t diff -Nru scheme9-2013.01.09/s9.1.txt scheme9-2013.11.26/s9.1.txt --- scheme9-2013.01.09/s9.1.txt 2012-11-27 15:30:18.000000000 +0000 +++ scheme9-2013.11.26/s9.1.txt 2013-11-26 11:00:22.000000000 +0000 @@ -97,6 +97,11 @@ These S9fES procedures are not in R4RS: + (argv integer) ==> string | #f + Retrieve the value of the given command line argument. + Return #f, if there are less than integer+1 arguments. + Arguments start at 0. + (bit-op integer1 integer2 integer3 ...) ==> integer | #f Implement a variety of bitwise operations. See the bit- op help page for details. @@ -110,22 +115,17 @@ Write a heap image to the file given in the string argument. If the file already exists, report an error. + (environ string) ==> string | #f + Retrieve the value of the given environment variable. + Return #f, if the variable is undefined. + (error string) ==> undefined (error string object) ==> undefined Print an error message of the form error: string: object and terminate program execution. - (exponent real) ==> integer - Extract the exponent part from a real number. - (file-exists? string) ==> boolean - Return #t if the file specified in the string argument - exists and otherwise #f. - (fold-left proc base list ...) ==> object - Combine the elements of the lists using proc. Combine - elements left-associatively. Base is the leftmost - element. S9 Interpreter Page 2 S9(1) @@ -134,32 +134,43 @@ S9(1) Scheme 9 from Empty Space S9(1) + (exponent real) ==> integer + Extract the exponent part from a real number. + + (file-exists? string) ==> boolean + Return #t if the file specified in the string argument + exists and otherwise #f. + + (fold-left proc base list ...) ==> object + Combine the elements of the lists using proc. Combine + elements left-associatively. Base is the leftmost + element. (fold-right proc base list ...) ==> object - Combine the elements of the lists using proc. Combine - elements right-associatively. Base is the rightmost + Combine the elements of the lists using proc. Combine + elements right-associatively. Base is the rightmost element. (gensym) ==> symbol (gensym symbol) ==> symbol (gensym string) ==> symbol - Return a fresh symbol. When a string or symbol argument + Return a fresh symbol. When a string or symbol argument is given, use it as prefix for the fresh symbol. (load-from-library string) ==> unspecific - Attempt to load the file string from each directory of + Attempt to load the file string from each directory of S9FES_LIBRARY_PATH. (locate-file string) ==> string | #f Search for the file string in each directory of - S9FES_LIBRARY_PATH in sequence. When the file can be + S9FES_LIBRARY_PATH in sequence. When the file can be located, return its full path, else return #f. (macro-expand object) ==> object (macro-expand-1 object) ==> object - If object is a list resembling a macro application, + If object is a list resembling a macro application, return the expanded form, else return the object. - Macro-expand-1 expands macros only once while macro- + Macro-expand-1 expands macros only once while macro- expand expands them recursively. (mantissa real) ==> integer @@ -169,12 +180,12 @@ Write multiple objects separated by spaces. (require-extension name ...) ==> unspecific - Require the named extensions to be compiled-in. Signal - an error if not all of the required extensions are + Require the named extensions to be compiled-in. Signal + an error if not all of the required extensions are present. (reverse! list) ==> list - Reverse list destructively and return the reverse list. + Reverse list destructively and return the reverse list. (set-input-port! input-port) ==> unspecific Destructively set the current input port. @@ -182,9 +193,17 @@ (set-output-port! output-port) ==> unspecific Destructively set the current output port. + +S9 Interpreter Page 3 S9(1) + + +S9(1) Scheme 9 from Empty Space S9(1) + + + (stats form) ==> form Evaluate the given form and return a list containing its - normal form plus a summary of the resources used to + normal form plus a summary of the resources used to compute that normal form: - reduction steps @@ -192,80 +211,76 @@ - total nodes allocated - garbage collections - - -S9 Interpreter Page 3 S9(1) - - -S9(1) Scheme 9 from Empty Space S9(1) - - - Each resource count will be returned as a group of - integers representing ones, thousands, millions, etc. - Note that form must be quoted or it will be evaluated + Each resource count will be returned as a group of + integers representing ones, thousands, millions, etc. + Note that form must be quoted or it will be evaluated before passing it to stats. (symbols) ==> list Return a list of all defined symbols. + (system string) ==> number + Run the given shell command and return its exit code. + (trace symbol ...) ==> list | #t (trace #t) ==> list | #t - Trace the procedure or syntax object bound to the given - symbols. When #t is passed to trace, trace all - procedures and syntax objects (expect lots of output!). - When no arguments are passed to it, disable tracing. - Trace returns the symbols that were being traced before + Trace the procedure or syntax object bound to the given + symbols. When #t is passed to trace, trace all + procedures and syntax objects (expect lots of output!). + When no arguments are passed to it, disable tracing. + Trace returns the symbols that were being traced before its invocation. (vector-append vector ...) ==> vector - Return a fresh vector containing the concatenation of + Return a fresh vector containing the concatenation of the given vectors. (vector-copy vector) ==> vector (vector-copy vector integer) ==> vector (vector-copy vector integer1 integer2) ==> vector (vector-copy vector integer1 integer2 object) ==> vector - Return a copy of the given vector. When integer1 is - specified, skip the given number of elements. When - integer2 is also specified, copy elements from integer1 - up to, but not including, integer2. When integer2 - exceeds the size of the original vector, add unspecific - slots to the copy. When an object argument is given, + Return a copy of the given vector. When integer1 is + specified, skip the given number of elements. When + integer2 is also specified, copy elements from integer1 + up to, but not including, integer2. When integer2 + exceeds the size of the original vector, add unspecific + slots to the copy. When an object argument is given, fill extra slots with that argument. (void) ==> unspecific Return an unspecific value. - Refer to the help pages for descriptions of the Scheme 9 + Refer to the help pages for descriptions of the Scheme 9 extension procedures. SPECIAL VARIABLES - These variables are predefined in the dynamic top-level + These variables are predefined in the dynamic top-level scope of the interpreter. + + + +S9 Interpreter Page 4 S9(1) + + +S9(1) Scheme 9 from Empty Space S9(1) + + ** (form) - The normal form of the expression most recently + The normal form of the expression most recently evaluated at the top level. *extensions* (list of symbols) Compiled-in extensions. *library-path* (string) - A verbatim copy of the S9FES_LIBRARY_PATH environment + A verbatim copy of the S9FES_LIBRARY_PATH environment variable (see below). *loading* (boolean) Set to #t when loading a file, else #f. MACROS - A macro is a procedure that is applied to its unevaluated + A macro is a procedure that is applied to its unevaluated arguments. The macro application is replaced with the value - returned by the procedure. This happens before the - - -S9 Interpreter Page 4 S9(1) - - -S9(1) Scheme 9 from Empty Space S9(1) - - + returned by the procedure. This happens before the expression containing the macro application is evaluated, so a macro rewrites its own application: @@ -283,15 +298,15 @@ (define-syntax name procedure) ==> unspecific (define-syntax (name args ...) body) ==> unspecific - Both of these forms introduce the keyword name and bind it - to a procedure. The first form requires the second argument - to be a procedure. Like in define forms the second variant + Both of these forms introduce the keyword name and bind it + to a procedure. The first form requires the second argument + to be a procedure. Like in define forms the second variant implies a procedure definition. - Macros may contain applications of macros that were defined - earlier. Macros may not recurse directly, but they may - implement recursion internally using letrec or by rewriting - their own applications. The following macro, for example, + Macros may contain applications of macros that were defined + earlier. Macros may not recurse directly, but they may + implement recursion internally using letrec or by rewriting + their own applications. The following macro, for example, does not work, because d is undefined in the body of d: (define-syntax (d x) (and (pair? x) (d (cdr x)))) ; wrong @@ -305,12 +320,20 @@ loaded. TECHNICAL DETAILS - S9fES is a tree-walking interpreter using deep binding and - hashed environments. It employs an extremely reliable[1] + S9fES is a tree-walking interpreter using deep binding and + hashed environments. It employs an extremely reliable[1] constant-space mark and sweep garbage collector with in-situ - string and vector pool compaction. Memory pools grow on - demand. The interpreter uses arbitrary-precision integer - arithmetics and (optional) decimal-based real number + string and vector pool compaction. Memory pools grow on + + +S9 Interpreter Page 5 S9(1) + + +S9(1) Scheme 9 from Empty Space S9(1) + + + demand. The interpreter uses arbitrary-precision integer + arithmetics and (optional) decimal-based real number arithmetics. INTERPRETER START-UP @@ -319,60 +342,62 @@ Load library. The interpreter searches its library path (either built- - in or specified in the S9FES_LIBRARY_PATH environment - variable) for a heap image file or the library source + in or specified in the S9FES_LIBRARY_PATH environment + variable) for a heap image file or the library source code. The heap image file is the name of the interpreter - with a .image suffix appended. An alternative name can - be specified with the -i option (see OPTIONS). The - - -S9 Interpreter Page 5 S9(1) - - -S9(1) Scheme 9 from Empty Space S9(1) - - - default library source code is named s9.scm. The first - directory containing either a heap image or the library + with a .image suffix appended. An alternative name can + be specified with the -i option (see OPTIONS). The + default library source code is named s9.scm. The first + directory containing either a heap image or the library source code is used. When the directory contains both an image and the library sources, the image is loaded. Initialize extensions. - Any extensions compiled into the interpreter are - initialized by calling the nullary procedure ext:ext + Any extensions compiled into the interpreter are + initialized by calling the nullary procedure ext:ext (where ext is the name of the extension). The procedures are optional. The first `extension' being initialized is - S9 itself, so when a procedure named s9:s9 exists, it + S9 itself, so when a procedure named s9:s9 exists, it will be called at this point. Evaluate command line options. When a -l file option is found, the program contained in - the given file will be loaded. When a -f file args - option is found, the program contained in the file will - be run and then S9 will exit. Args will be passed to + the given file will be loaded. When a -f file args + option is found, the program contained in the file will + be run and then S9 will exit. Args will be passed to the program. Load rc file. - If an `rc file' ($HOME/.s9fes/rc) exists, it will be - loaded at this point as if its name was passed to the + If an `rc file' ($HOME/.s9fes/rc) exists, it will be + loaded at this point as if its name was passed to the load procedure. (Unless the -n option was specified.) Enter REPL. - Interactive mode is only entered, when no -f option was + Interactive mode is only entered, when no -f option was specified. ALLOCATION STRATEGY - The S9fES memory pool grows exponentially until the memory - limit its reached. When the limit is reached, the current - computation is aborted. A memory limit can be specified - using the -m command line option. The limit is specified in - units of 1024 nodes (or in units of 1024*1024 nodes by + The S9fES memory pool grows exponentially until the memory + limit its reached. When the limit is reached, the current + computation is aborted. A memory limit can be specified + using the -m command line option. The limit is specified in + units of 1024 nodes (or in units of 1024*1024 nodes by appending an m suffix). Note that computations may abort before the limit is reached - due to the way the pool grows. Use the -g command line + due to the way the pool grows. Use the -g command line option to experiment with pool sizes. Specifying a limit of zero disables the memory limit - completely and the interpreter will allocate as much memory + completely and the interpreter will allocate as much memory + + + + +S9 Interpreter Page 6 S9(1) + + +S9(1) Scheme 9 from Empty Space S9(1) + + as it can get. This option should be used with care. LIMITATIONS @@ -383,26 +408,16 @@ Rational and complex numbers and related procedures. BUGS - You may not quasiquote quasiquote unless in unquote (e.g.: + You may not quasiquote quasiquote unless in unquote (e.g.: ``x does not work, but `,`x does). Syntax-rules is not fully hygienic. - Multiple call/cc's in the arguments of the same lambda (or - derived binding syntax, such as let) will break the - - - - -S9 Interpreter Page 6 S9(1) - - -S9(1) Scheme 9 from Empty Space S9(1) - - + Multiple call/cc's in the arguments of the same lambda (or + derived binding syntax, such as let) will break the evaluator. FILES $HOME/.s9fes/rc - If present, this file is loaded when the interpreter + If present, this file is loaded when the interpreter starts in interactive mode. @LIBDIR@ The S9fES procedure library (source code). @@ -415,14 +430,14 @@ ENVIRONMENT S9FES_LIBRARY_PATH - A colon-separated list of directories which will be - searched for the s9 library when the interpreter is - launched. The same directories will be searched by the + A colon-separated list of directories which will be + searched for the s9 library when the interpreter is + launched. The same directories will be searched by the locate-file procedure. Default: .:~/.s9fes:@LIBDIR@ SIGNALS - These work only if POSIX signal handling was enabled at + These work only if POSIX signal handling was enabled at compile time. SIGINT @@ -441,7 +456,15 @@ The Revised^4 Report on the Algorithmic Language Scheme. http://www-swiss.ai.mit.edu/~jaffer/r4rs_toc.html - Scheme 9 from Empty Space -- A Guide to Implementing Scheme + + +S9 Interpreter Page 7 S9(1) + + +S9(1) Scheme 9 from Empty Space S9(1) + + + Scheme 9 from Empty Space -- A Guide to Implementing Scheme in C. Available at Lulu.com, see http://www.t3x.org @@ -458,5 +481,48 @@ -S9 Interpreter Page 7 S9(1) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +S9 Interpreter Page 8 S9(1) diff -Nru scheme9-2013.01.09/s9.c scheme9-2013.11.26/s9.c --- scheme9-2013.01.09/s9.c 2013-01-09 10:09:48.000000000 +0000 +++ scheme9-2013.11.26/s9.c 2013-11-27 15:52:21.000000000 +0000 @@ -13,7 +13,7 @@ * (also add "s9-real.scm" to the heap image). */ -#define VERSION "2013-01-09" +#define VERSION "2013-11-26" #define EXTERN #include "s9.h" @@ -694,6 +694,9 @@ else if (s[0] == '+') { s++; } + /* plan9's atol() interprets leading 0 as octal! */ + while (s[0] == '0' && s[1]) + s++; k = (int) strlen(s); n = NIL; while (k) { @@ -3946,6 +3949,39 @@ return n; } +#ifdef unix + +cell pp_argv(cell x) { + cell n; + char **cl; + + if (Command_line == NULL || *Command_line == NULL) + return FALSE; + n = integer_value("argv", cadr(x)); + cl = Command_line; + for (; n--; cl++) + if (*cl == NULL) + return FALSE; + return *cl == NULL? FALSE: make_string(*cl, strlen(*cl)); +} + +cell pp_environ(cell x) { + char *s; + + s = getenv(string(cadr(x))); + if (s == NULL) + return FALSE; + return make_string(s, strlen(s)); +} + +cell pp_system(cell x) { + int r; + + r = system(string(cadr(x))); + return make_integer(r >> 8); +} +#endif + /* * Evaluator */ @@ -4120,6 +4156,11 @@ { "mantissa", pp_mantissa, 1, 1, { REA,___,___ } }, { "real?", pp_real_p, 1, 1, { ___,___,___ } }, #endif /* REALNUM */ +#ifdef unix + { "argv", pp_argv, 1, 1, { INT,___,___ } }, + { "environ", pp_environ, 1, 1, { STR,___,___ } }, + { "system", pp_system, 1, 1, { STR,___,___ } }, +#endif { NULL } }; diff -Nru scheme9-2013.01.09/util/categories.html scheme9-2013.11.26/util/categories.html --- scheme9-2013.01.09/util/categories.html 2012-11-09 08:10:48.000000000 +0000 +++ scheme9-2013.11.26/util/categories.html 2013-01-17 15:57:40.000000000 +0000 @@ -219,6 +219,7 @@
appendb.scm
assp.scm
+
collect.scm
duplicates.scm
filter.scm
flatten.scm
diff -Nru scheme9-2013.01.09/util/descriptions scheme9-2013.11.26/util/descriptions --- scheme9-2013.01.09/util/descriptions 2013-01-03 09:02:16.000000000 +0000 +++ scheme9-2013.11.26/util/descriptions 2013-01-17 15:57:11.000000000 +0000 @@ -17,6 +17,7 @@ catch.scm|catch / throw|-|Handle exceptions check-descr.scm|-|Missing description ;-)|- choose.scm|choose|-|Compute binomial coefficients +collect.scm|collect|-|Collect related elements from lists cols.scm|-|Format input in two columns|- combine.scm|combine|-|Generate combinations of sets cond-expand.scm|cond-expand|-|Simple feature-based conditional expansion diff -Nru scheme9-2013.01.09/util/libtest.scm scheme9-2013.11.26/util/libtest.scm --- scheme9-2013.01.09/util/libtest.scm 2013-01-09 10:11:01.000000000 +0000 +++ scheme9-2013.11.26/util/libtest.scm 2013-11-27 15:53:06.000000000 +0000 @@ -150,6 +150,12 @@ (choose 23 3) ==> 1771 ) +(load-from-library "collect.scm") +(%test + (collect eq? '(a a a b c c)) ==> ((a a a) (b) (c c)) + (collect < '(1 2 3 3 4 5 4)) ==> ((1 2 3) (3 4 5) (4)) +) + (load-from-library "combine.scm") (%test (combine 2 '(a b c)) ==> ((a b) (a c) (b c)) @@ -1087,7 +1093,7 @@ (%test (format-time "~w ~4y-~@m-~2d ~2h:~2m:~2s" '(1 2009 3 9 8 53 20)) - ==> "Tue 2009-Apr-09 08:53:20" + ==> "Tue 2009-Mar-09 08:53:20" ) (load-from-library "leap-yearp.scm") diff -Nru scheme9-2013.01.09/util/make-html scheme9-2013.11.26/util/make-html --- scheme9-2013.01.09/util/make-html 2013-01-08 18:27:11.000000000 +0000 +++ scheme9-2013.11.26/util/make-html 2013-01-10 08:28:32.000000000 +0000 @@ -269,7 +269,7 @@ if [ $update_only = no -o $update_only = txt ]; then format_txt_files -r "" ABOUT format_txt_files "" CHANGES LICENSE Makefile README Todo - format_txt_files "" _checksums mkfile s9.1.txt + format_txt_files "" configure _checksums mkfile s9.1.txt format_txt_files lib lib/_template format_txt_files prog prog/adventure.adv prog/edoc.css format_txt_files prog prog/advgen.txt diff -Nru scheme9-2013.01.09/util/systest.scm scheme9-2013.11.26/util/systest.scm --- scheme9-2013.01.09/util/systest.scm 2012-11-26 13:21:51.000000000 +0000 +++ scheme9-2013.11.26/util/systest.scm 2013-11-26 11:06:08.000000000 +0000 @@ -397,6 +397,8 @@ (equal? '("foo" "bar" "baz") (read (sys:make-input-port (car pipe)))))))) +; XXX should also test built-in ARGV primitive + (test (let ((pipe (sys:pipe))) (cond ((zero? (sys:fork)) (sys:dup2 (cadr pipe) 1) @@ -406,6 +408,15 @@ (equal? (string-append "hello" (string #\newline)) (sys:read (car pipe) 1024)))))) +(test (let ((pipe (sys:pipe))) ; SYSTEM of core S9, not of SYS: + (cond ((zero? (sys:fork)) + (sys:dup2 (cadr pipe) 1) + (system "echo hello") + (sys:exit)) + (else + (equal? (string-append "hello" (string #\newline)) + (sys:read (car pipe) 1024)))))) + (test (sys:unlink "testprog")) ; ----- Select --------------------------------------------------------------- @@ -535,6 +546,9 @@ (test (sys:getenv "HOME")) (fail (sys:getenv "")) +(test (environ "HOME")) ; these two are in fact not in SYS: +(fail (environ "")) + (test (sys:getpid)) (test (sys:getgid))