bpt/guile.git
13 years agoCompile with `-Wformat'.
Ludovic Courtès [Sun, 10 Oct 2010 15:13:36 +0000 (17:13 +0200)]
Compile with `-Wformat'.

* am/guilec (GUILE_WARNINGS): Add `-Wformat'.

13 years agoImplement fancy format string analysis.
Ludovic Courtès [Sun, 10 Oct 2010 15:13:21 +0000 (17:13 +0200)]
Implement fancy format string analysis.

* module/language/tree-il/analyze.scm (format-string-argument-count):
  Return two values, the minimum and maximum number of arguments.
  Add support for most of `format' escapes, including conditionals.
  (format-analysis): Adjust accordingly.

* module/system/base/message.scm (%warning-types)[format]: Take two
  arguments, MIN and MAX, instead of EXPECTED.  Display warning
  accordingly.

* test-suite/tests/tree-il.test ("warnings")["format"]("~%, ~~, ~&, ~t,
  ~_, and ~\\n", "~{...~}", "~{...~}, too many args", "~@{...~}",
  "~@{...~}, too few args", "~(...~)", "~v", "~v:@y", "~*", "~?",
  "complex 1", "complex 2", "complex 3"): New tests.
  ("conditionals"): New test prefix.

13 years agoEscape newlines from format strings in warnings.
Ludovic Courtès [Sat, 9 Oct 2010 16:06:36 +0000 (18:06 +0200)]
Escape newlines from format strings in warnings.

* module/system/base/message.scm (%warning-types)[format]: Escape
  newlines from FMT.

13 years agoadd --listen command line argument.
Andy Wingo [Sun, 10 Oct 2010 10:56:53 +0000 (12:56 +0200)]
add --listen command line argument.

* libguile/script.c (scm_shell_usage, scm_compile_shell_switches): Add a
  --listen argument to spawn a REPL server, possibly specifying the port
  or path to listen on. The goal is for this to be the default way to
  allow debugging via Emacs or simply using netcat.

13 years agoadd (system repl server)
Andy Wingo [Sun, 10 Oct 2010 10:15:34 +0000 (12:15 +0200)]
add (system repl server)

* module/system/repl/server.scm: New module, listens on a socket for
  connections, then serves repls to those sockets.

* module/Makefile.am: Add repl server.

13 years agofix segfaults when closing the current input port
Andy Wingo [Sun, 10 Oct 2010 10:13:04 +0000 (12:13 +0200)]
fix segfaults when closing the current input port

* libguile/ports.c (scm_char_ready_p, scm_peek_char, scm_unread_char)
  (scm_unread_string): Always validate the port, even in the case that
  we get it the default current-input-port. Otherwise the following
  causes a segfault:

    (begin (close-port (current-input-port)) (peek-char))

13 years agoreadline repl-reader falls back to boot-9 definition for other ports
Andy Wingo [Sun, 10 Oct 2010 09:49:50 +0000 (11:49 +0200)]
readline repl-reader falls back to boot-9 definition for other ports

* guile-readline/ice-9/readline.scm (readline-repl-reader): Pull
  definition out of activate-readline. If the current input port is not
  the readline port, fall back to the boot-9 repl reader.
  (activate-readline): Adapt.

13 years agointerrupted syscalls run asyncs before throwing syserror
Andy Wingo [Sun, 10 Oct 2010 09:24:29 +0000 (11:24 +0200)]
interrupted syscalls run asyncs before throwing syserror

* libguile/error.c (scm_syserror, scm_syserror_msg): Run pending pending
  asyncs before throwing the error, as one of the asyncs might be a
  signal handler. But there is unfortunately a race here, as noted in a
  comment.

13 years agofurther repl tweaks
Andy Wingo [Fri, 8 Oct 2010 17:27:45 +0000 (19:27 +0200)]
further repl tweaks

* module/system/repl/error-handling.scm (error-string): Refactor a
  little.
  (call-with-error-handling): Ensure a trailing newline when printing
  the error-msg.

* module/system/repl/repl.scm (run-repl): We don't know the name of the
  meta-command here.

13 years agoImprove pretty-printing of tree-il objects.
Ludovic Courtès [Fri, 8 Oct 2010 13:24:15 +0000 (15:24 +0200)]
Improve pretty-printing of tree-il objects.

* module/language/tree-il.scm (print-tree-il): Print the AST with ~S
  instead of ~A.

13 years agoAdd `-Wformat'.
Ludovic Courtès [Fri, 8 Oct 2010 14:25:32 +0000 (16:25 +0200)]
Add `-Wformat'.

* module/language/tree-il/analyze.scm (format-string-argument-count):
  New procedure.
  (format-analysis): New tree analysis.

* module/language/tree-il/compile-glil.scm (%warning-passes): Add
  `format'.

* module/system/base/message.scm (%warning-types): Add `format'.

* test-suite/tests/tree-il.test (%opts-w-format): New variable.
  ("warnings")["format"]: New test prefix.

* doc/ref/api-evaluation.texi (Compilation): Mention `format' warnings.

13 years agoFixlets for REPL error handling.
Ludovic Courtès [Fri, 8 Oct 2010 11:50:24 +0000 (13:50 +0200)]
Fixlets for REPL error handling.

* module/system/repl/error-handling.scm (error-string): Don't call
  `display-error' when STACK is empty.
  (call-with-error-handling): Display ERROR-MSG instead of using
  `format', since ERROR-MSG may contain `format' escapes.

