bpt/guile.git
10 years agoguile.m4 tweaks
Andy Wingo [Tue, 11 Feb 2014 19:59:38 +0000 (20:59 +0100)]
guile.m4 tweaks

* meta/guile.m4 (GUILE_PKG): Don't print "checking for guile 2.0" if
  we've already found 2.2.  Print the correct effective version at the
  end.
  (GUILE_PROGS): Allow prereleases, whose micro version does not yet
  match the effective version.  Default to the already-chosen effective
  version.

10 years agoFix improper use of 'with-locale'.
Mark H Weaver [Sat, 8 Feb 2014 17:35:35 +0000 (12:35 -0500)]
Fix improper use of 'with-locale'.

* test-suite/guile-test (run-tests): Use 'setlocale' with check
  instead of 'with-locale'.

10 years agoDeprecate the use of the vector interface on arrays
Andy Wingo [Sat, 8 Feb 2014 15:13:54 +0000 (16:13 +0100)]
Deprecate the use of the vector interface on arrays

* libguile/vectors.c (scm_is_vector): Deprecate use on weak vectors and
  arrays.
  (scm_is_simple_vector): Deprecate use on weak vectors.
  (scm_vector_length, scm_c_vector_ref, scm_c_vector_set_x): Deprecate
  use on arrays.

* libguile/sort.c: Adapt to check explicitly for arrays.

10 years agoDeprecate use of vector-length, vector-ref, vector-set! as primitive-generics
Andy Wingo [Sat, 8 Feb 2014 15:02:59 +0000 (16:02 +0100)]
Deprecate use of vector-length, vector-ref, vector-set! as primitive-generics

* libguile/vectors.c (scm_vector_length, scm_c_vector_ref):
  (scm_c_vector_set_x): Deprecate the use of vector-length, vector-ref,
  and vector-set! as primitive generics.

10 years agoDeprecate general "uniform-vector" interface
Andy Wingo [Sat, 8 Feb 2014 13:18:40 +0000 (14:18 +0100)]
Deprecate general "uniform-vector" interface

* libguile/uniform.h:
* libguile/uniform.c (scm_is_uniform_vector, scm_uniform_vector_p)
  (scm_c_uniform_vector_length, scm_uniform_vector_length)
  (scm_uniform_vector_element_type, scm_uniform_vector_element_size)
  (scm_c_uniform_vector_ref, scm_uniform_vector_ref):
  (scm_c_uniform_vector_set_x, scm_uniform_vector_set_x):
  (scm_uniform_vector_to_list)
  (scm_uniform_vector_elements, scm_uniform_vector_writable_elements):
  Deprecate.  This interface lacked both generality and specificity.
  The general replacement is array-length, array-ref, and friends on the
  scheme side, or the array handle interface on the C side.  On the
  specific side of things, there are the specific bytevector, srfi-4,
  and bitvector interfaces.

* test-suite/tests/arrays.test:
* test-suite/tests/bitvectors.test:
* test-suite/tests/ports.test:
* test-suite/tests/srfi-4.test: Update to use array interfaces.

* doc/ref/api-foreign.texi (Void Pointers and Byte Access):
* doc/ref/srfi-modules.texi (SRFI-4): Update.

10 years agoSimplify srfi-4 C implementation
Andy Wingo [Sat, 8 Feb 2014 12:52:21 +0000 (13:52 +0100)]
Simplify srfi-4 C implementation

* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): In the raw element
  accessors (e.g scm_u32vector_writable_elements), only permit
  bytevectors, as the constructors will only make bytevectors.  This
  harmonizes with the Scheme interfaces as well, which expect packed
  bytevectors.
  (scm_make_srfi_4_vector): Knowing that the new value is a bytevector
  with base 0 and inc 1, simplify initialization.

10 years agoDeprecate htons, htonl, ntohs, ntohl
Andy Wingo [Sat, 8 Feb 2014 13:27:49 +0000 (14:27 +0100)]
Deprecate htons, htonl, ntohs, ntohl

* libguile/sockets.h:
* libguile/sockets.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_htons, scm_htonl, scm_ntohs, scm_ntohl):
  Deprecate.  Bytevectors adequately subsume their functionality.

* doc/ref/posix.texi:
* test-suite/tests/00-socket.test: Update.

10 years agoImprove handling of locales in the test suite.
Mark H Weaver [Sat, 8 Feb 2014 02:42:28 +0000 (21:42 -0500)]
Improve handling of locales in the test suite.

* test-suite/guile-test (run-tests): Load each test file within
  (with-locale "C" ...).

* test-suite/tests/encoding-iso88591.test:
* test-suite/tests/encoding-iso88597.test:
* test-suite/tests/encoding-utf8.test:
* test-suite/tests/srfi-14.test: Remove broken code to save and restore
  the previous locale.

* test-suite/tests/bytevectors.test:
* test-suite/tests/format.test:
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-19.test:
* test-suite/tests/tree-il.test: Make sure 'setlocale' is defined before
  calling it.

10 years agoBetter error reporting in 'weak-vector-ref' and 'weak-vector-set!'.
Mark H Weaver [Fri, 7 Feb 2014 21:53:48 +0000 (16:53 -0500)]
Better error reporting in 'weak-vector-ref' and 'weak-vector-set!'.

* libguile/weaks.c (scm_c_weak_vector_ref, scm_c_weak_vector_set_x):
  Pass procedure name to 'scm_out_of_range'.

10 years agoMake size argument optional to 'make-doubly-weak-hash-table'; fix docs.
Mark H Weaver [Fri, 7 Feb 2014 21:38:58 +0000 (16:38 -0500)]
Make size argument optional to 'make-doubly-weak-hash-table'; fix docs.

* libguile/hashtab.c (scm_make_doubly_weak_hash_table): Make 'size'
  argument optional, like the weak hash table constructors.

* doc/ref/api-memory.texi (Weak hash tables): Document that 'size'
  argument is optional for the weak hash table constructors.

10 years agoFix 'weak-vector?' doc: Weak hash tables are not weak vectors.
Mark H Weaver [Fri, 7 Feb 2014 21:26:38 +0000 (16:26 -0500)]
Fix 'weak-vector?' doc: Weak hash tables are not weak vectors.

* doc/ref/api-memory.texi (Weak vectors): In 'weak-vector?' entry, don't
  claim that weak hash tables are weak vectors.  Remove statement that
  weak vectors are mainly useful for implementing weak hash tables.

10 years agoFix truncated-print for uniform vectors
Andy Wingo [Fri, 7 Feb 2014 17:04:20 +0000 (18:04 +0100)]
Fix truncated-print for uniform vectors

* module/ice-9/pretty-print.scm (truncated-print): Use bytevector?
  instead of uniform-vector?; the latter could be true for shared arrays
  with non-zero lower bounds.

