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

673 commits

Author SHA1 Message Date
Andy Wingo
aae64b37e5 fix scm-error invocation on SIGINT in top-repl.scm
* module/ice-9/top-repl.scm (call-with-sigint): Pass '() as the format
  args when invoking scm-error, to ensure that the error is printable.
2011-02-12 15:58:21 +01:00
Andy Wingo
e8df456a15 print-exception gets a c binding
* libguile/backtrace.c (scm_print_exception): Add C binding for
  print-exception, which dispatches to whatever is defined in Scheme.
  (boot_print_exception): Add initial binding, replaced later in
  Scheme.

* module/ice-9/boot-9.scm: Expect there to already be a print-exception
  binding.
2011-02-11 13:13:26 +01:00
Andy Wingo
40b91dc897 add set-exception-printer!, print-exception to boot-9
* module/ice-9/boot-9.scm (set-exception-printer!, print-exception):
  Define an extensible exception-printing mechanism.
  Also register printers for all keys thrown by Guile.
  Inspired by a patch by Andreas Rottmann.
2011-02-11 12:57:02 +01:00
Andy Wingo
7948811252 deprecate primitive properties
* libguile.h:
* libguile/Makefile.am:
* libguile/deprecated.h:
* libguile/deprecated.c:
* libguile/init.c:
* libguile/properties.c:
* libguile/properties.h: Deprecate the "primitive properties"
  interface.  It was only used to implement object properties, and that
  is no longer the case.

* module/ice-9/boot-9.scm (make-object-property): Reimplement just in
  terms of weak hash tables, and make threadsafe.

* NEWS:
* doc/ref/api-utility.texi: Update.
2011-02-10 23:16:52 +01:00
Andy Wingo
0bc86fcedc getopt-long: arg parsing errors cause print and exit, not backtrace
* module/ice-9/getopt-long.scm (fatal-error): New helper.  For errors
  that come from the user -- i.e., not the grammar -- we will handle our
  own error printing and call `exit' rather than relying on the root
  catch handler.  This is more friendly to the user than a Scheme
  backtrace.
  (parse-option-spec, process-options, getopt-long): Call `fatal-error'
  as appropriate.

* test-suite/tests/getopt-long.test (pass-if-fatal-exception): New
  helper, checks that a certain key was thrown to, and that suitable
  output has been printed on an error port.
  (deferr): Change to expect a 'quit key instead of 'misc-error.  Update
  exceptions to not match the beginning of the string, as that will be
  the program name.  Update tests to use pass-if-fatal-exception.
2011-02-10 12:17:23 +01:00
Andy Wingo
13f607c175 getopt-long cleanups
* module/ice-9/getopt-long.scm (process-options): Use `match' in the
  loop.  Clean up `eat' to not take the option being processed.
2011-02-10 11:40:38 +01:00
Andy Wingo
cafb15e96e getopt-long cleanup
* module/ice-9/getopt-long.scm (process-options): Use more internal
  definitions instead of let-bound functions to decrease the nesting
  depth.
2011-02-10 11:31:30 +01:00
Andy Wingo
8b9b0af445 getopt-long cleanup
* module/ice-9/getopt-long.scm (looks-like-an-option): Remove obtuse use
  of "some".
2011-02-10 11:25:22 +01:00
Andy Wingo
88c9420c15 getopt-long uses match:substring from (ice-9 regex)
* module/ice-9/getopt-long.scm: Import (ice-9 regex), and use its
  match:substring instead of our own.
2011-02-10 11:22:17 +01:00
Andy Wingo
887fac4521 match-lambda in getopt-long
* module/ice-9/getopt-long.scm (parse-option-spec): Use match-lambda to
  parse the grammar.
2011-02-10 11:19:02 +01:00
Andy Wingo
23f11f1dfd getopt-long uses srfi-9 records internally
* module/ice-9/getopt-long.scm: #:keywords in the define-module block.
  (option-spec): Define as a srfi-9 record instead of playing macro
  games with boot-9 records.