* module/system/repl/repl.scm (run-repl): Add missing argument to
  `format'.

13 years agoSRFI-1: Rewrite `split-at' and `split-at!' in Scheme.
Ludovic Courtès [Fri, 8 Oct 2010 11:48:02 +0000 (13:48 +0200)]
SRFI-1: Rewrite `split-at' and `split-at!' in Scheme.

This partially reverts commit bb560b9c16893f762699ba5a3109c8367fff8dfc
(Tue Mar 15 2005).

* module/srfi/srfi-1.scm (out-of-range, split-at, split-at!): New
  procedures.

* libguile/srfi-1.c (scm_srfi1_split_at, scm_srfi1_split_at_x): Remove.
* libguile/srfi-1.h (scm_srfi1_split_at, scm_srfi1_split_at_x): Ditto.

13 years agoSRFI-1: Rewrite `filter-map' in Scheme.
Ludovic Courtès [Fri, 8 Oct 2010 09:03:51 +0000 (11:03 +0200)]
SRFI-1: Rewrite `filter-map' in Scheme.

This partially reverts commit c16359466bcc3f2ebf6d750c069f787f629fc625
(Thu Mar 17 2005).

* libguile/srfi-1.c (scm_srfi1_filter_map): Remove.
* libguile/srfi-1.h (scm_srfi1_filter_map): Ditto.

* module/srfi/srfi-1.scm (filter-map): New procedure.

13 years agoSRFI-1: Make `fold-right' tail-recursive.
Ludovic Courtès [Fri, 8 Oct 2010 08:43:59 +0000 (10:43 +0200)]
SRFI-1: Make `fold-right' tail-recursive.

* module/srfi/srfi-1.scm (fold-right): Make tail-recursive.

* test-suite/tests/srfi-1.test ("fold-right"): New test prefix.

13 years agoSRFI-1: Make `unfold' tail-recursive (fix bug #30071).
Ludovic Courtès [Fri, 8 Oct 2010 08:23:52 +0000 (10:23 +0200)]
SRFI-1: Make `unfold' tail-recursive (fix bug #30071).

* module/srfi/srfi-1.scm (unfold): Make tail-recursive, following a
  suggestion by Szavai Gyula.

* test-suite/tests/srfi-1.test ("unfold"): New test prefix.

13 years agoRegister `scm_init_r6rs_ports' as an extension.
Ludovic Courtès [Fri, 8 Oct 2010 07:49:12 +0000 (09:49 +0200)]
Register `scm_init_r6rs_ports' as an extension.

* libguile/r6rs-ports.c (scm_register_r6rs_ports): New function.
* libguile/r6rs-ports.h (scm_register_r6rs_ports): New declaration.

* libguile/init.c (scm_i_init_guile): Call it.

13 years agoAlways run at least the ASCII regexp tests.
Ludovic Courtès [Fri, 8 Oct 2010 07:46:39 +0000 (09:46 +0200)]
Always run at least the ASCII regexp tests.