10 years ago(srfi srfi-4 gnu) uses private define-bytevector-type from (srfi srfi-4)
Andy Wingo [Fri, 7 Feb 2014 17:00:04 +0000 (18:00 +0100)]
(srfi srfi-4 gnu) uses private define-bytevector-type from (srfi srfi-4)

* module/srfi/srfi-4/gnu.scm: Re-use implementation of
  define-bytevector-type from srfi-4.

10 years agoRemove private unused duplicate c32/c64vector definitions
Andy Wingo [Fri, 7 Feb 2014 16:57:30 +0000 (17:57 +0100)]
Remove private unused duplicate c32/c64vector definitions

* module/srfi/srfi-4.scm: Remove vestigial definitions for c32vectors
  and c64vectors.  Those are defined in (srfi srfi-4 gnu).

10 years agoSRFI-4 predicates, length accessors only accept bytevectors (not arrays)
Andy Wingo [Fri, 7 Feb 2014 16:53:01 +0000 (17:53 +0100)]
SRFI-4 predicates, length accessors only accept bytevectors (not arrays)

* module/srfi/srfi-4.scm (define-bytevector-type): For the predicates
  and length accessors, only accept bytevectors.  Since arrays don't
  work for u32vector-ref et al, they shouldn't pass u32vector?.

10 years agoDeprecate vector-ref, vector-length, vector-set! on weak vectors
Andy Wingo [Fri, 7 Feb 2014 11:42:44 +0000 (12:42 +0100)]
Deprecate vector-ref, vector-length, vector-set! on weak vectors

* libguile/vectors.c (scm_vector_length, scm_c_vector_length):
  (scm_c_vector_ref, scm_c_vector_set_x): Deprecate the use of these
  procedures on weak vectors.

* test-suite/tests/guardians.test:
* test-suite/tests/weaks.test: Adapt test suites.

10 years agoAdd weak-vector-length, weak-vector-ref, weak-vector-set!
Andy Wingo [Fri, 7 Feb 2014 11:25:05 +0000 (12:25 +0100)]
Add weak-vector-length, weak-vector-ref, weak-vector-set!

* libguile/weaks.c (scm_is_weak_vector, scm_c_weak_vector_length):
  (scm_c_weak_vector_ref, scm_c_weak_vector_set_x): New interfaces for
  dealing with weak vectors from C.
  (scm_weak_vector_length, scm_weak_vector_ref, scm_weak_vector_set_x):
  New Scheme interfaces to weak vectors; to be used instead of
  vector-length, vector-ref, etc.

* module/ice-9/weak-vector.scm: Export the new interfaces.

* doc/ref/api-memory.texi (Weak vectors): Document them.

10 years agoRemove outdated documentation of LTDL_LIBRARY_PATH.
Mark H Weaver [Thu, 6 Feb 2014 04:40:25 +0000 (23:40 -0500)]
Remove outdated documentation of LTDL_LIBRARY_PATH.

* doc/ref/guile-invoke.texi (Environment Variables): Remove
  documentation of 'LTDL_LIBRARY_PATH'.

10 years agoDocument 'equal?' in list of R6RS incompatibilities.
Mark H Weaver [Thu, 6 Feb 2014 04:25:32 +0000 (23:25 -0500)]
Document 'equal?' in list of R6RS incompatibilities.

* doc/ref/r6rs.texi (R6RS Incompatibilities): Mention that 'equal?'
  may not terminate when applied to cyclic datums.

10 years agoREPL Server: Remove unneeded error case in 'run-server'.
Mark H Weaver [Tue, 4 Feb 2014 19:21:13 +0000 (14:21 -0500)]
REPL Server: Remove unneeded error case in 'run-server'.

* module/system/repl/server.scm (run-server): Remove case that handled
  'interrupt' exceptions specially.  It is no longer needed since
  e6c8e6047ed2e772cc4e1fb5ad4d389e5c616feb (REPL Server: Don't establish
  a SIGINT handler.)

10 years agoREPL Server: Redirect warnings to client socket.
Mark H Weaver [Tue, 4 Feb 2014 17:08:48 +0000 (12:08 -0500)]
REPL Server: Redirect warnings to client socket.

* module/system/repl/server.scm (serve-client): Use parameterize.
  Redirect warnings to client socket.

10 years agoDon't check HAVE_ALARM, which no longer exists.
Mark H Weaver [Tue, 4 Feb 2014 04:09:23 +0000 (23:09 -0500)]
Don't check HAVE_ALARM, which no longer exists.

* libguile/scmsigs.c (scm_alarm): Remove check for HAVE_ALARM.
  Conditionalize only on HAVE_DECL_ALARM.

10 years agoUpdate Gnulib to v0.1-77-gd9361da
Mark H Weaver [Tue, 4 Feb 2014 02:04:39 +0000 (21:04 -0500)]
Update Gnulib to v0.1-77-gd9361da

10 years agodefine-values: Blackhole 'dummy'; work around lack of toplevel hygiene.
Mark H Weaver [Mon, 3 Feb 2014 02:13:47 +0000 (21:13 -0500)]
define-values: Blackhole 'dummy'; work around lack of toplevel hygiene.

* module/ice-9/boot-9.scm (define-values): Use 'generate-temporaries' to
  generate a fresh name for 'dummy', to work around the lack of hygiene
  for macro-introduced toplevel identifiers.  Blackhole 'dummy' to avoid
  keeping garbage alive.  Add more comments.

10 years agoImplement R7RS 'define-values'.
Mark H Weaver [Sun, 12 Jan 2014 09:43:37 +0000 (04:43 -0500)]
Implement R7RS 'define-values'.

* module/ice-9/boot-9.scm (%define-values-arity-error): New procedure.
  (define-values): New macro.

* doc/ref/api-binding.texi (Binding Multiple Values): Add docs.

* test-suite/tests/syntax.test: Add tests.

10 years agoImplement SRFI-64 - A Scheme API for test suites.
Mark H Weaver [Wed, 29 Jan 2014 07:20:01 +0000 (02:20 -0500)]
Implement SRFI-64 - A Scheme API for test suites.

* module/srfi/srfi-64.scm: New file.
* module/srfi/srfi-64/testing.scm: New file.
* module/Makefile.am: Add rule for srfi-64.go dependency on
  srfi-64/testing.scm.
  (SRFI_SOURCES): Add srfi/srfi-64.scm.
  (NOCOMP_SOURCES): Add srfi/srfi-64/testing.scm.
* doc/ref/srfi-modules.texi (SRFI-64): New node.
* test-suite/tests/srfi-64.test: New file.
* test-suite/tests/srfi-64-test.scm: New file.
* test-suite/Makefile.am (SCM_TESTS): Add test-suite/tests/srfi-64.test.
  (EXTRA_DIST): Add tests/srfi-64-test.scm.

10 years agoImplement SRFI-43 Vector Library.
Mark H Weaver [Mon, 27 Jan 2014 22:17:23 +0000 (17:17 -0500)]
Implement SRFI-43 Vector Library.

