1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 04:40:29 +02:00
Commit graph

1825 commits

Author SHA1 Message Date
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
Noah Lavine
84816b3aae Parse Decimal Numbers
* module/language/ecmascript/parse.scm: handle numbers with leading
    decimals correctly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2011-01-26 23:47:29 +01:00
Noah Lavine
326298206a Fix Hex Constants
* module/language/ecmascript/tokenize.scm: hexadecimal constants can
    now use 'X' in addition to 'x'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2011-01-26 23:45:33 +01:00
Noah Lavine
110f652127 Ecmascript Syntax
* module/language/ecmascript/tokenize.scm: an unbreakable space
      counts as whitespace.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2011-01-26 23:31:12 +01:00
Noah Lavine
eacbe34618 Ecmascript Syntax Fix
* module/language/ecmascript/parse.scm: allow empty function bodies.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2011-01-26 23:30:44 +01:00
Andy Wingo
2183d66e13 more sensible error if compiled-file-name returns false in compile-file
* module/system/base/compile.scm (compile-file): Error if no output-file
  is given and compiled-file-name returns false.
2011-01-26 22:09:06 +01:00
Andy Wingo
c32f0d6b87 stexi->shtml supports itemx
* module/texinfo/html.scm (entry, rules): Allow @itemx,
2011-01-25 17:59:45 +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
Ludovic Courtès
eda0622095 Choose the input source file encoding in a locale-independent way.
This is so that compiling the same code on environments with different
locale settings yields the same result.

* module/system/base/compile.scm (compile-file): When ENC if #f, default
  to "UTF-8" instead of `(fluid-ref %default-port-encoding)'.

* doc/ref/api-evaluation.texi (Compilation): Document the default output
  file name and default source file encoding for `compile-file' and
  `guile-tools compile'.
2011-01-24 21:44:44 +01:00
Ludovic Courtès
bc03d89fa2 Remove unexpected non-ASCII character.
* module/language/tree-il/fix-letrec.scm: Replace U+2019 with an ASCII
  quote.  The iconv implementation on FreeBSD would immediately notice
  and bail out when reading it under a US-ASCII locale.
2011-01-23 23:43:50 +01:00
Andy Wingo
b04f841d5f implement port-eof?
* module/rnrs/io/ports.scm (port-eof?): Implement.
* module/rnrs.scm: Re-export port-eof?.

* test-suite/tests/r6rs-ports.test ("7.2.5 End-of-File Object"): Add
  test.

Thanks to Göran Weinholt for the report.
2011-01-21 08:27:08 +01:00
Noah Lavine
b1846b7fb3 Add ECMAScript Unicode literal support
* module/language/ecmascript/tokenize.scm: add unicode literals

* test-suite/tests/ecmascript.test ("parser"): Add new tests for Latin-1
  and Unicode escapes in string literals.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2011-01-17 23:03:32 +01:00
Andy Wingo
f944ee8f23 request and response cleanups
* module/web/request.scm (build-request): Make URI a positional
  argument.

* module/web/response.scm: Remove extend-response.
  (read-response): Fix a docstring.
* module/web/server.scm (extend-response): Include extend-response here,
  but not exported.
2011-01-10 22:44:41 -08:00
Andy Wingo
3475fbb572 (web response) and (web request): bodies are bytevectors
* module/web/request.scm (read-request-body, write-request-body): Rename
  from read-request-body/bytevector and
  write-request-body/bytevector.  Remove the /latin-1 variants, as they
  were unused and a bad idea.
* module/web/response.scm (read-response-body, write-response-body):
  Likewise.

* module/web/server/http.scm (http-read, http-write): Adapt to
  request/response change.

* test-suite/tests/web-request.test:
* test-suite/tests/web-response.test: Update tests.
2011-01-10 22:44:36 -08:00
Andy Wingo
ecfb7167cb parse credentials and challenges
* module/web/http.scm (parse-credentials, validate-credentials)
  (write-credentials, parse-challenge, parse-challenges)
  (validate-challenges, write-challenge, write-challenges)
  (declare-credentials-header!, declare-challenge-list-header!): New
  helpers.
  ("Authorization", "Proxy-Authorization"): Parse out credentials.
  ("Proxy-Authenticate", "WWW-Authenticate"): Parse out challenges.
2011-01-10 09:31:29 -08:00
Andy Wingo
94f16a5b8f more symbols in (web http)
* module/web/http.scm (declare-symbol-list-header!): New helper.
  ("Connection"): Redefine as a header list.
  ("Allow", "Content-Encoding", "Accept-Ranges"): Redefine as symbol
  lists.

* test-suite/tests/web-http.test:
* test-suite/tests/web-response.test: Adapt tests.
2011-01-08 21:32:14 -08:00
Andy Wingo
0acc595b94 (web http): keys are always symbols
* module/web/http.scm (parse-media-type): Parse media types as symbols.
  (parse-key-value-list, parse-param-component, parse-param-list):
  Change kons to val-parser. Always parse keys as symbols, and always
  either cons, if there is a val, or just have the key, if there is no
  val.  Easier to explain and just as correct.
  (declare-param-list-header!, declare-key-value-list-header!): Adapt to
  key-list and param-list kons change.
  ("Cache-Control", "Pragma", "Transfer-Encoding", "Accept", "Expect")
  ("TE"): Likewise, adapt.
  ("Content-Type"): Param keys are symbols.
2011-01-08 20:50:46 -08:00
Andy Wingo
7118eccd72 (web http): don't expose header-decl objects
* module/web/http.scm: Change to not expose the header-decl objects,
  instead exposing header-parse, header-validator, header-writer et al.
  Explaining header decls in the manual was too complicated.
  (string->header, header->string): New helpers.
  (<header-decl>): Remove the `sym' field.
  (declare-header!): Adapt to header-decl change, and use
  string->header.
  (known-header?, header-parser, header-validator, header-writer): New
  procedures.

  Adapt to use the new procedures internally.
