bpt/guile.git
13 years agoBump version number for 2.0.1.
Ludovic Courtès [Wed, 27 Apr 2011 20:39:38 +0000 (22:39 +0200)]
Bump version number for 2.0.1.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions
  such as `scm_c_public_ref' and `scm_from_latin1_keyword'.
  (LIBGUILE_INTERFACE_AGE): Increment.

13 years agoUpdate `NEWS'.
Ludovic Courtès [Wed, 27 Apr 2011 20:30:20 +0000 (22:30 +0200)]
Update `NEWS'.

13 years agoKeep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9).
Ludovic Courtès [Wed, 27 Apr 2011 20:26:05 +0000 (22:26 +0200)]
Keep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9).

Partially reverts 165b10ddfaaa8ecc72d45a9be7d29e7537dc2379 and
531c9f1dc51c4801c4d031ee80a31f15285a6b85.

* module/srfi/srfi-9.scm (define-inlinable): New macro.

13 years agoDocument `(ice-9 binary-ports)'.
Ludovic Courtès [Wed, 27 Apr 2011 20:14:31 +0000 (22:14 +0200)]
Document `(ice-9 binary-ports)'.

* doc/ref/api-io.texi (R6RS I/O Ports): Mention `(ice-9 binary-ports)'.

* NEWS: Update.

13 years agoAdd tests for UTF-8 ill-formed sequence handling.
Ludovic Courtès [Wed, 27 Apr 2011 19:55:42 +0000 (21:55 +0200)]
Add tests for UTF-8 ill-formed sequence handling.

* test-suite/tests/ports.test ("string ports"): Add for
  `test-decoding-error' tests for ill-formed UTF-8 sequences.  Thanks
  to Mark H Weaver <mhw@netris.org> for pointing this out.

13 years agoGracefully handle unterminated UTF-8 sequences instead of hitting an `assert'.
Ludovic Courtès [Wed, 27 Apr 2011 18:34:08 +0000 (20:34 +0200)]
Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert'.

* libguile/ports.c (get_codepoint): Return EILSEQ when OUTPUT_SIZE == 0.

* test-suite/tests/ports.test ("string ports"): Add 2 tests for
  unterminated sequences.

13 years agoAdd a couple more Unicode I/O tests.
Ludovic Courtès [Wed, 27 Apr 2011 14:26:26 +0000 (16:26 +0200)]
Add a couple more Unicode I/O tests.

* test-suite/tests/ports.test ("string ports")["%default-port-encoding
  is honored"]: Make sure `(port-encoding p)' is as expected.
  ["peek-char [utf-16]"]: New test.

13 years agoRewrite port decoding error tests using a mini DSL.
Ludovic Courtès [Wed, 27 Apr 2011 14:28:29 +0000 (16:28 +0200)]
Rewrite port decoding error tests using a mini DSL.

