summaryrefslogtreecommitdiff
path: root/module/srfi
AgeCommit message (Collapse)AuthorFilesLines
2012-03-02Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2-4/+7
There are a some failures currently: FAIL: tree-il.test: warnings: format: non-literal format string with forward declaration ERROR: srfi-18.test: current-exception-handler: current handler returned at top level - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>))) ERROR: srfi-18.test: current-exception-handler: multiple levels of handler nesting - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>))) ERROR: srfi-18.test: current-exception-handler: exception handler installation is thread-safe - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>))) Conflicts: module/language/tree-il/peval.scm module/language/tree-il/primitives.scm test-suite/tests/tree-il.test
2012-03-01Fix <TAG>vector-length when applied to other uniform vector typesMark H Weaver2-4/+7
* module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm (define-bytevector-type): Fix definition of <TAG>vector-length when applied to uniform vectors of different element sizes. Thanks to Tobias Brandt <tob.brandt@googlemail.com> for reporting this bug. * test-suite/tests/srfi-4.test: Add tests.
2012-02-24srfi-18 cleanupAndy Wingo1-13/+13
* module/srfi/srfi-18.scm (with-exception-handler): (thread-join!, mutex-lock!, mutex-unlock!): Avoid useless invocations of `apply'.
2012-01-10Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+1
Conflicts: libguile/__scm.h libguile/array-map.c libguile/procprop.c libguile/tags.h module/ice-9/deprecated.scm module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm test-suite/standalone/test-num2integral.c test-suite/tests/regexp.test
2012-01-05Placate a number of `syntax-check' verifications.Ludovic Courtès1-1/+1
- "filesystem" -> "file system" - remove doubled words - use EXIT_* macros instead of literal numbers - update `syntax-check' exclusion files
2011-12-13Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-93/+8
Conflicts: configure.ac
2011-12-10current-input-port et al are srfi-39 parametersAndy Wingo1-93/+8
* libguile/ports.c (scm_init_ports): Export the port fluids to Scheme, temporarily. * module/ice-9/boot-9.scm (fluid->parameter): Turn `current-input-port' et al into srfi-39 parameters, backed by the exported fluids, then remove the fluids from the guile module. (%cond-expand-features): Add srfi-39. * module/srfi/srfi-39.scm: Re-export features from boot-9. * test-suite/tests/parameters.test: Add tests.
2011-12-01Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-23/+27
Conflicts: configure.ac libguile/fluids.c libguile/gc.c libguile/gc.h libguile/objcodes.c libguile/procprop.c libguile/vm.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm
2011-11-24simplify %condition-type-vtableAndy Wingo1-8/+8
* module/srfi/srfi-35.scm (%condition-type-vtable): Use make-vtable instead of make-vtable-vtable.
2011-11-23Use default value for make-fluid in Scheme filesAndy Wingo1-23/+27
* module/ice-9/boot-9.scm (%exception-handler) (%running-exception-handlers, read-eval?, *repl-stack*) (make-mutable-parameter): * module/ice-9/getopt-long.scm (%program-name): * module/language/elisp/runtime.scm (built-in-macro, defspecial): * module/srfi/srfi-39.scm (make-parameter/helper): * module/system/base/language.scm (*current-language*): * module/system/base/message.scm (*current-warning-port*): (*current-warning-prefix*): * module/system/base/target.scm (%target-type, %target-endianness) (%target-word-size): * module/texinfo/plain-text.scm (*indent*, *itemizer*): * benchmark-suite/lib.scm (prefix-fluid): * test-suite/lib.scm (prefix-fluid): Give fluids a useful default value.
2011-09-02fix srfi-67 compilationAndy Wingo1-5/+5
* module/srfi/srfi-67/compare.scm: Fix define-syntax-rule conversion.
2011-09-02more define-syntax-rule usageAndy Wingo5-143/+111
* module/ice-9/boot-9.scm: * module/ice-9/control.scm: * module/ice-9/futures.scm: * module/ice-9/optargs.scm: * module/ice-9/poll.scm: * module/ice-9/receive.scm: * module/ice-9/threads.scm: * module/ice-9/vlist.scm: * module/language/assembly/compile-bytecode.scm: * module/language/ecmascript/compile-tree-il.scm: * module/language/tree-il.scm: * module/oop/goops.scm: * module/oop/goops/simple.scm: * module/oop/goops/stklos.scm: * module/srfi/srfi-1.scm: * module/srfi/srfi-35.scm: * module/srfi/srfi-39.scm: * module/srfi/srfi-45.scm: * module/srfi/srfi-67/compare.scm: * module/sxml/match.scm: * module/system/repl/error-handling.scm: * module/system/repl/repl.scm: * module/system/vm/inspect.scm: * module/texinfo.scm: * module/web/server.scm: Use define-syntax-rule, where it makes sense.
2011-08-17check that srfi-1 procedure arguments are proceduresAndy Wingo1-12/+65
* module/srfi/srfi-1.scm (check-arg, wrong-type-arg): Refactor arg type checkers to be macros, and do the minimal amount of work in the functions themselves. Use these checkers consistently for all procedure arguments in this module. This catches user errors early; see bug 33628.
2011-08-17srfi-9 record compatibility with boot-9 recordsAndy Wingo1-10/+22
* module/srfi/srfi-9.scm (define-record-type): Instead of defining the RTD using make-vtable, use make-struct with the record-type-vtable, and record the type name and fields names in the vtable. This way SRFI-9 records are compatible with boot-9 records. Also we use a generic printer, instead of generating one anew.
2011-08-12fix take-right and drop-right for improper listsAndy Wingo1-0/+16
* libguile/srfi-1.h: * libguile/srfi-1.c (scm_srfi1_drop_right, scm_srfi1_take_right): Remove these internal functions, replacing with Scheme implementations. * module/srfi/srfi-1.scm (take-right, drop-right): Add these impls from the reference code. They do the right thing for improper lists, according to the spec, but they diverge for circular lists. Oh well. * test-suite/tests/srfi-1.test ("drop-right", "take-right"): Add more tests.
2011-08-04srfi-19 refactorAndy Wingo1-263/+259
* module/srfi/srfi-19.scm (priv:locale-number-separator, priv:locale-am) (priv:locale-am): Inline definitions. Strip priv: prefix from module vars, as it's unnecessary, except for in a couple cases.
2011-05-07fix srfi-1 map-in-order definitionAndy Wingo1-0/+2
* module/srfi/srfi-1.scm (map-in-order): As we are not extending the core `map' binding, actually make a new `map-in-order' alias here. Fixes fresh builds.
2011-05-05map and for-each in schemeAndy Wingo1-30/+99
* module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead of C. There are boot versions before `cond' is defined. (map-in-order): Define this alias here instead of in evalext.h. * libguile/eval.c: Stub out the map and for-each definitions to just call into Scheme. * libguile/evalext.c: Remove map-in-order definition. * module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map. (map, for-each): Define implementations here, in Scheme, instead of in C. * test-suite/tests/eval.test (exception:wrong-length, "map"): Update the expected exception for mapping over lists of different lengths. * libguile/srfi-1.h: * libguile/srfi-1.c: Remove map and for-each definitions. Remove the bit that extended the core `map' primitive with another method: the right way to do that is with modules.
2011-05-05srfi-1 `member' in scheme, inlines to memq / memv in some casesAndy Wingo1-23/+52
* libguile/srfi-1.c: * libguile/srfi-1.h (scm_srfi1_member): Move implementation to Scheme. * module/srfi/srfi-1.scm (member): Implement here, with the inlining cases for eq? and eqv?. Speeds up a compiled bootstrap of psyntax.scm, because lset-adjoin inlines to the memq case. (lset<=): Reindent. (lset-adjoin, lset-union): If the comparator is eq? or eqv?, just pass it through to `member', so we inline to memq / memv. Use something closer to the reference implementations.
2011-04-27Keep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9).Ludovic Courtès1-0/+31
Partially reverts 165b10ddfaaa8ecc72d45a9be7d29e7537dc2379 and 531c9f1dc51c4801c4d031ee80a31f15285a6b85. * module/srfi/srfi-9.scm (define-inlinable): New macro.
2011-04-07Move `define-inlinable' into the default namespaceAndreas Rottmann1-32/+0
* module/ice-9/boot-9.scm (define-inlineable): Moved here from SRFI-9. * module/srfi/srfi-9 (define-inlinable): Removed here. * doc/ref/api-procedures.texi (Inlinable Procedures): Add subsection about `define-inlinable'.
2011-04-01fix c32vector-set!, c64vector-set!Andy Wingo1-5/+5
* module/srfi/srfi-4/gnu.scm (bytevector-c32-native-set!): (bytevector-c64-native-set!): Fix to actually allow complex numbers. * test-suite/tests/srfi-4.test: Add tests.
2011-03-11Fix `define-inlinable' in SRFI-9 so that arguments are evaluated only once.Ludovic Courtès1-3/+6
* module/srfi/srfi-9.scm (define-inlinable): When inlining, evaluate the arguments only once. Reported by Andreas Rottmann; thanks to Andy Wingo for the elegant solution. * test-suite/tests/srfi-9.test ("side-effecting arguments"): New test prefix.
2011-03-09Don't mix definitions and expressions in SRFI-9Andreas Rottmann1-3/+5
The expansion of `define-inlinable' contained an expression, which made SRFI-9's `define-record-type' fail in non-toplevel contexts ("definition used in expression context"). * module/srfi/srfi-9.scm (define-inlinable): Get rid of apparently useless expression in the expansion, so the expansion yields only definitions. At the same time, use a space in the generated names to lessen the chances of name conflicts, also avoiding -Wunused-toplevel warnings. * test-suite/tests/srfi-9.test (non-toplevel): New test verifying that `define-record-type' works in non-toplevel context as well. * doc/ref/srfi-modules.texi (SRFI-9 - define-record-type): Add subsubsection noting that Guile does not enforce top-levelness. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2010-12-07Get rid of `define-macro' in the SRFI 26 implementationAndreas Rottmann1-26/+43
* module/srfi/srfi-26.scm (cut, cute): Implement using `syntax-case'. The new implementation is mostly just a transcription of the old code; the reference implementation which relies only on `syntax-rules' may (or may not) be considered more elegant :-). Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2010-11-03Add implementation of SRFI 38Andreas Rottmann1-0/+206
* module/srfi/srfi-38.scm: New file, partly based on the reference implementation and on Alex Shinn's public-domain implementation for Chicken. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-38.scm. * test-suite/tests/srfi-38.test: New file, minimal test suite for SRFI 38. * test-suite/Makefile.am (SCM_TESTS): Added tests/srfi-38.test. * doc/ref/srfi-modules.texi: Add a node for SRFI 38. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2010-10-27Extend the #:replace list of the SRFI 69 moduleAndreas Rottmann1-1/+1
* module/srfi/srfi-69.scm: Add `make-hash-table' and `hash-table?' to the #:replace list of the module definition.
2010-10-14re-implement srfi-34's guard with syntax-caseAndy Wingo1-12/+16
* module/srfi/srfi-34.scm (guard): Re-implement using syntax-case.
2010-10-08SRFI-1: Rewrite `split-at' and `split-at!' in Scheme.Ludovic Courtès1-0/+28
This partially reverts commit bb560b9c16893f762699ba5a3109c8367fff8dfc (Tue Mar 15 2005). * module/srfi/srfi-1.scm (out-of-range, split-at, split-at!): New procedures. * libguile/srfi-1.c (scm_srfi1_split_at, scm_srfi1_split_at_x): Remove. * libguile/srfi-1.h (scm_srfi1_split_at, scm_srfi1_split_at_x): Ditto.
2010-10-08SRFI-1: Rewrite `filter-map' in Scheme.Ludovic Courtès1-0/+22
This partially reverts commit c16359466bcc3f2ebf6d750c069f787f629fc625 (Thu Mar 17 2005). * libguile/srfi-1.c (scm_srfi1_filter_map): Remove. * libguile/srfi-1.h (scm_srfi1_filter_map): Ditto. * module/srfi/srfi-1.scm (filter-map): New procedure.
2010-10-08SRFI-1: Make `fold-right' tail-recursive.Ludovic Courtès1-8/+12
* module/srfi/srfi-1.scm (fold-right): Make tail-recursive. * test-suite/tests/srfi-1.test ("fold-right"): New test prefix.
2010-10-08SRFI-1: Make `unfold' tail-recursive (fix bug #30071).Ludovic Courtès1-4/+13
* module/srfi/srfi-1.scm (unfold): Make tail-recursive, following a suggestion by Szavai Gyula. * test-suite/tests/srfi-1.test ("unfold"): New test prefix.
2010-10-03Add implementation of SRFI 45Andreas Rottmann1-0/+78
* module/srfi/srfi-45.scm: New file, containing the reference implementation of SRFI 45, slightly adapted to use SRFI-9. * module/Makefile.am (SRFI_SOURCES): Added srfi/srfi-45.scm. * test-suite/tests/srfi-45.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-45.test. * doc/ref/srfi-modules.texi (SRFI-45): New node and subsection; essentially a shortended transcript of the SRFI-45 specification.
2010-10-03srfi-67 #:replace workAndy Wingo1-2/+1
* module/srfi/srfi-67.scm (string-compare, string-compare-ci): #:replace these bindings.
2010-10-03Add implementation of SRFI-67Andreas Rottmann2-0/+794
* module/srfi/srfi-67/compare.scm: New file; reference implementation of SRFI 67. * module/srfi/srfi-67.scm: New module; includes the refernce implementation. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-67.scm. (NOCOMP_SOURCES): Add srfi/srfi-67/compare.scm. * test-suite/tests/srfi-67.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-67.test.
2010-10-03Add implementation of SRFI 42Andreas Rottmann2-0/+1117
* module/srfi/srfi-42/ec.scm: New file; reference implementation of SRFI 42. * module/srfi/srfi-42.scm: New file; module for SRFI 42. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-42.scm. (NOCOMP_SOURCES): Add srfi/srfi-42/ec.scm. * test-suite/tests/srfi-42.test: New file; test suite for SRFI 42. * test-suite/Makefile.am: SCM_TESTS: Add tests/srfi-42.test.
2010-09-27Add implementation of SRFI 27Andreas Rottmann1-0/+94
* module/srfi/srfi-27.scm: New file; implementation of SRFI 27 in terms of the existing random number generator. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-27.scm. * test-suite/tests/srfi-27.test: New file; minimal test suite for SRFI 27. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-27.test. * doc/ref/srfi-modules.texi: Add subsection on SRFI-27 based on the specification.
2010-09-20SRFI-1: Rewrite `alist-copy' in Scheme.Ludovic Courtès1-0/+9
This partially reverts commit b1fff4e793619b20342cba0015b9367680d3a0bd (Sat Apr 2 2005). * libguile/srfi-1.c (scm_srfi1_alist_copy): Remove. * libguile/srfi-1.h (scm_srfi1_alist_copy): Remove declaration. * module/srfi/srfi-1.scm (alist-copy): New procedure.
2010-09-12move srfi-1 and srfi-60 C impl to libguile, without public C apiAndy Wingo2-2/+4
* libguile/srfi-1.c: * libguile/srfi-1.h: * libguile/srfi-60.c: * libguile/srfi-60.h: * libguile/ChangeLog-srfi: Move here, from the srfi/ dir. The C API is internal. Add API to register the extensions, called by init.c. * libguile/init.c: Verily, register srfi extensions. * libguile/Makefile.am: Add srfi files. * module/srfi/srfi-1.scm: * module/srfi/srfi-60.scm: Update load-extension invocation. * Makefile.am: * configure.ac: Remove srfi/ dir. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-srfi-1.c: Remove srfi-1 C test, we don't support this API any more.
2010-09-02SRFI-1: Rewrite `drop-right!', `drop-while', `reduce', etc. in Scheme.Ludovic Courtès1-0/+127
This partially reverts commit e9508fbb7df0b1ead007637f16d80cf831776307 (May 3 2005). * module/srfi/srfi-1.scm (take!, drop-right!, reduce, reduce-right, take-while, take-while!, drop-while, span, span!, lset-adjoin): New procedures. * srfi/srfi-1.c (scm_srfi1_drop_right_x, scm_srfi1_drop_while, scm_srfi1_lset_adjoin, scm_srfi1_reduce, scm_srfi1_reduce_right, scm_srfi1_span, scm_srfi1_span_x, scm_srfi1_take_x, scm_srfi1_take_while, scm_srfi1_take_while_x): Rewrite as proxies to the corresponding Scheme procedures. * benchmark-suite/benchmarks/srfi-1.bm ("drop-while"): New benchmark prefix.
2010-08-27SRFI-1: Rewrite `break' and `break!' in Scheme.Ludovic Courtès1-0/+24
This partially reverts commit 6e9f3c2676c0101590d4229653e9c628cb293064 (Tue May 3 2005). * module/srfi/srfi-1.scm (break, break!): New procedures. * srfi/srfi-1.c (scm_srfi1_break, scm_srfi1_break_x): Rewrite as proxies to the corresponding Scheme procedures. * test-suite/standalone/test-srfi-1.c (failure): New function. (tests): Add `scm_srfi1_break' test. Use `failure'.
2010-08-27SRFI-1: Rewrite `fifth', `sixth', etc. in Scheme.Ludovic Courtès1-0/+6
This partially reverts commit 03731332d5dc8d650b947f5126427402c2b1d8bb (Tue May 3 2005). * module/srfi/srfi-1.scm (fifth, sixth, seventh, eighth, ninth, tenth): New procedures. * srfi/srfi-1.c (scm_srfi1_fifth, scm_srfi1_sixth, scm_srfi1_seventh, scm_srfi1_eighth, scm_srfi1_ninth, scm_srfi1_tenth): Rewrite as proxies to the corresponding Scheme procedure. * test-suite/tests/srfi-1.test ("eighth")["() -1"]: Change exception type to `exception:wrong-type-arg'. ("fifth")["() -1"]: Likewise. ("ninth")["() -1"]: Likewise. ("seventh")["() -1"]: Likewise. ("sixth")["() -1"]: Likewise. ("tenth")["() -1"]: Likewise.
2010-07-21Start rewriting SRFI-1 in Scheme.Ludovic Courtès1-2/+62
This partially reverts commit e556f8c3c6b74ee6596e8dcbe829109d7745da2c (Fri May 6 2005). * module/srfi/srfi-1.scm (xcons, list-tabulate, not-pair?, car+cdr, last, fold, list-index): New procedures. * srfi/srfi-1.c (srfi1_module): New variable. (CACHE_VAR): New macro. (scm_srfi1_car_plus_cdr, scm_srfi1_fold, scm_srfi1_last, scm_srfi1_list_index, scm_srfi1_list_tabulate, scm_srfi1_not_pair_p, scm_srfi1_xcons): Rewrite as proxies of the corresponding Scheme procedure. * test-suite/tests/srfi-1.test ("list-tabulate")["-1"]: Change exception type to `exception:wrong-type-arg'. * benchmark-suite/benchmarks/srfi-1.bm: New file. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/srfi-1.bm'. * test-suite/standalone/Makefile.am (test_srfi_1_SOURCES, test_srfi_1_CFLAGS, test_srfi_1_LDADD): New variables. (check_PROGRAMS): Add `test-srfi-1'. (TESTS): Ditto. * test-suite/standalone/test-srfi-1.c: New file.
2010-07-17recommend #:replaceAndy Wingo1-1/+1
* doc/ref/api-modules.texi (Creating Guile Modules): Update text to recommend #:replace. * module/srfi/srfi-19.scm (current-time): #:replace.
2010-06-28* module/srfi/srfi-60.scm (bit-count): #:replace core definition.Andy Wingo1-2/+2
2010-06-19Fix SRFI-9 for records without fieldsAndreas Rottmann1-0/+4
* module/srfi/srfi-9.scm (define-record-type): Deal with fieldless records. * test-suite/tests/srfi-9.test: Add a fieldless record definition.
2010-06-06srfi-34 #:replace raise fixAndy Wingo1-3/+3
* module/srfi/srfi-34.scm: #:replace the binding for `raise'
2010-06-01rename (rnrs bytevector) to (rnrs bytevectors)Andy Wingo2-3/+3
* module/rnrs/bytevectors.scm: Rename to (rnrs bytevectors), from (rnrs bytevector), to match the name from the R6RS. * benchmark-suite/benchmarks/bytevectors.bm: * doc/ref/api-data.texi: * doc/ref/api-foreign.texi: * libguile/bytevectors.c: * module/6/rnrs.scm: * module/language/assembly.scm: * module/language/assembly/compile-bytecode.scm: * module/language/assembly/decompile-bytecode.scm: * module/language/glil/compile-assembly.scm: * module/language/tree-il/primitives.scm: * module/srfi/srfi-4.scm: * module/srfi/srfi-4/gnu.scm: * module/system/foreign.scm: * test-suite/standalone/test-ffi: * test-suite/tests/asm-to-bytecode.test: * test-suite/tests/bytevectors.test: * test-suite/tests/foreign.test: * test-suite/tests/r6rs-ports.test: Update all referrers.
2010-05-27Record printer fixesNo Itisnt1-2/+3
* doc/ref/srfi-modules.texi: Fix style * module/srfi/srfi-9/gnu.scm (set-record-type-printer!): renamed from set-record-printer!
2010-05-25* doc/ref/srfi-modules.texi:No Itisnt1-5/+3
* module/srfi/srfi-9/gnu.scm: rename `define-record-printer' to `set-record-printer!' to reflect the fact that the printer is set at runtime