2011-02-10 11:04:31 +01:00
Ralf Wildenhues
ecb8733562 docs: fix typos in manual, and a couple in code comments.
* doc/ref/api-binding.texi, doc/ref/api-compound.texi,
doc/ref/api-control.texi, doc/ref/api-debug.texi,
doc/ref/api-io.texi, doc/ref/api-macros.texi,
doc/ref/api-procedures.texi, doc/ref/api-scheduling.texi,
doc/ref/api-undocumented.texi, doc/ref/api-utility.texi,
doc/ref/compiler.texi, doc/ref/goops.texi,
doc/ref/libguile-concepts.texi, doc/ref/misc-modules.texi,
doc/ref/posix.texi, doc/ref/r6rs.texi, doc/ref/slib.texi,
doc/ref/srfi-modules.texi, doc/ref/sxml-match.texi,
doc/ref/tools.texi, doc/ref/vm.texi, doc/ref/web.texi,
doc/sources/env.texi, doc/sources/jimb-org.texi,
doc/sources/scheme-concepts.texi, doc/sources/unix.texi,
module/ice-9/optargs.scm: Fix typos.
* doc/r4rs/r5rs.texi: Likewise.  Do not capitalize code symbols
even at the start of a sentence.
* doc/ref/api-data.texi: Likewise.  Also, remove executable bit.
2011-02-09 22:28:49 +00:00
Andy Wingo
c5f30c4cba add define-once
* module/ice-9/boot-9.scm (define-once): New syntax.

* doc/ref/api-binding.texi (Top Level):
* NEWS: Add notes about define-once.
2011-02-09 20:56:04 +01:00
Andy Wingo
4181e9200b module-use-interfaces! handles duplicate interfaces
* module/ice-9/boot-9.scm (module-use-interfaces!): Fix to have the same
  interface de-duplication characteristics as module-use!.
2011-02-08 23:46:00 +01:00
Ludovic Courtès
1497e87a4f Make `(format #f ...)' always Unicode-capable.
* module/ice-9/format.scm (format): When DESTINATION is #f, use a
  Unicode-capable output string port.

* test-suite/tests/format.test ("format basic output")["default to
  Unicode-capable port"]: New test.
2011-02-08 23:14:00 +01:00
Andy Wingo
0f550375be unquote and unquote-splicing can split multiple expressions
* module/ice-9/psyntax.scm (quasiquote): Import new definition from
  upstream psyntax, to allow unquote and unquote-splicing to take
  multiple arguments.
  (unquote, unquote-splicing): Adapt to not require a particular syntax
  form.

* module/ice-9/psyntax-pp.scm: Regenerated.
2011-02-08 21:38:57 +01:00
Andy Wingo
c415fe081e hack around bug in port-filename
* module/ice-9/boot-9.scm (define-module): Until the port-filename bug
  is fixed, hack around it.
2011-02-07 21:43:11 +01:00
Andy Wingo
05a5e5d6d0 toplevel vars added by syntax expansion are unbound
* module/ice-9/psyntax.scm (chi-top): When adding to the toplevel
  environment at compile-time, default to undefined variables, not
  variables defined to #f.

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

* module/ice-9/boot-9.scm (module-add!): Add a new pre-modules version
  of this function, so we can add variables the environment, not just
  values.
  (module-define!): Use module-add!.
2011-01-31 21:09:20 +01:00
Mark H Weaver
6a07a06118 Do not apply inf?' or nan?' to strings
* module/ice-9/format.scm (format): Test to make sure an argument is a
  number before applying `inf?' and `nan?' to it.  Formerly, format
  would call `inf?' and `nan?' on arguments that might be either a
  number or a string, although those predicates should ideally throw an
  exception when applied to non-number objects.
2011-01-28 12:16:59 +01:00
Ludovic Courtès
667230810b Install the current locale when starting the REPL.
* module/ice-9/top-repl.scm (top-repl): Install the current locale.
2011-01-24 23:37:46 +01:00
Andy Wingo
2dd7d8ce7a fix tab completion in repl (doh)
* libguile/hashtab.c: Fix remaining vector hash table support.
* module/ice-9/session.scm (apropos-fold): Use a hash table instead of a
  vector for the completions.