2011-01-08 11:40:20 -08:00
Andy Wingo
be1be3e597 (web http): header names always represented as symbols
* module/web/http.scm (declare-header!): No need to specify `sym', as it
  can be derived from `name'. Change to take parser, validator, and
  writer as positional arguments, and multiple? as a keyword.
  (parse-header): Change to take the header as a symbol already, and
  just return the parsed value.  All headers are symbols now, including
  unknown headers.  I feel OK doing this given that the symbol GC works
  now.
  (lookup-header-decl): Only look up headers by symbol.
  (read-header): Adapt to parse-header change.

  (valid-header?, write-header): Adapt to all headers being symbols.
  (split-header-names, list-of-header-names?, write-header-list):
  Represent all header names as symbols.

  (declare-opaque-header!, declare-date-header!)
  (declare-string-list-header!, declare-header-list-header!)
  (declare-integer-header!, declare-uri-header!)
  (declare-quality-list-header!, declare-param-list-header!)
  (declare-key-value-list-header!, declare-entity-tag-list-header!):
  Change to be functions instead of syntax, and no need to specify the
  symbolic name. Update all header declarations accordingly.

* module/web/request.scm (validate-headers):
* module/web/response.scm (validate-headers): Adapt to all headers being
  symbols.

* test-suite/tests/web-http.test (pass-if-parse, pass-if-any-error)
  (pass-if-parse-error): Update for parse-header change.
  ("general headers"): Update header list examples to be all symbols.
2011-01-08 10:54:07 -08: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
929ccf48fc read-header returns EOF at end, update (web http) docs
* doc/ref/web.texi (HTTP): Add an example for declaring a header, and
  adapt to read-header change.

* module/web/http.scm (read-header): Return EOF for both values if there
  are no more headers, instead of #f.
  (read-headers): Adapt.
2011-01-07 09:18:36 -08:00
Andy Wingo
91b320fe16 uri-encode fast path
* module/web/uri.scm (uri-encode): Add a fast-path for the common case
  in which the string does not contain any reserved characters.
2011-01-07 09:18:36 -08:00
Andy Wingo
7d6b8b75fc uri-decode #:encoding, not #:charset
* module/web/uri.scm (call-with-encoded-output-string, encode-string)
  (decode-string, uri-decode, uri-encode): Change all instances of
  "charset" to "encoding", as variables and arguments.
2011-01-07 09:18:36 -08:00
Andy Wingo
8745c33afb rename string->uri and uri->string.
* module/web/uri.scm (string->uri, uri->string): Rename from parse-uri
  and unparse-uri.

* test-suite/tests/web-uri.test:
* module/web/http.scm: All callers changed.
2011-01-07 09:18:36 -08:00
Ludovic Courtès
8a41c56af1 Tiny style improvement in the ECMAScript compiler.
Followup to 8891bd1b16 ("Fix ECMAScript
object creation.").

* module/language/ecmascript/compile-tree-il.scm (comp): Use `@implv'
  for `new-object'.  Suggested by Kan-Ru Chen <kanru@kanru.info>.
2011-01-05 22:22:15 +01:00
Noah Lavine
8891bd1b16 Fix ECMAScript object creation.
* module/language/ecmascript/compile-tree-il.scm (compile-tree-il):
  generate correct tree-il for construction of new objects.
* test-suite/tests/ecmascript.test (ecompile): Add pattern with EXPECTED
  omitted.
  ("compiler"): test whether we generate new objects correctly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2011-01-04 18:36:58 +01: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
Andy Wingo
e01163b5f1 rename make-undefined-fluid to make-unbound-fluid
* libguile/fluids.c (scm_make_unbound_fluid): Rename from
  scm_make_undefined_fluid.

* libguile/fluids.h:
* module/language/elisp/runtime.scm: Update referrers.
2010-12-17 13:10:03 +01:00
Andy Wingo
e2d4bfea00 build-response validates headers
* module/web/response.scm (build-response): Add some validation, like
  for build-request.
2010-12-17 12:01:34 +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
Andy Wingo
adc91e41bf http: lists of header names parse better
* module/web/http.scm (list-of-strings?, write-list-of-strings): Move
  definitions up.
  (split-header-names, list-of-header-names?, write-header-list): New
  helpers.
  (declare-header-list-header): New helper.
  (cache-control): Use split-header-names for private and no-cache.
  (trailer): Use declare-header-list-header to parse known headers to
  symbols.
  (vary): Likewise, use split-header-names et al.

* test-suite/tests/web-http.test ("general headers"): Add a test.
2010-12-16 18:12:14 +01:00
Andy Wingo
25731543d4 better cache-control: private, no-cache parsing
* module/web/http.scm (cache-control): Parse private and no-cache
  better.
* test-suite/tests/web-http.test ("general headers"): Update.
2010-12-16 17:56:03 +01:00
Andy Wingo
43d6659ae2 (web server) docstrings
* module/web/server.scm: Docstrings in the house.
2010-12-16 14:48:35 +01:00