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

2036 commits

Author SHA1 Message Date
Andy Wingo
58942f30d6 http web server: allow concurrent write operations
* 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.
2012-03-12 17:12:37 +01:00
Andy Wingo
f20ae551a1 http web server: allow concurrent read operations
* 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.
2012-03-12 17:12:37 +01:00
Andy Wingo
31a04ee239 add ability to wake up the poll() in http.scm
* 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.
2012-03-12 17:12:37 +01:00
Andy Wingo
5f54be9b3d add ice-9 thread-pool
* module/ice-9/thread-pool.scm: New file.

* module/Makefile.am: Add to build.
2012-03-12 17:12:37 +01:00
Andy Wingo
c62bbee320 add (ice-9 async-queue)
* module/ice-9/async-queue.scm: New file.
* module/Makefile.am: Add it to the make file.
2012-03-12 17:12:37 +01:00
Andy Wingo
d5e1f82240 Merge remote-tracking branch 'origin/stable-2.0' 2012-03-12 17:00:09 +01:00
Andy Wingo
da23abd970 Merge branch 'master' of git.sv.gnu.org:/srv/git/guile 2012-03-12 17:00:02 +01:00
Andy Wingo
89d45e8507 web http: fix Ma -> Mar
* module/web/http.scm (write-date): Fix serialization of Mar.  Oops.
2012-03-12 16:58:15 +01:00
Andy Wingo
9effafa444 fix bad-request-printer
* module/web/request.scm (bad-request-printer): Fix printer to expect
  args as a list.
2012-03-11 11:06:39 +01:00
Andy Wingo
8b49b6b1f5 Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
	configure.ac
2012-03-11 11:06:14 +01:00
Andy Wingo
e0dc497832 add bad-request printer
* module/web/request.scm (bad-request-printer): Add printer for these
  exceptions.
2012-03-11 10:57:05 +01:00
Andy Wingo
02360ed605 web server http: 400 Bad Request on bad requests
* 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.
2012-03-11 10:29:06 +01:00
Andy Wingo
aaaa0eef9c add exception printers for bad-header, bad-header-component
* module/web/http.scm (bad-header-component): Throw
  'bad-header-component instead of 'bad-header.
  (bad-header-printer, bad-header-component-printer): Add exception
  printers.
2012-03-11 10:24:08 +01:00
BT Templeton
52d2472441 elisp rng
* module/language/elisp/boot.el (random): New function.
2012-03-08 17:08:30 -05:00
BT Templeton
43ff6804d6 elisp i/o
* module/language/elisp/boot.el (send-string-to-terminal)
  (read-from-minibuffer, prin1-to-string): New functions.
2012-03-08 17:08:30 -05:00
BT Templeton
5c65ee510f elisp: symbol-name, intern
* module/language/elisp/boot.el (symbol-name, intern): New functions.
2012-03-08 17:08:30 -05:00
BT Templeton
c0652730bc elisp: when, unless
* module/language/elisp/boot.el (when, unless): New macros.
2012-03-08 17:08:30 -05:00
BT Templeton
12c00a0453 elisp sequence functions
* module/language/elisp/boot.el (nreverse, assoc, assq, rplaca, rplacd)
  (caar, cadr, cdar, cddr, dolist, stringp, string-equal, string=)
  (substring, upcase, downcase, string-match, make-vector, mapc, aref)
  (aset, concat): New functions.
2012-03-08 17:08:30 -05:00
BT Templeton
fc45b7e8e8 integerp, wholenump return nil for non-numbers
* 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.
2012-03-08 17:08:30 -05:00
Andy Wingo
bc61280992 Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
	configure.ac
	libguile/finalizers.c
	libguile/finalizers.h
	libguile/gc.c
	libguile/gc.h
	libguile/inline.c
	libguile/inline.h
	libguile/ports.c
	libguile/smob.c
	libguile/smob.h
	module/ice-9/deprecated.scm
	module/ice-9/r4rs.scm
2012-03-08 13:22:09 +01:00
Andy Wingo
283ab48d3f faster (make-prompt-tag); default-prompt-tag is a parameter
* 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.
2012-03-07 19:02:00 +01:00
Andy Wingo
a62b5c3d54 call-with-{input,output}-string implemented in scheme
* module/ice-9/boot-9.scm (call-with-input-string)
  (call-with-output-string): Implement in Scheme.

* libguile/strports.c (scm_call_with_output_string):
  (scm_call_with_input_string): Dispatch to Scheme.
2012-03-07 13:34:06 +01:00
Andy Wingo
4df9e5eb0f micro-optimizations to string-trim-both, and to (web http)
* 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.
2012-03-07 13:04:53 +01:00
Andy Wingo
3c12fc3595 micro-optimization in (web server)
* module/web/server.scm (extend-response): Micro-optimize to not mutate
  data, and to copy as little as possible.
2012-03-06 22:22:31 +01:00
Andy Wingo
f6e6b5181a shuffle r4rs procedures into boot-9
* 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.
2012-03-06 00:51:50 +01:00
Andy Wingo
124bc316a6 load parameters earlier in boot-9
* module/ice-9/boot-9.scm: Move parameters earlier in the boot process.
  The new with-output-to-port code will use it.
