Ludovic Courtès [Sat, 21 Apr 2012 21:08:49 +0000 (23:08 +0200)]
Fix and clarify documentation of `sorted?'.
Fixed <http://bugs.gnu.org/11262>.
Reported by Alexei Matveev <alexei.matveev@gmail.com>.
* libguile/sort.c (scm_sorted_p): Fix and clarify docstring.
* doc/ref/api-utility.texi (Sorting): Update accordingly.
Ludovic Courtès [Sat, 21 Apr 2012 21:08:49 +0000 (23:08 +0200)]
Remove duplicate test in `tree-il.test'.
* test-suite/tests/tree-il.test ("partial evaluation"): Remove duplicate
test for `(cons 0 (cons 1 (cons 2 (list 3 4 5))))'.
Ludovic Courtès [Thu, 12 Apr 2012 21:16:48 +0000 (23:16 +0200)]
Avoid use of `GC_PTR' in "smob.h".
Commit
c46fee438cf9f4a3449e8d04e7a54805517fd092 removed the "bdw-gc.h"
include from "smob.h", so better avoid `GC_PTR'.
* libguile/smob.c (scm_i_finalize_smob): Use `void *' instead of `GC_PTR'.
* libguile/smob.h (scm_i_finalize_smob): Update declaration accordingly.
Ludovic Courtès [Mon, 9 Apr 2012 22:17:39 +0000 (00:17 +0200)]
SRFI-9: Set the `record-constructor' slot of the RTD.
Fixed <http://bugs.gnu.org/11196>.
Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>.
* module/srfi/srfi-9.scm (define-record-type): Define the contructor
before TYPE-NAME. Set RTD's constructor field.
* test-suite/tests/srfi-9.test ("record compatibility"): New test
prefix.
Mark H Weaver [Wed, 4 Apr 2012 22:58:44 +0000 (18:58 -0400)]
Fix scm_to_utf8_stringn once and for all; optimize; add tests
* libguile/strings.c (scm_to_utf8_stringn): Fix another new bug in this
recent comedy of errors: pass the size of the preallocated buffer to
u32_to_u8. Arrange to call 'scm_i_string_wide_chars' and
'scm_i_string_length' only once each. Rename local variables for
improved code clarity.
* test-suite/standalone/test-conversion.c (test_to_utf8_stringn): New
function to test scm_to_utf8_stringn.
Mark H Weaver [Tue, 3 Apr 2012 13:50:20 +0000 (09:50 -0400)]
Fix scm_to_utf8_stringn to NUL-terminate properly
* libguile/strings.c (scm_to_utf8_stringn): NUL-terminate using the
correct pointer.
Mark H Weaver [Mon, 2 Apr 2012 22:55:45 +0000 (18:55 -0400)]
Fix scm_to_utf8_stringn to return the length in bytes, et al
* libguile/strings.c (u32_u8_length_in_bytes): Internal static function
renamed from u32_u8_strlen, whose name was potentially confusing. For
added safety, handle everything that can be encoded in the more
general UTF-8 encoding: up to six bytes for each code point, with code
points up to 2^31-1.
(scm_to_utf8_stringn): NUL-terminate only if (lenp == NULL).
If (lenp != NULL) return the length in bytes in *lenp.
Andy Wingo [Sun, 1 Apr 2012 18:29:41 +0000 (11:29 -0700)]
fix scm_to_utf8_stringn for wide strings to NUL-append the strings
* libguile/strings.c (u32_u8_strlen, scm_to_utf8_stringn): Sigh, fix the
u32-to-u8 optimization to ensure that the utf8 string is
NUL-terminated.
BT Templeton [Sat, 10 Mar 2012 08:31:58 +0000 (03:31 -0500)]
primitive resolution for public refs
* module/language/tree-il/primitives.scm (resolve-primitives!): Resolve
public module-refs to primitives.
* test-suite/tests/tree-il.test: New tests for primitive resolution.
Andy Wingo [Sun, 11 Mar 2012 09:57:05 +0000 (10:57 +0100)]
add bad-request printer
* module/web/request.scm (bad-request-printer): Add printer for these
exceptions.
Andy Wingo [Sun, 11 Mar 2012 09:24:08 +0000 (10:24 +0100)]
add exception printers for bad-header, bad-header-component
* module/web/http.scm (bad-header-component): Throw
'bad-header-component instead of 'bad-header.
(bad-header-printer, bad-header-component-printer): Add exception
printers.
Andy Wingo [Wed, 7 Mar 2012 11:39:30 +0000 (12:39 +0100)]
micro-optimizations to string-trim-both, and to (web http)
* libguile/srfi-13.c (scm_string_trim, scm_string_trim_right)
(scm_string_trim_both): Take the whitespace fast-path if the char_pred
is scm_char_set_whitespace.
* module/web/http.scm (read-header, split-and-trim, parse-quality-list):
(parse-param-component, parse-credentials, "Content-Type"):
(read-request-line, read-response-line): Use char-set:whitespace
instead of char-whitespace?. It avoids recursing into the VM.
Andy Wingo [Sun, 18 Mar 2012 19:04:28 +0000 (20:04 +0100)]
make applicable smob calls cheaper, and fix a memory leak
* libguile/vm.c (prepare_smob_call): New helper. Now, instead of making
a per-smob trampoline, we will shuffle the smob into the args and use
a gsubr. This prevents a memory leak in which the trampolines, which
were values in a weak-key table, were preventing the smobs from being
collected.
* libguile/vm-i-system.c (call, tail-call, mv-call): Adapt to new smob
application mechanism.
(smob-call): Remove this instruction.
* libguile/smob.h (scm_smob_descriptor): Rename apply_trampoline_objcode
to apply_trampoline.
* libguile/smob.c: Remove our own objcode trampolines in favor of using
scm_c_make_gsubr.
(scm_smob_prehistory): No more trampoline weak map.
* libguile/procprop.c (scm_i_procedure_arity): Adapt to applicable smob
representation change.
Andy Wingo [Mon, 12 Mar 2012 15:58:15 +0000 (16:58 +0100)]
web http: fix Ma -> Mar
* module/web/http.scm (write-date): Fix serialization of Mar. Oops.
Andy Wingo [Sun, 11 Mar 2012 09:29:06 +0000 (10:29 +0100)]
web server http: 400 Bad Request on bad requests
* module/web/server/http.scm (bad-request, http-read): If an exception
is raised while reading a response, write out a 400 Bad Request
response before closing the port.
Andy Wingo [Thu, 8 Mar 2012 22:50:41 +0000 (23:50 +0100)]
more libgc 7.1 compat
* configure.ac:
* libguile/gc.c (GC_set_finalize_on_demand): Check for this function,
and shim if it isn't present.
Andy Wingo [Fri, 24 Feb 2012 12:18:48 +0000 (13:18 +0100)]
run finalizers asynchronously in asyncs
* libguile/finalizers.c: New excitement! We'll be running finalizers
asynchronously, from asyncs. This will make it safer to allocate
while holding a mutex.
(GC_set_finalizer_notifier): Add back-compat shim.
* libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism
during boot.
* libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing
on demand.
(scm_gc): Explicitly run finalizers here.
* libguile/threads.c (guilify_self_2): Run finalizers here if
queue_finalizer_async happened to run during guilify_self_1.
* configure.ac: Add check for GC_set_finalizer_notifier.
Andy Wingo [Sun, 19 Feb 2012 11:23:29 +0000 (12:23 +0100)]
use the new finalizer helpers
* libguile/foreign.c (scm_set_pointer_finalizer_x)
* libguile/ports.c (finalize_port)
* libguile/smob.c (scm_i_new_smob, scm_i_new_double_smob)
* libguile/struct.c (scm_i_alloc_struct)
* libguile/numbers.c (make_bignum): Use the new API.
Andy Wingo [Sun, 19 Feb 2012 11:22:12 +0000 (12:22 +0100)]
add scm_i_set_finalizer, scm_i_add_finalizer, scm_i_add_resuscitator
* libguile/finalizers.h:
* libguile/finalizers.c: New files.
* libguile.h:
* libguile/Makefile.am: Add to build.
Andy Wingo [Thu, 26 May 2011 14:49:47 +0000 (16:49 +0200)]
scm_new_smob, scm_new_double_smob inline functions
* libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors,
which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline
functions instead of macros. They also bail to scm_i_new_smob /
scm_i_new_double_smob in either the mark or the free case, so that the
inline definition doesn't reference other internal details like libgc
stuff.
(SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see
them as already being declared.
(SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2):
(SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new
inline functions.
Remove now-unneeded bdw-gc include.
* libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and
make static.
(scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators.
(scm_i_finalize_smob, scm_i_new_smob_with_mark_proc): Add
back-compatibility shims to preserve ABI.
* libguile/inline.c: Include smob.h, so as to reify scm_new_smob and
scm_new_double_smob.
Andy Wingo [Thu, 26 May 2011 14:08:02 +0000 (16:08 +0200)]
scm_cell, scm_double_cell, scm_words back to gc.h
* libguile/inline.h:
* libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move
declarations and definitions back here, from inline.h. It's more
natural.
* libguile/inline.c: Include gc.h as well.
Andy Wingo [Thu, 26 May 2011 13:53:02 +0000 (15:53 +0200)]
simplify inline function infrastructure
* libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here,
from inline.h. We'd like to support inline function definitions in
more header files: not just inline.h.
(SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New
definitions.
* libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these
wrappers, which redirect to the GC_MALLOC macros when building Guile,
and the scm_gc_malloc functions otherwise. A step towards getting
BDW-GC out of Guile's API.
* libguile/inline.h: Simplify, using SCM_INLINE,
SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES. Also use the
new SCM_GC_MALLOC macros.
Ian Price [Fri, 27 Jan 2012 06:38:09 +0000 (06:38 +0000)]
Fix flush on soft ports, so that it actually runs.
* libguile/vports.c (sf_flush): Remove conditional testing the
position in the port's write_buf, as it is no longer used.
Ludovic Courtès [Wed, 7 Mar 2012 20:57:58 +0000 (21:57 +0100)]
Improve port benchmark.
* benchmark-suite/benchmarks/ports.bm (sequence): New macro, formerly
local to the "rdelim" benchmark prefix.
(large-string): New procedure.
(%latin1-port, %utf8/ascii-port, %utf8/wide-port): Use it.
("peek-char", "char-ready?", "read-char"): Use `sequence'.
Giuseppe Scrivano [Tue, 21 Feb 2012 14:55:44 +0000 (15:55 +0100)]
Fix a segfault when /dev/urandom is not accessible
* libguile/init.c (scm_i_init_guile): Call `scm_init_random' before
`scm_init_macros'.
Andy Wingo [Mon, 5 Mar 2012 22:52:00 +0000 (23:52 +0100)]
deprecate close-io-port
* module/ice-9/r4rs.scm:
* module/ice-9/deprecated.scm (close-io-port): Deprecate.
Mark H Weaver [Mon, 5 Mar 2012 03:47:04 +0000 (22:47 -0500)]
Don't call SYMBOL_STRINGBUF on a string
* libguile/strings.c (scm_i_make_symbol): Use STRING_STRINGBUF
instead of SYMBOL_STRINGBUF to get the stringbuf of a string.
Mark H Weaver [Mon, 5 Mar 2012 03:12:48 +0000 (22:12 -0500)]
Remove documentation of internal static string comparison functions
* doc/ref/api-data.texi (String Comparison): Remove documentation for
scm_i_string{,_ci}_{equal,less,leq,gr,geq}_p, which are not only
internal functions but static, and thus unusable by external code.
Mark H Weaver [Sun, 4 Mar 2012 17:01:10 +0000 (12:01 -0500)]
Comment out unused definitions of 'do' and 'case' in psyntax.scm
* module/ice-9/psyntax.scm (do, case): Comment out these definitions,
which are never used and immediately replaced by definitions in
boot-9.scm.
* module/ice-9/psyntax-pp.scm: Regenerate.
Mark H Weaver [Sun, 4 Mar 2012 16:53:23 +0000 (11:53 -0500)]
Fix syntax wrap comments; remove old unused cruft
* module/ice-9/psyntax.scm (subst-rename?, rename-old, rename-new,
rename-marks, make-rename): Remove these unused syntax rules.
Fix description of syntax wraps to match current reality.
Mark H Weaver [Fri, 2 Mar 2012 23:40:43 +0000 (18:40 -0500)]
Minimize size of embedded syntax objects in psyntax-pp.scm
* module/ice-9/compile-psyntax.scm: Minimize syntax object literals
embedded in psyntax-pp.scm.
* module/ice-9/psyntax.scm: Rename a few variables so that syntax
objects embedded in macros have no lexical bindings, so that their
minimized syntax objects will have no embedded labels. These labels
were the last remaining gensym counters in psyntax-pp.scm.
* module/ice-9/psyntax-pp.scm: Regenerate. It is now less than one
quarter of its previous size! More importantly, this file no longer
contains any gensym counters, which means that in the future, local
changes to psyntax.scm will usually result in only local changes to
psyntax-pp.scm.
Mark H Weaver [Thu, 1 Mar 2012 22:56:14 +0000 (17:56 -0500)]
tree-il->scheme improvements
* module/language/tree-il.scm (tree-il->scheme): New implementation that
simply calls 'decompile-tree-il'.
* module/language/scheme/decompile-tree-il.scm (choose-output-names,
do-decompile): New internal procedures.
(decompile-tree-il): New and improved implementation. Print source
identifiers where possible, otherwise add minimal numeric suffixes.
Previously we printed the gensyms. Avoid 'begin' in contexts that
provide an implicit 'begin'. Produce 'cond', 'case', 'and', 'or',
'let*', named let, and internal defines where appropriate. Recognize
keyword arguments in 'opts' to disable the production of these derived
syntactic forms, and to optionally strip numeric suffixes from
variable names.
* module/ice-9/compile-psyntax.scm: Disable partial evaluation, letrec
fixing, and primitive expansion when producing psyntax-pp.scm, in
order to produce output as close to the original source as practical.
Disable production of derived syntactic forms as needed during
bootstrap. Strip numeric suffixes from variable names. Adjust
pretty-printing parameters.
* module/ice-9/psyntax-pp.scm: Regenerate. It is now less than half
of the original size.
Mark H Weaver [Sun, 26 Feb 2012 20:58:30 +0000 (15:58 -0500)]
pretty-print: allow max-expr-width to be set; recognize more keywords
* module/ice-9/pretty-print.scm (pretty-print): Add new keyword argument
'#:max-expr-width'.
(generic-write): Add new argument 'max-expr-width'. Previously this
was internally defined to the constant value 50.
Mark H Weaver [Fri, 2 Mar 2012 22:54:23 +0000 (17:54 -0500)]
Fix typos in psyntax.scm
* module/ice-9/psyntax.scm (gen-syntax-case): #'pad --> #'pat
(define*): #'x --> #'id
* module/ice-9/psyntax-pp.scm: Regenerate
Andy Wingo [Fri, 2 Mar 2012 16:46:28 +0000 (17:46 +0100)]
tweaks to -Wformat's gettext detection
* module/language/tree-il/analyze.scm (proc-ref?): Change to use less
false-if-exception and more variable-bound?. If a variable is present
in the local module but not bound, assume that it is gettext if it has
the right name. This is to allow for (define _ gettext).
* test-suite/tests/tree-il.test ("warnings"): Update (_ "foo") example.
Andy Wingo [Fri, 2 Mar 2012 14:51:05 +0000 (15:51 +0100)]
peval: inline applications of lambda to rest args
* module/language/tree-il/peval.scm (peval): Add optimization to
hoist the inner procedure out of e.g.
(lambda args (apply (lambda ...) args))
This commit restores the ability to detect escape-only prompts at
compile-time.
* test-suite/tests/tree-il.test: Update test for prompt with a lambda,
and add a specific test for lambda application.
Andy Wingo [Fri, 2 Mar 2012 15:39:56 +0000 (16:39 +0100)]
tree-il: fix `canonicalize!' for prompts
* module/language/tree-il/canonicalize.scm (canonicalize!): Fix a bug in
which the sense of `escape-only?' was reversed. We never saw this
though, because for other reasons, no prompts were being identified as
escape-only.
Andy Wingo [Fri, 2 Mar 2012 12:02:19 +0000 (13:02 +0100)]
more general treatment of call-with-prompt
* module/language/tree-il/primitives.scm (*primitive-expand-table*):
Don't limit the call-with-prompt to <prompt> transition to lambda
expressions. Instead we can lexically bind the handler, and rely on
peval to propagate a lambda expression.
Mark H Weaver [Sun, 26 Feb 2012 20:53:11 +0000 (15:53 -0500)]
pmatch: always wrap with let, even if the expression appears atomic
* module/system/base/pmatch.scm (pmatch): Always wrap with 'let', even
if the expression appears atomic, because in the presence of
'identifier-syntax', we cannot know what an atomic expression will
later expand to. Also use '#:export-syntax' instead of '#:export'
to export 'pmatch'.
Mark H Weaver [Thu, 1 Mar 2012 21:07:28 +0000 (16:07 -0500)]
Fix <TAG>vector-length when applied to other uniform vector types
* module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm
(define-bytevector-type): Fix definition of <TAG>vector-length when
applied to uniform vectors of different element sizes. Thanks to
Tobias Brandt <tob.brandt@googlemail.com> for reporting this bug.
* test-suite/tests/srfi-4.test: Add tests.
Ludovic Courtès [Sun, 26 Feb 2012 23:51:09 +0000 (00:51 +0100)]
Avoid failure when `format-analysis' stumbles upon unbound variables.
* module/language/tree-il/analyze.scm (proc-ref?): Wrap `variable-ref'
in `false-if-exception'.
* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
format string with forward declaration"): New test.
Andy Wingo [Fri, 24 Feb 2012 19:01:47 +0000 (20:01 +0100)]
srfi-18 test fix
* test-suite/tests/srfi-18.test: Enclose the tests in a begin instead of
an and. Before, they were not being run, for some reason I don't
fully understand.
Andy Wingo [Fri, 24 Feb 2012 18:58:45 +0000 (19:58 +0100)]
slight cleanup to run-test
* test-suite/lib.scm (run-test): Slight cleanup.
Andy Wingo [Thu, 23 Feb 2012 12:56:06 +0000 (13:56 +0100)]
rewrite open-process in C, for robustness
* libguile/posix.c (scm_open_process): Rewrite in C, so as to avoid
allocations and other calls that are not async-signal-safe.
(scm_init_popen, scm_init_posix): Register popen extension.
* module/ice-9/popen.scm: Load the popen extension, to get open-process.
Andy Wingo [Wed, 22 Feb 2012 19:40:55 +0000 (20:40 +0100)]
microoptimizations in (web uri)
* module/web/uri.scm (valid-host?): Micro-optimizations.
Andy Wingo [Wed, 22 Feb 2012 19:08:44 +0000 (20:08 +0100)]
add test for recent quick fix
* test-suite/tests/web-uri.test ("string->uri"): Add test for
string->uri with hosts beginning in digits.
Andy Wingo [Tue, 21 Feb 2012 16:50:55 +0000 (16:50 +0000)]
quick fix the quick fix
Andy Wingo [Tue, 21 Feb 2012 16:42:53 +0000 (16:42 +0000)]
quick fix to uri parser
* module/web/uri.scm: Quick fix to not throw an error on e.g.
http://2012.jsconf.us.
Ludovic Courtès [Sun, 19 Feb 2012 22:54:18 +0000 (23:54 +0100)]
Have `-Wformat' recognize `ngettext' calls.
* module/language/tree-il/analyze.scm (gettext?): Rename to...
(proc-ref?): ... this. Add `proc' and `special-name' parameters.
(gettext?): Define in terms of `proc-ref?'.
(ngettext?): New procedure.
(const-fmt): Recognize `ngettext' calls.
(format-analysis)[<down>](check-format-args]: Check
constant-but-non-string 2nd argument in the (not (const-fmt ...))
case.
[check-simple-format-args]: Use `const-fmt'.
* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
format string using ngettext", "non-literal format string using
ngettext as N_"): New tests.
("simple-format")["unsupported, ngettext"]: New test.
Ludovic Courtès [Sun, 19 Feb 2012 22:08:49 +0000 (23:08 +0100)]
Have `-Wformat' better recognize the `gettext' procedure.
Fixes <http://bugs.gnu.org/10846>.
Reported by Bruno Haible <bruno@clisp.org>.
* module/language/tree-il/analyze.scm (gettext?): New procedure.
(const-fmt): Add `env' parameter; update callers. Use `gettext?'.
(format-analysis)[check-simple-format-args]: Actually support
gettextized format strings.
* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
format string using gettext"): Use `gettext' as the procedure name.
("non-literal format string using gettext as _"): New test.
["simple-format"]("unsupported, gettext"): New test.
Ludovic Courtès [Fri, 17 Feb 2012 23:04:17 +0000 (00:04 +0100)]
Don't fail when locale env. vars specify a dot-less locale name.
Fixes <http://bugs.gnu.org/10742>.
Reported by Alírio Eyng <alirioeyng@ig.com.br>.
* gnulib-local/lib/localcharset.c.diff (environ_locale_charset): Change
to set CODESET to "" when LOCALE lacks a dot. Return "ISO-8859-1"
when CODESET is the empty string.
* lib/localcharset.c: Update.
* test-suite/standalone/Makefile.am (check_SCRIPTS): Add
`test-command-line-encoding2'.
(TESTS): Likewise.
* test-suite/standalone/test-command-line-encoding2: New file.
Mark H Weaver [Wed, 15 Feb 2012 17:23:12 +0000 (12:23 -0500)]
Add tests to verify that 'read' sets source properties when appropriate
* test-suite/tests/srcprop.test (source properties): Add tests.
Mark H Weaver [Wed, 15 Feb 2012 16:47:31 +0000 (11:47 -0500)]
Add support for source properties on non-immediate numbers
* libguile/read.c (scm_read_number): Set source properties on
non-immediate numbers if the 'positions' reader option is set.
* doc/ref/api-debug.texi (Source Properties): Update manual.
Mark H Weaver [Wed, 15 Feb 2012 04:22:51 +0000 (23:22 -0500)]
psyntax: access source properties for all supported objects
* module/ice-9/psyntax.scm (decorate-source): Set source properties on
any object that satisfies 'supports-source-properties?'. Previously
we used 'pair?' as the predicate.
(source-annotation): Apply 'source-properties' to _any_ kind of source
expression, where previously only pairs were queried. If the argument
is a syntax-object, apply the source-properties to the syntax-object's
expression.
In the peculiar case of a syntax-object whose expression is also a
syntax-object: previously we would iterate, but with this commit we
now call 'syntax-object-expression' only once.
* module/ice-9/psyntax-pp.scm: Regenerate.
Mark H Weaver [Tue, 14 Feb 2012 07:14:10 +0000 (02:14 -0500)]
Add 'supports-source-properties?' predicate
* libguile/srcprop.c (scm_supports_source_properties_p): New procedure.
(supports_source_props): New static C function.
* libguile/srcprop.h (scm_supports_source_properties_p): Add prototype.
* doc/ref/api-debug.texi (Source Properties): Add documentation.
Mark H Weaver [Tue, 14 Feb 2012 06:54:15 +0000 (01:54 -0500)]
Relax validation of source property accessors
* libguile/srcprop.c (scm_source_properties, scm_source_property,
scm_i_has_source_properties): Relax validation to allow _any_ object
to be queried for source properties.
Mark H Weaver [Wed, 15 Feb 2012 05:41:24 +0000 (00:41 -0500)]
syntax-violation: prefer 'subform' for source info, with 'form' as fallback
* module/ice-9/psyntax.scm (syntax-violation): Look for source
properties of 'subform' first. If 'subform' has none, 'form' is used.
Previously, the source information of 'form' was used unless 'form'
_itself_ was '#f', in which case 'subform' was used.
* module/ice-9/psyntax-pp.scm: Regenerate.
Mark H Weaver [Wed, 15 Feb 2012 05:17:18 +0000 (00:17 -0500)]
Fix psyntax bugs that would cause bad source annotations
* module/ice-9/psyntax.scm (rebuild-macro-output): Fix two bugs that
would cause bogus source properties to be added to vectors and
macro-introduced syntax objects. These bugs were masked by the
limitation that only pairs can be decorated with source properties.
Due to a typo, each vector in the macro output was decorated using the
vector itself as its source. Due to accidental variable capture, each
syntax-object introduced by the macro had its expression decorated
with its own wrap-subst.
* module/ice-9/psyntax-pp.scm: Regenerate.
Mark H Weaver [Mon, 13 Feb 2012 05:06:43 +0000 (00:06 -0500)]
Fix typo in comment in message.scm: 'know' to 'known' warning types
* module/system/base/message.scm (%warning-types): Fix typo.
Andy Wingo [Tue, 14 Feb 2012 16:32:16 +0000 (17:32 +0100)]
web server: fix spurious warning
* module/web/server.scm (sanitize-response): Quick fix to the
304-has-no-body sanitizer.
Mark H Weaver [Sun, 12 Feb 2012 22:05:28 +0000 (17:05 -0500)]
Fix manual: scm_foreign_to_bytevector to scm_pointer_to_bytevector
* doc/ref/api-foreign.texi (Void Pointers and Byte Access): Fix outdated
function name: scm_foreign_to_bytevector to scm_pointer_to_bytevector.
Andy Wingo [Sun, 12 Feb 2012 12:17:11 +0000 (13:17 +0100)]
web server: do not provide a response body where it is not permitted
* module/web/response.scm (response-must-not-include-body?): New
function.
* doc/ref/web.texi: Doc the function.
* module/web/server.scm (sanitize-response): Error if we have a body,
but the response type does not permit a body. If we are responding to
a HEAD request, silently drop the body.
Andy Wingo [Sat, 11 Feb 2012 17:27:56 +0000 (18:27 +0100)]
web server: print backtrace on errors when run in batch mode
* module/web/server.scm (read-client, handle-request, write-client):
When run in batch mode, give a full backtrace for errors.
Andy Wingo [Thu, 9 Feb 2012 22:15:25 +0000 (23:15 +0100)]
more efficient scm_string_to_utf8, scm_string_to_utf32
* libguile/bytevectors.c (scm_string_to_utf8): More efficient
implementation.
(scm_string_to_utf32): Likewise.
Andy Wingo [Thu, 9 Feb 2012 22:14:11 +0000 (23:14 +0100)]
more efficient scm_to_utf8_stringn, scm_to_utf32_stringn
* libguile/strings.c (scm_to_utf8_stringn): More efficient
implementation than calling scm_to_stringn.
(scm_to_utf32_stringn): Likewise.
Mark H Weaver [Wed, 8 Feb 2012 00:40:29 +0000 (19:40 -0500)]
Support => within case, and improve error messages for cond and case
* module/ice-9/boot-9.scm (cond, case): Reimplement using syntax-case,
with improved error messages and support for '=>' within 'case' as
mandated by the R7RS. Add warnings for duplicate case datums and
case datums that cannot be meaningfully compared using 'eqv?'.
* module/system/base/message.scm (%warning-types): Add 'bad-case-datum'
and 'duplicate-case-datum' warning types.
* test-suite/tests/syntax.test (cond, case): Update tests to reflect
improved error reporting. Add tests for '=>' within 'case'.
* test-suite/tests/tree-il.test (partial evaluation): Update tests to
reflect changes in how 'case' is expanded.
* doc/ref/api-control.texi (Conditionals): Document '=>' within 'case'.
Mark H Weaver [Wed, 8 Feb 2012 20:51:38 +0000 (15:51 -0500)]
Add source properties to many more types of data
* libguile/read.c (scm_read_array): New internal helper that
calls scm_i_read_array and sets its source property if the
'positions' reader option is set.
(scm_read_string): Set source properties on strings if the 'positions'
reader option is set.
(scm_read_vector, scm_read_srfi4_vector, scm_read_bytevector,
scm_read_guile_bitvector, scm_read_sharp): Add new arguments for the
'line' and 'column' of the first character of the datum being read.
Set source properties if the 'positions' reader option is set.
(scm_read_expression): Pass 'line' and 'column' to scm_read_sharp.
* doc/ref/api-debug.texi (Source Properties): Update manual.
Mark H Weaver [Wed, 8 Feb 2012 20:32:55 +0000 (15:32 -0500)]
Unoptimize 'read' to return freshly allocated empty strings
* libguile/read.c (scm_read_string): Return a freshly allocated string
every time, even for empty strings. The motivation is to allow source
properties to be added to all strings. Previously, the shared global
'scm_nullstr' was returned for empty strings. Note that empty strings
still share a common global 'null_stringbuf'.
* test-suite/tests/srfi-13.test (substring/shared): Fix tests to reflect
the fact that empty string literals are no longer guaranteed to be
'eq?' to each other.
Mark H Weaver [Wed, 8 Feb 2012 20:29:10 +0000 (15:29 -0500)]
Optimize empty substring case of scm_i_substring_copy
* libguile/strings.c (scm_i_substring_copy): When asked to create an
empty substring, use 'scm_i_make_string' to make use of its
optimization for empty strings that reuses the global null_stringbuf.
Mark H Weaver [Wed, 8 Feb 2012 08:10:11 +0000 (03:10 -0500)]
Add and use maybe_annotate_source helper in read.c
* libguile/read.c (maybe_annotate_source): New static helper function.
(scm_read_sexp, scm_read_quote, scm_read_syntax): Use
'maybe_annotate_source'.
Mark H Weaver [Wed, 8 Feb 2012 08:00:15 +0000 (03:00 -0500)]
Remove inline and register attributes from read.c
* libguile/read.c: Remove all 'inline' and 'register' attributes.
Mark H Weaver [Wed, 8 Feb 2012 08:14:17 +0000 (03:14 -0500)]
Remove incorrect comment in read.c
* libguile/read.c (scm_read_sharp): Remove incorrect comment that
claims that scm_read_boolean might return a SRFI-4 vector.
Andy Wingo [Wed, 8 Feb 2012 11:20:09 +0000 (12:20 +0100)]
i18: avoid freelocale (NULL)
* libguile/i18n.c (smob_locale_free): Don't freelocale (NULL).
Andy Wingo [Sun, 5 Feb 2012 14:55:09 +0000 (15:55 +0100)]
Fix --enable-debug-malloc
* libguile/gc-malloc.c (do_realloc, do_calloc, do_gc_malloc)
(do_gc_malloc_atomic, do_gc_realloc, do_gc_free): Wrap the allocators
in helper methods. The non-GC allocators call
scm_gc_register_allocation, and the GC allocators ensure that
gc_malloc returns a nonzero value.
(scm_realloc, scm_calloc): Allow NULL return for malloc(0). It is
permitted by POSIX. Don't wrap in a SCM_SYSCALL; the only possible
errno is ENOMEM.
(scm_gc_malloc_pointerless, scm_gc_malloc, scm_gc_calloc):
(scm_gc_realloc, scm_gc_free, scm_gc_strndump): Use the wrappers.
Don't call the debug-malloc registrations and deregistrations, as it
is neither mandatory nor advised to call scm_gc_free. Fixes
compilation with debug-malloc.
(scm_must_free): Don't scm_malloc_unregister.
Ludovic Courtès [Sat, 4 Feb 2012 22:38:47 +0000 (23:38 +0100)]
i18n: Skips ~h `format' tests when digit grouping info is missing.
* test-suite/tests/i18n.test ("format ~h"): Skip tests when
`locale-digit-grouping' returns '().
Andy Wingo [Fri, 3 Feb 2012 15:22:50 +0000 (16:22 +0100)]
fix check for when libc already has clock_gettime / clock_getcpuclockid
* acinclude.m4 (gl_CLOCK_TIME): If both clock_gettime and
clock_getcpuclockid are present without -lrt and -lposix4, don't add
any libs to LIB_CLOCK_GETTIME. Thanks to taylanbarirli@gmail.com.
Bake Timmons [Mon, 16 Jan 2012 03:18:08 +0000 (22:18 -0500)]
Improve consistency of definitions of C functions in manual.
* doc/ref/api-compound.texi
* doc/ref/api-evaluation.texi
* doc/ref/api-foreign.texi
* doc/ref/api-io.texi
* doc/ref/posix.texi
* doc/ref/srfi-modules.texi: Add missing parentheses and commas to definitions
of C functions.
* doc/ref/api-data.texi: Change from @deffn to @deftypefn for C function
with arguments not of SCM type.
Andy Wingo [Fri, 3 Feb 2012 12:57:32 +0000 (13:57 +0100)]
fix compilation of control.c, continuations.c when SCM_ALIGNED is not defined
* libguile/control.c:
* libguile/continuations.c: Fix for the case in which SCM_ALIGNED is not
defined. Though I wonder, perhaps we should just error out in those
cases.
Bake Timmons [Sun, 15 Jan 2012 15:56:53 +0000 (10:56 -0500)]
Make notation for Scheme repeated arguments more consistent in manual.
* doc/ref/api-compound.texi
* doc/ref/api-control.texi
* doc/ref/api-data.texi
* doc/ref/api-debug.texi
* doc/ref/api-evaluation.texi
* doc/ref/api-macros.texi
* doc/ref/api-memory.texi
* doc/ref/api-modules.texi
* doc/ref/api-procedures.texi
* doc/ref/api-regex.texi
* doc/ref/api-scheduling.texi
* doc/ref/api-utility.texi
* doc/ref/goops.texi
* doc/ref/match.texi
* doc/ref/misc-modules.texi
* doc/ref/posix.texi
* doc/ref/r6rs.texi
* doc/ref/scheme-using.texi
* doc/ref/srfi-modules.texi
* doc/ref/sxml-match.texi: Make notation for Scheme repeated arguments more
consistent in manual.
Ludovic Courtès [Fri, 3 Feb 2012 19:11:00 +0000 (20:11 +0100)]
i18n: Provide default values for when Gnulib has no replacement.
This reverts parts of
a0919aefee7512686c3374876df2c549fd47e071 ("i18n:
Use Gnulib's `nl_langinfo' module.").
* module/ice-9/i18n.scm (define-simple-langinfo-mapping): Re-add
`default' parameter, and update users accordingly.
Ludovic Courtès [Fri, 3 Feb 2012 15:52:15 +0000 (16:52 +0100)]
Augment `-Wformat' analysis with support for `~:h'.
* module/language/tree-il/analyze.scm (format-string-argument-count):
Add support for ~h.
* test-suite/tests/tree-il.test ("warnings")["format"]("~h", "~:h with
locale object", "~:h without locale object"): New tests.
Ludovic Courtès [Fri, 3 Feb 2012 15:35:06 +0000 (16:35 +0100)]
format: Add specifier ~h for localized number output.
* doc/ref/misc-modules.texi (Formatted Output): Document ~h. Recommend
use of ~h instead of ~:d.
* module/ice-9/format.scm (format): Add support for ~h.
* test-suite/tests/format.test ("~h localized number"): New test prefix.
* test-suite/tests/i18n.test (%american-english-locale-name,
%american-english-locale): New variables.
(under-american-english-locale-or-unresolved): New procedure.
("format ~h"): New test prefix.
Ludovic Courtès [Fri, 3 Feb 2012 13:31:17 +0000 (14:31 +0100)]
i18n: Add a couple of tests for `monetary-amount->locale-string'.
* test-suite/tests/i18n.test ("monetary-amount->locale-string"): New
test prefix.
Ludovic Courtès [Fri, 3 Feb 2012 13:05:31 +0000 (14:05 +0100)]
i18n: Use Gnulib's `nl_langinfo' module.
* configure.ac: Remove checks for <langinfo.h> and <nl_types.h>, and
`nl_langinfo'.
* libguile/i18n.c: Remove #ifdefs for HAVE_LANGINFO_H, HAVE_NL_TYPES_H,
HAVE_NL_ITEM, and HAVE_LANGINFO_CODESET.
(SCM_VALIDATE_OPTIONAL_LOCALE_COPY): Use `SCM_UNBNDP'.
* m4/gnulib-cache.m4 (gl_MODULES): Add `nl_langinfo'.
* module/ice-9/i18n.scm (define-vector-langinfo-mapping): Remove
`defaults' parameter; assume (provided? 'nl-langinfo) is always true.
Update users accordingly.
(define-simple-langinfo-mapping): Likewise.
(define-monetary-langinfo-mapping): Likewise, but do not assume
LOCAL-ITEM and INTL-ITEM are always defined.
Ludovic Courtès [Fri, 3 Feb 2012 09:51:46 +0000 (10:51 +0100)]
Use Gnulib's `regex' module.
This should help with regex portability, as reported in
<http://bugs.gnu.org/10684> for Darwin 8.11.
* m4/gnulib-cache.m4 (gl_MODULES): Add `regex'.
* configure.ac: Remove header checks for regex.h, rxposix.h, and
rx/rxposix.h. Remove check for the `regcomp' function. Remove
definition of `HAVE_REGCOMP'. Define `ENABLE_REGEX'.
* libguile/init.c: Check for `ENABLE_REGEX' instead of `HAVE_REGCOMP'.
* libguile/regex-posix.c: Always include <regex.h>. Remove #ifdefs for
rxposix.h and co.
Ludovic Courtès [Fri, 3 Feb 2012 09:30:52 +0000 (10:30 +0100)]
tests: Have `getaddrinfo' test work for Darwin 8.
* doc/ref/posix.texi (Network Databases): Update description of
`EAI_NODATA' to mention that Darwin provides it.
* libguile/net_db.c (scm_getaddrinfo): Likewise.
* test-suite/tests/net-db.test ("getaddrinfo")["wrong service name"]:
Accept `EAI_NODATA' too. Reported by David Fang <fang@csl.cornell.edu>,
see <http://bugs.gnu.org/10684>.
Ludovic Courtès [Fri, 3 Feb 2012 09:17:12 +0000 (10:17 +0100)]
tests: Work around erroneous tr_TR locale in Darwin 8.
* test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved):
Add exception for Darwin 8. Reported by David Fang <fang@csl.cornell.edu>,
see <http://bugs.gnu.org/10684>.
Mike Gran [Fri, 3 Feb 2012 03:50:07 +0000 (19:50 -0800)]
Update srfi-14 test for Unicode 6.1
Some Latin-1 symbols have been reclassified as punctuation
* test-suite/tests/srfi-14.test: updated
Mark H Weaver [Thu, 2 Feb 2012 22:23:35 +0000 (17:23 -0500)]
Implement scm_to_pointer
* libguile/foreign.c, libguile/foreign.h (scm_to_pointer):
New C function.
* test-suite/standalone/test-loose-ends.c: Add test.
Andy Wingo [Thu, 2 Feb 2012 22:38:01 +0000 (23:38 +0100)]
revert r5rs changes
* doc/r5rs/r5rs.texi: Reverts the recent changes to r5rs.texi.
Ludovic Courtès [Thu, 2 Feb 2012 20:58:04 +0000 (21:58 +0100)]
Fix `SCM_I_ERROR' definition for MinGW without networking.
* libguile/error.c (SCM_I_ERROR)[__MINGW32__]: Conditionalize on
`HAVE_NETWORKING'.
Bake Timmons [Thu, 12 Jan 2012 15:45:28 +0000 (10:45 -0500)]
Fix case in identifiers starting sentences in doc/r5rs/r5rs.texi
* doc/r5rs/r5rs.texi: Use proper case of characters in identifiers starting
sentences.
Bake Timmons [Thu, 12 Jan 2012 04:55:18 +0000 (23:55 -0500)]
Improve the usage of variable names in Scheme docstrings.
* module/ice-9/boot-9.scm:
* module/ice-9/popen.scm:
* module/ice-9/pretty-print.scm:
* module/ice-9/r4rs.scm:
* module/rnrs/io/ports.scm:
* module/texinfo/string-utils.scm:
* module/web/http.scm:
* module/web/request.scm:
* module/web/response.scm:
* test-suite/vm/run-vm-tests.scm: Make the variable names in Scheme docstrings more
consistent. Replace a few instances of @var with @code when appropriate.
Bake Timmons [Thu, 12 Jan 2012 04:33:01 +0000 (23:33 -0500)]
Improve the usage of variable names in C docstrings.
* libguile/alist.c:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/bitvectors.c:
* libguile/filesys.c:
* libguile/foreign.c:
* libguile/generalized-arrays.c:
* libguile/hashtab.c:
* libguile/ioext.c:
* libguile/load.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/procprop.c:
* libguile/promises.c:
* libguile/simpos.c:
* libguile/socket.c:
* libguile/srfi-1.c:
* libguile/srfi-13.c:
* libguile/srfi-14.c:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/struct.c:
* libguile/symbols.c:
* libguile/threads.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Make the variable names in the C docstrings more
consistent. Replace a few instances of @var with @code when appropriate.
Andy Wingo [Thu, 2 Feb 2012 11:16:30 +0000 (12:16 +0100)]
Remove unused doc/sources/
* doc/sources: Remove. It is not used at all, presumably because all it
had to offer was already incorporated in the manual.
Bake Timmons [Wed, 11 Jan 2012 17:02:57 +0000 (12:02 -0500)]
Make consistent the usage of variable names in the function definitions found in the Texinfo docs.
* doc/r5rs/r5rs.texi:
* doc/ref/api-compound.texi:
* doc/ref/api-data.texi:
* doc/ref/api-debug.texi:
* doc/ref/api-evaluation.texi:
* doc/ref/api-io.texi:
* doc/ref/api-modules.texi:
* doc/ref/api-procedures.texi:
* doc/ref/api-scheduling.texi:
* doc/ref/api-smobs.texi:
* doc/ref/compiler.texi:
* doc/ref/misc-modules.texi:
* doc/ref/posix.texi:
* doc/ref/scheme-using.texi:
* doc/ref/srfi-modules.texi:
* doc/ref/vm.texi:
* doc/ref/web.texi:
* doc/sources/env.texi: Make usage of variable names of function definitions
more consistent.
Bake Timmons [Wed, 11 Jan 2012 14:30:57 +0000 (09:30 -0500)]
Fix unbalanced parentheses in docs.
* doc/ref/sxml-match.texi (sxml-match-let, sxml-match-let*): Remove
extraneous parenthesis at end of Texinfo function definition header.
Mike Gran [Thu, 2 Feb 2012 03:51:35 +0000 (19:51 -0800)]
Update srfi-14 character sets to Unicode 6.1
* libguile/srfi-14.i.c (cs_lower_case_ranges, cs_lower_case)
(cs_upper_case_ranges, cs_upper_case, cs_letter_ranges, cs_letter)
(cs_digit_ranges, cs_digit, cs_letter_plus_digit_ranges, cs_letter_plus_digit)
(cs_graphic_ranges, cs_graphic, cs_printing_ranges, cs_printing)
(cs_punctuation_ranges, cs_punctuation, cs_symbol_ranges, cs_symbol)
(cs_designated_ranges, cs_designated): modified
* doc/ref/api-data.texi: modified
Mark H Weaver [Wed, 1 Feb 2012 21:35:32 +0000 (16:35 -0500)]
Fix search_path to fill stat_buf when given an absolute pathname
* libguile/load.c (search_path): When the provided 'filename' is an
absolute pathname, perform a 'stat' on that pathname to fill the
'stat_buf'. Previously, 'stat_buf' was left uninitialized in this
case, even though 'scm_primitive_load_path' assumes that 'stat_buf'
will be filled. Update the header comment to explicitly specify that
'stat_buf' will be filled. Also 'goto end' in a few failure cases
instead of replicating its code.
Andy Wingo [Wed, 1 Feb 2012 23:10:11 +0000 (00:10 +0100)]
leniency in the "unused modules are removed" gc.test
* libguile/foreign.h: Remove comment about the finalizer bit, as I don't
think that is the case any more.
* test-suite/tests/gc.test: Ignore flakiness in the gc-modules test.