bpt/guile.git
9 years agoAccessor methods only apply to subclasses with their slot
Andy Wingo [Mon, 26 Jan 2015 16:54:26 +0000 (17:54 +0100)]
Accessor methods only apply to subclasses with their slot

* libguile/goops.c (is_accessor_method, scm_compute_applicable_methods):
  Fix regression from 51f66c912078a25ab0380c8fc070abb73d178d98 (2009).
  Accessor methods are added on each subclass on which the slot is
  present; therefore if a subclass doesn't have a method, then the
  methods doesn't apply.  Truly fixes #17355, unlike
  583a23bf104c84d9617222856e188f3f3af4934d.

* module/oop/goops.scm (compute-cmethod, compute-getter-method)
  (compute-setter-method): Revert earlier changes.

* test-suite/tests/goops.test ("accessor slots"): Update for new
  expectations, in agreement with Guile 1.8.

9 years agoFix accessor struct field inlining
Andy Wingo [Sat, 24 Jan 2015 18:22:47 +0000 (19:22 +0100)]
Fix accessor struct field inlining

* module/oop/goops/compile.scm: Inline into goops.scm, leaving a
  compatible interface stub behind.

* module/oop/goops/dispatch.scm: Don't import (oop goops compile), to
  break circularities.

* module/oop/goops.scm: Move (oop goops util) include up to the top, and
  import (ice-9 match).
  (compute-cmethod): Move here from compile.scm.  Add a special case for
  accessor methods, so as to fix bug #17355.
  (compute-getter-method, compute-setter-method): #:procedure slot is
  now generic.

* test-suite/tests/goops.test ("accessor slots"): New test.

9 years agoReally disable stack underflow checks when VM_CHECK_UNDERFLOW == 0.
Ludovic Courtès [Thu, 22 Jan 2015 12:50:49 +0000 (13:50 +0100)]
Really disable stack underflow checks when VM_CHECK_UNDERFLOW == 0.

* libguile/vm-engine.h: Use '#if VM_CHECK_UNDERFLOW' instead of
  '#ifdef'.

9 years agoFix #:init-value on class-allocated slots
Andy Wingo [Thu, 22 Jan 2015 11:40:43 +0000 (12:40 +0100)]
Fix #:init-value on class-allocated slots

Allocating an instance of a class with a #:class or #:each-subclass slot
allocation should not re-initialize the class-allocated slot.  In Guile
1.8, this worked by effectively doing a slot-bound? within
%initialize-object.  In Guile 2.0 we instead initialize the slot when it
is allocated -- in compute-get-n-set.

* module/oop/goops.scm (compute-getters-n-setters): Don't set an
  init-thunk for class-allocated slots.
  (compute-get-n-set): Initialize class-allocated slots here, if an
  init-thunk or init-value are present.

* test-suite/tests/goops.test ("#:each-subclass"): Add test.

9 years agoFix buffer overrun with unbuffered custom binary input ports.
Ludovic Courtès [Sun, 18 Jan 2015 20:52:48 +0000 (21:52 +0100)]
Fix buffer overrun with unbuffered custom binary input ports.

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

Before that, in 'cbip_fill_input', BUFFERED would be set to 0 when
reading from 'scm_getc' et al, because 'shortbuf' was being used.  Thus,
we could eventually execute this line:

      /* Copy the data back to the internal buffer.  */
      memcpy ((char *) c_port->read_pos, SCM_BYTEVECTOR_CONTENTS (bv),
      c_octets);

But 'read_pos' would quickly point to the fields beyond 'shortbuf',
thereby leading to a corruption of the 'scm_t_port' itself.

* libguile/r6rs-ports.c (cbip_setvbuf): When READ_SIZE is 0, keep using
  BV as the 'read_buf'.
  (cbip_fill_input): Adjust assertion to accept 'read_buf_size = 1'.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port unbuffered & 'get-string-all'", "custom binary input port
  unbuffered UTF-8 & 'get-string-all'"]: New tests.

9 years agoImprove output of command-line errors.
Ludovic Courtès [Tue, 13 Jan 2015 08:30:08 +0000 (09:30 +0100)]
Improve output of command-line errors.

* module/ice-9/command-line.scm (shell-usage): Add 'newline' call when
  FMT is true.
  (compile-shell-switches)[error]: Prepend "error: " and append "~%" to
  FMT.
  Use a lower-case message.

9 years agoOptimize 'string-hash'.
Ludovic Courtès [Sun, 11 Jan 2015 21:40:07 +0000 (22:40 +0100)]
Optimize 'string-hash'.

This yields a 50% improvement on the "narrow string" benchmark of
'hash.bm', 41% on "wide string", and 76% on "long string".

* libguile/hash.c (scm_i_string_hash): Rewrite to avoid
  'scm_i_string_ref' calls.

9 years agoAdd 'string-hash' benchmarks.
Ludovic Courtès [Sun, 11 Jan 2015 21:37:00 +0000 (22:37 +0100)]
Add 'string-hash' benchmarks.

* benchmark-suite/benchmarks/hash.bm: New file.
* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add it.

9 years agoDeprecate 'scm_string_hash'.
Ludovic Courtès [Sun, 11 Jan 2015 21:11:17 +0000 (22:11 +0100)]
Deprecate 'scm_string_hash'.

This function has been unused internally for some time and is undocumented.

* libguile/hash.c (scm_string_hash): Wrap if #if SCM_ENABLE_DEPRECATED
  == 1.
* libguile/hash.h (scm_string_hash): Likewise, and replace SCM_API with
  SCM_DEPRECATED.

9 years agoOptimize 'write' for strings.
Ludovic Courtès [Sun, 11 Jan 2015 20:57:54 +0000 (21:57 +0100)]
Optimize 'write' for strings.

This shows a 19% improvement on the "string without escapes"
micro-benchmark of 'write.bm', and 12% on "string with escapes".

* libguile/print.c (iprin1) <scm_tc7_string>: Replace 'scm_i_string_ref'
  loop with a call to 'write_string'.
  (display_character): Adjust description of return value in comment.
  (write_string): New function.

9 years agoAvoid converting the 'mode' argument of 'open-file'.
Ludovic Courtès [Sun, 11 Jan 2015 19:58:34 +0000 (20:58 +0100)]
Avoid converting the 'mode' argument of 'open-file'.