2011-01-07 22:01:27 -08:00
Andy Wingo
b90b4b2bf2 format handles ~@c better
* module/ice-9/format.scm (format): Fix ascii-ism in ~@c. Pull
  flush-output? into the let*.
2010-12-18 13:13:16 +01:00
Andy Wingo
79f124ac87 more format tweaks
* module/ice-9/format.scm (format): Strip format: prefix from port and
  output-col.
2010-12-18 13:02:07 +01:00
Andy Wingo
8390dac023 more format tweaks
* module/ice-9/format.scm (format): Move the port and output-col to let*
  vars, again removing a set!. We will probably move more state vars to
  the let*, to let the procedures exist in a more fixed-point style.
2010-12-18 12:57:29 +01:00
Andy Wingo
0e9306801a take advantage of letrec* in format
* module/ice-9/format.scm (format): Take advantage of letrec* internal
  expansion, and so have fewer set! invocations.
2010-12-18 12:50:00 +01:00
Andy Wingo
d55066ddc3 inline format:out into format
* module/ice-9/format.scm (format): Inline format:out into the body.
2010-12-18 12:42:50 +01:00
Andy Wingo
098e6fc63f more format cleanups
* module/ice-9/format.scm (format): Remove the need to save a copy of
  the incoming arguments, because they are available as local
  variables.  Do the check early for the format-string actually being a
  string.
2010-12-18 12:32:14 +01:00
Andy Wingo
f02f8a6174 format's first arg is "destination"
* module/ice-9/format.scm: The argument to format is "destination", not
  "port". Fix this newly reintroduced buglet.
2010-12-18 12:20:26 +01:00
Andy Wingo
3d56118c50 inline format:format into format
* module/ice-9/format.scm (format): Inline format:format body.
2010-12-18 12:17:46 +01:00
Andy Wingo
2ce77e6cf6 deprecate omission of port to ice-9 format
* module/ice-9/format.scm (format): Add port and format-string as formal
  arguments. Seems also to have triggered a reindent.  Formally
  deprecate omitting the port, as it's usually an error.

* test-suite/tests/format.test ("format basic output")
  ("format basic output", "~{ iteration"): Fix up tests that omitted the
  destination port.
2010-12-18 12:06:53 +01:00
Andy Wingo
29d096c8e6 letrec -> internal definitions in format.scm
* module/ice-9/format.scm (format): Change from letrec to internal
  definitions, and use the define (foo ...) .. shorthand. No semantic
  change.
2010-12-18 11:44:57 +01:00
Andy Wingo
9ebf1af3c1 format.scm cleanups
* module/ice-9/format.scm (format:symbol-case-conv)
  (format:iobj-case-conv): Remove these exports, they were not used.
  (format:expch): Remove this one, though it was used.
  (format:floats, format:complex-numbers, format:radix-pref): Inline
  these "configuration variables" into the format body.
2010-12-18 11:27:19 +01:00
Andy Wingo
e3e3394374 ice-9 format license update
* module/ice-9/format.scm: A more standard copyright header, with
  LGPLv3+ instead of public domain. Update define-module block.
2010-12-18 11:21:29 +01:00
Ludovic Courtès
90b2c69c97 futures: Store pending futures in a queue.
* module/ice-9/futures.scm (%futures): Change from a list to a queue.
  (register-future!, process-futures, touch): Adjust accordingly.
  (unregister-future!): Remove.
2010-12-17 21:55:56 +01:00
Andy Wingo
7cf64a0af1 guile-user has no filename
* module/ice-9/boot-9.scm (guile-user): Set #:filename to #f for
  guile-user module, as guile-user isn't really associated with any
  file.
2010-12-17 13:30:07 +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
Ludovic Courtès
c21a5ddcaf Implement `(ice-9 threads)' high-level constructs in terms of futures.
* module/ice-9/threads.scm (parallel, par-mapper): Rewrite in terms of
  `future' and `touch'.

* test-suite/tests/threads.test ("par-map", "par-for-each"): New test
  prefixes.

