bpt/guile.git
13 years ago[maint] Avoid no-op config-subst for libguile/guile-func-name-check.
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.

13 years ago[build] Overhaul <errno.h>, <signal.h> cpp symbol extraction/checking.
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.

13 years agofix git-version-gen to work with bsd sed and obsolete regexps
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.

13 years agoStart rewriting SRFI-1 in Scheme.
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.

13 years agoAdd `vhash-fold*' in `(ice-9 vlist)'.
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.

13 years agoFix random number generator on 64-bit platforms
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.

13 years agorecommend #:replace
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.

13 years agouse scm_malloc_pointerless to alloc aligned blocks in fallback
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.

13 years agoSCM_I_FLUID_P -> SCM_FLUID_P
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.

13 years agoEnable character hex escapes by default
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

13 years agoopen-file should handle binary mode and coding declarations
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

13 years agoremove (system vm debug)
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.

13 years agoremove (ice-9 emacs)
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.

13 years agogut ice-9 debug
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.

13 years agoupdate tour.texi examples
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.

13 years agotour.texi updates
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.

13 years agoupdate debugger docs
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.

13 years agoupdates to system repl command
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.

13 years agolower fill-column in .dir-locals.el
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.

13 years agoread-line should use port's encoding, not locale's encoding
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

13 years agoMore explicit variable names in scm_i_scan_for_encoding
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

13 years agoRemove heap allocations in `scm_getc', `scm_ungetc', and `find_valid_encoding'.
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'.

13 years agoExpose `scm_encoding_error'.
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.

13 years agosxml-match: Always use the same prompt tag.
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.

13 years agoDeclare `ice-9/psyntax-pp.scm.gen' as a phony target.
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'.

13 years agodon't re-print the error by default in call-with-error-handling
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.

13 years agoerror-handling tweak
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.

13 years agobetter error reporting from the vm
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.

13 years agopass a frame to display-error in system repl error-handling
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.

13 years agodisplay-error takes a frame, shows source if possible
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.

13 years agofix boostrapping error with srfi-1 (for the third time!)
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.

13 years agoFix argument passing for external hash functions in `(rnrs hashtables)'.
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.

13 years agofix '(] infinite loop
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.

13 years agofix psyntax-pp.go dependency
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.

13 years agoctrl-d with readline exits one recursive repl instance
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.

13 years agodon't automatically generate psyntax-pp.scm any more
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.

13 years agoHave `benchmark-guile' honor the current $GUILE_LOAD_PATH.
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.

13 years agoAdd missing benchmark files to the distribution.
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'.

13 years agoFix type-checking in the optimized path of `string=?'.
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.

13 years agoprint column numbers in backtraces
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.

13 years agofinally, backtraces only showing frames for the computation
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.

13 years agoupdate manual for value history on by default
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.

13 years agovalidating repl options; value-history on by default
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.

13 years agovalue-history-enabled? accessor
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.

13 years agoheap/literal fixes for repl-default-options
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.

13 years agoadd utils to turn value history on and off, and to clear it
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.

13 years agocapture default dynamic state in (guile-user)
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).

13 years agoRemove trailing whitespace
No Itisnt [Sat, 10 Jul 2010 02:22:27 +0000 (21:22 -0500)]
Remove trailing whitespace

* module/language/tree-il.scm: Remove trailing whitespace

13 years agoavoid running the debugger during parsing or compilation at the repl
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.

13 years agofix up a repl command docstring
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.

13 years agotweaks to print-locals
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.

13 years agotweaks to new repl
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.

13 years agointegrate the debugger into the repl
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.

13 years agoreadline only handles SIGWINCH
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.

13 years agoremove use-emacs-interface check from ice-9 readline
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.

13 years agodefine* in ice-9 regex
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*.

13 years agountabify (ice-9 regex)
Andy Wingo [Thu, 8 Jul 2010 16:13:08 +0000 (17:13 +0100)]
untabify (ice-9 regex)

* module/ice-9/regex.scm: Untabify.

13 years agofix (set! MACRO exp) hygiene
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.

13 years agoFix TeXing of doc/ref/r6rs.texi
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}".

13 years agoOptimize `string=' for the common case.
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.

