bpt/guile.git
14 years agoMerge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc
Ludovic Courtès [Tue, 1 Sep 2009 22:07:27 +0000 (00:07 +0200)]
Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc

Conflicts:
acinclude.m4
libguile/strings.c

14 years agoFix leaky behavior of `scm_take_TAGvector ()'.
Ludovic Courtès [Tue, 1 Sep 2009 21:53:58 +0000 (23:53 +0200)]
Fix leaky behavior of `scm_take_TAGvector ()'.

* libguile/srfi-4.c (free_user_data): New function.

* libguile/srfi-4.i.c (scm_take_TAGvector): Register `free_user_data ()'
  as a finalizer for DATA.

* libguile/objcodes.c (scm_objcode_to_bytecode): Allocate with
  `scm_malloc ()' since the memory taken by `scm_take_u8vector ()' will
  eventually be free(3)d.

* libguile/vm.c (really_make_boot_program): Likewise.

14 years agoRemove the distinction between inline/outline storage for stringbufs.
Ludovic Courtès [Tue, 1 Sep 2009 00:02:43 +0000 (02:02 +0200)]
Remove the distinction between inline/outline storage for stringbufs.

* libguile/strings.c (STRINGBUF_HEADER_SIZE, STRINGBUF_HEADER_BYTES):
  New macros.
  (STRINGBUF_F_INLINE, STRINGBUF_INLINE, STRINGBUF_OUTLINE_CHARS,
  STRINGBUF_OUTLINE_LENGTH, STRINGBUF_INLINE_CHARS,
  STRINGBUF_INLINE_LENGTH, STRINGBUF_MAX_INLINE_LEN): Remove.
  (STRINGBUF_CHARS, STRINGBUF_WIDE_CHARS): Adjust to return a fixed
  location.
  (STRINGBUF_LENGTH): Get the length from word 1.
  (make_stringbuf, make_wide_stringbuf): Adjust to use a contiguous
  memory region.
  (wide_stringbuf): Renamed from `widen_stringbuf'.  Adjust similarly.
  Return the new stringbuf.  Callers updated.
  (narrow_stringbuf): Likewise.
  (scm_sys_string_dump, scm_sys_symbol_dump): Remove `stringbuf-inline'
  pair.

