bpt/guile.git
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.

10 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*.

10 years agoAvoid non-constant struct initializers
Andy Wingo [Mon, 28 Apr 2014 09:01:44 +0000 (11:01 +0200)]
Avoid non-constant struct initializers

* libguile/foreign-object.c (scm_make_foreign_object_2):
  (scm_make_foreign_object_3): Avoid non-constant struct initializers.

10 years agoAdd scm_make_foreign_object_0; optimize scm_make_foreign_object_n.
Andy Wingo [Mon, 28 Apr 2014 08:55:26 +0000 (10:55 +0200)]
Add scm_make_foreign_object_0; optimize scm_make_foreign_object_n.

* libguile/foreign-object.c (scm_make_foreign_object_0): New function.
  (scm_make_foreign_object_n): Pre-fetch layout_chars.

* libguile/foreign-object.h: Add scm_make_foreign_object_0.

10 years agoNew foreign object facility, to replace SMOBs
Andy Wingo [Sun, 27 Apr 2014 12:47:40 +0000 (14:47 +0200)]
New foreign object facility, to replace SMOBs

* libguile/foreign-object.c:
* libguile/foreign-object.h:
* module/system/foreign-object.scm:
* test-suite/standalone/test-foreign-object-c.c:
* test-suite/standalone/test-foreign-object-scm: New files.

* test-suite/standalone/Makefile.am:
* module/Makefile.am:
* libguile/Makefile.am: Add new files.

* libguile.h: Add foreign-object.h.
* libguile/init.c (scm_i_init_guile): Call scm_register_foreign_object.

10 years agoFix foreign slot initialization and access
Andy Wingo [Sun, 27 Apr 2014 09:02:35 +0000 (11:02 +0200)]
Fix foreign slot initialization and access

* libguile/goops.c (scm_sys_initialize_object): Refactor initialization
  so that we don't ref uninitialized slots before initializing them.
  This allows foreign slots, whose initial value is 0, to be initialized
  via #:init-form.

* module/oop/goops.scm (@slot-ref, @slot-set!): Remove definitions.
  Change callers to use struct-ref and struct-set!.  slot-ref and
  slot-set! were only marginally more efficient and were much more
  dangerous.  This change allows the standard accessors to work on
  foreign slots; that was not the case before, as the 'u' fields of the
  struct were read as if they were 'p' slots.
* module/language/tree-il/compile-glil.scm (lambda): Remove support for
  compiling @slot-ref/@slot-set!.  These were private to GOOPS.

* test-suite/tests/goops.test ("active-slot"): Update to not expect a
  ref before initialization.
  ("foreign slots"): Add tests.

10 years agoAdd interface to disable automatic finalization
Andy Wingo [Thu, 17 Apr 2014 13:29:13 +0000 (15:29 +0200)]
Add interface to disable automatic finalization

* libguile/finalizers.h:
* libguile/finalizers.c (run_finalizers_async_thunk): Call the new
  scm_run_finalizers helper.
  (scm_set_automatic_finalization_enabled, scm_run_finalizers): New
  functions.
  (scm_init_finalizers): Only set a finalizer notifier if automatic
  finalization is enabled.

* doc/ref/libguile-smobs.texi (Garbage Collecting Smobs): Add discussion
  of concurrency.

* doc/ref/api-smobs.texi (Smobs): Document new functions.

10 years agoSupport weak vectors, arrays, and bitvectors in (system base types).
Mark H Weaver [Thu, 24 Apr 2014 21:57:19 +0000 (17:57 -0400)]
Support weak vectors, arrays, and bitvectors in (system base types).

* module/system/base/types.scm (%tc7-wvect, %tc7-array, %tc7-bitvector):
  New variables.
  (cell->object): Add cases for weak vectors, arrays, and bitvectors.

10 years agoprint: avoid triggering deprecation warnings when printing weak vectors.
Mark H Weaver [Thu, 24 Apr 2014 21:55:47 +0000 (17:55 -0400)]
print: avoid triggering deprecation warnings when printing weak vectors.

* libguile/print.c (iprin1): Use 'scm_c_weak_vector_ref' to access
  elements of weak vectors.