* test-suite/tests/regexp.test (with-ascii-or-latin1-locale): New macro.
  ("regexp-quote"): Use it instead of `with-latin1-locale'.

13 years agofix a bug in `finish'
Andy Wingo [Fri, 8 Oct 2010 10:29:54 +0000 (12:29 +0200)]
fix a bug in `finish'

* module/system/repl/command.scm (repl-pop-continuation-resumer)
  (finish): Fix a bug printing return values.

13 years agostepping traps use frame-next-source, not frame-source
Andy Wingo [Fri, 8 Oct 2010 10:23:34 +0000 (12:23 +0200)]
stepping traps use frame-next-source, not frame-source

* module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): Use
  frame-next-source in stepping traps.

13 years agoadd program-sources-pre-retire to core and define frame-next-source
Andy Wingo [Fri, 8 Oct 2010 10:21:20 +0000 (12:21 +0200)]
add program-sources-pre-retire to core and define frame-next-source

* libguile/programs.h:
* libguile/programs.c (scm_program_source): Add an optional arg, the
  sources table to traverse. Defaults to the result of
  scm_program_sources.

* module/system/vm/program.scm (program-sources-pre-retire): Move
  definition here from (system vm traps), and export.

* module/system/vm/traps.scm: Adapt.

* module/system/vm/frame.scm (frame-next-source): New exported binding,
  returns the source line corresponding to the next instruction instead
  of the previous instruction.

13 years agofix error in frame-return-values
Andy Wingo [Fri, 8 Oct 2010 09:53:59 +0000 (11:53 +0200)]
fix error in frame-return-values

* module/system/vm/frame.scm (frame-return-values): Fix off-by-one
  error.

13 years agofix tracing of mv returns
Andy Wingo [Fri, 8 Oct 2010 09:52:38 +0000 (11:52 +0200)]
fix tracing of mv returns

* module/system/vm/trace.scm (print-return): Fix multiple-value-return
  printing.

13 years agomore inlining in psyntax
Andy Wingo [Fri, 8 Oct 2010 09:43:15 +0000 (11:43 +0200)]
more inlining in psyntax

* module/ice-9/psyntax.scm (make-wrap, wrap-marks, wrap-subst): Use
  identifier syntax here too.

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

13 years agoinline symbol? and vector? to opcodes, and a psyntax inlining tweak
Andy Wingo [Fri, 8 Oct 2010 09:30:17 +0000 (11:30 +0200)]
inline symbol? and vector? to opcodes, and a psyntax inlining tweak

* libguile/vm-i-scheme.c (symbol?, vector?): New
  instructions. Renumbered the rest.
* libguile/vm-i-system.c: Renumber instructions.
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.

* module/ice-9/psyntax.scm (binding-type, binding-value): Define using
  macros so that we inline to car and cdr opcodes. Oh, for an inliner :)

* module/language/tree-il/compile-glil.scm (*primcall-ops*)
* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*, *effect-free-primitives*)
  (*effect+exception-free-primitives*): Add symbol? and vector?
  inlines.

13 years agoadd repl debugging command docs
Andy Wingo [Fri, 8 Oct 2010 09:13:19 +0000 (11:13 +0200)]
add repl debugging command docs

* doc/ref/scheme-using.texi (Debug Commands): Add docs for new debugging
  commands (break, step, registers, etc).

13 years agoproof-reading fixen in api-debug
Andy Wingo [Fri, 8 Oct 2010 08:54:03 +0000 (10:54 +0200)]
proof-reading fixen in api-debug

* doc/ref/api-debug.texi (Trap States, High-Level Traps): A couple of
  proof-reading fixes.

13 years agofinish traps documentation
Andy Wingo [Thu, 7 Oct 2010 22:00:16 +0000 (00:00 +0200)]
finish traps documentation

* doc/ref/api-debug.texi (Low-Level Traps, Tracing Traps, Trap States):
  Add notes on using modules.
  (High-Level Traps): Combine "Trap Handlers" and "Setting Traps"
  here. Flesh out docs.

13 years agoremove old debugging examples from api-debug
Andy Wingo [Thu, 7 Oct 2010 20:57:07 +0000 (22:57 +0200)]
remove old debugging examples from api-debug

* doc/ref/api-debug.texi (Debugging Examples): Remove section, as the
  tracing bits are adequately covered in tracing, and the breakpoints
  and such will get covered in the debugging meta-commands section.

13 years agodocument trap states
Andy Wingo [Thu, 7 Oct 2010 20:50:33 +0000 (22:50 +0200)]
document trap states

* module/system/vm/trap-state.scm: Export add-trap!.

* doc/ref/api-debug.texi (Trap States): Document.

13 years agodocument tracing traps
Andy Wingo [Thu, 7 Oct 2010 20:27:00 +0000 (22:27 +0200)]
document tracing traps

* doc/ref/api-debug.texi (Tracing Traps): Document the traps.

13 years agofinish documenting low-level traps, other api-debug.texi fixes
Andy Wingo [Thu, 7 Oct 2010 20:15:35 +0000 (22:15 +0200)]
finish documenting low-level traps, other api-debug.texi fixes

* doc/ref/api-debug.texi (Stack Capture): Rename from "Capturing the
  Stack or Innermost Stack Frame". Move start-stack docs here.
  (Frames): Document accessors for fp, sp, ip, et al.
  (Source Properties): Raise to a subsection.
  (VM Hooks): Add notes about the VM trace level within hook firing.
  (Low-Level Traps): Flesh out.

13 years agoupdate traps documentation (unfinished)
Andy Wingo [Thu, 7 Oct 2010 11:06:57 +0000 (13:06 +0200)]
update traps documentation (unfinished)

* doc/ref/Makefile.am:
* doc/ref/guile.texi:
* doc/ref/scheme-debugging.texi: Remove scheme-debugging.texi, which
  only described tracing. Tracing documentation is now in
  api-debugging.

* doc/ref/scheme-using.texi (Evaluating Scheme Code): Remove reference
  to source traps, as that section is going away.

* doc/ref/api-modules.texi (Included Guile Modules): Remove reference to
  Tracing. This section is a little silly, anyway...

* doc/ref/api-evaluation.texi (VM Behaviour): Remove section, it is in
  api-debugging now.

* doc/ref/api-debug.texi (Stacks, Frames): Rename sections from
  "Examining the Stack" and "Examining Stack Frames", respectively.
  (Traps): Update for current API. A big and not-quite-finished update.

13 years agoupdate docs regarding --debug
Andy Wingo [Thu, 7 Oct 2010 10:56:43 +0000 (12:56 +0200)]
update docs regarding --debug

* doc/ref/scheme-scripts.texi (Invoking Guile): Update docs on --debug.

13 years agorename vm-trace to call-with-trace
Andy Wingo [Thu, 7 Oct 2010 10:55:37 +0000 (12:55 +0200)]
rename vm-trace to call-with-trace

* module/system/vm/trace.scm (print-application, print-return): Change
  to add more whitespace, as (ice-9 debug) did.
  (call-with-trace): Rename from vm-trace, and make the vm a keyword
  argument.

* module/system/repl/command.scm: Don't autoload (system vm profile).
  (trace): Update for call-with-trace name change.

13 years agoupdate (system repl debug) todo
Andy Wingo [Wed, 6 Oct 2010 19:19:49 +0000 (21:19 +0200)]
update (system repl debug) todo

* module/system/repl/debug.scm: Update todo.

13 years agoadd ,step ,stepi ,next and ,nexti
Andy Wingo [Wed, 6 Oct 2010 19:19:08 +0000 (21:19 +0200)]
add ,step ,stepi ,next and ,nexti

* module/system/vm/traps.scm (trap-matching-instructions): New trap,
  just installs a next hook and runs the handler when a predicate
  succeeds.

* module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): New
  procedure, uses trap-matching-instructions with an appropriate
  predicate to handle step, stepi, next, and nexti repl metacommands.

* module/system/repl/command.scm (step, step-instruction, next)
  (next-instruction): New repl debugger commands.

13 years agocleanups to ,finish
Andy Wingo [Wed, 6 Oct 2010 19:17:06 +0000 (21:17 +0200)]
cleanups to ,finish

* module/system/repl/command.scm (repl-pop-continuation-resumer): Factor
  out of finish.
  (finish): Adapt.

* module/system/vm/trap-state.scm (add-ephemeral-trap-at-frame-finish!):
  Rename to add "ephemeral" to the name.

* module/system/vm/traps.scm (trap-calls-to-procedure): Remove unused
  #:width kwarg.

13 years agobuild guile-readline/ after module/
Andy Wingo [Wed, 6 Oct 2010 08:24:45 +0000 (10:24 +0200)]
build guile-readline/ after module/

* Makefile.am (SUBDIRS): Build module/ before guile-readline/. Reformat.

13 years agoadd ,finish repl meta-command
Andy Wingo [Tue, 5 Oct 2010 19:53:58 +0000 (21:53 +0200)]
add ,finish repl meta-command

* module/system/repl/command.scm (finish): New REPL meta command. Uses
  fancy prompt stuff.

13 years ago(system vm trap-state): add-trap-at-frame-finish!
Andy Wingo [Tue, 5 Oct 2010 19:53:29 +0000 (21:53 +0200)]
(system vm trap-state): add-trap-at-frame-finish!

* module/system/vm/traps.scm: Fix a comment.

* module/system/vm/trap-state.scm (<trap-state>): Add next-ephemeral-idx
  slot.
  (wrapper-at-index): Use eqv? instead of = to avoid type errors in user
  inputs.
  (next-ephemeral-index!, ephemeral-handler-for-index): New functions,
  allocate ephemeral trap ids for functions to be called only once.
  (add-trap-at-frame-finish!): New export, traps when a frame finishes.

13 years ago(system vm frame): frame-return-values
Andy Wingo [Tue, 5 Oct 2010 19:51:44 +0000 (21:51 +0200)]
(system vm frame): frame-return-values

* module/system/vm/frame.scm (frame-return-values): New exported
  function, gives the return values for a frame.
* module/system/vm/trace.scm: Remove frame-return-values from here.

13 years agodebug-trap-handler ephemeral trap enhancement
Andy Wingo [Tue, 5 Oct 2010 19:50:57 +0000 (21:50 +0200)]
debug-trap-handler ephemeral trap enhancement

* module/system/repl/error-handling.scm (call-with-error-handling): If
  the given index is false, assume this was an ephemeral trap, and don't
  print a welcome message or reference the trap by index.

13 years ago(system repl debug): add frame->stack-vector
Andy Wingo [Tue, 5 Oct 2010 19:49:13 +0000 (21:49 +0200)]
(system repl debug): add frame->stack-vector

* module/system/repl/debug.scm (frame->stack-vector): New public
  function.

13 years agofix embarrassing error preventing ,del from working
Andy Wingo [Tue, 5 Oct 2010 19:48:27 +0000 (21:48 +0200)]
fix embarrassing error preventing ,del from working

* module/system/vm/trap-state.scm (remove-trap-wrapper!): Oops, fix
  newbie error regarding delq and mutation.

13 years agosystem repl repl comments
Andy Wingo [Tue, 5 Oct 2010 17:58:13 +0000 (19:58 +0200)]
system repl repl comments

* module/system/repl/repl.scm (meta-reader): Add a comment about peek,
  read, and the EOF object.

13 years agobugfixes and simplifications to ice-9 buffered-input.
Andy Wingo [Tue, 5 Oct 2010 17:55:37 +0000 (19:55 +0200)]
bugfixes and simplifications to ice-9 buffered-input.

* module/ice-9/buffered-input.scm (make-buffered-input-port): Simplify,
  and fix one case in which we would buffer the EOF object.

13 years agoguile-readline slight modernization
Andy Wingo [Tue, 5 Oct 2010 17:38:21 +0000 (19:38 +0200)]
guile-readline slight modernization

* guile-readline/Makefile.am: Update to use am/guilec.

* guile-readline/ice-9/readline.scm (activate-readline): Update to use a
  lambda*.

13 years agoRevert "repl.scm next-char needed to read EOF from port"
Andy Wingo [Mon, 4 Oct 2010 20:54:41 +0000 (22:54 +0200)]
Revert "repl.scm next-char needed to read EOF from port"

Actually peek-char => EOF does not guarantee that read-char => EOF. I
don't know what to do about this.

This reverts commit 6e1dccc42f9ec81e04524ccc0956c692ee423576.

13 years agoEdit section on generic functions
Neil Jerram [Sun, 3 Oct 2010 22:22:03 +0000 (23:22 +0100)]
Edit section on generic functions

* doc/ref/goops.texi (Generic Functions and Accessors): Renamed from
  `Creating Generic Functions'.  Explain what an accessor is.
  (Basic Generic Function Creation): Clarify the point of the text
  about generics having short names.