* doc/ref/api-scheduling.texi (Parallel Forms): Add cross-ref to
  futures.  Recommend against the `n-' variants.
2010-12-16 23:45:24 +01:00
Ludovic Courtès
6c17f7bd71 futures: Support multiple-value returns.
* module/ice-9/futures.scm (process-future!): Use `call-with-values'
  when invoking `(future-thunk future)'.

* test-suite/tests/future.test ("futures")["multiple values"]: New test.
2010-12-16 23:45:24 +01:00
Ludovic Courtès
691a1c3c06 futures: Fix potential deadlock.
* module/ice-9/futures.scm (process-futures): Fix potential deadlock,
  whereby %FUTURES-MUTEX would be acquired *after* FUTURE's mutex.
2010-12-16 23:45:24 +01:00
Ludovic Courtès
18f06db925 Add compose', negate', and `const'.
* module/ice-9/boot-9.scm (compose, negate, const): New procedures.

* doc/ref/api-procedures.texi (Higher-Order Functions): New node.

* test-suite/Makefile.am (SCM_TESTS): Add `tests/procs.test'.

* test-suite/tests/procs.test: New file.
2010-12-16 23:45:23 +01:00
Ludovic Courtès
51fc066ae2 Use `current-processor-count' to determine the number of future-workers.
* module/ice-9/futures.scm (%worker-count): Use
  `current-processor-count'.

* doc/ref/api-scheduling.texi (Futures): Add note about side-effects and
  I/O.  Mention `current-processor-count'.
2010-12-07 23:13:20 +01:00
Ludovic Courtès
a94469c651 Add a record type printer for vlists/vhashes.
* module/ice-9/vlist.scm (<vlist>): Add a record type printer.
2010-12-07 23:13:19 +01:00
Brian Templeton
9c933e1d3f autoload compile-file in (guile-user)
* module/ice-9/boot-9.scm (guile-user): Autoload `compile-file'.
2010-12-07 13:21:01 +01:00
Andy Wingo
e9634465e3 ice-9 poll handles buffered io too
* libguile/poll.c (scm_primitive_poll): Account for buffered I/O.

* module/ice-9/poll.scm (poll): Adapt to call primitive-poll with the
  port vector too.
2010-12-06 19:27:22 +01:00
Andy Wingo
8556760c23 read-delimited is clearer and conses less
* module/ice-9/rdelim.scm (read-delimited): Clarify and somewhat
  optimize implementation.
2010-12-03 18:04:09 +01:00
Andy Wingo
6f81b18abe add (ice-9 poll), a poll wrapper
* libguile/poll.c:
* libguile/poll.h:
* module/ice-9/poll.scm: New module, (ice-9 poll).

* module/Makefile.am:
* libguile/init.c:
* libguile/Makefile.am: Adapt.

* configure.ac: Check for poll.h and poll.
2010-12-03 15:16:37 +01:00
Ludovic Courtès
0d4e6ca38f Add `(ice-9 futures)'.
* doc/ref/api-scheduling.texi (Threads): Add short introduction.
  Mention the `threads' feature.  Add cross-reference to futures.
  (Futures): New node.

* module/Makefile.am (ICE_9_SOURCES): Add `ice-9/futures.scm'.

* module/ice-9/futures.scm: New file.

* test-suite/Makefile.am (SCM_TESTS): Add `tests/future.test'.

* test-suite/tests/future.test: New file.
2010-12-03 00:38:29 +01:00
Ludovic Courtès
ec84b0a251 Use `define-module*' in (ice-9 history).
* module/ice-9/history.scm: Use `define-module*' instead of
  `process-define-module'.
2010-11-20 00:47:12 +01:00
Andy Wingo
402c35ac81 deprecate process-define-module
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm (process-define-module): Deprecate.
2010-11-19 15:22:44 +01:00
Andy Wingo
cd8c35193c define-module compiles to define-module*
* module/ice-9/boot-9.scm (define-module): Compile down to a call to
  define-module*, not process-define-module.
2010-11-19 15:22:44 +01:00