10 years agobuild: Clean up rules for meta/{guild,guile-config}.
Ludovic Courtès [Thu, 24 Apr 2014 21:46:20 +0000 (23:46 +0200)]
build: Clean up rules for meta/{guild,guile-config}.

* meta/Makefile.am (guile-config, guild): Avoid useless 'cat'
  invocation'.  Quote all occurrences of '@'.
  Suggested by Eric Blake <eblake@redhat.com>.

10 years agobuild: Honor program name transformation in 'guild'.
Ludovic Courtès [Thu, 24 Apr 2014 09:16:21 +0000 (11:16 +0200)]
build: Honor program name transformation in 'guild'.

* configure.ac: Remove erroneous 'guile_program_name' substitute; see
  <https://lists.gnu.org/archive/html/autoconf/2014-04/msg00010.html>
  for details.  Remove 'meta/guild' config file.
* meta/Makefile.am (guild): New target.
  (CLEANFILES): Add 'guild'.
* meta/guild.in: Remove 'prefix' and 'exec_prefix' definitions; use
  @installed_guile@.

10 years agoFix memory leak on `realloc' failure
Dmitry Bogatov [Thu, 10 Apr 2014 05:23:28 +0000 (09:23 +0400)]
Fix memory leak on `realloc' failure

* libguile/script.c (realloc0): New helper.
  (script_read_arg, scm_get_meta_args): Use realloc0, not realloc.

Signed-off-by: Dmitry Bogatov <KAction@gnu.org>
10 years agoUpdate libgc URL in README.
Mark H Weaver [Wed, 16 Apr 2014 04:49:40 +0000 (00:49 -0400)]
Update libgc URL in README.

* README: Update libgc URL.  Suggested by Ian Grant
  <ian.a.n.grant@googlemail.com>.

10 years agoReadline history preserves newlines
Andy Wingo [Mon, 14 Apr 2014 14:12:14 +0000 (16:12 +0200)]
Readline history preserves newlines