* libguile/fports.c (scm_open_file_with_encoding): const-qualify 'md'
  and 'ptr'.  Add call to 'scm_i_try_narrow_string'.  Use
  'scm_i_string_chars' instead of 'scm_to_locale_string' plus '
  scm_dynwind_free'.
* test-suite/tests/ports.test ("invalid wide mode string",
  "valid wide mode string"): New tests.

9 years agostatprof: 'statprof' and 'with-statprof' return the code's return values.
Ludovic Courtès [Sun, 11 Jan 2015 19:44:36 +0000 (20:44 +0100)]
statprof: 'statprof' and 'with-statprof' return the code's return values.

* module/statprof.scm (statprof): Return the return values of THUNK.
  (with-statprof): Adjust docstring accordingly.
* test-suite/tests/statprof.test ("return values"): New test.
* doc/ref/statprof.texi (Statprof): Adjust accordingly.

9 years agoImprove deprecation message of 'scm_add_to_port_table'.
Ludovic Courtès [Fri, 9 Jan 2015 14:47:15 +0000 (15:47 +0100)]
Improve deprecation message of 'scm_add_to_port_table'.

Reported by Thien-Thi Nguyen <ttn@gnu.org>.

* libguile/ports.c (scm_add_to_port_table): Mention
  'scm_new_port_table_entry'.

9 years agobuild: Better handle substitutions in 'guile-2.0.pc' & co.
Ludovic Courtès [Sat, 6 Dec 2014 14:57:23 +0000 (15:57 +0100)]
build: Better handle substitutions in 'guile-2.0.pc' & co.

* meta/Makefile.am (dependency_substitutions): Use '|' as the separate
  instead of ','.  See <http://hydra.nixos.org/build/17684751>.

9 years agobuild: Add missing substitutions for 'guile-2.0.pc'.
Ludovic Courtès [Wed, 3 Dec 2014 22:09:12 +0000 (23:09 +0100)]
build: Add missing substitutions for 'guile-2.0.pc'.

This is a followup to 5fac1a7.

* meta/Makefile.am (substitute): Add GUILE_* and LIBGUILE_* substitutions,
  and $(dependency_substitutions).
  (dependency_substitutions): New variable.

9 years agodoc: Clarify the unit of the 'offset' argument of 'seek'.
Ludovic Courtès [Wed, 3 Dec 2014 18:07:28 +0000 (19:07 +0100)]
doc: Clarify the unit of the 'offset' argument of 'seek'.

Reported in <http://bugs.gnu.org/18520>
by David Kastrup <dak@gnu.org>.

* doc/ref/api-io.texi (Random Access): Clarify the unit of the 'offset'
  argument to 'seek'.

9 years agoAdd the 'guild' and 'guile' variables to 'guile-2.0.pc'.
Ludovic Courtès [Wed, 3 Dec 2014 17:59:00 +0000 (18:59 +0100)]
Add the 'guild' and 'guile' variables to 'guile-2.0.pc'.

* configure.ac: Remove meta/guile-2.0.pc and
  meta/guile-2.0-uninstalled.pc from 'AC_CONFIG_FILES'.
* meta/Makefile.am (substitute): New variable.
  (guile-2.0.pc, guile-2.0-uninstalled.pc): New targets.
  (guile-config, guild): Use $(substitute) instead of duplicated sed
  script.
  (CLEANFILES): Add the .pc files.
* meta/guile-2.0.pc.in (bindir, guild, guile): New variables.
* doc/ref/libguile-parallel.texi (Parallel Installations): Document the
  'guild' and 'guile' pkg-config variables.

9 years agoUpdate (system base lalr) from upstream.
Ludovic Courtès [Tue, 2 Dec 2014 20:25:26 +0000 (21:25 +0100)]
Update (system base lalr) from upstream.

Suggested by Jan Nieuwenhuizen <janneke@gnu.org>.

* module/system/base/lalr.upstream.scm: Update from
  <https://github.com/schemeway/lalr-scm.git>, commit 4c4f149.

9 years agodoc: Tell when 'GUILE_INSTALL_LOCALE' first appeared.
Ludovic Courtès [Tue, 2 Dec 2014 17:35:55 +0000 (18:35 +0100)]
doc: Tell when 'GUILE_INSTALL_LOCALE' first appeared.

* doc/ref/guile-invoke.texi (Environment Variables): Add footnote about
  the Guile version where 'GUILE_INSTALL_LOCALE' appeared.

9 years agoImplement SRFI 28: Basic Format Strings.
Chris Jester-Young [Sun, 30 Nov 2014 10:20:54 +0000 (05:20 -0500)]
Implement SRFI 28: Basic Format Strings.

* module/srfi/srfi-28.scm: New module.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-28.scm.
* doc/ref/srfi-modules.texi (SRFI-28): New node.

9 years agodoc: Clarify behavior of 'select' in the presence of signal interruptions.
Ludovic Courtès [Thu, 20 Nov 2014 20:32:44 +0000 (21:32 +0100)]
doc: Clarify behavior of 'select' in the presence of signal interruptions.

Fixes <http://bugs.gnu.org/18988>.
Reported by Chris Vine <chris@cvine.freeserve.co.uk>.

* libguile/filesys.c (scm_select): Clarify handling of signal
  interruptions.
* doc/ref/posix.texi (Ports and File Descriptors): Adjust accordingly.

9 years agoRecognize m68k, s390x, and sh4 as compilation targets
Rob Browning [Wed, 24 Sep 2014 21:47:55 +0000 (16:47 -0500)]
Recognize m68k, s390x, and sh4 as compilation targets

* module/system/base/target.scm (cpu-endianness, triplet-pointer-size):
  Add cases for "m68k", "sh4", and "s390x".

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
9 years agoFix bytevector-fill! to accept fill arguments greater than 127.
Mark H Weaver [Wed, 12 Nov 2014 05:40:47 +0000 (00:40 -0500)]
Fix bytevector-fill! to accept fill arguments greater than 127.

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

* libguile/bytevectors.c (scm_bytevector_fill_x): Accept fill arguments
  between -128 and 255.

* test-suite/tests/bytevectors.test ("2.2 General Operations"): Add
  tests.

