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

13562 commits

Author SHA1 Message Date
Brian Templeton
eda83f0ac9 use tree-il's support for optional arguments
* module/language/elisp/compile-tree-il.scm (compile-lambda): Use
  Tree-IL's support for optional arguments.
  (process-optionals, process-rest): Remove.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Brian Templeton
450cb50419 make pass-if-equal' literal in compile-test'
* test-suite/tests/elisp-compiler.test (compile-test): Add
  `pass-if-equal' to the list of literal identifiers

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Brian Templeton
f4e5e4114d reindent
* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm:
* module/language/elisp/spec.scm: Reindent.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Brian Templeton
c983a199d8 reformat comments
* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm:
* module/language/elisp/runtime/value-slot.scm: Reformat comments.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Brian Templeton
abcf4a9e1d whitespace changes
* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm: Ensure that all
  top-level forms and comments are separated by exactly one newline.
  Remove blank lines in most procedure bodies. Delete trailing
  whitespace.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +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
Brian Templeton
a8aa4c0b56 variable-unset!
* libguile/variable.c (scm_variable_unset_x): New function.
* libguile/variable.h (scm_variable_unset_x): New prototype.
2010-12-07 13:21:01 +01:00
Brian Templeton
ef94624eaf unbound fluids
* libguile/fluids.c (scm_make_undefined_fluid, scm_fluid_unset_x)
  (scm_fluid_bound_p): New functions.

  (fluid_ref): New function; like scm_fluid_ref, but will not throw an
  error for unbound fluids.
  (scm_fluid_ref, swap_fluid): Use `fluid_ref'.

* libguile/fluids.h (scm_make_undefined_fluid, scm_fluid_unset_x)
  (scm_fluid_bound_p): New prototypes.

* libguile/vm-i-system.c (fluid_ref): If fluid is unbound, jump to
  `vm_error_unbound_fluid'.
* libguile/vm-engine.c (VM_NAME)[vm_error_unbound_fluid]: New error
  message.

* test-suite/tests/fluids.test ("unbound fluids")["fluid-ref of unbound
  fluid", "fluid-bound? of bound fluid", "fluid-bound? of unbound
  fluid", "unbound fluids can be set", "bound fluids can be unset"]: New
  tests.
2010-12-07 13:21:01 +01:00
Andy Wingo
d107921794 better unbound variable errors in the vm
* libguile/vm-i-system.c (variable-ref, toplevel-ref)
  (long-toplevel-ref): Fixup callers.

* libguile/vm-engine.c (vm_error_unbound): Don't use vm-error for
  unbound vars, use misc-error. Don't include VM: in the string. Take
  the name directly in finish_args, not as a list.
2010-12-07 13:21:01 +01:00
Brian Templeton
1f845305c1 make guile-test work without configuration
* test-suite/guile-test: Use "../meta/guile" as the interpreter instead
  of "../libguile/guile".
  (default-test-suite): New function, replacing the variable of the same
  name. Look for tests in the same directory as the guile-test script.
  Throw an error if not invoked as `guile-test'.
  (test-suite): The old default value of `default-test-suite' could now
  throw an error, and this already gets initialized in `main', so don't
  provide an initial value.