13 years agoEdit section on slot access
Neil Jerram [Sun, 3 Oct 2010 22:20:17 +0000 (23:20 +0100)]
Edit section on slot access

* doc/ref/goops.texi (Instance Slots): Remove a little verbosity.
  (Class Slots): Correct one `slot-missing' to `slot-unbound'.

13 years agoTypeset Ludo's name correctly
Neil Jerram [Sun, 3 Oct 2010 22:17:54 +0000 (23:17 +0100)]
Typeset Ludo's name correctly

* doc/ref/history.texi (A Scheme of Many Maintainers): Add
  TeX-specific version of `Courtès'.

13 years agoavoid some double-breaks in trap-at-procedure-ip-in-range
Andy Wingo [Sun, 3 Oct 2010 21:09:32 +0000 (23:09 +0200)]
avoid some double-breaks in trap-at-procedure-ip-in-range

* module/system/vm/traps.scm (trap-at-procedure-ip-in-range): Rework not
  to call the handler when returning to a frame that was already
  entered. So now breaking at foo.scm:1234 doesn't break when returning
  to that line.

13 years agorepl.scm next-char needed to read EOF from port
Andy Wingo [Sun, 3 Oct 2010 21:08:27 +0000 (23:08 +0200)]
repl.scm next-char needed to read EOF from port

* module/system/repl/repl.scm (next-char): Actually read off the EOF if
  we got one. Interesting, this.

13 years agoAdd implementation of SRFI 45
Andreas Rottmann [Sun, 3 Oct 2010 19:54:22 +0000 (21:54 +0200)]
Add implementation of SRFI 45

* module/srfi/srfi-45.scm: New file, containing the reference implementation of
  SRFI 45, slightly adapted to use SRFI-9.
* module/Makefile.am (SRFI_SOURCES): Added srfi/srfi-45.scm.

* test-suite/tests/srfi-45.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-45.test.

* doc/ref/srfi-modules.texi (SRFI-45): New node and subsection;
  essentially a shortended transcript of the SRFI-45 specification.

13 years agoAdd v1.8.x backward compatiblity to GUILE_SITE_DIR
Michael Gran [Sat, 2 Oct 2010 21:29:14 +0000 (14:29 -0700)]
Add v1.8.x backward compatiblity to GUILE_SITE_DIR

* meta/guile.m4 (GUILE_SITE_DIR): use pkgdatadir if no sitedir

13 years agosrfi-67 #:replace work
Andy Wingo [Sun, 3 Oct 2010 10:18:14 +0000 (12:18 +0200)]
srfi-67 #:replace work

* module/srfi/srfi-67.scm (string-compare, string-compare-ci): #:replace
  these bindings.

13 years agoAdd implementation of SRFI-67
Andreas Rottmann [Sun, 3 Oct 2010 10:14:21 +0000 (12:14 +0200)]
Add implementation of SRFI-67

* module/srfi/srfi-67/compare.scm: New file; reference implementation of
  SRFI 67.
* module/srfi/srfi-67.scm: New module; includes the refernce
  implementation.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-67.scm.
  (NOCOMP_SOURCES): Add srfi/srfi-67/compare.scm.

* test-suite/tests/srfi-67.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-67.test.

13 years agoAdd implementation of SRFI 42
Andreas Rottmann [Sun, 3 Oct 2010 10:06:38 +0000 (12:06 +0200)]
Add implementation of SRFI 42

* module/srfi/srfi-42/ec.scm: New file; reference implementation of
  SRFI 42.
* module/srfi/srfi-42.scm: New file; module for SRFI 42.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-42.scm.
  (NOCOMP_SOURCES): Add srfi/srfi-42/ec.scm.

* test-suite/tests/srfi-42.test: New file; test suite for SRFI 42.
* test-suite/Makefile.am: SCM_TESTS: Add tests/srfi-42.test.

13 years agoReference original specification in SRFI 27 documentation
Andreas Rottmann [Sun, 3 Oct 2010 09:55:24 +0000 (11:55 +0200)]
Reference original specification in SRFI 27 documentation

* doc/ref/srfi-modules.texi (SRFI-27): Link to the original
  specification of SRFI-27.

13 years agobugfixen in source breakpoints and in-procedure traps
Andy Wingo [Sun, 3 Oct 2010 09:12:36 +0000 (11:12 +0200)]
bugfixen in source breakpoints and in-procedure traps

* module/system/vm/traps.scm (trap-in-procedure): If we are
  (re-)entering the procedure from a return, call the enter-proc with
  the returnee, not the returner.
  (in-range?): Tighten up a bit.
  (program-sources-before-retire): New helper, like program-sources but
  indexed before instructions are retired instead of after.
  (program-sources-by-line): Use program-sources-before-retire so that
  we can break on instructions by source line *before* those
  instructions are executed.

13 years agoFlatten `Miscellaneous Functions'
Neil Jerram [Sat, 2 Oct 2010 15:24:14 +0000 (16:24 +0100)]
Flatten `Miscellaneous Functions'

* doc/ref/goops.texi (Miscellaneous Functions): Delete this container
  section, and promote its subsections.

13 years agoCustomizing Instance Creation to metaobject protocol section
Neil Jerram [Sat, 2 Oct 2010 15:12:32 +0000 (16:12 +0100)]
Customizing Instance Creation to metaobject protocol section

* doc/ref/goops.texi (Customizing Instance Creation): Moved from
  `Creating Instances' to `The Metaobject Protocol'.

