1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

191 commits

Author SHA1 Message Date
Mark H Weaver
505afe2832 Update user-visible copyright dates in manual and REPL to 2012
* doc/ref/guile.texi, module/system/repl/common.scm: Update
  user-visible copyright dates to 2012.
2012-01-30 00:33:31 -05:00
Ludovic Courtès
f5e772b2ba Fix a couple of warnings.
* module/scripts/list.scm: Use SRFI-1.
* module/system/repl/error-handling.scm: Use (ice-9 format).
2012-01-26 00:37:23 +01:00
Andy Wingo
2aef6c2ba9 ,language at REPL sets current-language
* module/system/repl/command.scm (language): Set the
  *current-language*.
* module/system/repl/repl.scm (start-repl): Create a new dynamic scope
  for *current-language*.
2011-12-04 21:56:13 +01:00
Andy Wingo
46e0923d35 fix bug in make-repl when lang is actually a language
* module/system/repl/common.scm (make-repl): Fix to accept language
  objects in addition to symbols.  Fixes http://debbugs.gnu.org/9857.
  Thanks to Tristan Colgate for the report.
2011-11-16 19:49:50 +01:00
BT Templeton
74e4dd2798 set width for `,trace' command
* module/system/repl/command.scm (trace): Set trace width to terminal
  width by default.
2011-10-22 12:46:56 +02:00
Andy Wingo
d62dd76685 add ,expand and ,optimize
* module/system/repl/command.scm (*command-table*, expand, optimize):
  New meta-commands.
* module/system/repl/common.scm (repl-expand, repl-optimize): New
  helpers.

* doc/ref/scheme-using.texi (Compile Commands): Document.
2011-10-10 17:01:11 +02:00
Andy Wingo
0c65f52c6d more define-syntax-rule usage
* module/ice-9/boot-9.scm:
* module/ice-9/control.scm:
* module/ice-9/futures.scm:
* module/ice-9/optargs.scm:
* module/ice-9/poll.scm:
* module/ice-9/receive.scm:
* module/ice-9/threads.scm:
* module/ice-9/vlist.scm:
* module/language/assembly/compile-bytecode.scm:
* module/language/ecmascript/compile-tree-il.scm:
* module/language/tree-il.scm:
* module/oop/goops.scm:
* module/oop/goops/simple.scm:
* module/oop/goops/stklos.scm:
* module/srfi/srfi-1.scm:
* module/srfi/srfi-35.scm:
* module/srfi/srfi-39.scm:
* module/srfi/srfi-45.scm:
* module/srfi/srfi-67/compare.scm:
* module/sxml/match.scm:
* module/system/repl/error-handling.scm:
* module/system/repl/repl.scm:
* module/system/vm/inspect.scm:
* module/texinfo.scm:
* module/web/server.scm: Use define-syntax-rule, where it makes sense.
2011-09-02 11:36:14 +02:00
Andy Wingo
c1e3e9aaff more precision for ,time
* module/system/repl/command.scm (time): Use the high-precision timers
  instead of stime(2).  Changes the output format of `,time' too;
  perhaps there is a better way.
2011-07-07 09:57:19 +02:00
Andy Wingo
adf43b3f08 ignore SIGPIPE in (system repl server)
* module/system/repl/server.scm (run-server): Ignore SIGPIPE when we run
  a server, as otherwise a rudely disconnected client could cause the
  server to quit.  Thanks to John Proctor for the report, and Detlev
  Zundel for the debugging.
2011-04-11 10:13:48 +02:00
Andy Wingo
fb6df3ea13 fix error message on ,disassemble "non-procedure"
* module/language/objcode/spec.scm (decompile-value): Don't assume that
  `error' will handle format strings appropriately.
* module/system/repl/command.scm (disassemble): A more human error when
  you disassemble a non-procedure.

Bug reported by Andrew Horton.
2011-03-29 12:38:18 +02:00
Mark H Weaver
8099352769 Do not enter the debugger if the thrown key is in `pass-keys'
* module/system/repl/error-handling.scm (call-with-error-handling):
  Do _not_ enter the debugger if the thrown key is in `pass-keys'.
  Previously, for example, (throw 'quit) entered the debugger when run
  from the REPL, despite the fact that 'quit is in `pass-keys'.