2010-12-07 13:21:00 +01:00
Neil Jerram
4431a337f0 Put `figures' into standard texinfo form
* doc/ref/goops.texi (Example, Inheritance): Remove unnecessary figure
  references.  Use @float and @ref.
  (Class precedence list): Ditto.
2010-12-06 23:02:12 +00:00
Neil Jerram
f60a835300 Merge tutorial' and reference' treatments of the same basic GOOPS
material

* doc/ref/goops.texi (GOOPS): Move use of (oop goops) here.

  (Class Definition): Merged with `Defining New Classes'

  (Instance Creation): Insert before covering slot options.  Merge in
  material from `Creating Instances'.

  (Slot Options): Merged some better wording and index entries from
  the tutorial version.

  (Slot Description Example): New node, containing the <my-complex>
  material from the tutorial.

  (Methods and Generic Functions, Inheritance): Tutorial sections
  moved into main line of the manual.

* doc/ref/goops-tutorial.texi: Nothing left here now.
2010-12-06 22:28:39 +00:00
Neil Jerram
1dc43d57cc Minor textual markups
* doc/ref/goops-tutorial.texi (Class definition): No reason to assume
  particular familiarity with CLOS.
  (Instance creation and slot access): Remove a couple of words.
2010-12-06 20:26:48 +00:00
Andy Wingo
67a72dc13c scm_setvbuf doesn't throw away current buffers
* libguile/ports.c (scm_drain_input): Slight optimization.

* libguile/fports.c (scm_setvbuf): If there is buffered output, flush
  it.  If there is input, drain it, and then unread it after updating
  the buffers.  Much more sensible than dropping it silently...
2010-12-06 19:59:15 +01:00
Andy Wingo
4595600a08 http-read calls setvbuf only once
* module/web/server/http.scm (http-read): Don't play the setvbuf dance,
  it was throwing away buffered input. Instead just call setvbuf once
  before doing any reads or writes.
2010-12-06 19:52:51 +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
a9a2065540 fix name...
* module/web/request.scm (read-request-body/latin-1): Fix name...
2010-12-06 15:32:13 +01:00
Andy Wingo
e46f69e25c fix read-{request,response}-body/latin-1
* module/web/request.scm (read-response-body/latin-1):
* module/web/response.scm (read-response-body/latin-1): Avoid the
  craziness of the read-delimited! interface and hand-roll our
  own. Fixes errors if read-delimited returns #f or EOF.
2010-12-06 15:30:45 +01:00
Andy Wingo
e7fb779fb0 update read-delimited! docs
* doc/ref/api-io.texi (Line/Delimited): Update the read-delimited!
  docs.
2010-12-06 15:19:40 +01:00
Andy Wingo
9eed1010e7 leniency regarding quality values in http.scm
* module/web/http.scm: Add commentary.
  (parse-quality): Allow .NNN to be interpreted as 0.NNN.

* test-suite/tests/web-http.test ("request headers"): Add a test.
2010-12-06 13:52:56 +01:00
Andy Wingo
adcd58543c fix entity tag writing
* module/web/http.scm (write-entity-tag): Fix writing of entity tags
  (strong versus weak).
2010-12-06 12:58:16 +01:00
Andy Wingo
b500ced6b8 more robustness in http-read
* module/web/server/http.scm (http-read): If there was an error reading
  the request, be sure to close the request port.
2010-12-06 11:24:48 +01:00
Andy Wingo
4164be30d3 http doesn't keep-alive requests for which there was an error
* module/web/server/http.scm (keep-alive?): Don't keep the client around
  if there is an error.
2010-12-05 20:24:14 +01:00
Andy Wingo
e8c44a044f (web server http) comment
* module/web/server/http.scm: Add comment about charsets.
2010-12-04 19:45:51 +01:00
Andy Wingo
f3d390939b fix error handling in read-{request,response}-body/latin-1
* module/web/request.scm (read-request-body/latin-1):
* module/web/response.scm (read-response-body/latin-1): Detect short
  reads instead of returning a full buffer with the last bits zeroed
  out. (Before the make-string commit, they contained uninitialized
  memory, which was a fairly serious error.)
2010-12-04 19:45:09 +01:00
Andy Wingo
3ef6650def make-string et al nulls memory if not given an initializer
* libguile/gc-malloc.c: Add a note that the gc-malloc does not clear the
  memory block, so users need to make sure it is initialized.

* libguile/bitvectors.c (scm_c_make_bitvector):
* libguile/bytevectors.c (scm_make_bytevector):
* libguile/strings.c (scm_c_make_string): If no initializer is given,
  initialize the bytes to 0. Prevents information leakage if an app uses
  make-string et al without initializers.

* libguile/foreign.c (make_cif): Initialize this too, to prevent leakage
  in the struct holes. Paranoia...
2010-12-04 19:31:20 +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
80993fa438 http server impl reads body as a bytevector by default
* module/web/server/http.scm (http-read): Read body as a bytevector by
  default. That way we punt encoding issues to the app.
2010-12-03 17:37:22 +01:00
Andy Wingo
35b97af9d6 remove redundant error-handling block
* module/web/server/http.scm (http-read): No need for a
  call-with-error-handling block here, as the read impl is itself within
  an error-handling block.
2010-12-03 16:41:46 +01:00
Andy Wingo
e6ae317306 web server micro-tuning
* module/web/server/http.scm (http-open): Allow up to 128 pending
  connections -- the default value for somaxconn on a number of
  machines. This is from the HOP paper.
  (http-read): Set the send buffer to 12 KB, also from the HOP paper.
2010-12-03 16:30:52 +01:00
Andy Wingo
0baead3f6e reverse order of poll-set traversal in http-read
* module/web/server/http.scm (http-read): Rewrite to iterate down the
  pollset, so the vector shuffles touch less memory and the end
  condition of the loop is clearer.
2010-12-03 16:11:37 +01:00
Andy Wingo
462a1a04cf (web server) punts keep-alive to impls; http server uses (ice-9 poll)
* module/web/server.scm: Rewrite to remove the extra "keep-alive"
  parameter. Instead, since the server is an essentially stateful
  object, have clients that want to do keep-alive manage that set as
  part of the server state. Also avoids imposing a particular data
  structure on the server implementation.

* module/web/server/http.scm: Adapt to the new server interface. Also,
  use a poll set instead of select and lists. Makes handling 1000
  clients at a time much more possible.
2010-12-03 15:31:57 +01:00
Andy Wingo
51c1dba88a ASYNC_TICK after catching EINTR in SCM_SYSCALL
* libguile/_scm.h (SCM_SYSCALL): As in scm_syserror, do a SCM_ASYNC_TICK
  before resuming the syscall after an EINTR.
2010-12-03 15:17:35 +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
fe613fe25d Add bindings to GNU sched_setaffinity' and sched_getaffinity'.
* configure.ac: Add checks for `sched_setaffinity' and
  `sched_getaffinity'.

* doc/ref/posix.texi (Processes): Document `getaffinity' and
  `setaffinity'.

* libguile/posix.c (cpu_set_to_bitvector,
  scm_getaffinity)[HAVE_SCHED_GETAFFINITY]: New functions.
  (scm_setaffinity)[HAVE_SCHED_SETAFFINITY]: New function.

* libguile/posix.h (scm_getaffinity, scm_setaffinity): New declarations.

* test-suite/tests/posix.test ("affinity"): New test prefix.
2010-12-03 00:38:29 +01:00
Andy Wingo
50a4533f82 no need for fport_fill_input to select() before read()
* libguile/fports.c (fport_fill_input): Likewise to the previous commit,
  no need to select() before read().
2010-12-02 23:41:00 +01:00
Andy Wingo
e68e0369cc scm_accept no longer leaves guile mode
* libguile/socket.c (scm_accept): Revert
  7d1fc87217. Now that we don't need to
  leave guile mode in order for GC to happen, don't do so, as we assume
  that anyone who cares has already done a select() beforehand.
2010-12-02 23:24:39 +01:00
Andy Wingo
6901bad07d sxml->xml fix
* module/sxml/simple.scm (attribute-value->xml): Whoops, fix null case.
2010-12-02 22:24:26 +01:00
Andy Wingo
d9fff48e4c sxml->xml writes directly to a port
* module/sxml/simple.scm: Remove "universal-sxslt-rules" -- it was a bad
  interface, and I couldn't find any users of it.
  (sxml->xml): Rewrite so that instead of generating another tree of
  data, we write the data directly to a port.
2010-12-02 17:25:46 +01:00
Andy Wingo
8bf6cfea71 add some debugging to (web server)
* module/web/server.scm: Add some basic elapsed-time debugging, but only
  if you flip a switch to turn it on at expand-time.
2010-12-02 13:36:04 +01:00
Andy Wingo
bb90ce2cbc better socket buffering on http web server backend
* module/web/server/http.scm (http-read, http-write): Line-buffer the
  port while we're reading the request, and block-buffer it otherwise
  Use the default block size.
2010-12-02 13:33:49 +01:00
Andy Wingo
e1ee45e78b indentation fix in ports.c
* libguile/ports.c (scm_i_get_conversion_strategy): Indentation fix.
2010-12-02 12:46:15 +01:00
Andy Wingo
af0da6ebe7 (web server) supports non-utf-8 charsets
* module/web/server.scm (sanitize-response): Support charsets other than
  utf-8. Oddly collecting a string and converting it to utf-8 appears to
  be faster than collecting a utf-8 bytevector directly.
2010-12-02 12:28:35 +01:00
Andy Wingo
ee3a800f46 add simple web app examples
* examples/web/hello.scm:
* examples/web/debug-sxml.scm: New examples, for simple web
  applications.

* examples/README:
* examples/Makefile.am: Add new files.
2010-12-02 11:47:19 +01:00
Andy Wingo
a0ad8ad16c http web server impl ignores SIGPIPE
* module/web/server/http.scm (http-open): Ignore SIGPIPE. Keeps the
  server from dying in some circumstances.
2010-12-01 10:13:30 +01:00
Andy Wingo
c637190203 stub fixes to http 1.0 support in the web server
* module/web/server.scm (read-client): Fix number of returned values in
  the case in which there is an error reading the client.
  (sanitize-response): Add a case to adapt the reponse to the request
  version.
  (handle-request): Sanitize the response within an error-handling
  block.
  (serve-one-client): Move sanitation out of here.

* module/web/server/http.scm (keep-alive?): A more proper detection on
  whether we should support persistent connections.

* module/web/response.scm (adapt-response-version): New routine, to
  adapt a response to a given version. Currently a stub.
2010-12-01 10:13:30 +01:00
Andreas Rottmann
c0f6c1638b Some tweaks to the R6RS support
* module/rnrs/base.scm (error, assert): Define -- they were missing.
  (assertion-violation): Properly treat a #f `who' argument.