* doc/ref/goops.texi (Basic Instance Creation): Flattened into parent
  `Creating Instances', refs updated accordingly.

13 years agoRemove goops-version, which is no longer defined
Neil Jerram [Sat, 2 Oct 2010 15:10:56 +0000 (16:10 +0100)]
Remove goops-version, which is no longer defined

* doc/ref/goops.texi (Administrative Functions): Removed.

* module/oop/goops.scm (oop): Don't export `goops-version'.

13 years agoRemove doc of STKlos compatibility
Neil Jerram [Sat, 2 Oct 2010 14:39:14 +0000 (15:39 +0100)]
Remove doc of STKlos compatibility

As module/oop/goops/stklos.scm, the available compatibility is
superficial only, so it isn't worth documenting.

* doc/ref/goops.texi (STKlos Compatibility): Removed.

13 years agoContinue separating simple and more complex GOOPS doc
Neil Jerram [Sat, 2 Oct 2010 14:36:46 +0000 (15:36 +0100)]
Continue separating simple and more complex GOOPS doc

* doc/ref/goops.texi (Defining New Classes): Move `Class Definition
  Internals' and `Customizing Class Definition' notes to the
  metaobject protocol section.

13 years agosource breakpoints accept user line numbers
Andy Wingo [Fri, 1 Oct 2010 16:25:44 +0000 (18:25 +0200)]
source breakpoints accept user line numbers

