Andy Wingo [Fri, 6 Aug 2010 11:15:58 +0000 (13:15 +0200)]
s/extensionsdir/extensiondir/
* libguile/Makefile.am (libpath.h): Change "extensionsdir" to
"extensiondir".
* meta/guile-2.0.pc.in (extensiondir): Likewise.
Andy Wingo [Fri, 6 Aug 2010 11:15:29 +0000 (13:15 +0200)]
%site-dir is specific to the effective version
* libguile/load.h:
* libguile/load.c (scm_sys_global_site_dir): New API, is what %site-dir
used to be.
(scm_sys_site_dir): Changed to be a version-specific dir.
(scm_init_load_path): Search the version-specific sitedir before the
global one.
* libguile/Makefile.am (libpath.h): Update SCM_SITE_DIR and
SCM_GLOBAL_SITE_DIR, as appropriate.
Andy Wingo [Fri, 6 Aug 2010 10:27:11 +0000 (12:27 +0200)]
only one Value History section
* doc/ref/repl-modules.texi: Remove section on Value History, it's
covered in scheme-using.
* doc/ref/scheme-using.texi: Rename "Value Historyx" section to "Value
History".
* doc/ref/guile.texi: Update xref.
Andy Wingo [Fri, 6 Aug 2010 10:16:49 +0000 (12:16 +0200)]
add settable identifier syntax docs
* doc/ref/api-macros.texi (Identifier Macros): Add documentation for
settable identifier syntax.
Andy Wingo [Fri, 6 Aug 2010 09:52:27 +0000 (11:52 +0200)]
letrec* in docs, and some r6rs fixes
* doc/ref/api-binding.texi: Add docs for letrec*, and revise some other
text.
* doc/ref/compiler.texi: Update <letrec> for in-order?.
* doc/ref/r6rs.texi: Add letrec* entry.
* module/rnrs.scm:
* module/rnrs/base.scm: Export letrec*.
Andy Wingo [Thu, 5 Aug 2010 09:17:09 +0000 (11:17 +0200)]
fold 1.9.11 news into main body
* NEWS: Update.
Andy Wingo [Wed, 4 Aug 2010 19:48:00 +0000 (21:48 +0200)]
fix vector-move-right! and vector-move-left!
* libguile/vectors.c (scm_vector_move_left_x, scm_vector_move_right_x):
Fix some bugs reported by Michael Lucy -- both variants would happily
write beyond the end, and vector-move-right! didn't increment the
counter before copying in the reverse direction.
* test-suite/tests/vectors.test ("vector-move-left!"):
("vector-move-right!"): Add tests.
Yan Li [Wed, 4 Aug 2010 07:02:43 +0000 (15:02 +0800)]
Compiling DOT_X_FILES requires version.h
There was a race condition when building Guile since DOT_X_FILES didn't
depend on version.h, which is dynamically generated. Sometimes the
DOT_X_FILES are compiled before the version.h is generated and leads to
build failure. This patch fixed this problem.
Signed-off-by: Yan Li <yan.i.li@intel.com>
Andreas Rottmann [Sun, 1 Aug 2010 19:53:29 +0000 (21:53 +0200)]
Fix the range of `random' on 64-bit platforms
For > 32 bit integers still in the fixnum range, scm_random() would
return random numbers with a lower range than specified.
* libguile/random.c (scm_i_mask32): New static inline function.
(scm_c_random): Use `scm_i_mask32'.
(scm_c_random64): New function, 64-bit variant of scm_c_random.
(scm_random): Use `scm_c_random64' instead of forming the 64-bit random
number in a bogus way.
* libguile/random.h: Added `scm_c_random64'.
Ludovic Courtès [Wed, 28 Jul 2010 10:02:50 +0000 (12:02 +0200)]
Fix `parse-c-struct'.
* module/system/foreign.scm (parse-c-struct): Update use of
`pointer->bytevector' to the new API.
* test-suite/tests/foreign.test ("structs"): New test prefix.
Ludovic Courtès [Wed, 28 Jul 2010 10:01:54 +0000 (12:01 +0200)]
Update the FFI doc.
* doc/ref/api-foreign.texi (Foreign Types): Remove bits about typed
foreign pointers. Add `void'.
(Foreign Variables): Update the doc of `dynamic-pointer' and the
`numptob' example. Remove `foreign-set!' and `foreign-ref'. Add
`pointer-address', `make-pointer', `%null-pointer', and
`null-pointer?'
(Void Pointers and Byte Access): Make it clear that wrapped pointers
are untyped. Remove `void' from here. Replace `foreign->bytevector'
and `bytevector->foreign' by `pointer->bytevector' and
`bytevector->pointer'. Add `dereference-pointer' and the rest of the
`numptob' example.
(Dynamic FFI): Update examples. Remove `%null-pointer' from here.
* libguile/dynl.c (scm_dynamic_pointer): Update docstring.
* libguile/foreign.c (scm_dereference_pointer,
scm_pointer_to_bytevector): Likewise.
* module/system/foreign.scm (null-pointer?): Add docstring.
Ludovic Courtès [Tue, 27 Jul 2010 16:46:23 +0000 (18:46 +0200)]
Remove unused parameter from `bytevector->pointer'.
* libguile/foreign.c (scm_bytevector_to_pointer): Remove unused LEN
parameter. Update docstring.
Ludovic Courtès [Tue, 27 Jul 2010 16:44:45 +0000 (18:44 +0200)]
Always return `%null-pointer' when creating a NULL pointer with no finalizer.
* libguile/foreign.c (scm_make_pointer): Always call out to
`scm_from_pointer'.
(scm_from_pointer): Return NULL_POINTER when PTR and FINALIZER are
NULL.
Ludovic Courtès [Tue, 27 Jul 2010 12:54:53 +0000 (14:54 +0200)]
Use "pointer" instead of "foreign" when dealing with wrapped pointers.
* libguile/foreign.h (scm_t_foreign_finalizer): Rename to...
(scm_t_pointer_finalizer): ... this.
(SCM_FOREIGN_P): Rename to...
(SCM_POINTER_P): this.
(SCM_VALIDATE_FOREIGN): Rename to...
(SCM_VALIDATE_POINTER): ... this.
(SCM_FOREIGN_HAS_FINALIZER): Rename to...
(SCM_POINTER_HAS_FINALIZER): ... this.
(scm_take_foreign_pointer): Rename to...
(scm_from_pointer): ... this.
(scm_foreign_address): Rename to...
(scm_pointer_address): ... this.
(scm_foreign_to_bytevector): Rename to...
(scm_pointer_to_bytevector): ... this.
(scm_foreign_set_finalizer_x): Rename to...
(scm_set_pointer_finalizer_x): ... this.
(scm_bytevector_to_foreign): Rename to...
(scm_bytevector_to_pointer): ... this.
(scm_i_foreign_print): Rename to...
(scm_i_pointer_print): ... this.
* libguile/foreign.c: Update accordingly.
* libguile/tags.h (scm_tc7_foreign): Rename to...
(scm_tc7_pointer): ... this.
* libguile/foreign.c, libguile/deprecated.c, libguile/dynl.c,
libguile/evalext.c, libguile/gc.c, libguile/goops.c, libguile/gsubr.c,
libguile/gsubr.h, libguile/print.c, libguile/snarf.h,
libguile/vm-i-system.c, module/system/foreign.scm,
test-suite/standalone/test-ffi, test-suite/tests/foreign.test: Update
accordingly.
Andy Wingo [Tue, 27 Jul 2010 09:32:31 +0000 (11:32 +0200)]
64-bit random fixes
* libguile/random.c (scm_random): Fix generation of inum randoms with
more than 32 bits.
* libguile/random.h (scm_t_rstate): Fix a comment.
Ludovic Courtès [Mon, 26 Jul 2010 17:36:03 +0000 (19:36 +0200)]
Add `dereference-pointer' to `(system foreign)'.
* libguile/foreign.c (scm_dereference_pointer): New function.
* libguile/foreign.h (scm_dereference_pointer): New declaration.
* module/system/foreign.scm (dereference-pointer): Likewise.
* test-suite/tests/foreign.test
("foreign<->bytevector")["dereference-pointer"]: New test.
Ludovic Courtès [Mon, 26 Jul 2010 15:44:43 +0000 (17:44 +0200)]
Simplify the (system foreign) API.
Suggested by Neil Jerram.
* libguile/foreign.h (SCM_FOREIGN_TYPE, SCM_FOREIGN_VALUE_REF,
SCM_FOREIGN_VALUE_SET, SCM_FOREIGN_LEN, SCM_FOREIGN_TYPED_P,
SCM_FOREIGN_VALUE_P, SCM_VALIDATE_FOREIGN_VALUE, scm_foreign_set_x,
scm_foreign_type): Remove.
(scm_foreign_ref): Rename to...
(scm_foreign_address): ... this.
(scm_take_foreign_pointer): Update.
(SCM_FOREIGN_POINTER): Remove CTYPE argument. Update callers.
(scm_make_pointer): New declaration.
* libguile/foreign.c (scm_to_uintptr, scm_from_uintptr): New macros.
(scm_make_pointer): New function.
(scm_take_foreign_pointer): Remove TYPE and LEN arguments. Update
callers.
(scm_foreign_ref): Remove to...
(scm_foreign_address): ... this. Remove type-related code.
(scm_foreign_set_x): Remove.
(scm_foreign_to_bytevector): Change argument order; make LEN argument
compulsory.
(scm_i_foreign_print): Remove type printing.
(unpack): Remove foreign-type checking.
* libguile/deprecated.c (scm_dynamic_args_call): Update accordingly.
* libguile/dynl.c (scm_dynamic_pointer): Remove the TYPE and LEN
arguments; update callers. Update to the new foreign API.
* libguile/dynl.h (scm_dynamic_pointer): Update.
* libguile/gsubr.c (create_gsubr): Update to the new foreign API.
* libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_GENERIC): Ditto.
* libguile/snarf.h (SCM_IMMUTABLE_FOREIGN): Ditto.
* libguile/vm-i-system.c (subr_call): Ditto.
* module/system/foreign.scm (null-pointer?): New procedure.
* test-suite/standalone/test-ffi: Update to the new
`bytevector->foreign' signature.
* test-suite/tests/foreign.test ("null pointer")["null pointer
identity", "null-pointer? %null-pointer"]: New tests.
["foreign-set! other-null-pointer", "foreign->bytevector
other-null-pointer"]: Remove.
("make-pointer", "foreign<->bytevector"): New test prefixes.
Ludovic Courtès [Mon, 26 Jul 2010 14:36:24 +0000 (16:36 +0200)]
Import unbound variable reports in the VM.
* libguile/vm-engine.c (VM_NAME)[vm_error_unbound]: Add comment.
* libguile/vm-i-system.c (variable_ref): Attempt provide the name of X
in FINISH_ARGS.
Ludovic Courtès [Mon, 26 Jul 2010 09:56:25 +0000 (11:56 +0200)]
Check for go/scm mtime ordering rather than equality.
* am/guilec (install-data-hook): Remove.
(guile_install_go_files): New variable.
($(guile_install_go_files)): New dependency.
* libguile/load.c (compiled_is_fresh): Check for ordering of STAT_SOURCE
and STAT_COMPILED, not equality.
* module/ice-9/boot-9.scm (load): Ditto.
* module/system/base/compile.scm (call-with-output-file/atomic): Don't
set the timestamp of TEMPLATE.
Andy Wingo [Mon, 26 Jul 2010 14:36:15 +0000 (16:36 +0200)]
rstates point to rngs
* libguile/random.h (scm_t_rstate): Include the rng in the rstate, so we
can actually have multiple rngs. Instead of reserved0 / reserved1,
reserve a double explicitly for scm_c_normal01.
(scm_c_uniform32): Change to call the rstate's rng.
* libguile/random.c: Change to access an rstate's rng through its rng
pointer.
(scm_c_normal01): Instead of a flag and a next double, just check that
the double is equal to 0.0. Excluding one value shouldn't affect the
distribution, right?
Andy Wingo [Mon, 26 Jul 2010 13:12:42 +0000 (15:12 +0200)]
update docs
* doc/ref/api-data.texi:
* libguile/random.c: Update datum->random-state and random-state->datum
docs.
Andy Wingo [Mon, 26 Jul 2010 12:57:46 +0000 (14:57 +0200)]
refactor datum->random-state / random-state->datum
* libguile/random.c (scm_t_i_rstate): Move here from random.h, along
with prototypes for functions
(scm_i_uniform32, scm_i_init_rstate, scm_i_copy_rstate): Change to
take a stock scm_t_rstate as an arg, and cast it. This way we don't
cast the pointers below.
(scm_i_rstate_from_datum, scm_i_rstate_from_datum): Same and rename
from scm_i_init_rstate_scm / scm_i_expose_rstate.
(scm_c_rstate_from_datum): Rename from scm_c_make_rstate_scm.
(scm_datum_to_random_state, scm_random_state_to_datum): Rename from
scm_external_to_random_state and scm_random_state_to_external.
(scm_init_random): Remove casts.
* libguile/random.h (scm_t_rng): Rename init_rstate_scm, expose_rstate
vmethods to from_datum, to_datum. Remove internal definitions. Rename
to scm_c_rstate_from_datum, and provide scm_random_state_to_datum and
scm_datum_to_random_state.
Andy Wingo [Thu, 22 Jul 2010 19:26:19 +0000 (21:26 +0200)]
low-level RNG interfaces deal in scm_t_uint32, not unsigned long
* libguile/random.h (scm_t_rng): random_bits returns a scm_t_uint32.
(scm_i_uniform32, scm_t_i_rstate): Internal RNG returns a
scm_t_uint32, as advertised, instead of unsigned long.
(scm_c_random): Return a scm_t_uint32 instead of an unsigned long.
* libguile/random.c (scm_i_uniform32, scm_i_init_rstate_scm):
(scm_i_expose_rstate, scm_c_random, scm_c_random_bignum, scm_random)
(scm_init_random): Adapt types to match implementation.
Andy Wingo [Thu, 22 Jul 2010 18:56:55 +0000 (20:56 +0200)]
remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64
* libguile/__scm.h:
* libguile/numbers.h:
* libguile/random.c:
* libguile/srfi-4.c:
* libguile/srfi-4.h:
* libguile/numbers.c:
* test-suite/standalone/test-conversion.c:
* libguile/gen-scmconfig.c: As we require 64-bit integers in
configure.ac, remove conditional definition of 64-bit types.
Andreas Rottmann [Thu, 22 Jul 2010 16:26:00 +0000 (18:26 +0200)]
Allow exposing of random number generator state
Now the random number generator state can be obtained in external
(i.e. `read'/`write'-able) form via the new procedure
`random-state->external'. An externalized state can be reinstantiated by
calling `external->random-state'.
* libguile/random.c (scm_i_init_rstate_scm, scm_i_expose_rstate): New
internal functions.
* libguile/random.c (scm_c_make_rstate_scm, scm_external_to_random_state,
scm_random_state_to_external): New public functions.
* libguile/random.h: Add prototypes for the above functions.
* libguile/random.h (scm_t_rng): Add new fields `init_rstate_scm' and
`expose_rstate'.
* libguile/random.c (scm_init_random): Initialize the new fields in
`scm_the_rng'.
Thien-Thi Nguyen [Sat, 24 Jul 2010 20:25:24 +0000 (22:25 +0200)]
Fix "make dist" regression: Distribute guile-func-name-check.
Regression introduced 2010-07-22,
"Avoid no-op config-subst for libguile/guile-func-name-check".
* libguile/Makefile.am (noinst_SCRIPTS):
Move guile-func-name-check from here...
(EXTRA_DIST): ...to here.
Thien-Thi Nguyen [Thu, 22 Jul 2010 20:55:02 +0000 (22:55 +0200)]
Update AUTHORS to reflect now-removed guile-snarf-docs-texi; nfc.
Thien-Thi Nguyen [Thu, 22 Jul 2010 19:02:45 +0000 (21:02 +0200)]
[maint] Remove unused script guile-doc-snarf.
* doc/ref/tools.texi (Doc Snarfing): Don't mention guile-doc-snarf.
* configure.ac (libguile/guile-doc-snarf): Delete ‘GUILE_CONFIG_SCRIPT’.
* libguile/Makefile.am (noinst_SCRIPTS): Remove guile-doc-snarf.
* libguile/.gitignore: Remove guile-doc-snarf.
* libguile/guile-doc-snarf.in: Delete file.
* module/scripts/doc-snarf.scm: Comment munging; nfc.
* AUTHORS: Update.
Thien-Thi Nguyen [Thu, 22 Jul 2010 12:25:27 +0000 (14:25 +0200)]
Add copyright notice to acinclude.m4.
* acinclude.m4: Add copyright notice, with years derived from "git log" output.
Thien-Thi Nguyen [Thu, 22 Jul 2010 12:22:42 +0000 (14:22 +0200)]
[build] Move GUILE_CONFIG_SCRIPT to acinclude.m4.
* configure.ac (GUILE_CONFIG_SCRIPT): Move from here...
* acinclude.m4 (GUILE_CONFIG_SCRIPT): ...to here.
Thien-Thi Nguyen [Thu, 22 Jul 2010 12:17:26 +0000 (14:17 +0200)]
[maint] Avoid no-op config-subst for libguile/guile-func-name-check.
* configure.ac (libguile/guile-func-name-check): Remove ‘GUILE_CONFIG_SCRIPT’.
* libguile/Makefile.am (.c.doc): Look in $(srcdir) for awk script.
* libguile/guile-func-name-check: Rename from guile-func-name-check.in.
Thien-Thi Nguyen [Thu, 22 Jul 2010 11:59:12 +0000 (13:59 +0200)]
[build] Overhaul <errno.h>, <signal.h> cpp symbol extraction/checking.
* libguile/Makefile.am (BUILT_SOURCES): Delete cpp_err_symbols.c,
cpp_sig_symbols.c; add cpp-E.c, cpp-SIG.c.
(EXTRA_DIST): Delete cpp_signal.c, cpp_errno.c, cpp_err_symbols.in,
cpp_err_symbols.c, cpp_sig_symbols.c, cpp_sig_symbols.in, cpp_cnvt.awk;
add cpp-E.syms, cpp-E.c, cpp-SIG.syms, cpp-SIG.c.
(error.x, posix.x): Update prereq list.
(cpp_err_symbols.c, cpp_sig_symbols.c): Delete targets.
(check_signals, check_errnos): Likewise.
(.syms.c): New pattern rule.
(chknew-E, chknew-SIG): New targets.
(MOSTLYCLEANFILES): Delete cpp_err_symbols_here, cpp_err_symbols_diff,
cpp_err_symbols_new, cpp_sig_symbols_here, cpp_sig_symbols_diff,
cpp_sig_symbols_new.
* libguile/cpp-E.syms: Rename from libguile/cpp_err_symbols.in.
* libguile/cpp-SIG.syms: Rename from libguile/cpp_sig_symbols.in.
* libguile/error.c (scm_init_error): #include "libguile/cpp-E.c".
* libguile/posix.c (scm_init_posix): #include "libguile/cpp-SIG.c".
* libguile/cpp_cnvt.awk: Delete file.
* libguile/cpp_errno.c: Delete file.
* libguile/cpp_signal.c: Delete file.
Andy Wingo [Wed, 21 Jul 2010 10:15:50 +0000 (12:15 +0200)]
fix git-version-gen to work with bsd sed and obsolete regexps
* configure.ac: Avoid + in git-version-gen sed script, as it doesn't
work on BSD sed with obsolete regexps.
Ludovic Courtès [Mon, 12 Jul 2010 22:07:12 +0000 (00:07 +0200)]
Start rewriting SRFI-1 in Scheme.
This partially reverts commit
e556f8c3c6b74ee6596e8dcbe829109d7745da2c
(Fri May 6 2005).
* module/srfi/srfi-1.scm (xcons, list-tabulate, not-pair?, car+cdr,
last, fold, list-index): New procedures.
* srfi/srfi-1.c (srfi1_module): New variable.
(CACHE_VAR): New macro.
(scm_srfi1_car_plus_cdr, scm_srfi1_fold, scm_srfi1_last,
scm_srfi1_list_index, scm_srfi1_list_tabulate, scm_srfi1_not_pair_p,
scm_srfi1_xcons): Rewrite as proxies of the corresponding Scheme
procedure.
* test-suite/tests/srfi-1.test ("list-tabulate")["-1"]: Change exception
type to `exception:wrong-type-arg'.
* benchmark-suite/benchmarks/srfi-1.bm: New file.
* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add
`benchmarks/srfi-1.bm'.
* test-suite/standalone/Makefile.am (test_srfi_1_SOURCES,
test_srfi_1_CFLAGS, test_srfi_1_LDADD): New variables.
(check_PROGRAMS): Add `test-srfi-1'.
(TESTS): Ditto.
* test-suite/standalone/test-srfi-1.c: New file.
Ludovic Courtès [Tue, 20 Jul 2010 08:27:38 +0000 (10:27 +0200)]
Add `vhash-fold*' in `(ice-9 vlist)'.
* module/ice-9/vlist.scm (%vhash-fold*): New inline procedure.
(vhash-fold*, vhash-foldq*, vhash-foldv*): New procedures.
* test-suite/tests/vlist.test ("vhash")["vhash-fold*", "vhash-fold*
tail", "vhash-fold* interleaved", "vhash-foldq* degenerate"]: New
tests.
* doc/ref/api-compound.texi (VHashes): Add `vhash-fold*' & co.
Andreas Rottmann [Mon, 19 Jul 2010 20:40:56 +0000 (22:40 +0200)]
Fix random number generator on 64-bit platforms
* libguile/random.c (scm_c_random): On platforms where `unsigned long' has 64
bit, generate up to 64 bit of randomness. This is expected by
scm_c_random_bignum(), and hence was a serious distortion of the random value
distribution for values exceeding 2^32. This change also fixes a crash when
the `m' argument is a value above 2^32.
Andy Wingo [Sat, 17 Jul 2010 11:30:50 +0000 (13:30 +0200)]
recommend #:replace
* doc/ref/api-modules.texi (Creating Guile Modules): Update text to
recommend #:replace.
* module/srfi/srfi-19.scm (current-time): #:replace.
Andy Wingo [Sat, 17 Jul 2010 10:22:17 +0000 (12:22 +0200)]
use scm_malloc_pointerless to alloc aligned blocks in fallback
* libguile/continuations.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY)
(SCM_STATIC_ALIGNED_ARRAY)
* libguile/control.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY)
(SCM_STATIC_ALIGNED_ARRAY): Tweak backslashes. Use
scm_malloc_pointerless to ensure alignment.
Andy Wingo [Sat, 17 Jul 2010 10:10:52 +0000 (12:10 +0200)]
SCM_I_FLUID_P -> SCM_FLUID_P
* libguile/fluids.h (SCM_FLUID_P): Change from SCM_I_FLUID_P.
(SCM_I_FLUID_NUM, SCM_I_DYNAMIC_STATE_P, SCM_I_DYNAMIC_STATE_FLUIDS):
Wrap in BUILDING_LIBGUILE ifdef.
Michael Gran [Sat, 17 Jul 2010 11:16:57 +0000 (04:16 -0700)]
Enable character hex escapes by default
R6RS character hex escapes do not conflict with legacy Guile octal
character escapes, so they can be enabled by default.
* libguile/read.c (scm_read_character): modified
* test-suite/tests/reader.test: modify character escape tests
* doc/ref/api-data.texi: modified
* doc/ref/api-options.texi: modified
Michael Gran [Sat, 17 Jul 2010 10:45:28 +0000 (03:45 -0700)]
open-file should handle binary mode and coding declarations
The open-file port should use the 8-bit ISO-8859-1 encoding when
a file is opened using mode "b". Also, it should honor a "coding:"
declaration at the top of a file when reading files where it is present.
* libguile/fports.c (scm_open_file): modified
* test-suite/tests/ports.test: more tests for open-file
* doc/ref/api-io.texi (File Ports): more documentation for open-file
Andy Wingo [Fri, 16 Jul 2010 11:19:33 +0000 (13:19 +0200)]
remove (system vm debug)
* module/system/vm/debug.scm: Remove.
* module/Makefile.am: Update.
* module/system/repl/debug.scm: Add some TODOs and a commented-out
function here.
Andy Wingo [Fri, 16 Jul 2010 11:14:23 +0000 (13:14 +0200)]
remove (ice-9 emacs)
* module/ice-9/emacs.scm: Remove.
* module/ice-9/deprecated.scm (load-emacs-interface): Remove wrapper
with no callers.
* module/Makefile.am: update.
Andy Wingo [Fri, 16 Jul 2010 11:10:54 +0000 (13:10 +0200)]
gut ice-9 debug
* module/ice-9/debug.scm: Gut, though we keep the module around for code
Out There that uses it.
* module/ice-9/top-repl.scm (top-repl): Don't import (ice-9 debug)
* module/ice-9/debugger/commands.scm:
* module/ice-9/debugging/trace.scm:
* module/ice-9/emacs.scm: Remove ice-9 debug includes.
Andy Wingo [Fri, 16 Jul 2010 10:44:44 +0000 (12:44 +0200)]
update tour.texi examples
* doc/ref/tour.texi (Running Guile Interactively): Update examples for
formatting.
Andy Wingo [Fri, 16 Jul 2010 10:41:04 +0000 (12:41 +0200)]
tour.texi updates
* doc/ref/tour.texi: Update Guile prompts for
scheme@(guile-user)>. Update output to assume value-history is on. Lop
and crop the bug reporting section -- it was too long.
Andy Wingo [Fri, 16 Jul 2010 09:54:19 +0000 (11:54 +0200)]
update debugger docs
* doc/ref/api-debug.texi (Debug on Error): Update xref.
* doc/ref/scheme-using.texi (REPL Commands): New subsection.
(Interactive Debugging): Rename from Interactive Debugger, to indicate
that debugging is just part of the REPL. Update docs.
Andy Wingo [Fri, 16 Jul 2010 09:50:59 +0000 (11:50 +0200)]
updates to system repl command
* module/system/repl/command.scm (help): Update docs on how to get help
on a particular command.
(load): Remove #:f flag.
Andy Wingo [Fri, 16 Jul 2010 09:50:51 +0000 (11:50 +0200)]
lower fill-column in .dir-locals.el
* .dir-locals.el: Fill-columns back down to 72.
Michael Gran [Fri, 16 Jul 2010 13:44:59 +0000 (06:44 -0700)]
read-line should use port's encoding, not locale's encoding
* libguile/rdelim.c (scm_read_line): modified, use port's encoding
* test-suite/test/ports.test: new test
Michael Gran [Fri, 16 Jul 2010 12:39:52 +0000 (05:39 -0700)]
More explicit variable names in scm_i_scan_for_encoding
Note especially that the variable 'i' has two different uses in this
function, and they get confused.
* libguile/read.c (scm_i_scan_for_encoding): cleanup
Ludovic Courtès [Thu, 15 Jul 2010 16:49:12 +0000 (18:49 +0200)]
Remove heap allocations in `scm_getc', `scm_ungetc', and `find_valid_encoding'.
* libguile/ports.c (scm_getc): Provide `u32_conv_from_encoding' with the
RESULT_BUF stack-allocated buffer to avoid heap allocation.
(find_valid_encoding): Likewise.
(scm_ungetc): Ditto with `u32_conv_to_encoding'.
Ludovic Courtès [Thu, 15 Jul 2010 16:45:29 +0000 (18:45 +0200)]
Expose `scm_encoding_error'.
* libguile/strings.c (scm_encoding_error): Make public.
* libguile/strings.h (scm_encoding_error): New internal declaration.
Ludovic Courtès [Thu, 15 Jul 2010 16:39:49 +0000 (18:39 +0200)]
sxml-match: Always use the same prompt tag.
* module/sxml/match.scm (%call/ec-prompt): New variable.
(call/ec): Use it instead of creating a new prompt tag.
Ludovic Courtès [Thu, 15 Jul 2010 16:38:39 +0000 (18:38 +0200)]
Declare `ice-9/psyntax-pp.scm.gen' as a phony target.
* module/Makefile.am (.PHONY): Add `ice-9/psyntax-pp.scm.gen'.
Andy Wingo [Thu, 15 Jul 2010 10:47:58 +0000 (12:47 +0200)]
don't re-print the error by default in call-with-error-handling
* module/system/repl/error-handling.scm (call-with-error-handling):
Previous post-error changed to "report"; now "catch", the default,
doesn't re-print the error.
Andy Wingo [Thu, 15 Jul 2010 10:46:02 +0000 (12:46 +0200)]
error-handling tweak
* module/system/repl/error-handling.scm (call-with-error-handling):
Remove extra newline.
Andy Wingo [Thu, 15 Jul 2010 10:44:15 +0000 (12:44 +0200)]
better error reporting from the vm
* libguile/vm-engine.c: Add func_name local, for error reporting.
(vm_error_apply_to_non_list): New error case.
(vm_error_wrong_type_arg): Remove this generic error case.
(vm_error_wrong_type_apply): Remove FUNC_NAME -- no sense in seeing
"vm-debug-engine" in the error report.
(vm_error_not_a_pair, vm_error_not_a_bytevector)
(vm_error_not_a_struct, vm_error_not_a_thunk): Use func_name instead
of FUNC_NAME, so we can indicate what caused the error.
* libguile/vm-i-scheme.c (VM_VALIDATE_CONS, car, cdr, set-car!)
(set-cdr!): Indicate provenance of errors.
(VM_VALIDATE_STRUCT, struct-vtable):
(VM_VALIDATE_BYTEVECTOR, BV_FIXABLE_INT_REF, BV_INT_REF)
(BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Same.
* libguile/vm-i-system.c (apply, tail-apply): Use
vm_error_apply_to_non_list.
Andy Wingo [Thu, 15 Jul 2010 10:13:15 +0000 (12:13 +0200)]
pass a frame to display-error in system repl error-handling
* module/system/repl/error-handling.scm (call-with-error-handling): Pass
a frame to display-error.
Andy Wingo [Thu, 15 Jul 2010 10:11:34 +0000 (12:11 +0200)]
display-error takes a frame, shows source if possible
* libguile/backtrace.h:
* libguile/backtrace.c (scm_display_error): Change "stack" arg to
"frame". Still accept stacks for backward compatibility.
(display_header, display_error_body): Show the source of the error, if
possible.
Andy Wingo [Wed, 14 Jul 2010 17:45:05 +0000 (19:45 +0200)]
fix boostrapping error with srfi-1 (for the third time!)
* module/ice-9/deprecated.scm (set-repl-prompt!): Avoid @, so as to
avoid a bootstrapping error. Horrible.
Julian Graham [Wed, 14 Jul 2010 05:16:19 +0000 (01:16 -0400)]
Fix argument passing for external hash functions in `(rnrs hashtables)'.
Guile implements this library in terms of SRFI-69, which is a bit vague on
the arity of hash functions, whereas `(rnrs hashtables)' explicitly
specifies unary ones.
* module/rnrs/hashtables.scm (wrap-hash-function): Assume SRFI-69 will pass
the table capacity as the second argument; return the result of proc
modulo the capacity.
* test-suite/tests/r6rs-hashtables.test (make-hashtable): New test case for
hash functions that return large values.
Andy Wingo [Tue, 13 Jul 2010 19:53:41 +0000 (21:53 +0200)]
fix '(] infinite loop
* libguile/read.c (scm_read_sexp): Fix reader infinite loop. Thanks to
Bill Schottstaedt for the report.
* test-suite/tests/reader.test: Add test.
Andy Wingo [Tue, 13 Jul 2010 08:48:19 +0000 (10:48 +0200)]
fix psyntax-pp.go dependency
* module/Makefile.am (ice-9/psyntax-pp.go): Fix dep.
Andy Wingo [Tue, 13 Jul 2010 08:42:42 +0000 (10:42 +0200)]
ctrl-d with readline exits one recursive repl instance
* module/ice-9/buffered-input.scm (make-buffered-input-port): Instead of
always returning EOF once EOF is seen once, call the producer again.
Allows Ctrl-D to cause one EOF at the REPL, returning once from a
recursive edit, but input continues normally. Thanks to Andrew
Bagdanov for a clue that led to the fix.
Andy Wingo [Tue, 13 Jul 2010 08:40:18 +0000 (10:40 +0200)]
don't automatically generate psyntax-pp.scm any more
* module/Makefile.am (ice-9/psyntax-pp.scm.gen): No longer automatically
regenerate psyntax-pp.scm, as the gensym dance is getting too
complicated. Instead when you change psyntax.scm now you should make
ice-9/psyntax-pp.scm.gen.
Ludovic Courtès [Mon, 12 Jul 2010 22:02:54 +0000 (00:02 +0200)]
Have `benchmark-guile' honor the current $GUILE_LOAD_PATH.
* benchmark-guile.in (GUILE_LOAD_PATH): Extend the current value instead
of overwriting it completely.
Ludovic Courtès [Mon, 12 Jul 2010 22:01:43 +0000 (00:01 +0200)]
Add missing benchmark files to the distribution.
* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add
`benchmarks/chars.bm' and `benchmarks/srfi-13.bm'.
Ludovic Courtès [Mon, 12 Jul 2010 15:31:38 +0000 (17:31 +0200)]
Fix type-checking in the optimized path of `string=?'.
* libguile/srfi-13.c (scm_string_eq): Properly type-check S1 and S2.
* test-suite/tests/strings.test ("string=?")["1st argument EOF", "2nd
argument EOF"]: New tests exposing the problem.
Andy Wingo [Sat, 10 Jul 2010 10:32:24 +0000 (12:32 +0200)]
print column numbers in backtraces
* module/system/repl/debug.scm (print-frame): Print column numbers too.
Andy Wingo [Sat, 10 Jul 2010 10:21:50 +0000 (12:21 +0200)]
finally, backtraces only showing frames for the computation
* module/system/repl/repl.scm (run-repl): Run the thunk in a stack in a
prompt, similar to the default prompt. Gives proper backtraces.
* module/system/repl/error-handling.scm (call-with-error-handling):
Narrow one more outer frame, for the %start-stack thunk invocation.
* module/ice-9/boot-9.scm (%start-stack): Reindent.
Andy Wingo [Sat, 10 Jul 2010 09:38:47 +0000 (11:38 +0200)]
update manual for value history on by default
* doc/ref/compiler.texi: Update for new ,pp meta-command.
* doc/ref/scheme-using.texi (Using Guile Interactively): Show value
history in examples.
(Value Historyx): Update docs to mention the repl option and the
programmatic interface.
Andy Wingo [Sat, 10 Jul 2010 09:19:19 +0000 (11:19 +0200)]
validating repl options; value-history on by default
* module/system/repl/common.scm: Use (ice-9 history). Turns on value
history by default.
(repl-default-options): Expand the format of options to include an
optional value transformer, run when setting a value. Add prompt and
value-history options.
(repl-prepare-eval-thunk): Use repl-option-ref.
(repl-option-ref): Error if the option is unknown.
(repl-option-set!, repl-default-option-set!): Error if the option is
unknown. Pass the val through the transformer procedure.
(repl-default-prompt-set!): Just use repl-default-option-set!.
* module/system/repl/command.scm (option): Update for the new options
format.
Andy Wingo [Sat, 10 Jul 2010 09:16:16 +0000 (11:16 +0200)]
value-history-enabled? accessor
* module/ice-9/history.scm (value-history-enabled?): Add accessor.
(enable-value-history!, disable-value-history!): Adapt.
Andy Wingo [Sat, 10 Jul 2010 08:49:01 +0000 (10:49 +0200)]
heap/literal fixes for repl-default-options
* module/system/repl/common.scm (repl-default-options): Heap-allocate
the repl-default-options, to avoid mutating a literal.
(make-repl): Copy repl-default-options.
Andy Wingo [Sat, 10 Jul 2010 08:44:29 +0000 (10:44 +0200)]
add utils to turn value history on and off, and to clear it
* module/ice-9/history.scm (enable-value-history!)
(disable-value-history!, clear-value-history!): New exports.
Andy Wingo [Sat, 10 Jul 2010 08:21:22 +0000 (10:21 +0200)]
capture default dynamic state in (guile-user)
* libguile/init.c (scm_i_init_guile): Move the call to
scm_init_threads_default_dynamic_state after the call to
scm_load_startup_files, so that the default dynamic state is in the
(guile-user) module, not (guile).
No Itisnt [Sat, 10 Jul 2010 02:22:27 +0000 (21:22 -0500)]
Remove trailing whitespace
* module/language/tree-il.scm: Remove trailing whitespace
Andy Wingo [Fri, 9 Jul 2010 16:58:01 +0000 (18:58 +0200)]
avoid running the debugger during parsing or compilation at the repl
* module/system/repl/repl.scm (abort-on-error): New helper.
(run-repl): Don't enter the debugger during parsing or compilation of
a repl expression. If you want to debug compilation, run compilation
from the repl, not as part of the repl.
Andy Wingo [Fri, 9 Jul 2010 16:39:15 +0000 (18:39 +0200)]
fix up a repl command docstring
* module/system/repl/command.scm (procedure): Fix up docstring.
Andy Wingo [Fri, 9 Jul 2010 16:34:24 +0000 (18:34 +0200)]
tweaks to print-locals
* module/system/repl/debug.scm (print-locals): Run the before-print-hook
on the values, so we can hook into (ice-9 history) if available. Don't
bother printing binding indices. Give a little per-line-prefix.
Andy Wingo [Fri, 9 Jul 2010 16:22:08 +0000 (18:22 +0200)]
tweaks to new repl
* module/system/repl/command.scm (read-command): Remove a pk.
* module/system/repl/repl.scm (run-repl): Export. Use % and abort to
implement the prompt.
Andy Wingo [Fri, 9 Jul 2010 15:04:34 +0000 (17:04 +0200)]
integrate the debugger into the repl
* module/system/repl/debug.scm: New file, defines a data type to hold
state for a debugger stack, and some helper procedures to print the
stack or print a frame. Most pieces are from (system vm debug).
* module/system/repl/error-handling.scm: New file, implements
call-with-error-handling and with-error-handling, and instead of going
into a debugger, we go into a recursive repl that happens to have
debugging information. Will be removing the old debugger from (system
vm debug) shortly.
* module/Makefile.am (SYSTEM_SOURCES): Add error-handling and debug scm
files.
* module/system/repl/repl.scm (prompting-meta-read): Better error
handling -- we don't want to go into a debugger when reading a
command.
(start-repl): Add #:debug keyword argument, and just dispatch to
run-repl.
(run-repl): New function, with the guts of the old start-repl. Added a
prompt, to which a throw to 'quit will abort.
* module/system/repl/common.scm (repl-prepare-eval-thunk): New
helper. In the future we will use this to not enter the debugger on
errors that happen at compile time.
(repl-eval): Use repl-prepare-eval-thunk.
(repl-print): Run the before-print-hook when printing a value.
* module/system/repl/command.scm (*command-table*): Move `option' to the
`system' group. Move `trace' to the `profile' group. Add `debug' and
`inspect' groups.
(command-abbrevs): Rename from command-abbrev, and allow multiple
abbreviations.
(display-group): Fix the case where abbrev? was #f.
(display-summary): Fix alignment of the command and
abbreviations. Allow multiple abbreviations.
(read-command): Rename from read-datum, and have better error
handling.
(meta-command): Better error handling.
(define-meta-command): Better error handling.
(help, show, import, compile, disassemble, time, profile, trace): Fix
docstrings and error messages.
(define-stack-command): New helper, for commands that operate on a
saved stack.
(backtrace, up, down, frame, procedure, locals): New debugger
commands, in the REPL now.
(inspect, pretty-print): New "inspect" commands.
Andy Wingo [Fri, 9 Jul 2010 14:48:30 +0000 (16:48 +0200)]
readline only handles SIGWINCH
* acinclude.m4 (GUILE_READLINE): Check for rl_catch_signals and
rl_catch_sigwinch.
* guile-readline/readline.c (scm_init_readline): If we can, turn off
readline's signal handling, because we can do our own.
(scm_readline): Use dynwinds to handle resetting readline's state on
nonlocal exit, not catches.
(unwind_readline): Rename from handle_error.
Andy Wingo [Fri, 9 Jul 2010 08:57:51 +0000 (10:57 +0200)]
remove use-emacs-interface check from ice-9 readline
* guile-readline/ice-9/readline.scm (activate-readline): Remove check
for use-emacs-interface in guile-user, an interface that was removed.
Andy Wingo [Thu, 8 Jul 2010 16:18:21 +0000 (17:18 +0100)]
define* in ice-9 regex
* module/ice-9/regex.scm (match:start, match:end, match:substring)
(fold-matches, list-matches): Reimplement using define*.
Andy Wingo [Thu, 8 Jul 2010 16:13:08 +0000 (17:13 +0100)]
untabify (ice-9 regex)
* module/ice-9/regex.scm: Untabify.
Andy Wingo [Thu, 1 Jul 2010 11:10:02 +0000 (12:10 +0100)]
fix (set! MACRO exp) hygiene
* module/ice-9/psyntax.scm (lookup): Reflow comment.
(chi-top, syntax): Add comments about mod for lookup.
(set!): Lookup the identifier in the module attached to its syntax
object. In the (set! MACRO foo) case, after expanding the macro, chi
the resulting expression with the empty wrap, as syntax-type
does. Seems to fix the case where the expansion references
lexically-bound variables.
* module/ice-9/psyntax-pp.scm: Regenerated.
* test-suite/tests/syncase.test: Add a bunch of tests.
Neil Jerram [Sun, 4 Jul 2010 20:07:49 +0000 (21:07 +0100)]
Fix TeXing of doc/ref/r6rs.texi
* doc/ref/r6rs.texi (rnrs conditions): Add "{Condition Type}" to
@deffn line for each condition type. Add one missing "{Scheme
Procedure}".
Ludovic Courtès [Sun, 4 Jul 2010 16:44:08 +0000 (18:44 +0200)]
Optimize `string=' for the common case.
* libguile/srfi-13.c (scm_string_eq): Add a fast path for the common
case.
Ludovic Courtès [Sun, 4 Jul 2010 16:38:53 +0000 (18:38 +0200)]
Add `scm_i_string_data'.
* libguile/strings.c (STRINGBUF_CONTENTS): New macro.
(STRINGBUF_CHARS, STRINGBUF_WIDE_CHARS): Use it.
(scm_i_string_data): New function.
* libguile/strings.h (scm_i_string_data): New declaration.
Neil Jerram [Thu, 10 Jun 2010 22:40:41 +0000 (23:40 +0100)]
Fix hanging of popen.test
The "open-output-pipe":"no duplicate" test has been hanging, on and
off, and not completely reliably, for a few years. It's now doing so
fairly reliably for me, and investigation shows that
- the child shell process is in a tight loop (99% CPU)
- the parent Guile process is stuck calling waitpid().
The problem is that the child hasn't got the SIGPIPE that the test
intends, and so is continuing to echo "closed" forever; and Guile is
waiting for it to terminate, forever.
I haven't fully debugged the SIGPIPE problem, but it sounds very like
what Chet Ramey describes here:
http://old.nabble.com/Re%3A-SIGPIPE-not-properly-reset-with-%27trap---PIPE%27-p20985595.html.
(And my version of bash is 3.2.39.)
So, a fix should be to use something other than shell to implement the
child; and it appears that this works.
* check-guile.in (TEST_SUITE_DIR): Export.
* test-suite/tests/popen-child.scm: New script file.
* test-suite/tests/popen.test ("open-output-pipe", "no duplicate"):
Use Guile for the child process, instead of shell.
Andy Wingo [Tue, 29 Jun 2010 10:20:09 +0000 (12:20 +0200)]
fix repl level printing
* module/system/repl/common.scm (repl-prompt): Fix repl level printing.
Tristan Colgate [Tue, 29 Jun 2010 08:14:33 +0000 (09:14 +0100)]
Update #:procedure method for <applicable-struct>
* modules/oop/goop.scm (initialize-object-procedure): Use slot-set!
instead of set-object-procedure!.
Andy Wingo [Mon, 28 Jun 2010 13:03:34 +0000 (15:03 +0200)]
* module/srfi/srfi-60.scm (bit-count): #:replace core definition.
Andy Wingo [Sat, 26 Jun 2010 20:28:21 +0000 (22:28 +0200)]
use *repl-stack* instead of *repl-level*
* module/ice-9/boot-9.scm (*repl-stack*): Instead of repl-level, have a
stack.
(batch-mode?): Change to poke the stack.
* module/ice-9/deprecated.scm (set-batch-mode?!): Update deprecation
method.
* module/system/repl/common.scm (repl-prompt): Update to poke
*repl-stack* to get the level.
* module/system/repl/repl.scm (start-repl): Bind *repl-stack*
appropriately.
Andy Wingo [Sat, 26 Jun 2010 20:18:37 +0000 (22:18 +0200)]
tweak to ensure-batch-mode!
* module/ice-9/boot-9.scm (ensure-batch-mode!): Fix to be correct
regarding dynamic extent (so far as this hack goes).
Andy Wingo [Sat, 26 Jun 2010 19:55:13 +0000 (21:55 +0200)]
add repl inport and outport fields and accessors
* module/system/repl/common.scm (<repl>): Add inport and outport fields
and accessors.
(make-repl): Add optional "debug" argument. Bind inport and outport to
the current inport and output ports at the time of repl creation.
(repl-read): Read from the repl inport.
(repl-print): Write to the repl outport.
* module/system/repl/command.scm (read-datum, read-line, meta-command):
Respect repl-inport, and bind the outport of meta-commands to the repl
outport.
Andy Wingo [Sat, 26 Jun 2010 19:46:28 +0000 (21:46 +0200)]
allow kwargs to repl metacommands
* module/system/repl/command.scm (define-meta-command): Allow repl
meta-commands to have optional or keyword arguments.
Thien-Thi Nguyen [Fri, 25 Jun 2010 16:47:12 +0000 (18:47 +0200)]
HACKING: Mention (add-hook 'before-save-hook 'delete-trailing-whitespace)
* HACKING (Coding standards):
Mention ‘(add-hook 'before-save-hook 'delete-trailing-whitespace)’.