2011-03-22 11:45:53 -04:00
Andy Wingo
bb455e4f94 allow ,option on-error report instead of debug
* module/system/repl/command.scm:
* module/system/repl/debug.scm (terminal-width): Move terminal-width
  here, make it thread-local, and export it.
  (print-locals, print-frame, print-frames): Default width to
  terminal-width.

* module/system/repl/error-handling.scm (call-with-error-handling): Add
  `report' and `backtrace' on-error handlers.

* module/system/repl/common.scm (repl-default-options): Add on-error
  REPL option, defaulting to `debug', but which may be changed.

* module/system/repl/repl.scm (run-repl): Pass the #:on-error REPL
  option to call-with-error-handling.
2011-03-17 12:39:59 +01:00
Andy Wingo
090f14b890 repl: terminal-width by default
* module/system/repl/command.scm (terminal-width): New parameter that
  will use the true terminal width if unset.
  (backtrace, locals): Default to (terminal-width).
  (width): Simplify.
2011-03-04 11:16:15 +01:00
Michael Gran
47b86dbf4d Add ,width meta-command to set screen width in debug output
This meta-command allows one to set the default number of columns
that output from ,backtrace and ,locals shall occupy.

* doc/ref/scheme-using.texi (Debug Commands): document ,width
* module/system/repl/command.scm (*width*): new var
  (backtrace, locals): use *width* in optarg
  (width): new meta-command
2011-03-04 11:01:48 +01:00
Andy Wingo
c7d6f8b279 fix ,stat
* module/system/repl/command.scm (statistics): Fix for BDW-GC.
  Unfortunately we still don't have mallocation or time taken.
2011-03-04 10:33:51 +01:00
Andy Wingo
65fa60ca7a repl.scm understands comments
* module/system/repl/repl.scm (read-comment, read-scheme-line-comment)
  (read-scheme-datum-comment): New helpers.
  (meta-reader): Take a language instead of a reader.  If we have a
  nonwhitespace char, first check to see that it's a comment, and if so,
  read it off and loop.
  (prompting-meta-read): Call meta-reader with the lang.
2011-03-03 23:51:20 +01:00
Andy Wingo
859e58ae8a repl.scm refactor
* module/system/repl/repl.scm (flush-leading-whitespace): Rename from
  next-char.
  (meta-reader): Use flush-leading-whitespace.
  (run-repl): Use flush-to-newline after the evaluation, which seems to
  be the same as what we did before.
2011-03-03 23:19:35 +01:00
Andy Wingo
dcb7c7ddf5 flush all input on a read error
* module/system/repl/repl.scm (flush-all-input): New helper.
  (prompting-meta-read): Flush all input on a read error, as we could be
  within some expression or a string or something.
2011-02-27 23:26:08 +01:00
Ludovic Courtès
d215190e5c Leave the default `*current-warning-prefix*' at the REPL.
* module/system/repl/common.scm (repl-compile): Leave the default
  `*current-warning-prefix*'.
2011-02-14 13:47:20 +01:00
Ludovic Courtès
5a79300f85 Add %auto-compilation-options', used by compile-file' when auto-compiling.
* module/ice-9/boot-9.scm (%auto-compilation-options): New variable.
  (load-in-vicinity): Honor it.

* libguile/load.c (kw_opts, sym_compile_file,
  sym_auto_compilation_options): New variables.
  (do_try_auto_compile): Honor %AUTO-COMPILATION-OPTIONS.

* module/system/repl/common.scm (repl-default-options): Have
  `compile-options' default to %AUTO-COMPILATION-OPTIONS.
2011-02-13 19:18:02 +01:00
Ludovic Courtès
a4060f6710 Add `*current-warning-prefix*'.
* module/system/base/message.scm (*current-warning-prefix*): New
  variable.
  (%warning-types): Honor `*current-warning-prefix*'.

