~ chicken-core (chicken-5) ee71f3cdae746a5a37dbe9327e9d6c5d6fac0438
commit ee71f3cdae746a5a37dbe9327e9d6c5d6fac0438 Author: Evan Hanson <evhan@foldling.org> AuthorDate: Mon Feb 9 07:04:34 2015 +1300 Commit: Evan Hanson <evhan@foldling.org> CommitDate: Sun Jul 19 21:12:54 2015 +1200 Convert the data-structures unit into a module Includes a minor tweak to srfi-4, to avoid depending on data-structures. diff --git a/README b/README index b79457c4..6806ecac 100644 --- a/README +++ b/README @@ -284,10 +284,10 @@ | |-- chicken | | `-- 7 | | |-- chicken.import.so + | | |-- chicken.data-structures.import.so | | |-- chicken.ports.import.so | | |-- chicken.utils.import.so | | |-- csi.import.so - | | |-- data-structures.import.so | | |-- extras.import.so | | |-- files.import.so | | |-- foreign.import.so diff --git a/batch-driver.scm b/batch-driver.scm index c2db8dbe..16b76795 100644 --- a/batch-driver.scm +++ b/batch-driver.scm @@ -40,7 +40,8 @@ user-options-pass user-read-pass user-preprocessor-pass user-pass user-post-analysis-pass) -(import chicken scheme extras data-structures files +(import chicken scheme extras files + chicken.data-structures chicken.compiler.support chicken.compiler.compiler-syntax chicken.compiler.core diff --git a/c-backend.scm b/c-backend.scm index 63486c7b..4419430e 100644 --- a/c-backend.scm +++ b/c-backend.scm @@ -38,7 +38,8 @@ ;; For "foreign" (aka chicken-ffi-syntax): foreign-type-declaration) -(import chicken scheme foreign data-structures +(import chicken scheme foreign + chicken.data-structures chicken.compiler.core chicken.compiler.c-platform chicken.compiler.support) diff --git a/c-platform.scm b/c-platform.scm index 6d24b258..b2f18736 100644 --- a/c-platform.scm +++ b/c-platform.scm @@ -42,7 +42,8 @@ target-include-file words-per-flonum parameter-limit small-parameter-limit) -(import chicken scheme data-structures +(import chicken scheme + chicken.data-structures chicken.compiler.optimizer chicken.compiler.support chicken.compiler.core) diff --git a/chicken-bug.scm b/chicken-bug.scm index e2cd4f05..f5cc6694 100644 --- a/chicken-bug.scm +++ b/chicken-bug.scm @@ -24,9 +24,11 @@ ; POSSIBILITY OF SUCH DAMAGE. -(require-extension posix tcp data-structures utils extras) +(require-library posix tcp data-structures utils extras) -(import chicken.utils) +(import posix tcp extras + chicken.data-structures + chicken.utils) (define-constant +bug-report-file+ "chicken-bug-report.~a-~a-~a") diff --git a/chicken-ffi-syntax.scm b/chicken-ffi-syntax.scm index 47303dc4..f0b4dbf1 100644 --- a/chicken-ffi-syntax.scm +++ b/chicken-ffi-syntax.scm @@ -27,6 +27,7 @@ (declare (unit chicken-ffi-syntax) + (uses data-structures) (disable-interrupts) (fixnum)) @@ -38,6 +39,8 @@ (no-bound-checks) (no-procedure-checks)) +(import chicken.data-structures) + (include "mini-srfi-1.scm") (##sys#provide 'chicken-ffi-syntax) diff --git a/chicken-install.scm b/chicken-install.scm index 1d5a85b0..b9069599 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -29,11 +29,12 @@ (module main () - (import scheme chicken posix data-structures irregex extras files) + (import scheme chicken posix irregex extras files) (import setup-download setup-api) (import foreign) - (import chicken.ports + (import chicken.data-structures + chicken.ports chicken.utils) (include "mini-srfi-1.scm") @@ -43,12 +44,12 @@ '("setup-api.so" "setup-api.import.so" "setup-download.so" "setup-download.import.so" "chicken.import.so" + "chicken.data-structures.import.so" "chicken.ports.import.so" "chicken.utils.import.so" "lolevel.import.so" "srfi-1.import.so" "srfi-4.import.so" - "data-structures.import.so" "files.import.so" "posix.import.so" "extras.import.so" diff --git a/chicken-profile.scm b/chicken-profile.scm index 688c5361..5e340de7 100644 --- a/chicken-profile.scm +++ b/chicken-profile.scm @@ -30,6 +30,8 @@ (uses data-structures posix)) +(import chicken.data-structures) + (include "mini-srfi-1.scm") (define symbol-table-size 3001) diff --git a/chicken-status.scm b/chicken-status.scm index 02ae33a8..501050dd 100644 --- a/chicken-status.scm +++ b/chicken-status.scm @@ -30,8 +30,9 @@ (module main () (import scheme chicken foreign) - (import posix data-structures irregex files setup-api extras) - (import chicken.ports) + (import posix irregex files setup-api extras) + (import chicken.data-structures + chicken.ports) (include "mini-srfi-1.scm") diff --git a/chicken-uninstall.scm b/chicken-uninstall.scm index 5a259e1f..843e7683 100644 --- a/chicken-uninstall.scm +++ b/chicken-uninstall.scm @@ -33,8 +33,9 @@ (import scheme chicken foreign) (import setup-api) - (import posix data-structures irregex files) - (import chicken.ports + (import posix irregex files) + (import chicken.data-structures + chicken.ports chicken.utils) (include "mini-srfi-1.scm") diff --git a/chicken.scm b/chicken.scm index 6f13de85..00e243e7 100644 --- a/chicken.scm +++ b/chicken.scm @@ -37,7 +37,8 @@ (import chicken.compiler.batch-driver chicken.compiler.c-platform - chicken.utils) + chicken.data-structures + chicken.utils) (include "mini-srfi-1.scm") diff --git a/compiler-syntax.scm b/compiler-syntax.scm index 88a29739..ff3b0585 100644 --- a/compiler-syntax.scm +++ b/compiler-syntax.scm @@ -32,9 +32,10 @@ (module chicken.compiler.compiler-syntax (compiler-syntax-statistics) -(import chicken scheme data-structures +(import chicken scheme chicken.compiler.support - chicken.compiler.core) + chicken.compiler.core + chicken.data-structures) (include "tweaks.scm") (include "mini-srfi-1.scm") @@ -320,4 +321,4 @@ (,f ,zvar (##sys#slot ,lstvar 0))) ,zvar)))) x)) -) \ No newline at end of file +) diff --git a/core.scm b/core.scm index 545be117..4c51c2f2 100644 --- a/core.scm +++ b/core.scm @@ -314,9 +314,10 @@ constant-table immutable-constants inline-table line-number-database-2 line-number-database-size) -(import chicken scheme foreign extras data-structures +(import chicken scheme foreign extras chicken.compiler.scrutinizer - chicken.compiler.support) + chicken.compiler.support + chicken.data-structures) (define (d arg1 . more) (when (##sys#fudge 13) ; debug mode? @@ -2893,4 +2894,4 @@ (debugging 'o "fast global assignments" fastsets)) (values node2 (##sys#fast-reverse literals) (##sys#fast-reverse lambda-info-literals) lambda-table) ) ) ) -) \ No newline at end of file +) diff --git a/csc.scm b/csc.scm index ed0a5b23..e921ddfd 100644 --- a/csc.scm +++ b/csc.scm @@ -29,7 +29,8 @@ (block) (uses data-structures utils files extras)) -(import chicken.utils) +(import chicken.data-structures + chicken.utils) (include "mini-srfi-1.scm") diff --git a/csi.scm b/csi.scm index a3bd2903..6685af44 100644 --- a/csi.scm +++ b/csi.scm @@ -26,7 +26,7 @@ (declare - (uses ports extras) + (uses data-structures ports extras) (usual-integrations) (disable-interrupts) (compile-syntax) @@ -54,7 +54,8 @@ EOF describe dump tty-input? history-list history-count history-add history-ref history-clear history-show) ) -(import chicken.ports) +(import chicken.data-structures + chicken.ports) ;;; Parameters: diff --git a/data-structures.import.scm b/data-structures.import.scm deleted file mode 100644 index 343f6f41..00000000 --- a/data-structures.import.scm +++ /dev/null @@ -1,72 +0,0 @@ -;;;; data-structures.import.scm - import library for "data-structures" module -; -; Copyright (c) 2008-2015, The CHICKEN Team -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following -; conditions are met: -; -; Redistributions of source code must retain the above copyright notice, this list of conditions and the following -; disclaimer. -; Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -; disclaimer in the documentation and/or other materials provided with the distribution. -; Neither the name of the author nor the names of its contributors may be used to endorse or promote -; products derived from this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS -; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR -; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -; POSSIBILITY OF SUCH DAMAGE. - - -(##sys#register-primitive-module - 'data-structures - '(->string - alist-ref - alist-update! - alist-update - any? - atom? - butlast - chop - complement - compose - compress - conc - conjoin - constantly - disjoin - each - flatten - flip - identity - intersperse - join - list-of? - merge - merge! - o - rassoc - reverse-string-append - sort - sort! - sorted? - topological-sort - string-chomp - string-chop - string-compare3 - string-compare3-ci - string-intersperse - string-split - string-translate - string-translate* - substring-ci=? - substring-index - substring-index-ci - substring=? - tail?)) diff --git a/data-structures.scm b/data-structures.scm index a3acb9a0..37a9ad77 100644 --- a/data-structures.scm +++ b/data-structures.scm @@ -28,6 +28,22 @@ (declare (unit data-structures)) +(module chicken.data-structures + (alist-ref alist-update alist-update! atom? butlast + chop compress flatten intersperse join rassoc tail? + merge sort sorted? topological-sort + conc ->string string-chop string-chomp + string-compare3 string-compare3-ci + reverse-string-append + string-intersperse string-split + string-translate string-translate* + substring=? substring-ci=? + substring-index substring-index-ci + any? constantly complement compose + conjoin disjoin each flip identity list-of? o) + +(import scheme chicken foreign) + (include "common-declarations.scm") (register-feature! 'data-structures) @@ -767,3 +783,5 @@ (cdar dag) '() state))))) + +) diff --git a/defaults.make b/defaults.make index 30e08e72..ec0979d2 100644 --- a/defaults.make +++ b/defaults.make @@ -267,10 +267,10 @@ CHICKEN_PROGRAM_OPTIONS += $(if $(PROFILE_OBJECTS),-profile) # import libraries -PRIMITIVE_IMPORT_LIBRARIES = chicken lolevel srfi-4 data-structures files +PRIMITIVE_IMPORT_LIBRARIES = chicken lolevel srfi-1 srfi-4 files PRIMITIVE_IMPORT_LIBRARIES += posix extras tcp foreign csi irregex PRIMITIVE_IMPORT_LIBRARIES += setup-api setup-download -DYNAMIC_IMPORT_LIBRARIES = ports utils +DYNAMIC_IMPORT_LIBRARIES = data-structures ports utils # targets diff --git a/distribution/manifest b/distribution/manifest index 9816c967..5a834b33 100644 --- a/distribution/manifest +++ b/distribution/manifest @@ -240,6 +240,8 @@ files.import.scm files.import.c chicken.import.scm chicken.import.c +chicken.data-structures.import.scm +chicken.data-structures.import.c chicken.ports.import.scm chicken.ports.import.c chicken.utils.import.scm @@ -248,14 +250,12 @@ foreign.import.scm foreign.import.c lolevel.import.scm srfi-4.import.scm -data-structures.import.scm posix.import.scm extras.import.scm irregex.import.scm tcp.import.scm lolevel.import.c srfi-4.import.c -data-structures.import.c posix.import.c extras.import.c irregex.import.c diff --git a/extras.scm b/extras.scm index f4939bfa..32c0f885 100644 --- a/extras.scm +++ b/extras.scm @@ -32,6 +32,8 @@ (declare (hide fprintf0 generic-write) ) +(import chicken.data-structures) + (include "common-declarations.scm") (register-feature! 'extras) diff --git a/files.scm b/files.scm index af437d1a..272d5960 100644 --- a/files.scm +++ b/files.scm @@ -52,6 +52,8 @@ EOF )) +(import chicken.data-structures) + (include "common-declarations.scm") (register-feature! 'files) diff --git a/modules.scm b/modules.scm index 4b91c8e8..e47c2ad6 100644 --- a/modules.scm +++ b/modules.scm @@ -913,6 +913,7 @@ (##sys#register-primitive-module 'r5rs-null '() r4rs-syntax)) (##sys#register-module-alias 'r5rs 'scheme) +(##sys#register-module-alias 'data-structures 'chicken.data-structures) (##sys#register-module-alias 'ports 'chicken.ports) (##sys#register-module-alias 'utils 'chicken.utils) diff --git a/optimizer.scm b/optimizer.scm index 93d4960c..9eb4247d 100644 --- a/optimizer.scm +++ b/optimizer.scm @@ -36,7 +36,8 @@ eq-inline-operator membership-test-operators membership-unfold-limit default-optimization-passes rewrite) -(import chicken scheme data-structures +(import chicken scheme + chicken.data-structures chicken.compiler.support) (include "tweaks") diff --git a/rules.make b/rules.make index d6ac0efb..a4b0047f 100644 --- a/rules.make +++ b/rules.make @@ -511,6 +511,7 @@ $(foreach lib, $(filter-out chicken,$(COMPILER_OBJECTS_1)),\ chicken.c: chicken.scm mini-srfi-1.scm \ chicken.compiler.batch-driver.import.scm \ chicken.compiler.c-platform.import.scm \ + chicken.data-structures.import.scm \ chicken.utils.import.scm batch-driver.c: batch-driver.scm mini-srfi-1.scm \ chicken.compiler.core.import.scm \ @@ -520,52 +521,72 @@ batch-driver.c: batch-driver.scm mini-srfi-1.scm \ chicken.compiler.c-platform.import.scm \ chicken.compiler.lfa2.import.scm \ chicken.compiler.c-backend.import.scm \ - chicken.compiler.support.import.scm + chicken.compiler.support.import.scm \ + chicken.data-structures.import.scm c-platform.c: c-platform.scm mini-srfi-1.scm \ chicken.compiler.optimizer.import.scm \ chicken.compiler.support.import.scm \ - chicken.compiler.core.import.scm + chicken.compiler.core.import.scm \ + chicken.data-structures.import.scm c-backend.c: c-backend.scm mini-srfi-1.scm \ chicken.compiler.c-platform.import.scm \ chicken.compiler.support.import.scm \ - chicken.compiler.core.import.scm + chicken.compiler.core.import.scm \ + chicken.data-structures.import.scm core.c: core.scm mini-srfi-1.scm \ chicken.compiler.scrutinizer.import.scm \ - chicken.compiler.support.import.scm + chicken.compiler.support.import.scm \ + chicken.data-structures.import.scm optimizer.c: optimizer.scm mini-srfi-1.scm \ - chicken.compiler.support.import.scm + chicken.compiler.support.import.scm \ + chicken.data-structures.import.scm scrutinizer.c: scrutinizer.scm mini-srfi-1.scm \ chicken.compiler.support.import.scm \ + chicken.data-structures.import.scm \ chicken.ports.import.scm lfa2.c: lfa2.scm mini-srfi-1.scm \ chicken.compiler.support.import.scm compiler-syntax.c: compiler-syntax.scm mini-srfi-1.scm \ chicken.compiler.support.import.scm \ - chicken.compiler.core.import.scm + chicken.compiler.core.import.scm \ + chicken.data-structures.import.scm +chicken-ffi-syntax.c: chicken-ffi-syntax.scm \ + chicken.data-structures.import.scm support.c: support.scm mini-srfi-1.scm \ + chicken.data-structures.import.scm \ chicken.ports.import.scm csc.c: csc.scm \ + chicken.data-structures.import.scm \ chicken.utils.import.scm csi.c: csi.scm \ + chicken.data-structures.import.scm \ chicken.ports.import.scm chicken-bug.c: chicken-bug.scm \ + chicken.data-structures.import.scm \ chicken.utils.import.scm +chicken-profile.c: chicken-profile.scm \ + chicken.data-structures.import.scm chicken-status.c: chicken-status.scm \ + chicken.data-structures.import.scm \ chicken.ports.import.scm \ setup-api.import.scm chicken-install.c: chicken-install.scm \ + chicken.data-structures.import.scm \ chicken.ports.import.scm \ chicken.utils.import.scm \ setup-api.import.scm \ setup-download.import.scm chicken-uninstall.c: chicken-uninstall.scm \ + chicken.data-structures.import.scm \ chicken.ports.import.scm \ chicken.utils.import.scm \ setup-api.import.scm setup-api.c: setup-api.scm \ + chicken.data-structures.import.scm \ chicken.ports.import.scm \ chicken.utils.import.scm setup-download.c: setup-download.scm \ + chicken.data-structures.import.scm \ chicken.ports.import.scm \ chicken.utils.import.scm \ setup-api.import.scm @@ -573,8 +594,14 @@ posixunix.c: posixunix.scm \ chicken.ports.import.scm posixwin.c: posixwin.scm \ chicken.ports.import.scm +extras.c: extras.scm \ + chicken.data-structures.import.scm +files.c: files.scm \ + chicken.data-structures.import.scm tcp.c: tcp.scm \ chicken.ports.import.scm +utils.c: utils.scm \ + chicken.data-structures.import.scm define profile-flags $(if $(filter $(basename $(1)),$(PROFILE_OBJECTS)),-profile) @@ -603,7 +630,7 @@ chicken-syntax.c: $(SRCDIR)chicken-syntax.scm $(SRCDIR)common-declarations.scm $ chicken-ffi-syntax.c: $(SRCDIR)chicken-ffi-syntax.scm $(SRCDIR)common-declarations.scm $(SRCDIR)mini-srfi-1.scm $(bootstrap-lib) data-structures.c: $(SRCDIR)data-structures.scm $(SRCDIR)common-declarations.scm - $(bootstrap-lib) + $(bootstrap-lib) -emit-import-library chicken.data-structures ports.c: $(SRCDIR)ports.scm $(SRCDIR)common-declarations.scm $(bootstrap-lib) -emit-import-library chicken.ports files.c: $(SRCDIR)files.scm $(SRCDIR)common-declarations.scm diff --git a/scrutinizer.scm b/scrutinizer.scm index f1569ee3..490cda7a 100644 --- a/scrutinizer.scm +++ b/scrutinizer.scm @@ -33,8 +33,9 @@ (scrutinize load-type-database emit-type-file validate-type check-and-validate-type install-specializations) -(import chicken scheme data-structures extras files +(import chicken scheme extras files chicken.compiler.support + chicken.data-structures chicken.ports) (include "tweaks") diff --git a/setup-api.scm b/setup-api.scm index 2e74bef6..96817d76 100644 --- a/setup-api.scm +++ b/setup-api.scm @@ -66,7 +66,8 @@ setup-error-handling) (import scheme chicken foreign - irregex posix extras data-structures files + irregex posix extras files + chicken.data-structures chicken.ports chicken.utils) diff --git a/setup-download.scm b/setup-download.scm index 8c6e8eb2..9f3ec607 100644 --- a/setup-download.scm +++ b/setup-download.scm @@ -37,8 +37,9 @@ temporary-directory) (import scheme chicken foreign) - (import extras irregex posix data-structures tcp files + (import extras irregex posix tcp files setup-api + chicken.data-structures chicken.utils) (include "mini-srfi-1.scm") diff --git a/srfi-4.scm b/srfi-4.scm index 0e4a8346..acedc20b 100644 --- a/srfi-4.scm +++ b/srfi-4.scm @@ -531,19 +531,19 @@ EOF (define-syntax NNNvector->list (er-macro-transformer (lambda (x r c) - (let* ((tag (##sys#strip-syntax (cadr x))) + (let* ((tag (symbol->string (##sys#strip-syntax (cadr x)))) (alloc (and (pair? (cddr x)) (caddr x))) - (name (string->symbol (string-append (symbol->string tag) "->list")))) + (name (string->symbol (string-append tag "->list")))) `(define (,name v) - (##sys#check-structure v ',tag ',name) - (let ((len (##core#inline ,(conc "C_u_i_" tag "_length") v))) + (##sys#check-structure v ',(string->symbol tag) ',name) + (let ((len (##core#inline ,(string-append "C_u_i_" tag "_length") v))) (let loop ((i 0)) (if (fx>= i len) '() (cons ,(if alloc - `(##core#inline_allocate (,(conc "C_a_u_i_" tag "_ref") ,alloc) v i) - `(##core#inline ,(conc "C_u_i_" tag "_ref") v i)) + `(##core#inline_allocate (,(string-append "C_a_u_i_" tag "_ref") ,alloc) v i) + `(##core#inline ,(string-append "C_u_i_" tag "_ref") v i)) (loop (fx+ i 1)) ) ) ) ) ) ) ))) (NNNvector->list u8vector) diff --git a/support.scm b/support.scm index 2dc27c53..477d95bf 100644 --- a/support.scm +++ b/support.scm @@ -75,7 +75,8 @@ ;; in a lot of other places. number-type unsafe) -(import chicken scheme foreign data-structures files extras +(import chicken scheme foreign files extras + chicken.data-structures chicken.ports) (include "tweaks") diff --git a/tests/compiler-tests.scm b/tests/compiler-tests.scm index 42cb0256..de31b1ac 100644 --- a/tests/compiler-tests.scm +++ b/tests/compiler-tests.scm @@ -2,6 +2,7 @@ (import foreign) +(use-for-syntax data-structures) (use srfi-4) ;; test dropping of previous toplevel assignments diff --git a/tests/port-tests.scm b/tests/port-tests.scm index 2f70ecf5..4122df59 100644 --- a/tests/port-tests.scm +++ b/tests/port-tests.scm @@ -1,4 +1,4 @@ -(require-extension ports utils srfi-4 extras tcp posix) +(require-extension data-structures ports utils srfi-4 extras tcp posix) (include "test.scm") (test-begin) diff --git a/tests/runtests.bat b/tests/runtests.bat index 2af3216a..f44330b6 100644 --- a/tests/runtests.bat +++ b/tests/runtests.bat @@ -310,7 +310,7 @@ if errorlevel 1 exit /b 1 echo ======================================== r4rstest ... echo (expect mult-float-print-test to fail) -%interpret% -e "(set! ##sys#procedure->string (constantly \"#<procedure>\"))" -i -s r4rstest.scm >r4rstest.log +%interpret% -R data-structures -e "(set! ##sys#procedure->string (constantly \"#<procedure>\"))" -i -s r4rstest.scm >r4rstest.log if errorlevel 1 exit /b 1 type r4rstest.log diff --git a/tests/runtests.sh b/tests/runtests.sh index cd965f65..a3a1261c 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -37,7 +37,7 @@ mkdir -p test-repository for x in setup-api.so setup-api.import.so setup-download.so \ setup-download.import.so chicken.import.so lolevel.import.so \ - srfi-4.import.so data-structures.import.so \ + srfi-4.import.so chicken.data-structures.import.so \ chicken.ports.import.so chicken.utils.import.so files.import.so \ posix.import.so \ extras.import.so \ @@ -266,7 +266,7 @@ $interpret -s loopy-test.scm echo "======================================== r4rstest ..." echo "(expect mult-float-print-test to fail)" -$interpret -e '(set! ##sys#procedure->string (constantly "#<procedure>"))' \ +$interpret -R data-structures -e '(set! ##sys#procedure->string (constantly "#<procedure>"))' \ -i -s r4rstest.scm >r4rstest.log diff $DIFF_OPTS r4rstest.out r4rstest.log diff --git a/tests/test-irregex.scm b/tests/test-irregex.scm index 57b65596..70786392 100644 --- a/tests/test-irregex.scm +++ b/tests/test-irregex.scm @@ -1,7 +1,7 @@ ;;;: test-irregex.scm -(use irregex ports) +(use data-structures irregex ports) (include "test.scm") diff --git a/tests/version-tests.scm b/tests/version-tests.scm index 09769846..851850c8 100644 --- a/tests/version-tests.scm +++ b/tests/version-tests.scm @@ -1,4 +1,4 @@ -(use irregex) +(use data-structures irregex) (let* ((version-tokens (string-split (chicken-version) ".")) (major (string->number (car version-tokens))) diff --git a/types.db b/types.db index 4b1945ec..63c64fd7 100644 --- a/types.db +++ b/types.db @@ -1400,77 +1400,77 @@ ;; data-structures -(->string (procedure ->string (*) string) +(chicken.data-structures#->string (procedure chicken.data-structures#->string (*) string) ((string) #(1))) -(alist-ref (#(procedure #:clean #:enforce #:foldable) alist-ref (* (list-of pair) #!optional (procedure (* *) *) *) *)) -(alist-update! (#(procedure #:enforce) alist-update! (* * (list-of pair) #!optional (procedure (* *) *)) *)) -(alist-update (#(procedure #:clean #:enforce #:foldable) alist-update (* * (list-of pair) #!optional (procedure (* *) *) *) *)) +(chicken.data-structures#alist-ref (#(procedure #:clean #:enforce #:foldable) chicken.data-structures#alist-ref (* (list-of pair) #!optional (procedure (* *) *) *) *)) +(chicken.data-structures#alist-update! (#(procedure #:enforce) chicken.data-structures#alist-update! (* * (list-of pair) #!optional (procedure (* *) *)) *)) +(chicken.data-structures#alist-update (#(procedure #:clean #:enforce #:foldable) chicken.data-structures#alist-update (* * (list-of pair) #!optional (procedure (* *) *) *) *)) -(any? (#(procedure #:pure #:foldable) any? (*) boolean) +(chicken.data-structures#any? (#(procedure #:pure #:foldable) chicken.data-structures#any? (*) boolean) ((*) (let ((#(tmp) #(1))) '#t))) -(atom? (#(procedure #:pure #:foldable) atom? (*) boolean) +(chicken.data-structures#atom? (#(procedure #:pure #:foldable) chicken.data-structures#atom? (*) boolean) ((pair) (let ((#(tmp) #(1))) '#f)) (((not (or pair list))) (let ((#(tmp) #(1))) '#t))) -(butlast (forall (a) (#(procedure #:clean #:enforce) butlast ((pair a *)) (list-of a)))) -(chop (forall (a) (#(procedure #:clean #:enforce) chop ((list-of a) fixnum) (list-of a)))) -(complement (#(procedure #:clean #:enforce) complement ((procedure (#!rest) *)) (procedure (#!rest) boolean))) -(compose (#(procedure #:clean #:enforce) compose (#!rest procedure) procedure)) -(compress (forall (a) (#(procedure #:clean #:enforce) compress (list (list-of a)) (list-of a)))) -(conc (procedure conc (#!rest) string)) -(conjoin (#(procedure #:clean #:enforce) conjoin (#!rest (procedure (*) *)) (procedure (*) *))) -(constantly (forall (a) (#(procedure #:pure) constantly (a) (procedure (#!rest) a)))) -(disjoin (#(procedure #:clean #:enforce) disjoin (#!rest (procedure (*) *)) (procedure (*) *))) -(each (#(procedure #:clean #:enforce) each (#!rest procedure) procedure)) -(flatten (#(procedure #:clean #:enforce) flatten (#!rest *) list)) -(flip (#(procedure #:clean #:enforce) flip ((procedure (* *) . *)) (procedure (* *) . *))) -(identity (forall (a) (#(procedure #:pure #:foldable) identity (a) a))) -(intersperse (#(procedure #:clean #:enforce) intersperse (list *) list)) -(join (#(procedure #:clean #:enforce) join ((list-of list) #!optional list) list)) -(list-of? (#(procedure #:clean #:enforce) list-of? ((procedure (*) *)) (procedure (list) boolean))) - -(merge +(chicken.data-structures#butlast (forall (a) (#(procedure #:clean #:enforce) chicken.data-structures#butlast ((pair a *)) (list-of a)))) +(chicken.data-structures#chop (forall (a) (#(procedure #:clean #:enforce) chicken.data-structures#chop ((list-of a) fixnum) (list-of a)))) +(chicken.data-structures#complement (#(procedure #:clean #:enforce) chicken.data-structures#complement ((procedure (#!rest) *)) (procedure (#!rest) boolean))) +(chicken.data-structures#compose (#(procedure #:clean #:enforce) chicken.data-structures#compose (#!rest procedure) procedure)) +(chicken.data-structures#compress (forall (a) (#(procedure #:clean #:enforce) chicken.data-structures#compress (list (list-of a)) (list-of a)))) +(chicken.data-structures#conc (procedure chicken.data-structures#conc (#!rest) string)) +(chicken.data-structures#conjoin (#(procedure #:clean #:enforce) chicken.data-structures#conjoin (#!rest (procedure (*) *)) (procedure (*) *))) +(chicken.data-structures#constantly (forall (a) (#(procedure #:pure) chicken.data-structures#constantly (a) (procedure (#!rest) a)))) +(chicken.data-structures#disjoin (#(procedure #:clean #:enforce) chicken.data-structures#disjoin (#!rest (procedure (*) *)) (procedure (*) *))) +(chicken.data-structures#each (#(procedure #:clean #:enforce) chicken.data-structures#each (#!rest procedure) procedure)) +(chicken.data-structures#flatten (#(procedure #:clean #:enforce) chicken.data-structures#flatten (#!rest *) list)) +(chicken.data-structures#flip (#(procedure #:clean #:enforce) chicken.data-structures#flip ((procedure (* *) . *)) (procedure (* *) . *))) +(chicken.data-structures#identity (forall (a) (#(procedure #:pure #:foldable) chicken.data-structures#identity (a) a))) +(chicken.data-structures#intersperse (#(procedure #:clean #:enforce) chicken.data-structures#intersperse (list *) list)) +(chicken.data-structures#join (#(procedure #:clean #:enforce) chicken.data-structures#join ((list-of list) #!optional list) list)) +(chicken.data-structures#list-of? (#(procedure #:clean #:enforce) chicken.data-structures#list-of? ((procedure (*) *)) (procedure (list) boolean))) + +(chicken.data-structures#merge (forall (e) - (#(procedure #:enforce) merge ((list-of e) (list-of e) (procedure (e e) *)) (list-of e)))) + (#(procedure #:enforce) chicken.data-structures#merge ((list-of e) (list-of e) (procedure (e e) *)) (list-of e)))) -(merge! +(chicken.data-structures#merge! (forall (e) - (#(procedure #:enforce) merge! ((list-of e) (list-of e) (procedure (e e) *)) (list-of e)))) + (#(procedure #:enforce) chicken.data-structures#merge! ((list-of e) (list-of e) (procedure (e e) *)) (list-of e)))) -(o (#(procedure #:clean #:enforce) o (#!rest (procedure (*) *)) (procedure (*) *))) +(chicken.data-structures#o (#(procedure #:clean #:enforce) chicken.data-structures#o (#!rest (procedure (*) *)) (procedure (*) *))) -(rassoc (#(procedure #:clean #:enforce #:foldable) rassoc (* (list-of pair) #!optional (procedure (* *) *)) *)) -(reverse-string-append (#(procedure #:clean #:enforce) reverse-string-append ((list-of string)) string)) +(chicken.data-structures#rassoc (#(procedure #:clean #:enforce #:foldable) chicken.data-structures#rassoc (* (list-of pair) #!optional (procedure (* *) *)) *)) +(chicken.data-structures#reverse-string-append (#(procedure #:clean #:enforce) chicken.data-structures#reverse-string-append ((list-of string)) string)) -(sort +(chicken.data-structures#sort (forall (e (s (or (vector-of e) (list-of e)))) - (#(procedure #:enforce) - sort - (s (procedure (e e) *)) + (#(procedure #:enforce) + chicken.data-structures#sort + (s (procedure (e e) *)) s))) -(sort! +(chicken.data-structures#sort! (forall (e (s (or (vector-of e) (list-of e)))) - (#(procedure #:enforce) - sort - (s (procedure (e e) *)) + (#(procedure #:enforce) + chicken.data-structures#sort! + (s (procedure (e e) *)) s))) -(sorted? (#(procedure #:enforce) sorted? ((or list vector) (procedure (* *) *)) boolean)) -(topological-sort (#(procedure #:enforce) topological-sort ((list-of list) (procedure (* *) *)) list)) -(string-chomp (#(procedure #:clean #:enforce) string-chomp (string #!optional string) string)) -(string-chop (#(procedure #:clean #:enforce) string-chop (string fixnum) (list-of string))) -(string-compare3 (#(procedure #:clean #:enforce) string-compare3 (string string) fixnum)) -(string-compare3-ci (#(procedure #:clean #:enforce) string-compare3-ci (string string) fixnum)) -(string-intersperse (#(procedure #:clean #:enforce) string-intersperse ((list-of string) #!optional string) string)) -(string-split (#(procedure #:clean #:enforce) string-split (string #!optional string *) (list-of string))) -(string-translate (#(procedure #:clean #:enforce) string-translate (string * #!optional *) string)) -(string-translate* (#(procedure #:clean #:enforce) string-translate* (string (list-of (pair string string))) string)) -(substring-ci=? (#(procedure #:clean #:enforce #:foldable) substring-ci=? (string string #!optional fixnum fixnum fixnum) boolean)) - -(substring-index (#(procedure #:clean #:enforce #:foldable) substring-index (string string #!optional fixnum) (or false fixnum)) +(chicken.data-structures#sorted? (#(procedure #:enforce) chicken.data-structures#sorted? ((or list vector) (procedure (* *) *)) boolean)) +(chicken.data-structures#topological-sort (#(procedure #:enforce) chicken.data-structures#topological-sort ((list-of list) (procedure (* *) *)) list)) +(chicken.data-structures#string-chomp (#(procedure #:clean #:enforce) chicken.data-structures#string-chomp (string #!optional string) string)) +(chicken.data-structures#string-chop (#(procedure #:clean #:enforce) chicken.data-structures#string-chop (string fixnum) (list-of string))) +(chicken.data-structures#string-compare3 (#(procedure #:clean #:enforce) chicken.data-structures#string-compare3 (string string) fixnum)) +(chicken.data-structures#string-compare3-ci (#(procedure #:clean #:enforce) chicken.data-structures#string-compare3-ci (string string) fixnum)) +(chicken.data-structures#string-intersperse (#(procedure #:clean #:enforce) chicken.data-structures#string-intersperse ((list-of string) #!optional string) string)) +(chicken.data-structures#string-split (#(procedure #:clean #:enforce) chicken.data-structures#string-split (string #!optional string *) (list-of string))) +(chicken.data-structures#string-translate (#(procedure #:clean #:enforce) chicken.data-structures#string-translate (string * #!optional *) string)) +(chicken.data-structures#string-translate* (#(procedure #:clean #:enforce) chicken.data-structures#string-translate* (string (list-of (pair string string))) string)) +(chicken.data-structures#substring-ci=? (#(procedure #:clean #:enforce #:foldable) chicken.data-structures#substring-ci=? (string string #!optional fixnum fixnum fixnum) boolean)) + +(chicken.data-structures#substring-index (#(procedure #:clean #:enforce #:foldable) chicken.data-structures#substring-index (string string #!optional fixnum) (or false fixnum)) ((* *) (##sys#substring-index #(1) #(2) '0)) ((* * *) (##sys#substring-index #(1) #(2) #(3)))) @@ -1479,7 +1479,7 @@ (string string fixnum) (or false fixnum))) -(substring-index-ci (#(procedure #:clean #:enforce #:foldable) substring-index-ci (string string #!optional fixnum) (or false fixnum)) +(chicken.data-structures#substring-index-ci (#(procedure #:clean #:enforce #:foldable) chicken.data-structures#substring-index-ci (string string #!optional fixnum) (or false fixnum)) ((* *) (##sys#substring-index-ci #(1) #(2) '0)) ((* * *) (##sys#substring-index-ci #(1) #(2) #(3)))) @@ -1488,8 +1488,8 @@ (string string fixnum) (or false fixnum))) -(substring=? (#(procedure #:clean #:enforce #:foldable) substring=? (string string #!optional fixnum fixnum fixnum) boolean)) -(tail? (#(procedure #:clean) tail? (* *) boolean)) +(chicken.data-structures#substring=? (#(procedure #:clean #:enforce #:foldable) chicken.data-structures#substring=? (string string #!optional fixnum fixnum fixnum) boolean)) +(chicken.data-structures#tail? (#(procedure #:clean) chicken.data-structures#tail? (* *) boolean)) ;; extras diff --git a/utils.scm b/utils.scm index f3c1e9c2..01821db2 100644 --- a/utils.scm +++ b/utils.scm @@ -41,7 +41,8 @@ qs) (import scheme chicken) -(import data-structures extras files foreign irregex posix) +(import extras files foreign irregex posix) +(import chicken.data-structures) (include "common-declarations.scm")Trap