9 years agoAvoid signed overflow and use size_t in bytevectors.c.
Mark H Weaver [Wed, 12 Nov 2014 05:35:34 +0000 (00:35 -0500)]
Avoid signed overflow and use size_t in bytevectors.c.

* libguile/bytevectors.c (ULONG_MAX): Remove (unportable) fallback
  definition.  It is no longer used.
  (scm_make_bytevector): Use 'size_t' instead of 'unsigned' for
  indices.  Use 'scm_t_uint8' instead of 'signed char' for elements
  and c_fill.  Previously relied on GNU-C-specific behavior when
  casting integers in the range 128-255 to signed char.
  (GENERIC_INTEGER_ACCESSOR_PROLOGUE, INTEGER_LIST_TO_BYTEVECTOR)
  (scm_bytevector_eq_p, scm_bytevector_copy_x, scm_bytevector_copy)
  (scm_bytevector_to_u8_list, scm_u8_list_to_bytevector)
  (scm_bytevector_fill_x): Use 'size_t' instead of 'unsigned' for
  indices.  Use 'scm_t_uint8' for elements.

9 years agoAdd SCM_VALIDATE_SIZE_COPY and SCM_NUM2SIZE.
Mark H Weaver [Wed, 12 Nov 2014 05:19:10 +0000 (00:19 -0500)]
Add SCM_VALIDATE_SIZE_COPY and SCM_NUM2SIZE.

* libguile/validate.h (SCM_VALIDATE_SIZE_COPY, SCM_NUM2SIZE): New
  macros.

9 years agoFix bytevector-copy when applied to SRFI-4 homogeneous numeric vectors.
Mark H Weaver [Wed, 12 Nov 2014 04:14:26 +0000 (23:14 -0500)]
Fix bytevector-copy when applied to SRFI-4 homogeneous numeric vectors.

Fixes <http://bugs.gnu.org/18866>.
Reported by tantalum <sph@posteo.eu>.

* libguile/bytevectors.c (scm_bytevector_copy): Always create a VU8
  bytevector.

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

9 years agoAvoid bash-specific '==' comparison operator in guile.m4.
Thomas Klausner [Wed, 29 Oct 2014 23:33:39 +0000 (00:33 +0100)]
Avoid bash-specific '==' comparison operator in guile.m4.

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

* meta/guile.m4 (GUILE_PROGS): Use '=' instead of the bash-specific '=='
  comparison operator in 'test' call.

9 years agoFix strerror error handling when given a non-integer argument.
Mark H Weaver [Wed, 12 Nov 2014 03:30:14 +0000 (22:30 -0500)]
Fix strerror error handling when given a non-integer argument.

Fixes <http://bugs.gnu.org/18065>.
Reported and fixed by Glenn Michaels <gmichaels@Safe-mail.net>.

* libguile/error.c (scm_strerror): Convert the argument to a C integer
  outside of the critical section, to avoid deadlock on error.
* THANKS: Add Glenn Michaels to the fixes section.

9 years agoReduce C heap allocations in 'search-path'.
Ludovic Courtès [Fri, 31 Oct 2014 22:27:44 +0000 (23:27 +0100)]
Reduce C heap allocations in 'search-path'.

* libguile/load.c (scm_c_string_has_an_ext): Rename to...
  (string_has_an_ext): ... this.  Add docstring.  Change
  'str' to be an SCM, and remove 'len' parameter.  Change loop body to
  use 'scm_string_suffix_p'.
  (search_path): Update accordingly.

9 years agoUse on-stack or GC-managed memory in 'search-path'.
Ludovic Courtès [Fri, 31 Oct 2014 21:53:04 +0000 (22:53 +0100)]
Use on-stack or GC-managed memory in 'search-path'.

* libguile/load.c (stringbuf_free): Remove.
  (stringbuf_grow): Use 'scm_gc_malloc_pointerless' instead of 'scm_realloc'.
  (search_path): Use stack-allocated INITIAL_BUFFER instead of
  'scm_malloc'.  Remove use of 'stringbuf_free'.

9 years agoi18n: Add HAVE_USELOCALE as a requirement for USE_GNU_LOCALE_API.
Mark H Weaver [Wed, 15 Oct 2014 00:36:11 +0000 (20:36 -0400)]
i18n: Add HAVE_USELOCALE as a requirement for USE_GNU_LOCALE_API.

* configure.ac: Check for uselocale.
* libguile/i18n.c: Add HAVE_USELOCALE to the list of requirements
  before defining USE_GNU_LOCALE_API.

9 years agoscm_boot_guile: Gracefully handle the case where argc == 0.
Mark H Weaver [Sat, 11 Oct 2014 02:36:54 +0000 (22:36 -0400)]
scm_boot_guile: Gracefully handle the case where argc == 0.

Fixes <http://bugs.gnu.org/18680>.
Reported by Nala Ginrut <nalaginrut@gmail.com>.

* libguile/init.c (scm_boot_guile): Do not canonicalize argv[0] unless
  argc > 0.
* THANKS: Add Nala Ginrut to the fixes section.

9 years agoThank Per Bothner.
Mark H Weaver [Tue, 7 Oct 2014 03:53:08 +0000 (23:53 -0400)]
Thank Per Bothner.

* THANKS: Add Per Bothner to the "libraries" section (for SRFI-64).

9 years agobuild: Adjust autogen.sh to 'libtoolize' name on Darwin.
Ludovic Courtès [Mon, 6 Oct 2014 13:22:44 +0000 (15:22 +0200)]
build: Adjust autogen.sh to 'libtoolize' name on Darwin.

Reported by Daniel Llorens.

* autogen.sh: Use 'glibtoolize' on Darwin.

9 years agoread: Accept "\(" in string literals.
Mark H Weaver [Thu, 2 Oct 2014 00:45:41 +0000 (20:45 -0400)]
read: Accept "\(" in string literals.

Suggested by David Kastrup <dak@gnu.org> in <http://bugs.gnu.org/13644>.

* libguile/read.c (scm_read_string_like_syntax): Accept "\(" as
  equivalent to "(".
* doc/ref/api-data.texi (String Syntax): Document it.
* test-suite/tests/reader.test ("reading"): Add test.

9 years agodocs: Fix documented return type of 'scm_c_export'.
Mark H Weaver [Wed, 1 Oct 2014 22:57:44 +0000 (18:57 -0400)]
docs: Fix documented return type of 'scm_c_export'.

