Brian Templeton [Sat, 14 Aug 2010 22:35:17 +0000 (18:35 -0400)]
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.
Andy Wingo [Tue, 7 Dec 2010 11:26:07 +0000 (12:26 +0100)]
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.
Brian Templeton [Wed, 14 Jul 2010 00:55:45 +0000 (20:55 -0400)]
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.
Neil Jerram [Mon, 6 Dec 2010 23:02:12 +0000 (23:02 +0000)]
Put `figures' into standard texinfo form
* doc/ref/goops.texi (Example, Inheritance): Remove unnecessary figure
references. Use @float and @ref.
(Class precedence list): Ditto.
Neil Jerram [Mon, 6 Dec 2010 22:28:39 +0000 (22:28 +0000)]
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.
Neil Jerram [Mon, 6 Dec 2010 20:24:58 +0000 (20:24 +0000)]
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.
Andy Wingo [Mon, 6 Dec 2010 18:59:15 +0000 (19:59 +0100)]
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...
Andy Wingo [Mon, 6 Dec 2010 18:52:51 +0000 (19:52 +0100)]
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.
Andy Wingo [Mon, 6 Dec 2010 18:27:22 +0000 (19:27 +0100)]
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.
Andy Wingo [Mon, 6 Dec 2010 14:32:13 +0000 (15:32 +0100)]
fix name...
* module/web/request.scm (read-request-body/latin-1): Fix name...
Andy Wingo [Mon, 6 Dec 2010 14:30:45 +0000 (15:30 +0100)]
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.
Andy Wingo [Mon, 6 Dec 2010 14:19:40 +0000 (15:19 +0100)]
update read-delimited! docs
* doc/ref/api-io.texi (Line/Delimited): Update the read-delimited!
docs.
Andy Wingo [Mon, 6 Dec 2010 12:52:56 +0000 (13:52 +0100)]
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.
Andy Wingo [Mon, 6 Dec 2010 11:58:16 +0000 (12:58 +0100)]
fix entity tag writing
* module/web/http.scm (write-entity-tag): Fix writing of entity tags
(strong versus weak).
Andy Wingo [Mon, 6 Dec 2010 10:24:48 +0000 (11:24 +0100)]
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.
Andy Wingo [Sun, 5 Dec 2010 19:24:14 +0000 (20:24 +0100)]
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.
Andy Wingo [Sat, 4 Dec 2010 18:45:51 +0000 (19:45 +0100)]
(web server http) comment
* module/web/server/http.scm: Add comment about charsets.
Andy Wingo [Sat, 4 Dec 2010 18:45:09 +0000 (19:45 +0100)]
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.)
Andy Wingo [Sat, 4 Dec 2010 18:31:20 +0000 (19:31 +0100)]
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...
Andy Wingo [Fri, 3 Dec 2010 17:03:51 +0000 (18:03 +0100)]
read-delimited is clearer and conses less
* module/ice-9/rdelim.scm (read-delimited): Clarify and somewhat
optimize implementation.
Andy Wingo [Fri, 3 Dec 2010 16:37:22 +0000 (17:37 +0100)]
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.
Andy Wingo [Fri, 3 Dec 2010 15:41:46 +0000 (16:41 +0100)]
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.
Andy Wingo [Fri, 3 Dec 2010 15:30:52 +0000 (16:30 +0100)]
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.
Andy Wingo [Fri, 3 Dec 2010 15:11:37 +0000 (16:11 +0100)]
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.
Andy Wingo [Fri, 3 Dec 2010 14:31:57 +0000 (15:31 +0100)]
(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.
Andy Wingo [Fri, 3 Dec 2010 14:17:35 +0000 (15:17 +0100)]
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.
Andy Wingo [Fri, 3 Dec 2010 12:09:43 +0000 (13:09 +0100)]
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.
Ludovic Courtès [Thu, 2 Dec 2010 23:35:15 +0000 (00:35 +0100)]
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.
Ludovic Courtès [Wed, 1 Dec 2010 22:58:39 +0000 (23:58 +0100)]
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.
Andy Wingo [Thu, 2 Dec 2010 22:41:00 +0000 (23:41 +0100)]
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().
Andy Wingo [Thu, 2 Dec 2010 22:24:39 +0000 (23:24 +0100)]
scm_accept no longer leaves guile mode
* libguile/socket.c (scm_accept): Revert
7d1fc8721724ab64ccdc44d6f4f84abad43751b4. 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.
Andy Wingo [Thu, 2 Dec 2010 21:24:26 +0000 (22:24 +0100)]
sxml->xml fix
* module/sxml/simple.scm (attribute-value->xml): Whoops, fix null case.
Andy Wingo [Thu, 2 Dec 2010 16:25:46 +0000 (17:25 +0100)]
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.
Andy Wingo [Thu, 2 Dec 2010 12:36:04 +0000 (13:36 +0100)]
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.
Andy Wingo [Thu, 2 Dec 2010 12:33:49 +0000 (13:33 +0100)]
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.
Andy Wingo [Thu, 2 Dec 2010 11:46:15 +0000 (12:46 +0100)]
indentation fix in ports.c
* libguile/ports.c (scm_i_get_conversion_strategy): Indentation fix.
Andy Wingo [Thu, 2 Dec 2010 11:28:35 +0000 (12:28 +0100)]
(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.
Andy Wingo [Thu, 2 Dec 2010 10:47:19 +0000 (11:47 +0100)]
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.
Andy Wingo [Mon, 29 Nov 2010 12:00:43 +0000 (13:00 +0100)]
http web server impl ignores SIGPIPE
* module/web/server/http.scm (http-open): Ignore SIGPIPE. Keeps the
server from dying in some circumstances.
Andy Wingo [Mon, 29 Nov 2010 11:05:57 +0000 (12:05 +0100)]
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.
Andreas Rottmann [Thu, 25 Nov 2010 22:03:12 +0000 (23:03 +0100)]
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'.
Ludovic Courtès [Wed, 24 Nov 2010 22:38:01 +0000 (23:38 +0100)]
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.
Ludovic Courtès [Wed, 24 Nov 2010 22:01:50 +0000 (23:01 +0100)]
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.
Andreas Rottmann [Sun, 21 Nov 2010 22:17:54 +0000 (23:17 +0100)]
Add implementation of "transcoded ports"
* libguile/r6rs-ports.c (make_tp, tp_write, tp_fill_input, tp_flush)
(tp_close, initialize_transcoded_ports, scm_i_make_transcoded_port): New
functions.
(scm_init_r6rs_ports): Call `initialize_transcoded_ports'.
* module/rnrs/ports.scm (transcoded-port): Actually implement,
using `%make-transcoded-port'.
* test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports"): Added a
few tests for `transcoded-port'.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Andreas Rottmann [Sun, 21 Nov 2010 22:17:53 +0000 (23:17 +0100)]
Work towards a more complete implementation of `(rnrs io ports)'
* module/rnrs/io/ports.scm: (file-options, buffer-mode, eol-style)
(error-handling-mode, make-transcoder, native-transcoder)
(latin-1-codec, utf-8-codec, utf-16-codec)
(call-with-bytevector-output-port, open-file-input-port)
(open-file-output-port, make-custom-textual-output-port)
(flush-output-port, put-char, put-datum, put-string, get-char)
(get-datum, get-line, get-string-all, lookahead-char)
(standard-input-port, standard-output-port, standard-error-port):
Define all of these.
(call-with-port): Don't use `dynamic-wind', as it is against its
specification in R6RS 8.2.6.
* module/rnrs.scm: Export procedures added.
* module/rnrs/io/simple.scm (call-with-input-file)
(call-with-output-file): Define these in terms of R6RS procedures to
get correct exception behavior.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Andreas Rottmann [Sun, 21 Nov 2010 22:17:52 +0000 (23:17 +0100)]
Reorganize the R6RS I/O condition types
Move the I/O condition types from `(rnrs conditions)', where they were
not exported, to `(rnrs files)', where they are.
* module/rnrs/conditions.scm: Remove definition of I/O condition types.
* module/rnrs/files.scm: Replace references to I/O condition types
inside `(rnrs conditions)' with the actual definitions.
* module/rnrs/io/simple.scm: Don't `@@'-reference the I/O condition types, just
imported them from `(rnrs files)'.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Andreas Rottmann [Sun, 21 Nov 2010 22:17:51 +0000 (23:17 +0100)]
Turn `(rnrs io ports)' into an R6RS library
* module/rnrs/io/ports.scm: Change into an R6RS library from a "regular"
Guile module, so the bookkeeping for #:re-export and #:replace is done
automatically and we gain control over the imports from `(guile)'.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Andy Wingo [Tue, 23 Nov 2010 21:39:06 +0000 (22:39 +0100)]
fix regexp matches to refer to chars, not bytes
* libguile/regex-posix.c (fixup_multibyte_match): Fixup the match
structure to refer to character offsets, not byte offsets. Fixes bug
31650.
* test-suite/tests/regexp.test: Add a test.
Andy Wingo [Tue, 23 Nov 2010 15:02:21 +0000 (16:02 +0100)]
fix web server bugs
* module/web/http.scm (valid-quality?):
* module/web/server.scm (sanitize-response): Fix a couple bugs.
Andy Wingo [Mon, 22 Nov 2010 22:58:24 +0000 (23:58 +0100)]
fix up a couple content-length issues in web/server.scm:sanitize-response
* module/web/server.scm (sanitize-response): Allow body to be #f. Don't
require or insert a content-length if there is no body.
Julian Graham [Sun, 21 Nov 2010 20:35:44 +0000 (15:35 -0500)]
Enumeration set universe comparisons should be done with `equal?'
* module/rnrs/enums.scm (enum-set-union, enum-set-intersection,
enum-set-difference): Compare enum-set universes with `equal?' to support
sets generated using constructor syntax bound by `define-enumeration'.
* test-suite/tests/r6rs-enums.test (enum-set-union, enum-set-intersection,
enum-set-difference): New test cases for syntactically-generated sets.
Andreas Rottmann [Sat, 20 Nov 2010 17:40:30 +0000 (18:40 +0100)]
Fix missing port-table locking and bytevector output port segfault
* libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop): Lock
the port table.
* libguile/r6rs-ports.c (make_bop): Let the returned extraction
procedure refer to the port's buffer instead of the port itself. This
fixes a segfault if the port is closed before the extraction procedure
is called.
(bop_proc_apply): Adapt accordingly.
* test-suite/tests/r6rs-ports.test (8.2.10 Output ports): Add testcase
for extraction after close.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Andreas Rottmann [Sat, 20 Nov 2010 22:14:05 +0000 (23:14 +0100)]
Allow user-defined meta-commands
Besides allowing user-defined meta-commands, this change also refactors
the meta-command machinery to split reading a command's arguments from
the procedure actually implementing it, and hence allows nesting
meta-commands. As an example of such a command, ",in" is added as a new
meta-command.
* module/system/repl/command.scm: Export `define-meta-command'.
(*command-module*): Replaced by the hash table `*command-infos*'.
(command-info, make-command-info, command-info-procedure)
(command-info-arguments-reader): New procedures, encapsulating the
information about a meta-command.
(command-procedure): Adapted to use the `command-info' lookup
procedure.
(read-command-arguments): New auxiliary procedure invoking a command's
argument reader procedure.
(meta-command): Adapted to the split of reading arguments and
executing a command.
(add-meta-command!): New auxiliary procedure, registers a meta
command's procedure and argument reader into `*command-infos* and
`*command-table*.
(define-meta-command): Extended to allow specification of the command's
category; split the argument reader and actual command procedure.
(guile:apropos, guile:load, guile:compile-file, guile:gc): Remove these
aliases, they are unnecessary as we now use a hash table instead of the
module to store the commands.
(in): New meta-command, which evaluates an expression, or alternatively
executes another meta-command, in the context of a specific module.
* doc/ref/scheme-using.texi (Module Commands): Document the `in'
meta-command.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Andy Wingo [Sat, 20 Nov 2010 22:18:43 +0000 (23:18 +0100)]
announce flex version in autogen.sh
* autogen.sh: Announce flex version. Has the side-effect of checking for
flex when building from git.
Andreas Rottmann [Sat, 20 Nov 2010 00:05:10 +0000 (01:05 +0100)]
Allow specifying load extensions on the command line
Add a new command-line switch `-x', which manipulates the
%load-extensions list.
* libguile/script.c (scm_compile_shell_switches): Process the new "-x"
switch.
(scm_shell_usage): Mention the "-x" switch.
* doc/ref/scheme-scripts.texi (Invoking Guile): Add "-x" switch to the
list of command-line switches.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Ludovic Courtès [Fri, 19 Nov 2010 23:47:12 +0000 (00:47 +0100)]
Use `define-module*' in (ice-9 history).
* module/ice-9/history.scm: Use `define-module*' instead of
`process-define-module'.
Andy Wingo [Fri, 19 Nov 2010 16:51:16 +0000 (17:51 +0100)]
bump objcode version
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, as the
process-define-module deprecation means that outside compiled code
won't find process-define-module in the (guile) module, as they would
before.
Andy Wingo [Fri, 19 Nov 2010 16:08:36 +0000 (17:08 +0100)]
fix string-filter and string-delete argument order
* libguile/srfi-13.h:
* libguile/srfi-13.c (scm_string_filter, scm_string_delete): Swap
char_pred and s argument order, to comply with SRFI-13. There is a
back-compat shim that will detect programs that used the old,
erroneous interface, while giving a warning.
* doc/ref/api-data.texi: Update docs.
Andy Wingo [Fri, 19 Nov 2010 14:08:07 +0000 (15:08 +0100)]
deprecate process-define-module
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm (process-define-module): Deprecate.
Andy Wingo [Fri, 19 Nov 2010 13:43:31 +0000 (14:43 +0100)]
define-module compiles to define-module*
* module/ice-9/boot-9.scm (define-module): Compile down to a call to
define-module*, not process-define-module.
Andy Wingo [Fri, 19 Nov 2010 12:11:47 +0000 (13:11 +0100)]
scm_c_define_module uses define-module*
* libguile/modules.c (scm_c_define_module):
* module/ice-9/boot-9.scm: Update to have the C function call
define-module*.
Andy Wingo [Fri, 19 Nov 2010 12:06:03 +0000 (13:06 +0100)]
make module definition procedure more structured
* module/ice-9/boot-9.scm (define-module*): New procedure, like
process-define-modules but more structured.
(process-define-module): Reimplement in terms of define-module*.
Andy Wingo [Fri, 19 Nov 2010 10:39:06 +0000 (11:39 +0100)]
relax sizeof(long) restriction in configure.ac
* configure.ac: Relax the sizeof(long)==sizeof(void*) restriction,
instead asserting that the sizeof(long)<=sizeof(void*). There will
still be problems on nonstandard platforms related to the interface
with gmp, but those are confined to numbers.c.
Andy Wingo [Fri, 19 Nov 2010 10:29:26 +0000 (11:29 +0100)]
fix a number of assuptions that a long could hold an inum
* libguile/bytevectors.c:
* libguile/goops.c:
* libguile/instructions.c:
* libguile/numbers.c:
* libguile/random.c:
* libguile/read.c:
* libguile/vm-i-scheme.c: Fix a number of assumptions that a long could
hold an inum. This is not the case on platforms whose void* is larger
than their long.
* libguile/numbers.c (scm_i_inum2big): New helper, only implemented for
sizeof(void*) == sizeof(long); produces a compile error on other
platforms. Basically gmp doesn't have a nice interface for converting
between mpz values and intmax_t.
Andy Wingo [Thu, 18 Nov 2010 21:31:34 +0000 (22:31 +0100)]
simpos tweak
* libguile/simpos.c (scm_system_star): Use scm_from_ulong, as we do cast
to ulong.
Andy Wingo [Thu, 18 Nov 2010 21:30:27 +0000 (22:30 +0100)]
fix a number of assumptions that a pointer could fit into a long
* libguile/debug.c:
* libguile/eval.c:
* libguile/frames.c:
* libguile/objcodes.c:
* libguile/print.c:
* libguile/programs.c:
* libguile/read.c:
* libguile/struct.c:
* libguile/vm.c: Fix a number of instances in which we assumed we could
fit a pointer into a long.
Ludovic Courtès [Fri, 19 Nov 2010 13:28:40 +0000 (14:28 +0100)]
Fix incorrect uses of en-dashes and em-dashes in the intro.
* doc/ref/intro.texi (Introduction): Use commas instead of en-dashes
around "for example". Use em-dashes instead of en-dashes around
parenthetical phrases. Remove spaces around em-dashes.
Ludovic Courtès [Fri, 19 Nov 2010 13:14:53 +0000 (14:14 +0100)]
Include <alloca.h> wherever `alloca' is used.
Patch provided by <carlo.bramix@libero.it> (tiny change).
* libguile/control.c, libguile/fluids.c, libguile/foreign.c,
libguile/hashtab.c, libguile/strings.c: Include <alloca.h>.
Ludovic Courtès [Fri, 19 Nov 2010 10:18:42 +0000 (11:18 +0100)]
Optimize fixnum comparison.
* libguile/vm-i-scheme.c (REL): Don't untag X and Y since tagging
preserves ordering.
Ludovic Courtès [Fri, 19 Nov 2010 10:06:10 +0000 (11:06 +0100)]
Add fixnum arithmetic benchmarks.
* benchmark-suite/benchmarks/arithmetic.bm ("fixnum")["*", "/"]: New
benchmarks.
Ludovic Courtès [Wed, 17 Nov 2010 22:06:26 +0000 (23:06 +0100)]
Add optimized tagged integer addition/subtractions for x86_64.
This results in a 17% improvement in the execution time of the "+" and
"-" benchmarks for fixnums.
* libguile/vm-i-scheme.c (ASM_ADD, ASM_SUB)[defined __x86_64__ &&
SCM_GNUC_PREREQ (4, 5)]: New macros.
(add)[defined ASM_ADD]: Use `ASM_ADD' for the fast path.
(sub)[defined ASM_SUB]: Use `ASM_SUB' for the fast path.
* test-suite/tests/numbers.test ("+")["fixnum + fixnum = bignum
(32-bit)", "fixnum + fixnum = bignum (64-bit)", "bignum + fixnum =
fixnum", "wrong type"]: New tests.
("-")["fixnum - fixnum = bignum (32-bit)", "fixnum - fixnum = bignum
(64-bit)", "bignum - fixnum = fixnum", "wrong type"]: New tests.
* test-suite/tests/00-initial-env.test ("goopsless")["+ wrong type
argument"]: Use `with-test-prefix/c&e' instead of `with-test-prefix'.
["- wrong type argument"]: New test prefix.
Ludovic Courtès [Wed, 17 Nov 2010 22:05:50 +0000 (23:05 +0100)]
Use the `with-test-prefix/c&e' for the `1+' and `1-' tests.
* test-suite/tests/numbers.test ("1+"): Use `with-test-prefix/c&e'
instead of `with-test-prefix'. Provide a name to each `pass-if'
invocation.
("1-"): Likewise.
Ludovic Courtès [Wed, 17 Nov 2010 22:04:11 +0000 (23:04 +0100)]
Move `with-test-prefix/c&e' to `(test-suite lib)'.
* test-suite/tests/bytevectors.test (c&e, with-test-prefix/c&e): Move...
* test-suite/lib.scm: ... here.
(with-test-prefix): Rewrite using `syntax-rules'.
Ludovic Courtès [Fri, 12 Nov 2010 08:54:49 +0000 (09:54 +0100)]
Add `SCM_GNUC_PREREQ'.
* libguile/__scm.h (SCM_GNUC_PREREQ): New macro.
Use it in this file in lieu of hand-written GCC version tests.
Andy Wingo [Thu, 18 Nov 2010 20:48:55 +0000 (21:48 +0100)]
add `reload-module' to boot-9
* module/ice-9/boot-9.scm (reload-module): New procedure,
programmatically reloads the source file corresponding to the given
module.
Andy Wingo [Thu, 18 Nov 2010 15:06:46 +0000 (16:06 +0100)]
numbers.test expects lower-case hexadecimals
* test-suite/tests/numbers.test ("number->string"): Expect lower-case
hexidecimals.
Andy Wingo [Thu, 18 Nov 2010 13:43:43 +0000 (14:43 +0100)]
read-set! takes effect at expand time
* module/ice-9/boot-9.scm (define-option-interface): The set! command
goes in an eval-when to be run at expand-time, so that (read-set!
keywords 'prefix) does what it used to in 1.8 (mostly).
Andy Wingo [Thu, 18 Nov 2010 13:32:53 +0000 (14:32 +0100)]
repl read/write using current ports, not captured ports
Fixes bug in repl meta-commands after activating readline, which changes
the current input port.
* module/system/repl/common.scm (<repl>): Remove inport and outport
fields.
(make-repl): Adapt.
(repl-read, repl-print): Just read and write to the current ports.
* module/system/repl/repl.scm (meta-reader): Meta-read from the current
input port.
* module/system/repl/command.scm (read-command, define-meta-command):
Read from the current input port.
Andy Wingo [Thu, 18 Nov 2010 12:10:45 +0000 (13:10 +0100)]
lower-case hexadecimal digits again
* libguile/numbers.c: Default to lower-case hexadecimal digits again.
Andy Wingo [Thu, 18 Nov 2010 12:03:49 +0000 (13:03 +0100)]
better errors for ecmascript parser too
* module/language/ecmascript/parse.scm (syntax-error): Better errors
here too.
Andy Wingo [Thu, 18 Nov 2010 11:55:25 +0000 (12:55 +0100)]
ecmascript tokenization errors report source location
* module/language/ecmascript/tokenize.scm (syntax-error): Report source
locations. Adapt all callers to pass source locations.
Andy Wingo [Thu, 18 Nov 2010 11:31:28 +0000 (12:31 +0100)]
add source-location->source-properties to lalr
* module/system/base/lalr.scm (source-location->source-properties): New
public function, to produce source properties that can be given to the
compiler.
Andy Wingo [Thu, 18 Nov 2010 11:26:20 +0000 (12:26 +0100)]
more ecmascript testing
* test-suite/tests/ecmascript.test (eread/1, parse): Also check
read-ecmascript/1, which uses tokenize/1.
Andy Wingo [Thu, 18 Nov 2010 11:24:01 +0000 (12:24 +0100)]
fix ecmascript at the repl
* module/language/ecmascript/tokenize.scm (syntax-error): Reorder args
to throw vals in the right order.
(make-tokenizer/1): Fix. Broken since the lalr refactor...
Andy Wingo [Thu, 18 Nov 2010 11:21:36 +0000 (12:21 +0100)]
repl.scm displays syntax errors on read as well
* module/system/repl/repl.scm (prompting-meta-read): Use
display-syntax-error as appropriate.
Andy Wingo [Thu, 18 Nov 2010 10:15:16 +0000 (11:15 +0100)]
deprecate cuserid
* libguile/posix.c:
* libguile/posix.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_cuserid): Deprecate cuserid, as it only
returns 8 bytes of a user's login.
* doc/ref/posix.texi: Remove cuserid from docs.
Andy Wingo [Thu, 18 Nov 2010 10:04:15 +0000 (11:04 +0100)]
adapt tests to new syntax-error form
* test-suite/tests/syntax.test (pass-if-syntax-error): Fix up for new
form of syntax errors. Adapt all tests.
* test-suite/tests/srfi-17.test: Likewise.
Julian Graham [Wed, 17 Nov 2010 05:59:45 +0000 (00:59 -0500)]
Add exports for missing functions from `(rnrs base)'.
* module/rnrs.scm (boolean=?): New export.
Fix typo in export of`integer-valued?'.
* module/rnrs/base.scm: Add exports for `exact' and `inexact'.
(boolean=?, symbol=?, infinite?, finite?, exact-integer-sqrt,
integer-valued?, rational-valued?, real-valued?): New functions.
* test-suite/tests/r6rs-base.test (boolean=?, symbol=?, infinite?,
finite?, exact-integer-sqrt, integer-valued?, rational-valued?,
real-valued?): New test prefixes and tests.
Andy Wingo [Tue, 16 Nov 2010 02:00:01 +0000 (03:00 +0100)]
fix the C syntax-error pretty-printer
* libguile/throw.c (handler_message): Fix up a bit.
Andy Wingo [Tue, 16 Nov 2010 01:56:43 +0000 (02:56 +0100)]
add proper pretty-printing for syntax errors
* module/system/repl/repl.scm (display-syntax-error): New helper,
displays a syntax error.
(abort-on-error, run-repl): Use it.
* libguile/throw.c (handler_message): Re-code the same thing in C.
Andy Wingo [Tue, 16 Nov 2010 01:55:46 +0000 (02:55 +0100)]
remove syntax-error and call-with-compile-error-catch from compile.scm
* module/system/base/compile.scm: Remove unused syntax-error and
call-with-compile-error-catch exports.
Andy Wingo [Tue, 16 Nov 2010 01:09:39 +0000 (02:09 +0100)]
ecmascript syntax errors throw to 'syntax-error
* module/language/ecmascript/parse.scm (syntax-error):
* module/language/ecmascript/tokenize.scm (syntax-error): Throw to
'syntax-error as psyntax does.
Andy Wingo [Tue, 16 Nov 2010 01:09:03 +0000 (02:09 +0100)]
syntax-violation uses lambda*, throws a structured message
* module/ice-9/psyntax.scm (syntax-violation): Use lambda* for subform
arg. Instead of using scm-error, just throw to 'syntax-error with all
we got.
* module/ice-9/psyntax-pp.scm (#{and-map*\ 37}): Regenerated.
Andy Wingo [Mon, 15 Nov 2010 22:43:30 +0000 (23:43 +0100)]
fix string->number for bases > 16
* libguile/numbers.c (scm_iuint2str): Add an assertion on the domain of
the radix. Use the number_chars table to write the string, instead of
doing strange math. Same effect, though.
(mem2uinteger, char_decimal_value): Change logic to allow all ascii
alphabetic chars as decimals, not just a-f. Thanks to Nils Gey for the
report.
* test-suite/tests/numbers.test ("number->string"): Add some tests.
Neil Jerram [Sat, 30 Oct 2010 15:28:54 +0000 (16:28 +0100)]
Expression-oriented readline history
* guile-readline/ice-9/readline.scm (make-readline-port): Instead of
calling add-history after every %readline call, do it only when
starting a new read. Other times, append the line just read to an
internal buffer.
Andy Wingo [Sat, 13 Nov 2010 17:31:34 +0000 (18:31 +0100)]
flesh out (web server)'s sanitize-response
* module/web/server.scm (sanitize-response): Flesh out. If we get a
string, we encode it to a bytevector using the encoding snarfed from
the response. We should check the request, though...
Andy Wingo [Sat, 13 Nov 2010 17:30:27 +0000 (18:30 +0100)]
add extend-response.
* module/web/response.scm (extend-response): New utility.
Andy Wingo [Sat, 13 Nov 2010 17:17:28 +0000 (18:17 +0100)]
(web http) parses content-type as "foo/bar", not "foo" "bar"
* module/web/http.scm (parse-media-type, validate-media-type,
(content-type): Change to represent media types as ("foo/bar" ("param"
. "val") ...) instead of ("foo" "bar" ("param" . "val") ...). Seems to
be more in line with what people expect.
* test-suite/tests/web-http.test ("entity headers"): Add content-type
test.
* test-suite/tests/web-response.test ("example-1"): Adapt expected
parse.
Andy Wingo [Fri, 12 Nov 2010 16:18:08 +0000 (17:18 +0100)]
NUL vs NULL fix
* libguile/read.c (scm_i_scan_for_encoding): Fix NUL rather than NULL.
Andy Wingo [Fri, 12 Nov 2010 11:16:26 +0000 (12:16 +0100)]
remove (web toy-server)
* module/Makefile.am
* module/web/toy-server.scm: Remove. It's not so much that the new (web
server) stuff is not a toy, it's that users are expected to use the
new backends (mod-lisp, etc) in "production".