2012-03-06 00:51:49 +01:00
Andy Wingo
d867c7496c slight tweak to file-exists?, file-is-directory?
* module/ice-9/boot-9.scm (file-exists?, file-is-directory?): For the
  fallback cases, use open-input-file instead of open-file with
  OPEN_READ.
2012-03-06 00:51:49 +01:00
Andy Wingo
f7955da966 bootstrapping shenanigans in `warn'
* module/ice-9/boot-9.scm (warn): Don't use with-output-to-port, as
  we'll move that definition after the psyntax boot.
2012-03-06 00:51:49 +01:00
Andy Wingo
f28dc43c95 more clear comments in boot-9.scm
* module/ice-9/boot-9.scm: Update comment header for language
  primitives.
2012-03-06 00:51:49 +01:00
Andy Wingo
0f6f5fb7f8 remove deprecated close-io-port
* module/ice-9/boot-9.scm (close-io-port): Remove proc that was
  deprecated in 2.0.
2012-03-06 00:51:49 +01:00
Andy Wingo
418321524a inline ice-9/r4rs.scm into ice-9/boot-9.scm
* module/ice-9/boot-9.scm: Inline r4rs.scm, in anticipation of more
  refactorings.

* module/ice-9/r4rs.scm: Remove.
* module/Makefile.am: Update.
2012-03-06 00:51:49 +01:00
BT Templeton
663c5875f5 use #nil as default for elisp rest parameters
* module/langauge/elisp/compile-tree-il.scm (compile-lambda): Bind the
  rest parameter to `#nil' instead of `()' by default.
2012-03-05 18:10:29 -05:00
Andy Wingo
1fa0fde495 deprecate close-io-port
* module/ice-9/r4rs.scm:
* module/ice-9/deprecated.scm (close-io-port): Deprecate.
2012-03-05 23:52:28 +01:00
BT Templeton
5ddd9645c9 Merge branch 'bt/elisp'
Conflicts:
	am/guilec
	libguile/_scm.h
	libguile/vm-i-scheme.c
	module/language/elisp/compile-tree-il.scm
	module/language/elisp/runtime.scm
	module/language/elisp/runtime/macros.scm
	module/language/tree-il/compile-glil.scm
	module/language/tree-il/primitives.scm
2012-03-05 16:52:05 -05:00
Mark H Weaver
3fafc52afb Comment out unused definitions of 'do' and 'case' in psyntax.scm
* 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.
2012-03-04 12:01:10 -05:00
Mark H Weaver
1948b38d88 Fix syntax wrap comments; remove old unused cruft
* 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.
2012-03-04 12:00:57 -05:00
Mark H Weaver
d019ef9288 Merge branch 'stable-2.0'
Conflicts:
	module/ice-9/psyntax-pp.scm
	module/language/tree-il.scm
2012-03-03 20:20:16 -05:00
Mark H Weaver
1af6d2a717 Minimize size of embedded syntax objects in psyntax-pp.scm
* 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.
2012-03-03 18:06:59 -05:00
Mark H Weaver
72ee0ef71b tree-il->scheme improvements
* 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.
2012-03-03 18:05:21 -05:00
Andy Wingo
d5dbe0c1d5 optimize dynamic-wind when we know winders are thunks
* 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.
2012-03-03 21:46:38 +01:00
Mark H Weaver
8c43b28a11 pretty-print: allow max-expr-width to be set; recognize more keywords
* 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.
2012-03-02 18:29:29 -05:00
Mark H Weaver
9120f130a8 Fix typos in psyntax.scm
* module/ice-9/psyntax.scm (gen-syntax-case): #'pad --> #'pat
  (define*): #'x --> #'id

* module/ice-9/psyntax-pp.scm: Regenerate
2012-03-02 18:28:06 -05:00
Andy Wingo
dee4e3ee3c Merge remote-tracking branch 'origin/stable-2.0' 2012-03-02 17:46:52 +01:00
Andy Wingo
dab48cc567 tweaks to -Wformat's gettext detection
* 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.
2012-03-02 17:46:28 +01:00
Andy Wingo
d489998364 Merge remote-tracking branch 'origin/stable-2.0'
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
2012-03-02 17:20:47 +01:00
Andy Wingo
eebcacf41c peval: inline applications of lambda to rest args
* 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.
2012-03-02 16:47:39 +01:00
Andy Wingo
542aa859de tree-il: fix `canonicalize!' for prompts
* 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.
2012-03-02 16:47:39 +01:00
Andy Wingo
20337139d2 more general treatment of call-with-prompt
* 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.
2012-03-02 16:47:39 +01:00
Mark H Weaver
e082b13b66 pmatch: always wrap with let, even if the expression appears atomic
* 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'.
2012-03-01 16:16:27 -05:00
Mark H Weaver
ef405f8ba7 Fix <TAG>vector-length when applied to other uniform vector types
* 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.
2012-03-01 16:16:18 -05:00