Fixes <http://bugs.gnu.org/17869>.
Reported and fixed by Alexei Matveev <alexei.matveev@gmail.com>.

* doc/ref/api-modules.texi (Accessing Modules from C): Change documented
  return type of 'scm_c_export' to 'void' to reflect reality.
* THANKS: Add Alexei Matveev to the fixes section.

9 years agoAdd (ice-9 unicode) module
Andy Wingo [Fri, 12 Sep 2014 15:00:59 +0000 (17:00 +0200)]
Add (ice-9 unicode) module

* libguile/unicode.c:
* libguile/unicode.h:
* test-suite/tests/unicode.test:
* module/ice-9/unicode.scm: New files.

* module/Makefile.am:
* libguile/Makefile.am:
* test-suite/Makefile.am:
* libguile/init.c: Wire new files into the build.

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

9 years agopeval: Handle optional argument inits that refer to previous arguments.
Mark H Weaver [Sun, 28 Sep 2014 16:51:11 +0000 (12:51 -0400)]
peval: Handle optional argument inits that refer to previous arguments.

Fixes <http://bugs.gnu.org/17634>.
Reported by Josep Portella Florit <jpf@primfilat.com>.

* module/language/tree-il/peval.scm (inlined-application): When inlining
  an application whose operator is a lambda expression with optional
  arguments that rely on default initializers, expand into a series of
  nested let expressions, to ensure that previous arguments are in scope
  when the default initializers are evaluated.

* test-suite/tests/peval.test ("partial evaluation"): Add tests.

9 years agodoc: Improve description of vector-unfold and vector-unfold-right.
Mark H Weaver [Thu, 25 Sep 2014 02:03:58 +0000 (22:03 -0400)]
doc: Improve description of vector-unfold and vector-unfold-right.

* doc/ref/srfi-modules.texi (SRFI-43 Constructors)[vector-unfold]:
  Improve description.
* module/srfi/srfi-43.scm (vector-unfold, vector-unfold-right):
  Improve docstrings.

9 years agoAdd 'EXIT_SUCCESS' and 'EXIT_FAILURE'.
Ludovic Courtès [Mon, 22 Sep 2014 20:51:23 +0000 (22:51 +0200)]
Add 'EXIT_SUCCESS' and 'EXIT_FAILURE'.

Suggested by Frank Terbeck <ft@bewatermyfriend.org>.

* libguile/posix.c (scm_init_posix): Define 'EXIT_SUCCESS' and
  'EXIT_FAILURE'.
* doc/ref/posix.texi (Processes): Document them.

9 years agoguile-readline: Use the current directory if HOME is unset.
David Michael [Mon, 22 Sep 2014 03:21:25 +0000 (23:21 -0400)]
guile-readline: Use the current directory if HOME is unset.

* guile-readline/ice-9/readline.scm (history-file): When the HOME
  environment variable is unset, use the current directory instead.

9 years agobuild: Use 'libtoolize' in autogen.sh.
Ludovic Courtès [Sat, 20 Sep 2014 12:36:09 +0000 (14:36 +0200)]
build: Use 'libtoolize' in autogen.sh.

Fixes <http://bugs.gnu.org/18470>.
Reported by Rob Browning <rlb@defaultvalue.org>.

* autogen.sh: Invoke 'libtoolize' instead of 'libtool'.

9 years agoFix SCM_SMOB_OBJECT{_,_0_,_1_,_2_,_3_}LOC.
David Kastrup [Sat, 20 Sep 2014 09:17:54 +0000 (05:17 -0400)]
Fix SCM_SMOB_OBJECT{_,_0_,_1_,_2_,_3_}LOC.

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

* libguile/smob.h (SCM_SMOB_OBJECT_LOC, SCM_SMOB_OBJECT_0_LOC)
  (SCM_SMOB_OBJECT_1_LOC, SCM_SMOB_OBJECT_2_LOC)
  (SCM_SMOB_OBJECT_3_LOC): These elementary API macros have been broken
  by commit 56164dc47f6616b359f0ad23be208f01a77b55fa in 2009.

Signed-off-by: David Kastrup <dak@gnu.org>
9 years agoguild disassemble: Use #:prefix instead of #:renamer.
Mark H Weaver [Sat, 20 Sep 2014 08:51:02 +0000 (04:51 -0400)]
guild disassemble: Use #:prefix instead of #:renamer.

* module/scripts/disassemble.scm: Use #:prefix instead of #:renamer
  in #:use-module clause.

9 years agoDocument #:prefix option in use-module clauses.
Mark H Weaver [Sat, 20 Sep 2014 08:42:49 +0000 (04:42 -0400)]
Document #:prefix option in use-module clauses.

* doc/ref/api-modules.texi (Using Guile Modules): Document #:prefix
  option.

9 years agoSRFI-43: vector-concatenate: Fix error message.
Mark H Weaver [Sat, 20 Sep 2014 08:09:14 +0000 (04:09 -0400)]
SRFI-43: vector-concatenate: Fix error message.

* module/srfi/srfi-43.scm (vector-concatenate): Fix the 'who' of an
  error message.

9 years agoVM: Use register "a3" for IP_REG on m68k.
Mark H Weaver [Sat, 20 Sep 2014 08:05:43 +0000 (04:05 -0400)]
VM: Use register "a3" for IP_REG on m68k.

Subset of a patch by Andreas Schwab <schwab@linux-m68k.org>.
Reported by Rob Browning <rlb@defaultvalue.org>.

* libguile/vm-engine.h (IP_REG)[__mc68000__]: Use register "a3".

9 years agoVM: Allow the C compiler to choose FP_REG on ARM.
Mark H Weaver [Sat, 20 Sep 2014 07:59:51 +0000 (03:59 -0400)]
VM: Allow the C compiler to choose FP_REG on ARM.

Reported by Rob Browning <rlb@defaultvalue.org>.

* libguile/vm-engine.h (IP_REG)[__arm__]: Remove explicit register
  choice ("r7") for FP_REG, which was reported to cause compilation
  failures on ARM.

9 years agoDo not assume that 64-bit integers will be 64-bit aligned.
Mark H Weaver [Sat, 20 Sep 2014 07:49:46 +0000 (03:49 -0400)]
Do not assume that 64-bit integers will be 64-bit aligned.

