Currently failing some guardian tests.
* libguile/tags.h: Refactor tagging so that tc3 bits for a pair live in
the SCM value, not in the heap words. Do the same for structs. This
more rational tagging strategy will make native code generation
easier. Note that this means that to check a heap pointer for its
type, you first have to ensure that it has the expected tc3, as not
all the type bits are on the heap.
(SCM_TYP3): Check the SCM tag type, not the bits in the cell.
(SCM_HAS_TYP3): New helper.
(SCM_I_CONSP): Redefine to just check the typ3.
(scm_tcs_cons_imcar, scm_tcs_cons_nimcar, scm_tcs_struct): Remove, as
they are no longer necessary.
* libguile/array-handle.c (scm_i_array_implementation_for_obj): Check
for heap objects before checking type bits, so we don't check pairs.
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/gc.c (scm_i_tag_name):
* libguile/goops.c (scm_class_of)
* libguile/hash.c (scm_hasher):
* libguile/print.c (iprin1): Adapt to tagging changes.
* libguile/gc.c (scm_storage_prehistory): Register all displacements
here. There are the same displacements as before, unfortunately.
* libguile/list.c (SCM_I_CONS):
* libguile/pairs.c (scm_cons):
* libguile/pairs.h (scm_is_pair):
* libguile/vm-engine.h (CONS): Tag pairs with scm_tc3_pair.
* libguile/modules.c (scm_post_boot_init_modules):
* libguile/modules.h (SCM_MODULEP):
* libguile/struct.c (struct_finalizer_trampoline, scm_i_alloc_struct):
(scm_make_vtable_vtable):
* libguile/struct.h (SCM_STRUCTP, SCM_STRUCT_VTABLE_DATA):
(SCM_STRUCT_VTABLE_SLOTS):
* libguile/vm-i-scheme.c (make-struct): Adapt to struct tagging
changes.
* libguile/numbers.h (SCM_I_INUMP):
* module/rnrs/arithmetic/fixnums.scm (fixnum?, inline-fixnum?): Adapt
to the new fixnum tag.
* libguile/numbers.h (SCM_INEXACTP): Make sure of the tc3 before looking
at the cell type.
* libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro. Given a SCM,
returns a pointer to the start of its memory area on the heap.
* libguile/bytevectors.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/gc.h:
* libguile/guardians.c:
* libguile/numbers.h:
* libguile/ports.c:
* libguile/smob.c:
* libguile/struct.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Use it.
* libguile/ports.c (scm_i_set_default_port_encoding): An encoding of
ASCII is not the same as ISO-8859-1, because it does not allow
characters above 128. Fix this.
* module/ice-9/iconv.scm (call-with-encoded-output-string):
(string->bytevector, bytevector->string): Only call string->utf8 and
utf8->string if the conversion strategy is `error'.
* libguile/ports.c (scm_c_read_unlocked, scm_ungetc_unlocked):
* libguile/read.c (scm_read_character):
* libguile/vports.c (sf_fill_input): Port encodings cannot be NULL any
more, now that encodings are canonicalized, so simplify these.
* module/rnrs/io/ports.scm (binary-port?): All ports are binary _and_
textual. Bytevectors and strings may be written to or read from
either.
(port-transcoder): All textual ports (all ports) have transcoders of
some sort.
* test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports"):
Remove test that binary ports don't have transcoders, because binary
ports are also textual.
* libguile/ports.c (ascii_toupper, encoding_matches)
(canonicalize_encoding): New helpers.
(scm_c_make_port_with_encoding):
(scm_i_set_default_port_encoding):
(scm_i_set_port_encoding_x): Use the new helpers to be
case-insensitive and also to canonicalize the internal representation
to upper-case ASCII names.
(scm_i_default_port_encoding): Never return NULL.
(scm_port_encoding): The encoding is always a string.
* libguile/read.c (scm_i_scan_for_encoding): Use a locale-independent
check instead of isalnum. Don't upcase the result: the port code will
handle that.
* test-suite/tests/web-response.test ("example-1"): Adapt test to expect
normalized (upper-case) encoding for the response port.
* libguile/strings.c (scm_from_utf8_stringn):
* libguile/symbols.c (utf8_string_equals_wide_string): The "bad UTF8"
return from u8_mbtouc is a 0xfffd character, not a negative byte
length. Fixes a bug in which invalid UTF-8 would not be caught.
* libguile/bytevectors.c (scm_utf8_to_string): Use scm_from_utf8_stringn
directly. Just a little cleanup.
* test-suite/tests/iconv.test ("narrow non-ascii string"): Add test for
parsing bad utf-8 with substitution.
There is a failing test due to a scm_from_utf8_stringn bug brought out
by the iconv test that will be fixed in the next commit.
Conflicts:
libguile/deprecated.h
module/ice-9/deprecated.scm
* module/ice-9/iconv.scm (call-with-encoded-output-string):
(string->bytevector, bytevector->string): Take an optional instead of
a keyword argument.
* doc/ref/api-data.texi (Representing Strings as Bytes): Adapt docs to
change, and fix a number of errors. Thanks to Ludovic Courtès for the
pointers.
* test-suite/tests/iconv.test ("wide non-ascii string"): Add a test for
the 'substitute path.
* module/web/client.scm (ensure-uri): New helper.
(open-socket-for-uri): Accept a URI as a string or as a URI object.
(extend-request, sanitize-request): New helpers, like the
corresponding functions in (web server).
(decode-response-body): Add a reference to the HTTP/1.1 spec, and
use (ice-9 iconv).
(request): New helper, factoring all aspects of sending an HTTP
request and getting a response.
(http-get): Redefine in terms of http-get. Deprecate the
#:extra-headers argument in favor of #:headers. Allow a body. Add a
#:streaming? argument, subsuming the functionality of http-get*.
(http-get*): Deprecate.
(http-head, http-post, http-put, http-delete, http-trace)
(http-options): Define interfaces for all HTTP verbs.
* test-suite/tests/web-client.test: Add tests.
* doc/ref/web.texi: Update documentation.
Thanks to Gregory Benison for the initial patch.
* module/web/response.scm (read-response-body): Fix to always return
either a bytevector or #f. Previously, reading a 0-length body could
return the EOF object.
* module/ice-9/slib.scm: Change to just load up slib.init directly. The
recently submitted patch to slib-discuss and guile-user should make
this work correctly.
* libguile/__scm.h:
* libguile/deprecated.h (SCM_CHAR_CODE_LIMIT): Move declaration here
from __scm.h.
* libguile/feature.c:
* module/ice-9/deprecated.scm (char-code-limit): Move definition here.
* test-suite/tests/regexp.test: Update to not use char-code-limit.
* libguile/posix.c (scm_open_process): Return the ports as values
instead of calling out to Scheme again to make-rw-port. This
function is private to (ice-9 popen).
* module/ice-9/popen.scm (open-pipe*): Adapt to change.
* module/web/http.scm ("Connection"): Write the "close" token in
lower-case.
* module/web/client.scm (http-get): Don't shutdown the writing side of
the pipe if we are not doing a keepalive, as this may prevent the
request from being sent at all. Prevented http://friendfeed.com/ from
being correctly fetched.
* doc/ref/api-procedures.texi (Compiled Procedures): Expand
program-arguments-alist and program-lambda-list documentation.
* module/system/vm/program.scm (arity->arguments-alist): Fix the rest
arg if there are also keyword args, a bug found while documenting!
* test-suite/tests/session.test ("procedure-arguments"): Update.
Fixes <http://bugs.gnu.org/13166>.
* libguile/simpos.c (scm_system_star): In the child, call `_exit'
instead of `SCM_SYSERROR' when `execvp' fails.
* test-suite/tests/posix.test ("system*"): New test prefix.
* module/web/client.scm (open-socket-for-uri): Delete addrinfos
with the same address. Always open SOCK_STREAM/IPPROTO_IP sockets.
Fix the error handler's condition to determine what to do.
Reported by Nikita Karetnikov <nikita.karetnikov@gmail.com> at
<http://lists.gnu.org/archive/html/bug-guix/2012-12/msg00150.html>.
* libguile/numbers.c (scm_product): Avoid signed integer overflow, which
modern C compilers are allowed to assume will never happen, thus
allowing them to optimize out our overflow checks.
* test-suite/tests/numbers.test (*): Add tests.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C
function `scm_make_vtable_vtable'.
(LIBGUILE_INTERFACE_AGE): Increment.