* test-suite/tests/ports.test ("string ports")[test-decoding-error]: New
  macro.
  ["read-char, wrong encoding, error", "read-char, wrong encoding,
  escape", "read-char, wrong encoding, substitute", "peek-char, wrong
  encoding, error"]: Rewrite using `test-decoding-error'.

13 years agoGracefully handle `setlocale' errors at the REPL.
Ludovic Courtès [Tue, 26 Apr 2011 22:57:16 +0000 (00:57 +0200)]
Gracefully handle `setlocale' errors at the REPL.

* module/ice-9/top-repl.scm (top-repl): Catch exceptions from
  `setlocale'.  Reported by CRLF0710 <crlf0710@gmail.com>.

13 years agoRemove the `sizeof (mpz_t)' check.
Ludovic Courtès [Mon, 25 Apr 2011 22:03:44 +0000 (00:03 +0200)]
Remove the `sizeof (mpz_t)' check.

* libguile/numbers.c: Remove `sizeof (mpz_t)' check, which wasn't need
  anymore since `make_bignum' doesn't make any such assumption.

13 years agoUse `scm_with_guile' in `test-pthread-create'.
Ludovic Courtès [Mon, 25 Apr 2011 21:59:12 +0000 (23:59 +0200)]
Use `scm_with_guile' in `test-pthread-create'.

* test-suite/standalone/test-pthread-create.c (inner_main): New
  function.
  (main): Call it within `scm_with_guile', instead of using
  `scm_init_guile'.  This improves portability--e.g.,
  `GC_get_stack_base', used by `scm_init_guile', failed on Darwin
  up to BDW-GC 7.1alpha4 included (thanks, Mark, for the hint.)

13 years agoUpdate Gnulib to v0.0-5158-g7d06b32; remove `strcase' and `version-etc-fsf'.
Ludovic Courtès [Mon, 25 Apr 2011 21:27:31 +0000 (23:27 +0200)]
Update Gnulib to v0.0-5158-g7d06b32; remove `strcase' and `version-etc-fsf'.

* m4/gnulib-cache.m4: Remove `strcase' and `version-etc-fsf'.

* configure.ac (POTENTIAL_GCC_CFLAGS): Remove `-Wundef'.

* libguile/script.c: Don't include <version-etc.h>.

13 years agoFix `#ifdef HAVE_CONFIG_H' stanza in some stand-alone tests.
Ludovic Courtès [Mon, 25 Apr 2011 21:54:47 +0000 (23:54 +0200)]
Fix `#ifdef HAVE_CONFIG_H' stanza in some stand-alone tests.

* test-suite/standalone/test-asmobs-lib.c,
  test-suite/standalone/test-extensions-lib.c,
  test-suite/standalone/test-ffi-lib.c,
  test-suite/standalone/test-list.c,
  test-suite/standalone/test-num2integral.c,
  test-suite/standalone/test-with-guile-module.c: Change `#ifndef
  HAVE_CONFIG_H' to `#ifdef HAVE_CONFIG_H' (!).

13 years agoCompile more file system related procedures when `--disable-posix'.
Ludovic Courtès [Mon, 25 Apr 2011 20:52:00 +0000 (22:52 +0200)]
Compile more file system related procedures when `--disable-posix'.

* libguile/filesys.c (scm_tc16_dir, scm_directory_stream_p, scm_opendir,
  scm_readdir, scm_rewinddir, scm_closedir, scm_dir_print,
  scm_dir_free, scm_lstat): Compile unconditionally.

13 years agoMove `{total,current}-processor-count' outside of `posix.c'.
Ludovic Courtès [Mon, 25 Apr 2011 20:41:58 +0000 (22:41 +0200)]
Move `{total,current}-processor-count' outside of `posix.c'.

* libguile/posix.c (scm_total_processor_count,
  scm_current_processor_count): Move to...
* libguile/threads.c: ... here.

* libguile/posix.h (scm_total_processor_count,
  scm_current_processor_count): Move declarations to...
* libguile/threads.h: ... here.

* test-suite/tests/posix.test ("nproc"): Move tests to...
* test-suite/tests/threads.test: ... here.

13 years agoMake the `sizeof (mpz_t)' check at compile-time.
Ludovic Courtès [Mon, 25 Apr 2011 20:36:30 +0000 (22:36 +0200)]
Make the `sizeof (mpz_t)' check at compile-time.

* libguile/init.c (scm_i_init_guile): Remove the `sizeof (mpz_t)'
  run-time check.

* libguile/numbers.c: Add a compile-time check for `sizeof (mpz_t)'.

13 years agoAdd pthread-related tests.
Ludovic Courtès [Fri, 22 Apr 2011 10:29:50 +0000 (12:29 +0200)]
Add pthread-related tests.

* test-suite/standalone/Makefile.am (test_scm_spawn_thread_CFLAGS,
  test_scm_spawn_thread_LDADD, test_pthread_create_CFLAGS,
  test_pthread_create_LDADD, test_pthread_create_secondary_CFLAGS,
  test_pthread_create_secondary_LDADD): New variables.
  (check_PROGRAMS)[BUILD_PTHREAD_SUPPORT]: Add `test-scm-spawn-thread',
  `test-pthread_create', `test-pthread_create-secondary'.
  (TESTS)[BUILD_PTHREAD_SUPPORT]: Likewise.

* test-suite/standalone/test-scm-spawn-thread.c,
  test-suite/standalone/test-pthread-create.c,
  test-suite/standalone/test-pthread-create-secondary.c: New files.

13 years agoMake `scm_i_ensure_signal_delivery_thread' call in Guile mode.
Ludovic Courtès [Mon, 25 Apr 2011 14:44:54 +0000 (16:44 +0200)]
Make `scm_i_ensure_signal_delivery_thread' call in Guile mode.

* libguile/threads.c (on_thread_exit): Move
  `scm_i_ensure_signal_delivery_thread' call...
  (do_thread_exit): ... here.

13 years agoMake sure binary ports pass `binary-port?' regardless of the locale.
Ludovic Courtès [Fri, 22 Apr 2011 21:55:37 +0000 (23:55 +0200)]
Make sure binary ports pass `binary-port?' regardless of the locale.

* libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop):
  Set `c_port->encoding' to NULL.

* test-suite/tests/r6rs-ports.test ("7.2.7 Input
  Ports")["bytevector-input-port is binary"]: New test.
  ("7.2.7 Input Ports")["make-custom-binary-input-port"]: Make sure PORT
  passes `binary-port?' and `input-port?'.
  ("8.2.10 Output ports")["bytevector-output-port is binary"]: New test.
  ["make-custom-binary-output"]: Rename to...
  ["make-custom-binary-output-port"]: ... this.

* test-suite/tests/ports.test ("string ports")["read-char, wrong
  encoding, error", "read-char, wrong encoding, escape", "read-char,
  wrong encoding, substitute", "peek-char, wrong encoding, error"]: Use
  `set-port-encoding!' instead of `%default-port-encoding' to set the
  encoding of bytevector input ports.

* test-suite/tests/rdelim.test ("read-line")["decoding error", "decoding
  error, substitute"]: Likewise.

* doc/ref/api-io.texi (R6RS Port Manipulation): Document `binary-port?'
  and `textual-port?'.

* doc/ref/r6rs.texi (R6RS Incompatibilities): Mention the soft
  distinction between textual and binary ports.

13 years agoTurn the libunistring/iconv configure check into a macro.
Ludovic Courtès [Fri, 22 Apr 2011 14:58:18 +0000 (16:58 +0200)]
Turn the libunistring/iconv configure check into a macro.

* acinclude.m4 (GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT): New macro.

* configure.ac: Use it.

13 years agoFix typo in `configure.ac'.
Ludovic Courtès [Fri, 22 Apr 2011 14:40:58 +0000 (16:40 +0200)]
Fix typo in `configure.ac'.

* configure.ac: Add missing comma in `AC_RUN_IFELSE' invocation.

13 years agoIncrease the timeout of timing-sensitive thread tests.
Ludovic Courtès [Fri, 22 Apr 2011 14:18:14 +0000 (16:18 +0200)]
Increase the timeout of timing-sensitive thread tests.

* test-suite/tests/threads.test ("timed locking succeeds if mutex
  unlocked within timeout", "timed unlocking returns #t if condition
  signaled", "timed joining succeeds if thread exits within timeout"):
  Increase the timeout.  Reported by Dale P. Smith <dsmich@roadrunner.com>.

13 years agoadd test that libunistring was built with iconv support
Andy Wingo [Thu, 21 Apr 2011 10:27:49 +0000 (12:27 +0200)]
add test that libunistring was built with iconv support

* configure.ac: Add check that libunistring was built with iconv
  support.  Thanks to Mark Weaver for the debugging and test program.

13 years agoClarify units of string length in decription of scm_from_stringn
Mark H Weaver [Thu, 21 Apr 2011 13:56:11 +0000 (09:56 -0400)]
Clarify units of string length in decription of scm_from_stringn

* doc/ref/api-data.texi (Conversion to/from C): In description of
  scm_from_stringn, clarify that the length is specified in bytes.

13 years agoClarify the units of returned lengths in string conversion functions
Mark H Weaver [Wed, 20 Apr 2011 03:59:17 +0000 (23:59 -0400)]
Clarify the units of returned lengths in string conversion functions

* doc/ref/api-data.texi (Conversion to/from C): In descriptions of
  scm_to_stringn and scm_to_{latin1,utf8,utf32}, clarify that the
  returned length is in units of bytes or code points, not characters.
  Also change NULL to @code{NULL} in a few places.

13 years agofix pre-GC_set_start_callback compilation
Andy Wingo [Fri, 15 Apr 2011 16:41:34 +0000 (16:41 +0000)]
fix pre-GC_set_start_callback compilation

* libguile/gc.c: Move declaration of run_before_gc_hook up.

13 years agopre-GC_set_start_callback compatibility
Andy Wingo [Fri, 15 Apr 2011 16:31:06 +0000 (18:31 +0200)]
pre-GC_set_start_callback compatibility

* configure.ac: Add a check for GC_set_start_callback.

* libguile/gc.c (scm_i_gc): If we don't have GC_set_start_callback, run
  the before-gc hook manually here.
  (scm_init_gc): Otherwise set it as a start callback.

* libguile/hashtab.c (weak_gc_callback, weak_gc_hook)
  (weak_gc_finalizer, scm_c_register_weak_gc_callback): Fix to work
  either way, with or without GC_set_start_callback.

13 years agoweak hash table vacuum on before-gc C hook
Andy Wingo [Fri, 15 Apr 2011 16:05:23 +0000 (18:05 +0200)]
weak hash table vacuum on before-gc C hook

* libguile/hashtab.c (weak_gc_callback)
  (scm_c_register_weak_gc_callback): Change implementation to use the
  before-gc C hook instead of the after-gc finalizers.

13 years agouse gc_start_callback + asyncs for after-gc-hook, instead of finalizers
Andy Wingo [Fri, 15 Apr 2011 15:45:52 +0000 (17:45 +0200)]
use gc_start_callback + asyncs for after-gc-hook, instead of finalizers

* libguile/gc.c (run_before_gc_c_hook, scm_storage_prehistory)
  (after_gc_async_thunk, queue_after_gc_hook, scm_init_gc): Instead of
  playing our finalizer trick, connect to the GC start callback, and use
  it to queue an async after-gc-hook.  Seems to fix the after-gc-hook on
  non-threaded builds.  Though this does re-enable the before-gc C hook,
  we don't wire up the Scheme hook because we're in the alloc lock; and
  indeed, a before-GC scheme hook isn't a great idea...

13 years agoadd --fresh-auto-compile
Andy Wingo [Fri, 15 Apr 2011 09:27:27 +0000 (11:27 +0200)]
add --fresh-auto-compile

* doc/ref/api-evaluation.texi (Compilation): Add discussion of
  --fresh-auto-compile.
* doc/ref/scheme-scripts.texi (Invoking Guile): Add --fresh-auto-compile
  option.

* NEWS: Add entry.

* libguile/load.c: Define %fresh-auto-compile.
  (scm_primitive_load_path): Use it here.
  (scm_init_load_should_auto_compile): Init from GUILE_AUTO_COMPILE env
  var, with a value of "fresh".

* module/ice-9/boot-9.scm (load-in-vicinity): Auto-compilation cache is
  stale if %fresh-auto-compile is true.

* module/ice-9/command-line.scm (compile-shell-switches): Parse out
  --fresh-auto-compile.

13 years agoBuild `filesys.x'.
Ludovic Courtès [Fri, 15 Apr 2011 07:09:30 +0000 (09:09 +0200)]
Build `filesys.x'.

* libguile/Makefile.am (DOT_X_FILES): Add `filesys.x'.

13 years agoAllow compilation with `--disable-posix'.
Ludovic Courtès [Thu, 14 Apr 2011 21:42:28 +0000 (23:42 +0200)]
Allow compilation with `--disable-posix'.

Reported by Dmitry Dzhus <dima@dzhus.org>.

* configure.ac: Remove `AC_LIBOBJ([filesys])'.  Document
  `--disable-posix' as omitting non-essential POSIX interfaces.

* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  Add `filesys.c'.
  (DOT_DOC_FILES): Add `filesys.doc'.
  (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Remove
  `filesys.c'.

* libguile/posix.c (scm_mkstemp, scm_access): Move to `filesys.c'.
  (scm_init_posix): Move `R_OK' etc. to `filesys.c'.

* libguile/filesys.c (scm_chown, scm_chmod, scm_umask, scm_open_fdes,
  scm_open, scm_close, scm_close_fdes, scm_link, scm_tc16_dir,
  scm_directory_stream_p, scm_opendir, scm_readdir, scm_rewinddir,
  scm_closedir, scm_dir_print, scm_dir_free, scm_chdir, scm_getcwd,
  set_element, fill_select_type, get_element, retrieve_select_type,
  scm_select, scm_fcntl, scm_fsync, scm_symlink, scm_readlink,
  scm_lstat, scm_copy_file): Conditionalize on HAVE_POSIX.
  (scm_mkstemp, scm_access): New functions.
  (scm_init_filesys): Conditionalize `scm_tc16_dir', `O_RDONLY', etc. on
  HAVE_POSIX.  Define `R_OK', `W_OK', etc.

* libguile/fports.c (fport_print): Use `scm_ttyname' only when
  HAVE_POSIX.

* libguile/i18n.c (lock_locale_mutex, unlock_locale_mutex): New
  functions.  Update users of `scm_i_locale_mutex' to use them.

* libguile/init.c (scm_i_init_guile): Always call `scm_init_filesys'.

* meta/guile-tools.in (main): Use `setlocale' only when it is defined.

* module/ice-9/boot-9.scm: Always load `ice-9/posix'.

13 years agoInclude <sched.h> in `posix.c'.
Ludovic Courtès [Thu, 14 Apr 2011 21:16:21 +0000 (23:16 +0200)]
Include <sched.h> in `posix.c'.

* configure.ac: Check for <sched.h>.

* libguile/posix.c [HAVE_SCHED_H]: Include <sched.h>, for
  `sched_setaffinity' & co.
  Reported by Marco Maggi <marco.maggi-ipsu@poste.it>.

13 years agoAdd tests for `-Wformat' and gettext.
Ludovic Courtès [Thu, 14 Apr 2011 21:14:14 +0000 (23:14 +0200)]
Add tests for `-Wformat' and gettext.

* test-suite/tests/tree-il.test ("warnings")["non-literal format string
  using gettext", "one missing argument, gettext"]: New tests.

13 years agofix analyze.scm literal string warnings
Andy Wingo [Thu, 14 Apr 2011 14:53:18 +0000 (16:53 +0200)]
fix analyze.scm literal string warnings

* module/language/tree-il/analyze.scm (const-fmt): Return any literal
  value, not just strings.  The string case is checked later.

13 years agofix embarrassing bugs in (ice-9 command-line)
Andy Wingo [Thu, 14 Apr 2011 14:46:49 +0000 (16:46 +0200)]
fix embarrassing bugs in (ice-9 command-line)

* module/ice-9/command-line.scm (compile-shell-switches): Whoops, fix a
  few cases that forgot to loop back to the beginning.

13 years agoguile -v prints LGPLv3+.
Andy Wingo [Thu, 14 Apr 2011 14:18:56 +0000 (16:18 +0200)]
guile -v prints LGPLv3+.

* module/ice-9/command-line.scm (compile-shell-switches): Though Guile
  may be distributed under the GPLv3, Guile is actually LGPLv3+.

13 years agoscript.c calls out to (ice-9 command-line)
Andy Wingo [Thu, 14 Apr 2011 14:15:47 +0000 (16:15 +0200)]
script.c calls out to (ice-9 command-line)

* libguile/script.c (scm_shell_usage): Call (ice-9 command-line)'s
  shell-usage.
  (scm_compile_shell_switches): Likewise, call (ice-9 command-line)'s
  compile-shell-switches.

13 years agoadd packager info to %build-info
Andy Wingo [Thu, 14 Apr 2011 14:06:40 +0000 (16:06 +0200)]
add packager info to %build-info

* libguile/load.c (init_build_info): Add packager, packager-version, and
  packager-bug-reports to %build-info, if they are available.

13 years agoadd (ice-9 command-line)
Andy Wingo [Thu, 14 Apr 2011 14:06:07 +0000 (16:06 +0200)]
add (ice-9 command-line)

* module/ice-9/command-line.scm: New module for parsing Guile's command
  line, ported from script.c.  Includes local eval-string implementation
  to make `guile -c 1' faster, by not having to load the compiler.
* module/Makefile.am: Add to build.

13 years agodon't warn about non-literal fmt strings for e.g. (_ "foo")
Andy Wingo [Thu, 14 Apr 2011 14:04:18 +0000 (16:04 +0200)]
don't warn about non-literal fmt strings for e.g. (_ "foo")

* module/language/tree-il/analyze.scm (const-fmt, format-analysis):
  Allow format strings to be gettexted, using the conventional _ name.

13 years agoupdate NEWS
Andy Wingo [Wed, 13 Apr 2011 12:07:22 +0000 (14:07 +0200)]
update NEWS

* NEWS: Update for 2.0.1.

13 years ago(rnrs arithmetic fixnums) fixnum? export a procedure again
Andy Wingo [Wed, 13 Apr 2011 10:50:16 +0000 (12:50 +0200)]
(rnrs arithmetic fixnums) fixnum? export a procedure again

* module/rnrs/arithmetic/fixnums.scm (fixnum?): Restore this export to
  be a procedure, not syntax.
  (inline-fixnum?): This is what fixnum? was.  Use it internally.

13 years agorevert 4a2ac0623c3dabb2c8b9d38c27b837dcb2c7fe4e
Andy Wingo [Wed, 13 Apr 2011 10:16:00 +0000 (12:16 +0200)]
revert 4a2ac0623c3dabb2c8b9d38c27b837dcb2c7fe4e

* module/ice-9/popen.scm (open-pipe*): No need to pump the pipes
  guardian here, now that hooks are working again.

13 years ago--disable-threads fix
Andy Wingo [Wed, 13 Apr 2011 10:03:50 +0000 (12:03 +0200)]
--disable-threads fix

* libguile/threads.c (do_thread_exit_trampoline, on_thread_exit):
  (scm_i_init_thread_for_guile): Only register and unregister threads
  with bdw-gc when we are building with threads support.  Thanks to
  Marijn for the report.

13 years agoFix fencepost error in bip_seek
Ian Price [Fri, 8 Apr 2011 01:49:20 +0000 (02:49 +0100)]
Fix fencepost error in bip_seek

* libguile/r6rs-ports.c (bip_seek): Fix to allow seeking to end of port.

* test-suite/tests/r6rs-ports.test ("bytevector input port can seek to
  very end"): Add tests.

13 years agofix assert to return true value.
Ian Price [Wed, 6 Apr 2011 12:51:44 +0000 (13:51 +0100)]
fix assert to return true value.

* module/rnrs/base.scm (assert): returns value instead of void.

* test-suite/tests/r6rs-base.test ("assert"): add test cases.

13 years agoAdded optional second arg to R6RS log function
Ian Price [Wed, 6 Apr 2011 00:53:38 +0000 (01:53 +0100)]
Added optional second arg to R6RS log function

* module/rnrs/base.scm (log): now takes a base argument, using the
  change of base formula for logs.
* test-suite/tests/r6rs-base.test ("log (2nd arg)"): Add test cases.

13 years agofix reader.test for --disable-deprecated
Andy Wingo [Mon, 11 Apr 2011 15:21:20 +0000 (17:21 +0200)]
fix reader.test for --disable-deprecated

* test-suite/tests/reader.test: Fix deprecated tests; begin-deprecated
  was splicing in expression context before, which is a no-no.

13 years agoregen psyntax-pp.scm
Andy Wingo [Mon, 11 Apr 2011 11:49:29 +0000 (13:49 +0200)]
regen psyntax-pp.scm

* module/ice-9/psyntax-pp.scm: Regenerate, to take advantage of better
  #{}# serialization.

13 years agosymbols with odd characters print better in #{}#
Andy Wingo [Mon, 11 Apr 2011 11:38:27 +0000 (13:38 +0200)]
symbols with odd characters print better in #{}#

* libguile/print.c (symbol_has_extended_read_syntax): Use a more
  general, unicode-appropriate algorithm.  Hopefully doesn't cause
  any current #{}# cases to be unescaped.
  (print_extended_symbol): Use more appropriate unicode algorithm, and
  emit unicode hex escapes instead of our own lame escapes.

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

13 years agoread-extended-symbol handles backslash better, including r6rs hex escapes
Andy Wingo [Mon, 11 Apr 2011 10:48:06 +0000 (12:48 +0200)]
read-extended-symbol handles backslash better, including r6rs hex escapes

* libguile/read.c (scm_read_extended_symbol): Interpret '\' as an escape
  character.  Due to some historical oddities we have to support '\'
  before any character, but since we never emitted '\' in front of
  "normal" characters like 'x' we can interpret "\x..;" to be an R6RS
  hex escape.

* test-suite/tests/reader.test ("#{}#"): Add tests.

13 years agorefactor scm_i_print_symbol_name
Andy Wingo [Mon, 11 Apr 2011 09:52:35 +0000 (11:52 +0200)]
refactor scm_i_print_symbol_name

* libguile/print.c (symbol_has_extended_read_syntax)
  (print_normal_symbol, print_extended_symbol, scm_i_print_symbol_name):
  Factor scm_i_print_symbol_name into separate routines.  Add comments.
  There are a number of bugs here.

13 years agoignore SIGPIPE in (system repl server)
Andy Wingo [Mon, 11 Apr 2011 08:13:48 +0000 (10:13 +0200)]
ignore SIGPIPE in (system repl server)

* module/system/repl/server.scm (run-server): Ignore SIGPIPE when we run
  a server, as otherwise a rudely disconnected client could cause the
  server to quit.  Thanks to John Proctor for the report, and Detlev
  Zundel for the debugging.

13 years agoFix the R6RS exact-integer-sqrt and import into core guile
Mark H Weaver [Wed, 6 Apr 2011 19:09:42 +0000 (15:09 -0400)]
Fix the R6RS exact-integer-sqrt and import into core guile

* libguile/numbers.c (scm_exact_integer_sqrt): New C procedure to
  compute exact integer square root and remainder.
  (scm_i_exact_integer_sqrt): New Scheme procedure `exact-integer-sqrt'
  from the R6RS, imported into core guile.

* libguile/numbers.h: Add prototypes.

* module/rnrs/base.scm: Remove broken stub implementation, which would
  fail badly when applied to large integers.

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

* doc/ref/r6rs.texi: Change documentation for `exact-integer-sqrt' to a
  stub that xrefs the core docs, as is done for other operations
  available in core.

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

* NEWS: Add news entries.

13 years agoImplement R6RS' `fixnum?' in a smarter way
Andreas Rottmann [Fri, 8 Apr 2011 21:56:30 +0000 (23:56 +0200)]
Implement R6RS' `fixnum?' in a smarter way

* module/rnrs/arithmetic/fixnums.scm (fixnum?): Implemented using
  bit-twiddling, and using `define-inlinable'.

13 years agoFix typo in arithmetic benchmark
Mark H Weaver [Thu, 7 Apr 2011 06:28:01 +0000 (02:28 -0400)]
Fix typo in arithmetic benchmark

* benchmark-suite/benchmarks/arithmetic.bm (fixnum): Fix `-' benchmark
  to actually use `-' operator instead of `+' operator.

13 years agoMove `define-inlinable' into the default namespace
Andreas Rottmann [Wed, 6 Apr 2011 23:12:26 +0000 (01:12 +0200)]
Move `define-inlinable' into the default namespace

* module/ice-9/boot-9.scm (define-inlineable): Moved here from SRFI-9.
* module/srfi/srfi-9 (define-inlinable): Removed here.

* doc/ref/api-procedures.texi (Inlinable Procedures): Add subsection
  about `define-inlinable'.

13 years agoFix parsing of exact numbers with negative exponents
Mark H Weaver [Wed, 6 Apr 2011 22:24:40 +0000 (18:24 -0400)]
Fix parsing of exact numbers with negative exponents

* libguile/numbers.c (mem2decimal_from_point): Use scm_divide instead of
  scm_divide2real when applying a negative exponent, to preserve
  exactness in case the "#e" forced exactness specifier is present.
  This fixes a bug where numeric literals such as "#e1e-5" yielded
  incorrect fractions.

13 years agoDoc fix: quotient/remainder/modulo do not require exact arguments
Mark H Weaver [Wed, 6 Apr 2011 17:00:34 +0000 (13:00 -0400)]
Doc fix: quotient/remainder/modulo do not require exact arguments

* doc/ref/api-data.texi (Arithmetic): `floor-remainder' is equivalent to
  the R5RS `modulo' when the arguments are integers.  Previously,
  equivalence was claimed only for exact integers.  Similarly for
  `truncate-quotient' and `truncate-remainder' compared with the R5RS
  `quotient' and `remainder'.

13 years agoUndeprecate read syntax for uniform complex vectors
Mark H Weaver [Tue, 5 Apr 2011 23:42:06 +0000 (19:42 -0400)]
Undeprecate read syntax for uniform complex vectors

* libguile/read.c (scm_read_sharp): Move the "#c..." case outside of
  #if SCM_ENABLE_DEPRECATED, and to the same section which handles
  "#s...", "#u..." and "#f...".
  Thanks to Andreas Rottmann <a.rottmann@gmx.at> for the bug report.

13 years agoSeveral optimizations for R6RS fixnum arithmetic
Andreas Rottmann [Sat, 2 Apr 2011 17:42:27 +0000 (19:42 +0200)]
Several optimizations for R6RS fixnum arithmetic

* module/rnrs/arithmetic/fixnums.scm (assert-fixnum): Is now a
  macro.
  (assert-fixnums): New procedure checking a the elements of a list
  for fixnum-ness.  All callers applying `assert-fixnum' to a list
  now changed to use this procedure.

* module/rnrs/arithmetic/fixnums.scm (define-fxop*): New for defining
  n-ary inlinable special-casing the binary case using `case-lambda'.
  All applicable procedures redefined using this macro.

* module/rnrs/arithmetic/fixnums.scm: Alias all predicates to
  their non-fixnum counterparts.

13 years agoAdd a few benchmarks for R6RS fixnum arithmetic
Andreas Rottmann [Sat, 2 Apr 2011 17:42:26 +0000 (19:42 +0200)]
Add a few benchmarks for R6RS fixnum arithmetic

* benchmark-suite/benchmarks/r6rs-arithmetic.bm: New file containing
  some benchmarks for R6RS fixnum operations.
* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add
  benchmarks/r6rs-arithmetic.

13 years agopthread-threads.h: only redirect to GC_pthread_sigmask if it is present
Andy Wingo [Sun, 3 Apr 2011 20:03:56 +0000 (22:03 +0200)]
pthread-threads.h: only redirect to GC_pthread_sigmask if it is present

* configure.ac: Check for pthread_sigmask.
* libguile/gen-scmconfig.c: Create SCM_HAVE_GC_PTHREAD_SIGMASK.
* libguile/pthread-threads.h (scm_i_pthread_sigmask): Only redirect to
  GC_pthread_sigmask if GC_pthread_sigmask is present.

13 years agofix c32vector-set!, c64vector-set!
Andy Wingo [Fri, 1 Apr 2011 14:45:58 +0000 (16:45 +0200)]
fix c32vector-set!, c64vector-set!

* module/srfi/srfi-4/gnu.scm (bytevector-c32-native-set!):
  (bytevector-c64-native-set!): Fix to actually allow complex numbers.

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

13 years agostring->pointer and pointer->string have optional encoding arg
Andy Wingo [Fri, 1 Apr 2011 11:31:26 +0000 (13:31 +0200)]
string->pointer and pointer->string have optional encoding arg

* test-suite/tests/foreign.test ("pointer<->string"): Add test cases.

* libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): Add
  optional encoding, and in the pointer->string case, length arguments.

* libguile/foreign.h: Update prototypes of internal functions.
  Shouldn't affect ABI as they are internal.

* doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update
  docs.

13 years agosupport loading objcode even if mmap(2) is unavailable
Andy Wingo [Fri, 1 Apr 2011 10:10:42 +0000 (12:10 +0200)]
support loading objcode even if mmap(2) is unavailable

* configure.ac: Check for sys/mman.h.

* libguile/objcodes.c (verify_cookie): Factor cookie verification out to
  a helper function.
  (make_objcode_from_file): Rename from make_objcode_by_mmap.  If mmap
  is unavailable, just read(2) to a bytevector.

13 years agomake_objcode_by_mmap uses MAP_PRIVATE, not MAP_SHARED
Andy Wingo [Fri, 1 Apr 2011 09:23:12 +0000 (11:23 +0200)]
make_objcode_by_mmap uses MAP_PRIVATE, not MAP_SHARED

* libguile/objcodes.c (make_objcode_by_mmap): MAP_PRIVATE, not
  MAP_SHARED -- we don't need to update the underlying file, nor do we
  need to see updates.

13 years agolatin1 subr and message in internal scm_{encoding,decoding}_error
Andy Wingo [Fri, 1 Apr 2011 09:05:37 +0000 (11:05 +0200)]
latin1 subr and message in internal scm_{encoding,decoding}_error

* libguile/strings.c (scm_encoding_error, scm_decoding_error): Use
  scm_from_latin1_string for the subr and message args, as these are
  internal functions, and we know their callers.

13 years agofix duplicate path in uninstalled-env
Andy Wingo [Thu, 31 Mar 2011 21:33:00 +0000 (23:33 +0200)]
fix duplicate path in uninstalled-env

* meta/uninstalled-env.in: Our code that checked for paths already being
  in the load path was not working for the last entry in the load path.
  This caused the last entry to be re-added to the beginning, which also
  caused relative filename canonicalization to prepend "module/" to
  everything.

  Terrible.

13 years agofix gc_register_my_thread et al fallback impls
Kevin Fletcher [Thu, 31 Mar 2011 20:16:54 +0000 (22:16 +0200)]
fix gc_register_my_thread et al fallback impls

* libguile/threads.c (GC_register_my_thread, GC_get_stack_base): Fix
  fallback impls.

13 years agoweb.texi: handler return types documentation
Andy Wingo [Thu, 31 Mar 2011 14:36:01 +0000 (16:36 +0200)]
web.texi: handler return types documentation

* doc/ref/web.texi (Web Server): More docs on handler return types.

13 years agoweb.texi: fix uri->string invocation
Andy Wingo [Thu, 31 Mar 2011 14:17:35 +0000 (16:17 +0200)]
web.texi: fix uri->string invocation

* doc/ref/web.texi (Web Examples): Fix uri->string invocation.  Thanks
  to Romel Sandoval for the report.

13 years agofix problems detecting coding: in block comments
Andy Wingo [Thu, 31 Mar 2011 12:46:21 +0000 (14:46 +0200)]
fix problems detecting coding: in block comments

* libguile/read.c (scm_i_scan_for_encoding): Fix for coding on first
  line #! and for !# immediately following the coding.

* test-suite/Makefile.am:
* test-suite/tests/coding.test: Add tests.

13 years agoinline fxops in psyntax
Andy Wingo [Thu, 31 Mar 2011 11:29:41 +0000 (13:29 +0200)]
inline fxops in psyntax

* module/ice-9/psyntax.scm (fx+, fx-, fx=, fx<): Given our lame lack of
  an inliner, inline these manually with identifier syntax.

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

13 years agoallow definitions in with-syntax body
Andy Wingo [Thu, 31 Mar 2011 11:23:27 +0000 (13:23 +0200)]
allow definitions in with-syntax body

* module/ice-9/psyntax.scm (with-syntax): Allow definitions in the body,
  as seems to be suggested by the R6RS.

* test-suite/tests/syncase.test ("with-syntax"): Add test.

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

13 years agoMore descriptive error for dynamic-pointer
Michael Gran [Thu, 31 Mar 2011 03:42:37 +0000 (20:42 -0700)]
More descriptive error for dynamic-pointer

* libguile/dynl.c (sysdep_dynl_value): Failure to find a symbol is not
  an error, so raise our own, more appropriate error.

* test-suite/tests/foreign.test ("dynamic-pointer"): Add a test.

13 years agowith-continuation-barrier calls exit(3) _after_ unwinding
Andy Wingo [Thu, 24 Mar 2011 19:20:14 +0000 (20:20 +0100)]
with-continuation-barrier calls exit(3) _after_ unwinding

* libguile/continuations.c (scm_handler, c_handler)
  (scm_c_with_continuation_barrier, scm_with_continuation_barrier):
  Instead of calling scm_handle_by_message_noexit in the pre-unwind
  handler, roll our own exception printing in the pre-unwind, and do to
  exit()-on-quit in the post-unwind handler.  This lets the stack unwind
  at exit-time so that pending dynwinds run.

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

13 years agodon't GC unregister null thread
Michael Gran [Wed, 30 Mar 2011 04:27:54 +0000 (21:27 -0700)]
don't GC unregister null thread

GC_unregister_my_thread is only supposed to be called from
a thread other than the main thread, so, it should never be
called when the system is compiled with null threads.

* libguile/threads.c (on_thread_exit)[SCM_USE_NULL_THREADS]: don't
    call GC_unregister_my_thread

13 years agocheck for GC_allow_register_threads
Michael Gran [Wed, 30 Mar 2011 04:25:04 +0000 (21:25 -0700)]
check for GC_allow_register_threads

This is not present in earlier versions of BDW-GC

* configure.ac: check for GC_allow_register_threads
* libguile/threads.c (scm_i_init_thread_for_guile): Only call
  GC_allow_register_threads if it is present.

13 years agoFix `procedure->pointer' for functions returning `void'.
Ludovic Courtès [Tue, 29 Mar 2011 21:35:24 +0000 (23:35 +0200)]
Fix `procedure->pointer' for functions returning `void'.

* libguile/foreign.c (unpack): Handle `FFI_TYPE_VOID'.

* test-suite/tests/foreign.test ("procedure->pointer")["procedures
  returning void"]: New test.  Reported by
  Tristan Colgate <tcolgate@gmail.com>.

13 years agofix prompt and abort with the boot evaluator
Andy Wingo [Tue, 29 Mar 2011 15:41:31 +0000 (17:41 +0200)]
fix prompt and abort with the boot evaluator

* libguile/control.h:
* libguile/control.c (scm_i_prompt_pop_abort_args_x): Take a VM instead
  of a prompt, given that it's the VM's registers that record the abort
  arguments, not the prompt registers (which actually point right below
  the abort values).

* libguile/eval.c (eval):
* libguile/throw.c (pre_init_catch): Pass the vm instead of a prompt.

13 years agofix compilation with libgc 7.0, 7.1
Andy Wingo [Tue, 29 Mar 2011 11:21:44 +0000 (13:21 +0200)]
fix compilation with libgc 7.0, 7.1

* configure.ac: Check for GC_pthread_exit and GC_pthread_cancel.

* libguile/gen-scmconfig.c: Write HAVE_GC_PTHREAD_CANCEL and
  HAVE_GC_PTHREAD_EXIT into scmconfig.h.

* libguile/pthread-threads.h (scm_i_pthread_exit, scm_i_pthread_cancel):
  Only redefine to their GC_pthread_* variants if we have those
  functions, which is not the case in libgc < 7.2.

13 years agofix error message on ,disassemble "non-procedure"
Andy Wingo [Tue, 29 Mar 2011 10:38:18 +0000 (12:38 +0200)]
fix error message on ,disassemble "non-procedure"

* module/language/objcode/spec.scm (decompile-value): Don't assume that
  `error' will handle format strings appropriately.
* module/system/repl/command.scm (disassemble): A more human error when
  you disassemble a non-procedure.

Bug reported by Andrew Horton.

13 years agodocument -q, repl options
Andy Wingo [Tue, 29 Mar 2011 10:18:20 +0000 (12:18 +0200)]
document -q, repl options

* doc/ref/scheme-scripts.texi (Invoking Guile): Document -q.
* doc/ref/scheme-using.texi (Init File): New section, on .guile.
  (Readline): Link to Init File.
  (System Commands): Document the various REPL options, and
  repl-default-option-set!.

13 years agorewrite ensure-writable-dir to not be racy
Andy Wingo [Tue, 29 Mar 2011 09:40:05 +0000 (11:40 +0200)]
rewrite ensure-writable-dir to not be racy

* module/system/base/compile.scm (ensure-writable-dir): Rewrite to not
  be racy.

13 years agofix prompt in fix in single-value context compilation
Andy Wingo [Sun, 27 Mar 2011 13:00:18 +0000 (15:00 +0200)]
fix prompt in fix in single-value context compilation

* module/language/tree-il/compile-glil.scm (flatten): When compiling a
  <prompt> in push context with an RA, after the body returns normally,
  jump to that RA instead of to our POST label (which in that case does
  not need to be emitted).  Fixes a tail <prompt> in a push <fix>.

* test-suite/tests/control.test ("prompt in different contexts"): Add
  more test cases.

13 years agotree-il->scheme fix
Andy Wingo [Sun, 27 Mar 2011 12:44:20 +0000 (14:44 +0200)]
tree-il->scheme fix

* module/language/tree-il.scm (tree-il->scheme): Fix <prompt> to Scheme
  serialization.

13 years agoDocument SRFI-23
Noah Lavine [Fri, 11 Mar 2011 16:45:33 +0000 (11:45 -0500)]
Document SRFI-23

 * doc/ref/srfi-modules.texi: mention that we support SRFI 23
 * module/ice-9/boot-9.scm (%cond-expand-features): add srfi-23

13 years agoUpdate comment about uc_locale_language.
Bruno Haible [Sat, 26 Mar 2011 22:33:00 +0000 (23:33 +0100)]
Update comment about uc_locale_language.

* libguile/i18n.c (locale_language): Update comment.

13 years agofix stexi->html double translation
Andy Wingo [Sat, 26 Mar 2011 12:33:21 +0000 (13:33 +0100)]
fix stexi->html double translation

* module/texinfo/html.scm (entry): Fix to avoid double translation:
  arg-req already pulls an stexi->shtml on its arg.

13 years agofix (texinfo reflection) to handle nested structures like syntax patterns
Andy Wingo [Sat, 26 Mar 2011 11:53:10 +0000 (12:53 +0100)]
fix (texinfo reflection) to handle nested structures like syntax patterns

* module/texinfo/reflection.scm (process-args): Convert any arg to a
  string.  "Fixes" documentation of syntax-rules patterns.

13 years agoRemove statements about scripts/* that are no longer true
Neil Jerram [Mon, 21 Mar 2011 09:05:59 +0000 (09:05 +0000)]
Remove statements about scripts/* that are no longer true

* doc/ref/tools.texi (Executable Modules): Say "guile-tools modules"
  instead of "executable modules".  Remove obsolete statements about
  not ending in .scm, being executable, and beginning with shell
  script invocation sequence.

* module/scripts/README: Ditto.

13 years agoInline the effect of am/pre-inst-guile
Neil Jerram [Sun, 20 Mar 2011 23:50:22 +0000 (23:50 +0000)]
Inline the effect of am/pre-inst-guile

It's just one variable definition, and in my opinion it confuses,
rather than helps, the overall build picture to have two names
(preinstguile and meta/guile) for the same thing.

* am/Makefile.am (am_frags): Remove pre-inst-guile.

* am/pre-inst-guile: Deleted.

* doc/ref/Makefile.am: Don't include am/pre-inst-guile.
  ($(snarf_doc).am, $(snarf_doc).texi): Expand $(preinstguile).

* module/Makefile.am (ice-9/psyntax-pp.scm.gen): Don't include
  am/pre-inst-guile.
  (ice-9/psyntax-pp.scm.gen): Expand $(preinstguile).

13 years agoMake explicit that GUILE_FOR_BUILD is only used when cross-compiling
Neil Jerram [Sun, 20 Mar 2011 23:02:33 +0000 (23:02 +0000)]
Make explicit that GUILE_FOR_BUILD is only used when cross-compiling

* configure.ac (GUILE_FOR_BUILD): Change normal build value to
  'this-value-will-never-be-used'.

13 years agoGUILE_FOR_BUILD is only needed by meta/guile.in, not by Makefiles
Neil Jerram [Sun, 20 Mar 2011 22:48:33 +0000 (22:48 +0000)]
GUILE_FOR_BUILD is only needed by meta/guile.in, not by Makefiles

* configure.ac: Use AM_SUBST_NOTMAKE for GUILE_FOR_BUILD instead of
  AC_SUBST.

13 years agoRemove unused definition of preinstguiletool
Neil Jerram [Sun, 20 Mar 2011 22:27:38 +0000 (22:27 +0000)]
Remove unused definition of preinstguiletool

* am/pre-inst-guile (preinstguiletool): Removed.

13 years agoavoid running GC when SCM_I_CURRENT_THREAD is unset
Andy Wingo [Fri, 25 Mar 2011 14:35:20 +0000 (15:35 +0100)]
avoid running GC when SCM_I_CURRENT_THREAD is unset

* libguile/threads.c (guilify_self_1): Prevent finalizers from running
  before SCM_I_CURRENT_THREAD is set.
  (do_thread_exit_trampoline): Leave the thread in the registered state.
  (on_thread_exit): Always unregister the thread here.

13 years agothreading / with_guile refactor to use more GC_stack_base
Andy Wingo [Fri, 25 Mar 2011 12:01:51 +0000 (13:01 +0100)]
threading / with_guile refactor to use more GC_stack_base

* libguile/init.h:
* libguile/init.c (scm_i_init_guile): Change arg to this internal
  function from SCM_STACKITEM* to void*.  Actually it's a
  struct GC_stack_base*.

* libguile/bdw-gc.h: Don't do pthread redirects, because we don't want
  to affect applications' pthread_* bindings.

* libguile/pthread-threads.h (scm_i_pthread_create)
  (scm_i_pthread_detach, scm_i_pthread_exit, scm_i_pthread_cancel)
  (scm_i_pthread_sigmask): Do pthread redirects here, in this internal
  header.

* libguile/threads.h: Remove declaration of internal
  scm_i_with_guile_and_parent.  Remove declaration of undefined
  scm_threads_init_first_thread.  Make declaration of internal
  scm_threads_prehistory actually internal, and take a void* (actually a
  struct GC_stack_base*).

* libguile/threads.c (GC_get_stack_base): Implement a shim if this
  function is unavailable, and fold in the implementations of
  get_thread_stack_base.
  (GC_call_with_stack_base): Actually implement.
  (guilify_self_1): Take a GC_stack_base* as an arg.
  (scm_i_init_thread_for_guile): Likewise, and set up libgc for
  registration of other threads.
  (scm_init_guile): Use GC_get_stack_base instead of our own guesswork.
  (with_guile_and_parent, scm_i_with_guile_and_parent): Rework to
  trampoline through a GC_call_with_stack_base.
  (scm_threads_prehistory): Pass the "base" arg on to guilify_self_1.

13 years agoRevert "with-continuation-barrier carps, calls exit(3) _after_ unwinding"
Andy Wingo [Fri, 25 Mar 2011 09:47:10 +0000 (10:47 +0100)]
Revert "with-continuation-barrier carps, calls exit(3) _after_ unwinding"

This reverts commit ecba00af6501e082b86c8f2f7730081c733509d7.