13 years agoAdd `scm_i_string_data'.
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.

13 years agoFix hanging of popen.test
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.

13 years agofix repl level printing
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.

13 years agoUpdate #:procedure method for <applicable-struct>
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!.

13 years ago* module/srfi/srfi-60.scm (bit-count): #:replace core definition.
Andy Wingo [Mon, 28 Jun 2010 13:03:34 +0000 (15:03 +0200)]
* module/srfi/srfi-60.scm (bit-count): #:replace core definition.

13 years agouse *repl-stack* instead of *repl-level*
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.

13 years agotweak to ensure-batch-mode!
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).

13 years agoadd repl inport and outport fields and accessors
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.

13 years agoallow kwargs to repl metacommands
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.

13 years agoHACKING: Mention (add-hook 'before-save-hook 'delete-trailing-whitespace)
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)’.

13 years agoEdits to R6RS standard libraries documentation proposed by Ludovic Courtès.
Julian Graham [Thu, 24 Jun 2010 03:44:24 +0000 (23:44 -0400)]
Edits to R6RS standard libraries documentation proposed by Ludovic Courtès.

* doc/ref/r6rs.texi: Fix erroneous usage of @pxref; add pointers from
  `(rnrs conditions)' and `(rnrs arithmetic bitwise)' to SRFI-35 and
  SRFI-60 sections; remove reference to `fold'.

13 years agotop-repl out to its own module
Andy Wingo [Tue, 22 Jun 2010 21:50:27 +0000 (23:50 +0200)]
top-repl out to its own module

* module/ice-9/boot-9.scm:
* module/ice-9/top-repl.scm: Move top-repl out here.

* module/Makefile.am: Add new file.

* module/ice-9/deprecated.scm (top-repl): Deprecated shim.

* libguile/script.c (scm_compile_shell_switches): Invoke top-repl from
  its new location.

13 years agosimplify top-repl
Andy Wingo [Tue, 22 Jun 2010 21:29:43 +0000 (23:29 +0200)]
simplify top-repl

* module/ice-9/boot-9.scm (top-repl): Simplify.

13 years agodon't bother catching SIGSEGV et al in top-repl
Andy Wingo [Tue, 22 Jun 2010 21:16:49 +0000 (23:16 +0200)]
don't bother catching SIGSEGV et al in top-repl

* module/ice-9/boot-9.scm (exit-hook): Move up with the other hooks.
  (top-repl): Don't install handlers for SIGFPE, SIGILL, SIGSEGV, or
  SIGBUS, as they will have no effect.

13 years agodeprecate named-module-use!, load-emacs-interface, and remove --emacs
Andy Wingo [Tue, 22 Jun 2010 20:34:23 +0000 (22:34 +0200)]
deprecate named-module-use!, load-emacs-interface, and remove --emacs

* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm (named-module-use!)
  (load-emacs-interface): Deprecate these.

* module/ice-9/gds-client.scm (run-utility): Redefine to not use
  named-module-use!.

* libguile/script.c (scm_shell_usage): Remove --emacs option.
  (scm_compile_shell_switches): Remove support for --emacs.

* module/ice-9/boot-9.scm (top-repl): Don't muck with --emacs.

* doc/ref/scheme-scripts.texi (Invoking Guile): Remove note about
  --emacs.

13 years agorequire-extension using syntax-case
Andy Wingo [Tue, 22 Jun 2010 20:25:20 +0000 (22:25 +0200)]
require-extension using syntax-case

* module/ice-9/boot-9.scm (require-extension): Implement using
  syntax-case.

13 years agocond-expand in syntax-case
Andy Wingo [Tue, 22 Jun 2010 20:15:50 +0000 (22:15 +0200)]
cond-expand in syntax-case

* module/ice-9/boot-9.scm: Some spacing improvements.
  (cond-expand): Reimplement in syntax-case.

13 years agomore aspiration in boot-9
Andy Wingo [Tue, 22 Jun 2010 19:47:15 +0000 (21:47 +0200)]
more aspiration in boot-9

* module/ice-9/boot-9.scm: Spacing fixes for local-ref et al.

13 years agobegin-deprecated using syntax-case
Andy Wingo [Tue, 22 Jun 2010 19:43:09 +0000 (21:43 +0200)]
begin-deprecated using syntax-case

* module/ice-9/boot-9.scm (begin-deprecated): In terms of syntax-case.

13 years agoIntegrate complete R6RS standard libraries documentation.
Julian Graham [Tue, 22 Jun 2010 03:10:13 +0000 (23:10 -0400)]
Integrate complete R6RS standard libraries documentation.

* doc/ref/r6rs.texi: Reshuffle Andy Wingo's introductory notes; add more
  detailed @subsubsections for each library.

13 years agorelax restriction on _ in literals
Andy Wingo [Mon, 21 Jun 2010 19:47:42 +0000 (21:47 +0200)]
relax restriction on _ in literals

* module/ice-9/psyntax.scm: Relax restriction on _ in literals.

* module/ice-9/psyntax-pp.scm: Regen.

13 years agofix matches? test
Andy Wingo [Mon, 21 Jun 2010 19:06:29 +0000 (21:06 +0200)]
fix matches? test

* test-suite/tests/syntax.test (matches?): Unfortunately this relatively
  recent macro fails due to the underscore-in-literals-list prohibition.
  But, it seems I was in the minority wanting _ for a literal.

13 years agosyntax-case treats _ as placeholder
Andy Wingo [Mon, 21 Jun 2010 18:54:14 +0000 (20:54 +0200)]
syntax-case treats _ as placeholder

* module/ice-9/psyntax.scm (underscore?): New helper, like ellipsis?.
  (syntax-case): Treat the _ pattern as a matches-all pattern,
  disallowing it from the keyword list. Another well-thought part of the
  R6RS.
  ($sc-dispatch): Dispatch _ patterns.

* module/ice-9/psyntax-pp.scm: Regenerated.

* test-suite/tests/syncase.test ("_ is a placeholder"): Add a test.

13 years agofix compilation with automake < 1.11
Andy Wingo [Mon, 21 Jun 2010 09:02:31 +0000 (11:02 +0200)]
fix compilation with automake < 1.11

* configure.ac: On automake < 1.11, define AM_DEFAULT_VERBOSITY so that
  our custom silent rules work.

13 years agofreshly regenerate psyntax-pp
Andy Wingo [Mon, 21 Jun 2010 09:02:00 +0000 (11:02 +0200)]
freshly regenerate psyntax-pp

* module/ice-9/psyntax-pp.scm: A fresh regen to get the lowest gensyms
  we can. Needs a better solution in the end.

13 years agofix rnrs duplicate bindings warnings
Andy Wingo [Sun, 20 Jun 2010 22:07:46 +0000 (00:07 +0200)]
fix rnrs duplicate bindings warnings

* module/rnrs.scm: Fix i/o duplicate bindings warnings by excluding some
  bindings.

13 years agornrs modules #:replace as appropriate
Andy Wingo [Sun, 20 Jun 2010 21:59:57 +0000 (23:59 +0200)]
rnrs modules #:replace as appropriate

* module/ice-9/boot-9.scm (export!): New syntax, as export is to
  module-export!, export! is to module-replace!. I thought that taking
  up the name `replace' would be presumptuous, hence the name mismatch.