* module/srfi/srfi-43.scm: New file.
* module/Makefile.am (SRFI_SOURCES): Add module/srfi/srfi-43.scm.
* test-suite/tests/srfi-43.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add test-suite/tests/srfi-43.test.
* doc/ref/srfi-modules.texi (SRFI-43, SRFI-43 Constructors)
  (SRFI-43 Predicates, SRFI-43 Selectors, SRFI-43 Iteration)
  (SRFI-43 Searching, SRFI-43 Mutators, SRFI-43 Conversion): New nodes.

10 years agoCompile numerical comparisons with more than 2 arguments to VM code.
Mark H Weaver [Tue, 28 Jan 2014 22:44:22 +0000 (17:44 -0500)]
Compile numerical comparisons with more than 2 arguments to VM code.

* module/language/tree-il/primitives.scm (chained-comparison-expander):
  New procedure.
  (*primitive-expand-table*): Add primitive expanders for '<', '>',
  '<=', '>=', and '='.

10 years agoRevert "Primitive expand numerical comparisons with more than 2 arguments."
Mark H Weaver [Fri, 31 Jan 2014 09:01:12 +0000 (04:01 -0500)]
Revert "Primitive expand numerical comparisons with more than 2 arguments."

This reverts commit 4dc4b86e858d391d20d0ea2551614a89fa3bd4d1.

10 years agoPrimitive expand numerical comparisons with more than 2 arguments.
Mark H Weaver [Tue, 28 Jan 2014 22:44:22 +0000 (17:44 -0500)]
Primitive expand numerical comparisons with more than 2 arguments.

* module/language/tree-il/primitives.scm (chained-comparison-expander):
  New procedure.
  (*primitive-expand-table*): Add primitive expanders for '<', '>',
  '<=', '>=', and '='.

10 years agoAdd 'positive?' and 'negative?' as primitives.
Mark H Weaver [Tue, 28 Jan 2014 21:54:10 +0000 (16:54 -0500)]
Add 'positive?' and 'negative?' as primitives.

* module/language/tree-il/primitives.scm (*interesting-primitive-names*)
  (*effect-free-primitives*): Add 'positive?' and 'negative?'.
  (*primitive-expand-table*): Add primitive expanders for 'positive?'
  and 'negative?'.

10 years agoMinor for-each speedup
Andy Wingo [Tue, 28 Jan 2014 21:28:08 +0000 (22:28 +0100)]
Minor for-each speedup

* module/ice-9/boot-9.scm (for-each): Minor speedup by unrolling
  tortoise/hare loop.

10 years agoImplement SRFI-111 Boxes.
Mark H Weaver [Fri, 24 Jan 2014 05:21:17 +0000 (00:21 -0500)]
Implement SRFI-111 Boxes.

* module/srfi/srfi-111.scm: New file.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-111.scm.
* test-suite/tests/srfi-111.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-111.test.
* doc/ref/srfi-modules.texi (SRFI-111): New node.

10 years agoFix thread-unsafe lazy initializations.
Mark H Weaver [Thu, 23 Jan 2014 16:37:36 +0000 (11:37 -0500)]
Fix thread-unsafe lazy initializations.

* libguile/backtrace.c (print_exception_var): New static variable.
  (init_print_exception_var): New static function.
  (scm_print_exception): Remove thread-unsafe lazy initialization.
  Call 'init_print_exception_var' using 'scm_i_pthread_once'.
  Use 'print_exception_var'.

* libguile/continuations.c (call_cc): New static variable.
  (init_call_cc): New static function.
  (scm_i_call_with_current_continuation): Remove thread-unsafe lazy
  initialization.  Call 'init_call_cc' using 'scm_i_pthread_once'.

* libguile/debug.c (local_eval_var): New static variable.
  (init_local_eval_var): New static function.
  (scm_local_eval): Remove lazy initialization using mutexes.
  Call 'init_local_eval_var' using 'scm_i_pthread_once'.
  Use 'scm_variable_ref' instead of 'SCM_VARIABLE_REF'.

* libguile/eval.c (map_var, for_each_var): New static variables.
  (init_map_var, init_for_each_var): New static functions.
  (scm_map, scm_for_each): Remove thread-unsafe lazy initializations.
  Call 'init_map_var' (or 'init_for_each_var') using 'scm_i_pthread_once'.
  Use 'map_var' (or 'for_each_var').

* libguile/frames.c (frame_arguments_var): New static variable.
  (init_frame_arguments_var): New static function.
  (scm_frame_arguments): Remove thread-unsafe lazy initialization.
  Call 'init_frame_arguments_var' using 'scm_i_pthread_once'.
  Use 'frame_arguments_var'.  Use 'scm_variable_ref' instead of
  'SCM_VARIABLE_REF'.

* libguile/goops.c (delayed_compile_var): New static variable.
  (init_delayed_compile_var): New static function.
  (make_dispatch_procedure): Remove thread-unsafe lazy initialization.
  Call 'init_delayed_compile_var' using 'scm_i_pthread_once'.
  Use 'delayed_compile_var'.  Use 'scm_variable_ref' instead of
  'SCM_VARIABLE_REF'.

* libguile/instructions.c (instructions_by_name): New static variable.
  (init_instructions_by_name): New static function.
  (scm_lookup_instruction_by_name): Remove thread-unsafe lazy
  initialization.  Call 'init_instructions_by_name' using
  'scm_i_pthread_once'.

* libguile/ports.c (current_warning_port_var)
  (current_warning_port_once): New static variables.
  (init_current_warning_port_var): New static function.
  (scm_current_warning_port): Remove lazy initialization using mutexes.
  Call 'init_current_warning_port_var' using 'scm_i_pthread_once'.
  Use 'current_warning_port_var'.
  (scm_set_current_warning_port): Remove thread-unsafe lazy initialization.
  Call 'init_current_warning_port_var' using 'scm_i_pthread_once'.
  Use 'current_warning_port_var'.

* libguile/strings.c (null_stringbuf): New static variable.
  (init_null_stringbuf): New static function.
  (scm_i_make_string): Remove thread-unsafe lazy initialization.
  Call 'init_null_stringbuf' using 'scm_i_pthread_once'.

* libguile/strports.c (eval_string_var, k_module): New static variables.
  (init_eval_string_var_and_k_module): New static function.
  (scm_eval_string_in_module): Remove lazy initialization using mutexes.
  Call 'init_eval_string_var_and_k_module' using 'scm_i_pthread_once'.
  Use 'eval_string_var'.

* libguile/throw.c (CACHE_VAR): Remove incorrect macro.
  (catch_var, throw_var, with_throw_handler_var): New static variables.
  (scm_catch, scm_catch_with_pre_unwind_handler): Remove thread-unsafe
  lazy initialization.  Use 'catch_var'.
  (init_with_throw_handler_var): New static function.
  (scm_with_throw_handler): Remove thread-unsafe lazy initialization.
  Call 'init_with_throw_handler_var' using 'scm_i_pthread_once'.
  Use 'with_throw_handler_var'.
  (scm_throw): Remove thread-unsafe lazy initialization.
  Use 'throw_var'.
  (scm_init_throw): Initialize 'catch_var' and 'throw_var'.