* guile-readline/ice-9/readline.scm (make-readline-port): Preserve
  newlines.  This preserves the semantics of history entries that
  contain until-end-of-line comments using `;'.

10 years agoMake reverse! forego the cost of SCM_VALIDATE_LIST
David Kastrup [Tue, 1 Apr 2014 14:24:29 +0000 (16:24 +0200)]
Make reverse! forego the cost of SCM_VALIDATE_LIST

* libguile/list.c (scm_reverse_x): Do not validate first argument to
  reverse! in advance.  Instead undo reversal in error case.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Mark H Weaver <mhw@netris.org>
10 years agoCalculate usecs correctly in thread-sleep!
Nathaniel Alderson [Thu, 19 Sep 2013 21:02:26 +0000 (14:02 -0700)]
Calculate usecs correctly in thread-sleep!

* module/srfi/srfi-18.scm (thread-sleep!): Correctly compute
  microseconds.

* test-suite/tests/srfi-18.test: Add test.

10 years agoBump version number for 2.0.11.
Ludovic Courtès [Thu, 20 Mar 2014 20:21:21 +0000 (21:21 +0100)]
Bump version number for 2.0.11.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_REVISION): Increment.

10 years agoUpdate NEWS.
Ludovic Courtès [Thu, 20 Mar 2014 20:20:59 +0000 (21:20 +0100)]
Update NEWS.

10 years agotests: Add #undef NDEBUG when using <assert.h>.
Ludovic Courtès [Thu, 20 Mar 2014 08:43:01 +0000 (09:43 +0100)]
tests: Add #undef NDEBUG when using <assert.h>.

* test-suite/standalone/test-loose-ends.c,
  test-suite/standalone/test-num2integral.c,
  test-suite/standalone/test-round.c,
  test-suite/standalone/test-scm-c-bind-keyword-arguments.c,
  test-suite/standalone/test-scm-c-read.c,
  test-suite/standalone/test-scm-values.c,
  test-suite/standalone/test-smob-mark.c,
  test-suite/standalone/test-srfi-4.c: Add #undef NDEBUG.

10 years agotests: Check 'simple-format' with closed current-output-port.
Ludovic Courtès [Thu, 20 Mar 2014 08:40:42 +0000 (09:40 +0100)]
tests: Check 'simple-format' with closed current-output-port.

This is a follow-up to e26ab06.

* libguile/print.c (scm_simple_format): Pass 1 to
  SCM_VALIDATE_OPORT_VALUE, for 'destination'.
* test-suite/tests/format.test ("simple-format"): Add test.

10 years agoFix (rnrs io simple) to open file ports in textual mode.
Mark H Weaver [Thu, 20 Mar 2014 03:36:46 +0000 (23:36 -0400)]
Fix (rnrs io simple) to open file ports in textual mode.

Fixes <http://bugs.gnu.org/17044>.
Reported and diagnosed by Xin Wang <dram.wang@gmail.com>.

* module/rnrs/io/simple.scm (open-input-file, open-output-file): Pass
  missing buffer-mode argument to open-file-{input,output}-port.
  Previously, (native-transcoder) was incorrectly passed as the
  buffer-mode argument, so no transcoder was provided, thus creating a
  binary port.

10 years agosimple-format: Don't assume the current output port is valid.
Mark H Weaver [Wed, 19 Mar 2014 21:55:20 +0000 (17:55 -0400)]
simple-format: Don't assume the current output port is valid.

* libguile/print.c (scm_simple_format): Validate the current output
  port.

10 years agoFix breakage of SRFI-4 C accessors
Andy Wingo [Wed, 19 Mar 2014 21:41:19 +0000 (22:41 +0100)]
Fix breakage of SRFI-4 C accessors

* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix bad assumption that
  width was a byte width.  Thanks very much to Barry Fishman for the
  report, and to Daniel Llorens for tracking it down.

* test-suite/standalone/Makefile.am (test_srfi_4_CFLAGS):
* test-suite/standalone/test-srfi-4.c: Add test.

10 years agoBump version number for 2.0.10.
Ludovic Courtès [Mon, 17 Mar 2014 22:18:38 +0000 (23:18 +0100)]
Bump version number for 2.0.10.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_REVISION): Increment.

10 years agoFix typo in NEWS.
Ludovic Courtès [Mon, 17 Mar 2014 22:06:21 +0000 (23:06 +0100)]
Fix typo in NEWS.

10 years agoUpdate NEWS.
Ludovic Courtès [Mon, 17 Mar 2014 21:13:09 +0000 (22:13 +0100)]
Update NEWS.

* NEWS: Remove last 'XXX'.

10 years agoUpdate NEWS
Andy Wingo [Mon, 17 Mar 2014 21:05:39 +0000 (22:05 +0100)]
Update NEWS

* NEWS: Update.

10 years agoUpdate NEWS.
Ludovic Courtès [Mon, 17 Mar 2014 20:55:26 +0000 (21:55 +0100)]
Update NEWS.

* NEWS: Move "New interfaces" higher.  Complement.

10 years agoFix newline preservation in @example with lines beginning with @
Andy Wingo [Thu, 27 Feb 2014 16:16:29 +0000 (17:16 +0100)]
Fix newline preservation in @example with lines beginning with @

* module/texinfo.scm (read-char-data): Preserve newlines in @example and
  similar environments in the case when the next line starts with an @.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test.

10 years agoMinor NEWS tweaks.
Mark H Weaver [Mon, 17 Mar 2014 06:54:47 +0000 (02:54 -0400)]
Minor NEWS tweaks.

* NEWS: Fix typo and improve wording in custom ellipsis entry.

10 years agoAdd first draft of NEWS for 2.0.10.
Mark H Weaver [Mon, 17 Mar 2014 06:42:38 +0000 (02:42 -0400)]
Add first draft of NEWS for 2.0.10.

* NEWS: Add first draft of changes in 2.0.10.

10 years agoDocumentation tweaks for the 'r7rs-symbols' read/print options.
Mark H Weaver [Mon, 17 Mar 2014 06:40:23 +0000 (02:40 -0400)]
Documentation tweaks for the 'r7rs-symbols' read/print options.

* doc/ref/api-data.texi (Symbol Read Syntax): Mention the 'r7rs-symbols'
  print option, and provide example code to enable both the read and
  print options.  Add 'r7rs-symbols' to the concept index.

10 years agobuild: Link 'test-unwind.c' against libgnu.la.
Ludovic Courtès [Sun, 16 Mar 2014 22:24:34 +0000 (23:24 +0100)]
build: Link 'test-unwind.c' against libgnu.la.

* test-suite/standalone/Makefile.am (test_unwind_LDADD): Add libgnu.la,
  which provides 'rpl_mkstemp' on systems missing 'mkstemp'.

10 years agoFix (system base types) on big-endian systems.
Mark H Weaver [Sat, 15 Mar 2014 17:23:21 +0000 (13:23 -0400)]
Fix (system base types) on big-endian systems.

* module/system/base/types.scm (cell->object): When reading stringbufs,
  use UTF-32BE on big-endian systems.

10 years agoSRFI-43 documentation tweaks
Mark H Weaver [Fri, 14 Mar 2014 19:07:10 +0000 (15:07 -0400)]
SRFI-43 documentation tweaks

* doc/ref/api-compound.texi (Vectors): Add cross-reference to SRFI-43.
* doc/ref/srfi-modules.texi (SRFI-43 Selectors): Simplify description of
  'vector-ref'.

10 years agoCheck SCM_USE_PTHREAD_THREADS using #if not #ifdef.
Mark H Weaver [Fri, 14 Mar 2014 03:21:48 +0000 (23:21 -0400)]
Check SCM_USE_PTHREAD_THREADS using #if not #ifdef.

* libguile/bdw-gc.h: Check SCM_USE_PTHREAD_THREADS using #if not #ifdef.

10 years agoInclude <config.h> in gen-scmconfig even when cross-compiling.
Mark H Weaver [Thu, 13 Mar 2014 20:47:11 +0000 (16:47 -0400)]
Include <config.h> in gen-scmconfig even when cross-compiling.

Partially reverts 8cb0d6d7fa9aaac316c29a64c541336b51b6f93d.

* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Remove
  -DCROSS_COMPILING=1 from cross-compiling case.
* libguile/gen-scmconfig.c: Include <config.h> regardless of
  whether CROSS_COMPILING is defined.

10 years agobuild: Remove libguile-2.0-gdb.scm and $infodir/dir upon uninstall.
Ludovic Courtès [Wed, 12 Mar 2014 14:56:11 +0000 (15:56 +0100)]
build: Remove libguile-2.0-gdb.scm and $infodir/dir upon uninstall.

* libguile/Makefile.am (uninstall-data-hook): New target.

10 years agobuild: Install libguile-2.0-gdb.scm after libguile-2.0.so.
Ludovic Courtès [Wed, 12 Mar 2014 14:18:27 +0000 (15:18 +0100)]
build: Install libguile-2.0-gdb.scm after libguile-2.0.so.

* libguile/Makefile.am (install-data-local): Rename to...
  (install-data-hook): ... this.  This guarantees that the rule runs
  after libguile-2.0.so has been installed.

10 years agobuild: Don't include <config.h> in native programs when cross-compiling.
Ludovic Courtès [Wed, 12 Mar 2014 13:35:07 +0000 (14:35 +0100)]
build: Don't include <config.h> in native programs when cross-compiling.

* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): When cross-compiling,
  pass -DCROSS_COMPILING=1.
  (c-tokenize.$(OBJEXT)): Likewise.
* libguile/c-tokenize.lex (%top): Include <config.h> only when
  CROSS_COMPILING is undefined.
* libguile/gen-scmconfig.c: Likewise.

10 years agobuild: Fix Gnulib compilation when $builddir != $srcdir.
Ludovic Courtès [Wed, 12 Mar 2014 13:24:11 +0000 (14:24 +0100)]
build: Fix Gnulib compilation when $builddir != $srcdir.

* configure.ac: Add -I$top_srcdir_absolute to 'CPPFLAGS'.  Fixes
  out-of-source-tree compilation of lib/regex.c.  Reported at
  <https://lists.gnu.org/archive/html/guile-devel/2014-03/msg00022.html>.

10 years agoTest for deleted weak pairs in hash-for-each.
David Thompson [Sat, 8 Mar 2014 22:15:52 +0000 (17:15 -0500)]
Test for deleted weak pairs in hash-for-each.

* libguile/hashtab.c (scm_internal_hash_for_each_handle): Test for
  deleted weak pairs.
* test-suite/tests/hash.test: Add test case.

10 years agoSCM_I_INUM: Rewrite to avoid unspecified behavior when not using GNU C.
Mark H Weaver [Wed, 12 Mar 2014 01:33:48 +0000 (21:33 -0400)]
SCM_I_INUM: Rewrite to avoid unspecified behavior when not using GNU C.

* libguile/numbers.h (SCM_I_INUM): Unless using GNU C, use a portable
  implementation that avoids unspecified behavior.

10 years agoSCM_SRS: Improve fallback implemention to avoid unspecified behavior.
Mark H Weaver [Wed, 12 Mar 2014 01:27:21 +0000 (21:27 -0400)]
SCM_SRS: Improve fallback implemention to avoid unspecified behavior.

* libguile/numbers.h (SCM_SRS): Rewrite preprocessor test to avoid
  left-shifting negative integers, and to test more comprehensively for
  the behavior we need.  Rewrite fallback implementation to avoid
  unspecified behavior.

10 years agoSRFI-60: Reimplement 'rotate-bit-field' on inums to be more portable.
Mark H Weaver [Wed, 12 Mar 2014 00:34:28 +0000 (20:34 -0400)]
SRFI-60: Reimplement 'rotate-bit-field' on inums to be more portable.

* libguile/srfi-60.c (scm_srfi60_rotate_bit_field): Avoid division by
  zero in the (start == end) case.  Rewrite inum case to work with
  unsigned integers in two's complement format.

* test-suite/tests/srfi-60.test ("rotate-bit-field"): Add more tests.

10 years agoUse 'offsetof' to avoid undefined behavior.
Mark H Weaver [Wed, 12 Mar 2014 00:31:38 +0000 (20:31 -0400)]
Use 'offsetof' to avoid undefined behavior.

* libguile/socket.c (SUN_LEN): Use 'offsetof'.

10 years agoAvoid undefined behavior regarding signed integers and left shifts.
Mark H Weaver [Wed, 12 Mar 2014 00:19:17 +0000 (20:19 -0400)]
Avoid undefined behavior regarding signed integers and left shifts.

* libguile/numbers.c (scm_logbit_p): If the requested bit is the sign
  bit (or above), check the sign portably.  Otherwise, ensure that we're
  testing the bit in a two's complement representation.
  (left_shift_exact_integer): Avoid left-shifting negative integers.

* libguile/vm-i-scheme.c (ash): Avoid left-shifting negative integers.

10 years agoAvoid signed overflow in random.c.
Mark H Weaver [Wed, 12 Mar 2014 00:15:27 +0000 (20:15 -0400)]
Avoid signed overflow in random.c.

* libguile/random.c (scm_i_mask32): Avoid signed overflow from shifting
  an unsigned char (promoted to signed int) 24 bits to the left.

10 years agoAvoid side effects in argument to SCM_I_INUM.
Mark H Weaver [Wed, 12 Mar 2014 00:12:32 +0000 (20:12 -0400)]
Avoid side effects in argument to SCM_I_INUM.

* libguile/vm-i-system.c (halt): Avoid side effects in argument to
  SCM_I_INUM.

10 years agoThank Paul.
Ludovic Courtès [Tue, 11 Mar 2014 23:03:03 +0000 (00:03 +0100)]
Thank Paul.

10 years agoProvide glthread/lock.h implementation in terms of Guile threads.
Ludovic Courtès [Tue, 11 Mar 2014 23:02:01 +0000 (00:02 +0100)]
Provide glthread/lock.h implementation in terms of Guile threads.

Fixes <http://bugs.gnu.org/14404>.
Thanks to Paul Eggert <eggert@cs.ucla.edu> for the suggestion.

* m4/gnulib-cache.m4: Avoid 'lock' module.
* m4/lock.m4, m4/threadlib.m4, lib/glthread/threadlib.c,
  lib/glthread/lock.c: Remove.
* lib/glthread/lock.h: Rewrite in terms of libguile/threads.h.
* m4/gnulib-common.m4, m4/gnulib-comp.m4, lib/Makefile.am,
  lib/unistd.in.h, maint.mk : Update, from Gnulib v0.1-92-g546ff82.

* configure.ac (GNULIB_LOCK): Define 'GNULIB_LOCK'.  Define
  'USE_POSIX_THREADS' when building with pthread support.
* Makefile.am (noinst_HEADERS): New variable.
  (BUILT_SOURCES): Add libguile/scmconfig.h.
  (libguile/scmconfig.h): New target.

10 years agoImprove compliance with C standards regarding signed integer shifts.
Mark H Weaver [Fri, 7 Mar 2014 09:21:46 +0000 (04:21 -0500)]
Improve compliance with C standards regarding signed integer shifts.

* configure.ac: Add -fwrapv when using GCC (or compatible), if
  supported.

* libguile/numbers.h (SCM_I_MAKINUM): Cast to scm_t_bits (unsigned)
  before shifting, to avoid undefined behavior.

10 years agochars.c: Remove duplicate 'const' specifiers.
Mark H Weaver [Fri, 7 Mar 2014 04:59:56 +0000 (23:59 -0500)]
chars.c: Remove duplicate 'const' specifiers.

* libguile/chars.c (scm_r5rs_charnums, scm_r6rs_charnums)
  (scm_r7rs_charnums, scm_C0_control_charnums, scm_alt_charnums):
  Remove duplicate 'const' specifiers.

10 years agosnarf.h: Declare static const function name vars as SCM_UNUSED.
Mark H Weaver [Fri, 7 Mar 2014 04:56:48 +0000 (23:56 -0500)]
snarf.h: Declare static const function name vars as SCM_UNUSED.

* libguile/snarf.h (SCM_DEFINE_GSUBR, SCM_DEFINE, SCM_PRIMITIVE_GENERIC,
  SCM_DEFINE_PUBLIC, SCM_PROC, SCM_REGISTER_PROC, SCM_GPROC): Declare
  static const function name variables as SCM_UNUSED to avoid spurious
  warnings.

10 years agoMake snarfing tools more robust to varied C preprocessor behavior.
Mark H Weaver [Thu, 6 Mar 2014 22:17:11 +0000 (17:17 -0500)]
Make snarfing tools more robust to varied C preprocessor behavior.

* libguile/guile-snarf.in (modern_snarf): Rewrite sed script to cope
  with newlines in the snarfed code segments, or multiple code segments
  on the same line.

* module/scripts/snarf-check-and-output-texi.scm (process-stream):
  Strip all 'hash' tokens from the stream.
  (do-command): Remove special cases that handled 'hash' tokens
  in a few places.

10 years agoSRFI-19: Update the table of leap seconds.
Mark H Weaver [Mon, 3 Mar 2014 22:20:03 +0000 (17:20 -0500)]
SRFI-19: Update the table of leap seconds.

* module/srfi/srfi-19.scm (leap-second-table): Update to include the two
  most recent leap seconds.

10 years agoAdd missing files to the test-suite Makefile.
Mark H Weaver [Sun, 2 Mar 2014 00:03:35 +0000 (19:03 -0500)]
Add missing files to the test-suite Makefile.

* test-suite/Makefile.am (SCM_TESTS): Add "tests/compiler.test",
  "tests/encoding-escapes.test", "tests/encoding-iso88591.test",
  "tests/encoding-iso88597.test", "tests/encoding-utf8.test",
  "tests/pairs.test", "tests/records.test", "tests/sort.test",
  "tests/srfi-17.test", "tests/srfi-18.test", "tests/srfi-98.test",
  "tests/streams.test", "tests/vectors.test", and "tests/web-client.test".

10 years agobuild: Make c-tokenize.c build on non-GNU systems.
Ludovic Courtès [Fri, 28 Feb 2014 20:00:11 +0000 (21:00 +0100)]
build: Make c-tokenize.c build on non-GNU systems.

* libguile/c-tokenize.lex: Add %top directive to include <config.h>
  first.  This fixes builds on systems that use Gnulib's <stdio.h> and
  similar replacements.  See <http://hydra.nixos.org/build/9259627> for
  an example.

10 years agoSRFI-18: Export 'current-thread'.
Mark H Weaver [Fri, 28 Feb 2014 02:31:57 +0000 (21:31 -0500)]
SRFI-18: Export 'current-thread'.

Fixes <http://debbugs.gnu.org/16890>.
Reported by Xin Wang <dram.wang@gmail.com>.

* module/srfi/srfi-18.scm: Reexport 'current-thread'.
* THANKS: Add "Xin Wang" to fixes section.

10 years agoRely on Gnulib for <unistd.h>.
Mark H Weaver [Fri, 28 Feb 2014 03:04:39 +0000 (22:04 -0500)]
Rely on Gnulib for <unistd.h>.

* libguile/async.c:
* libguile/backtrace.c:
* libguile/error.c:
* libguile/filesys.c:
* libguile/fports.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/gdbint.c:
* libguile/init.c:
* libguile/ioext.c:
* libguile/load.c:
* libguile/mallocs.c:
* libguile/mkstemp.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/rw.c:
* libguile/scmsigs.c:
* libguile/script.c:
* libguile/simpos.c:
* libguile/socket.c:
* libguile/stime.c:
* libguile/strports.c:
* libguile/threads.c: Unconditionally include <unistd.h>.

10 years agoRely on Gnulib for fsync, link, readlink, mkdir, rmdir, and rename.
Mark H Weaver [Fri, 28 Feb 2014 02:24:40 +0000 (21:24 -0500)]
Rely on Gnulib for fsync, link, readlink, mkdir, rmdir, and rename.

* libguile/filesys.c: Remove 'fsync' wrapper for MinGW.
  (scm_link, scm_readlink, scm_mkdir, scm_rmdir): Define these
  unconditionally.
  (my_rename): Remove.
  (scm_rename): Use 'rename' instead of 'my_rename'.

10 years agoImport Gnulib modules: link, fsync, readlink, rename, mkdir, rmdir, unistd.
Mark H Weaver [Thu, 27 Feb 2014 03:15:13 +0000 (22:15 -0500)]
Import Gnulib modules: link, fsync, readlink, rename, mkdir, rmdir, unistd.

* lib/fsync.c:
* lib/link.c:
* lib/mkdir.c:
* lib/strdup.c:
* m4/fsync.m4:
* m4/link.m4:
* m4/mkdir.m4:
* m4/strdup.m4: New files.

* lib/Makefile.am
* m4/gnulib-cache.m4
* m4/gnulib-comp.m4: Add modules.

10 years agoFix typo in manual.
Mark H Weaver [Tue, 25 Feb 2014 22:38:34 +0000 (17:38 -0500)]
Fix typo in manual.

* doc/ref/api-foreign.texi (Void Pointers and Byte Access):
  (rnrs bytevector) --> (rnrs bytevectors).

10 years agobuild: Fix out-of-source-tree installation of libguile-2.0-gdb.scm.
Ludovic Courtès [Thu, 27 Feb 2014 13:14:21 +0000 (14:14 +0100)]
build: Fix out-of-source-tree installation of libguile-2.0-gdb.scm.

* libguile/Makefile.am (install-data-local): Use $< instead of just
  libguile-2.0-gdb.scm.  Quote file names in $(INSTALL_DATA) invocation.

10 years agoMake sure 'ftw' allows directory traversal when running as root.
Ludovic Courtès [Thu, 20 Feb 2014 21:57:26 +0000 (22:57 +0100)]
Make sure 'ftw' allows directory traversal when running as root.

* module/ice-9/ftw.scm (stat-dir-readable?-proc): Return #t when UID is
  zero.  Reported Frank Terbeck <ft@bewatermyfriend.org>.

10 years agobuild: Bail out when 'PKG_CHECK_MODULES' is missing.
Ludovic Courtès [Thu, 20 Feb 2014 21:56:17 +0000 (22:56 +0100)]
build: Bail out when 'PKG_CHECK_MODULES' is missing.

* configure.ac: Add 'm4_pattern_forbid' invocation.