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".
Andy Wingo [Fri, 12 Nov 2010 11:07:24 +0000 (12:07 +0100)]
add generic web server with http-over-tcp backend
* module/web/server.scm: New generic web server module, with support for
different backends. An HTTP-over-TCP backend is the only one included
with Guile, though one can imagine FastCGI, mod-lisp, mongrel2/0mq etc
backends as well.
* module/web/server/http.scm: The aforementioned HTTP backend.
Andy Wingo [Fri, 12 Nov 2010 11:12:34 +0000 (12:12 +0100)]
add request-meta
* module/web/request.scm (<request>): Add `meta' field and accessor, for
metadata like the server IP, the client IP, CGI environment variables,
etc.
(build-request): Add meta kwarg.
(read-request): Add meta optional arg.
(write-request): Adapt.
Andy Wingo [Fri, 12 Nov 2010 11:10:44 +0000 (12:10 +0100)]
more (web http) exports for parsing request components
* module/web/http.scm (lookup-header-decl): New exported function.
(parse-http-version, parse-http-method, parse-request-uri): Export
these functions.
Andy Wingo [Fri, 12 Nov 2010 11:08:54 +0000 (12:08 +0100)]
call-with-error-handling pass-keys w/ procedural handlers fix
* module/system/repl/error-handling.scm (call-with-error-handling):
Respect the pass-keys set for procedural on-error and post-error
handlers.
Andy Wingo [Mon, 8 Nov 2010 15:06:50 +0000 (16:06 +0100)]
unparse-uri avoids serializing e.g. :80 in uris
* module/web/uri.scm (declare-default-port!): New function, declares a
default port for a scheme. Predeclare default ports for http and
https.
(unparse-uri): If the port is the default port for the given scheme,
don't serialize the port part of the URI.
Julian Graham [Fri, 12 Nov 2010 13:45:09 +0000 (08:45 -0500)]
Fix buffer over-read in port encoding scan.
* libguile/read.c (scm_i_scan_for_encoding): Add a NULL terminator to the
end of header to prevent over-read by subsequent call to strstr.
Ludovic Courtès [Thu, 11 Nov 2010 15:36:29 +0000 (16:36 +0100)]
Add FFI tests for `sizeof' and structs.
* test-suite/tests/foreign.test ("structs")["sizeof { int8, double }",
"sizeof { short, int, long, pointer }"]: New tests.
Ludovic Courtès [Thu, 11 Nov 2010 15:26:50 +0000 (16:26 +0100)]
Add FFI support for `short' and `unsigned short'.
* libguile/foreign.c (sym_short, sym_unsigned_short): New variables.
(scm_init_foreign): Define Scheme variables SYM_SHORT and
SYM_UNSIGNED_SHORT.
* module/system/foreign.scm (short, unsigned-short): New exports.
(integer-ref, integer-set): Support (= (sizeof TYPE) 2).
(%read-short, %write-short!, %read-unsigned-short,
%write-unsigned-short!): New variables.
(*writers*): Add support for `short' and `unsigned-short'.
(*readers*): Likewise.
* test-suite/tests/foreign.test ("structs")["int8, pointer, short,
double"]: New test.
Ludovic Courtès [Thu, 11 Nov 2010 15:09:22 +0000 (16:09 +0100)]
Have `parse-c-struct' and `make-c-struct' support `int', pointers, etc.
Reported by Tristan Colgate <tcolgate@gmail.com>.
* module/system/foreign.scm: Call `load-extension' at compile-time too.
(compile-time-value): New macro.
(integer-ref, integer-set): New procedures.
(define-integer-reader, define-integer-writer): New macros.
(%read-int, %read-long, %write-int!, %write-long!, %read-unsigned-int,
%read-unsigned-long, %write-unsigned-int!, %write-unsigned-long!,
%read-size_t, %write-size_t!, %read-pointer, %write-pointer!): New
procedures.
(*writers*): Add writers for `int', `unsigned-int', `long',
`unsigned-long', `size_t', and `*'.
(*readers*): Likewise.
* test-suite/tests/foreign.test ("structs")["int8, pointer",
"unsigned-long, int8, size_t", "long, int, pointer"]: New tests.
Ludovic Courtès [Mon, 8 Nov 2010 22:08:48 +0000 (23:08 +0100)]
FFI: Honor alignment constraints in `parse-c-struct'.
* module/system/foreign.scm (parse-c-struct): Honor alignment
constraints for TYPE.
* test-suite/tests/foreign.test ("structs")["alignment constraints
honored"]: New test.
Michael Gran [Tue, 9 Nov 2010 02:57:29 +0000 (18:57 -0800)]
Use ellipsis character in truncated pretty-print of sequences
* module/ice-9/pretty-print.scm (print-sequence): use ellipsis when available
Mike [Mon, 8 Nov 2010 16:52:04 +0000 (08:52 -0800)]
pretty-print print-sequence width error
Avoid the "expected a positive width" display error when printing
sequences with no width remaining.
* module/ice-9/pretty-print (print-sequence): test for zero width when
printing sequences
Ludovic Courtès [Sun, 7 Nov 2010 22:31:53 +0000 (23:31 +0100)]
Fix `reader.test'.
This is a followup to
a4e472294423bb796db3132c73027384fdfff820 ("need
read error for extra closing square brackets".)
* test-suite/tests/reader.test (exception:unexpected-rsqbracket): New
variable.
("reading")["paren mismatch (2)"]: Change exception type to
EXCEPTION:UNEXPECTED-RSQBRACKET.
["paren mismatch (3)", "paren mismatch (4)"]: New tests.
("mismatching parentheses")["closing square bracket following
mismatched opening"]: New test.
Ludovic Courtès [Sat, 6 Nov 2010 11:12:09 +0000 (12:12 +0100)]
pretty-print: Suitably indent macro-related constructs.
* module/ice-9/pretty-print.scm (generic-write)[pp-SYNTAX-CASE]: New
procedure.
[style]: Add support for `define-public', `define-syntax',
`let-syntax', `letrec-syntax', `syntax-rules', and `syntax-case'.
Andy Wingo [Fri, 5 Nov 2010 23:36:45 +0000 (00:36 +0100)]
fix up toy-server error handling
* module/web/toy-server.scm (serve-client): Fix up error handling, so we
catch errors when reading, handling, and writing. If we run
interactively, an error will enter the debugger.
Michael Gran [Fri, 5 Nov 2010 05:07:50 +0000 (22:07 -0700)]
need read error for extra closing square brackets
* libguile/read.c (scm_read_expression): add test
Ludovic Courtès [Fri, 5 Nov 2010 00:34:08 +0000 (01:34 +0100)]
Improve handling of read macros in `pretty-print'.
* module/ice-9/pretty-print.scm (generic-write)[wr]: Handle read macros
that appear in the middle of a list.
* test-suite/tests/print.test (prints?): New macro.
("pretty-print"): New test prefix.
Andy Wingo [Thu, 21 Oct 2010 23:07:27 +0000 (01:07 +0200)]
add toy web server
* module/web/toy-server.scm: New module, a toy web server.
* module/Makefile.am: Adapt.
Andy Wingo [Thu, 21 Oct 2010 23:06:54 +0000 (01:06 +0200)]
add HTTP response module
* module/web/response.scm: New module, for HTTP responses.
* test-suite/tests/web-response.test: Test suite.
* module/Makefile.am:
* test-suite/Makefile.am: Adapt.
Andy Wingo [Thu, 21 Oct 2010 22:06:32 +0000 (00:06 +0200)]
add HTTP request module
* module/web/request.scm: Add HTTP request module.
* test-suite/tests/web-request.test: Test cases.
* module/Makefile.am:
* test-suite/Makefile.am: Adapt.
Andy Wingo [Sun, 24 Oct 2010 10:36:17 +0000 (12:36 +0200)]
add HTTP module
* module/web/http.scm: New module, declares known HTTP headers, and
their parsers and unparsers.
* test-suite/tests/web-http.test: Add test suite.
* module/Makefile.am:
* test-suite/Makefile.am: Adapt.
Andy Wingo [Sat, 23 Oct 2010 13:23:42 +0000 (15:23 +0200)]
URI parsing errors throw to `uri-error'
* module/web/uri.scm (uri-error): New proc, throws to 'uri-error.
(validate-uri, uri-decode, uri-encode): Use uri-error.
* test-suite/tests/web-uri.test: Update for uri-error.
Neil Jerram [Thu, 4 Nov 2010 01:13:16 +0000 (01:13 +0000)]
Finish adding api-regex.texi
* doc/ref/Makefile.am (guile_TEXINFOS): Add api-regex.texi, so that it
gets into distributions.
Andreas Rottmann [Tue, 2 Nov 2010 23:19:54 +0000 (00:19 +0100)]
Add implementation of SRFI 38
* module/srfi/srfi-38.scm: New file, partly based on the reference
implementation and on Alex Shinn's public-domain implementation for
Chicken.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-38.scm.
* test-suite/tests/srfi-38.test: New file, minimal test suite for SRFI
38.
* test-suite/Makefile.am (SCM_TESTS): Added tests/srfi-38.test.
* doc/ref/srfi-modules.texi: Add a node for SRFI 38.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Andreas Rottmann [Tue, 2 Nov 2010 23:09:57 +0000 (00:09 +0100)]
Use a fluid for the list of the reader's "hash procedures"
This allows customizing the reader behavior for a dynamic extent more easily.
* libguile/read.c (scm_read_hash_procedures): Renamed to
`scm_i_read_hash_procedures'.
(scm_i_read_hash_procedures_ref, scm_i_read_hash_procedures_set_x):
New (internal) accessor functions for the fluid.
(scm_read_hash_extend, scm_get_hash_procedure): Use these accessor
functions.
(scm_init_read): Create the fluid, named `%read-hash-procedures' instead of
the previous plain list `read-hash-procedures'.
* test-suite/tests/reader.test: Adapt the "R6RS/SRFI-30 block comment
syntax overridden" test to make use of the fluid.
* module/ice-9/deprecated.scm (read-hash-procedures):
New identifier macro -- backward-compatibility shim.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Neil Jerram [Sun, 31 Oct 2010 08:34:05 +0000 (08:34 +0000)]
Manual sections don't need a page break before
* doc/ref/api-coverage.texi (Code Coverage): Remove @page.
* doc/ref/api-foreign.texi (Foreign Function Interface): Ditto.
* doc/ref/api-lalr.texi: (LALR(1) Parsing): Ditto.
* doc/ref/api-macros.texi (Macros): Ditto.
Neil Jerram [Sun, 31 Oct 2010 08:27:56 +0000 (08:27 +0000)]
Add ref to new location for regex doc
* doc/ref/api-data.texi: Add ref to new location for regex doc. Also
correct other refs to say section rather than chapter.
Neil Jerram [Sun, 31 Oct 2010 08:24:28 +0000 (08:24 +0000)]
Promote regex doc out of the `Simple Data Types' section
Because that probably isn't where people will look for it.
Thanks to Noah Lavine for the idea.
* doc/ref/api-regex.texi (Regular Expressions): New file, containing
the regex doc (promoted one level) that used to be in api-data.texi.
* doc/ref/guile.texi (API Reference): Include new file, and add menu
entry for the new section.
* THANKS: Add Noah.
Ludovic Courtès [Wed, 27 Oct 2010 22:03:54 +0000 (00:03 +0200)]
Fix typo in the (system base lalr) documentation.
* doc/ref/api-lalr.texi (LALR(1) Parsing): "The tokenizer should be a
unary procedure" -> "thunk". Patch by Noah Lavine
<noah.b.lavine@gmail.com>.
Andreas Rottmann [Wed, 27 Oct 2010 21:33:40 +0000 (23:33 +0200)]
Extend the #:replace list of the SRFI 69 module
* module/srfi/srfi-69.scm: Add `make-hash-table' and `hash-table?' to
the #:replace list of the module definition.
Ludovic Courtès [Wed, 27 Oct 2010 21:31:49 +0000 (23:31 +0200)]
Have "frisk" recognize `#:use-module' and `#:autoload'.
* module/scripts/frisk.scm (grok-proc): Support keywords `#:use-module'
and `#:autoload'.
Ludovic Courtès [Wed, 27 Oct 2010 21:28:58 +0000 (23:28 +0200)]
Augment `arithmetic.bm'.
* benchmark-suite/benchmarks/arithmetic.bm (repeat): Change the syntax.
Add support for binary OP.
("fixnum")["1+", "1-"]: Adjust accordingly.
["+", "-"]: New benchmarks.
Neil Jerram [Tue, 26 Oct 2010 08:11:52 +0000 (09:11 +0100)]
Fix manual typo
* doc/ref/api-foreign.texi: "prodedures" -> "procedures".
Julian Graham [Sun, 10 Oct 2010 05:35:26 +0000 (01:35 -0400)]
Improve performance of R6RS records implementation
Reimplement record-type descriptors as vtables for record structs, saving
us what was an expensive inspection of a record's vtable layout string to
determine its type.
* module/rnrs/records/inspection.scm (record-field-mutable?): Check
mutability using the bit field stored in the record-type descriptor
instead of the record struct's vtable.
* module/rnrs/records/procedural.scm (record-internal?): Reimplement as a
delegation to a check of the passed struct's vtable against
`record-type-descriptor?'.
(record-type-vtable): Modify to include base vtable layout as a prefix
of the record-type-descriptor layout so that all record-type instances
are now also vtables.
(make-record-type-descriptor): Remove field vtable; build up a mutability
bit field to use for fast mutability checks.
(record-accessor, record-mutator): Use field struct and mutability bit
field.
Ludovic Courtès [Wed, 20 Oct 2010 20:40:10 +0000 (22:40 +0200)]
Tweak `-Wunused-variable' and `-Wunused-toplevel' for special names.
* module/language/tree-il/analyze.scm (gensym?): New procedure.
(unused-variable-analysis): Ignore variables whose name passes
`gensym?' or is `_'.
(unused-toplevel-analysis): Ignore variables whose name passes
`gensym?'.
* test-suite/tests/tree-il.test ("warnings")["unused-variable"]("special
variable names"): New test.
["unused-toplevel"]("special variable names"): New test.
Ludovic Courtès [Tue, 19 Oct 2010 21:36:04 +0000 (23:36 +0200)]
Add `Libs.private' to the `.pc' files.
* meta/guile-2.0-uninstalled.pc.in (Libs): Remove @GUILE_LIBS@.
(Libs.private): New field.
* meta/guile-2.0.pc.in (Libs): Remove @GUILE_LIBS@.
(Libs.private): New field.
Ludovic Courtès [Tue, 19 Oct 2010 21:32:16 +0000 (23:32 +0200)]
configure: Don't needlessly augment $LIBS (and $GUILE_LIBS.)
* configure.ac: Don't augment $LIBS with $LTLIBUNISTRING and
$BDW_GC_LIBS.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS):
Remove @LTLIBINTL@. Add $(BDW_GC_LIBS).
Tristan Colgate-McFarlane [Wed, 20 Oct 2010 08:36:32 +0000 (09:36 +0100)]
Add support for more multicast sockopts.
* libguile/socket.c: Add support for IP_MULTICAST_TTL and IP_MILTICAST_IF sockopts.
Tristan Colgate-McFarlane [Wed, 20 Oct 2010 08:28:30 +0000 (09:28 +0100)]
Fix detection of struct ip_mreq
* configura.ac: netinet/in.h is required to complete definition of
struct ip_mreq.
Andy Wingo [Tue, 19 Oct 2010 20:58:00 +0000 (22:58 +0200)]
rdelim cleanups
* module/ice-9/rdelim.scm: Clean up export list.
(read-line!, read-delimited!, read-delimited, read-line): Use
define*.
Andy Wingo [Mon, 18 Oct 2010 11:35:46 +0000 (13:35 +0200)]
more -Wundef on darwin fixes
* libguile/threads.c:
* libguile/posix.c: Change a couple #if HAVE_FOO to #ifdef HAVE_FOO to
pacify -Wundef. Some vars are defined or not, whereas some are always
defined to 0 or 1. The inconsistency is unfortunate.
Andy Wingo [Mon, 18 Oct 2010 11:29:58 +0000 (13:29 +0200)]
uninitialized var in scm_read_character
* libguile/read.c (scm_read_character): Fix error condition where
charname could be uninitialized.
Andy Wingo [Mon, 18 Oct 2010 11:27:17 +0000 (13:27 +0200)]
_scm GUILE_USE_64_CALLS compilation warning fix
* libguile/_scm.h: Check that GUILE_USE_64_CALLS is defined. Fixes an
error on i386-apple-darwin9.8.0.
Andy Wingo [Fri, 15 Oct 2010 18:56:42 +0000 (20:56 +0200)]
web/uri: reimplement for rfc 3986, add tests
* module/web/uri.scm: Reimplement for RFC 3986.
* module/Makefile.am: Add to build.
* test-suite/Makefile.am:
* test-suite/tests/web-uri.test: Add tests.
Andy Wingo [Fri, 15 Oct 2010 18:51:29 +0000 (20:51 +0200)]
import uri.scm from tekuti, from guile-www
Ludovic Courtès [Fri, 15 Oct 2010 08:19:57 +0000 (10:19 +0200)]
Bump version number for 1.9.13.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
Ludovic Courtès [Fri, 15 Oct 2010 08:36:36 +0000 (10:36 +0200)]
Update `cpp-E.syms' and `cpp-SIG.syms'.
* libguile/cpp-E.syms, libguile/cpp-SIG.syms: Update on a Glibc 2.11.1
system.
Ludovic Courtès [Fri, 15 Oct 2010 08:34:33 +0000 (10:34 +0200)]
Fix the `chknew-E' and `chknew-SIG' rules.
* libguile/Makefile.am (chknew-E chknew-SIG): Run gcc without `-undef'
since otherwise it ends up trying to include headers that are not
available (e.g., <gnu/stubs-32.h> on an x86_64-linux-gnu system.)
Michael Gran [Fri, 15 Oct 2010 01:27:41 +0000 (18:27 -0700)]
Unresolved var errors don't work for top-level vars
* libguile/vm-i-system.c (toplevel_ref, long_toplevel_ref): modified
Michael Gran [Fri, 15 Oct 2010 01:21:28 +0000 (18:21 -0700)]
Update charsets to Unicode 6.0.0
* libguile/srfi-14.i.c: regenerated
Andy Wingo [Thu, 14 Oct 2010 14:13:57 +0000 (16:13 +0200)]
re-implement srfi-34's guard with syntax-case
* module/srfi/srfi-34.scm (guard): Re-implement using syntax-case.