10 years agoImprove correctness and consistency of 'eval-when' usage.
Mark H Weaver [Thu, 23 Jan 2014 15:09:29 +0000 (10:09 -0500)]
Improve correctness and consistency of 'eval-when' usage.

* module/ice-9/boot-9.scm:
* module/ice-9/i18n.scm:
* module/ice-9/poll.scm:
* module/ice-9/popen.scm:
* module/ice-9/r6rs-libraries.scm:
* module/oop/goops.scm:
* module/oop/goops/compile.scm:
* module/oop/goops/dispatch.scm:
* module/srfi/srfi-88.scm:
* module/system/foreign.scm:
* module/texinfo/serialize.scm: Change most uses of 'compile' to
  'expand', except where we must avoid it during initial bootstrap
  before the module system is loaded.  Remove redundant uses of
  'compile' where 'expand' is also given.  Standardize on the
  "(expand load eval)" order of conditions.

10 years agoImprove docs for 'eval-when'.
Mark H Weaver [Thu, 23 Jan 2014 08:49:21 +0000 (03:49 -0500)]
Improve docs for 'eval-when'.

* doc/ref/api-macros.texi (Eval When): Explain in detail what each
  condition means, including 'expand' which was previously undocumented.
  Change the example to use (expand load eval) and recommend that set of
  conditions, instead of (compile load eval) which was previously
  recommended and shown in the example.

10 years agoBuffered custom binary input ports correctly handle partial read requests.
Ludovic Courtès [Tue, 21 Jan 2014 22:39:30 +0000 (23:39 +0100)]
Buffered custom binary input ports correctly handle partial read requests.

* libguile/r6rs-ports.c (cbip_fill_input): Always initialize 'read_pos'
  when BUFFERED.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port buffered partial reads"]: New test.

10 years agoFix nested block comment example in manual.
Mark H Weaver [Tue, 21 Jan 2014 21:21:36 +0000 (16:21 -0500)]
Fix nested block comment example in manual.

Reported by Chris K. Jester-Young <cky944@gmail.com>.

* doc/ref/api-evaluation.texi (Block Comments): Fix example.

10 years agoREPL Server: Don't establish a SIGINT handler.
Mark H Weaver [Tue, 21 Jan 2014 21:06:40 +0000 (16:06 -0500)]
REPL Server: Don't establish a SIGINT handler.

* module/system/repl/server.scm (call-with-sigint): Remove.
  (accept-new-client): Don't wrap 'call-with-sigint' around call to
  'accept'.

10 years agoWrite out HTTP Basic auth headers correctly.
Mark H Weaver [Tue, 21 Jan 2014 20:50:58 +0000 (15:50 -0500)]
Write out HTTP Basic auth headers correctly.

Fixes <http://bugs.gnu.org/14370>.
Reported by Atom X Zane <atomx@deadlyhead.com>.

* module/web/http.scm (write-credentials): Handle the Basic auth scheme
  correctly.

* test-suite/tests/web-http.test (pass-if-round-trip): Use
  'pass-if-equal' for better error reporting.
  ("request headers"): Add tests.

* THANKS: Add "Atom X Zane" to bug fix section.

10 years agoAdd support for content-disposition
Andy Wingo [Sat, 18 Jan 2014 20:08:52 +0000 (21:08 +0100)]
Add support for content-disposition

* module/web/http.scm ("Content-Disposition"): Add a parser and
  serializer.  Defined in RFC2616 section 19.5.1.

* test-suite/tests/web-http.test ("entity headers"): New test case.

10 years agoCustom binary input ports support 'setvbuf'.
Ludovic Courtès [Thu, 16 Jan 2014 22:43:31 +0000 (23:43 +0100)]
Custom binary input ports support 'setvbuf'.

* libguile/r6rs-ports.c (CBIP_BUFFER_SIZE): Adjust comment.  Set to 8KiB.
  (SCM_SET_CBIP_BYTEVECTOR): New macro.
  (cbip_setvbuf): New function.
  (make_cbip): Set PORT's 'setvbuf' internal field.
  (cbip_fill_input): Check whether PORT is buffered.  When unbuffered,
  check whether BV can hold C_REQUESTED bytes, and allocate a new
  bytevector if not; copy the data back from BV to c_port->read_pos.
  Remove 'again' label, and don't loop there.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port unbuffered & 'port-position'", "custom binary input port
  unbuffered & 'read!' calls", "custom binary input port, unbuffered
  then buffered", "custom binary input port, buffered then unbuffered"]:
  New tests.
* doc/ref/api-io.texi (R6RS Binary Input): Document the buffering of
  custom binary input ports, and link to 'setvbuf'.

10 years agoPrepare 'setvbuf' to support for non-file ports.
Ludovic Courtès [Thu, 16 Jan 2014 22:52:01 +0000 (23:52 +0100)]
Prepare 'setvbuf' to support for non-file ports.

* libguile/ports-internal.h (struct scm_port_internal): Add
  setvbuf' field.  Change 'pending_eof' to a 1-bit unsigned char.
* libguile/ports.c (scm_new_port_table_entry): Clear 'pti->setvbuf'.
* libguile/fports.c (scm_setvbuf): Accept any open port, and error out
  when PORT's setvbuf' field is NULL.  Remove explicit 'scm_gc_free' calls.
  (scm_i_fdes_to_port): Set PORT's 'setvbuf' field.
* test-suite/tests/ports.test ("setvbuf")["closed port", "string port"]:
  New tests.
* doc/ref/posix.texi (Ports and File Descriptors): Suggest that
  'setvbuf' works for different port types.

10 years agodoc: embedding example more readable.
Arne Babenhauserheide [Fri, 17 Jan 2014 15:25:16 +0000 (16:25 +0100)]
doc: embedding example more readable.

* doc/ref/guile.texi (A Sample Guile Main Program): Easier to read
  example code and building split into 2 subsections.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
10 years agoThank Sree Harsha.
Ludovic Courtès [Fri, 17 Jan 2014 17:20:09 +0000 (18:20 +0100)]
Thank Sree Harsha.

10 years agoArrange so that 'file-encoding' does not truncate the encoding name.
Ludovic Courtès [Fri, 17 Jan 2014 17:18:41 +0000 (18:18 +0100)]
Arrange so that 'file-encoding' does not truncate the encoding name.

Fixes <http://bugs.gnu.org/16463>.
Reported by Sree Harsha Totakura <sreeharsha@totakura.in>.