* module/scripts/compile.scm (compile): Use an empty
  `*current-warning-prefix*'.

* module/system/repl/common.scm (repl-compile): Likewise.

* test-suite/tests/tree-il.test (call-with-warnings): Likewise.
2011-02-13 19:13:36 +01:00
Mark H Weaver
1a3152f7df Bump copyright date in REPL version string
* module/system/repl/common.scm (*version*): Add 2011 to copyright
  date range.
2011-02-12 13:00:43 +01:00
Andy Wingo
eaba53b7c8 repl.scm: use print-exception
* module/system/repl/repl.scm: Remove custom exception printers in favor
  of print-exception.
2011-02-11 12:57:08 +01:00
Andy Wingo
f87db65719 (system repl error-handling) uses print-exception
* module/system/repl/error-handling.scm (error-string): Just use
  print-exception instead of rolling our own printer.
  (call-with-error-handling): Simplify.
2011-02-11 12:57:08 +01:00
Andy Wingo
4b1eb2b27a hackily fix another case where display-exception would be apropos
* module/system/repl/error-handling.scm (display-syntax-error)
  (error-string): Until we get the exception-printing patch merged in,
  copy display-syntax-error into error-handling so that we avoid
  display-error.  Fixes bug 32365.
2011-02-08 22:41:36 +01:00
Michael Gran
e1b6a3f150 Use 'substring' instead of obsoleted 'make-shared-substring'
* module/system/repl/describe.scm (display-description): replace
  make-shared-substring with substring
2011-02-02 05:45:37 -08:00
Andreas Rottmann
de9a0f008f Fix `show' REPL meta-command
* module/system/repl/command.scm (warranty, copying, version): Use
  `define-meta-command' to define these procedures, so they are entered
  into the *command-infos* table.
2011-02-01 23:50:09 +01:00
Andy Wingo
cdab9fc625 add ,reload meta-command and document it and reload-module
* module/ice-9/boot-9.scm (reload-module): Add docstring.
* module/system/repl/command.scm (reload): New meta-command.

* doc/ref/scheme-using.texi (Module Commands): Document the ,reload
  meta-command.
* doc/ref/api-modules.texi (Module System Reflection): Document
  reload-module.
2010-12-17 13:27:43 +01:00
Andreas Rottmann
8fdd85f834 Allow user-defined meta-commands
Besides allowing user-defined meta-commands, this change also refactors
the meta-command machinery to split reading a command's arguments from
the procedure actually implementing it, and hence allows nesting
meta-commands.  As an example of such a command, ",in" is added as a new
meta-command.

* module/system/repl/command.scm: Export `define-meta-command'.
  (*command-module*): Replaced by the hash table `*command-infos*'.
  (command-info, make-command-info, command-info-procedure)
  (command-info-arguments-reader): New procedures, encapsulating the
  information about a meta-command.
  (command-procedure): Adapted to use the `command-info' lookup
  procedure.
  (read-command-arguments): New auxiliary procedure invoking a command's
  argument reader procedure.
  (meta-command): Adapted to the split of reading arguments and
  executing a command.
  (add-meta-command!): New auxiliary procedure, registers a meta
  command's procedure and argument reader into `*command-infos* and
  `*command-table*.
  (define-meta-command): Extended to allow specification of the command's
  category; split the argument reader and actual command procedure.
  (guile:apropos, guile:load, guile:compile-file, guile:gc): Remove these
  aliases, they are unnecessary as we now use a hash table instead of the
  module to store the commands.
  (in): New meta-command, which evaluates an expression, or alternatively
  executes another meta-command, in the context of a specific module.
* doc/ref/scheme-using.texi (Module Commands): Document the `in'
  meta-command.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2010-11-20 23:55:19 +01:00
Andy Wingo
c372cd74fd repl read/write using current ports, not captured ports
Fixes bug in repl meta-commands after activating readline, which changes
the current input port.

* module/system/repl/common.scm (<repl>): Remove inport and outport
  fields.
  (make-repl): Adapt.
  (repl-read, repl-print): Just read and write to the current ports.

* module/system/repl/repl.scm (meta-reader): Meta-read from the current
  input port.

* module/system/repl/command.scm (read-command, define-meta-command):
  Read from the current input port.
2010-11-18 14:32:53 +01:00
Andy Wingo
29de6ae2e8 repl.scm displays syntax errors on read as well
* module/system/repl/repl.scm (prompting-meta-read): Use
  display-syntax-error as appropriate.
