Mark H Weaver [Wed, 16 Apr 2014 04:49:40 +0000 (00:49 -0400)]
Update libgc URL in README.
* README: Update libgc URL. Suggested by Ian Grant
<ian.a.n.grant@googlemail.com>.
Andy Wingo [Mon, 14 Apr 2014 14:12:14 +0000 (16:12 +0200)]
Readline history preserves newlines
* guile-readline/ice-9/readline.scm (make-readline-port): Preserve
newlines. This preserves the semantics of history entries that
contain until-end-of-line comments using `;'.
David Kastrup [Tue, 1 Apr 2014 14:24:29 +0000 (16:24 +0200)]
Make reverse! forego the cost of SCM_VALIDATE_LIST
* libguile/list.c (scm_reverse_x): Do not validate first argument to
reverse! in advance. Instead undo reversal in error case.
Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Mark H Weaver <mhw@netris.org>
Nathaniel Alderson [Thu, 19 Sep 2013 21:02:26 +0000 (14:02 -0700)]
Calculate usecs correctly in thread-sleep!
* module/srfi/srfi-18.scm (thread-sleep!): Correctly compute
microseconds.
* test-suite/tests/srfi-18.test: Add test.
Ludovic Courtès [Thu, 20 Mar 2014 20:21:21 +0000 (21:21 +0100)]
Bump version number for 2.0.11.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_REVISION): Increment.
Ludovic Courtès [Thu, 20 Mar 2014 20:20:59 +0000 (21:20 +0100)]
Update NEWS.
Ludovic Courtès [Thu, 20 Mar 2014 08:43:01 +0000 (09:43 +0100)]
tests: Add #undef NDEBUG when using <assert.h>.
* test-suite/standalone/test-loose-ends.c,
test-suite/standalone/test-num2integral.c,
test-suite/standalone/test-round.c,
test-suite/standalone/test-scm-c-bind-keyword-arguments.c,
test-suite/standalone/test-scm-c-read.c,
test-suite/standalone/test-scm-values.c,
test-suite/standalone/test-smob-mark.c,
test-suite/standalone/test-srfi-4.c: Add #undef NDEBUG.
Ludovic Courtès [Thu, 20 Mar 2014 08:40:42 +0000 (09:40 +0100)]
tests: Check 'simple-format' with closed current-output-port.
This is a follow-up to
e26ab06.
* libguile/print.c (scm_simple_format): Pass 1 to
SCM_VALIDATE_OPORT_VALUE, for 'destination'.
* test-suite/tests/format.test ("simple-format"): Add test.
Mark H Weaver [Thu, 20 Mar 2014 03:36:46 +0000 (23:36 -0400)]
Fix (rnrs io simple) to open file ports in textual mode.
Fixes <http://bugs.gnu.org/17044>.
Reported and diagnosed by Xin Wang <dram.wang@gmail.com>.
* module/rnrs/io/simple.scm (open-input-file, open-output-file): Pass
missing buffer-mode argument to open-file-{input,output}-port.
Previously, (native-transcoder) was incorrectly passed as the
buffer-mode argument, so no transcoder was provided, thus creating a
binary port.
Mark H Weaver [Wed, 19 Mar 2014 21:55:20 +0000 (17:55 -0400)]
simple-format: Don't assume the current output port is valid.
* libguile/print.c (scm_simple_format): Validate the current output
port.
Andy Wingo [Wed, 19 Mar 2014 21:41:19 +0000 (22:41 +0100)]
Fix breakage of SRFI-4 C accessors
* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix bad assumption that
width was a byte width. Thanks very much to Barry Fishman for the
report, and to Daniel Llorens for tracking it down.
* test-suite/standalone/Makefile.am (test_srfi_4_CFLAGS):
* test-suite/standalone/test-srfi-4.c: Add test.
Ludovic Courtès [Mon, 17 Mar 2014 22:18:38 +0000 (23:18 +0100)]
Bump version number for 2.0.10.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_REVISION): Increment.
Ludovic Courtès [Mon, 17 Mar 2014 22:06:21 +0000 (23:06 +0100)]
Fix typo in NEWS.
Ludovic Courtès [Mon, 17 Mar 2014 21:13:09 +0000 (22:13 +0100)]
Update NEWS.
* NEWS: Remove last 'XXX'.
Andy Wingo [Mon, 17 Mar 2014 21:05:39 +0000 (22:05 +0100)]
Update NEWS
* NEWS: Update.
Ludovic Courtès [Mon, 17 Mar 2014 20:55:26 +0000 (21:55 +0100)]
Update NEWS.
* NEWS: Move "New interfaces" higher. Complement.
Andy Wingo [Thu, 27 Feb 2014 16:16:29 +0000 (17:16 +0100)]
Fix newline preservation in @example with lines beginning with @
* module/texinfo.scm (read-char-data): Preserve newlines in @example and
similar environments in the case when the next line starts with an @.
* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test.
Mark H Weaver [Mon, 17 Mar 2014 06:54:47 +0000 (02:54 -0400)]
Minor NEWS tweaks.
* NEWS: Fix typo and improve wording in custom ellipsis entry.
Mark H Weaver [Mon, 17 Mar 2014 06:42:38 +0000 (02:42 -0400)]
Add first draft of NEWS for 2.0.10.
* NEWS: Add first draft of changes in 2.0.10.
Mark H Weaver [Mon, 17 Mar 2014 06:40:23 +0000 (02:40 -0400)]
Documentation tweaks for the 'r7rs-symbols' read/print options.
* doc/ref/api-data.texi (Symbol Read Syntax): Mention the 'r7rs-symbols'
print option, and provide example code to enable both the read and
print options. Add 'r7rs-symbols' to the concept index.
Ludovic Courtès [Sun, 16 Mar 2014 22:24:34 +0000 (23:24 +0100)]
build: Link 'test-unwind.c' against libgnu.la.
* test-suite/standalone/Makefile.am (test_unwind_LDADD): Add libgnu.la,
which provides 'rpl_mkstemp' on systems missing 'mkstemp'.
Mark H Weaver [Sat, 15 Mar 2014 17:23:21 +0000 (13:23 -0400)]
Fix (system base types) on big-endian systems.
* module/system/base/types.scm (cell->object): When reading stringbufs,
use UTF-32BE on big-endian systems.
Mark H Weaver [Fri, 14 Mar 2014 19:07:10 +0000 (15:07 -0400)]
SRFI-43 documentation tweaks
* doc/ref/api-compound.texi (Vectors): Add cross-reference to SRFI-43.
* doc/ref/srfi-modules.texi (SRFI-43 Selectors): Simplify description of
'vector-ref'.
Mark H Weaver [Fri, 14 Mar 2014 03:21:48 +0000 (23:21 -0400)]
Check SCM_USE_PTHREAD_THREADS using #if not #ifdef.
* libguile/bdw-gc.h: Check SCM_USE_PTHREAD_THREADS using #if not #ifdef.
Mark H Weaver [Thu, 13 Mar 2014 20:47:11 +0000 (16:47 -0400)]
Include <config.h> in gen-scmconfig even when cross-compiling.
Partially reverts
8cb0d6d7fa9aaac316c29a64c541336b51b6f93d.
* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Remove
-DCROSS_COMPILING=1 from cross-compiling case.
* libguile/gen-scmconfig.c: Include <config.h> regardless of
whether CROSS_COMPILING is defined.
Ludovic Courtès [Wed, 12 Mar 2014 14:56:11 +0000 (15:56 +0100)]
build: Remove libguile-2.0-gdb.scm and $infodir/dir upon uninstall.
* libguile/Makefile.am (uninstall-data-hook): New target.
Ludovic Courtès [Wed, 12 Mar 2014 14:18:27 +0000 (15:18 +0100)]
build: Install libguile-2.0-gdb.scm after libguile-2.0.so.
* libguile/Makefile.am (install-data-local): Rename to...
(install-data-hook): ... this. This guarantees that the rule runs
after libguile-2.0.so has been installed.
Ludovic Courtès [Wed, 12 Mar 2014 13:35:07 +0000 (14:35 +0100)]
build: Don't include <config.h> in native programs when cross-compiling.
* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): When cross-compiling,
pass -DCROSS_COMPILING=1.
(c-tokenize.$(OBJEXT)): Likewise.
* libguile/c-tokenize.lex (%top): Include <config.h> only when
CROSS_COMPILING is undefined.
* libguile/gen-scmconfig.c: Likewise.
Ludovic Courtès [Wed, 12 Mar 2014 13:24:11 +0000 (14:24 +0100)]
build: Fix Gnulib compilation when $builddir != $srcdir.
* configure.ac: Add -I$top_srcdir_absolute to 'CPPFLAGS'. Fixes
out-of-source-tree compilation of lib/regex.c. Reported at
<https://lists.gnu.org/archive/html/guile-devel/2014-03/msg00022.html>.
David Thompson [Sat, 8 Mar 2014 22:15:52 +0000 (17:15 -0500)]
Test for deleted weak pairs in hash-for-each.
* libguile/hashtab.c (scm_internal_hash_for_each_handle): Test for
deleted weak pairs.
* test-suite/tests/hash.test: Add test case.
Mark H Weaver [Wed, 12 Mar 2014 01:33:48 +0000 (21:33 -0400)]
SCM_I_INUM: Rewrite to avoid unspecified behavior when not using GNU C.
* libguile/numbers.h (SCM_I_INUM): Unless using GNU C, use a portable
implementation that avoids unspecified behavior.
Mark H Weaver [Wed, 12 Mar 2014 01:27:21 +0000 (21:27 -0400)]
SCM_SRS: Improve fallback implemention to avoid unspecified behavior.
* libguile/numbers.h (SCM_SRS): Rewrite preprocessor test to avoid
left-shifting negative integers, and to test more comprehensively for
the behavior we need. Rewrite fallback implementation to avoid
unspecified behavior.
Mark H Weaver [Wed, 12 Mar 2014 00:34:28 +0000 (20:34 -0400)]
SRFI-60: Reimplement 'rotate-bit-field' on inums to be more portable.
* libguile/srfi-60.c (scm_srfi60_rotate_bit_field): Avoid division by
zero in the (start == end) case. Rewrite inum case to work with
unsigned integers in two's complement format.
* test-suite/tests/srfi-60.test ("rotate-bit-field"): Add more tests.
Mark H Weaver [Wed, 12 Mar 2014 00:31:38 +0000 (20:31 -0400)]
Use 'offsetof' to avoid undefined behavior.
* libguile/socket.c (SUN_LEN): Use 'offsetof'.
Mark H Weaver [Wed, 12 Mar 2014 00:19:17 +0000 (20:19 -0400)]
Avoid undefined behavior regarding signed integers and left shifts.
* libguile/numbers.c (scm_logbit_p): If the requested bit is the sign
bit (or above), check the sign portably. Otherwise, ensure that we're
testing the bit in a two's complement representation.
(left_shift_exact_integer): Avoid left-shifting negative integers.
* libguile/vm-i-scheme.c (ash): Avoid left-shifting negative integers.
Mark H Weaver [Wed, 12 Mar 2014 00:15:27 +0000 (20:15 -0400)]
Avoid signed overflow in random.c.
* libguile/random.c (scm_i_mask32): Avoid signed overflow from shifting
an unsigned char (promoted to signed int) 24 bits to the left.
Mark H Weaver [Wed, 12 Mar 2014 00:12:32 +0000 (20:12 -0400)]
Avoid side effects in argument to SCM_I_INUM.
* libguile/vm-i-system.c (halt): Avoid side effects in argument to
SCM_I_INUM.
Ludovic Courtès [Tue, 11 Mar 2014 23:03:03 +0000 (00:03 +0100)]
Thank Paul.
Ludovic Courtès [Tue, 11 Mar 2014 23:02:01 +0000 (00:02 +0100)]
Provide glthread/lock.h implementation in terms of Guile threads.
Fixes <http://bugs.gnu.org/14404>.
Thanks to Paul Eggert <eggert@cs.ucla.edu> for the suggestion.
* m4/gnulib-cache.m4: Avoid 'lock' module.
* m4/lock.m4, m4/threadlib.m4, lib/glthread/threadlib.c,
lib/glthread/lock.c: Remove.
* lib/glthread/lock.h: Rewrite in terms of libguile/threads.h.
* m4/gnulib-common.m4, m4/gnulib-comp.m4, lib/Makefile.am,
lib/unistd.in.h, maint.mk : Update, from Gnulib
v0.1-92-g546ff82.
* configure.ac (GNULIB_LOCK): Define 'GNULIB_LOCK'. Define
'USE_POSIX_THREADS' when building with pthread support.
* Makefile.am (noinst_HEADERS): New variable.
(BUILT_SOURCES): Add libguile/scmconfig.h.
(libguile/scmconfig.h): New target.
Mark H Weaver [Fri, 7 Mar 2014 09:21:46 +0000 (04:21 -0500)]
Improve compliance with C standards regarding signed integer shifts.
* configure.ac: Add -fwrapv when using GCC (or compatible), if
supported.
* libguile/numbers.h (SCM_I_MAKINUM): Cast to scm_t_bits (unsigned)
before shifting, to avoid undefined behavior.
Mark H Weaver [Fri, 7 Mar 2014 04:59:56 +0000 (23:59 -0500)]
chars.c: Remove duplicate 'const' specifiers.
* libguile/chars.c (scm_r5rs_charnums, scm_r6rs_charnums)
(scm_r7rs_charnums, scm_C0_control_charnums, scm_alt_charnums):
Remove duplicate 'const' specifiers.
Mark H Weaver [Fri, 7 Mar 2014 04:56:48 +0000 (23:56 -0500)]
snarf.h: Declare static const function name vars as SCM_UNUSED.
* libguile/snarf.h (SCM_DEFINE_GSUBR, SCM_DEFINE, SCM_PRIMITIVE_GENERIC,
SCM_DEFINE_PUBLIC, SCM_PROC, SCM_REGISTER_PROC, SCM_GPROC): Declare
static const function name variables as SCM_UNUSED to avoid spurious
warnings.
Mark H Weaver [Thu, 6 Mar 2014 22:17:11 +0000 (17:17 -0500)]
Make snarfing tools more robust to varied C preprocessor behavior.
* libguile/guile-snarf.in (modern_snarf): Rewrite sed script to cope
with newlines in the snarfed code segments, or multiple code segments
on the same line.
* module/scripts/snarf-check-and-output-texi.scm (process-stream):
Strip all 'hash' tokens from the stream.
(do-command): Remove special cases that handled 'hash' tokens
in a few places.
Mark H Weaver [Mon, 3 Mar 2014 22:20:03 +0000 (17:20 -0500)]
SRFI-19: Update the table of leap seconds.
* module/srfi/srfi-19.scm (leap-second-table): Update to include the two
most recent leap seconds.
Mark H Weaver [Sun, 2 Mar 2014 00:03:35 +0000 (19:03 -0500)]
Add missing files to the test-suite Makefile.
* test-suite/Makefile.am (SCM_TESTS): Add "tests/compiler.test",
"tests/encoding-escapes.test", "tests/encoding-iso88591.test",
"tests/encoding-iso88597.test", "tests/encoding-utf8.test",
"tests/pairs.test", "tests/records.test", "tests/sort.test",
"tests/srfi-17.test", "tests/srfi-18.test", "tests/srfi-98.test",
"tests/streams.test", "tests/vectors.test", and "tests/web-client.test".
Ludovic Courtès [Fri, 28 Feb 2014 20:00:11 +0000 (21:00 +0100)]
build: Make c-tokenize.c build on non-GNU systems.
* libguile/c-tokenize.lex: Add %top directive to include <config.h>
first. This fixes builds on systems that use Gnulib's <stdio.h> and
similar replacements. See <http://hydra.nixos.org/build/
9259627> for
an example.
Mark H Weaver [Fri, 28 Feb 2014 02:31:57 +0000 (21:31 -0500)]
SRFI-18: Export 'current-thread'.
Fixes <http://debbugs.gnu.org/16890>.
Reported by Xin Wang <dram.wang@gmail.com>.
* module/srfi/srfi-18.scm: Reexport 'current-thread'.
* THANKS: Add "Xin Wang" to fixes section.
Mark H Weaver [Fri, 28 Feb 2014 03:04:39 +0000 (22:04 -0500)]
Rely on Gnulib for <unistd.h>.
* libguile/async.c:
* libguile/backtrace.c:
* libguile/error.c:
* libguile/filesys.c:
* libguile/fports.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/gdbint.c:
* libguile/init.c:
* libguile/ioext.c:
* libguile/load.c:
* libguile/mallocs.c:
* libguile/mkstemp.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/rw.c:
* libguile/scmsigs.c:
* libguile/script.c:
* libguile/simpos.c:
* libguile/socket.c:
* libguile/stime.c:
* libguile/strports.c:
* libguile/threads.c: Unconditionally include <unistd.h>.
Mark H Weaver [Fri, 28 Feb 2014 02:24:40 +0000 (21:24 -0500)]
Rely on Gnulib for fsync, link, readlink, mkdir, rmdir, and rename.
* libguile/filesys.c: Remove 'fsync' wrapper for MinGW.
(scm_link, scm_readlink, scm_mkdir, scm_rmdir): Define these
unconditionally.
(my_rename): Remove.
(scm_rename): Use 'rename' instead of 'my_rename'.
Mark H Weaver [Thu, 27 Feb 2014 03:15:13 +0000 (22:15 -0500)]
Import Gnulib modules: link, fsync, readlink, rename, mkdir, rmdir, unistd.
* lib/fsync.c:
* lib/link.c:
* lib/mkdir.c:
* lib/strdup.c:
* m4/fsync.m4:
* m4/link.m4:
* m4/mkdir.m4:
* m4/strdup.m4: New files.
* lib/Makefile.am
* m4/gnulib-cache.m4
* m4/gnulib-comp.m4: Add modules.
Mark H Weaver [Tue, 25 Feb 2014 22:38:34 +0000 (17:38 -0500)]
Fix typo in manual.
* doc/ref/api-foreign.texi (Void Pointers and Byte Access):
(rnrs bytevector) --> (rnrs bytevectors).
Ludovic Courtès [Thu, 27 Feb 2014 13:14:21 +0000 (14:14 +0100)]
build: Fix out-of-source-tree installation of libguile-2.0-gdb.scm.
* libguile/Makefile.am (install-data-local): Use $< instead of just
libguile-2.0-gdb.scm. Quote file names in $(INSTALL_DATA) invocation.
Ludovic Courtès [Thu, 20 Feb 2014 21:57:26 +0000 (22:57 +0100)]
Make sure 'ftw' allows directory traversal when running as root.
* module/ice-9/ftw.scm (stat-dir-readable?-proc): Return #t when UID is
zero. Reported Frank Terbeck <ft@bewatermyfriend.org>.
Ludovic Courtès [Thu, 20 Feb 2014 21:56:17 +0000 (22:56 +0100)]
build: Bail out when 'PKG_CHECK_MODULES' is missing.
* configure.ac: Add 'm4_pattern_forbid' invocation.
Ludovic Courtès [Mon, 17 Feb 2014 14:40:34 +0000 (15:40 +0100)]
Add GDB extension to support Guile.
* libguile/libguile-2.0-gdb.scm: New file.
* libguile/Makefile.am (install-data-local): New target. Based on code
from GNU libstdc++.
(EXTRA_DIST): Add 'libguile-2.0-gdb.scm'.
* doc/ref/api-debug.texi (GDB Support): New section.
Ludovic Courtès [Tue, 18 Feb 2014 22:04:01 +0000 (23:04 +0100)]
Add (system base types).
* module/system/base/types.scm, test-suite/tests/types.test: New files.
* module/Makefile.am (SYSTEM_BASE_SOURCES): Add system/base/types.scm.
* test-suite/Makefile.am (SCM_TESTS): Add tests/types.test.
Mark H Weaver [Wed, 12 Feb 2014 19:28:03 +0000 (14:28 -0500)]
Fix inline asm of VM numerical operations for x32.
* libguile/vm-i-scheme.c (_CX): Choose register size based on
'SIZEOF_VOID_P' instead of '__x86_64__'.
Mark H Weaver [Wed, 12 Feb 2014 22:47:13 +0000 (17:47 -0500)]
Rely on Gnulib for 'select', 'lstat', and 'mkstemp'.
* libguile/iselect.h:
* libguile/threads.c:
* libguile/deprecated.h: Rely on Gnulib for sys/select.h.
* libguile/filesys.c: Rely on Gnulib for 'lstat' and 'mkstemp'.
Mark H Weaver [Wed, 12 Feb 2014 22:43:35 +0000 (17:43 -0500)]
Import 'lstat' and 'mkstemp' modules from Gnulib.
* lib/mkstemp.c:
* lib/secure_getenv.c:
* lib/tempname.c:
* lib/tempname.h:
* m4/mkstemp.m4:
* m4/secure_getenv.m4:
* m4/tempname.m4: New files.
* lib/Makefile.am:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4: Add modules.
David Thompson [Sun, 19 Jan 2014 18:16:02 +0000 (13:16 -0500)]
Add cooperative REPL server module.
Modified-by: Mark H Weaver <mhw@netris.org>
* module/system/repl/coop-server.scm: New module.
* module/system/repl/repl.scm (start-repl): Extract body to start-repl*.
(start-repl*): New procedure.
(run-repl): Extract body to run-repl*.
(run-repl*): New procedure.
* module/system/repl/server.scm (run-server): Extract body to
run-server*.
(run-server*): New procedure.
* doc/ref/api-evaluation.texi (Cooperative REPL Servers): New node.
* module/Makefile.am (SYSTEM_SOURCES): Add system/repl/coop-server.scm.
Mark H Weaver [Tue, 4 Feb 2014 17:18:22 +0000 (12:18 -0500)]
REPL Server: Fix 'stop-server-and-clients!'.
* module/system/repl/server.scm: Import (ice-9 match) and (srfi srfi-1).
(*open-sockets*): Add comment. This is now a list of pairs with a
'force-close' procedure in the cdr.
(close-socket!): Add comment noting that it is unsafe to call this
from another thread.
(add-open-socket!): Add 'force-close' argument, and put it in the cdr
of the '*open-sockets*' entry.
(stop-server-and-clients!): Use 'match'. Remove the first element
from *open-sockets* immediately. Call the 'force-close' procedure
instead of 'close-socket!'.
(errs-to-retry): New variable.
(run-server): Add a pipe, used in the 'force-close' procedure to
cleanly shut down the server. Put the server socket into non-blocking
mode. Use 'select' to monitor both the server socket and the pipe.
Don't call 'add-open-socket!' on the client-socket. Close the pipe
and the server socket cleanly when we're asked to shut down.
(serve-client): Call 'add-open-socket!' with a 'force-close' procedure
that cancels the thread. Set the thread cleanup handler to call
'close-socket!', instead of calling it in the main body.
* doc/ref/api-evaluation.texi (REPL Servers): Add a caveat to the manual
entry for 'stop-servers-and-clients!'.
Andy Wingo [Tue, 11 Feb 2014 19:59:38 +0000 (20:59 +0100)]
guile.m4 tweaks
* meta/guile.m4 (GUILE_PKG): Don't print "checking for guile 2.0" if
we've already found 2.2. Print the correct effective version at the
end.
(GUILE_PROGS): Allow prereleases, whose micro version does not yet
match the effective version. Default to the already-chosen effective
version.
Mark H Weaver [Sat, 8 Feb 2014 17:35:35 +0000 (12:35 -0500)]
Fix improper use of 'with-locale'.
* test-suite/guile-test (run-tests): Use 'setlocale' with check
instead of 'with-locale'.
Andy Wingo [Sat, 8 Feb 2014 15:13:54 +0000 (16:13 +0100)]
Deprecate the use of the vector interface on arrays
* libguile/vectors.c (scm_is_vector): Deprecate use on weak vectors and
arrays.
(scm_is_simple_vector): Deprecate use on weak vectors.
(scm_vector_length, scm_c_vector_ref, scm_c_vector_set_x): Deprecate
use on arrays.
* libguile/sort.c: Adapt to check explicitly for arrays.
Andy Wingo [Sat, 8 Feb 2014 15:02:59 +0000 (16:02 +0100)]
Deprecate use of vector-length, vector-ref, vector-set! as primitive-generics
* libguile/vectors.c (scm_vector_length, scm_c_vector_ref):
(scm_c_vector_set_x): Deprecate the use of vector-length, vector-ref,
and vector-set! as primitive generics.
Andy Wingo [Sat, 8 Feb 2014 13:18:40 +0000 (14:18 +0100)]
Deprecate general "uniform-vector" interface
* libguile/uniform.h:
* libguile/uniform.c (scm_is_uniform_vector, scm_uniform_vector_p)
(scm_c_uniform_vector_length, scm_uniform_vector_length)
(scm_uniform_vector_element_type, scm_uniform_vector_element_size)
(scm_c_uniform_vector_ref, scm_uniform_vector_ref):
(scm_c_uniform_vector_set_x, scm_uniform_vector_set_x):
(scm_uniform_vector_to_list)
(scm_uniform_vector_elements, scm_uniform_vector_writable_elements):
Deprecate. This interface lacked both generality and specificity.
The general replacement is array-length, array-ref, and friends on the
scheme side, or the array handle interface on the C side. On the
specific side of things, there are the specific bytevector, srfi-4,
and bitvector interfaces.
* test-suite/tests/arrays.test:
* test-suite/tests/bitvectors.test:
* test-suite/tests/ports.test:
* test-suite/tests/srfi-4.test: Update to use array interfaces.
* doc/ref/api-foreign.texi (Void Pointers and Byte Access):
* doc/ref/srfi-modules.texi (SRFI-4): Update.
Andy Wingo [Sat, 8 Feb 2014 12:52:21 +0000 (13:52 +0100)]
Simplify srfi-4 C implementation
* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): In the raw element
accessors (e.g scm_u32vector_writable_elements), only permit
bytevectors, as the constructors will only make bytevectors. This
harmonizes with the Scheme interfaces as well, which expect packed
bytevectors.
(scm_make_srfi_4_vector): Knowing that the new value is a bytevector
with base 0 and inc 1, simplify initialization.
Andy Wingo [Sat, 8 Feb 2014 13:27:49 +0000 (14:27 +0100)]
Deprecate htons, htonl, ntohs, ntohl
* libguile/sockets.h:
* libguile/sockets.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_htons, scm_htonl, scm_ntohs, scm_ntohl):
Deprecate. Bytevectors adequately subsume their functionality.
* doc/ref/posix.texi:
* test-suite/tests/00-socket.test: Update.
Mark H Weaver [Sat, 8 Feb 2014 02:42:28 +0000 (21:42 -0500)]
Improve handling of locales in the test suite.
* test-suite/guile-test (run-tests): Load each test file within
(with-locale "C" ...).
* test-suite/tests/encoding-iso88591.test:
* test-suite/tests/encoding-iso88597.test:
* test-suite/tests/encoding-utf8.test:
* test-suite/tests/srfi-14.test: Remove broken code to save and restore
the previous locale.
* test-suite/tests/bytevectors.test:
* test-suite/tests/format.test:
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-19.test:
* test-suite/tests/tree-il.test: Make sure 'setlocale' is defined before
calling it.
Mark H Weaver [Fri, 7 Feb 2014 21:53:48 +0000 (16:53 -0500)]
Better error reporting in 'weak-vector-ref' and 'weak-vector-set!'.
* libguile/weaks.c (scm_c_weak_vector_ref, scm_c_weak_vector_set_x):
Pass procedure name to 'scm_out_of_range'.
Mark H Weaver [Fri, 7 Feb 2014 21:38:58 +0000 (16:38 -0500)]
Make size argument optional to 'make-doubly-weak-hash-table'; fix docs.
* libguile/hashtab.c (scm_make_doubly_weak_hash_table): Make 'size'
argument optional, like the weak hash table constructors.
* doc/ref/api-memory.texi (Weak hash tables): Document that 'size'
argument is optional for the weak hash table constructors.
Mark H Weaver [Fri, 7 Feb 2014 21:26:38 +0000 (16:26 -0500)]
Fix 'weak-vector?' doc: Weak hash tables are not weak vectors.
* doc/ref/api-memory.texi (Weak vectors): In 'weak-vector?' entry, don't
claim that weak hash tables are weak vectors. Remove statement that
weak vectors are mainly useful for implementing weak hash tables.
Andy Wingo [Fri, 7 Feb 2014 17:04:20 +0000 (18:04 +0100)]
Fix truncated-print for uniform vectors
* module/ice-9/pretty-print.scm (truncated-print): Use bytevector?
instead of uniform-vector?; the latter could be true for shared arrays
with non-zero lower bounds.
Andy Wingo [Fri, 7 Feb 2014 17:00:04 +0000 (18:00 +0100)]
(srfi srfi-4 gnu) uses private define-bytevector-type from (srfi srfi-4)
* module/srfi/srfi-4/gnu.scm: Re-use implementation of
define-bytevector-type from srfi-4.
Andy Wingo [Fri, 7 Feb 2014 16:57:30 +0000 (17:57 +0100)]
Remove private unused duplicate c32/c64vector definitions
* module/srfi/srfi-4.scm: Remove vestigial definitions for c32vectors
and c64vectors. Those are defined in (srfi srfi-4 gnu).
Andy Wingo [Fri, 7 Feb 2014 16:53:01 +0000 (17:53 +0100)]
SRFI-4 predicates, length accessors only accept bytevectors (not arrays)
* module/srfi/srfi-4.scm (define-bytevector-type): For the predicates
and length accessors, only accept bytevectors. Since arrays don't
work for u32vector-ref et al, they shouldn't pass u32vector?.
Andy Wingo [Fri, 7 Feb 2014 11:42:44 +0000 (12:42 +0100)]
Deprecate vector-ref, vector-length, vector-set! on weak vectors
* libguile/vectors.c (scm_vector_length, scm_c_vector_length):
(scm_c_vector_ref, scm_c_vector_set_x): Deprecate the use of these
procedures on weak vectors.
* test-suite/tests/guardians.test:
* test-suite/tests/weaks.test: Adapt test suites.
Andy Wingo [Fri, 7 Feb 2014 11:25:05 +0000 (12:25 +0100)]
Add weak-vector-length, weak-vector-ref, weak-vector-set!
* libguile/weaks.c (scm_is_weak_vector, scm_c_weak_vector_length):
(scm_c_weak_vector_ref, scm_c_weak_vector_set_x): New interfaces for
dealing with weak vectors from C.
(scm_weak_vector_length, scm_weak_vector_ref, scm_weak_vector_set_x):
New Scheme interfaces to weak vectors; to be used instead of
vector-length, vector-ref, etc.
* module/ice-9/weak-vector.scm: Export the new interfaces.
* doc/ref/api-memory.texi (Weak vectors): Document them.
Mark H Weaver [Thu, 6 Feb 2014 04:40:25 +0000 (23:40 -0500)]
Remove outdated documentation of LTDL_LIBRARY_PATH.
* doc/ref/guile-invoke.texi (Environment Variables): Remove
documentation of 'LTDL_LIBRARY_PATH'.
Mark H Weaver [Thu, 6 Feb 2014 04:25:32 +0000 (23:25 -0500)]
Document 'equal?' in list of R6RS incompatibilities.
* doc/ref/r6rs.texi (R6RS Incompatibilities): Mention that 'equal?'
may not terminate when applied to cyclic datums.
Mark H Weaver [Tue, 4 Feb 2014 19:21:13 +0000 (14:21 -0500)]
REPL Server: Remove unneeded error case in 'run-server'.
* module/system/repl/server.scm (run-server): Remove case that handled
'interrupt' exceptions specially. It is no longer needed since
e6c8e6047ed2e772cc4e1fb5ad4d389e5c616feb (REPL Server: Don't establish
a SIGINT handler.)
Mark H Weaver [Tue, 4 Feb 2014 17:08:48 +0000 (12:08 -0500)]
REPL Server: Redirect warnings to client socket.
* module/system/repl/server.scm (serve-client): Use parameterize.
Redirect warnings to client socket.
Mark H Weaver [Tue, 4 Feb 2014 04:09:23 +0000 (23:09 -0500)]
Don't check HAVE_ALARM, which no longer exists.
* libguile/scmsigs.c (scm_alarm): Remove check for HAVE_ALARM.
Conditionalize only on HAVE_DECL_ALARM.
Mark H Weaver [Tue, 4 Feb 2014 02:04:39 +0000 (21:04 -0500)]
Update Gnulib to
v0.1-77-gd9361da
Mark H Weaver [Mon, 3 Feb 2014 02:13:47 +0000 (21:13 -0500)]
define-values: Blackhole 'dummy'; work around lack of toplevel hygiene.
* module/ice-9/boot-9.scm (define-values): Use 'generate-temporaries' to
generate a fresh name for 'dummy', to work around the lack of hygiene
for macro-introduced toplevel identifiers. Blackhole 'dummy' to avoid
keeping garbage alive. Add more comments.
Mark H Weaver [Sun, 12 Jan 2014 09:43:37 +0000 (04:43 -0500)]
Implement R7RS 'define-values'.
* module/ice-9/boot-9.scm (%define-values-arity-error): New procedure.
(define-values): New macro.
* doc/ref/api-binding.texi (Binding Multiple Values): Add docs.
* test-suite/tests/syntax.test: Add tests.
Mark H Weaver [Wed, 29 Jan 2014 07:20:01 +0000 (02:20 -0500)]
Implement SRFI-64 - A Scheme API for test suites.
* module/srfi/srfi-64.scm: New file.
* module/srfi/srfi-64/testing.scm: New file.
* module/Makefile.am: Add rule for srfi-64.go dependency on
srfi-64/testing.scm.
(SRFI_SOURCES): Add srfi/srfi-64.scm.
(NOCOMP_SOURCES): Add srfi/srfi-64/testing.scm.
* doc/ref/srfi-modules.texi (SRFI-64): New node.
* test-suite/tests/srfi-64.test: New file.
* test-suite/tests/srfi-64-test.scm: New file.
* test-suite/Makefile.am (SCM_TESTS): Add test-suite/tests/srfi-64.test.
(EXTRA_DIST): Add tests/srfi-64-test.scm.
Mark H Weaver [Mon, 27 Jan 2014 22:17:23 +0000 (17:17 -0500)]
Implement SRFI-43 Vector Library.
* module/srfi/srfi-43.scm: New file.
* module/Makefile.am (SRFI_SOURCES): Add module/srfi/srfi-43.scm.
* test-suite/tests/srfi-43.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add test-suite/tests/srfi-43.test.
* doc/ref/srfi-modules.texi (SRFI-43, SRFI-43 Constructors)
(SRFI-43 Predicates, SRFI-43 Selectors, SRFI-43 Iteration)
(SRFI-43 Searching, SRFI-43 Mutators, SRFI-43 Conversion): New nodes.
Mark H Weaver [Tue, 28 Jan 2014 22:44:22 +0000 (17:44 -0500)]
Compile numerical comparisons with more than 2 arguments to VM code.
* module/language/tree-il/primitives.scm (chained-comparison-expander):
New procedure.
(*primitive-expand-table*): Add primitive expanders for '<', '>',
'<=', '>=', and '='.
Mark H Weaver [Fri, 31 Jan 2014 09:01:12 +0000 (04:01 -0500)]
Revert "Primitive expand numerical comparisons with more than 2 arguments."
This reverts commit
4dc4b86e858d391d20d0ea2551614a89fa3bd4d1.
Mark H Weaver [Tue, 28 Jan 2014 22:44:22 +0000 (17:44 -0500)]
Primitive expand numerical comparisons with more than 2 arguments.
* module/language/tree-il/primitives.scm (chained-comparison-expander):
New procedure.
(*primitive-expand-table*): Add primitive expanders for '<', '>',
'<=', '>=', and '='.
Mark H Weaver [Tue, 28 Jan 2014 21:54:10 +0000 (16:54 -0500)]
Add 'positive?' and 'negative?' as primitives.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*)
(*effect-free-primitives*): Add 'positive?' and 'negative?'.
(*primitive-expand-table*): Add primitive expanders for 'positive?'
and 'negative?'.
Andy Wingo [Tue, 28 Jan 2014 21:28:08 +0000 (22:28 +0100)]
Minor for-each speedup
* module/ice-9/boot-9.scm (for-each): Minor speedup by unrolling
tortoise/hare loop.
Mark H Weaver [Fri, 24 Jan 2014 05:21:17 +0000 (00:21 -0500)]
Implement SRFI-111 Boxes.
* 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.
Mark H Weaver [Thu, 23 Jan 2014 16:37:36 +0000 (11:37 -0500)]
Fix thread-unsafe lazy initializations.
* libguile/backtrace.c (print_exception_var): New static variable.
(init_print_exception_var): New static function.
(scm_print_exception): Remove thread-unsafe lazy initialization.
Call 'init_print_exception_var' using 'scm_i_pthread_once'.
Use 'print_exception_var'.
* libguile/continuations.c (call_cc): New static variable.
(init_call_cc): New static function.
(scm_i_call_with_current_continuation): Remove thread-unsafe lazy
initialization. Call 'init_call_cc' using 'scm_i_pthread_once'.
* libguile/debug.c (local_eval_var): New static variable.
(init_local_eval_var): New static function.
(scm_local_eval): Remove lazy initialization using mutexes.
Call 'init_local_eval_var' using 'scm_i_pthread_once'.
Use 'scm_variable_ref' instead of 'SCM_VARIABLE_REF'.
* libguile/eval.c (map_var, for_each_var): New static variables.
(init_map_var, init_for_each_var): New static functions.
(scm_map, scm_for_each): Remove thread-unsafe lazy initializations.
Call 'init_map_var' (or 'init_for_each_var') using 'scm_i_pthread_once'.
Use 'map_var' (or 'for_each_var').
* libguile/frames.c (frame_arguments_var): New static variable.
(init_frame_arguments_var): New static function.
(scm_frame_arguments): Remove thread-unsafe lazy initialization.
Call 'init_frame_arguments_var' using 'scm_i_pthread_once'.
Use 'frame_arguments_var'. Use 'scm_variable_ref' instead of
'SCM_VARIABLE_REF'.
* libguile/goops.c (delayed_compile_var): New static variable.
(init_delayed_compile_var): New static function.
(make_dispatch_procedure): Remove thread-unsafe lazy initialization.
Call 'init_delayed_compile_var' using 'scm_i_pthread_once'.
Use 'delayed_compile_var'. Use 'scm_variable_ref' instead of
'SCM_VARIABLE_REF'.
* libguile/instructions.c (instructions_by_name): New static variable.
(init_instructions_by_name): New static function.
(scm_lookup_instruction_by_name): Remove thread-unsafe lazy
initialization. Call 'init_instructions_by_name' using
'scm_i_pthread_once'.
* libguile/ports.c (current_warning_port_var)
(current_warning_port_once): New static variables.
(init_current_warning_port_var): New static function.
(scm_current_warning_port): Remove lazy initialization using mutexes.
Call 'init_current_warning_port_var' using 'scm_i_pthread_once'.
Use 'current_warning_port_var'.
(scm_set_current_warning_port): Remove thread-unsafe lazy initialization.
Call 'init_current_warning_port_var' using 'scm_i_pthread_once'.
Use 'current_warning_port_var'.
* libguile/strings.c (null_stringbuf): New static variable.
(init_null_stringbuf): New static function.
(scm_i_make_string): Remove thread-unsafe lazy initialization.
Call 'init_null_stringbuf' using 'scm_i_pthread_once'.
* libguile/strports.c (eval_string_var, k_module): New static variables.
(init_eval_string_var_and_k_module): New static function.
(scm_eval_string_in_module): Remove lazy initialization using mutexes.
Call 'init_eval_string_var_and_k_module' using 'scm_i_pthread_once'.
Use 'eval_string_var'.
* libguile/throw.c (CACHE_VAR): Remove incorrect macro.
(catch_var, throw_var, with_throw_handler_var): New static variables.
(scm_catch, scm_catch_with_pre_unwind_handler): Remove thread-unsafe
lazy initialization. Use 'catch_var'.
(init_with_throw_handler_var): New static function.
(scm_with_throw_handler): Remove thread-unsafe lazy initialization.
Call 'init_with_throw_handler_var' using 'scm_i_pthread_once'.
Use 'with_throw_handler_var'.
(scm_throw): Remove thread-unsafe lazy initialization.
Use 'throw_var'.
(scm_init_throw): Initialize 'catch_var' and 'throw_var'.
Mark H Weaver [Thu, 23 Jan 2014 15:09:29 +0000 (10:09 -0500)]
Improve correctness and consistency of 'eval-when' usage.
* 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.
Mark H Weaver [Thu, 23 Jan 2014 08:49:21 +0000 (03:49 -0500)]
Improve docs for 'eval-when'.
* doc/ref/api-macros.texi (Eval When): Explain in detail what each
condition means, including 'expand' which was previously undocumented.
Change the example to use (expand load eval) and recommend that set of
conditions, instead of (compile load eval) which was previously
recommended and shown in the example.
Ludovic Courtès [Tue, 21 Jan 2014 22:39:30 +0000 (23:39 +0100)]
Buffered custom binary input ports correctly handle partial read requests.
* libguile/r6rs-ports.c (cbip_fill_input): Always initialize 'read_pos'
when BUFFERED.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
input port buffered partial reads"]: New test.
Mark H Weaver [Tue, 21 Jan 2014 21:21:36 +0000 (16:21 -0500)]
Fix nested block comment example in manual.
Reported by Chris K. Jester-Young <cky944@gmail.com>.
* doc/ref/api-evaluation.texi (Block Comments): Fix example.
Mark H Weaver [Tue, 21 Jan 2014 21:06:40 +0000 (16:06 -0500)]
REPL Server: Don't establish a SIGINT handler.
* module/system/repl/server.scm (call-with-sigint): Remove.
(accept-new-client): Don't wrap 'call-with-sigint' around call to
'accept'.