* libguile/read.c (ENCODING_NAME_MAX_SIZE): New macro.
  (SCM_ENCODING_SEARCH_SIZE): Change to 500 + ENCODING_NAME_MAX_SIZE.
  (scm_i_scan_for_encoding): Return NULL if there's less than
  ENCODING_NAME_MAX_SIZE bytes once "coding: *" has been read.
* test-suite/tests/coding.test ("line
  comment")["http://bugs.gnu.org/16463"]: New test.

10 years agoweb: Don't throw if a response is longer than its Content-Length says.
Ludovic Courtès [Wed, 15 Jan 2014 22:41:23 +0000 (23:41 +0100)]
web: Don't throw if a response is longer than its Content-Length says.

* module/web/response.scm (make-delimited-input-port): Read at most LEN
  bytes from PORT, instead of trying to read more and returning an error
  if more is available.  Try again when 'get-bytevector-n!' return zero.
* test-suite/tests/web-response.test (example-1): Add garbage after the
  body itself.

10 years agoCustom binary input ports sanity-check the return value of 'read!'.
Ludovic Courtès [Wed, 15 Jan 2014 22:07:25 +0000 (23:07 +0100)]
Custom binary input ports sanity-check the return value of 'read!'.

* libguile/r6rs-ports.c (cbip_fill_input): Throw an exception when
  C_OCTETS is greater than what was requested.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port 'read!' returns too much"]: New test.

10 years agoDocument that we support srfi-46 and add it to %cond-expand-features.
Mark H Weaver [Wed, 15 Jan 2014 08:08:32 +0000 (03:08 -0500)]
Document that we support srfi-46 and add it to %cond-expand-features.

* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-46.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-46 to the list of core
  features.
  (SRFI-46): New node.

* doc/ref/api-macros.texi (Syntax Rules): Mention that the custom
  ellipsis identifier support is specified by SRFI-46.

* test-suite/tests/syntax.test ("syntax-rules"): Add ellipsis hygiene
  test from SRFI-46.

10 years agoDocument that we support srfi-87 and add it to %cond-expand-features.
Mark H Weaver [Wed, 15 Jan 2014 07:37:46 +0000 (02:37 -0500)]
Document that we support srfi-87 and add it to %cond-expand-features.

* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-87.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-87 to the list of core
  features.
  (SRFI-87): New node.

10 years agoprint: In R7RS |...| symbols, print most graphic characters unescaped.
Mark H Weaver [Wed, 15 Jan 2014 04:29:50 +0000 (23:29 -0500)]
print: In R7RS |...| symbols, print most graphic characters unescaped.

* libguile/print.c (print_r7rs_extended_symbol): Print any unicode
  graphic character other than '|' or '\' unescaped.  Escape any spacing
  character other than ASCII space.

10 years agoprint: Support R7RS |...| symbol notation.
Mark H Weaver [Tue, 14 Jan 2014 22:38:30 +0000 (17:38 -0500)]
print: Support R7RS |...| symbol notation.

* libguile/print.c (scm_print_opts): Add 'r7rs-symbols' print option.
  (symbol_has_extended_read_syntax): If the 'r7rs-symbols' option is
  enabled, then disallow '|' and '\' from bare symbols.
  (print_extended_symbol): Use 'scm_lfwrite' and 'scm_putc' instead of
  'display_string' and 'display_character' when printing ASCII literals.
  (print_r7rs_extended_symbol): New static function.
  (scm_i_print_symbol_name): If the 'r7rs-symbols' option is enabled,
  use 'print_r7rs_extended_symbol' instead of 'print_extended_symbol'.

* libguile/private-options.h (SCM_PRINT_R7RS_SYMBOLS_P): New macro.
  (SCM_N_PRINT_OPTIONS): Increment.

* doc/ref/api-evaluation.texi (Scheme Write): Mention 'r7rs-symbols'
  print option.

* test-suite/tests/print.test ("write"): Add tests.

10 years agoread: Support R7RS |...| symbol notation.
Mark H Weaver [Sun, 12 Jan 2014 12:55:22 +0000 (07:55 -0500)]
read: Support R7RS |...| symbol notation.

* libguile/private-options.h (SCM_R7RS_SYMBOLS_P): New macro.
  (SCM_N_READ_OPTIONS): Increment.

* libguile/read.c (scm_read_opts): Add entry for 'r7rs-symbols'.
  (t_read_opts): Add field for 'r7rs_symbols_p'.
  (scm_read_string_like_syntax): New function based on earlier
  'scm_read_string' that handles either string literals or R7RS quoted
  symbols (delimited by vertical bars), depending on the value of 'chr'.
  (scm_read_string): Reimplement based on 'scm_read_string_like_syntax'.
  (scm_read_r7rs_symbol): New static function.

* doc/ref/api-data.texi (Symbol Read Syntax): Briefly describe the R7RS
  symbol syntax, mention the 'r7rs-symbols' read option, and give some
  examples.

* doc/ref/api-evaluation.texi (Scheme Read): Mention the 'r7rs-symbols'
  read option.

* test-suite/tests/reader.test ("reading"): Add test.

10 years agoDocument that we support srfi-62 and add it to %cond-expand-features.
Mark H Weaver [Tue, 14 Jan 2014 18:26:30 +0000 (13:26 -0500)]
Document that we support srfi-62 and add it to %cond-expand-features.

* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-62.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-62 to the list of core
  features.
  (SRFI-62): New node.

10 years agoread: use 'c_tolower' instead of 'tolower' in 'try_read_ci_chars'.
Mark H Weaver [Tue, 14 Jan 2014 08:13:58 +0000 (03:13 -0500)]
read: use 'c_tolower' instead of 'tolower' in 'try_read_ci_chars'.

* libguile/read.c: Include <c-ctype.h>.
  (try_read_ci_chars): Use 'c_tolower' instead of 'tolower'.

10 years agoRecognize 'escape' character name, per R7RS.
Mark H Weaver [Sun, 12 Jan 2014 09:36:57 +0000 (04:36 -0500)]
Recognize 'escape' character name, per R7RS.

* libguile/chars.c (scm_r7rs_charnames, scm_r7rs_charnums):
  New static constants.
  (SCM_N_R7RS_CHARNAMES): New macro.
  (scm_i_charname, scm_i_charname_to_char): Adapt to new R7RS
  char names.

* doc/ref/api-data.texi (Characters): Document #\escape.

* test-suite/tests/reader.test ("reading"): Add test.

10 years agoread: Accept "\|" in string literals.
Mark H Weaver [Sun, 12 Jan 2014 09:36:29 +0000 (04:36 -0500)]
read: Accept "\|" in string literals.

* libguile/read.c (scm_read_string): Accept "\|" in string literals.

* doc/ref/api-data.texi (String Syntax): Add "\|" to the list of
  supported backslash escapes.

* test-suite/tests/reader.test ("reading"): Add test.

10 years agoread: Support R7RS '#true' and '#false' syntax for booleans.
Mark H Weaver [Sun, 12 Jan 2014 09:36:02 +0000 (04:36 -0500)]
read: Support R7RS '#true' and '#false' syntax for booleans.

* libguile/read.c (try_read_ci_chars): New static function.
  (scm_read_boolean, scm_read_array): Use 'try_read_ci_chars'.

* doc/ref/api-data.texi (Booleans): Update docs.

* test-suite/tests/reader.test ("reading"): Add tests.

10 years agoAdd srfi-16 and srfi-30 to %cond-expand-features.
Mark H Weaver [Tue, 14 Jan 2014 07:19:52 +0000 (02:19 -0500)]
Add srfi-16 and srfi-30 to %cond-expand-features.

* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-16 and
  srfi-30.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-16 and srfi-30 to the
  list of core features.

* module/srfi/srfi-16.scm: Remove call to 'cond-expand-provide'.

10 years ago'port-position' works on CBIPs that do not support 'set-port-position!'.
Ludovic Courtès [Mon, 13 Jan 2014 22:15:28 +0000 (23:15 +0100)]
'port-position' works on CBIPs that do not support 'set-port-position!'.

* libguile/r6rs-ports.c (cbp_seek)[WHENCE == SEEK_CUR]: Break out of the
  switch statement when OFFSET is zero.
  Pass 'scm_wrong_type_arg_msg' a phrase suitable for use after
  "expecting".
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port supports `port-position', not `set-port-position!'"]: New
  test.

10 years agoFix 'exact-integer?' comment in numbers.test.
Mark H Weaver [Sun, 12 Jan 2014 12:47:00 +0000 (07:47 -0500)]
Fix 'exact-integer?' comment in numbers.test.

* test-suite/tests/numbers.test: Fix 'exact-integer?' comment.

10 years agoFix hashing of empty vectors.
Mark H Weaver [Sun, 12 Jan 2014 12:11:44 +0000 (07:11 -0500)]
Fix hashing of empty vectors.

Fixes a bug introduced in cc1cd04f8111c306cf48b93e131d5c1765c808a3
"Fix hashing of vectors to run in bounded time."

* libguile/hash.c (scm_hasher): Avoid division by zero.

* test-suite/tests/hash.test ("hash"): Add tests.

10 years agoBump user-visible copyright years to 2014.
Mark H Weaver [Sun, 12 Jan 2014 09:16:39 +0000 (04:16 -0500)]
Bump user-visible copyright years to 2014.

* doc/ref/guile.texi: Add 2014 to list of copyright years in @copying
  section.

* module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to
  2014.

* module/system/repl/common.scm (*version*): Add 2014 to the range of
  copyright years.

10 years agoFix hashing of vectors to run in bounded time.
Mark H Weaver [Sat, 11 Jan 2014 15:18:40 +0000 (10:18 -0500)]
Fix hashing of vectors to run in bounded time.

* libguile/hash.c (SCM_MIN): New macro.
  (scm_hasher): In vector case, do nothing if d is 0.  Make sure to
  recurse with a reduced d.  Move the loop out of the 'if'.

10 years agoImplement R7RS 'syntax-error'.
Mark H Weaver [Thu, 19 Dec 2013 18:22:50 +0000 (13:22 -0500)]
Implement R7RS 'syntax-error'.

* module/ice-9/psyntax.scm (syntax-error): New macro.
  (syntax-rules): Handle 'syntax-error' templates specially
  for improved error reporting.

* module/ice-9/psyntax-pp.scm: Regenerate.

* doc/ref/api-macros.texi (Syntax Rules): Add new subsection "Reporting
  Syntax Errors in Macros".

* test-suite/tests/syntax.test: Add tests.

10 years agopsyntax: custom ellipses using 'with-ellipsis' or R7RS syntax-rules.
Mark H Weaver [Wed, 18 Dec 2013 23:49:37 +0000 (18:49 -0500)]
psyntax: custom ellipses using 'with-ellipsis' or R7RS syntax-rules.

* module/ice-9/psyntax.scm (binding-type): Update the header comment
  to mention the new 'ellipsis' binding type.
  (macros-only-env): Preserve ellipsis bindings.
  (ellipsis?): Add 'r' and 'mod' as arguments.  Search the lexical
  environment for an ellipsis binding, and use it.
  (gen-syntax): Adapt to the additional arguments of 'ellipsis?'.
  (with-ellipsis): New core syntax.
  (convert-pattern): Add unary 'ellipsis?' procedure as an argument.
  (gen-clause): Adapt to the additional arguments of 'ellipsis?'.
  Pass unary 'ellipsis?' procedure to 'convert-pattern'.
  (syntax-case): Adapt to the additional arguments of 'ellipsis?'.
  (syntax-local-binding): Support new 'ellipsis' binding type.
  (syntax-rules): Add support for a custom ellipsis identifier as
  the first operand, as per R7RS.  Collect common code within new
  local procedure 'expand-syntax-rules'.

* module/ice-9/psyntax-pp.scm: Regenerate.

* module/ice-9/local-eval.scm (analyze-identifiers): Add support for
  'ellipsis' binding type.

* doc/ref/api-macros.texi (Syntax Rules): Add docs for R7RS custom
  ellipsis syntax.  Use @dots{}.
  (Syntax Case): Add docs for 'with-ellipsis'.  Use @dots{}.
  (Syntax Transformer Helpers): Update to include new 'ellipsis'
  binding type.

* test-suite/tests/syntax.test: Add tests.

10 years agopsyntax: toplevel variable definitions discard previous syntactic binding.
Mark H Weaver [Tue, 24 Dec 2013 11:42:51 +0000 (06:42 -0500)]
psyntax: toplevel variable definitions discard previous syntactic binding.

* module/ice-9/psyntax.scm (expand-top-sequence): When defining a
  toplevel variable, use the value of the same-named imported
  _variable_, if any.  Do _not_ use an existing syntactic binding.

* module/ice-9/psyntax-pp.scm: Regenerate.

10 years agoFix trap handlers to handle applicable structs.
Ian Price [Thu, 24 Oct 2013 04:51:47 +0000 (05:51 +0100)]
Fix trap handlers to handle applicable structs.

Reported by Jordy Dickinson <jordy.dickinson@gmail.com>.
Fixes <http://bugs.gnu.org/15691>.

* module/system/vm/traps.scm (frame-matcher): Extract procedure when
  proc is an applicable struct.

10 years agoFix 'string-copy!' to work properly with overlapping src/dest.
Mark H Weaver [Wed, 25 Dec 2013 10:10:19 +0000 (05:10 -0500)]
Fix 'string-copy!' to work properly with overlapping src/dest.

* libguile/srfi-13.c (scm_string_copy_x): Fix to work properly with
  overlapping src/dest.

* test-suite/tests/srfi-13.test ("string-copy!"): Add tests.

10 years agoImplement 'exact-integer?' and 'scm_is_exact_integer'.
Mark H Weaver [Fri, 20 Dec 2013 23:12:37 +0000 (18:12 -0500)]
Implement 'exact-integer?' and 'scm_is_exact_integer'.

* libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer):
  New procedures.
  (scm_integer_p): Improve docstring.

* libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer):
  New prototypes.

* doc/ref/api-data.texi (Integers): Add docs.

* test-suite/tests/numbers.test ("exact-integer?"): Add tests.

10 years agoFix doc that incorrectly claimed (integer? +inf.0) => #t.
Mark H Weaver [Thu, 9 Jan 2014 02:39:55 +0000 (21:39 -0500)]
Fix doc that incorrectly claimed (integer? +inf.0) => #t.

Fixes <http://bugs.gnu.org/16356>.
Reported by Zefram <zefram@fysh.org>.

* doc/ref/api-data.texi (Integers): Add docs.  Fix outdated example
  that incorrectly showed (integer? +inf.0) => #t.

10 years agoscm_primitive_load: Simplify code using 'scm_open_file_with_encoding'.
Mark H Weaver [Tue, 24 Dec 2013 11:48:44 +0000 (06:48 -0500)]
scm_primitive_load: Simplify code using 'scm_open_file_with_encoding'.

* libguile/load.c (scm_primitive_load): Use
  'scm_open_file_with_encoding'.

10 years agoboot-9: add comment about autoload thread-unsafety.
Mark H Weaver [Tue, 24 Dec 2013 12:40:40 +0000 (07:40 -0500)]
boot-9: add comment about autoload thread-unsafety.

