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

17 commits

Author SHA1 Message Date
Andy Wingo
9447207f0c Use default value for make-fluid in Scheme files
* module/ice-9/boot-9.scm (%exception-handler)
  (%running-exception-handlers, read-eval?, *repl-stack*)
  (make-mutable-parameter):
* module/ice-9/getopt-long.scm (%program-name):
* module/language/elisp/runtime.scm (built-in-macro, defspecial):
* module/srfi/srfi-39.scm (make-parameter/helper):
* module/system/base/language.scm (*current-language*):
* module/system/base/message.scm (*current-warning-port*):
  (*current-warning-prefix*):
* module/system/base/target.scm (%target-type, %target-endianness)
  (%target-word-size):
* module/texinfo/plain-text.scm (*indent*, *itemizer*):
* benchmark-suite/lib.scm (prefix-fluid):
* test-suite/lib.scm (prefix-fluid): Give fluids a useful default
  value.
2011-11-23 12:54:09 +01:00
Neil Jerram
6b4b4bfb09 Implement #:stop-at-first-non-option option for getopt-long
(For use by guile-tools)

* module/ice-9/getopt-long.scm: Use (ice-9 optargs) so we can use
  define*.

  (process-options): Add stop-at-first-non-option parameter.  When
  this is true, stop processing when we hit a non-option (so long as
  that non-option isn't something that resulted from the unclumping of
  a short option group).

  (getopt-long): Add #:stop-at-first-non-option keyword; pass it on to
  process-options.

* test-suite/tests/getopt-long.test ("stop-at-first-non-option"): New
  test (for the above).
2011-05-26 17:58:18 +01:00
Neil Jerram
0faf4b2a74 Handle short option unclumping progressively, instead of all upfront
This is needed as a prerequisite for the following change that
introduces the stop-at-first-non-option option, because when that
option is used we don't know upfront how far through the command
line we should proceed with unclumping.

* module/ice-9/getopt-long.scm (expand-clumped-singles): Delete.

  (process-options): Add a loop variable to indicate how many elements
  at the start of `argument-ls' are known not to be clumped.  When we
  see a short option and this variable is <= 0, perform unclumping
  (using code that used to be in expand-clumped-singles) and loop with
  the variable > 0.

  (getopt-long): Don't call expand-clumped-singles upfront here.
2011-05-26 17:58:18 +01:00
Neil Jerram
1e2cc0b630 Simplify getopt-long handling of option values, esp with multiple occurrences
Basically, accumulate values in the `process-options' loop variables,
instead of using set-option-spec-value!

* module/ice-9/getopt-long.scm (option-spec): Delete the `value' slot.

  (process-options): Delete `val!loop' and just use `loop' everywhere
  instead.  When adding an option spec to `found', add the
  corresponding value too; hence `found' becomes an alist, where it
  was previously a list of specs.

  (getopt-long): Use assq-ref to get values out of `found'.  Remove
  unhittable error condition for detecting an option that requires an
  explicit value, where a value wasn't supplied.  This condition is
  actually caught and handled in `process-options'.  Rewrite the end
  of the procedure much more simply.
2011-05-26 17:58:18 +01:00
Neil Jerram
ec7ea550f2 Fix "occurrances" typos in getopt-long code and test
* module/ice-9/getopt-long.scm (process-options, getopt-long): Change
  to "occurrences".

* test-suite/tests/getopt-long.test ("multiple occurrences"): Same
  again.
2011-05-26 17:58:18 +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
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Andy Wingo
b15dea6857 Replace eval-case with eval-when
* module/ice-9/boot-9.scm (eval-when): Replace eval-case with eval-when.
  Eval-when is *much* simpler, and more expressive to boot. Perhaps in
  the future we'll get 'visit and 'revisit too.

* module/ice-9/deprecated.scm (eval-case): Provide mostly-working
  deprecated version of eval-case.

* module/ice-9/boot-9.scm (defmacro, define-macro): Relax condition: we
  can make defmacros that are not at the toplevel now. But in the future
  we should replace this implementation of defmacros with one written in
  syntax-case.
  (define-module, use-modules, use-syntax): Allow at non-toplevel.
  (define-public, defmacro-public, export, re-export): Don't evaluate at
  compile-time, I can't see how that helps things. Allow `export' and
  `re-export' at non-toplevel.

* module/ice-9/getopt-long.scm:
* module/ice-9/i18n.scm:
* module/oop/goops.scm:
* module/oop/goops/compile.scm:
* module/oop/goops/dispatch.scm: Switch to use eval-when, not
  eval-case.

* module/language/scheme/compile-ghil.scm (eval-when): Replace eval-case
  transformer with eval-when transformer. Sooooo much simpler, and it
  will get better once we separate expansion from compilation.

* module/language/scheme/expand.scm (quasiquote): Hm, expand quasiquote
  properly. Not hygienic. Syncase needed.
  (lambda): Handle internal defines with docstrings propertly.
2009-03-06 13:29:13 +01:00
Ludovic Courtès
8f4e84855e Fix interpretation of `(ice-9 getopt-long)'.
* module/ice-9/getopt-long.scm (define-one-option-spec-field-accessor,
  define-one-option-spec-field-modifier): Eval-case for `load-toplevel'
  as well so that the interpreter can load this module.
2009-02-20 17:38:32 +01:00
Ludovic Courtès
d39b967642 Fix compilation of `(ice-9 getopt-long)'.
* module/ice-9/getopt-long.scm (option-spec-fields): Enclose in a
  `(load-toplevel compile-toplevel)' `eval-case'.
  (define-one-option-spec-field-accessor,
  define-one-option-spec-field-modifier): Enclose in a
  `compile-toplevel'-only `eval-case'.
2009-02-20 17:12:47 +01:00
Andy Wingo
00d0489205 move ice-9/ and oop/ under module/
Moved ice-9/ and oop/ under module/, with the idea being that we have
only scheme under module/. Adjusted configure.in and Makefile.am
appropriately. Put oop/ at the end of the compilation order.
2008-11-01 12:44:21 +01:00
Renamed from ice-9/getopt-long.scm (Browse further)