* module/ice-9/r6rs-libraries.scm (library): Calculate not only
  re-exports, but replacements as well.

13 years agoensure unicode-capable rnrs string ports
Andy Wingo [Sun, 20 Jun 2010 21:15:29 +0000 (23:15 +0200)]
ensure unicode-capable rnrs string ports

* module/rnrs/io/ports.scm (open-string-input-port):
  (open-string-output-port): Ensure that the ports are unicode-capable
  by binding %default-port-encoding to "UTF-8".

13 years agoCanonicalize source file names in `primitive-load-path' (fix bug #30170).
Ludovic Courtès [Sun, 20 Jun 2010 14:57:06 +0000 (16:57 +0200)]
Canonicalize source file names in `primitive-load-path' (fix bug #30170).

* libguile/load.c (scm_primitive_load_path): Canonicalize
  FULL_FILENAME.  Fixes bug #30170 ("Auto-compilation erroneously
  recompiles dependencies").

13 years agorepl compiles with warnings by default
Andy Wingo [Sat, 19 Jun 2010 18:07:29 +0000 (20:07 +0200)]
repl compiles with warnings by default

* module/system/repl/command.scm (compile): Remove the bitrotten
  options.

* module/system/repl/common.scm (repl-default-options): Add
  'compile-options option.
  (repl-compile-options): Accessor for compile-options.
  (repl-compile): Use repl-compile-options.
  (repl-eval): Adapt to repl-compile interface change.