* module/system/vm/trap-state.scm (add-trap-at-source-location!):
* module/system/vm/traps.scm (trap-at-source-location): Rename "line"
  argument to "user-line", indicating that the line is one-based instead
  of zero-based. Decrement the line before handing off to
  source-closures-or-procedures and source->ip-range.

13 years agoadd source:line-for-user, returning a 1-indexed line number
Andy Wingo [Fri, 1 Oct 2010 16:15:23 +0000 (18:15 +0200)]
add source:line-for-user, returning a 1-indexed line number

* module/system/vm/program.scm (source:line-for-user): New exported
  procedure, returns a 1-indexed line, suitable for presentation to a
  user.
  (write-program): Use source:line-for-user when making fallback names.

* module/system/vm/coverage.scm (coverage-data->lcov):
* module/language/assembly/disassemble.scm (source->string):
* module/system/repl/debug.scm (print-frame): Use source:line-for-user.

13 years agoapi-debug tweak
Andy Wingo [Fri, 1 Oct 2010 15:26:41 +0000 (17:26 +0200)]
api-debug tweak

* doc/ref/api-debug.texi (Debug Options): Fix wording.

13 years agoupdate api-debug.texi discussion of stack overflow
Andy Wingo [Fri, 1 Oct 2010 15:11:25 +0000 (17:11 +0200)]
update api-debug.texi discussion of stack overflow

* doc/ref/api-debug.texi (Debug Options): Update stack overflow
  discussion.

13 years agoc stack overflow checked for, once more
Andy Wingo [Fri, 1 Oct 2010 14:47:39 +0000 (16:47 +0200)]
c stack overflow checked for, once more

* libguile/stackchk.h: Include private-options.h if we are building
  guile.

* libguile/vm.c (scm_c_vm_run): Check for C stack overflow before
  entering the engine.

13 years agoscm_report_stack_overflow eventually resets scm_stack_checking_enabled_p
Andy Wingo [Fri, 1 Oct 2010 14:36:34 +0000 (16:36 +0200)]
scm_report_stack_overflow eventually resets scm_stack_checking_enabled_p

* libguile/stackchk.c (scm_report_stack_overflow): Surround in a
  dynwind, so that scm_stack_checking_enabled_p is reset when the error
  throws.

13 years agoFix typo in configure.ac
Neil Jerram [Thu, 30 Sep 2010 23:11:18 +0000 (00:11 +0100)]
Fix typo in configure.ac

Fixes an error when running ./configure:
./configure: line 31873: text: command not found

* configure.ac: Change "text" to "test", in libltdl-related code.

13 years agodeprecate turn-on-debugging, it is obsolete
Andy Wingo [Fri, 1 Oct 2010 11:17:44 +0000 (13:17 +0200)]
deprecate turn-on-debugging, it is obsolete

* libguile/script.c (scm_compile_shell_switches): Don't generate calls
  to turn-on-debugging.

* module/ice-9/boot-9.scm (turn-on-debugging): Remove.

* module/ice-9/deprecated.scm (turn-on-debugging): Add deprecated shim.

13 years agoscm_debug_opts to debug.c, backtrace on by default, scm_*_opts internal linkage
Andy Wingo [Fri, 1 Oct 2010 11:11:51 +0000 (13:11 +0200)]
scm_debug_opts to debug.c, backtrace on by default, scm_*_opts internal linkage

* libguile/eval.c:
* libguile/debug.c (scm_debug_opts): Move here, from eval.c. Change
  SCM_BACKTRACE_P to 1, initially.

* libguile/private-options.h: Make all options vars private.

13 years agodocument call-with-error-handling
Andy Wingo [Fri, 1 Oct 2010 11:03:08 +0000 (13:03 +0200)]
document call-with-error-handling

* doc/ref/api-debug.texi (Pre-Unwind Debugging): Document
  call-with-error-handling.

13 years agoapi-debug.texi refactors
Andy Wingo [Fri, 1 Oct 2010 10:49:16 +0000 (12:49 +0200)]
api-debug.texi refactors

* doc/ref/api-debug.texi (Programmatic Error Handling): Rename from
  "Debug on Error". Reorganize subsections according to when the error
  is handled.
* doc/ref/api-options.texi: Adapt xref.

13 years agoupdate tour.texi
Andy Wingo [Fri, 1 Oct 2010 09:54:38 +0000 (11:54 +0200)]
update tour.texi

* doc/ref/tour.texi (Using the Guile Module System): Remove "in flux"
  language. Update examples to use #:export instead of (export ...).

13 years agofinish cleaning out api-options.texi
Andy Wingo [Fri, 1 Oct 2010 09:47:53 +0000 (11:47 +0200)]
finish cleaning out api-options.texi

* doc/ref/api-debug.texi (Debug on Error): Move debug options here (for
  now). Leave debug-options-interface undocumented.

