summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-02-18Don't fail when locale env. vars specify a dot-less locale name.Ludovic Courtès4-32/+52
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.
2012-02-17wrap iconv_open / iconv_close with a lock to help in thread/fork issuesAndy Wingo4-1/+45
* libguile/bytevectors.c (STRING_TO_UTF, scm_string_to_utf8) (UTF_TO_STRING): * libguile/ports.c (open_iconv_descriptors, close_iconv_descriptors): * libguile/strings.c (scm_from_stringn, scm_to_stringn): Wrap operations that acquire and destroy iconv contexts with a mutex. While iconv is threadsafe, internally it uses a lock, and we need to make sure when we fork() that no one has that lock -- so we surround it with another one. Gross.
2012-02-17install pthread_atfork handlers for guile's static mutexenAndy Wingo9-5/+16
* libguile/async.c: * libguile/deprecation.c: * libguile/fluids.c: * libguile/gc.c: * libguile/instructions.c: * libguile/ports.c: * libguile/posix.c: * libguile/strings.c: * libguile/threads.c: Use the SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX mechanism to lock a number of static mutexen.
2012-02-17add pthread_atfork helpers to our threading shimsAndy Wingo3-3/+18
* libguile/null-threads.h: * libguile/pthread-threads.h (SCM_DEFINE_ATFORK_HANDLERS_FOR_MUTEX) (scm_i_pthread_atfork): Define a pthread_atfork shim, and a helper to declare procedures to lock and unlock a mutex. * libguile/threads.h (SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX): New macro, causes the snarfer to emit a pthread_atfork call to lock a mutex, if threads are enabled.
2012-02-17with a threaded guile, lock weak sets and tables during a forkAndy Wingo4-28/+194
* libguile/weak-set.c (make_weak_set): * libguile/weak-table.c (make_weak_table): If we have a threaded Guile, * keep a weak set (table) of weak sets (tables). Use this and the pthread_atfork mechanism to lock and unlock weak sets and weak tables during a fork(). * libguile/weak-set.h (scm_weak_set_prehistory): New internal API. * libguile/init.c: Add call to scm_weak_set_prehistory().
2012-02-17Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo7-9114/+10895
Conflicts: libguile/read.c libguile/srcprop.c module/ice-9/psyntax-pp.scm
2012-02-15remove deprecated features testAndy Wingo1-7/+1
* test-suite/tests/procprop.test ("procedure-arity"): Remove a test of deprecated features.
2012-02-15Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo4-8689/+8712
Conflicts: module/ice-9/psyntax-pp.scm
2012-02-15Add tests to verify that 'read' sets source properties when appropriateMark H Weaver1-6/+42
* test-suite/tests/srcprop.test (source properties): Add tests.
2012-02-15Add support for source properties on non-immediate numbersMark H Weaver2-3/+9
* 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.
2012-02-15psyntax: access source properties for all supported objectsMark H Weaver2-6372/+6438
* 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.
2012-02-15Add 'supports-source-properties?' predicateMark H Weaver3-1/+27
* 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.
2012-02-15Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+1
2012-02-15Relax validation of source property accessorsMark H Weaver1-38/+50
* 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.
2012-02-15syntax-violation: prefer 'subform' for source info, with 'form' as fallbackMark H Weaver2-11417/+11371
* 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.
2012-02-15Fix psyntax bugs that would cause bad source annotationsMark H Weaver2-6563/+6585
* 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.
2012-02-14Fix typo in comment in message.scm: 'know' to 'known' warning typesMark H Weaver1-1/+1
* module/system/base/message.scm (%warning-types): Fix typo.
2012-02-14better handling for exceptions in close-port and port finalizersAndy Wingo2-37/+59
* libguile/fports.c (close_the_fd, fport_close): Arrange to always close the fd, even if the flush procedure throws an exception. Perhaps the port machinery should do this for us, though. Don't wrap the close call in SCM_SYSCALL, EINTR leaves the fd in an unspecified state. Don't bother freeing buffers, the collector will handle that; simply drop references via scm_port_non_buffer. * libguile/ports.c (do_free, finalize_port): Catch exceptions caused by the free procedure. Don't bother setting the stream to 0 at all. (scm_close_port): Ensure that exceptions thrown by the "close" procedure don't prevent the port from being marked as closed.
2012-02-14web server: fix spurious warningAndy Wingo1-1/+3
* module/web/server.scm (sanitize-response): Quick fix to the 304-has-no-body sanitizer.
2012-02-14scm_from_stringn utf8 optimizationAndy Wingo1-7/+3
* libguile/strings.c (scm_from_stringn): Optimize scm_from_stringn for utf-8.
2012-02-14fix buggy scm_from_utf8_stringn (!)Andy Wingo1-2/+2
* libguile/strings.c (scm_from_utf8_stringn): Embarassingly, my scm_from_utf8_stringn implementation was buggy for non-ascii characters, since October (41d1d984). Fixed. Will be tested with the next patch.
2012-02-14ports: avoid adding port table entries and finalizers if possibleAndy Wingo2-33/+37
* libguile/ports.h (scm_t_port_type_flags, scm_t_ptob_descriptor): Add flags to ptob descriptors. * libguile/ports.c (scm_set_port_flush): Set the SCM_PORT_TYPE_HAS_FLUSH flag here. (scm_c_make_port_with_encoding): Only add ports to the table if SCM_PORT_TYPE_HAS_FLUSH is set. Only add finalizers to ports if there is a free function. (scm_close_port): Inline scm_i_remove_port here. Only remove from the weak set if SCM_PORT_TYPE_HAS_FLUSH is set. (scm_set_port_revealed_x): Add a comment.
2012-02-14refactor port encoding modes: utf-8 and iconvAndy Wingo3-94/+158
* libguile/ports.h (struct scm_t_port): Add a flag for the port encoding mode: UTF8 or iconv. The iconv descriptors are now in a separate structure so that we can avoid attaching finalizers to the ports themselves, in some cases. * libguile/ports.c (scm_c_make_port_with_encoding): Init the encoding mode. (scm_i_remove_port): Adapt to call close_iconv_descriptors. (finalize_iconv_descriptors, open_iconv_descriptors): (close_iconv_descriptors): New infrastructure to manage iconv descriptors. (scm_i_port_iconv_descriptors): New internal helper. (scm_i_set_port_encoding_x): Use open_iconv_descriptors, if needed. (get_iconv_codepoint): Use pt->iconv_descriptors. (get_codepoint): Check the port encoding mode flags. * libguile/print.c (display_string_using_iconv): Use scm_i_port_iconv_descriptors. (display_string): Use pt->encoding_mode flag.
2012-02-14string ports simplificationAndy Wingo1-65/+20
* libguile/strports.c (st_fill_input): Rename from stfill_buffer, and remove an unneeded scm_return_first_int. (st_resize_port): Minor variable renaming. (st_write): Keep read_pos updated to be the same as write_pos. If we need to resize, do so only once. (st_seek): No more need to flush. (st_truncate): Update read_pos here too. (scm_mkstrport): No need to flush here. (scm_strport_to_string): Just call scm_from_stringn; rely on it to detect the latin1 case. (scm_make_stptob): No more flush function.
2012-02-13weaks: move an allocation outside a critical sectionAndy Wingo2-34/+71
* libguile/weak-set.c (resize_set): * libguile/weak-table.c (resize_table): Drop the set/table lock while allocating the new vector. Fixes a bug in which a finalizer could recursively try to grab the port table lock.
2012-02-12Fix manual: scm_foreign_to_bytevector to scm_pointer_to_bytevectorMark H Weaver1-1/+1
* doc/ref/api-foreign.texi (Void Pointers and Byte Access): Fix outdated function name: scm_foreign_to_bytevector to scm_pointer_to_bytevector.
2012-02-12Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo3-6/+31
2012-02-12web server: do not provide a response body where it is not permittedAndy Wingo3-6/+31
* 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.
2012-02-11Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-16/+8
2012-02-11web server: print backtrace on errors when run in batch modeAndy Wingo1-16/+8
* module/web/server.scm (read-client, handle-request, write-client): When run in batch mode, give a full backtrace for errors.
2012-02-11Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo10-201/+422
Conflicts: libguile/read.c test-suite/tests/tree-il.test
2012-02-10more efficient scm_string_to_utf8, scm_string_to_utf32Andy Wingo1-26/+30
* libguile/bytevectors.c (scm_string_to_utf8): More efficient implementation. (scm_string_to_utf32): Likewise.
2012-02-10more efficient scm_to_utf8_stringn, scm_to_utf32_stringnAndy Wingo1-4/+52
* libguile/strings.c (scm_to_utf8_stringn): More efficient implementation than calling scm_to_stringn. (scm_to_utf32_stringn): Likewise.
2012-02-08Support => within case, and improve error messages for cond and caseMark H Weaver5-84/+234
* 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'.
2012-02-08Add source properties to many more types of dataMark H Weaver2-26/+47
* 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.
2012-02-08Unoptimize 'read' to return freshly allocated empty stringsMark H Weaver2-12/+8
* 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.
2012-02-08Optimize empty substring case of scm_i_substring_copyMark H Weaver1-22/+27
* 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.
2012-02-08Add and use maybe_annotate_source helper in read.cMark H Weaver1-12/+11
* libguile/read.c (maybe_annotate_source): New static helper function. (scm_read_sexp, scm_read_quote, scm_read_syntax): Use 'maybe_annotate_source'.
2012-02-08Remove inline and register attributes from read.cMark H Weaver1-12/+12
* libguile/read.c: Remove all 'inline' and 'register' attributes.
2012-02-08Remove incorrect comment in read.cMark H Weaver1-3/+2
* libguile/read.c (scm_read_sharp): Remove incorrect comment that claims that scm_read_boolean might return a SRFI-4 vector.
2012-02-08Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+2
2012-02-08i18: avoid freelocale (NULL)Andy Wingo1-1/+2
* libguile/i18n.c (smob_locale_free): Don't freelocale (NULL).
2012-02-08Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo147-4676/+17939
Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c
2012-02-05Fix --enable-debug-mallocAndy Wingo1-37/+56
* 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.
2012-02-04i18n: Skips ~h `format' tests when digit grouping info is missing.Ludovic Courtès1-5/+13
* test-suite/tests/i18n.test ("format ~h"): Skip tests when `locale-digit-grouping' returns '().
2012-02-03function binding fixesBT Templeton2-62/+78
* module/language/elisp/bindings.scm (bindings): Add `function-bindings' field. (make-bindings): Initialize the `function-bindings' field. (get-function-binding, with-function-bindings): New functions. (access-variable, reference-variable, set-variable!): Remove the `module' argument and only handle references to the value cell. All callers changed. Callers passing `function-slot' as the module changed to use the corresponding functions for the function cell instead. (access-function, reference-function, set-function!): New procedures. (compile-flet, compile-labels): Use `with-function-bindings' instead of `with-lexical-bindings'.
2012-02-03sharpsign-colon for uninterned symbolsBT Templeton1-1/+6
* module/language/elisp/lexer.sm (lex): Add support for `#:' syntax for uninterned symbols.
2012-02-03elisp I/OBT Templeton1-0/+14
* module/language/elisp/boot.el (princ, print, terpri, format*): New functions.
2012-02-03improve management of global special variablesBT Templeton2-151/+109
* module/language/elisp/bindings.scm (bindings): Remove `globals' field. (global?, mark-global!, map-globals): Remove. All callers changed. * module/language/elisp/compile-tree-il.scm (generate-ensure-global, ensuring-globals): Remove. All callers changed. (global?, ensure-globals!): New procedures. (bind-lexically?): Use new `global?'. (compile-lambda, compile-let, compile-let*): Use `ensure-globals!'.
2012-02-03more lexical declarationsBT Templeton1-0/+5
* module/language/elisp/boot.el (condition-case, catch): Add `lexical' declarations in macro expansions.