* module/ice-9/boot-9.scm: Add comment about lack of thread-safety in
  handling of autoloads.

10 years agoread: Avoid signed integer overflow in 'read_decimal_integer'.
Mark H Weaver [Tue, 24 Dec 2013 13:00:51 +0000 (08:00 -0500)]
read: Avoid signed integer overflow in 'read_decimal_integer'.

* libguile/read.c (read_decimal_integer): Avoid overflow.

10 years agoIncrement SCM_N_READ_OPTIONS for 'curly-infix' option.
Mark H Weaver [Tue, 24 Dec 2013 19:39:44 +0000 (14:39 -0500)]
Increment SCM_N_READ_OPTIONS for 'curly-infix' option.

* libguile/private-options.h (SCM_N_READ_OPTIONS): Increment to 8.
  This should have been done when the 'curly-infix' was added.

10 years agoFix inlining of tail list to apply.
Ian Price [Wed, 23 Oct 2013 10:14:26 +0000 (11:14 +0100)]
Fix inlining of tail list to apply.

Fixes <http://bugs.gnu.org/15533>.

* module/language/tree-il/peval.scm (peval): Final list argument to
  `apply' should not be inlined if it is mutable.
* test-suite/tests/peval.test ("partial evaluation"): Add test.

10 years agoThank Aleix.
Ludovic Courtès [Sat, 21 Dec 2013 21:01:38 +0000 (22:01 +0100)]
Thank Aleix.

10 years agoallow specifying a required version in GUILE_PROGS
Aleix Conchillo Flaque [Thu, 3 Oct 2013 22:49:07 +0000 (15:49 -0700)]
allow specifying a required version in GUILE_PROGS

* meta/guile.m4: GUILE_PROGS now takes an optional argument to specify a
  required Guile version. By default, it requires Guile >= 2.0. A micro
  version can also be specified (e.g. GUILE_PROGS([2.0.10])).

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
10 years agoRevert "Fix bound-identifier=? to compare binding names, not just symbolic names."
Mark H Weaver [Tue, 17 Dec 2013 03:55:25 +0000 (22:55 -0500)]
Revert "Fix bound-identifier=? to compare binding names, not just symbolic names."

This reverts commit 70c74b847680d3b239e591afa2e99c51a712980c.

10 years agoFix bound-identifier=? to compare binding names, not just symbolic names.
Mark H Weaver [Mon, 16 Dec 2013 00:04:59 +0000 (19:04 -0500)]
Fix bound-identifier=? to compare binding names, not just symbolic names.

Fixes <http://bugs.gnu.org/16158>.

* module/ice-9/psyntax.scm (bound-id=?): Use 'id-var-name' to compare
  binding names (gensyms), not just symbolic names.

* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syntax.test: Add test.

10 years agoHide EINTR returns from 'accept'.
Ludovic Courtès [Sun, 15 Dec 2013 21:48:41 +0000 (22:48 +0100)]
Hide EINTR returns from 'accept'.

* libguile/socket.c (scm_accept): Wrap 'accept' call in 'SCM_SYSCALL'.

10 years agosyntax-case: fix error reporting for misplaced ellipses.
Mark H Weaver [Fri, 13 Dec 2013 17:53:24 +0000 (12:53 -0500)]
syntax-case: fix error reporting for misplaced ellipses.

Reported by taylanbayirli@gmail.com (Taylan Ulrich B.).

* module/ice-9/psyntax.scm (cvt*): Use 'syntax-case' to destructure
  the pattern tail, instead of 'pair?', 'car', and 'cdr'.
  (gen-clause): When checking for errors, check for misplaced ellipsis
  before duplicate pattern variables, to improve the error message in
  case of multiple misplaced ellipses.

* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syntax.test: Add tests.

10 years agoTHANKS Tom Tromey.
Mark H Weaver [Fri, 13 Dec 2013 05:34:40 +0000 (00:34 -0500)]
THANKS Tom Tromey.

* THANKS: Add Tom Tromey to fixes section.

10 years agoAdd missing FUNC_NAME defines for pair accessors.
Tom Tromey [Tue, 10 Dec 2013 14:43:35 +0000 (07:43 -0700)]
Add missing FUNC_NAME defines for pair accessors.

* libguile/pairs.c (scm_car, scm_cdr, scm_caar, scm_cadr, scm_cdar,
  scm_cddr, scm_caaar, scm_caadr, scm_cadar, scm_caddr, scm_cdaar,
  scm_cdadr, scm_cddar, scm_cdddr, scm_caaaar, scm_caaadr, scm_caadar,
  scm_caaddr, scm_cadaar, scm_cadadr, scm_caddar, scm_cadddr,
  scm_cdaaar, scm_cdaadr, scm_cdadar, scm_cdaddr, scm_cddaar,
  scm_cddadr, scm_cdddar, scm_cddddr): Add missing FUNC_NAME defines.

10 years agoFix computation of LIBLOBJS.
Tom Tromey [Tue, 10 Dec 2013 14:43:34 +0000 (07:43 -0700)]
Fix computation of LIBLOBJS.

Fixes <http://bugs.gnu.org/14193>.

* configure.ac (LIBLOBJS): Add prefix to computed .lo file name so
  dependencies work properly.

10 years agovm: Gracefully handle stack overflows.
Ludovic Courtès [Thu, 5 Dec 2013 21:18:02 +0000 (22:18 +0100)]
vm: Gracefully handle stack overflows.

Fixes <http://lists.gnu.org/archive/html/guile-user/2013-12/msg00017.html>.
Reported by rvclayton@verizon.net (R. Clayton).

* libguile/vm.c (reinstate_stack_reserve): New function.
  (vm_error_stack_overflow): Install it as an unwind handler.
* test-suite/tests/control.test ("the-vm")["stack overflow reinstates
  stack reserve"]: New test.

10 years agoFix brainfuck comment
Andy Wingo [Mon, 2 Dec 2013 18:02:05 +0000 (19:02 +0100)]
Fix brainfuck comment

* module/language/brainfuck/parse.scm: Fix outdated comment.

10 years agoFix brainfuck->scheme compiler.
Andy Wingo [Mon, 2 Dec 2013 18:00:57 +0000 (19:00 +0100)]
Fix brainfuck->scheme compiler.

* module/language/brainfuck/compile-scheme.scm (compile-scheme): Fix
  brainfuck compiler.

10 years agoGOOPS doc fix: #:dsupers is the init keyword for the dsupers slot.
Mark H Weaver [Sun, 1 Dec 2013 23:35:37 +0000 (18:35 -0500)]
GOOPS doc fix: #:dsupers is the init keyword for the dsupers slot.

* doc/ref/goops.texi (Metaclasses): #:dsupers is the initialization
  keyword for the dsupers slot, not #:supers.

10 years agoCritical sections in guardians do not need to block asyncs
Andy Wingo [Thu, 28 Nov 2013 15:20:42 +0000 (16:20 +0100)]
Critical sections in guardians do not need to block asyncs

* libguile/guardians.c: Critical sections here cannot cause an
  async_tick, so they do not need to block asyncs.

10 years agoDeprecate gc-live-object-stats
Andy Wingo [Thu, 28 Nov 2013 13:40:58 +0000 (14:40 +0100)]
Deprecate gc-live-object-stats

* libguile/gc.h:
* libguile/gc.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_gc_live_object_stats): Deprecate; it hasn't
  worked in the whole 2.0 series.

10 years agoMake (ice-9 popen) thread-safe.
Mark H Weaver [Sun, 17 Nov 2013 07:54:31 +0000 (02:54 -0500)]
Make (ice-9 popen) thread-safe.

Fixes <http://bugs.gnu.org/15683>.
Reported by David Pirotte <david@altosw.be>.

* module/ice-9/popen.scm: Import (ice-9 threads) and (srfi srfi-9).
  (<pipe-info>): New record type.
  (port/pid-table): Mark as deprecated in comment.
  (port/pid-table-mutex): New variable.
  (open-pipe*): Store the pid in the pipe-info record, and store the
  pipe-info as a port property.  Guard the pipe-info instead of the
  port.  Lock 'port/pid-table-mutex' while mutating 'port/pid-table'.
  (fetch-pid): Removed.
  (fetch-pipe-info): New procedure.
  (close-process-quietly): Removed.
  (close-pipe): Use 'fetch-pipe-info' instead of 'fetch-pid'.  Clear
  the pid from the pipe-info.  Improve error messages.
  (reap-pipes): Adapt to the fact that the pipe-info is now guarded
  instead of the port.  Incorporate the 'waitpid' code that was
  previously in 'close-process-quietly', but let the port finalizer
  close the port.  Clear the pid from the pipe-info.

10 years agoStylistic improvements for (ice-9 popen).
Mark H Weaver [Sun, 17 Nov 2013 07:46:08 +0000 (02:46 -0500)]
Stylistic improvements for (ice-9 popen).

* module/ice-9/popen.scm (close-process, close-process-quietly): Accept
  'port' and 'pid' as separate arguments.  Improve style.
  (close-pipe, read-pipes): Improve style.

10 years agoMake port properties accessible from Scheme.
Mark H Weaver [Sun, 17 Nov 2013 06:11:57 +0000 (01:11 -0500)]
Make port properties accessible from Scheme.

* libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
  (scm_i_port_property, scm_i_set_port_property_x): New procedures,
  available from Scheme as '%port-property' and '%set-port-property!'.

* libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
  (scm_i_port_property, scm_i_set_port_property_x): New prototypes.

* libguile/read.c (set_port_read_option, init_read_options): Adapt to
  use scm_i_port_property and scm_i_set_port_property_x.

10 years agoMake guardians thread-safe.
Mark H Weaver [Sun, 17 Nov 2013 08:35:09 +0000 (03:35 -0500)]
Make guardians thread-safe.

* libguile/guardians.c (t_guardian): Add mutex.
  (finalize_guarded, scm_i_guard, scm_i_get_one_zombie): Lock mutex and
  block system asyncs during critical sections.
  (scm_make_guardian): Initialize mutex.

10 years agoBlock system asyncs while 'overrides_lock' is held.
Mark H Weaver [Sun, 17 Nov 2013 08:19:32 +0000 (03:19 -0500)]
Block system asyncs while 'overrides_lock' is held.

* libguile/procprop.c (scm_set_procedure_property_x): Block system
  asyncs while overrides_lock is held.  Use dynwind block in case
  an exception is thrown.

10 years agoAdd mutex locking functions that also block asyncs.
Mark H Weaver [Sun, 17 Nov 2013 09:00:29 +0000 (04:00 -0500)]
Add mutex locking functions that also block asyncs.

* libguile/async.h (scm_i_pthread_mutex_lock_block_asyncs,
  scm_i_pthread_mutex_unlock_unblock_asyncs): New macros.

* libguile/threads.c (do_unlock_with_asyncs): New static helper.
  (scm_i_dynwind_pthread_mutex_lock_block_asyncs): New function.

* libguile/threads.h (scm_i_dynwind_pthread_mutex_lock_block_asyncs):
  Add prototype.

10 years agoConvert test-suite/tests/exceptions.test to use hygienic macros.
Chris K. Jester-Young [Sun, 27 Oct 2013 21:31:38 +0000 (17:31 -0400)]
Convert test-suite/tests/exceptions.test to use hygienic macros.

* test-suite/tests/exceptions.test (push): New syntax parameter.
  (throw-test): Convert to a syntax-rules macro, using syntax parameters
  to support the otherwise-unhygienic use of "push".

10 years agoWeb: accept "UTC" as the zone offset in date headers.
Mark H Weaver [Mon, 18 Nov 2013 05:44:17 +0000 (00:44 -0500)]
Web: accept "UTC" as the zone offset in date headers.

Fixes <http://bugs.gnu.org/14128>.
Reported by Aleix Conchillo Flaqué <aconchillo@gmail.com>.

* module/web/http.scm (parse-zone-offset): Accept "UTC".

10 years agoTHANKS David Thompson
Mark H Weaver [Tue, 19 Nov 2013 04:04:18 +0000 (23:04 -0500)]
THANKS David Thompson

* THANKS: Add David Thompson to list of contributors.