* module/web/server/http.scm (<http-server>, http-open)
(read-request!, write-request!, enqueue-write!, http-write): As in the
previous commit, add support for concurrent writes.
(http-read): Pop off keepalive ports in this, the main loop.
(http-close): Shut down writers appropriately.
* module/web/server/http.scm (<http-server>): Add fields for a reader
thread-pool, and some async queues that it operates on. Also, a flag,
http-threaded?.
(http-open): Add #:threaded? and #:read-workers kwargs. Create a
thread pool for reading if threads are available.
(read-request!): New function, factored out of http-read.
(enqueue-read!, http-read): Instead of reading the client directly,
enqueue a read. In the case where threads are not available, this
will call read-request! directly. read-request! takes care of adding
to the handle-queue. The read polling loop will pop items off the
handle-queue.
(seconds-from-now, async-queue-for-each): New helpers.
(http-write): Shut down the queues and threads, hopefully in a
nonblocking fashion.
* module/web/server/http.scm (make-waker, flush-wake-port): New
functions, to wake up a poll().
(http-open): Add a wakeup port to the poll set.
(http-read): Handle the wakeup port specially.
* module/web/server/http.scm (bad-request, http-read): If an exception
is raised while reading a response, write out a 400 Bad Request
response before closing the port.
* module/language/elisp/boot.el (integerp, wholenump): Call `integer?'
before `exact?' so that these predicates return nil for non-numbers
instead of signalling an error.
* module/ice-9/boot-9.scm (default-prompt-tag): Once parameters have
booted, redefine as a parameter.
(make-prompt-tag): Change from a gensym to a list. Thanks to Mark
Weaver for the suggestion.
* doc/ref/api-control.texi (Prompt Primitives): Update docs.
* libguile/srfi-13.c (scm_string_trim, scm_string_trim_right)
(scm_string_trim_both): Take the whitespace fast-path if the char_pred
is scm_char_set_whitespace.
* module/web/http.scm (read-header, split-and-trim, parse-quality-list):
(parse-param-component, parse-credentials, "Content-Type"):
(read-request-line, read-response-line): Use char-set:whitespace
instead of char-whitespace?. It avoids recursing into the VM.
* module/ice-9/boot-9.scm: Refine a comment about low-level port
functions. Move call-with-foo-port, with-input-from-foo, etc later in
the file, and define using `parameterize' instead of `dynamic-wind'.
Somewhat cleaner, and avoids thunk? checks for "swaports" in the old
implementation.
* module/ice-9/psyntax.scm (do, case): Comment out these definitions,
which are never used and immediately replaced by definitions in
boot-9.scm.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (subst-rename?, rename-old, rename-new,
rename-marks, make-rename): Remove these unused syntax rules.
Fix description of syntax wraps to match current reality.
* module/ice-9/compile-psyntax.scm: Minimize syntax object literals
embedded in psyntax-pp.scm.
* module/ice-9/psyntax.scm: Rename a few variables so that syntax
objects embedded in macros have no lexical bindings, so that their
minimized syntax objects will have no embedded labels. These labels
were the last remaining gensym counters in psyntax-pp.scm.
* module/ice-9/psyntax-pp.scm: Regenerate. It is now less than one
quarter of its previous size! More importantly, this file no longer
contains any gensym counters, which means that in the future, local
changes to psyntax.scm will usually result in only local changes to
psyntax-pp.scm.
* module/language/tree-il.scm (tree-il->scheme): New implementation that
simply calls 'decompile-tree-il'.
* module/language/scheme/decompile-tree-il.scm (choose-output-names,
do-decompile): New internal procedures.
(decompile-tree-il): New and improved implementation. Print source
identifiers where possible, otherwise add minimal numeric suffixes.
Previously we printed the gensyms. Avoid 'begin' in contexts that
provide an implicit 'begin'. Produce 'cond', 'case', 'and', 'or',
'let*', named let, and internal defines where appropriate. Recognize
keyword arguments in 'opts' to disable the production of these derived
syntactic forms, and to optionally strip numeric suffixes from
variable names.
* module/ice-9/compile-psyntax.scm: Disable partial evaluation, letrec
fixing, and primitive expansion when producing psyntax-pp.scm, in
order to produce output as close to the original source as practical.
Disable production of derived syntactic forms as needed during
bootstrap. Strip numeric suffixes from variable names. Adjust
pretty-printing parameters.
* module/ice-9/psyntax-pp.scm: Regenerate. It is now less than half
of the original size.
* libguile/vm-i-system.c (wind):
* module/language/tree-il/compile-glil.scm (flatten-lambda-case):
Instead of making `wind' call `scm_thunk_p' on the winder and unwinder
at runtime, make it the responsibility of the compiler to emit code to
call thunk? and error, but only if the compiler cannot prove them to
be thunks.
* libguile/vm-engine.c (vm_engine): Remove a now-unused error block.
* module/ice-9/pretty-print.scm (pretty-print): Add new keyword argument
'#:max-expr-width'.
(generic-write): Add new argument 'max-expr-width'. Previously this
was internally defined to the constant value 50.
* module/language/tree-il/analyze.scm (proc-ref?): Change to use less
false-if-exception and more variable-bound?. If a variable is present
in the local module but not bound, assume that it is gettext if it has
the right name. This is to allow for (define _ gettext).
* test-suite/tests/tree-il.test ("warnings"): Update (_ "foo") example.
There are a some failures currently:
FAIL: tree-il.test: warnings: format: non-literal format string with forward declaration
ERROR: srfi-18.test: current-exception-handler: current handler returned at top level - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>)))
ERROR: srfi-18.test: current-exception-handler: multiple levels of handler nesting - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>)))
ERROR: srfi-18.test: current-exception-handler: exception handler installation is thread-safe - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>)))
Conflicts:
module/language/tree-il/peval.scm
module/language/tree-il/primitives.scm
test-suite/tests/tree-il.test
* module/language/tree-il/peval.scm (peval): Add optimization to
hoist the inner procedure out of e.g.
(lambda args (apply (lambda ...) args))
This commit restores the ability to detect escape-only prompts at
compile-time.
* test-suite/tests/tree-il.test: Update test for prompt with a lambda,
and add a specific test for lambda application.
* module/language/tree-il/canonicalize.scm (canonicalize!): Fix a bug in
which the sense of `escape-only?' was reversed. We never saw this
though, because for other reasons, no prompts were being identified as
escape-only.
* module/language/tree-il/primitives.scm (*primitive-expand-table*):
Don't limit the call-with-prompt to <prompt> transition to lambda
expressions. Instead we can lexically bind the handler, and rely on
peval to propagate a lambda expression.
* module/system/base/pmatch.scm (pmatch): Always wrap with 'let', even
if the expression appears atomic, because in the presence of
'identifier-syntax', we cannot know what an atomic expression will
later expand to. Also use '#:export-syntax' instead of '#:export'
to export 'pmatch'.
* module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm
(define-bytevector-type): Fix definition of <TAG>vector-length when
applied to uniform vectors of different element sizes. Thanks to
Tobias Brandt <tob.brandt@googlemail.com> for reporting this bug.
* test-suite/tests/srfi-4.test: Add tests.