* test-suite/tests/strings.test ("string internals")["null strings are
  inlined", "short Latin-1 encoded strings are inlined", "long Latin-1
  encoded strings are not inlined", "short UCS-4 encoded strings are not
  inlined", "long UCS-4 encoded strings are not inlined"]: Remove.

* test-suite/tests/symbols.test ("symbol internals")["null symbols are
  inlined", "short Latin-1 encoded symbols are inlined", "long Latin-1
  encoded symbols are not inlined", "short UCS-4 encoded symbols are not
  inlined", "long UCS-4 encoded symbols are not inlined"]: Remove.

14 years agoFix leaky handling of `scm_take_locale_{symbol,string} ()'.
Ludovic Courtès [Mon, 31 Aug 2009 22:38:40 +0000 (00:38 +0200)]
Fix leaky handling of `scm_take_locale_{symbol,string} ()'.

* libguile/strings.c (scm_i_take_stringbufn, scm_i_c_take_symbol):
  Remove.
  (scm_take_locale_stringn): Rewrite in terms of `scm_from_locale_stringn ()'.

* libguile/strings.h (scm_i_c_take_symbol, scm_i_take_stringbufn):
  Remove declarations.

14 years agoFix `benchmark-guile'.
Ludovic Courtès [Sun, 30 Aug 2009 23:28:09 +0000 (01:28 +0200)]
Fix `benchmark-guile'.

* benchmark-guile.in (guile): Use `meta/guile', not `pre-inst-guile'.

14 years agoRemove the distinction between inline/outline storage for bytevectors.
Ludovic Courtès [Sun, 30 Aug 2009 23:07:30 +0000 (01:07 +0200)]
Remove the distinction between inline/outline storage for bytevectors.

* libguile/bytevectors.c (SCM_BYTEVECTOR_INLINE_THRESHOLD,
  SCM_BYTEVECTOR_INLINEABLE_SIZE_P, SCM_BYTEVECTOR_SET_CONTENTS,
  SCM_BYTEVECTOR_SET_INLINE): Remove.
  (SCM_BYTEVECTOR_HEADER_BYTES): New macro.
  (SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Adjust to new flag layout.
  (make_bytevector): Remove content inlining machinery; use
  `scm_gc_malloc_pointerless ()' in all cases; special-case zero-sized
  vu8 buffers.
  (make_bytevector_from_buffer): Simplified.
  (scm_c_shrink_bytevector): New, formerly `scm_i_shrink_bytevector ()'.
  Remove buffer inlining machinery.
  (scm_bootstrap_bytevectors): Use `make_bytevector ()' for
  SCM_NULL_BYTEVECTOR.

* libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): New macro.
  (SCM_BYTEVECTOR_CONTENTS): Adjust to new layout.
  (SCM_SET_BYTEVECTOR_FLAGS): Properly cast F.
  (SCM_F_BYTEVECTOR_INLINE, SCM_BYTEVECTOR_INLINE_P): Remove.
  (SCM_BYTEVECTOR_ELEMENT_TYPE): Adjust.
  (scm_c_shrink_bytevector): Remove macro, make a C function
  declaration.

14 years agoUse a TC7 tag instead of a SMOB for bytevectors.
Ludovic Courtès [Sun, 30 Aug 2009 18:12:09 +0000 (20:12 +0200)]
Use a TC7 tag instead of a SMOB for bytevectors.

* libguile/bytevectors.c (scm_tc16_bytevector): Remove.
  (SCM_BYTEVECTOR_SET_LENGTH, SCM_BYTEVECTOR_SET_CONTENTS,
  SCM_BYTEVECTOR_SET_INLINE, SCM_BYTEVECTOR_SET_ELEMENT_TYPE,
  make_bytevector_from_buffer, scm_is_bytevector,
  scm_bootstrap_bytevectors): Adjust to the SMOB->tc7 change.
  (scm_i_print_bytevector): New, formerly `print_bytevector ()'.
  (bytevector_equal_p): Remove.

* libguile/bytevectors.h (SCM_BYTEVECTOR_LENGTH,
  SCM_BYTEVECTOR_CONTENTS, SCM_BYTEVECTOR_P): Adjust to SMOB->tc7
  change.
  (SCM_BYTEVECTOR_FLAGS, SCM_SET_BYTEVECTOR_FLAGS): New macros.
  (scm_tc16_bytevector): Remove declaration.
  (scm_i_print_bytevector): New declaration.

* libguile/eq.c (scm_equal_p): Handle `scm_tc7_bytevector'.

* libguile/evalext.c (scm_self_evaluating_p): Likewise.

* libguile/print.c (iprin1): Likewise.

* libguile/tags.h (scm_tc7_bytevector): New.
  (scm_tc7_unused_8): Remove.

* libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): Adjust.

* test-suite/tests/bytevectors.test ("Datum
  Syntax")["self-evaluating?"]: New test.

14 years agoAdd `BDW_GC_CFLAGS' to the `.pc' files.
Ludovic Courtès [Fri, 28 Aug 2009 19:08:07 +0000 (21:08 +0200)]
Add `BDW_GC_CFLAGS' to the `.pc' files.

This is needed because <gc/gc.h> is included in public headers (via
<libguile/boehm-gc.h>.

* meta/guile-2.0-uninstalled.pc.in (Cflags): Add `@BDW_GC_CFLAGS'.

* meta/guile-2.0.pc.in (Cflags): Likewise.

14 years agoRemove deprecated variables/macros from the GC headers.
Ludovic Courtès [Fri, 28 Aug 2009 18:25:49 +0000 (20:25 +0200)]
Remove deprecated variables/macros from the GC headers.

* libguile/deprecated.c (scm_mtrigger, scm_mallocated,
  scm_max_segment_size): New global variables, from gc.c.
  (scm_map_free_list,
  scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New stubs.

* libguile/deprecated.h (scm_mallocated, scm_mtrigger,
  scm_max_segment_size): New declarations.
  (scm_map_free_list,
  scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New
  declarations.

* libguile/gc-malloc.c (scm_i_minyield_malloc): Remove.
  (scm_gc_init_malloc): Remove references to `scm_i_minyield_malloc' and
  `scm_mtrigger'.

* libguile/gc.c (scm_mtrigger, scm_mallocated): Remove.
  (scm_init_storage): Remove reference to `SCM_HEAP_SEG_SIZE'.

* libguile/gc.h (scm_max_segment_size, SCM_SET_FREELIST_LOC,
  SCM_FREELIST_LOC, scm_i_master_freelist, scm_i_master_freelist2,
  scm_mallocated, scm_mtrigger): Remove.
  (scm_map_free_list,
  scm_gc_set_debug_check_freelist_x)[SCM_ENABLE_DEPRECATED &&
  GUILE_DEBUG_FREELIST]: Remove.

* libguile/private-gc.h (SCM_DEFAULT_INIT_HEAP_SIZE_1,
  SCM_DEFAULT_MIN_YIELD_1, SCM_DEFAULT_MIN_YIELD_2,
  DEFAULT_SWEEP_AMOUNT, SCM_DEFAULT_MAX_SEGMENT_SIZE,
  SCM_MIN_HEAP_SEG_SIZE, SCM_HEAP_SEG_SIZE,
  SCM_GC_CARD_BVEC_SIZE_IN_LONGS, SCM_GC_IN_CARD_HEADERP): Remove.
  (scm_getenv_int): Made internal.
  (scm_i_marking, scm_mark_all, scm_i_deprecated_memory_return,
  scm_i_find_heap_calls, scm_gc_init_malloc, scm_gc_init_freelist,
  scm_gc_init_segments, scm_gc_init_mark): Remove declarations.

* libguile/gc-segment-table.c: Remove, finally.

14 years agoMerge branch 'master' into boehm-demers-weiser-gc
Ludovic Courtès [Fri, 28 Aug 2009 17:01:19 +0000 (19:01 +0200)]
Merge branch 'master' into boehm-demers-weiser-gc

Conflicts:
libguile/Makefile.am
libguile/bytevectors.c
libguile/gc-card.c
libguile/gc-mark.c
libguile/programs.c
libguile/srcprop.c
libguile/srfi-14.c
libguile/symbols.c
libguile/threads.c
libguile/unif.c
libguile/vm.c

14 years agoDon't presume existence or success of setlocale in test-suite
Michael Gran [Fri, 28 Aug 2009 13:27:00 +0000 (06:27 -0700)]
Don't presume existence or success of setlocale in test-suite

* test-suite/lib.scm (with-locale, with-locale*): new test functions

* test-suite/tests/encoding-escapes: don't fail if en_US.utf8 doesn't exist

* test-suite/tests/encoding-iso88591.test: set and restore locale, if
  possible

* test-suite/tests/encoding-iso88597.test: set and restore locale, if
  possible

* test-suite/tests/encoding-utf8.test: set and restore locale, if possible

* test-suite/tests/srfi-14.test: don't need to setlocale to Latin-1 to
  test Latin-1 since string conversion is handled at read/compile time.
  Set and restore locale, if possible.

14 years agoscm_getc improperly handles Latin-1 characters
Michael Gran [Fri, 28 Aug 2009 03:42:36 +0000 (20:42 -0700)]
scm_getc improperly handles Latin-1 characters

Upper-plane Latin-1 characters should be converted to codepoints.

* libguile/ports.c (scm_getc): improper conversion of char to scm_t_wchar

14 years agoFix FUNC_NAME definitions and #endif in srfi-14.[ch]
Michael Gran [Fri, 28 Aug 2009 01:52:53 +0000 (18:52 -0700)]
Fix FUNC_NAME definitions and #endif in srfi-14.[ch]

* libguile/srfi-14.c: whitespace and FUNC_NAME fixes

* libguile/srfi-14.h: #endif comment

14 years agoScript to generate srfi-14 charsets from UnicodeData.txt
Michael Gran [Fri, 28 Aug 2009 01:23:46 +0000 (18:23 -0700)]
Script to generate srfi-14 charsets from UnicodeData.txt

This script was used to generate srfi-14.i.c from the UnicodeData.txt
file supplied by ftp://www.unicode.org/Public/UNIDATA/

* libguile/unidata_to_charset.pl

14 years agoFix GDS utility client startup
Neil Jerram [Thu, 27 Aug 2009 23:29:04 +0000 (00:29 +0100)]
Fix GDS utility client startup

* emacs/gds-scheme.el (gds-start-utility-guile): Use buffer-local
  variable gds-client instead of client, as client is actually unbound
  when the process-filter lambda runs.  (i.e. This isn't Scheme code!)

14 years agoAdd missing `FUNC_NAME' definition.
Ludovic Courtès [Thu, 27 Aug 2009 23:16:49 +0000 (01:16 +0200)]
Add missing `FUNC_NAME' definition.

* libguile/load.c (scm_sys_warn_autocompilation_enabled): Define
  `FUNC_NAME'.

14 years agoMerge branch 'ossau-gds-dev'
Neil Jerram [Thu, 27 Aug 2009 21:52:20 +0000 (22:52 +0100)]
Merge branch 'ossau-gds-dev'

Conflicts:

THANKS

14 years agoFix doc of let*-values
Neil Jerram [Fri, 17 Jul 2009 07:00:42 +0000 (08:00 +0100)]
Fix doc of let*-values

Thanks to Judy Hawkins for reporting this.

* doc/ref/api-modules.texi (Included Guile Modules): Change
  `let-values*' to `let*-values'.

14 years agoMake GDS resilient to autocompilation comments
Neil Jerram [Thu, 27 Aug 2009 21:22:34 +0000 (22:22 +0100)]
Make GDS resilient to autocompilation comments

* emacs/gds-scheme.el (gds-start-utility-guile): Make the extraction
  of client number more robust; in particular when the client emits
  comments (about auto compilation) before the number.

14 years agoIncorporate ice-9-debugger-extensions properly
Neil Jerram [Thu, 27 Aug 2009 21:21:20 +0000 (22:21 +0100)]
Incorporate ice-9-debugger-extensions properly

i.e. put the extensions where they need to be, and delete
ice-9-debugger-extensions.scm.

* doc/ref/api-debug.texi (Single Stepping through a Procedure's Code):
  Change mentions of (ice-9 debugging ice-9-debugger-extensions)
  module to whatever is appropriate now (or just remove them).

* module/Makefile.am (NOCOMP_SOURCES): Remove
  ice-9-debugger-extensions.scm.

* module/ice-9/debugger.scm (debug-trap): Move here from
  ice-9-debugger-extensions.scm.

* module/ice-9/debugger/command-loop.scm ("continue", "finish",
  "step", "next"): Move here from ice-9-debugger-extensions.scm.

* module/ice-9/debugger/commands.scm (assert-continuable, continue,
  finish, step, next): Move here from ice-9-debugger-extensions.scm.

* module/ice-9/debugging/breakpoints.scm: Don't use
  ice-9-debugger-extensions module.

* module/ice-9/debugging/ice-9-debugger-extensions.scm: Removed.

* module/ice-9/debugging/trace.scm, module/ice-9/debugging/traps.scm:
  Remove more old version code.

* module/ice-9/debugging/traps.scm (guile-trap-features): Hardcoded as
  '(tweaking).

14 years agoRemove superfluous ice-9-debugger-extensions code for old Guile versions
Neil Jerram [Thu, 27 Aug 2009 20:50:46 +0000 (21:50 +0100)]
Remove superfluous ice-9-debugger-extensions code for old Guile versions

* module/ice-9/debugging/ice-9-debugger-extensions.scm: Remove all
  code checking for version < 1.7, and move code for versions >= 1.7
  up to top level.  Comment out dummy mutex definitions for now, as
  I'm not sure how to rewrite them correctly for psyntax.

14 years agoDefault srfi-14 character set information
Michael Gran [Thu, 27 Aug 2009 16:13:22 +0000 (09:13 -0700)]
Default srfi-14 character set information

* libguile/srfi-14.i.c: structures containing the default srfi-14
  sets

14 years agoAlways cast input to toupper as int
Michael Gran [Thu, 27 Aug 2009 14:35:39 +0000 (07:35 -0700)]
Always cast input to toupper as int

* libguile/read.c (scm_scan_for_encoding): add cast to int

14 years agoSegfault when writing non-Latin-1 characters under Latin-1 locale
Michael Gran [Thu, 27 Aug 2009 14:34:48 +0000 (07:34 -0700)]
Segfault when writing non-Latin-1 characters under Latin-1 locale

* libguile/print.c (iprin1): handle write of non-Latin-1 characters
  under the Latin-1 locale

14 years agoUnicode-capable srfi-14 charsets
Michael Gran [Thu, 27 Aug 2009 14:32:50 +0000 (07:32 -0700)]
Unicode-capable srfi-14 charsets

* libguile/Makefile.am: distribute new files srfi-14.i.c and
  unidata_to_charset.pl

* chars.c (scm_c_upcase, scm_c_downcase): use unicode-enable toupper
  and tolower

* libguile/srfi-14.h (scm_t_char_range, scm_t_char_set): new structures
  to describe char-sets
  (scm_t_char_set_cursor): new structure to describe char-set-cursors
  (SCM_BITS_PER_LONG): removed
  (SCM_CHARSET_GET): calls function
  New declarations for scm_i_charset_get, scm_i_charset_set,
  scm_i_charset_unset, and scm_debug_char_set.

* test-suite/tests/srfi-14.test: new tests

* libguile/srfi-14.c (SCM_CHARSET_DATA): new macro
  (SCM_CHARSET_SET, SCM_CHARSET_UNSET): call function
  (BYTES_PER_CHARSET, LONGS_PER_CHARSET): removed
  (scm_i_charset_get, scm_i_charset_set, scm_i_charset_unset)
  (charsets_equal, charsets_leq, charsets_union)
  (charsets_intersection, charsets_complement, charsets_xor): new
  functions that are low-level charset operators
  (charset_print, charset_free): modified for new charset struct
  (charset_cursor_print, charset_cursor_free): new function
  (make_char_set, scm_char_set_p, scm_char_set_eq, scm_car_set_leq)
  (scm_char_set_hash, scm_char_set_cursor, scm_char_set_ref)
  (scm_char_set_cursor_next, scm_end_of_char_set_p, scm_char_set_fold)
  (scm_char_set_unfold, scm_char_set_unfold_x, scm_char_set_for_each)
  (scm_char_set_map, scm_char_set_copy, scm_char_set, scm_list_to_char_set)
  (scm_list_to_char_set_x, scm_string_to_char_set, scm_string_to_char_set_x)
  (scm_char_set_filter, scm_char_set_filter_x, scm_ucs_range_to_char_set)
  (scm_ucs_range_to_char_set_x, scm_to_char_set, scm_char_set_size)
  (scm_char_set_count, scm_char_set_to_list, scm_char_set_to_string)
  (scm_char_set_contains_p, scm_char_set_every, scm_char_set_any)
  (scm_char_set_adjoin, scm_char_set_delete, scm_char_set_adjoin_x)
  (scm_char_set_delete_x, scm_char_set_complement, scm_char_set_union)
  (scm_char_set_intersection, scm_char_set_difference, scm_char_set_xor)
  (scm_char_set_diff_plus_intersection, scm_char_set_complement_x)
  (scm_char_set_union_x, scm_char_set_intersection_x, scm_char_set_difference_x)
  (scm_char_set_xor_x, scm_char_set_diff_plus_intersection_x): modified
  to use new charset and charset-cursor data structures
  (CSET_BLANK_PRED, CSET_SYMBOL_PRED, CSET_PUNCT_PRED, CSET_LOWER_PRED)
  (CSET_UPPER_PRED, CSET_LETTER_PRED, CSET_DIGIT_PRED, CSET_WHITESPACE_PRED)
  (CSET_CONTROL_PRED, CSET_HEX_DIGIT_PRED, CSET_ASCII_PRED, CSET_LETTER_PRED)
  (CSET_LETTER_AND_DIGIT_PRED, CSET_PRINTING_PRED, CSET_TRUE_PRED)
  (CSET_FALSE_PRED): removed
  (scm_srfi_14_compute_char_sets): removed - too slow to iterate
  over all of unicode at startup
  (scm_debug_char_set) [SCM_CHARSET_DEBUG]: new function

14 years agoRevert "eval is actually compile"
Andy Wingo [Wed, 26 Aug 2009 23:25:52 +0000 (01:25 +0200)]
Revert "eval is actually compile"

This reverts commit afe5e6baa76796b1467890fd55416a7f304bed5c.

14 years agoDon't leave and reenter guile mode if mutex is available
Ken Raeburn [Wed, 26 Aug 2009 22:30:59 +0000 (23:30 +0100)]
Don't leave and reenter guile mode if mutex is available

On Aug 5, 2009, at 10:06, Ken Raeburn wrote:
> (1) In scm_pthread_mutex_lock, we leave and re-enter guile mode so
> that we don't block the thread while in guile mode.  But we could
> use pthread_mutex_trylock first, and avoid the costs scm_leave_guile
> seems to incur on the Mac.  If we can't acquire the lock, it should
> return immediately, and then we can do the expensive, blocking
> version.  A quick, hack version of this changed my run time for
> A(3,8) from 17.5s to 14.5s, saving about 17%; sigaltstack and
> sigprocmask are still in the picture, because they're called from
> scm_catch_with_pre_unwind_handler.  I'll work up a nicer patch
> later.

Ah, we already had scm_i_pthread_mutex_trylock lying around; that made
things easy.
A second timing test with A(3,9) and this version of the patch (based
on 1.9.1) shows the same improvement.

* libguile/threads.c (scm_pthread_mutex_lock): Try the mutex before
  leaving and reentering guile mode.

14 years agoPick up in tree headers rather than installed ones
Ken Raeburn [Wed, 26 Aug 2009 22:06:13 +0000 (23:06 +0100)]
Pick up in tree headers rather than installed ones

From Ken Raeburn:

The Mac build off of "master" fails for me currently in srfi-13.c,
with the comparison-always-false warning Greg discussed.  I hacked
around that, but then guile-readline doesn't build:

Making all in guile-readline
../libguile/guile-snarf -o readline.x ../../guile-readline/readline.c
-
DHAVE_CONFIG_H  -I. -I.. -I../../guile-readline/.. -I../../guile-
readline/lib -I./lib  -g -O2
In file included from ../../guile-readline/readline.c:29:
../../guile-readline/../libguile.h:25:17: error: gmp.h: No such file
or directory
In file included from ../../guile-readline/../libguile.h:95,
                 from ../../guile-readline/readline.c:29:
../../guile-readline/../libguile/strings.h:26:21: error: uniconv.h: No
such file or directory

Neither the path specified for libgmp nor the path specified for
libunistring at configure time is included here.

I don't think any of this is Mac-specific; I'm surprised that it works
on GNU/Linux systems.  Perhaps I'm building it in ways that are
unusual for the other developers (build dir != src dir, libgmp and
guile-1.8 installed in the same place, libgmp and libunistring
installed in different nonstandard directories)?

If I use CPPFLAGS=... and LDFLAGS=... instead of --with-libfoo-prefix
configure options to specify paths to find libgmp and libunistring,
the tests still pick old, installed Guile headers (which this time
I've poisoned to highlight the problem) from those locations instead
of the in-tree versions:

Making all in test-suite
Making all in standalone
../../libguile/guile-snarf -o test-asmobs-lib.x ../../../test-suite/
standalone/test-asmobs-lib.c -DHAVE_CONFIG_H
-I. -I../../../test-suite/ standalone -I../.. -I/opt/local/include
-I/Users/raeburn/dev/guile/ libunistring-0.9.1/I/include -g -O2
-I../../.. -I../../../lib -I../../ lib -I../..
In file included from /opt/local/include/libguile.h:30,
                 from ../../../test-suite/standalone/test-asmobs-
lib.c:23:
/opt/local/include/libguile/__scm.h:3:2: error: #error Poison!

I might be building Guile as part of a larger package
(*cough*Emacs*cough*) that wants to include stuff from the same system
directories (e.g., for MacPorts, pkgsrc, whatever) where an old
version of Guile is installed, and thus Guile gets passed CPPFLAGS/
LDFLAGS settings that add that old version to the search paths.  So I
think the CPPFLAGS/LDFLAGS version needs to be made to work, as well
as the --with-libfoo-prefix version.

With the attached patch, I can get guile to build with CPPFLAGS= and
LDFLAGS= ... someone more familiar than I am with automake will have
to fix the guile-readline stuff.

14 years agofix uninitialized variable in scm_read_character
Andy Wingo [Wed, 26 Aug 2009 11:15:07 +0000 (13:15 +0200)]
fix uninitialized variable in scm_read_character

* libguile/read.c (scm_read_character): Fix uninitialized variable.

14 years agoactually install guile-tools
Andy Wingo [Wed, 26 Aug 2009 10:16:36 +0000 (12:16 +0200)]
actually install guile-tools

* meta/Makefile.am (bin_SCRIPTS): Re-add guile-tools here (removed in
  54b38caf19deb0e5a6e8146c65b3e176e7fffa60). Otherwise guile-tools
  doesn't get installed. I think that 1.9.2 had this bug.

14 years agofix guile-readline linker bug
Andy Wingo [Wed, 26 Aug 2009 10:12:31 +0000 (12:12 +0200)]
fix guile-readline linker bug

* acinclude.m4 (GUILE_READLINE): Fix typo that caused readline not to be
  linked to termcap.

14 years agoRemove the `scm_tc_free_cell' SMOB type.
Ludovic Courtès [Tue, 25 Aug 2009 21:57:49 +0000 (23:57 +0200)]
Remove the `scm_tc_free_cell' SMOB type.

* libguile/deprecated.h (SCM_FREEP, SCM_NFREEP): Changed to constants.

* libguile/gc.c (scm_i_tag_name): Remove reference to
  `scm_tc_free_cell'.

* libguile/gc.h (SCM_FREE_CELL_CDR, SCM_SET_FREE_CELL_CDR): Remove.

* libguile/smob.c (free_print): Remove.
  (scm_smob_prehistory): Don't create the "free" SMOB type.

* libguile/struct.c (struct_finalizer_trampoline): Use a bare
  `scm_tc3_struct' tag for finalized structs instead of
  `scm_tc_free_cell'.

* libguile/tags.h (scm_tc_free_cell): Remove.

14 years agoMerge commit 'origin/master'
Andy Wingo [Tue, 25 Aug 2009 19:43:00 +0000 (21:43 +0200)]
Merge commit 'origin/master'

Conflicts:
libguile/unif.c

14 years agoMerge wip-array refactor, up to cd43fdc5b7a7c
Andy Wingo [Tue, 25 Aug 2009 16:04:02 +0000 (18:04 +0200)]
Merge wip-array refactor, up to cd43fdc5b7a7c

Conflicts:
NEWS
libguile/print.c

14 years agoAdd full Unicode capability to ports and the default reader
Michael Gran [Tue, 25 Aug 2009 14:54:37 +0000 (07:54 -0700)]
Add full Unicode capability to ports and the default reader

Ports are given two additional properties: a character encoding and
a conversion failure strategy.  These properties have getters and setters.
The new properties are used to convert any locale text to/from the
internal representation of strings.

If unspecified, ports use a default value. The default value of these
properties is held in a fluid.  The default character encoding can be
modified by calling setlocale.

ISO-8859-1 is treated specially.  Since it is a native encoding of
strings, it can be processed more quickly.  Source code is assumed to be
ISO-8859-1 unless otherwise specified.  The encoding of a source code
file can be given as 'coding: XXXXX' in a magic comment at the top of a
file.

The C functions that deal with encoding often use a null pointer
as shorthand for the native Latin-1 encoding, for efficiency's sake.

* test-suite/tests/encoding-iso88591.test: new tests
* test-suite/tests/encoding-iso88597.test: new tests
* test-suite/tests/encoding-utf8.test: new tests
* test-suite/tests/encoding-escapes.test: new tests
* test-suite/tests/numbers.test: declare 'binary' encoding
* test-suite/tests/ports.test: declare 'binary' encoding
* test-suite/tests/r6rs-ports.test: declare 'binary' encoding

* module/system/base/compile.scm (compile-file): use source-code
  file's self-declared encoding when compiling files

* libguile/strports.c: store string ports in locale encoding
  (scm_strport_to_locale_u8vector, scm_call_with_output_locale_u8vector)
  (scm_open_input_locale_u8vector, scm_get_output_locale_u8vector):
  new functions

* libguile/strings.h: new declaration for scm_i_string_contains_char

* libguile/strings.c (scm_i_string_contains_char): new function
  (scm_from_stringn, scm_to_stringn):  use NULL for Latin-1
  (scm_from_locale_stringn, scm_to_locale_stringn): respect character
  encoding of input and output ports

* libguile/read.h: declaration for scm_scan_for_encoding

* libguile/read.c:
  (read_token): now takes scheme string instead of C string/length
  (read_complete_token): new function
  (scm_read_sexp, scm_read_number, scm_read_mixed_case_symbol)
  (scm_read_number_and_radix, scm_read_quote, scm_read_semicolon_comment)
  (scm_read_srfi4_vector, scm_read_bytevector, scm_read_guile_bit_vector)
  (scm_read_scsh_block_comment, scm_read_commented_expression)
  (scm_read_extended_symbol, scm_read_sharp_extension, scm_read_shart)
  (scm_read_expression): use scm_t_wchar for char type, use read_complete_token
  (scm_scan_for_encoding): new function to find a file's character encoding
  (scm_file_encoding): new function to find a port's character encoding

* libguile/rdelim.c: don't unpack strings

* libguile/print.h: declaration for modified function
  scm_i_charprint

* libguile/print.c: use locale when printing characters and
  strings
  (scm_i_charprint): input parameter is now scm_t_wchar
  (scm_simple_format): don't unpack strings

* libguile/posix.h: new declaration for scm_setbinary.

* libguile/posix.c (scm_setlocale): set default and stdio port
  encodings based on the locale's character encoding
  (scm_setbinary): new function

* libguile/ports.h (scm_t_port): add encoding and failed
  conversion handler to port type.  Declarations for new or modified
  functions scm_getc, scm_unget_byte, scm_ungetc,
  scm_i_get_port_encoding, scm_i_set_port_encoding_x,
  scm_port_encoding, scm_set_port_encoding_x,
  scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x,
  scm_port_conversion_strategy, scm_set_port_conversion_strategy_x.

* libguile/ports.c: assign the current ports to zero on startup so
  we can see if they've been set.
  (scm_current_input_port, scm_current_output_port,
  scm_current_error_port): return #f if the port is not yet
  initialized
  (scm_new_port_table_entry): set up a new port's encoding and
  illegal sequence handler based on the thread's current defaults
  (scm_i_remove_port): free port encoding name when port is removed
  (scm_i_mode_bits_n): now takes a scheme string instead of a c
  string and length.  All callers changed.
  (SCM_MBCHAR_BUF_SIZE): new const
  (scm_getc): new function, since the scm_getc in inline.h is now
  scm_get_byte_or_eof.  This pulls one codepoint from a port.
  (scm_lfwrite_substr, scm_lfwrite_str): now uses port's encoding
  (scm_unget_byte): new function, incorportaing the low-level functionality
  of scm_ungetc
  (scm_ungetc): uses scm_unget_byte

* libguile/numbers.h (scm_t_wchar): compilation order problem with
  scm_t_wchar being use in functions in multiple headers.  Forward
  declare scm_t_wchar.

* libguile/load.c (scm_primitive_load): scan for file encoding at
  top of file and use it to set the load port's encoding

* libguile/inline.h (scm_get_byte_or_eof): new function
  incorporating most of the functionality of scm_getc.

* libguile/fports.c (fport_fill_input): now returns scm_t_wchar

* libguile/chars.h (scm_t_wchar): avoid compilation order problem
  with declaration of scm_t_wchar

14 years agoAvoid unpacking symbols in GOOPS
Michael Gran [Sun, 23 Aug 2009 17:40:44 +0000 (10:40 -0700)]
Avoid unpacking symbols in GOOPS

* libguile/goops.c (scm_make_extended_class_from_symbol): new function
  (scm_class_of): don't unpack symbol chars
  (wrap_init): don't unpack symbol chars
  (make_class_from_symbol): new function
  (make_struct_class): don't unpack symbol chars

14 years agoModify socket and time functions for wide strings
Michael Gran [Sun, 23 Aug 2009 13:50:45 +0000 (06:50 -0700)]
Modify socket and time functions for wide strings

* libguile/socket.c (scm_recv): receive the message without holding the
  stringbuf writing lock
  (scm_send): try to narrow a string before using it

* libguile/stime.c (strftime): convert string to UTF-8 so that it can
  be safely passed to strftime
  (strptime): convert input string to UTF-8 so that it can be safely
  passed through strptime

* libguile/strings.c (narrow_stringbuf): new function
  (scm_i_try_narrow_string): new function

* libguile/strings.h: new declaration for scm_i_try_narrow_string

14 years agoUse string and symbol accessors in struct, throw, and array funcs
Michael Gran [Sat, 22 Aug 2009 17:15:53 +0000 (10:15 -0700)]
Use string and symbol accessors in struct, throw, and array funcs

* libguile/struct.c (scm_make_struct_layout, scm_struct_init)
  (scm_struct_vtable_p, scm_struct_ref, scm_struct_set_x): use string
  and symbol accessors and avoid unpacking strings and symbols

* libguile/throw.c (scm_ithrow): allow wide symbols in the error message

* libguile/unif.c (scm_enclose_array, scm_istr2bve): use string
  accessors and avoid unpacking strings

14 years agoAvoid type-punning warning in scm_gentemp
Michael Gran [Sat, 22 Aug 2009 13:30:34 +0000 (06:30 -0700)]
Avoid type-punning warning in scm_gentemp

Int and size_t may not have the same storage size

* libguile/deprecated.c (scm_gentemp): use size_t for string length

14 years agoUpdate NEWS
Neil Jerram [Fri, 21 Aug 2009 21:31:09 +0000 (22:31 +0100)]
Update NEWS

14 years agoAvoid clash with system setjmp/longjmp on IA64
Neil Jerram [Wed, 5 Aug 2009 15:13:28 +0000 (16:13 +0100)]
Avoid clash with system setjmp/longjmp on IA64

Problem was that if an application includes both libguile.h and the
system's setjmp.h, and is compiled on IA64, it gets compile errors
because of jmp_buf, setjmp and longjmp being multiply defined.

* libguile/__scm.h (__ia64__): Define scm_i_jmp_buf, SCM_I_SETJMP and
  SCM_I_LONGJMP instead of jmp_buf, setjmp and longjmp.

  (all other platforms): Map scm_i_jmp_buf, SCM_I_SETJMP and
  SCM_I_LONGJMP to jmp_buf, setjmp and longjmp.

* libguile/continuations.c (scm_make_continuation): Use `SCM_I_SETJMP'
  instead of `setjmp'.
  (copy_stack_and_call): Use `SCM_I_LONJMP' instead of `longjmp'.
  (scm_ia64_longjmp): Use type `scm_i_jmp_buf' instead of `jmp_buf'.

* libguile/continuations.h (scm_t_contregs): Use type `scm_i_jmp_buf'
  instead of `jmp_buf'.

* libguile/threads.c (suspend): Use `SCM_I_SETJMP' instead of
  `setjmp'.

* libguile/threads.h (scm_i_thread): Use type `scm_i_jmp_buf' instead
  of `jmp_buf'.

* libguile/throw.c (JBJMPBUF, make_jmpbuf, jmp_buf_and_retval): Use
  type `scm_i_jmp_buf' instead of `jmp_buf'.
  (scm_c_catch): Use `SCM_I_SETJMP' instead of `setjmp'.
  (scm_ithrow): Use `SCM_I_LONGJMP' instead of `longjmp'.

14 years agoRemove trailing whitespace
Neil Jerram [Tue, 4 Aug 2009 18:11:21 +0000 (19:11 +0100)]
Remove trailing whitespace

14 years agoFix set-source-properties so that the special source properties work
Neil Jerram [Tue, 4 Aug 2009 17:57:18 +0000 (18:57 +0100)]
Fix set-source-properties so that the special source properties work

* libguile/srcprop.c (scm_set_source_properties_x): Look for the special
  source properties, save them off, and then construct a srcprops object
  using them.

14 years agoIn srcprop.c change all occurrences of "plist" to "alist"
Neil Jerram [Tue, 4 Aug 2009 17:54:50 +0000 (18:54 +0100)]
In srcprop.c change all occurrences of "plist" to "alist"

As with the previous commit, this is to avoid any suggestion that
the source properties API uses the property list format, i.e.
(key1 value1 key2 value2 ...).

Also remove scm_srcprops_to_plist () from the API.  It doesn't have any
external usefulness and has never documented.

14 years agoMinor improvements to doc on source properties
Neil Jerram [Tue, 4 Aug 2009 14:40:06 +0000 (15:40 +0100)]
Minor improvements to doc on source properties

In particular avoid any suggestion that the API uses the
property list format, i.e. (key1 value1 key2 value2 ...),
as opposed to the alist format that it actually does use.

14 years agoMerge branch 'wip-manual' of ssh://ossau@git.sv.gnu.org/srv/git/guile
Neil Jerram [Fri, 21 Aug 2009 21:04:03 +0000 (22:04 +0100)]
Merge branch 'wip-manual' of ssh://ossau@git.sv.gnu.org/srv/git/guile

Conflicts:

doc/ref/autoconf.texi
doc/ref/vm.texi

14 years agoUse uc_tolower in number conversion
Michael Gran [Fri, 21 Aug 2009 16:30:53 +0000 (09:30 -0700)]
Use uc_tolower in number conversion

* libguile/numbers.c (XDIGIT2UINT): use uc_tolower

14 years agoUse string accessors for string->number conversion
Michael Gran [Fri, 21 Aug 2009 16:18:30 +0000 (09:18 -0700)]
Use string accessors for string->number conversion

* libguile/numbers.c (scm_i_print_fraction): use string accessors
  (XDIGIT2UINT): use libunistring function
  (mem2uinteger, mem2integer, mem2decimal_from_point, mem2ureal)
  (mem2complex): take scheme string instead of c string; use accessors
  (scm_i_string_to_number): new function
  (scm_c_locale_string_to_number): use scm_i_string_to_number

* libguile/numbers.h: declaration for scm_i_string_to_number

* libguile/strings.c (scm_i_string_strcmp): new function

* libguile/strings.h: declaration for scm_i_string_strcmp

14 years agoAdd initial support for wide symbols
Michael Gran [Fri, 21 Aug 2009 15:57:35 +0000 (08:57 -0700)]
Add initial support for wide symbols

* libguile/hash.c (scm_i_string_hash): new function
  (scm_hasher): don't unpack string: use scm_i_string_hash

* libguile/hash.h: new declaration for scm_i_string_hash

* libguile/print.c (quote_keywordish_symbol): use symbol accessors
  (scm_i_print_symbol_name): new function
  (scm_print_symbol_name): call scm_i_print_symbol_name
  (iprin1): use scm_i_print_symbol_name to print symbols

* libguile/print.h: new declaration for scm_i_print_symbol_name

* libguile/symbols.c (lookup_interned_symbol): now takes scheme string
  instead of c string; callers changed
  (lookup_interned_symbol): add wide symbol support
  (scm_i_c_mem2symbol): removed
  (scm_i_mem2symbol): removed and replaced with scm_i_str2symbol
  (scm_i_str2symbol): new function
  (scm_i_mem2uninterned_symbol): removed and replaced with
  scm_i_str2uninterned_symbol
  (scm_i_str2uninterned_symbol): new function
  (scm_make_symbol, scm_string_to_symbol, scm_from_locale_symbol)
  (scm_from_locale_symboln): use scm_i_str2symbol

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

14 years agoUse symbol accessors in scm_gc_mark_dependencies
Michael Gran [Fri, 21 Aug 2009 05:41:12 +0000 (22:41 -0700)]
Use symbol accessors in scm_gc_mark_dependencies

* libguile/gc-mark.c (scm_gc_mark_dependencies): don't unpack symbols.
  Use symbol accessors.

14 years agoUse string accessors in scm_basename and scm_dirname
Michael Gran [Fri, 21 Aug 2009 05:40:15 +0000 (22:40 -0700)]
Use string accessors in scm_basename and scm_dirname

* libguile/filesys.c (basename, dirname): don't unpack strings.
  Use string accessor functions.

14 years agoAvoid type-limits warning in SCM_TO_TYPE_PROTO
Michael Gran [Fri, 21 Aug 2009 04:33:49 +0000 (21:33 -0700)]
Avoid type-limits warning in SCM_TO_TYPE_PROTO

* libguile/conv-uinteger.i.c (SCM_TO_TYPE_PROTO): avoid a comparison
  that is always true due to the limited range of the data type

14 years agoType-limits error in GC environment initialization
Michael Gran [Fri, 21 Aug 2009 04:31:58 +0000 (21:31 -0700)]
Type-limits error in GC environment initialization

* libguile/gc-malloc.c (scm_gc_init_malloc): GUILE_INIT_MALLOC_LIMIT
  is cast to unsigned then tested as if it were still signed

14 years agoAvoid accessing symbol internals in call_dsubr_1 and DEVAL
Michael Gran [Fri, 21 Aug 2009 03:30:12 +0000 (20:30 -0700)]
Avoid accessing symbol internals in call_dsubr_1 and DEVAL

The symbol's characters are only accessed in case they are needed
for an error message.  This can be avoided by passing the symbol
all the way to a error message function.

* libguile/__scm.h (SCM_WTA_DISPATCH_1_SUBR): new macro

* libguile/error.c (scm_i_wrong_type_arg_symbol): new error function

* libguile/error.h: declaration of scm_i_wrong_type_arg_symbol

* libguile/eval.c (call_dsubr_1): use new macro SCM_WTA_DISPATCH_1_SUBR
  to avoid having to unpack the symbol's chars

* libguile/eval.i.c: use new macro SCM_WTA_DISPATCH_1_SUBR

14 years agoUse string and symbol accessors with obarrays and keyword-dash-symbols
Michael Gran [Thu, 20 Aug 2009 16:42:38 +0000 (09:42 -0700)]
Use string and symbol accessors with obarrays and keyword-dash-symbols

* libguile/deprecated.c (intern_obarray_soft): new function
  (scm_intern_obarray_soft, scm_string_to_obarray_symbol): use
  intern_obarray_soft
  (scm_gentemp): don't unpack string chars, use intern_obarray_soft

* libguile/discouraged.c (scm_make_keyword_from_dash_symbol): use
  symbol accessor

14 years agoAggregate `guile-readline' makefiles.
Ludovic Courtès [Thu, 20 Aug 2009 23:33:16 +0000 (01:33 +0200)]
Aggregate `guile-readline' makefiles.

* configure.ac: Don't produce `guile-readline/ice-9/Makefile'.

* guile-readline/Makefile.am (SUBDIRS): Remove.
  (ice9dir, nobase_ice9_DATA): New, formerly under `ice-9'.
  (ETAGS_ARGS, EXTRA_DIST): Augment.
  (DEFS): Move outside of `if'.
  (MKDEP): Remove.

* guile-readline/ice-9/Makefile.am: Remove.

14 years agoDon't use a sub-`configure' for `guile-readline'.
Ludovic Courtès [Thu, 20 Aug 2009 23:18:20 +0000 (01:18 +0200)]
Don't use a sub-`configure' for `guile-readline'.

* acinclude.m4 (GUILE_READLINE): New macro, based on the former
  `guile-readline/configure.ac'.

* configure.ac: Remove `AC_CONFIG_SUBDIRS' invocation.  Add
  `GUILE_READLINE' invocation.  Produce files under `guile-readline'.

* guile-readline/Makefile.am: Conditionalize the meat under
  `HAVE_READLINE'.
  (INCLUDES): Rename to...
  (AM_CPPFLAGS): this.  Users updates.
  (AM_CFLAGS): New variable.
  (libguilereadline_v_@LIBGUILEREADLINE_MAJOR@_la_LIBADD): Add
  $(READLINE_LIBS).

* guile-readline/readline.c: Include <config.h>.

* guile-readline/configure.ac, guile-readline/autogen.sh: Remove.

14 years agoeval is actually compile
Andy Wingo [Thu, 20 Aug 2009 12:33:38 +0000 (14:33 +0200)]
eval is actually compile

* module/ice-9/boot-9.scm (eval): Here at the tail of boot-9, replace
  the root definition of `eval' with a procedure that will call
  `compile'.

* test-suite/tests/syntax.test ("top-level define"):
  ("internal define"): Run unmemoization tests in the interpreter, using
  primitive-eval.

14 years agoprograms have their own tc7 now
Andy Wingo [Thu, 20 Aug 2009 12:27:38 +0000 (14:27 +0200)]
programs have their own tc7 now

* libguile/tags.h (scm_tc7_program):
* libguile/programs.h: Programs now have their own tc7 code. Fix up the
  macros appropriately.

* libguile/programs.c: Remove smobby bits, leaving marking, printing,
  and application for other parts of Guile.

* libguile/debug.c (scm_procedure_source):
* libguile/eval.c (scm_trampoline_0, scm_trampoline_1)
  (scm_trampoline_2): Add cases for tc7_program.
* libguile/eval.i.c (CEVAL, SCM_APPLY):
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/gc-card.c (scm_i_sweep_card, scm_i_tag_name):
* libguile/gc-mark.c (1):
* libguile/print.c (iprin1):
* libguile/procs.c (scm_procedure_p, scm_thunk_p)
* libguile/vm-i-system.c (make-closure): Adapt to new procedure
  representation.

* libguile/procprop.c (scm_i_procedure_arity): Do the right thing for
  programs.
* test-suite/tests/procprop.test ("procedure-arity"): Arity test now
  succeeds.

* libguile/goops.c (scm_class_of): Programs now belong to the class
  <procedure>, not a smob class.

* libguile/vm.h (struct vm, struct vm_cont):
* libguile/vm-engine.c (vm_engine):
* libguile/frames.h (SCM_FRAME_BYTE_CAST, struct vm_frame):
* libguile/frames.c (scm_c_make_vm_frame): Fix usages of scm_byte_t,
  changing them to scm_t_uint8.

14 years agoeval-elisp uses primitive-eval
Andy Wingo [Thu, 20 Aug 2009 10:55:05 +0000 (12:55 +0200)]
eval-elisp uses primitive-eval

* lang/elisp/interface.scm (eval-elisp): Use primitive-eval, as we will
  be switching the evaluator soon.

14 years agodefine @bind using syntax-case
Andy Wingo [Thu, 20 Aug 2009 10:48:11 +0000 (12:48 +0200)]
define @bind using syntax-case

* module/ice-9/boot-9.scm (@bind): Define a VM-compatible syntax
  definition for this old evaluator primitive.

* test-suite/tests/dynamic-scope.test: Change the expected error
  messages.

14 years agouse primitive-eval in run-vm-tests.scm
Andy Wingo [Thu, 20 Aug 2009 10:47:11 +0000 (12:47 +0200)]
use primitive-eval in run-vm-tests.scm

* testsuite/run-vm-tests.scm (run-vm-tests): Use primitive-eval, as
  we'll be changing eval soon.

14 years agobetter VM error messages
Andy Wingo [Thu, 20 Aug 2009 10:46:36 +0000 (12:46 +0200)]
better VM error messages

* libguile/vm-engine.c: Attempt to make error messages more friendly
  and uniform with historical expectation.

14 years agoupdate docs for calling convention change
Andy Wingo [Sat, 15 Aug 2009 12:27:15 +0000 (14:27 +0200)]
update docs for calling convention change

* doc/ref/vm.texi: Update.

14 years agopush new frame on stack before procedure & args
Andy Wingo [Sat, 15 Aug 2009 12:15:56 +0000 (14:15 +0200)]
push new frame on stack before procedure & args

* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump

* libguile/vm-engine.c (vm_engine): Push a frame corresponding to the
  mv-call.

* libguile/vm-i-system.c: Renumber ops.
  (new-frame): New op, pushes a frame.
  (call, mv-call): No need to shuffle args, though we do need to pop the
  frame in the non-vm call case.
  (goto/args): Inconsequential tweaks.
  (call/cc): Push a frame if needed.

* module/language/tree-il/compile-glil.scm (flatten): Emit `new-frame'
  as appropriate.

* test-suite/tests/tree-il.test: Fix to expect new-frame.

14 years agoreorder frame layout
Andy Wingo [Sat, 15 Aug 2009 12:13:08 +0000 (14:13 +0200)]
reorder frame layout

* libguile/frames.h: Reorder the frame layout so the return address
  comes below the arguments.working
  (SCM_FRAME_SET_RETURN_ADDRESS, SCM_FRAME_SET_MV_RETURN_ADDRESS): New
  macros.

* libguile/frames.c (scm_vm_frame_arguments): Use the macros to access
  the arguments.

* libguile/vm-engine.c (vm_engine): Fix for new calling convention.

* libguile/vm-engine.h (INIT_FRAME): New macro. Does part of what
  NEW_FRAME used to do.

* libguile/vm-i-system.c (call, mv-call): Shuffle args up to make room
  for the stack, and adapt to new calling convention.
  (goto/args): Shuffling down is easier now.
  (return, return/args): Adapt to new frame layout.

* libguile/vm.c (vm_mark_stack): Adapt to new frame layout, and the
  possibility of there being crap on the stack.
  (really_make_boot_program): Remove extraneous comment.

14 years agoremove dead weight from vm-i-system.c
Andy Wingo [Sat, 15 Aug 2009 12:11:51 +0000 (14:11 +0200)]
remove dead weight from vm-i-system.c

* libguile/vm-i-system.c: Remove mark, list-mark, cons-mark,
  vector-mark, and list-break, as they are no longer used.
  (call, goto/args, mv-call): Remove bits about trampolines, which was
  slower, and VM continuations, which are not used (we use Guile's
  continuations as the applicable objects).

  Renumber ops.

* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.

14 years agodisable autocompilation in the test suite
Andy Wingo [Thu, 20 Aug 2009 16:46:09 +0000 (18:46 +0200)]
disable autocompilation in the test suite

* check-guile.in: Disable autocompilation while working in the test
  suite, for now at least. We'll enable it again later.

14 years agoautocompiled files before installation go to a cache dir in the builddir
Andy Wingo [Thu, 20 Aug 2009 15:56:44 +0000 (17:56 +0200)]
autocompiled files before installation go to a cache dir in the builddir

* libguile/load.c (scm_init_load_path): Append a slash after
  XDG_CACHE_HOME.

* meta/gdb-uninstalled-guile.in:
* meta/guile.in (XDG_CACHE_HOME): Export this var so we write to a cache
  within the build directory. Probably we should have a GUILE_CACHE_DIR
  to be more specific, though.

* Makefile.am (clean-local): Clear the cache when making clean.

14 years agotype limits error in string-tabulate
Michael Gran [Thu, 20 Aug 2009 14:23:22 +0000 (07:23 -0700)]
type limits error in string-tabulate

* libguile/srfi-13.c (scm_string_tabulate): test range of signed integer
  before casting it to unsigned size_t

14 years agoRelax assumptions made in the precise VM stack marking procedure.
Ludovic Courtès [Thu, 20 Aug 2009 10:18:57 +0000 (12:18 +0200)]
Relax assumptions made in the precise VM stack marking procedure.

* libguile/vm.c (vm_stack_mark): Change assertions into checks to
  determine whether VM points to a sane (initialized) object.  The
  assumption previously was that free-list elements would be zeroed, as
  implied by the comment in <gc/gc_mark.h>, but this doesn't appear to
  be the case.

14 years agoUpdate srfi-13 functions for Unicode
Michael Gran [Wed, 19 Aug 2009 12:25:47 +0000 (05:25 -0700)]
Update srfi-13 functions for Unicode

* libguile/srfi-13.c (MY_SUBF_VALIDATE_SUBSTRING_SPEC): new macro
  (MY_VALIDATE_SUBSTRING_SPEC_COPY): now unused, removed
  (MY_VALIDATE_SUBSTRING_SPEC_UCOPY): now unused, removed
  (REF_IN_CHARSET): new macro
  (race_error)[0]: unused, removed
  (scm_string_any, scm_string_every, scm_string_tabulate)
  (scm_substring_to_list, scm_reverse_string_to_list)
  (scm_reverse_list_to_string, scm_string_join)
  (s_scm_srfi13_substring_copy, scm_string_copy, scm_string_copy_x)
  (scm_string_pad, scm_string_pad_right, scm_string_trim)
  (scm_string_trim_right, scm_string_trim_both, scm_substring_fill_x):
  (scm_string_compare, scm_string_compare_ci): modified for
  both wide and narrow strings
  (compare_string): new function
  (scm_string_eq, scm_string_neq, scm_string_lt, scm_string_gt)
  (scm_string_le, scm_string_ge, scm_string_ci_eq, scm_string_ci_neq)
  (scm_string_ci_lt, scm-string_ci_gt, scm_string_ci_le, scm_string_ci_gt)
  (scm_substring_hash, scm_string_prefix_length, scm_string_suffix_length)
  (scm_string_prefix_length_ci, scm_string_suffix_length_ci)
  (scm_string_prefix_p, scm_string_prefix_ci_p, scm_string_suffix_p)
  (scm_string_suffix_ci_p, scm_string_index, scm_string_index_right)
  (scm_string_skip, scm_string_skip_right, scm_string_count)
  (scm_string_contains, scm_string_contains_ci, string_upcase_x)
  (scm_substring_upcase_x, scm_substring_upcase, string_downcase_x)
  (scm_string_downcase_x, scm_string_downcase, scm_string_titlecase_x)
  (scm_string_titlecase, scm_string_capitalize, scm_string_reverse)
  (scm_string_reverse_x, scm_string_map, scm_string_map_x)
  (scm_string_fold, scm_string_fold_right, scm_string_unfold)
  (scm_string_unfold_right, scm_xsubstring, scm_string_xcopy_x)
  (scm_string_replace, scm_string_tokenize, scm_string_split)
  (scm_string_filter, scm_string_delete): modified for both wide and
  narrow strings

14 years agoSome srfi-13 test with wide strings
Michael Gran [Thu, 20 Aug 2009 06:21:18 +0000 (23:21 -0700)]
Some srfi-13 test with wide strings

* test-suite/tests/srfi-13.test: more tests

14 years agoUpdates to benchmarks for srfi-13
Michael Gran [Thu, 20 Aug 2009 04:21:29 +0000 (21:21 -0700)]
Updates to benchmarks for srfi-13

Test more of the positive paths.  Add test for string-prefix-ci?
string-suffix-ci? and string-hash-ci.  Update the counts per test
to give approximately the same bench/interp time for each test for
1.8.7.

* benchmark-suite/benchmarks/srfi-13.bm: update benchmarks

14 years agoAvoid possible mutex hang on error message output
Michael Gran [Thu, 20 Aug 2009 04:47:19 +0000 (21:47 -0700)]
Avoid possible mutex hang on error message output

Avoid possible mutex hang when scm_lfwrite_substr is used in error
message output and when an error has caused the stringbuf write
mutex to not be unlocked.  scm_lfwrite_substr makes a substring:
making a substring requires that mutex.

Hopefully, all cases of non-local jumps when the stringbuf write
lock is held have been eliminated anyway, making this O.B.E.

* libguile/ports.c (scm_lfwrite_str): include functionality in this
  function instead of making this a special case of scm_lfwrite_substr

14 years agoAdd VM exception in strings.test
Michael Gran [Thu, 20 Aug 2009 05:12:33 +0000 (22:12 -0700)]
Add VM exception in strings.test

* test-suite/tests/strings.test (exception:wrong-type-arg): change regex

14 years agoTry to optimize scm_string for speed
Michael Gran [Thu, 20 Aug 2009 04:26:11 +0000 (21:26 -0700)]
Try to optimize scm_string for speed

* libguile/strings.c (scm_string): optimize for speed

14 years agoRename string-width to string-bytes-per-char
Michael Gran [Thu, 20 Aug 2009 04:24:23 +0000 (21:24 -0700)]
Rename string-width to string-bytes-per-char

* libguile/strings.h: rename scm_string_width to scm_string_bytes_per_char

* libguile/strings.c (scm_string_width): renamed to scm_string_bytes_per_char
  (scm_string_bytes_per_char): renamed from scm_string_width

* module/language/assembly/compile-bytecode.scm (write-bytecode): string-width
  -> string-bytes-per-char

* module/language/glil/compile-assembly.scm (dump-object): string-width
  -> string-bytes-per-char

14 years agoMisleading error message text in scm_i_string_writable_wide_chars
Michael Gran [Thu, 20 Aug 2009 04:25:23 +0000 (21:25 -0700)]
Misleading error message text in scm_i_string_writable_wide_chars

* libguile/strings.c (scm_i_string_writable_wide_chars): change error text

14 years agoImplement precise marking of the VM stack.
Ludovic Courtès [Wed, 19 Aug 2009 23:56:47 +0000 (01:56 +0200)]
Implement precise marking of the VM stack.

Suggested by Andy Wingo.

* libguile/vm.c (VM_ENABLE_PRECISE_STACK_GC_SCAN): New macro.
  (vm_stack_gc_kind): New variable.
  (make_vm)[VM_ENABLE_PRECISE_STACK_GC_SCAN]: Use `GC_generic_malloc ()'
  to allocate the stack.
  (vm_stack_mark): New function.
  (scm_bootstrap_vm)[VM_ENABLE_PRECISE_STACK_GC_SCAN]: Initialize
  `vm_stack_gc_kind'.

14 years agoFix bogus computation of `vm->stack_limit'.
Ludovic Courtès [Wed, 19 Aug 2009 23:20:58 +0000 (01:20 +0200)]
Fix bogus computation of `vm->stack_limit'.

* libguile/vm.c (make_vm): Remove bogus "- 3" when computing
  `stack_size'.

* libguile/vm-engine.h (CHECK_OVERFLOW): Change accordingly.

14 years agoSimplify the creation of the SMOB GC "kind".
Ludovic Courtès [Wed, 19 Aug 2009 23:16:38 +0000 (01:16 +0200)]
Simplify the creation of the SMOB GC "kind".

* libguile/smob.c (smob_freelist): Remove.
  (scm_smob_prehistory): Adjust accordingly.

14 years agoInclude "scmconfig.h" in <libguile/boehm-gc.h>.
Ludovic Courtès [Wed, 19 Aug 2009 23:14:14 +0000 (01:14 +0200)]
Include "scmconfig.h" in <libguile/boehm-gc.h>.

* libguile/boehm-gc.h: Use "scmconfig.h".  Check for
  `SCM_USE_PTHREAD_THREADS', not `SCM_I_GSC_USE_PTHREAD_THREADS'.

14 years agoprocedure-documentation works on vm procedures
Andy Wingo [Wed, 19 Aug 2009 10:20:58 +0000 (12:20 +0200)]
procedure-documentation works on vm procedures

* libguile/procs.c (scm_procedure_documentation): Add a hack so that
  this function works for compiled procedures too.

14 years agoDisplay wide strings using escapes
Michael Gran [Wed, 19 Aug 2009 05:32:08 +0000 (22:32 -0700)]
Display wide strings using escapes

* libguile/print.c (iprin1): for now, display wide strings
  as escaped strings

14 years agoAvoid double-casts of stringbuf
Michael Gran [Wed, 19 Aug 2009 04:14:56 +0000 (21:14 -0700)]
Avoid double-casts of stringbuf

Conversion from char to scm_t_wchar require an intermediate cast to
unsigned char.  By changing the return type of SCM_STRINGBUF_INLINE_CHARS
to unsigned char *, doublecasts in the code can be avoided.  Also,
some clarification of return types.

* libguile/strings.c (STRINGBUF_OUTLINE_CHARS)
(STRINGBUF_INLINE_CHARS): now returns unsigned char *; all callers changed.

14 years agoAvoid compilation warnings in SCM_MAKE_CHAR
Michael Gran [Wed, 19 Aug 2009 04:13:38 +0000 (21:13 -0700)]
Avoid compilation warnings in SCM_MAKE_CHAR

* libguile/chars.h (SCM_MAKE_CHAR): change inequality

14 years agoBenchmarks for common character and string procedures
Michael Gran [Wed, 19 Aug 2009 02:42:38 +0000 (19:42 -0700)]
Benchmarks for common character and string procedures

* benchmark-suite/benchmarks/chars.bm: new benchmarks

* benchmark-suite/benchmarks/srfi-13.bm: new benchmarks

14 years agoRemove unneeded `scm_without_guile ()' call.
Ludovic Courtès [Tue, 18 Aug 2009 22:13:55 +0000 (00:13 +0200)]
Remove unneeded `scm_without_guile ()' call.

* libguile/scmsigs.c (read_without_guile_data, do_read_without_guile,
  read_without_guile): Remove.
  (signal_delivery_thread): Use read(2) instead of `read_without_guile ()'.

14 years agoReinstate missing IA64 helper functions.
Ludovic Courtès [Tue, 18 Aug 2009 22:06:14 +0000 (00:06 +0200)]
Reinstate missing IA64 helper functions.

* libguile/threads.c (scm_ia64_register_backing_store_base,
  scm_ia64_ar_bsp): New, formerly in `gc.c', which was removed in the
  BDW-GC branch.

14 years agoUse `scm_gc_malloc_pointerless ()' for bytevectors.
Ludovic Courtès [Tue, 18 Aug 2009 20:12:31 +0000 (22:12 +0200)]
Use `scm_gc_malloc_pointerless ()' for bytevectors.

* libguile/bytevectors.c (make_bytevector): Use
  `scm_gc_malloc_pointerless ()' for the buffer itself.

* libguile/r6rs-ports.c (scm_get_bytevector_some,
  scm_get_bytevector_all, bop_buffer_grow): Likewise.

14 years agoremove (ice-9 lineio)'s dependency on (ice-9 readline)
Andy Wingo [Tue, 18 Aug 2009 15:52:46 +0000 (17:52 +0200)]
remove (ice-9 lineio)'s dependency on (ice-9 readline)

* module/ice-9/lineio.scm: Use (ice-9 rdelim) instead of (ice-9
  readline) to remove readline dependency.

14 years ago`load' autocompiles
Andy Wingo [Tue, 18 Aug 2009 09:05:17 +0000 (11:05 +0200)]
`load' autocompiles

* libguile/load.h:
* libguile/load.c (scm_sys_warn_autocompilation_enabled): New primitive,
  not exported. Since `load' autocompiles now, it should warn in the
  same way that the bits hardcoded into C warn.
  (scm_try_autocompile): Use scm_sys_warn_autocompilation_enabled.

* module/ice-9/boot-9.scm (autocompiled-file-name): New helper.
  (load): Try autocompiling the argument, if appropriate. Will
  autocompile files passed on Guile's command line. `primitive-load' is
  unaffected.

14 years agoRemove unneeded SMOB mark/free procedures.
Ludovic Courtès [Mon, 17 Aug 2009 22:31:32 +0000 (00:31 +0200)]
Remove unneeded SMOB mark/free procedures.

* libguile/bytevectors.c (free_bytevector): Remove.
  (scm_bootstrap_bytevectors): Update accordingly.

* libguile/r6rs-ports.c (bip_mark, cbp_mark, bop_free, bop_proc_mark):
  Remove.
  (initialize_bytevector_input_ports,
  initialize_custom_binary_input_ports,
  initialize_bytevector_output_ports,
  initialize_custom_binary_output_ports): Update accordingly.

14 years agoFix malloc/scm_c_take_bytevector mismatch.
Ludovic Courtès [Mon, 17 Aug 2009 22:09:26 +0000 (00:09 +0200)]
Fix malloc/scm_c_take_bytevector mismatch.

* libguile/bytevectors.c (STRING_TO_UTF): Use `make_bytevector ()'
  instead of `scm_c_take_bytevector ().
  (scm_string_to_utf8): Likewise.

14 years agoMerge branch 'master' into boehm-demers-weiser-gc
Ludovic Courtès [Mon, 17 Aug 2009 21:39:56 +0000 (23:39 +0200)]
Merge branch 'master' into boehm-demers-weiser-gc

Conflicts:
lib/Makefile.am
libguile/Makefile.am
libguile/frames.c
libguile/gc-card.c
libguile/gc-freelist.c
libguile/gc-mark.c
libguile/gc-segment.c
libguile/gc_os_dep.c
libguile/load.c
libguile/macros.c
libguile/objcodes.c
libguile/programs.c
libguile/strings.c
libguile/vm.c
m4/gnulib-cache.m4
m4/gnulib-comp.m4
m4/inline.m4

14 years agoThanks, Mike.
Ludovic Courtès [Mon, 17 Aug 2009 21:06:49 +0000 (23:06 +0200)]
Thanks, Mike.

14 years agoUpdate `NEWS' for commit d8dd381fa781c236ae777ca1ac55b73d3ca91c2a.
Ludovic Courtès [Mon, 17 Aug 2009 21:05:50 +0000 (23:05 +0200)]
Update `NEWS' for commit d8dd381fa781c236ae777ca1ac55b73d3ca91c2a.

14 years agoBump version number for 1.9.2.
Ludovic Courtès [Sat, 15 Aug 2009 12:41:46 +0000 (14:41 +0200)]
Bump version number for 1.9.2.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.

14 years agoTurn off auto-compilation to stand-alone tests.
Ludovic Courtès [Sat, 15 Aug 2009 12:35:29 +0000 (14:35 +0200)]
Turn off auto-compilation to stand-alone tests.

* test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Add
  "GUILE_AUTO_COMPILE=0".