summaryrefslogtreecommitdiff
path: root/module/srfi
AgeCommit message (Collapse)AuthorFilesLines
2014-01-24Implement SRFI-111 Boxes.Mark H Weaver1-0/+37
* module/srfi/srfi-111.scm: New file. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-111.scm. * test-suite/tests/srfi-111.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-111.test. * doc/ref/srfi-modules.texi (SRFI-111): New node.
2014-01-23Improve correctness and consistency of 'eval-when' usage.Mark H Weaver1-1/+1
* module/ice-9/boot-9.scm: * module/ice-9/i18n.scm: * module/ice-9/poll.scm: * module/ice-9/popen.scm: * module/ice-9/r6rs-libraries.scm: * module/oop/goops.scm: * module/oop/goops/compile.scm: * module/oop/goops/dispatch.scm: * module/srfi/srfi-88.scm: * module/system/foreign.scm: * module/texinfo/serialize.scm: Change most uses of 'compile' to 'expand', except where we must avoid it during initial bootstrap before the module system is loaded. Remove redundant uses of 'compile' where 'expand' is also given. Standardize on the "(expand load eval)" order of conditions.
2014-01-14Merge branch 'stable-2.0'Mark H Weaver1-4/+2
Conflicts: libguile/chars.c libguile/read.c test-suite/tests/reader.test
2014-01-14Add srfi-16 and srfi-30 to %cond-expand-features.Mark H Weaver1-4/+2
* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-16 and srfi-30. * doc/ref/srfi-modules.texi (SRFI-0): Add srfi-16 and srfi-30 to the list of core features. * module/srfi/srfi-16.scm: Remove call to 'cond-expand-provide'.
2013-11-10Effects analysis sees match-error, throw-bad-structs as bailoutsAndy Wingo1-0/+1
* module/language/tree-il/effects.scm (make-effects-analyzer): Allow module-ref calls to be treated as bailouts, if the procedure has the "definite-bailout?" property. Perhaps this should be renamed. * module/ice-9/match.upstream.scm (match-error): * module/srfi/srfi-9.scm (throw-bad-struct): Give these procedures the definite-bailout? property.
2013-09-13Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-1/+4
Conflicts: module/srfi/srfi-9.scm module/web/server.scm
2013-09-12Adapt srfi-9.test to error reporting improvements; update copyright dates.Mark H Weaver1-1/+2
* module/srfi/srfi-9.scm: Add 2013 copyright date. * test-suite/tests/srfi-9.test: Adapt to recent error reporting improvements to procedures defined by 'define-tagged-inlinable'.
2013-09-12Improve error reporting of procedures defined by define-inlinable.Mark H Weaver1-0/+2
* module/ice-9/boot-9.scm (define-inlinable): Improve error reporting when procedures defined using 'define-inlinable' are applied to the wrong number of arguments. * module/srfi/srfi-9.scm (define-tagged-inlinable): Improve error reporting when procedures defined using 'define-tagged-inlinable' are applied to the wrong number of arguments.
2013-08-07String ports use UTF-8; ignore %default-port-encoding.Mark H Weaver1-17/+3
* libguile/strports.c (scm_mkstrport): Use UTF-8; ignore %default-port-encoding. Rename 'str_len' and 'c_pos' to 'num_bytes' and 'c_byte_pos'. Interpret 'pos' argument as a character index instead of a byte index. * module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-6 to the list of core features. * module/srfi/srfi-6.scm (open-input-string, open-output-string): Simply re-export these, since the core versions are now compliant. * doc/ref/api-io.texi (String Ports): Remove text that describes non-compliant behavior of string ports with regard to encoding. * doc/ref/srfi-modules.texi (SRFI-0): Add srfi-6 to the list of core features. (SRFI-6): Remove text that mentions non-compliant behavior of core string ports. * module/ice-9/format.scm (format): * module/ice-9/pretty-print.scm (truncated-print): * module/rnrs/io/ports.scm (open-string-input-port, open-string-output-port): * test-suite/test-suite/lib.scm (format-test-name): * test-suite/tests/chars.test ("combining accent is pretty-printed", "combining X is pretty-printed"): * test-suite/tests/ecmascript.test (eread, eread/1): * test-suite/tests/rdelim.test: * test-suite/tests/reader.test (read-string): * test-suite/tests/regexp.test: * test-suite/tests/srfi-105.test (read-string): Don't set %default-port-encoding before creating string ports. * benchmark-suite/benchmarks/ports.bm (%latin1-port): Use 'set-port-encoding!' to set the string port encoding. (%utf8/ascii-port, %utf8/wide-port, "rdelim"): Don't set %default-port-encoding before creating string ports. * test-suite/tests/r6rs-ports.test ("lookahead-u8 non-ASCII"): Don't set %default-port-encoding before creating string ports. ("put-bytevector with UTF-16 string port", "put-bytevector with wrong-encoding string port"): Use 'set-port-encoding!' to set the string port encoding. * test-suite/tests/print.test (tprint): Use 'set-port-encoding!' to set the string port encoding. ("truncated-print"): Use 'pass-if-equal'. * test-suite/tests/ports.test ("encoding failure leads to exception", "%default-port-encoding is honored", "peek-char [latin-1]", "peek-char [utf-8]", "peek-char [utf-16]"): Remove tests. ("%default-port-encoding is ignored", "peek-char"): Add tests. ("suitable encoding [latin-1]", "suitable encoding [latin-3]", "wrong encoding, error", "wrong encoding, substitute", "wrong encoding, escape"): Use 'set-port-encoding!' to set the string port encoding. ("%default-port-encoding, wrong encoding"): Rewrite to use a file port instead of a string port.
2013-07-21Use allocate-struct in define-record-type implementationsAndy Wingo1-28/+34
* module/ice-9/boot-9.scm (iota): Move up. (make-record-type, define-record-type): Use allocate-struct and struct-set!. * module/srfi/srfi-9.scm (%%set-fields, %define-record-type): Use allocate-struct and struct-set!. Note that this makes the stack VM slower, but it will make RTL compilation faster.
2013-04-14Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2-2/+40
Conflicts: GUILE-VERSION libguile/array-map.c libguile/fports.h libguile/gc.h libguile/inline.h libguile/ports.c libguile/ports.h libguile/print.c libguile/r6rs-ports.c libguile/read.c test-suite/tests/00-socket.test
2013-04-07Add record type printer for srfi-41.Chris K. Jester-Young1-0/+23
* module/srfi/srfi-41.scm: Add record type printer for streams. (stream-promise-visit): New helper for visiting stream promises.
2013-04-07Add record type printer for srfi-45.Chris K. Jester-Young1-1/+16
* module/srfi/srfi-45.scm: Add record type printer for promises. (promise-visit): New helper for visiting lazy promises.
2013-04-06Use a fresh cons for %stream-null.Chris K. Jester-Young1-1/+1
* module/srfi/srfi-41.scm (%stream-null): Use a fresh cons rather than a literal cons. You never know what peval constant-folding could do with the latter, either now or in the future.
2013-04-05Revert "Add record type printers for srfi-41 and srfi-45."Chris K. Jester-Young2-29/+2
This reverts commit 4a1cdc9d5d643d05fa7a18febc7c12070f3ef6d9, which was prematurely pushed.
2013-04-04Add record type printers for srfi-41 and srfi-45.Chris K. Jester-Young2-2/+29
* module/srfi/srfi-41.scm: Add record type printer for streams. * module/srfi/srfi-45.scm: Add record type printer for promises.
2013-03-28Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver11-7/+507
Conflicts: configure.ac libguile/deprecated.c libguile/deprecated.h libguile/filesys.h libguile/fluids.c libguile/fports.c libguile/gc.c libguile/guile.c libguile/numbers.c libguile/objcodes.c libguile/r6rs-ports.c libguile/smob.c libguile/socket.c libguile/threads.h module/language/scheme/decompile-tree-il.scm module/language/tree-il/peval.scm test-suite/tests/syncase.test
2013-03-27Add SRFI-41.Chris K. Jester-Young1-0/+482
Incorporates suggestions from Mark H Weaver <mhw@netris.org> and Ian Price <ianprice90@googlemail.com>. * module/srfi/srfi-41.scm: New file. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-41.scm. * test-suite/tests/srfi-41.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-41.test. * doc/ref/srfi-modules.texi (SRFI Support): Add SRFI-41. (SRFI-41): New node which refers the reader to <http://srfi.schemers.org/srfi-41/srfi-41.html>.
2013-03-26SRFI-45: add promise? predicate.Mark H Weaver1-5/+6
* module/srfi/srfi-45.scm (promise?): Export. * doc/ref/srfi-modules.texi (SRFI-45): Update docs. * test-suite/tests/srfi-45.test: Add test. Add FSF copyright for 2010 and 2013. Add missing year to André van Tonder's copyright notice.
2013-03-26Revert "SRFI-45: Support multiple values; add promise? predicate."Mark H Weaver1-12/+9
This reverts commit 1d64b4edb9da4011ad06c0fab1c6225ec20b0876.
2013-03-25SRFI-37: Fix infinite loop when processing short option with no required arg.Ludovic Courtès1-1/+4
Fixes <http://bugs.gnu.org/13176>. * module/srfi/srfi-37.scm (args-fold)[short-option-argument]: When ARGS is a pair, always set it to its cdr. * test-suite/tests/srfi-37.test ("SRFI-37")["short option with optional argument omitted", "short option with optional argument provided"]: New tests.
2013-03-21Add missing 'cond-expand' feature identifiers; remove srfi-6 from core list.Mark H Weaver9-1/+15
* module/ice-9/boot-9.scm (%cond-expand-features): Remove redundant list of feature identifiers in the comment. Explain more clearly what belongs in this list. Remove srfi-6. * module/srfi/srfi-4.scm, module/srfi/srfi-27.scm, module/srfi/srfi-31.scm, module/srfi/srfi-38.scm, module/srfi/srfi-39.scm, module/srfi/srfi-42.scm, module/srfi/srfi-45.scm, module/srfi/srfi-67.scm: Add missing 'cond-expand-provide'. * module/srfi/srfi-69.scm: Fix erroneous 'cond-expand-provide'. * doc/ref/srfi-modules.texi (SRFI-0): Update the list of features in Guile core.
2013-03-19SRFI-45: Support multiple values; add promise? predicate.Mark H Weaver1-9/+12
* module/srfi/srfi-45.scm (eager): Accept any number of arguments. Store the list of arguments in the value record. Previously, only one argument was accepted, and that value was stored in the value record. (delay): Support expressions that return any number of arguments. (force): Return the list of values stored in the value record. (promise?): Export. * doc/ref/srfi-modules.texi (SRFI-45): Update docs. Remove typing for simplicity in discussing multiple values. * test-suite/tests/srfi-45.test: Add tests. Add FSF copyright for 2010 and 2013. Add missing year to André van Tonder's copyright notice.
2013-02-18Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-4/+4
Conflicts: libguile/array-handle.c libguile/deprecated.h libguile/inline.c libguile/inline.h module/ice-9/deprecated.scm module/language/tree-il/peval.scm
2013-02-18deprecate generalized vectors in favor of arraysAndy Wingo1-4/+4
* libguile/generalized-arrays.h: * libguile/generalized-arrays.c (scm_c_array_length): (scm_array_length): New functions. * module/ice-9/deprecated.scm: * libguile/generalized-vectors.c: * libguile/generalized-vectors.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_generalized_vector_p) (scm_generalized_vector_length, scm_generalized_vector_ref) (scm_generalized_vector_set_x, scm_generalized_vector_to_list): Deprecate. * libguile/uniform.c (scm_uniform_vector_to_list): Use scm_array_to_list. * module/ice-9/boot-9.scm (case): Arrays are generalized vectors. * module/srfi/srfi-4/gnu.scm (define-any->vector): Use the array functions instead of the generalized-vector functions. * test-suite/tests/arrays.test: Remove generalized-vector->list test; covered by array->list test. * test-suite/tests/bitvectors.test: * test-suite/tests/bytevectors.test: * test-suite/tests/srfi-4.test: Adapt to test using array interfaces instead of generalized-vector interfaces. * doc/ref/api-compound.texi: Remove generalized vector docs. * doc/ref/api-data.texi: * doc/ref/srfi-modules.texi: Adapt.
2013-01-07Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-3/+3
Conflicts: GUILE-VERSION libguile/posix.c module/ice-9/eval.scm test-suite/tests/cse.test
2012-11-17doc: Fix typo in `set-record-type-printer!' doc.Ludovic Courtès1-3/+3
* module/srfi/srfi-9/gnu.scm (set-record-type-printer!): Change the parameter name to `proc'. * doc/ref/api-compound.texi (SRFI-9 Records): Update accordingly.
2012-11-10Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2-28/+75
2012-11-10Change the argument order of 'set-fields' to match that of 'set-fields'.Mark H Weaver1-2/+2
* module/srfi/srfi-9/gnu.scm (set-fields): Swap order of first two arguments. * test-suite/tests/srfi-9.test: Update tests.
2012-11-10Improve error for set-fields paths leading to different types.Mark H Weaver2-26/+73
* module/system/base/ck.scm: New module. * module/srfi/srfi-9.scm: Import (system base ck). (getter-type, getter-index, getter-copier): Convert incoming argument convention to CK form. (define-tagged-inlinable): Convert return value convention for key lookup to CK form. * module/srfi/srfi-9/gnu.scm: Import (system base ck). Rename '%set-fields-unknown-getter' to 'unknown-getter'. (c-list, c-same-type-check): New macros. (%set-fields): Using the CK abstract machine, arrange to check (at macro expansion time) that all of the getters in head position correspond to the same record type. * test-suite/tests/srfi-9.test: Add test.
2012-11-09Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2-8/+40
2012-11-09Improve error messages for invalid record definitions.Mark H Weaver2-8/+40
* module/srfi/srfi-9.scm (%define-record-type): Accept additional 'form' parameter which contains the original form of 'define-record-type' or 'define-immutable-record-type'. Add elaborate pattern guard which raises descriptive syntax errors for specific errors, and a fallback pattern to catch anything else. (define-record-type): Pass 'form' parameter to %define-record-type. * module/srfi/srfi-9/gnu.scm (define-immutable-record-type): Pass 'form' parameter to %define-record-type. * test-suite/tests/srfi-9.test: Add tests.
2012-11-08Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2-83/+269
2012-11-08Implement functional record setters.Mark H Weaver2-83/+269
Written in collaboration with Ludovic Courtès <ludo@gnu.org> * module/srfi/srfi-9.scm: Internally, rename 'accessor' to 'getter' and 'modifier' to 'setter'. (define-tagged-inlinable, getter-type, getter-index, getter-copier, %%on-error, %%set-fields): New macros. (%define-record-type): New macro for creating both mutable and immutable records, and containing a substantially rewritten version of the code formerly in 'define-record-type'. (define-record-type): Now just a wrapper for '%define-record-type'. (throw-bad-struct, make-copier-id): New procedures. * module/srfi/srfi-9/gnu.scm (define-immutable-record-type, set-field, and set-fields): New exported macros. (collate-set-field-specs): New procedure. (%set-fields-unknown-getter, %set-fields): New macros. * test-suite/tests/srfi-9.test: Add tests. Rename getters and setters in existing tests to make the functional setters look better.
2012-10-30Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2-18/+16
Moved scm_i_struct_hash from struct.c to hash.c and made it static. The port's alist is now a field of 'scm_t_port'. Conflicts: libguile/arrays.c libguile/hash.c libguile/ports.c libguile/print.h libguile/read.c
2012-09-11Rewrite SRFI-31 in terms of `syntax-rules'.Ludovic Courtès1-14/+12
* module/srfi/srfi-31.scm: Use `#:export' instead of `#:export-syntax'. (rec): Rewrite using `syntax-rules'. * test-suite/tests/srfi-31.test ("rec special form"): Change exception type to EXCEPTION:SYNTAX-PATTERN-UNMATCHED.
2012-08-27ISO 8601 time format specifies zero padding for hours, not blank padding.Ian Price1-4/+4
* doc/ref/srfi-modules.texi ("SRFI-19 Date to string"): Fix iso 8601 format strings. * module/srfi/srfi-19.scm (directives): Fix iso 8601 format strings.
2012-07-06simplify %condition-type-vtableAndy Wingo1-8/+8
* module/srfi/srfi-35.scm (%condition-type-vtable): Use make-vtable instead of make-vtable-vtable.
2012-06-22Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-4/+14
Conflicts: libguile/deprecated.c libguile/ports.c libguile/ports.h libguile/strports.c test-suite/tests/cse.test
2012-06-20Make SRFI-6 string ports Unicode-capable.Ludovic Courtès1-4/+14
Partly addresses <http://bugs.gnu.org/11197>. Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>. * module/srfi/srfi-6.scm (open-input-string, open-output-string): New procedures. * test-suite/tests/srfi-6.test ("open-input-string")["read-char, Unicode"]: New test. ("open-output-string")["λ"]: New test.
2012-04-26Merge commit 'd10f7b572c0ca1ccef87f9c46069daa30946e0cf'Andy Wingo1-4/+8
Conflicts: libguile/smob.c libguile/smob.h test-suite/tests/tree-il.test
2012-04-10SRFI-9: Set the `record-constructor' slot of the RTD.Ludovic Courtès1-4/+8
Fixed <http://bugs.gnu.org/11196>. Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>. * module/srfi/srfi-9.scm (define-record-type): Define the contructor before TYPE-NAME. Set RTD's constructor field. * test-suite/tests/srfi-9.test ("record compatibility"): New test prefix.
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