* doc/ref/api-options.texi (Runtime Options): Remove debug options. Link
  to the sections where the options documentation is now. Update the
  options example transcript.

13 years agodebug and readline options doc tweak
Andy Wingo [Fri, 1 Oct 2010 09:15:12 +0000 (11:15 +0200)]
debug and readline options doc tweak

* doc/ref/api-options.texi (Debugger options):
* doc/ref/repl-modules.texi (Readline Options): Use 'help instead of
  'full (they are entirely equivalent right now). Update output to show
  options in the right order.

13 years agomove read and print options docs to the procedures they parameterize
Andy Wingo [Fri, 1 Oct 2010 09:09:28 +0000 (11:09 +0200)]
move read and print options docs to the procedures they parameterize

* doc/ref/api-evaluation.texi (Scheme Read): Fold all reader options
  docs into this section. Undocument read-options-interface.
  (Scheme Write): New section for `write' and `display', and the print
  options. print-enable/print-disable are not documented, as there are
  no boolean print options. print-options-interface is likewise
  undocumented.

* doc/ref/api-options.texi: Remove discussion of options in
  general. Move read options to Scheme Read, and print options to Scheme
  Write.

* doc/ref/api-io.texi (Reading): Link to Scheme Read.
  (Writing): Move write and display to Scheme Write, and link there.

* doc/ref/srfi-modules.texi:
* doc/ref/api-debug.texi:
* doc/ref/api-data.texi: Update xrefs.

13 years agoremove elisp-strings and elisp-vectors read options
Andy Wingo [Fri, 1 Oct 2010 08:20:54 +0000 (10:20 +0200)]
remove elisp-strings and elisp-vectors read options

* libguile/private-options.h (SCM_ELISP_VECTORS_P, SCM_ESCAPED_PARENS_P):
* libguile/read.c (scm_read_opts): Remove unused elisp-vectors option,
  and the elisp-strings option (which allowed \( and \) escapes in
  strings).
  (scm_read_string): Remove the elisp-strings case.

* doc/ref/api-options.texi (Reader options): Update, and update wording
  of the case-insensitive bit.