* libguile/foreign.c (raw_bytecode, objcode_cells):
* libguile/gsubr.c (raw_bytecode, objcode_cells): Use SCM_ALIGNED to
  ensure 64-bit alignment.

9 years agoVM: ASM_MUL for ARM: Add earlyclobber constraint to the SMULL outputs.
Mark H Weaver [Sat, 20 Sep 2014 01:18:09 +0000 (21:18 -0400)]
VM: ASM_MUL for ARM: Add earlyclobber constraint to the SMULL outputs.

Reported by Rob Browning <rlb@defaultvalue.org>.

* libguile/vm-i-scheme.c (ASM_MUL)[ARM]: Add earlyclobber (&) constraint
  to the SMULL output registers.

9 years agotests: Link test against Gnulib.
Ludovic Courtès [Wed, 17 Sep 2014 11:43:55 +0000 (13:43 +0200)]
tests: Link test against Gnulib.

Reported by Eli Zaretskii <eliz@gnu.org>.

* test-suite/standalone/Makefile.am (test_scm_take_locale_symbol_LDADD):
  Add libgnu.la, for the 'strdup' replacement.

9 years agoThank Franck.
Ludovic Courtès [Tue, 26 Aug 2014 21:41:14 +0000 (23:41 +0200)]
Thank Franck.

9 years agoHandle ~p in 'format' warnings.
Ludovic Courtès [Tue, 26 Aug 2014 21:40:22 +0000 (23:40 +0200)]
Handle ~p in 'format' warnings.

Fixes <http://bugs.gnu.org/18299>.
Reported by Frank Terbeck <ft@bewatermyfriend.org>.

* module/language/tree-il/analyze.scm (format-string-argument-count):
  Add case for ~p.