13 years agoscheme-mode in syntactic records test
Andy Wingo [Sat, 19 Jun 2010 13:40:47 +0000 (15:40 +0200)]
scheme-mode in syntactic records test

* test-suite/tests/r6rs-records-syntactic.test: Add -*- scheme -*-.

13 years agotypo in mutable-strings
Andy Wingo [Sat, 19 Jun 2010 13:40:25 +0000 (15:40 +0200)]
typo in mutable-strings

* module/rnrs/mutable-strings.scm: Fix typo.

13 years ago*unspecified* in rnrs exceptions
Andy Wingo [Sat, 19 Jun 2010 13:40:11 +0000 (15:40 +0200)]
*unspecified* in rnrs exceptions

* module/rnrs/exceptions.scm (rnrs): Import *unspecified*.

13 years agodon't unconditionally restore signals in ensure-batch-mode!
Andy Wingo [Sat, 19 Jun 2010 13:20:02 +0000 (15:20 +0200)]
don't unconditionally restore signals in ensure-batch-mode!

* module/ice-9/boot-9.scm (ensure-batch-mode!): Remove comment about
  restoring signals, and that behavior, as it was making popen.test
  hang. I should investigate further, but instead I'm just going to hope
  that this fixes it.

13 years agoFix SRFI-9 for records without fields
Andreas Rottmann [Sat, 19 Jun 2010 12:52:56 +0000 (14:52 +0200)]
Fix SRFI-9 for records without fields

* module/srfi/srfi-9.scm (define-record-type): Deal with fieldless records.
* test-suite/tests/srfi-9.test: Add a fieldless record definition.

13 years agoIgnore the SRFI name component(s) in R6RS imports
Andreas Rottmann [Sat, 19 Jun 2010 12:52:21 +0000 (14:52 +0200)]
Ignore the SRFI name component(s) in R6RS imports

* module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): To avoid having to
  create alias libraries for all the SRFIs, we simply ignore the name
  components, so (srfi :n foo bar) will resolve to (srfi :n).

13 years agoice-9 receive without define-macro
Andreas Rottmann [Sat, 19 Jun 2010 12:51:48 +0000 (14:51 +0200)]
ice-9 receive without define-macro

* module/ice-9/receive.scm: Replace define-macro usage with syntax-rules.

13 years agoadd rnrs unicode to the compound rnrs module
Andreas Rottmann [Sat, 19 Jun 2010 12:51:04 +0000 (14:51 +0200)]
add rnrs unicode to the compound rnrs module

* module/rnrs.scm: import rnrs unicode and export all of its procedures.

13 years agofix ^L typo
Andy Wingo [Sat, 19 Jun 2010 12:45:03 +0000 (14:45 +0200)]
fix ^L typo

* module/rnrs/mutable-pairs.scm: Fix ^L typo.

13 years agoset! name (lambda ...) names the lambda
Andy Wingo [Sat, 19 Jun 2010 11:56:16 +0000 (13:56 +0200)]
set! name (lambda ...) names the lambda

* module/ice-9/psyntax.scm (build-lexical-assignment)
  (build-global-assignment): Maybe name the RHS.

* module/ice-9/psyntax-pp.scm: Regenerated.

* module/ice-9/boot-9.scm (catch, with-throw-handler, throw): Rework to
  use set! instead of define! so that we get names.