* module/rnrs/conditions.scm (condition): Use `assertion-violation'
  instead of the undefined `raise'.
  (define-condition-type): Fix for multiple fields.
* test-suite/tests/r6rs-conditions.test: Test accessors of a
  multiple-field condition.  Also import `(rnrs base)' to allow
  stand-alone running of the tests; apparently the `@' references
  scattered throughout the R6RS modules make the libraries sensitive to
  their load order -- for instance, trying to load `(rnrs conditions)'
  before `(rnrs base)' is loaded fails.

* module/rnrs/records/inspection.scm: Use `assertion-violation' instead
  of an explicit `raise'.
* module/rnrs/records/syntactic.scm (process-fields): Use
  `syntax-violation' instead of bogus invocations of `error'.
2010-11-25 23:04:12 +01:00
Ludovic Courtès
43ecaffc2f Fix `regexp.test' when the "en_US.utf8" locale isn't available.
* test-suite/tests/regexp.test ("nonascii locales"): Move `with-locale'
  within the body of `pass-if' so that `unresolved' is caught.
2010-11-24 23:38:01 +01:00
Ludovic Courtès
d4b8163784 Honor R6RS transcoder error handling modes, when possible.
* module/rnrs/io/ports.scm (transcoded-port): Change RESULT's conversion
  strategy based on TRANSCODER's error-handling mode.

* test-suite/tests/r6rs-ports.test ("8.2.6  Input and output
  ports")["transcoded-port [error handling mode = raise]",
  "transcoded-port [error handling mode = replace]"]: New tests.
2010-11-24 23:04:24 +01:00