* test-suite/tests/tree-il.test ("warnings")["format"]("~p", "~p, too
  few arguments", "~:p", "~:@p, too many arguments", "~:@p, too few
  arguments"): New tests.

9 years agoOn MS-Windows, don't return file names with backslashes from search-path.
Eli Zaretskii [Fri, 15 Aug 2014 06:47:52 +0000 (09:47 +0300)]
On MS-Windows, don't return file names with backslashes from search-path.

* libguile/load.c (search_path): On MS-Windows, convert all
  backslashes to forward slashes if the file was found on PATH.

9 years agoCopy the result from 'nl_langinfo' before it can be overwritten.
Mark H Weaver [Thu, 14 Aug 2014 02:47:32 +0000 (22:47 -0400)]
Copy the result from 'nl_langinfo' before it can be overwritten.

Based on a patch by Eli Zaretskii <eliz@gnu.org>.

* libguile/i18n.c (copy_string_or_null): New static function.
  (scm_nl_langinfo): Use 'copy_string_or_null' to copy the result from
  'nl_langinfo' and 'nl_langinfo_l' before the next call and before
  releasing the locale mutex.

9 years agoMake temporary file in coding.test work on MS-Windows.
Eli Zaretskii [Wed, 13 Aug 2014 15:41:15 +0000 (18:41 +0300)]
Make temporary file in coding.test work on MS-Windows.

* test-suite/tests/coding.test (with-temp-file): Instead of
  hard-coding "/tmp" as the temporary directory, use $TMPDIR or
  $TEMP from the environment, and fall back on "/tmp" if none of
  those 2 is defined.

9 years agodoc: "!#" does not need to appear on a line of its own.
Ludovic Courtès [Tue, 12 Aug 2014 20:23:07 +0000 (22:23 +0200)]
doc: "!#" does not need to appear on a line of its own.

* doc/ref/api-evaluation.texi (Block Comments): Remove "which must appear on a
  line of their own".  Reported by David Michael <fedora.dm0@gmail.com>.

9 years agoClarify that object-properties cannot be reliably applied to numbers.
David Kastrup [Mon, 11 Aug 2014 02:50:08 +0000 (22:50 -0400)]
Clarify that object-properties cannot be reliably applied to numbers.

* doc/ref/api-utility.texi (Object Properties)[make-object-property]:
  Clarify that object-properties cannot be reliably applied to numbers.

Signed-off-by: David Kastrup <dak@gnu.org>
9 years agoProvide curried version of define*-public.
Ian Price [Thu, 31 Jul 2014 15:05:58 +0000 (16:05 +0100)]
Provide curried version of define*-public.

* module/ice-9/curried-definitions.scm (define*-public): New macro.

9 years agoPrevent add-to-load-path from adding duplicate entries
Ian Price [Wed, 30 Jul 2014 17:58:16 +0000 (18:58 +0100)]
Prevent add-to-load-path from adding duplicate entries

* module/ice-9/boot-9.scm (add-to-load-path): Remove argument from
  %load-path (if it exists) before pushing. This also means that the
  `elt' will always be at the front of %load-path.

9 years agoRecognize more ARM targets.
Ludovic Courtès [Fri, 4 Jul 2014 15:26:41 +0000 (17:26 +0200)]
Recognize more ARM targets.

Suggested by Dale P. Smith.

* module/system/base/target.scm (cpu-endianness): Add cases for
  "arm.*eb", "^aarch64.*be", and "aarch64".  Change "arm" case to
  "arm.*".
  (triplet-pointer-size): Allow underscore as in 'aarch64_be'.
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")["armeb-unknown-linux-gnu",
  "aarch64-linux-gnu", "aarch64_be-linux-gnu"]: New tests.

9 years agoFix bit-count* bug
Andy Wingo [Sat, 28 Jun 2014 13:24:29 +0000 (15:24 +0200)]
Fix bit-count* bug

* libguile/bitvectors.c (scm_bit_count_star): Fix typo introduced in
  2005 refactor (!) in which the second arg was erroneously taken from
  the first arg.

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

* doc/ref/api-compound.texi: Fix doc example for u32vector selector.

9 years agobuild: Support pthread builds without 'pthread_cancel' support (Android).
Ludovic Courtès [Fri, 4 Jul 2014 13:52:15 +0000 (15:52 +0200)]
build: Support pthread builds without 'pthread_cancel' support (Android).

Reported by Sylvain Beucler <beuc@beuc.net>.

* configure.ac: Check for 'pthread_cancel'.
* libguile/threads.c (scm_cancel_thread): Conditionalize on
  !SCM_USE_PTHREAD_THREADS || defined HAVE_PTHREAD_CANCEL.
* test-suite/tests/threads.test (require-cancel-thread): New procedure.
  ("timed joining fails if timeout exceeded", "join-thread returns
  timeoutval on timeout", "cancel succeeds", "handler result passed to
  join", "can cancel self"): Use it.

9 years agobuild: Use 'LT_LIB_M' to determine whether -lm is needed.
Ludovic Courtès [Fri, 4 Jul 2014 13:37:38 +0000 (15:37 +0200)]
build: Use 'LT_LIB_M' to determine whether -lm is needed.

* configure.ac: Use 'LT_LIB_M' instead of 'AC_CHECK_LIB(m, cos)'.
  Suggested by Sylvain Beucler <beuc@beuc.net>.

9 years agoRecognize arm-* target triplets.
Ludovic Courtès [Fri, 4 Jul 2014 13:35:06 +0000 (15:35 +0200)]
Recognize arm-* target triplets.

Reported by Sylvain Beucler <beuc@beuc.net>.

* module/system/base/target.scm (cpu-endianness): Add case where CPU is
  "arm".
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")["arm-unknown-linux-androideabi"]:
  New test.

9 years agoRemove trailing whitespace from ports.test.
Eli Zaretskii [Thu, 3 Jul 2014 18:05:49 +0000 (21:05 +0300)]
Remove trailing whitespace from ports.test.

9 years agoUntabify some test files.
Eli Zaretskii [Thu, 3 Jul 2014 18:02:23 +0000 (21:02 +0300)]
Untabify some test files.

* test-suite/tests/ports.test: Untabify.
* test-suite/tests/posix.test: Untabify.
* test-suite/tests/r6rs-files.test: Untabify.

9 years agoFix problems with Windows file names that use backslashes.
Eli Zaretskii [Thu, 3 Jul 2014 17:58:19 +0000 (20:58 +0300)]
Fix problems with Windows file names that use backslashes.

* libguile/load.c (scm_i_mirror_backslashes): New function.
  (scm_init_load_path): Call it to produce MS-Windows file names
  with forward slashes.
  (FILE_NAME_SEPARATOR_STRING): Define as "/" on all platforms.

* libguile/load.h (scm_i_mirror_backslashes): Add prototype.

* libguile/init.c (scm_boot_guile): Call scm_i_mirror_backslashes
  on argv[0].

* libguile/filesys.c (scm_getcwd): Call scm_i_mirror_backslashes
  on the directory name returned by getcwd.

* test-suite/tests/ports.test ("file name separators"): New test.

9 years agoFix calculation of CPU set size for getaffinity.
Eli Zaretskii [Thu, 3 Jul 2014 16:30:02 +0000 (19:30 +0300)]
Fix calculation of CPU set size for getaffinity.

* libguile/posix.c (cpu_set_to_bitvector): Use CPU_SETSIZE, not
  sizeof, to compute the size of the CPU set.

9 years agoProvide a more reasonable default value for stack limit on MS-Windows.
Eli Zaretskii [Thu, 3 Jul 2014 16:26:21 +0000 (19:26 +0300)]
Provide a more reasonable default value for stack limit on MS-Windows.

* libguile/debug.c (init_stack_limit) [__MINGW32__]: Use
  VirtualQuery to compute the stack limit on MS-Windows.

9 years agoUnconditionally build and test the ice-9/popen module.
Eli Zaretskii [Thu, 3 Jul 2014 16:20:00 +0000 (19:20 +0300)]
Unconditionally build and test the ice-9/popen module.

* module/Makefile.am (ICE_9_SOURCES): Add ice-9/popen.scm.
  (ICE_9_SOURCES) [BUILD_ICE_9_POPEN]: Remove conditional addition
  of ice-9/popen.scm.
  (SCRIPTS_SOURCES): Add scripts/autofrisk.scm and
  scripts/scan-api.scm unconditionally.
  (SCRIPTS_SOURCES) [BUILD_ICE_9_POPEN]: Remove conditional addition
  of scripts/autofrisk.scm and scripts/scan-api.scm.

* configure.ac: Remove the BUILD_ICE_9_POPEN condition.

* test-suite/tests/popen.test (if-supported): Don't test for 'fork
 feature being supported.

9 years ago More fixes for deleting files whose ports are not closed.
Eli Zaretskii [Wed, 2 Jul 2014 18:21:52 +0000 (21:21 +0300)]
More fixes for deleting files whose ports are not closed.

* test-suite/tests/r6rs-files.test: Close the port after
using it.

* test-suite/tests/posix.test ("mkstemp!"): Close the port after
using it.

9 years ago Make 'system*' available on MS-Windows.
Eli Zaretskii [Wed, 2 Jul 2014 15:38:28 +0000 (18:38 +0300)]
Make 'system*' available on MS-Windows.

* libguile/simpos.c (scm_system_star) [!HAVE_FORK]: An
implementation of 'system*' for MS-Windows, which doesn't have
'fork', but can use 'spawnvp' in this case.

9 years ago Fix deletion of ports.test test file on MS-Windows.
Eli Zaretskii [Wed, 2 Jul 2014 15:28:06 +0000 (18:28 +0300)]
Fix deletion of ports.test test file on MS-Windows.

* test-suite/tests/ports.test ("fdes->port", "seek")
("truncate-file"): Close every file and port we open, to avoid
failure to delete the test file on MS-Windows when the test is
completed.

9 years agoFix compilation of scm_nl_langinfo when some nl_langinfo items are missing.
Eli Zaretskii [Sun, 22 Jun 2014 16:11:30 +0000 (19:11 +0300)]
Fix compilation of scm_nl_langinfo when some nl_langinfo items are missing.

* i18n.c (scm_nl_langinfo): Don't assume that both INT_* and
  the corresponding non-INT_* items are always either all defined
  or all undefined.

9 years agotests: Improve lack-of-/dev/null detection.
Ludovic Courtès [Thu, 12 Jun 2014 21:19:29 +0000 (23:19 +0200)]
tests: Improve lack-of-/dev/null detection.

Suggested by Eli Zaretskii <eliz@gnu.org>.

* test-suite/test-suite/lib.scm (%null-device): Test for Windows based
  by checking for a drive letter in the current directory name.

9 years agoi18n: Adjust tests for Windows.
Ludovic Courtès [Wed, 11 Jun 2014 13:03:31 +0000 (15:03 +0200)]
i18n: Adjust tests for Windows.

* test-suite/tests/i18n.test (mingw?): New variable.
  (%french-locale-name, %french-utf8-locale-name,
  %turkish-utf8-locale-name, %german-utf8-locale-name,
  %greek-utf8-locale-name): Add name of corresponding Windows codepage,
  when MINGW? is true.
  (under-turkish-utf8-locale-or-unresolved): Add exception for
  "mingw32".

Co-authored-by: Eli Zaretskii <eliz@gnu.org>
9 years agoi18n: Ignore LC_MESSAGES on MinGW.
Ludovic Courtès [Wed, 11 Jun 2014 12:54:21 +0000 (14:54 +0200)]
i18n: Ignore LC_MESSAGES on MinGW.

* libguile/locale-categories.h (MESSAGES): Add condition on
  !(defined(LC_MAX) && LC_MESSAGES > LC_MAX).
* test-suite/tests/i18n.test ("locale objects")["make-locale (2 args,
  list)", "make-locale (3 args)", "locale?"]: Use LC_NUMERIC or LC_TIME
  instead of LC_MESSAGES.

Co-authored-by: Eli Zaretskii <eliz@gnu.org>
9 years agotests: Use NUL instead of /dev/null on MinGW.
Ludovic Courtès [Wed, 11 Jun 2014 12:35:26 +0000 (14:35 +0200)]
tests: Use NUL instead of /dev/null on MinGW.

Reported by Eli Zaretskii <eliz@gnu.org>.

* test-suite/test-suite/lib.scm (%null-device): New variable.
* test-suite/tests/c-api.test (egrep): Use %NULL-DEVICE instead of
  /dev/null.
* test-suite/tests/popen.test ("open-input-pipe")["no duplicate"]:
  Likewise.

9 years agoR6RS library documentation fix
Taylan Ulrich B [Thu, 5 Jun 2014 17:27:53 +0000 (19:27 +0200)]
R6RS library documentation fix

* doc/ref/api-modules.texi (R6RS Libraries): Move 'export' before
  'import' in the example library form, as required by R6RS.

9 years agoFix typo in `transform-string' doc.
Dmitry Bogatov [Thu, 5 Jun 2014 00:49:28 +0000 (20:49 -0400)]
Fix typo in `transform-string' doc.

* doc/ref/texinfo.texi: Fix single typo.

Signed-off-by: Dmitry Bogatov <KAction@gnu.org>
9 years agoOptimize scm_ilength and 'length+'.
Mark H Weaver [Thu, 5 Jun 2014 00:42:21 +0000 (20:42 -0400)]
Optimize scm_ilength and 'length+'.

* libguile/list.c (scm_ilength): Test for SCM_NULL_OR_NIL_P only after
  testing scm_is_pair.  Conform to GNU coding standards.

* libguile/srfi-1.c (scm_srfi1_length_plus): Ditto.

9 years agotest-guild-compile: Increase sleep time before sending SIGINT.
Mark H Weaver [Thu, 5 Jun 2014 00:40:23 +0000 (20:40 -0400)]
test-guild-compile: Increase sleep time before sending SIGINT.

* test-suite/standalone/test-guild-compile: Increase sleep time
  before sending SIGINT, for slow machines.

9 years agoAvoid quadratic expansion time in 'and' and 'or' macros.
Mark H Weaver [Wed, 4 Jun 2014 23:30:16 +0000 (19:30 -0400)]
Avoid quadratic expansion time in 'and' and 'or' macros.

Fixes <http://bugs.gnu.org/17147>.
Reported by David Kastrup <dak@gnu.org>.

* module/ice-9/boot-9.scm (and, or): Use dotted tail instead of ellipsis
  in patterns.

9 years ago'guild compile' doesn't leave temporary files behind it.
Ludovic Courtès [Tue, 3 Jun 2014 12:58:55 +0000 (14:58 +0200)]
'guild compile' doesn't leave temporary files behind it.

* module/scripts/compile.scm (compile): Add 'sigaction' call.
* test-suite/standalone/test-guild-compile: New file.
* test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.

9 years agoSRFI-1 'length+' raises an error unless passed a proper or circular list.
Mark H Weaver [Fri, 18 Apr 2014 19:04:12 +0000 (15:04 -0400)]
SRFI-1 'length+' raises an error unless passed a proper or circular list.

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

* libguile/srfi-1.c (scm_srfi1_length_plus): Rewrite to raise an error
  unless passed a proper or circular list, based on code from
  'scm_ilength'.

* test-suite/tests/srfi-1.test (length+): Add tests.

9 years agoMark system async functions as SCM_API.
Mark H Weaver [Sun, 1 Jun 2014 23:08:25 +0000 (19:08 -0400)]
Mark system async functions as SCM_API.

Fixes <http://bugs.gnu.org/17661>.
Reported and fixed by Chris Vine <chris@cvine.freeserve.co.uk>.

* libguile/async.h (scm_c_call_with_blocked_asyncs)
  (scm_c_call_with_unblocked_asyncs, scm_dynwind_block_asyncs)
  (scm_dynwind_unblock_asyncs): Mark as SCM_API.

* THANKS: Add Chris Vine to fixes section.

9 years agoSlightly simplify 'scm_open_process'.
Ludovic Courtès [Wed, 28 May 2014 21:06:45 +0000 (23:06 +0200)]
Slightly simplify 'scm_open_process'.

* libguile/posix.c (scm_open_process): Call 'scm_fdes_to_port' with the
  '0' flag, and remove 'scm_setvbuf' calls.

9 years agordelim: Speed up 'read-string' (aka. 'get-string-all'.)
Ludovic Courtès [Wed, 28 May 2014 21:00:20 +0000 (23:00 +0200)]
rdelim: Speed up 'read-string' (aka. 'get-string-all'.)

This yields a 20% improvement on the "read-string" benchmark.

* module/ice-9/rdelim.scm (read-string): Rewrite as a 'case-lambda',
  with a tight loop around 'read-char', and without using
  'read-string!'.
* test-suite/tests/rdelim.test ("read-string")["longer than 100 chars,
  with limit"]: New test.
* benchmark-suite/benchmarks/ports.bm ("rdelim")["read-string"]: New
  benchmark.

9 years agotests: Add test for <http://bugs.gnu.org/17466>.
Ludovic Courtès [Wed, 28 May 2014 20:19:16 +0000 (22:19 +0200)]
tests: Add test for <http://bugs.gnu.org/17466>.

* test-suite/tests/r6rs-ports.test ("7.2.8 Binary
  Input")("http://bugs.gnu.org/17466"): New test.

9 years agoFix shrinking of contiguous bytevectors, as from 'get-bytevector-n'.
Ludovic Courtès [Wed, 28 May 2014 17:26:45 +0000 (19:26 +0200)]
Fix shrinking of contiguous bytevectors, as from 'get-bytevector-n'.

Fixes <http://bugs.gnu.org/17466>.
Reported by J Kalbhenn <jkal@posteo.eu>.

* libguile/bytevectors.c (scm_c_shrink_bytevector): When BV is
  contiguous, add use of 'SCM_BYTEVECTOR_SET_CONTENTS'.

9 years agoweb: Keep the default size for the client's in-kernel receive buffer.
Ludovic Courtès [Fri, 23 May 2014 20:00:21 +0000 (22:00 +0200)]
web: Keep the default size for the client's in-kernel receive buffer.

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

* module/web/client.scm (open-socket-for-uri): Remove call to
  'setsockopt'.  Contrary to what the comment said, its effect was to
  shrink the receive buffer from 124 KiB (the default size, per
  /proc/sys/net/core/rmem_default on Linux-based systems) to 12 KiB.

9 years agotests: Add test for _IOLBF.
Ludovic Courtès [Wed, 21 May 2014 13:34:22 +0000 (15:34 +0200)]
tests: Add test for _IOLBF.

* test-suite/tests/ports.test ("pipe, fdopen, and _IOLBF"): New test.

9 years agoSilence GCC warning.
Ludovic Courtès [Fri, 16 May 2014 09:32:43 +0000 (11:32 +0200)]
Silence GCC warning.

* libguile/fports.c (scm_setvbuf): Initialize 'drained'.  GCC 4.9 raises
  a "may be used uninitialized warning" for 'drained', because it can't
  tell that 'drained' is initialized anytime NDRAINED > 0.

10 years agoPrefer foreign objects over smobs in manual
Andy Wingo [Mon, 28 Apr 2014 16:00:05 +0000 (18:00 +0200)]
Prefer foreign objects over smobs in manual

* doc/ref/api-memory.texi (Memory Blocks): Recommend against
  scm_gc_free.  Refer to foreign objects instead of smobs.  Remove
  discussion of scm_must_malloc et al.

* doc/ref/guile.texi (API Reference): Rename SMOB menu item.

* doc/ref/libguile-snarf.texi (Function Snarfing): Update example to not
  refer to smobs.
* doc/ref/tools.texi (How guile-snarf works): Likewise.

10 years agoAdd new standalone tests to gitignore
Andy Wingo [Mon, 28 Apr 2014 15:47:54 +0000 (17:47 +0200)]
Add new standalone tests to gitignore

* .gitignore: Add entries.

10 years agoRemove doc/example-smob/
Andy Wingo [Mon, 28 Apr 2014 15:46:59 +0000 (17:46 +0200)]
Remove doc/example-smob/

* doc/example-smob/: Remove example.  It's smaller than it used to be in
  Guile 1.8, and with foreign objects there's practically nothing
  interesting to test.

* doc/oldfmt.c: Remove this hoary thing.

* doc/README:
* doc/Makefile.am: Update.

10 years agoRemove SMOB tutorial; update manual.
Andy Wingo [Mon, 28 Apr 2014 15:45:07 +0000 (17:45 +0200)]
Remove SMOB tutorial; update manual.

* doc/ref/libguile-smobs.texi: Remove; this tutorial is superseded by
  libguile-foreign-objects.

* doc/ref/libguile-foreign-objects.texi: Proofreading.

* doc/ref/libguile-program.texi: Update Dia examples to refer to foreign
  objects.

* doc/ref/libguile-concepts.texi (Garbage Collection): Update to
  accurately describe the BDW-GC, and to avoid reference to mark
  functions.

* doc/ref/guile.texi: Remove libguile-smobs, and reword API menu.

* doc/ref/api-utility.texi (Equality): Mention GOOPS instead of SMOBs.

* doc/ref/api-smobs.texi (Smobs): Describe as a legacy interface.
  Exhort readers against the writing of mark functions.

* doc/ref/api-foreign-objects.texi (Foreign Objects): Proofreading.

* doc/ref/api-control.texi (Catch): Fix ref to point to foreign
  objects.

* doc/ref/Makefile.am: Remove libguile-smobs.texi.

10 years agoAdd foreign object documentation
Andy Wingo [Mon, 28 Apr 2014 14:27:09 +0000 (16:27 +0200)]
Add foreign object documentation

* doc/ref/api-foreign-objects.texi:
* doc/ref/libguile-foreign-objects.texi: New files.

* doc/ref/guile.texi:
* doc/ref/Makefile.am: Link new files into docs.

10 years agoAdd more foreign object interfaces
Andy Wingo [Mon, 28 Apr 2014 09:27:31 +0000 (11:27 +0200)]
Add more foreign object interfaces

* libguile/foreign-object.c:
* libguile/foreign-object.h (scm_make_foreign_object_1)
  (scm_make_foreign_object_2, scm_make_foreign_object_3)
  (scm_make_foreign_object_n): Change to take void * arguments, and to
  add a comment to the header indicating that these are convenience
  constructors.

* libguile/foreign-object.c:
* libguile/foreign-object.h (scm_foreign_object_unsigned_ref)
  (scm_foreign_object_unsigned_set_x): New functions, equivalent to the
  old scm_foreign_object_ref and scm_foreign_object_set_x.

* libguile/foreign-object.c:
* libguile/foreign-object.h (scm_foreign_object_signed_ref)
  (scm_foreign_object_signed_set_x): New functions taking
  scm_t_signed_bits.

* libguile/foreign-object.c:
* libguile/foreign-object.h (scm_foreign_object_ref)
  (scm_foreign_object_set_x): New functions that take void*.