2010-11-18 12:21:36 +01:00
Andy Wingo
2090f909b4 add proper pretty-printing for syntax errors
* module/system/repl/repl.scm (display-syntax-error): New helper,
  displays a syntax error.
  (abort-on-error, run-repl): Use it.

* libguile/throw.c (handler_message): Re-code the same thing in C.
2010-11-16 02:57:27 +01:00
Andy Wingo
67d655849a call-with-error-handling pass-keys w/ procedural handlers fix
* module/system/repl/error-handling.scm (call-with-error-handling):
  Respect the pass-keys set for procedural on-error and post-error
  handlers.
2010-11-12 17:16:35 +01:00
Andy Wingo
5aa12c699c ,frame and related commands handle for-trap? appropriately
* module/system/repl/debug.scm (print-frame): Add #:next-source? arg,
  for when print-frame should use frame-next-source instead of
  frame-source.
  (print-frames): Add #:for-trap? arg. If true, the 0th frame should be
  printed with frame-next-source.

* module/system/repl/command.scm (define-stack-command): Introduce
  for-trap? into the lexical env.
  (backtrace, up, down, frame): Update to do the right thing regarding
  #:for-trap?.
2010-10-12 13:24:46 +02:00
Andy Wingo
5414d33376 don't warn for (format #t fmt) -- format string actually named fmt
* module/language/tree-il/analyze.scm (format-analysis): Don't warn on
  non-literal format string if the format string is a lexical ref to a
  variable named "fmt". A slight hack, but effective :)
* module/system/repl/command.scm (display-stat): Rename the format
  string to "fmt".
2010-10-12 13:11:40 +02:00
Andy Wingo
a36c3a458e debug has for-trap? field
* module/system/repl/debug.scm (<debug>): New field, `for-trap?'. True
  if the stack is for a trap, and thus the top frame should use
  frame-next-source instead of frame-source.

* module/system/repl/command.scm (repl-pop-continuation-resumer)
  (repl-next-resumer):
* module/system/repl/error-handling.scm (call-with-error-handling):
  Update callers.
2010-10-12 13:09:48 +02:00
Ludovic Courtès
08002eae4d Fix typo.
* module/system/repl/command.scm (repl-pop-continuation-resumer): Remove
  extraneous argument to `format'.
2010-10-10 19:10:11 +02:00
Andy Wingo
d30542c2b7 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.
2010-10-10 12:15:34 +02:00
Andy Wingo
a627100bf3 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.
2010-10-08 19:27:45 +02:00
Ludovic Courtès
7390e4bd11 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'.
2010-10-08 15:25:56 +02:00
Andy Wingo
aee24bac50 fix a bug in `finish'
* module/system/repl/command.scm (repl-pop-continuation-resumer)
  (finish): Fix a bug printing return values.
2010-10-08 12:31:56 +02:00
Andy Wingo
1ecf39a6a7 add repl debugging command docs
* doc/ref/scheme-using.texi (Debug Commands): Add docs for new debugging
  commands (break, step, registers, etc).
2010-10-08 12:31:50 +02:00
Andy Wingo
e7544f39a4 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.
2010-10-07 12:55:37 +02:00
Andy Wingo
90966af895 update (system repl debug) todo
* module/system/repl/debug.scm: Update todo.
2010-10-06 21:19:49 +02:00
Andy Wingo
439e032b0b 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.
2010-10-06 21:19:08 +02:00
Andy Wingo
e8e4e7310c 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.
2010-10-06 21:17:06 +02:00
Andy Wingo
c6025e76ff add ,finish repl meta-command
* module/system/repl/command.scm (finish): New REPL meta command. Uses
  fancy prompt stuff.
2010-10-05 21:53:58 +02:00
Andy Wingo
ee02e238a3 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.
2010-10-05 21:50:57 +02:00
Andy Wingo
586aff5a27 (system repl debug): add frame->stack-vector
* module/system/repl/debug.scm (frame->stack-vector): New public
  function.
2010-10-05 21:49:13 +02:00
Andy Wingo
35c46aad66 system repl repl comments
* module/system/repl/repl.scm (meta-reader): Add a comment about peek,
  read, and the EOF object.
2010-10-05 19:58:13 +02:00