13 years ago(foo-options 'full) displays options doc in correct order
Andy Wingo [Fri, 1 Oct 2010 08:07:47 +0000 (10:07 +0200)]
(foo-options 'full) displays options doc in correct order

* libguile/options.c (get_documented_option_setting): Reverse options
  interface list before returning, so that they are in the original
  order.

13 years agoremove unused print-options
Andy Wingo [Fri, 1 Oct 2010 07:56:15 +0000 (09:56 +0200)]
remove unused print-options

* libguile/private-options.h (SCM_PRINT_CLOSURE, SCM_PRINT_SOURCE_P):
* libguile/print.c (scm_print_opts):
* doc/ref/api-options.texi (Printing options): Remove source and
  closure-hook print options.

13 years agoadd ,registers
Andy Wingo [Thu, 30 Sep 2010 19:29:20 +0000 (21:29 +0200)]
add ,registers

* libguile/frames.h:
* libguile/frames.c (scm_frame_stack_pointer): New function.

* module/system/repl/debug.scm (print-registers): New function, prints
  out registers.

* module/system/repl/command.scm (registers): New debugging
  meta-command.
  (inspect): Not a stack-command, a normal meta-command.

13 years agofix check-guile.in for default vm change
Andy Wingo [Tue, 28 Sep 2010 08:03:55 +0000 (10:03 +0200)]
fix check-guile.in for default vm change

* check-guile.in: Make the --debug fix in the source file, not the
  generated file. Grr.

13 years agodefault to regular vm for noninteractive use
Andy Wingo [Tue, 28 Sep 2010 07:22:38 +0000 (09:22 +0200)]
default to regular vm for noninteractive use

* libguile/script.c (scm_compile_shell_switches): Select the debugging
  VM in the cases that we previously would select deval -- when running
  interactively without --no-debug, or otherwise with --debug.

* libguile/vm.c: Default to the regular engine.
  (scm_c_set_vm_engine_x): Remove requirement for the VM to have no
  pending computations.

13 years agoFix pattern variable extraction in `match' with `..1'.
Ludovic Courtès [Mon, 27 Sep 2010 21:52:10 +0000 (23:52 +0200)]
Fix pattern variable extraction in `match' with `..1'.

* module/ice-9/match.upstream.scm (match-extract-vars): Support `..1'.

13 years agoAdd support for `..1' to `match'.
Ludovic Courtès [Mon, 27 Sep 2010 20:50:36 +0000 (22:50 +0200)]
Add support for `..1' to `match'.

Patch accepted upstream:
<http://lists.gnu.org/archive/html/guile-devel/2010-09/threads.html#00114>.

* module/ice-9/match.upstream.scm (match-two): Add support for `..1'.

* test-suite/tests/match.test ("matches")["list ..1", "list ..1, with
  predicate"]: New tests.
  ("doesn't match")["list ..1", "list ..1, with predicate"]: New tests.

13 years agoAdd implementation of SRFI 27
Andreas Rottmann [Mon, 27 Sep 2010 20:15:51 +0000 (22:15 +0200)]
Add implementation of SRFI 27

* module/srfi/srfi-27.scm: New file; implementation of SRFI 27 in terms
  of the existing random number generator.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-27.scm.

* test-suite/tests/srfi-27.test: New file; minimal test suite for SRFI 27.
* test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-27.test.

* doc/ref/srfi-modules.texi: Add subsection on SRFI-27 based
  on the specification.

13 years agoadd call-with-vm; remove thread-vm bits; remove vm-apply; engines settable.
Andy Wingo [Mon, 27 Sep 2010 19:06:24 +0000 (21:06 +0200)]
add call-with-vm; remove thread-vm bits; remove vm-apply; engines settable.

* libguile/vm.h (scm_c_vm_run): Make internal.
* libguile/vm.c (vm_default_engine): New static global variable.
  (make_vm): Set vp->engine based on
  (scm_vm_apply): Remove in favor of call-with-vm.
  (scm_thread_vm, scm_set_thread_vm_x): Remove these, as they did not
  have a well-defined meaning, and were dangerous to call on other
  threads.
  (scm_the_vm): Reinstate previous definition.
  (symbol_to_vm_engine, vm_engine_to_symbol)
  (vm_has_pending_computation): New helpers.
  (scm_vm_engine, scm_set_vm_engine_x, scm_c_set_vm_engine_x): New
  accessors for VM engines.
  (scm_c_set_default_vm_engine_x, scm_set_default_vm_engine_x): New
  setters for the default VM engine.
  (scm_call_with_vm): New function, applies a procedure to arguments in
  a context in which a given VM is current.

* libguile/eval.c (eval, scm_apply): VM dispatch goes through
  scm_call_with_vm.

* test-suite/tests/control.test ("the-vm"):
* module/system/vm/coverage.scm (with-code-coverage): Use call-with-vm.

* module/system/vm/vm.scm: Update exports.

* test-suite/vm/run-vm-tests.scm (run-vm-program):
* test-suite/tests/compiler.test ("current-reader"): Just rely on the
  result of make-program being an applicable.

* test-suite/tests/eval.test ("stack overflow"): Add a note that this
  test does not test what it should.

13 years agoFix bignum memory leak.
Ludovic Courtès [Mon, 27 Sep 2010 09:20:14 +0000 (11:20 +0200)]
Fix bignum memory leak.

The `mpz_t' associated with a bignum would never be freed, so an
expression like `(while #t (expt 2 5000))' would quickly lead to memory
exhaustion.

* libguile/numbers.c (finalize_bignum): New function.
  (make_bignum): Register it as a finalizer for P.

13 years agoAllocate bignums in pointer-less memory.
Ludovic Courtès [Mon, 27 Sep 2010 09:10:01 +0000 (11:10 +0200)]
Allocate bignums in pointer-less memory.

* libguile/numbers.c (make_bignum): New function.
  (scm_i_mkbig, scm_i_long2big, scm_i_ulong2big, scm_i_clonebig,
  scm_i_dbl2big, scm_i_mpz2num): Use it.

13 years agoRemove `scm_t_aligned_cell'.
Ludovic Courtès [Sun, 26 Sep 2010 23:28:49 +0000 (01:28 +0200)]
Remove `scm_t_aligned_cell'.

* libguile/_scm.h (scm_aligned_cell, scm_t_aligned_cell): Remove.  The
  whole approach was misguided as the compiler can't guarantee absolute
  alignment on the stack.

13 years agoFix argument passing in VM hooks.
Ludovic Courtès [Sun, 26 Sep 2010 14:24:35 +0000 (16:24 +0200)]
Fix argument passing in VM hooks.

* libguile/vm.c (vm_dispatch_hook): Take care of FRAME's alignment
  explicitly so that it's correct even if the current stack frame isn't
  8-byte aligned (as can be the case on i686--the SysV i386 ABI just
  says that the stack is word-aligned.)

13 years agoHave `@abort' honor VM changes by winds.
Ludovic Courtès [Sun, 26 Sep 2010 14:23:53 +0000 (16:23 +0200)]
Have `@abort' honor VM changes by winds.

* libguile/control.c (scm_c_abort): Update VM after the `scm_dowinds'
  call.

* test-suite/tests/control.test ("the-vm"): New test prefix.

13 years agoFavor non-hex string escapes over hex escapes when writing strings
Michael Gran [Sun, 26 Sep 2010 19:25:18 +0000 (12:25 -0700)]
Favor non-hex string escapes over hex escapes when writing strings

The characters U+0007 to U+000D have non-hex forms for their
escapes when in written strings.

* libguile/print.c (write_character): use non-hex escapes
* test-suite/tests/reader.test (write R6RS string escapes): adjust test

13 years agoEdit define-class doc
Neil Jerram [Sun, 26 Sep 2010 18:42:01 +0000 (19:42 +0100)]
Edit define-class doc

* doc/ref/goops.texi (Defining New Classes): Remove "fixme" text
  (saying we should have something that we in fact already have).  A
  few minor edits throughout.

  (Basic Class Definition): Move content up into `Defining New
  Classes'.

  (Class Options): Move after `Slot Options' (because slot options are
  more important).  Remove doc of the #:environment option, since I
  believe it's now fictitious.

  (Slot Options): Reorder the options so that the most commonly used
  ones come first.

13 years agoRemove unwarranted para
Neil Jerram [Sat, 25 Sep 2010 16:29:18 +0000 (17:29 +0100)]
Remove unwarranted para

* doc/ref/goops.texi (Metaobjects and the Metaobject Protocol): Remove
  para about GOOPS classes belonging to the usual Scheme namespace.
  Interest doesn't justify the space that it takes.

13 years agoEdit text about the MOP
Neil Jerram [Sat, 25 Sep 2010 16:27:14 +0000 (17:27 +0100)]
Edit text about the MOP

* doc/ref/goops.texi (The Metaobject Protocol, Metaobjects and the
  Metaobject Protocol): Minor edits.