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

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.