summaryrefslogtreecommitdiff
path: root/test-suite
AgeCommit message (Collapse)AuthorFilesLines
2016-05-18Fix sports.testAndy Wingo1-1/+2
* test-suite/tests/sports.test (include-tests): Fix encoding when reading ports.test.
2016-05-16Test Scheme port implementationAndy Wingo2-0/+52
* module/ice-9/ports.scm: Add port-decode-char to internals export list. * test-suite/Makefile.am: * test-suite/tests/sports.test: Add new test.
2016-05-16U+FFFD is the input substitution characterAndy Wingo3-4/+4
* libguile/ports.c (UNICODE_REPLACEMENT_CHARACTER): * libguile/ports.c (peek_utf8_codepoint) (scm_port_decode_char, peek_iconv_codepoint): * module/ice-9/sports.scm (peek-char-and-len/utf8): (peek-char-and-len/iconv): Return U+FFFD when we get a decoding error when reading, instead of '?', in accordance with Unicode recommendations. * test-suite/tests/iconv.test: * test-suite/tests/ports.test: * test-suite/tests/rdelim.test: Update tests. * NEWS: Update.
2016-05-13Use heap-allocated port types instead of ptobnumsAndy Wingo1-2/+2
This removes a limitation on the number of port types, simplifies the API, and removes a central point of coordination. * libguile/ports-internal.h (struct scm_t_port_type): Rename from scm_t_ptob_descriptor, now that it's private. Add GOOPS class fields. (struct scm_t_port): Rename from struct scm_port, especially considering that deprecated.h redefines scm_port using the preprocessor :(. * libguile/ports.h: Add definitions of SCM_PORT and SCM_PORT_TYPE, though the scm_t_port and scm_t_port_type types are incomplete. (SCM_TC2PTOBNUM, SCM_PTOBNUM, SCM_PTOBNAME): Remove, as there are no more typecodes for port types. (scm_c_num_port_types, scm_c_port_type_ref, scm_c_port_type_add_x): Remove. (scm_make_port_type): Return a scm_t_port_type*. All methods adapted to take a scm_t_port_type* instead of a ptobnum. (scm_c_make_port_with_encoding, scm_c_make_port): Take a port type pointer instead of a tag. (scm_new_port_table_entry): Remove; not useful. * libguile/ports.c: Remove things related to the port kind table. Adapt uses of SCM_PORT_DESCRIPTOR / scm_t_ptob_descriptor to use SCM_PORT_TYPE and scm_t_port_type. * libguile/deprecated.c: * libguile/deprecated.h: * libguile/filesys.c: * libguile/fports.c: * libguile/fports.h: * libguile/print.c: * libguile/r6rs-ports.c: * libguile/strports.c: * libguile/strports.h: * libguile/tags.h: * libguile/vports.c: * test-suite/standalone/test-scm-c-read.c: Adapt to change. * libguile/goops.c (scm_class_of, make_port_classes) (scm_make_port_classes, create_port_classes): Adapt to store the classes in the ptob.
2016-05-10Decoding errors do not advance read pointerAndy Wingo2-7/+17
* libguile/ports.c (scm_getc): If the port conversion strategy is 'error, signal an error before advancing the read pointer. This is a change from previous behavior; before, we advanced the read pointer under an understanding that that was what R6RS required. But, that seems to be not the case. * test-suite/tests/ports.test ("string ports"): Update decoding-error tests to assume that read-char with an error doesn't advance the read pointer. * test-suite/tests/rdelim.test ("read-line"): Likewise.
2016-04-14Fix R6RS imports of interfaces that use interfacesAndy Wingo1-10/+32
* module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): In Guile, a module's public interface is just another module, and that means that it can import other modules as well. Allow for R6RS modules that import module whose interfaces import other modules to access all visible bindings. * test-suite/tests/rnrs-libraries.test ("import features"): Update test.
2016-04-11Port read/write functions take bytevectorsAndy Wingo1-5/+7
This will allow better Scheme integration for ports. * libguile/ports.h (scm_t_port_buffer): Change "holder" member to be a bytevector defined to have "buf" as its starting point. (scm_t_ptob_descriptor): Change read and write functions to take bytevectors as arguments and to return the number of octets read or written. (scm_make_port_type): Adapt accordingly. (scm_c_read_bytes, scm_c_write_bytes): New functions that take bytevectors. * libguile/ports.c (scm_make_port_type): Adapt to read/write function prototype change. (scm_c_make_port_buffer): Arrange to populate the "bytevector" field. (scm_i_read_bytes_unlocked): New function. (scm_i_read_unlocked): Use scm_i_read_bytes_unlocked. (scm_c_read_bytes_unlocked): New function. (scm_c_read_unlocked): Update comment, and always go through the buffer. (scm_c_read_bytes): New function. (scm_flush_unlocked): Use scm_i_write_unlocked instead of the port's write function. (scm_i_write_bytes_unlocked): New function. (scm_i_write_unlocked): Use scm_i_write_bytes_unlocked. (scm_c_write_bytes_unlocked): New function. (scm_c_write_unlocked): Always write through the buffer. (scm_c_write_bytes): New function. (scm_truncate_file): Remove unused variable. (void_port_read, void_port_write): Adapt to read/write prototype change. * libguile/fports.c (fport_read, fport_write): * libguile/r6rs-ports.c (bytevector_input_port_read) (custom_binary_input_port_read, bytevector_output_port_write) (custom_binary_output_port_write, transcoded_port_write) (transcoded_port_read): Adapt to read/write prototype change. (scm_get_bytevector_n, scm_get_bytevector_n_x) (scm_get_bytevector_all): Use scm_c_read_bytes. (scm_put_bytevector): Use scm_c_write_bytes. * libguile/strports.c (string_port_read, string_port_write): * libguile/vports.c (soft_port_write, soft_port_read): Adapt to read/write prototype change. * test-suite/standalone/test-scm-c-read.c (custom_port_read): Fix for read API change.
2016-04-06Generic port facility provides buffering uniformlyAndy Wingo3-40/+34
* libguile/ports.h (struct scm_t_port_buffer): New data type. (struct scm_t_port): Refactor to use port buffers instead of implementation-managed read and write pointers. Add "read_buffering" member. (SCM_INITIAL_PUTBACK_BUF_SIZE, SCM_READ_BUFFER_EMPTY_P): Remove. (scm_t_ptob_descriptor): Rename "fill_input" function to "read", and take a port buffer, returning void. Likewise "write" takes a port buffer and returns void. Remove "end_input"; instead if there is buffered input and rw_random is true, then there must be a seek function, so just seek back if needed. Remove "flush"; instead all calls to the "write" function implicitly include a "flush", since the buffering happens in the generic port code now. Remove "setvbuf", but add "get_natural_buffer_sizes"; instead the generic port code can buffer any port. (scm_make_port_type): Adapt to read and write prototype changes. (scm_set_port_flush, scm_set_port_end_input, scm_set_port_setvbuf): Remove. (scm_slow_get_byte_or_eof_unlocked) (scm_slow_get_peek_or_eof_unlocked): Remove; the slow path is to call scm_fill_input. (scm_set_port_get_natural_buffer_sizes): New function. (scm_c_make_port_buffer): New internal function. (scm_port_non_buffer): Remove. This was a function for implementations that is no longer needed. Instead open with BUF0 or use (setvbuf port 'none). (scm_fill_input, scm_fill_input_unlocked): Return the filled port buffer. (scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt to changes in buffering and EOF management. * libguile/ports.c: Adapt to port interface changes. (initialize_port_buffers): New function, using the port mode flags to set up appropriate initial buffering for all ports. (scm_c_make_port_with_encoding): Create port buffers here instead of delegating to implementations. (scm_close_port): Flush the port if needed instead of delegating to the implementation. * libguile/filesys.c (set_element): Adapt to buffering changes. * libguile/fports.c (fport_get_natural_buffer_sizes): New function, replacing scm_fport_buffer_add. (fport_write, fport_read): Update to let the generic ports code do the buffering. (fport_flush, fport_end_input): Remove. (fport_close): Don't flush in a dynwind; that's the core ports' job. (scm_make_fptob): Adapt. * libguile/ioext.c (scm_redirect_port): Adapt to buffering changes. * libguile/poll.c (scm_primitive_poll): Adapt to buffering changes. * libguile/ports-internal.h (struct scm_port_internal): Remove pending_eof flag; this is now set on the read buffer. * libguile/r6rs-ports.c (struct bytevector_input_port): New type. The new buffering arrangement means that there's now an intermediate buffer between the bytevector and the user of the port; this could lead to a perf degradation, but on the other hand there are some other speedups enabled by the buffering refactor, so probably the memcpy cost is dwarfed by the cost of the other parts of the ports machinery. (make_bytevector_input_port, bytevector_input_port_read): (bytevector_input_port_seek, initialize_bytevector_input_ports): Adapt to new buffering arrangement. (struct custom_binary_port): Remove read buffer, as Guile handles that now. (custom_binary_input_port_setvbuf): Remove; now handled by Guile. (make_custom_binary_input_port, custom_binary_input_port_read) (initialize_custom_binary_input_ports): Adapt. (scm_get_bytevector_some): Adapt to new EOF management. (scm_t_bytevector_output_port_buffer): Hold on to the underlying port, so we can flush it if it's open. (make_bytevector_output_port, bytevector_output_port_write): (bytevector_output_port_seek): Adapt. (bytevector_output_port_procedure): Flush the port as appropriate, so that we get all the bytes. (make_custom_binary_output_port, custom_binary_output_port_write): Adapt. (make_transcoded_port): Don't muck with buffering. (transcoded_port_write): Simply forward the write to the underlying port. (transcoded_port_read): Likewise. (transcoded_port_close): No need to flush. (initialize_transcoded_ports): Adapt. * libguile/read.c (scm_i_scan_for_encoding): Adapt to buffering changes. * libguile/rw.c (scm_write_string_partial): Adapt to buffering changes. * libguile/strports.c: Adapt to the fact that we don't manage the buffer. Probably room for speed improvements here... * libguile/vports.c (soft_port_get_natural_buffer_sizes): New function. Adapt the rest of the file for the new buffering regime. * test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Custom binary output ports need to be flushed before you can rely on the write! procedure having been called. Add necessary flush-port invocations. ("8.2.6 Input and output ports"): Transcoded ports now have an internal buffer by default. This test checks that the characters are transcoded one at a time, so to do that, call setvbuf on the transcoded port to remove the buffer. * test-suite/tests/web-client.test (run-with-http-transcript): Fix for different flushing regime on soft ports. (The vestigial flush procedure is now called after each write, which is not what the test was expecting.) * test-suite/standalone/test-scm-c-read.c: Update for changes to the C interface for defining port types. * doc/ref/api-io.texi (Ports): Update to discuss buffering in a generic way, and to remove a hand-wavey paragraph describing string ports as "interesting and powerful". (Reading, Writing): Remove placeholder comments. Document `scm_lfwrite'. (Buffering): New section. (File Ports): Link to buffering. (I/O Extensions): Join subnodes into parent and describe new API, including buffering API. * doc/ref/posix.texi (Ports and File Descriptors): Link to buffering. Remove unread-char etc, as they are documented elsewhere. (Pipes, Network Sockets and Communication): Link to buffering.
2016-04-04Flush buffered reads / writes before seekingAndy Wingo1-4/+4
* libguile/ports.c (scm_seek): Flush before seeking on a buffered port. * libguile/fports.c (fport_seek): * libguile/strports.c (st_seek): Remove code to flush buffers. * test-suite/tests/ports.test: Update test expectations that the putback buffer is flushed on a seek. Previously there was a special case for SEEK_CUR with an offset of 0 to avoid flushing buffers, but that's an arbitrary choice that differs from all other combinations of OFFSET and WHENCE.
2016-04-04Use symbols instead of _IONBF values as args to setvbufAndy Wingo2-13/+13
* libguile/ports.c (scm_setvbuf): Use the symbols `none', `line', and `block' instead of the values `_IONBF', `_IOLBF', and `_IOFBF'. * NEWS: Update. * doc/ref/posix.texi (Ports and File Descriptors): Update setvbuf documentation. * module/ice-9/deprecated.scm (define-deprecated): New helper. (_IONBF, _IOLBF, _IOFBF): Define deprecated values. * benchmark-suite/benchmarks/read.bm ("read"): * benchmark-suite/benchmarks/uniform-vector-read.bm ("uniform-vector-read!"): * libguile/r6rs-ports.c (cbip_fill_input): * module/system/base/types.scm (%ffi-memory-backend): * module/web/client.scm (open-socket-for-uri): * module/web/server/http.scm (http-read): * test-suite/tests/ports.test ("pipe, fdopen, and line buffering"): ("setvbuf"): * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Update to use non-deprecated interfaces.
2016-01-07web: Be less strict when parsing entity tags.Andy Wingo1-1/+2
* module/web/http.scm (parse-entity-tag): Be less strict, accepting unquoted strings as well. * test-suite/tests/web-http.test ("response headers"): Add a test for etag parsing.
2015-12-01Remove add1 and sub1Andy Wingo1-4/+4
* libguile/vm-engine.c: Remove add1 and sub1 instructions. Will replace with add/immediate and sub/immediate. * module/language/tree-il/peval.scm (peval): If we reify a new <primcall>, expand it. Removes 1- and similar primcalls. * module/language/tree-il/primitives.scm: Don't specialize (+ x 1) to 1+. (expand-primcall): New export, does a single primcall expansion. (expand-primitives): Use the new helper. * module/language/cps/effects-analysis.scm: * module/language/cps/primitives.scm: * module/language/cps/types.scm: * module/system/vm/assembler.scm: Remove support for add1 and sub1 CPS primitives. * test-suite/tests/peval.test ("partial evaluation"): Adapt tests that expect 1+/1- to expect +/-.
2015-12-01Remove frame-procedureAndy Wingo1-2/+2
* libguile/frames.h: * libguile/frames.c (scm_frame_procedure): Remove. * test-suite/tests/eval.test ("stacks"): Adapt test. * NEWS: Add news item. * doc/ref/api-debug.texi (Frames): Document frame-procedure-name instead of frame-procedure.
2015-12-01All arities serialize a "closure" bindingAndy Wingo1-3/+14
* module/language/cps/compile-bytecode.scm (compile-function): Always define a 'closure binding in slot 0. * module/system/vm/frame.scm (available-bindings): No need to futz around not having a closure binding. * module/system/vm/debug.scm (arity-arguments-alist): Expect a closure binding. * test-suite/tests/rtl.test: Emit definitions for the closure.
2015-10-28Reflection support for unboxed f64 slotsAndy Wingo1-13/+13
* module/system/vm/assembler.scm (emit-definition): Add representation field. (write-arities): Emit representations into the arities section. * module/system/vm/debug.scm (arity-definitions): Read representations. * module/system/vm/frame.scm (<binding>): Add representation field and binding-representation getter. (available-bindings): Pass representation to make-binding. (frame-binding-set!, frame-binding-ref, frame-call-representation): Pass representation to frame-local-ref / frame-local-set!. * test-suite/tests/rtl.test: Update definition instructions. * module/language/cps/slot-allocation.scm ($allocation): Add representations field. (lookup-representation): New public function. (allocate-slots): Pass representations to make-$allocation. * module/language/cps/compile-bytecode.scm (compile-function): Adapt to emit-definition change. * libguile/frames.h: * libguile/frames.c (scm_frame_local_ref, scm_frame_local_set_x): Take representation argument. (scm_to_stack_item_representation): New internal helper.
2015-10-28rtl.test uses return-valuesAndy Wingo1-34/+37
* test-suite/tests/rtl.test: Fix up to use return-values.
2015-10-21SP-relative local addressingAndy Wingo1-57/+57
* libguile/vm-engine.c: S24/S12/S8 operands addressed relative to the SP, not the FP. Cache the SP instead of a FP-relative locals pointer. Further cleanups to follow. * libguile/vm.c (vm_builtin_call_with_values_code): Adapt to mov operand addresing change. * module/language/cps/compile-bytecode.scm (compile-function): Reify SP-relative local indexes where appropriate. * module/system/vm/assembler.scm (emit-fmov*): New helper, exported as emit-fmov. (shuffling-assembler, define-shuffling-assembler): Rewrite to shuffle via push/pop/drop. (standard-prelude, opt-prelude, kw-prelude): No need to provide for shuffling args. * test-suite/tests/rtl.test: Update. * module/language/cps/slot-allocation.scm: Don't reserve slots 253-255.
2015-08-13Allow decoding of UTF-8 containing U+FFFD, the replacement character.Mark H Weaver1-1/+13
* libguile/strings.c (scm_from_utf8_stringn): Use 'u8_mbtoucr' and check for a decoding error by its 'nbytes' return value. Previously we used 'u8_mbtouc' and improperly assumed that a U+FFFD character indicated a decoding error. * libguile/symbols.c (utf8_string_equals_wide_string): Likewise. * test-suite/tests/bytevectors.test (exception:decoding-error): New variable. ("2.9 Operations on Strings"): Add tests.
2015-05-20Fix bug compiling fixpoint combinatorAndy Wingo1-2/+28
* module/language/tree-il/peval.scm (<operand>): Rename "alias-value" field to "alias", which is now an operand and not an expression. This allows the operand to capture its environment; before, the alias was being visited in its use environment instead of its definition environment. (peval): Adapt to operand change. Fix construction of rest bindings as well. * test-suite/tests/peval.test ("partial evaluation"): New test.
2015-02-18Non-vector 1D arrays print as #1()Daniel Llorens1-1/+13
* libguile/arrays.c (scm_i_print_array): Print the dimension whenever the array is a true scm_tc7_array. * test-suite/tests/arrays.test: Check that non-vector 1D arrays print as expected.
2015-02-17(system base types) knows about variablesAndy Wingo1-0/+1
* module/system/base/types.scm (%tc7-variable): New tc7. (cell->object): Handle tc7-variable. * test-suite/tests/types.test ("opaque objects"): Add a test.
2015-02-13Fix infinite loop in expanderAndy Wingo1-1/+16
* module/ice-9/psyntax.scm (resolve-identifier): There is a case where a syntax object can resolve to itself. Prevent an infinite loop in that case by continuing to resolve by name. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syncase.test ("infinite loop bug"): Add a test.
2015-02-06Add #:static-slot-allocation?Andy Wingo1-0/+23
* libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_STATIC): Reserve the fourth GOOPS flag to indicate that a class has static slot allocation. * libguile/goops.c (scm_init_goops_builtins): Define vtable-flag-goops-static for goops.scm. * module/oop/goops.scm (class-has-statically-allocated-slots?): New helper. (build-slots-list): Instead of the ad-hoc checks for <class> or <slot>, use the new helper. (initialize): Accept #:static-slot-allocation? keyword. * module/system/foreign-object.scm (make-foreign-object-type): Declare foreign object classes as having static slot allocation. * test-suite/tests/goops.test ("static slot allocation"): Add tests.
2015-01-26Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-2/+4
Conflicts: libguile/goops.c libguile/vm-engine.h module/oop/goops.scm module/oop/goops/compile.scm module/oop/goops/dispatch.scm test-suite/tests/goops.test
2015-01-26Accessor methods only apply to subclasses with their slotAndy Wingo1-2/+4
* libguile/goops.c (is_accessor_method, scm_compute_applicable_methods): Fix regression from 51f66c912078a25ab0380c8fc070abb73d178d98 (2009). Accessor methods are added on each subclass on which the slot is present; therefore if a subclass doesn't have a method, then the methods doesn't apply. Truly fixes #17355, unlike 583a23bf104c84d9617222856e188f3f3af4934d. * module/oop/goops.scm (compute-cmethod, compute-getter-method) (compute-setter-method): Revert earlier changes. * test-suite/tests/goops.test ("accessor slots"): Update for new expectations, in agreement with Guile 1.8.
2015-01-24Fix accessor struct field inliningAndy Wingo1-0/+34
* module/oop/goops/compile.scm: Inline into goops.scm, leaving a compatible interface stub behind. * module/oop/goops/dispatch.scm: Don't import (oop goops compile), to break circularities. * module/oop/goops.scm: Move (oop goops util) include up to the top, and import (ice-9 match). (compute-cmethod): Move here from compile.scm. Add a special case for accessor methods, so as to fix bug #17355. (compute-getter-method, compute-setter-method): #:procedure slot is now generic. * test-suite/tests/goops.test ("accessor slots"): New test.
2015-01-24Fix accessor struct inlining in GOOPSAndy Wingo1-0/+34
Fixes bug #17355. * module/oop/goops.scm (memoize-effective-method!): Adapt to compute-effective-method change. (compute-effective-method, %compute-effective-method): Renamed from compute-cmethod; now a generic protocol. (compute-specialized-effective-method) (%compute-specialized-effective-method): New sub-protocol. (memoize-generic-function-application!): Adapt to call the hard-wired compute-applicable-methods based on the concrete arguments types -- the semantics is that %compute-applicable-methods is the implementation for <generic> functions. Perhaps we should do the same for sort-applicable-methods and method-more-specific?. (compute-getter-method, compute-setter-method): The standard #:procedure is now a generic slot-ref. It wasn't valid to inline field access here, because subtypes could have different field layouts. (compute-applicable-methods): Refactor generic definition to use lexical scoping. (compute-specialized-effective-method): New method for <accessor-method>, which does field access inlining based on the concrete types being applied. * test-suite/tests/goops.test ("accessor slots"): New test.
2015-01-23Introduce <slot> objects in GOOPSAndy Wingo1-10/+9
* module/oop/goops.scm (fold-class-slots): Change format to use proper slot specifications. (fold-slot-slots): Flesh out with all needed slots. (<class>): Update cons-layout to deal with new fold-class-slots form. Don't create slots; we do that later. (is-a?, get-keyword, *unbound, unbound?, %allocate-instance): Move definitions up. (<slot>, slot?): New definitions. (slot-definition-name, slot-definition-allocation) (slot-definition-init-keyword, slot-definition-init-form) (slot-definition-init-value, slot-definition-init-thunk) (slot-definition-options, slot-definition-getter) (slot-definition-setter, slot-definition-accessor) (slot-definition-slot-ref, slot-definition-slot-set!) (slot-definition-index, slot-definition-size): New definitions as accessors on <slot> objects. (class-slot-definition): Adapt to class-slots change. (direct-slot-definition-class, make-slot): New definitions. (make): Define a boot version that can allocate <slot> instances. (compute-direct-slot-definition) (compute-direct-slot-definition-initargs) (effective-slot-definition-class, compute-effective-slot-definition): New definitions. (build-slots-list): Adapt to slots being <slot> objects. (compute-get-n-set): New boot definition. (allocate-slots): New definition. Replaces compute-getters-n-setters. (%compute-layout, %prep-layout): Adapt to changes. (make-standard-class): Make <slot> objects for direct-slots, and handle the allocate-slots protocol. (<foreign-slot>): Inherit from <slot>. (get-slot-value-using-name, set-slot-value-using-name!) (test-slot-existence): Adapt to using slot definition objects. (make-class): Allow slot specs or <slot> objects as the `slots' argument. (write): New method on <slot>. (class-slot-ref, class-slot-set!): Reimplement. (compute-slot-accessors, compute-getter-method) (compute-setter-method): Adapt to changes. (compute-getters-n-setters): Remove. Yay! (compute-get-n-set): Adapt to use effective slot definitions instead of the getters-n-setters for #:class / #:each-subclass allocation. (%initialize-object): Adapt. (initialize): New method for <slot>. Adapt method for <class>. * module/oop/goops/active-slot.scm (compute-get-n-set): * module/oop/goops/composite-slot.scm (compute-propagated-get-n-set): Use slot-definition-options to access options of slot. * test-suite/tests/goops.test ("bad init-thunk"): Fix to be a "pass-if" instead of an "expect-fail".
2015-01-23Add compute-cpl testsAndy Wingo1-0/+23
* test-suite/tests/goops.test: Add tests for compute-cpl based on comments from goops.scm. * module/oop/goops.scm (compute-std-cpl): Remove comment, and add docstring. (compute-cpl): Improve comment.
2015-01-23Mark two coverage tests as XFAILAndy Wingo1-3/+10
* test-suite/tests/coverage.test ("several times", "one proc hit, one proc unused"): Mark as XFAIL until we can fix either the expander or the compiler to have proper source info.
2015-01-22Merge commit '5b7632331e7551ac202bbaba37c572b96a791c6e'Andy Wingo1-1/+38
Conflicts: module/oop/goops.scm
2015-01-22Merge commit 'ed72201a795ac1c8d6c0288b6bb710f2bd0ebd9c'Andy Wingo1-2/+32
Conflicts: test-suite/tests/r6rs-ports.test
2015-01-22Merge commit '37b1453032488de582175270d1b3a1653ea81457'Andy Wingo1-1/+15
2015-01-22Merge commit 'cdcba5b2f6270de808e51b3b933374170611b91d'Andy Wingo1-0/+13
Conflicts: module/statprof.scm
2015-01-22Merge commit '8cf2a7ba7432d68b9a055d29f18117be70375af9'Andy Wingo1-0/+15
2015-01-22Merge commit 'fdd319e9bd4121d844662d3d8ccc69b462b60840'Andy Wingo1-3/+12
2015-01-22Keywords have a tc7Andy Wingo1-3/+2
* libguile/tags.h (scm_tc7_keyword): Allocate a tc7, so that the VM can have cheap keyword? tests. * libguile/keywords.c: * libguile/keywords.h: Adapt. * libguile/goops.c (scm_class_of, scm_sys_goops_early_init): Capture <keyword>. * libguile/print.c (iprin1): Inline keyword printer. * libguile/evalext.c (scm_self_evaluating_p): Add keywords here. * libguile/deprecated.h: * libguile/deprecated.c (scm_tc16_keyword): Deprecate. * module/language/cps/compile-bytecode.scm (compile-fun): Add keyword? case, and bitvector? case while we're at it. * module/language/cps/effects-analysis.scm (define-primitive-effects): Add bytevector?, keyword?, and bitvector? cases. * module/language/cps/primitives.scm (*branching-primcall-arities*): Add keyword?. * module/language/cps/types.scm (bitvector?, keyword?, bytevector?): Add branch inferrers. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): (*effect+exception-free-primitives*): Add bytevector?, keyword?, and bitvector?. * module/oop/goops.scm (<keyword>): New class. * module/system/base/types.scm (%tc7-keyword, cell->object): Add cases. * module/system/vm/assembler.scm (br-if-keyword): New definition. * module/system/vm/disassembler.scm (code-annotation): Add br-if-tc7 case for keywords. * test-suite/tests/types.test ("clonable objects"): Update now that keywords are cloneable.
2015-01-22Merge commit '5af307de43e4b65eec7f235b48a8908f2a00f134'Andy Wingo1-2/+7
Conflicts: test-suite/tests/reader.test
2015-01-22Fix #:init-value on class-allocated slotsAndy Wingo1-1/+38
Allocating an instance of a class with a #:class or #:each-subclass slot allocation should not re-initialize the class-allocated slot. In Guile 1.8, this worked by effectively doing a slot-bound? within %initialize-object. In Guile 2.0 we instead initialize the slot when it is allocated -- in compute-get-n-set. * module/oop/goops.scm (compute-getters-n-setters): Don't set an init-thunk for class-allocated slots. (compute-get-n-set): Initialize class-allocated slots here, if an init-thunk or init-value are present. * test-suite/tests/goops.test ("#:each-subclass"): Add test.
2015-01-18Fix buffer overrun with unbuffered custom binary input ports.Ludovic Courtès1-1/+32
Fixes <http://bugs.gnu.org/19621>. Before that, in 'cbip_fill_input', BUFFERED would be set to 0 when reading from 'scm_getc' et al, because 'shortbuf' was being used. Thus, we could eventually execute this line: /* Copy the data back to the internal buffer. */ memcpy ((char *) c_port->read_pos, SCM_BYTEVECTOR_CONTENTS (bv), c_octets); But 'read_pos' would quickly point to the fields beyond 'shortbuf', thereby leading to a corruption of the 'scm_t_port' itself. * libguile/r6rs-ports.c (cbip_setvbuf): When READ_SIZE is 0, keep using BV as the 'read_buf'. (cbip_fill_input): Adjust assertion to accept 'read_buf_size = 1'. * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary input port unbuffered & 'get-string-all'", "custom binary input port unbuffered UTF-8 & 'get-string-all'"]: New tests.
2015-01-11Avoid converting the 'mode' argument of 'open-file'.Ludovic Courtès1-1/+15
* libguile/fports.c (scm_open_file_with_encoding): const-qualify 'md' and 'ptr'. Add call to 'scm_i_try_narrow_string'. Use 'scm_i_string_chars' instead of 'scm_to_locale_string' plus ' scm_dynwind_free'. * test-suite/tests/ports.test ("invalid wide mode string", "valid wide mode string"): New tests.
2015-01-11statprof: 'statprof' and 'with-statprof' return the code's return values.Ludovic Courtès1-0/+13
* module/statprof.scm (statprof): Return the return values of THUNK. (with-statprof): Adjust docstring accordingly. * test-suite/tests/statprof.test ("return values"): New test. * doc/ref/statprof.texi (Statprof): Adjust accordingly.
2014-12-10Fix syntax.testAndy Wingo1-1/+1
* test-suite/tests/syntax.test (exception:variable-ref): Change expected error.
2014-12-05Assignment conversion in the interpreterAndy Wingo1-18/+13
* libguile/expand.c (compute_assigned, convert_assignment) (scm_convert_assignment): New functions. * libguile/expand.h: Declare scm_convert_assignment. * libguile/memoize.c (scm_memoize_expression): Do assignment conversion before memoization. * test-suite/tests/syntax.test ("letrec"): Detection of unbound letrec variables now works.
2014-11-12Fix bytevector-fill! to accept fill arguments greater than 127.Mark H Weaver1-0/+15
Fixes <http://bugs.gnu.org/19027>. * libguile/bytevectors.c (scm_bytevector_fill_x): Accept fill arguments between -128 and 255. * test-suite/tests/bytevectors.test ("2.2 General Operations"): Add tests.
2014-11-11Fix bytevector-copy when applied to SRFI-4 homogeneous numeric vectors.Mark H Weaver1-3/+12
Fixes <http://bugs.gnu.org/18866>. Reported by tantalum <sph@posteo.eu>. * libguile/bytevectors.c (scm_bytevector_copy): Always create a VU8 bytevector. * test-suite/tests/bytevectors.test: Add test.
2014-11-09texinfo: fix @url{@@} parsingAndy Wingo1-0/+4
* module/texinfo.scm (texi-command-specs): The body of @url{} can have texinfo commands. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add tests.
2014-11-01web: Location header is URI-reference; better URI-reference supportAndy Wingo2-4/+351
* module/web/uri.scm (validate-uri): Add reference? keyword argument, for validating references. (build-uri): Clarify comments to indicate that the result is an absolute URI. (build-uri-reference): New interface, to build URI-references. (string->uri-reference): Rename from string->uri*. Fix fragment parsing to not include the #. (string->uri): Adapt to string->uri-reference name change. * module/web/request.scm (request-absolute-uri): Add default-scheme optional argument. Use it if the request-uri has no scheme, or error. * module/web/http.scm (write-uri): Reflow to use "when". Fix writing of URI-reference instances. (declare-uri-reference-header!): Rename from declare-relative-uri-header!. Use string->uri-reference. ("Location"): Declare as a URI-reference header, as per RFC 7231. * module/web/client.scm (open-socket-for-uri): Handle the case in which there is no URI scheme. * test-suite/tests/web-http.test: * test-suite/tests/web-uri.test: Add tests.
2014-10-01read: Accept "\(" in string literals.Mark H Weaver1-2/+7
Suggested by David Kastrup <dak@gnu.org> in <http://bugs.gnu.org/13644>. * libguile/read.c (scm_read_string_like_syntax): Accept "\(" as equivalent to "(". * doc/ref/api-data.texi (String Syntax): Document it. * test-suite/tests/reader.test ("reading"): Add test.
2014-09-30Run some of arrays.test under both compiler & interpreterDaniel Llorens2-33/+38
* test-suite/test-suite/lib.scm (c&e): accept (pass-if exp) clause. * test-suite/tests/arrays.test: use with-prefix/c&e instead of with-prefix where possible.