Mark H Weaver [Tue, 25 Jan 2011 23:53:36 +0000 (18:53 -0500)]
Fix NEWS entry regarding changes to `expt' for zero base
NEWS: Fix NEWS entry regarding changes to `expt' when base is zero
Mark H Weaver [Tue, 25 Jan 2011 23:35:22 +0000 (18:35 -0500)]
Do not apply `inf?' or `nan?' to strings
* module/ice-9/format.scm (format): Test to make sure an argument is a
number before applying `inf?' and `nan?' to it. Formerly, format
would call `inf?' and `nan?' on arguments that might be either a
number or a string, although those predicates should ideally throw an
exception when applied to non-number objects.
Mark H Weaver [Tue, 25 Jan 2011 23:29:47 +0000 (18:29 -0500)]
Fix incorrect FUNC_NAME for scm_current_processor_count
* libguile/posix.c (scm_current_processor_count):
Fix incorrect FUNC_NAME (was s_scm_total_processor_count)
Andy Wingo [Thu, 27 Jan 2011 17:18:10 +0000 (18:18 +0100)]
fix guile-tools getopt
* meta/guile-tools.in (getopt): Define a local version of getopt that
stops parsing options when it sees a non-option.
Andy Wingo [Thu, 27 Jan 2011 12:13:23 +0000 (13:13 +0100)]
fix THANKS
* THANKS: Fix.
Andy Wingo [Thu, 27 Jan 2011 12:11:02 +0000 (13:11 +0100)]
for mmap objcodes, store the fd in the third word, as a scheme int
This leaves space for native code.
* libguile/objcodes.h (SCM_OBJCODE_NATIVE_CODE)
(SCM_SET_OBJCODE_NATIVE_CODE): Reserve the fourth word of objcode for
"native code", whatever that means.
* libguile/objcodes.c: Update a comment.
(make_objcode_by_mmap): Put the fd in the third word.
Andy Wingo [Thu, 27 Jan 2011 11:44:53 +0000 (12:44 +0100)]
objcode type is an enumeration, not flags
* libguile/objcodes.h (SCM_OBJCODE_TYPE_MMAP)
(SCM_OBJCODE_TYPE_BYTEVECTOR, SCM_OBJCODE_TYPE_SLICE)
(SCM_OBJCODE_TYPE_STATIC): Enumerate objcode types instead of
expressing them as flags.
(SCM_OBJCODE_TYPE): Type is held in bits 8-15.
(SCM_OBJCODE_FLAGS): Flags are now shifted by 16 bits, not 8.
(SCM_MAKE_OBJCODE_TAG): New helper.
* libguile/continuations.c (STATIC_OBJCODE_TAG):
* libguile/control.c (STATIC_OBJCODE_TAG):
* libguile/foreign.c (STATIC_OBJCODE_TAG):
* libguile/gsubr.c (STATIC_OBJCODE_TAG):
* libguile/smob.c (STATIC_OBJCODE_TAG):
* libguile/objcodes.c (make_objcode_by_mmap, scm_c_make_objcode_slice)
(scm_bytecode_to_objcode): : Use SCM_MAKE_OBJCODE_TAG.
Andy Wingo [Thu, 27 Jan 2011 10:24:22 +0000 (11:24 +0100)]
guile-tools gracefully errors for missing scripts
* meta/guile-tools.in (find-script): Use the #:ensure arg of
resolve-module.
(main): Display a comprehensible error message if we don't find a
script.
Andy Wingo [Thu, 27 Jan 2011 10:15:01 +0000 (11:15 +0100)]
guile-tools uses getopt-long
* meta/guile-tools.in: Use getopt-long.
Andy Wingo [Thu, 27 Jan 2011 09:57:18 +0000 (10:57 +0100)]
guile-tools uses srfi-1
* meta/guile-tools.in (guile-tools): Use srfi-1 here, now that we can.
Andy Wingo [Thu, 27 Jan 2011 09:49:51 +0000 (10:49 +0100)]
fix error handling in variable-ref family of instructions
* libguile/vm-i-system.c (variable-ref, variable-set, variable-bound?):
Check that the argument is actually a variable. Thanks to Kevin
Holmes for the report.
* libguile/vm-engine.c (vm_engine): Error handling down here.
* THANKS: Update.
Ludovic Courtès [Wed, 26 Jan 2011 23:16:54 +0000 (00:16 +0100)]
Use `scm_from_latin1_stringn' in `objcodes.c'.
* libguile/objcodes.c (make_objcode_by_mmap): Use
`scm_from_latin1_stringn', not `scm_from_locale_stringn', to display
the invalid cookie in the error case.
Ludovic Courtès [Wed, 26 Jan 2011 23:15:58 +0000 (00:15 +0100)]
Fix buffer overflow in `read-line'.
* libguile/rdelim.c (SCM_DEFINE): Compare INDEX to LINE_BUFFER_SIZE, not
`sizeof (buf)'.
Ludovic Courtès [Wed, 26 Jan 2011 22:45:13 +0000 (23:45 +0100)]
Add ECMAScript parser tests.
* test-suite/tests/ecmascript.test ("parser"): Add parser tests for the
previous fixes.
Noah Lavine [Tue, 11 Jan 2011 22:58:34 +0000 (17:58 -0500)]
Parse Decimal Numbers
* module/language/ecmascript/parse.scm: handle numbers with leading
decimals correctly.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Noah Lavine [Tue, 11 Jan 2011 23:03:04 +0000 (18:03 -0500)]
Fix Hex Constants
* module/language/ecmascript/tokenize.scm: hexadecimal constants can
now use 'X' in addition to 'x'.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Noah Lavine [Tue, 11 Jan 2011 22:41:21 +0000 (17:41 -0500)]
Ecmascript Syntax
* module/language/ecmascript/tokenize.scm: an unbreakable space
counts as whitespace.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Noah Lavine [Tue, 11 Jan 2011 22:29:09 +0000 (17:29 -0500)]
Ecmascript Syntax Fix
* module/language/ecmascript/parse.scm: allow empty function bodies.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Ludovic Courtès [Wed, 26 Jan 2011 22:02:41 +0000 (23:02 +0100)]
Add a `read-line' benchmark.
* benchmark-suite/benchmarks/ports.bm ("rdelim"): New benchmark prefix.
Ludovic Courtès [Wed, 26 Jan 2011 21:59:45 +0000 (22:59 +0100)]
Tweak `read-line'.
* libguile/rdelim.c (LINE_BUFFER_SIZE): Set to 1 KiB instead of 4 KiB.
(scm_read_line): Initialize STRING to #f so we actually use the fast
path.
Andy Wingo [Wed, 26 Jan 2011 21:09:06 +0000 (22:09 +0100)]
more sensible error if compiled-file-name returns false in compile-file
* module/system/base/compile.scm (compile-file): Error if no output-file
is given and compiled-file-name returns false.
Andy Wingo [Wed, 26 Jan 2011 20:48:20 +0000 (21:48 +0100)]
fix THANKS
* THANKS: Fix Hans' surname.
Andy Wingo [Wed, 26 Jan 2011 20:44:12 +0000 (21:44 +0100)]
fix error-handling of apply to non-list
* libguile/vm-engine.c (vm_error_apply_to_non_list): Sync registers
before erroring. Fix type of finish_args. Thanks to Hans Aberg for
the report.
Andy Wingo [Wed, 26 Jan 2011 19:40:07 +0000 (20:40 +0100)]
update README for copyright year ranges
* README: Add note about copyright year ranges. Remove reference to
guile-tut.info.
Andy Wingo [Wed, 26 Jan 2011 19:13:16 +0000 (20:13 +0100)]
fix format ~f documentation for width combined with overflowchar
* doc/ref/misc-modules.texi (Formatted Output): Adapt ~f documentation
to indicate that the output will always have a decimal point. Thanks
to Fu-gangqiang for the report.
* THANKS: Update.
Julian Graham [Wed, 26 Jan 2011 08:32:48 +0000 (03:32 -0500)]
Additional documentation for symbol manipulation functions.
* doc/ref/api-data.texi (Symbol Primitives): Document `symbol',
`list->symbol', and `symbol-append'.
Ludovic Courtès [Tue, 25 Jan 2011 23:24:34 +0000 (00:24 +0100)]
Rewrite `read-line' in terms of `scm_getc'.
As a result `read-line' handles decoding and decoding errors the same
way as `scm_getc'. It's also simpler and free of `malloc' calls.
* libguile/rdelim.c (scm_do_read_line): Remove.
(scm_read_line): Rewrite as a loop that calls `scm_getc'.
* test-suite/tests/rdelim.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add `tests/rdelim.test'.
Ludovic Courtès [Tue, 25 Jan 2011 23:16:10 +0000 (00:16 +0100)]
Have `scm_getc' honor the port's conversion strategy.
* libguile/ports.c (get_codepoint): Reset `pt->input_cd' upon failure.
If `pt->ilseq_handler' is `SCM_ICONVEH_QUESTION_MARK', then return a
question mark.
[failure]: Use `scm_encoding_error' when raising an error.
* test-suite/lib.scm (exception:encoding-error): Adjust regexp.
* test-suite/tests/ports.test ("string ports")["read-char, wrong
encoding, error", "read-char, wrong encoding, escape", "read-char,
wrong encoding, substitute"]: New tests.
Ludovic Courtès [Tue, 25 Jan 2011 23:05:27 +0000 (00:05 +0100)]
Test substitution and escaping on port output.
* test-suite/tests/ports.test ("string ports")["wrong encoding,
substitute", "wrong encoding, escape"]: New tests.
Ludovic Courtès [Tue, 25 Jan 2011 22:36:35 +0000 (23:36 +0100)]
Add `scm_{to,from}_utf32_string'.
* libguile/strings.c (scm_from_utf32_string, scm_from_utf32_stringn,
scm_to_utf32_string, scm_to_utf32_stringn): New functions.
* libguile/strings.h (scm_from_utf32_string, scm_from_utf32_stringn,
scm_to_utf32_string, scm_to_utf32_stringn): New declarations.
* doc/ref/api-data.texi (Conversion to/from C): Document
`scm_{to,from}_{utf8,utf32}_stringn'.
Ludovic Courtès [Tue, 25 Jan 2011 22:24:36 +0000 (23:24 +0100)]
Optimize `scm_{to,from}_latin1_string'.
* libguile/strings.c (scm_from_latin1_stringn): Directly return a narrow
string instead of going through `scm_from_stringn'.
(scm_to_latin1_stringn): Directly return a copy of STR's raw bytes when
it's narrow.
Andy Wingo [Tue, 25 Jan 2011 16:59:45 +0000 (17:59 +0100)]
stexi->shtml supports itemx
* module/texinfo/html.scm (entry, rules): Allow @itemx,
Ludovic Courtès [Mon, 24 Jan 2011 22:37:46 +0000 (23:37 +0100)]
Install the current locale when starting the REPL.
* module/ice-9/top-repl.scm (top-repl): Install the current locale.
Ludovic Courtès [Mon, 24 Jan 2011 22:13:03 +0000 (23:13 +0100)]
Remove useless branches in the port code.
* libguile/ports.c (scm_i_get_port_encoding): Remove useless `if'.
(scm_set_port_encoding_x): Remove redundant `find_valid_encoding'
call.
Ludovic Courtès [Mon, 24 Jan 2011 22:11:21 +0000 (23:11 +0100)]
Always initialize a port's encoding name.
* libguile/ports.c (scm_i_set_port_encoding_x): Always initialize
PT->encoding to something non-NULL. This fixes callers of
`scm_encoding_error' such that they always pass a non-NULL encoding
name. Reported by Matei Conovici.
Andy Wingo [Mon, 24 Jan 2011 21:48:26 +0000 (22:48 +0100)]
update the man page
* doc/guile.1: Update a bit.
Ludovic Courtès [Mon, 24 Jan 2011 20:44:44 +0000 (21:44 +0100)]
Choose the input source file encoding in a locale-independent way.
This is so that compiling the same code on environments with different
locale settings yields the same result.
* module/system/base/compile.scm (compile-file): When ENC if #f, default
to "UTF-8" instead of `(fluid-ref %default-port-encoding)'.
* doc/ref/api-evaluation.texi (Compilation): Document the default output
file name and default source file encoding for `compile-file' and
`guile-tools compile'.
Ludovic Courtès [Sun, 23 Jan 2011 22:43:50 +0000 (23:43 +0100)]
Remove unexpected non-ASCII character.
* module/language/tree-il/fix-letrec.scm: Replace U+2019 with an ASCII
quote. The iconv implementation on FreeBSD would immediately notice
and bail out when reading it under a US-ASCII locale.
Ludovic Courtès [Sun, 23 Jan 2011 00:26:07 +0000 (01:26 +0100)]
Rewrite `scm_lfwrite_substr' in terms of `scm_display'.
* libguile/ports.c (scm_lfwrite_substr): Rewrite in terms of
`scm_display'.
Ludovic Courtès [Sun, 23 Jan 2011 00:14:51 +0000 (01:14 +0100)]
Remove `scm_lfwrite_str'.
* libguile/ports.c (scm_lfwrite_str): Remove.
* libguile/ports.h (scm_lfwrite_str): Remove declaration.
* libguile/numbers.c (scm_i_print_fraction): Use `scm_display' instead
of `scm_lfwrite_str'.
Ludovic Courtès [Sat, 22 Jan 2011 23:20:07 +0000 (00:20 +0100)]
Augment `THANKS'.
Ludovic Courtès [Sat, 22 Jan 2011 23:13:27 +0000 (00:13 +0100)]
Hide the string escaping hacks.
* libguile/strings.c (scm_i_unistring_escapes_to_guile_escapes): Rename
to...
(unistring_escapes_to_guile_escapes): ... this. Make `static'.
(scm_i_unistring_escapes_to_r6rs_escapes): Rename to...
(unistring_escapes_to_r6rs_escapes): ... this. Make `static'.
* libguile/strings.h (scm_i_unistring_escapes_to_guile_escapes,
scm_i_unistring_escapes_to_r6rs_escapes): Remove declarations.
Ludovic Courtès [Sat, 22 Jan 2011 23:18:27 +0000 (00:18 +0100)]
Rewrite `read-char', `display', etc. using iconv calls instead of libunistring.
Thanks to Bruno Haible for his suggestions. See
<http://lists.gnu.org/archive/html/bug-libunistring/2010-09/msg00007.html>,
for details.
* libguile/ports.c (register_finalizer_for_port): Always register a
finalizer for PORT.
(finalize_port): Close ENTRY->input_cd and ENTRY->output_cd.
(scm_new_port_table_entry): Initialize the `input_cd' and `output_cd'
fields.
(utf8_to_codepoint): New function.
(get_codepoint): Rewrite to use `iconv' instead of libunistring.
(scm_i_set_port_encoding_x): Initialize the `input_cd' and `output_cd'
fields.
(update_port_lf): Move upward. Use `switch' instead of `if's.
* libguile/ports.h (scm_t_port)[input_cd, output_cd]: New fields.
* libguile/print.c (codepoint_to_utf8, display_string): New functions.
(display_character): Use `display_string'.
(write_combining_character): Likewise.
(iprin1): Use `display_string' instead of `scm_lfwrite_str', and
`display_character' instead of `scm_putc'.
(write_character): Likewise.
(write_character_escaped): New function.
* test-suite/tests/encoding-escapes.test ("display output
escapes")["Rashomon"]: Use lower-case escapes.
["fake escape"]: New test.
Andy Wingo [Sat, 22 Jan 2011 23:06:24 +0000 (00:06 +0100)]
infinities are no longer integers
* libguile/numbers.c (scm_is_integer): Infinities are not integers, per
the R6RS.
(scm_even_p, scm_odd_p): Passing an infinity to even? or odd? is an
error.
* test-suite/tests/numbers.test ("integer?"): Adapt test.
("expt"): Add tests for +inf.0 and -inf.0 exponents.
* NEWS: Add NEWS entries.
Andy Wingo [Sat, 22 Jan 2011 18:56:23 +0000 (19:56 +0100)]
web.texi fix
* doc/ref/web.texi (HTTP Headers): Fix transfer-encoding example.
Andy Wingo [Sat, 22 Jan 2011 18:55:31 +0000 (19:55 +0100)]
scm_with_guile calls GC_call_with_gc_active
* configure.ac: Check for GC_call_with_gc_active.
* libguile/threads.h (scm_i_thread): Remove "top", as it's not used.
* libguile/threads.c (with_gc_inactive, with_gc_active): Define shims to
GC_do_blocking and GC_call_with_gc_active.
(scm_i_init_thread_for_guile): Don't do thread base adjustment here,
do it in scm_i_with_guile_and_parent. The previous logic would never
be run.
(scm_i_with_guile_and_parent): If we enter Guile mode, leave it too.
Take care of adjusting the thread stack base here too. Also, call
with_gc_active.
(scm_without_guile): Refactor.
Andy Wingo [Fri, 21 Jan 2011 08:23:06 +0000 (09:23 +0100)]
update NEWS for hungry-eol-escapes
* NEWS: Update for hungry-eol-escapes.
Andy Wingo [Fri, 21 Jan 2011 08:21:15 +0000 (09:21 +0100)]
document hungry-eol-escapes
* doc/ref/api-data.texi (String Syntax): Document hungry-eol-escapes.
* doc/ref/api-evaluation.texi (Scheme Read):
* doc/ref/api-options.texi (Runtime Options): Update read-options 'help
output.
Andy Wingo [Fri, 21 Jan 2011 07:57:39 +0000 (08:57 +0100)]
implement r6rs hungry escaped EOL
* libguile/private-options.h (SCM_HUNGRY_EOL_ESCAPES_P): New private
option.
* libguile/read.c: Define SCM_HUNGRY_EOL_ESCAPES_P, defaulting to #f.
(skip_intraline_whitespace): New helper.
(scm_read_string): If SCM_HUNGRY_EOL_ESCAPES_P,
skip_intraline_whitespace after an escaped EOL.
* test-suite/tests/reader.test ("read-options"): Add test.
Andy Wingo [Fri, 21 Jan 2011 07:27:08 +0000 (08:27 +0100)]
implement port-eof?
* module/rnrs/io/ports.scm (port-eof?): Implement.
* module/rnrs.scm: Re-export port-eof?.
* test-suite/tests/r6rs-ports.test ("7.2.5 End-of-File Object"): Add
test.
Thanks to Göran Weinholt for the report.
Andy Wingo [Thu, 20 Jan 2011 22:44:40 +0000 (23:44 +0100)]
add NEWS for expt change
* NEWS: Update for Mark's expt patch.
Andy Wingo [Thu, 20 Jan 2011 22:39:56 +0000 (23:39 +0100)]
update NEWS for 1.9.14
* NEWS: Fold 1.9.14 entries into main text.
Mark H Weaver [Fri, 5 Nov 2010 02:10:02 +0000 (22:10 -0400)]
Fix bugs in expt and integer-expt
* libguile/numbers.c (scm_expt): Fix bug that caused expt to throw an
exception whenever the base was exact and the exponent was an
inexact integer, e.g. (expt 5 6.0).
(scm_expt): Fix bug that caused expt to introduce spurious imaginary
parts in the result when the base was an inexact negative real and
the exponent was an integer, e.g. (expt -1.0 2)
(scm_integer_expt, scm_expt): Change behavior of (integer-expt 0 -1),
and therefore also (expt 0 -1), to return NaN, per R6RS (actually,
R6RS says we should throw an exception or return an "unspecified
number object", but for now we use NaN). Formerly we returned 0, per
R5RS. R5RS claims that 0^x=0 for all non-zero x, but that's
mathematically incorrect, and probably an oversight.
(scm_integer_expt): Consistently throw a wrong-argument-type exception
when the exponent is inexact. Formerly, it didn't always check this
if the base was 0, 1, or -1.
* test-suite/tests/numbers.test ("integer-expt", "expt"): Add tests.
Noah Lavine [Tue, 11 Jan 2011 21:32:17 +0000 (16:32 -0500)]
Add ECMAScript Unicode literal support
* module/language/ecmascript/tokenize.scm: add unicode literals
* test-suite/tests/ecmascript.test ("parser"): Add new tests for Latin-1
and Unicode escapes in string literals.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Neil Jerram [Sat, 15 Jan 2011 21:16:39 +0000 (21:16 +0000)]
Add "REPORTING BUGS" and "COPYING" sections to Guile man page
Thanks to Mark Harig for the suggestion.
* doc/guile.1: Added "REPORTING BUGS" and "COPYING" sections, modelled
on those in the Emacs man page.
Neil Jerram [Sat, 15 Jan 2011 20:57:01 +0000 (20:57 +0000)]
Document missing Guile command line options
Thanks to Mark Harig for pointing this out and suggesting the text.
* doc/ref/scheme-scripts.texi (Invoking Guile): Mention --autocompile
and --no-autocompile.
Neil Jerram [Sat, 15 Jan 2011 20:51:27 +0000 (20:51 +0000)]
Manual page fixes
Thanks to Mark Harig for pointing these out.
* doc/guile.1: Remove mention of the tutorial, since it no longer
exists (as a separate document). Document the -q option.
* THANKS: Add Mark Harig.
Neil Jerram [Fri, 14 Jan 2011 21:53:37 +0000 (21:53 +0000)]
Confront the MOP
* doc/ref/goops.texi (The Metaobject Protocol): Bring forward to
before `Class Options', and add intro text to explain why. All of
the sections now remaining are ones where the MOP is more likely to
be relevant than not.
Neil Jerram [Fri, 14 Jan 2011 21:23:54 +0000 (21:23 +0000)]
Move `GOOPS Error Handling' to after `Introspection'
* doc/ref/goops.texi (GOOPS Error Handling): Move to just after
`Introspection'.
Neil Jerram [Fri, 14 Jan 2011 21:19:51 +0000 (21:19 +0000)]
Move `Handling Slot Access Errors' inside `Accessing Slots'
* doc/ref/goops.texi (Accessing Slots): Move `Handling Slot Access
Errors' here; update relevant references.
Neil Jerram [Fri, 14 Jan 2011 20:34:41 +0000 (20:34 +0000)]
Merge small sections into `GOOPS Object Miscellany'
* doc/ref/goops.texi (GOOPS Object Miscellany): New section, combining
previous `Object Comparison', `Cloning Objects' and `Write and
Display'. Replace `Object Comparison' text with something that
makes sense. Add a snippet to the end of the write/display section.
Neil Jerram [Fri, 14 Jan 2011 20:10:33 +0000 (20:10 +0000)]
Remove content-free `Generic Functions and Accessors'
* doc/ref/goops.texi (GOOPS): Remove `Generic Functions and
Accessors'. There was nothing here that wasn't better covered
elsewhere.
Neil Jerram [Fri, 14 Jan 2011 20:06:34 +0000 (20:06 +0000)]
Move `Accessing Slots' inside `Introspection'.
* doc/ref/goops.texi (Introspection): Move `Accessing Slots' into
here, and flatten it, except for `Handling Slot Access Errors'.
(GOOPS Error Handling): Move `Handling Slot Access Errors' here.
Neil Jerram [Fri, 14 Jan 2011 20:01:29 +0000 (20:01 +0000)]
Reorder `Introspection'
* doc/ref/goops.texi (Instances): Move `Instances' before `Slots', as
it feels more important.
Neil Jerram [Fri, 14 Jan 2011 19:45:38 +0000 (19:45 +0000)]
Edit `Introspection'
* doc/ref/goops.texi (Introspection): Make a bit snappier.
(Classes): Add intro. Remove "the" and "metaobject" everywhere.
Remove `class-environment', since I don't know what it's useful for.
(Instances): Remove implementation notes.
(Built-in classes): Merge with `Instances'. Reorder text points.
(Generic Functions): Add intro. Remove "the" and "metaobject"
everywhere.
(Generic Function Methods): Merge with `Generic Functions'.
Neil Jerram [Fri, 14 Jan 2011 19:08:46 +0000 (19:08 +0000)]
Move `Introspection' earlier
* doc/ref/goops.texi (Introspection): Move to after `Generic Functions
and Methods'. The idea is to have all of that sections that make
sense without needing to understand the MOP, before sections that
really depend on the MOP.
Neil Jerram [Wed, 12 Jan 2011 23:42:40 +0000 (23:42 +0000)]
Improve doc on generic functions and inheritance
* doc/ref/goops.texi (Methods and Generic Functions): More explanation
of generic function invocation. Created (or moved) subsections here
to cover material on the following that was previously spread elsewhere:
accessors; extending primitives; merging generics; generic function
examples; handling invocation errors. Edited for clarity throughout.
(Generic functions and methods, Example): Nodes deleted, with their
material incorporated above.
(Class Precedence List): Edited to improve clarity.
(Sorting Methods): New subsection.
Andy Wingo [Tue, 11 Jan 2011 06:40:43 +0000 (22:40 -0800)]
web.texi defun -> deffn
* doc/ref/web.texi (URIs): Change instances of @defun to @deffn with
{Scheme Procedure}.
Andy Wingo [Tue, 11 Jan 2011 06:35:39 +0000 (22:35 -0800)]
more web.texi foo
* doc/ref/web.texi (Web Server, Web Examples): Update.
Andy Wingo [Tue, 11 Jan 2011 06:23:38 +0000 (22:23 -0800)]
update web.text documentation for requests and responses
* doc/ref/web.texi (Requests, Responses): Update, and add a note on
character encodings.
Andy Wingo [Tue, 11 Jan 2011 06:22:56 +0000 (22:22 -0800)]
request and response cleanups
* module/web/request.scm (build-request): Make URI a positional
argument.
* module/web/response.scm: Remove extend-response.
(read-response): Fix a docstring.
* module/web/server.scm (extend-response): Include extend-response here,
but not exported.
Andy Wingo [Tue, 11 Jan 2011 06:09:57 +0000 (22:09 -0800)]
(web response) and (web request): bodies are bytevectors
* module/web/request.scm (read-request-body, write-request-body): Rename
from read-request-body/bytevector and
write-request-body/bytevector. Remove the /latin-1 variants, as they
were unused and a bad idea.
* module/web/response.scm (read-response-body, write-response-body):
Likewise.
* module/web/server/http.scm (http-read, http-write): Adapt to
request/response change.
* test-suite/tests/web-request.test:
* test-suite/tests/web-response.test: Update tests.
Andy Wingo [Mon, 10 Jan 2011 17:32:26 +0000 (09:32 -0800)]
update web.texi for (web http) changes
* doc/ref/web.texi (HTTP Headers): Update to reflect current code, and
to reformat. Not sure if it's an improvement...
Andy Wingo [Mon, 10 Jan 2011 16:20:29 +0000 (08:20 -0800)]
parse credentials and challenges
* module/web/http.scm (parse-credentials, validate-credentials)
(write-credentials, parse-challenge, parse-challenges)
(validate-challenges, write-challenge, write-challenges)
(declare-credentials-header!, declare-challenge-list-header!): New
helpers.
("Authorization", "Proxy-Authorization"): Parse out credentials.
("Proxy-Authenticate", "WWW-Authenticate"): Parse out challenges.
Andy Wingo [Sun, 9 Jan 2011 05:32:14 +0000 (21:32 -0800)]
more symbols in (web http)
* module/web/http.scm (declare-symbol-list-header!): New helper.
("Connection"): Redefine as a header list.
("Allow", "Content-Encoding", "Accept-Ranges"): Redefine as symbol
lists.
* test-suite/tests/web-http.test:
* test-suite/tests/web-response.test: Adapt tests.
Andy Wingo [Sun, 9 Jan 2011 04:50:46 +0000 (20:50 -0800)]
(web http): keys are always symbols
* module/web/http.scm (parse-media-type): Parse media types as symbols.
(parse-key-value-list, parse-param-component, parse-param-list):
Change kons to val-parser. Always parse keys as symbols, and always
either cons, if there is a val, or just have the key, if there is no
val. Easier to explain and just as correct.
(declare-param-list-header!, declare-key-value-list-header!): Adapt to
key-list and param-list kons change.
("Cache-Control", "Pragma", "Transfer-Encoding", "Accept", "Expect")
("TE"): Likewise, adapt.
("Content-Type"): Param keys are symbols.
Andy Wingo [Sat, 8 Jan 2011 20:21:38 +0000 (12:21 -0800)]
update (web http) docs
* doc/ref/web.texi (HTTP): Update docs to correspond with current code.
Andy Wingo [Sat, 8 Jan 2011 19:40:20 +0000 (11:40 -0800)]
(web http): don't expose header-decl objects
* module/web/http.scm: Change to not expose the header-decl objects,
instead exposing header-parse, header-validator, header-writer et al.
Explaining header decls in the manual was too complicated.
(string->header, header->string): New helpers.
(<header-decl>): Remove the `sym' field.
(declare-header!): Adapt to header-decl change, and use
string->header.
(known-header?, header-parser, header-validator, header-writer): New
procedures.
Adapt to use the new procedures internally.
Andy Wingo [Sat, 8 Jan 2011 18:54:07 +0000 (10:54 -0800)]
(web http): header names always represented as symbols
* module/web/http.scm (declare-header!): No need to specify `sym', as it
can be derived from `name'. Change to take parser, validator, and
writer as positional arguments, and multiple? as a keyword.
(parse-header): Change to take the header as a symbol already, and
just return the parsed value. All headers are symbols now, including
unknown headers. I feel OK doing this given that the symbol GC works
now.
(lookup-header-decl): Only look up headers by symbol.
(read-header): Adapt to parse-header change.
(valid-header?, write-header): Adapt to all headers being symbols.
(split-header-names, list-of-header-names?, write-header-list):
Represent all header names as symbols.
(declare-opaque-header!, declare-date-header!)
(declare-string-list-header!, declare-header-list-header!)
(declare-integer-header!, declare-uri-header!)
(declare-quality-list-header!, declare-param-list-header!)
(declare-key-value-list-header!, declare-entity-tag-list-header!):
Change to be functions instead of syntax, and no need to specify the
symbolic name. Update all header declarations accordingly.
* module/web/request.scm (validate-headers):
* module/web/response.scm (validate-headers): Adapt to all headers being
symbols.
* test-suite/tests/web-http.test (pass-if-parse, pass-if-any-error)
(pass-if-parse-error): Update for parse-header change.
("general headers"): Update header list examples to be all symbols.
Andy Wingo [Sat, 8 Jan 2011 06:16:10 +0000 (22:16 -0800)]
fix scm_from_stringn empty string case
* libguile/strings.c (scm_from_stringn): Fix empty string case
(oops...).
Andy Wingo [Sat, 8 Jan 2011 06:01:27 +0000 (22:01 -0800)]
fix tab completion in repl (doh)
* libguile/hashtab.c: Fix remaining vector hash table support.
* module/ice-9/session.scm (apropos-fold): Use a hash table instead of a
vector for the completions.
Andy Wingo [Fri, 7 Jan 2011 17:31:36 +0000 (09:31 -0800)]
revert unfinished web.texi changes
These were prematurely committed in
17072fd2c6acad1d4f2b5c98eb0d62911ea07406.
Andy Wingo [Fri, 7 Jan 2011 17:08:58 +0000 (09:08 -0800)]
use scm_from_latin1_symboln for string literals and load-symbol
* libguile/bytevectors.c:
* libguile/eval.c:
* libguile/goops.c:
* libguile/i18n.c:
* libguile/load.c:
* libguile/memoize.c:
* libguile/modules.c:
* libguile/ports.c:
* libguile/print.c:
* libguile/procs.c:
* libguile/programs.c:
* libguile/read.c:
* libguile/script.c:
* libguile/srfi-14.c:
* libguile/stacks.c:
* libguile/strings.c:
* libguile/throw.c:
* libguile/vm.c: Use scm_from_latin1_symboln to make symbols from string
literals, because they aren't in the user's locale -- they are in
ASCII, and we can optimize this case.
* libguile/vm-i-loader.c: Also use scm_from_latin1_symboln when loading
narrow symbols.
Andy Wingo [Fri, 7 Jan 2011 17:03:12 +0000 (09:03 -0800)]
optimize scm_from_latin1_symboln
* libguile/symbols.c (lookup_interned_latin1_symbol): New helper.
(scm_from_latin1_symboln): Use lookup_interned_latin1_symbol, so we
avoid allocating a string in that case.
Andy Wingo [Fri, 7 Jan 2011 16:42:15 +0000 (08:42 -0800)]
lookup_interned_symbol uses get_handle_by_hash
* libguile/symbols.c (lookup_interned_symbol): Change to use
scm_hash_fn_get_handle_by_hash.
Andy Wingo [Fri, 7 Jan 2011 16:36:39 +0000 (08:36 -0800)]
add scm_hash_fn_get_handle_by_hash
* libguile/hashtab.h:
* libguile/hashtab.c (scm_hash_fn_get_handle_by_hash): New internal
procedure, which should make symbol table lookup faster.
Andy Wingo [Fri, 7 Jan 2011 15:44:27 +0000 (07:44 -0800)]
remove vector hash table code
* libguile/hashtab.c: Remove deprecated hash-tables-as-vectors support
code.
Andy Wingo [Fri, 7 Jan 2011 00:20:54 +0000 (16:20 -0800)]
hashtab cleanups
* libguile/hashtab.c: Update comments.
(hashtable_size): Allow bigger vectors on 64-bit machines.
Andy Wingo [Thu, 6 Jan 2011 04:15:11 +0000 (20:15 -0800)]
fix symbol garbage collection
* libguile/symbols.c (lookup_interned_symbol, intern_symbol): Refactor
to use hashtab.[ch] interfaces.
Andy Wingo [Thu, 6 Jan 2011 02:43:28 +0000 (18:43 -0800)]
add hash functions for locale, latin1, and utf8 strings
* libguile/hash.c (scm_i_locale_string_hash)
(scm_i_latin1_string_hash, scm_i_utf8_string_hash): New functions.
Andy Wingo [Thu, 6 Jan 2011 00:40:22 +0000 (16:40 -0800)]
multibyte regex error handling fix
* libguile/regex-posix.c (fixup_multibyte_match): Fix mbrlen error
handling.
Andy Wingo [Thu, 6 Jan 2011 00:32:48 +0000 (16:32 -0800)]
hash.c cleanup
* libguile/hash.c (scm_hasher): Remove needless remember_upto_here.
Andy Wingo [Thu, 6 Jan 2011 00:24:32 +0000 (18:24 -0600)]
add scm_from_{latin1,utf8}_symbol{n,}
* libguile/symbols.c (scm_from_latin1_symbol, scm_from_latin1_symboln)
(scm_from_utf8_symbol, scm_from_utf8_symboln): New functions.
Andy Wingo [Thu, 6 Jan 2011 00:21:54 +0000 (18:21 -0600)]
add scm_{to,from}_{utf8,latin1}_string{n,}
* libguile/strings.h:
* libguile/strings.c (scm_from_latin1_string, scm_to_latin1_string): New
functions, in terms of the latin1_stringn variants.
(scm_from_utf8_string, scm_from_utf8_stringn)
(scm_to_utf8_string, scm_to_utf8_stringn): New functions.
(scm_i_from_utf8_string, scm_i_to_utf8_string): Removed these internal
functions.
(scm_from_stringn): Handle -1 as a length. Unlike the previous
behavior of scm_from_locale_string (NULL), which returned the empty
string, we now raise an error. The null pointer is not the same as
the empty string.
* libguile/stime.c (scm_strftime, scm_strptime): Adapt to publishing of
utf8 functions.
Andy Wingo [Sun, 2 Jan 2011 17:42:25 +0000 (12:42 -0500)]
read-header returns EOF at end, update (web http) docs
* doc/ref/web.texi (HTTP): Add an example for declaring a header, and
adapt to read-header change.
* module/web/http.scm (read-header): Return EOF for both values if there
are no more headers, instead of #f.
(read-headers): Adapt.
Andy Wingo [Sun, 2 Jan 2011 15:16:57 +0000 (10:16 -0500)]
update URI documentation
* doc/ref/web.texi (Types and the Web): Fix spacing.
(URIs): Give default values, and clarify a number of procedure docs.
Update "encoding" name, and string->uri name.
Andy Wingo [Sun, 2 Jan 2011 15:07:54 +0000 (10:07 -0500)]
uri-encode fast path
* module/web/uri.scm (uri-encode): Add a fast-path for the common case
in which the string does not contain any reserved characters.
Andy Wingo [Sun, 2 Jan 2011 14:41:14 +0000 (09:41 -0500)]
uri-decode #:encoding, not #:charset
* module/web/uri.scm (call-with-encoded-output-string, encode-string)
(decode-string, uri-decode, uri-encode): Change all instances of
"charset" to "encoding", as variables and arguments.
Andy Wingo [Fri, 31 Dec 2010 17:44:11 +0000 (12:44 -0500)]
rename string->uri and uri->string.
* module/web/uri.scm (string->uri, uri->string): Rename from parse-uri
and unparse-uri.
* test-suite/tests/web-uri.test:
* module/web/http.scm: All callers changed.
Andy Wingo [Fri, 31 Dec 2010 16:53:14 +0000 (11:53 -0500)]
clarify uri fragment discussion
* doc/ref/web.texi (URIs): Clarify the discussion of URI fragments.