bpt/guile.git
12 years agostdlib.h, not malloc.h
Andy Wingo [Thu, 22 Dec 2011 14:54:24 +0000 (09:54 -0500)]
stdlib.h, not malloc.h

* configure.ac: Remove check for malloc.h.

* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/mallocs.c:
* libguile/smob.c: Use stdlib instead of malloc.h.

12 years agoMake the "Dia Primitives" section of the manual more clear.
Andy Wingo [Thu, 22 Dec 2011 14:32:09 +0000 (09:32 -0500)]
Make the "Dia Primitives" section of the manual more clear.

* doc/ref/libguile-program.texi (Dia Primitives): Use
  scm_assert_smob_type, and update the text.

12 years agoHTTP: Fix qstring writing of cache-extension values
Andy Wingo [Thu, 22 Dec 2011 13:18:05 +0000 (08:18 -0500)]
HTTP: Fix qstring writing of cache-extension values

* module/web/http.scm ("Cache-Control"): Write string values using the
  default val writer, to get quoting correct.

* test-suite/tests/web-http.test (pass-if-round-trip): New helper.
  ("general headers"): Check that cache-extensions round trip properly.

12 years agoExtend handling of "Cache-Control" header.
Daniel Hartwig [Sun, 27 Nov 2011 14:37:24 +0000 (22:37 +0800)]
Extend handling of "Cache-Control" header.

* module/web/http.scm ("Cache-Control"): Value for `max-stale' is
  optional.  Strict validation for value-less directives (`no-store',
  etc.).  String values optional for "cache-extension" directives.
* test-suite/tests/web-http.test: Value for `max-stale' is optional.

12 years agopeval fix: (cons 1 #nil) is not (list 1)
Andy Wingo [Thu, 22 Dec 2011 03:04:18 +0000 (22:04 -0500)]
peval fix: (cons 1 #nil) is not (list 1)

* module/language/tree-il/peval.scm (peval): (cons FOO #nil) is not
  (cons FOO '()).

* test-suite/tests/tree-il.test ("partial evaluation"): Add a test.

12 years agopeval minor tweak
Andy Wingo [Thu, 22 Dec 2011 01:15:57 +0000 (20:15 -0500)]
peval minor tweak

* module/language/tree-il/peval.scm (peval): Record residual values in
  both value and values contexts.  No test cases, it just seemed like a
  good idea.

12 years agodocument invalidity of (begin) as expression; add back-compat shim
Andy Wingo [Thu, 22 Dec 2011 01:10:42 +0000 (20:10 -0500)]
document invalidity of (begin) as expression; add back-compat shim

* doc/ref/api-control.texi (begin): Update to distinguish between
  splicing begin and sequencing begin.

* module/ice-9/psyntax.scm (expand-expr): Add a back-compatibility shim
  for `(begin)'.
* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syntax.test: Update to run illegal (begin) test only
  if we are not including deprecated features.

12 years agoftw: Include sub-directories in the result of `scandir'.
Ludovic Courtès [Mon, 19 Dec 2011 21:25:30 +0000 (22:25 +0100)]
ftw: Include sub-directories in the result of `scandir'.

* module/ice-9/ftw.scm (scandir)[skip]: Keep NAME in the resulting list.

* test-suite/tests/ftw.test ("scandir")["top-srcdir"]: New test.

12 years agofix scm_protects deprecation warning
Andy Wingo [Mon, 19 Dec 2011 14:55:07 +0000 (15:55 +0100)]
fix scm_protects deprecation warning

* libguile/gc.c: Fix warning about scm_protects being deprecated.

12 years agofix peval to preserve effects when folding (values) forms
Andy Wingo [Mon, 19 Dec 2011 14:51:54 +0000 (15:51 +0100)]
fix peval to preserve effects when folding (values) forms

* module/language/tree-il/peval.scm (singly-valued-expression?): New
  helper.
  (truncate-values): Use the helper.
  (make-operand): Minor refactor.
  (set-operand-residual-value!): Try to undo the effects of (values
  FOO), if the continuation will check itself for the correct number of
  values.
  (peval): Fold helpers into fold-constant.  Add a constant-expression?
  case for (values FOO).  Add a new context: "values", for contexts in
  which multiple values are allowed, either because of being in a tail
  context relative to a function, or because of let-values.  "value" is
  now for single values.  Don't visit operands for "values", as their
  binding form truncates to one value.  Add a case to fold (values ...)
  forms.  Fix folding of (lambda), to process the cases in values
  context instead of tail context (which could have been "value", which
  would cause the procedure to truncate).

12 years agoftw: Fix typos/thinkos in `file-system-fold' and `scandir'.
Ludovic Courtès [Mon, 19 Dec 2011 08:18:42 +0000 (09:18 +0100)]
ftw: Fix typos/thinkos in `file-system-fold' and `scandir'.

* module/ice-9/ftw.scm (file-system-fold): Fix reference to STAT instead
  of ST.
  (scandir)[enter?]: Change the argument name to `dir', to avoid
  confusion.
  [skip]: Return RESULT, not #f.

12 years agoftw: Clarify the behavior of `scandir' for flat files and unreadable dirs.
Ludovic Courtès [Mon, 19 Dec 2011 08:11:43 +0000 (09:11 +0100)]
ftw: Clarify the behavior of `scandir' for flat files and unreadable dirs.

* module/ice-9/ftw.scm (scandir)[leaf]: Only add NAME when RESULT is a
  pair.
  [down]: Ignore RESULT.
  Start with #f instead of the empty list.

* test-suite/tests/ftw.test ("scandir")["flat file"]: New test.

* doc/ref/misc-modules.texi (File Tree Walk): Update `scandir'
  documentation accordingly.

12 years agoAdd a deprecated alias for $expt
Christian Persch [Thu, 24 Nov 2011 22:10:21 +0000 (23:10 +0100)]
Add a deprecated alias for $expt

* module/ice-9/deprecated.scm: Add alias for $expt. $expt was removed
  in commit 6fc4d0124d633d1b3ddc5af82967f23bd17556f8 but no deprecated
  alias was added in ad79736c68a803a59814fbfc0cb4b092c2b4cddf like for
  all the other deprecated $sin, $cos, ... functions.

12 years agoFFI: Properly unpack small integer return values in closure call.
Andreas Schwab [Sat, 3 Dec 2011 11:17:46 +0000 (12:17 +0100)]
FFI: Properly unpack small integer return values in closure call.

Fixes <http://debbugs.gnu.org/10203>.

* libguile/foreign.c (unpack): Add parameter return_value_p.
  Properly store integer return values smaller than int.
  (scm_i_foreign_call): Update call to unpack.
  (invoke_closure): Likewise.

12 years agodoc: Add link from `opendir' to (ice-9 ftw).
Ludovic Courtès [Sun, 18 Dec 2011 20:27:56 +0000 (21:27 +0100)]
doc: Add link from `opendir' to (ice-9 ftw).

* doc/ref/posix.texi (File System): Add link to "File Tree Walk".

12 years agodoc: Use `@deffn {Scheme Procedure}' in `misc-modules.texi'.
Ludovic Courtès [Sun, 18 Dec 2011 20:25:24 +0000 (21:25 +0100)]
doc: Use `@deffn {Scheme Procedure}' in `misc-modules.texi'.

* doc/ref/misc-modules.texi: Use `@deffn {Scheme Procedure}' instead of
  `@defun'.

12 years agoftw: Add `scandir'.
Ludovic Courtès [Sun, 18 Dec 2011 20:14:33 +0000 (21:14 +0100)]
ftw: Add `scandir'.

Suggested by Nala Ginrut <nalaginrut@gmail.com>.

* module/ice-9/ftw.scm (scandir): New procedure.
* test-suite/tests/ftw.test ("scandir"): New test prefix.
* doc/ref/misc-modules.texi (File Tree Walk): Document `scandir'.

12 years agoftw: Add an optional `stat' parameter to `file-system-fold' and `-tree'.
Ludovic Courtès [Thu, 15 Dec 2011 22:32:24 +0000 (23:32 +0100)]
ftw: Add an optional `stat' parameter to `file-system-fold' and `-tree'.

* module/ice-9/ftw.scm (file-system-fold): Add an optional `stat'
  parameter.  Use it instead of `lstat'.  Handle the case where (STAT child)
  fails.
  (file-system-tree): Likewise, and pass it to `file-system-fold'.

* doc/ref/misc-modules.texi (File Tree Walk): Update the documentation
  of these functions.

12 years agoArrange to convert command-line arguments from the right encoding.
Ludovic Courtès [Thu, 15 Dec 2011 00:23:23 +0000 (01:23 +0100)]
Arrange to convert command-line arguments from the right encoding.

This is a temporary workaround for the 2.0 stable series.  The next
stable series should have an implicit `setlocale (LC_ALL, "")' call,
which will make this unnecessary.

* libguile/feature.c (progargs_fluid): Rename to...
  (scm_program_arguments_fluid): ... this.  Update users.

* libguile/feature.h (scm_program_arguments_fluid): New internal
  declaration.

* libguile/init.c (invoke_main_func): Call
  `scm_i_set_boot_program_arguments' instead of
  `scm_set_program_arguments'.

* libguile/script.c (locale_arguments_to_string_list,
  scm_i_set_boot_program_arguments): New functions.
  (scm_compile_shell_switches): Use `locale_arguments_to_string_list'.

* libguile/script.h (scm_i_set_boot_program_arguments): New internal
  declaration.

* test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add
  `test-command-line-encoding'.
* test-suite/standalone/test-command-line-encoding: New file.

12 years agoUse Gnulib's `localcharset', with local patches.
Ludovic Courtès [Thu, 15 Dec 2011 00:31:16 +0000 (01:31 +0100)]
Use Gnulib's `localcharset', with local patches.

This follows Bruno Haible's suggestion at
<http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00055.html>.

* m4/gnulib-cache.m4: Add `gl_LOCAL_DIR'; use `localcharset'.

* Makefile.am (EXTRA_DIST): Add gnulib-local/lib/localcharset.[ch].diff.
  (TESTS_ENVIRONMENT): New variable.

* gnulib-local/lib/localcharset.c.diff,
  gnulib-local/lib/localcharset.h.diff: New files.

* test-suite/Makefile.am (TESTS_ENVIRONMENT): Add
  @LOCALCHARSET_TESTS_ENVIRONMENT@.
* test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Likewise.

12 years agoAugment `.gitignore'.
Ludovic Courtès [Wed, 14 Dec 2011 22:33:24 +0000 (23:33 +0100)]
Augment `.gitignore'.

12 years agoUpdate Gnulib to v0.0-6703-g4e0358a.
Ludovic Courtès [Wed, 14 Dec 2011 22:02:29 +0000 (23:02 +0100)]
Update Gnulib to v0.0-6703-g4e0358a.

12 years agoUse `alignof_type' instead of `alignof'.
Ludovic Courtès [Wed, 14 Dec 2011 22:44:30 +0000 (23:44 +0100)]
Use `alignof_type' instead of `alignof'.

* libguile/foreign.c: Use `alignof_type' instead of `alignof'; the
  latter was removed from Gnulib's <alignof.h> in
  408e170e3ae81f73fb65686c5834693d89a96594 (Nov. 1 2011).
* libguile/vm-i-scheme.c: Likewise.

12 years agodoc: Set document encoding to UTF-8; typeset my surname correctly.
Ludovic Courtès [Wed, 14 Dec 2011 21:26:15 +0000 (22:26 +0100)]
doc: Set document encoding to UTF-8; typeset my surname correctly.

* doc/ref/guile.texi: Add @documentencoding.
* doc/ref/history.texi: Always write "Court@`es".
* doc/ref/preface.texi (Contributors): Likewise.

12 years agoAdd `file-system-fold' and `file-system-tree' to (ice-9 ftw).
Ludovic Courtès [Tue, 13 Dec 2011 22:54:26 +0000 (23:54 +0100)]
Add `file-system-fold' and `file-system-tree' to (ice-9 ftw).

* module/ice-9/ftw.scm (file-system-fold, file-system-tree): New
  procedures.

* test-suite/tests/ftw.test (%top-srcdir, %test-dir): New variables.
  ("file-system-fold", "file-system-tree"): New test prefixes.

* doc/ref/misc-modules.texi (File Tree Walk): Document
  `file-system-tree' and `file-system-fold'.

12 years agoadd an apropos-hook to ice-9 session
Andy Wingo [Mon, 12 Dec 2011 22:42:04 +0000 (23:42 +0100)]
add an apropos-hook to ice-9 session

* module/ice-9/session.scm: #:keyword-ify the define-module form, and
  export apropos-hook.
  (apropos-hook): New hook.
  (apropos, apropos-fold): Run the apropos-hook.

12 years agocurrent-input-port et al are srfi-39 parameters
Andy Wingo [Sat, 10 Dec 2011 19:04:27 +0000 (20:04 +0100)]
current-input-port et al are srfi-39 parameters

* libguile/ports.c (scm_init_ports): Export the port fluids to Scheme,
  temporarily.

* module/ice-9/boot-9.scm (fluid->parameter): Turn `current-input-port'
  et al into srfi-39 parameters, backed by the exported fluids, then
  remove the fluids from the guile module.
  (%cond-expand-features): Add srfi-39.

* module/srfi/srfi-39.scm: Re-export features from boot-9.

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

12 years agofix compilation with gc 7.1
Chris K. Jester-Young [Thu, 8 Dec 2011 20:13:30 +0000 (21:13 +0100)]
fix compilation with gc 7.1

* configure.ac: Add checks for GC_gcollect_and_unmap and
  GC_get_unmapped_bytes.
* libguile/gc-malloc.c (scm_realloc): GC_gcollect() if we don't have
  GC_gcollect_and_unmap.
* libguile/gc.c (GC_get_heap_usage_safe): Likewise, don't
  GC_get_unmapped_bytes if the function doesn't exist.

12 years agoAdd an exception printer for `getaddrinfo-error'.
Ludovic Courtès [Tue, 6 Dec 2011 20:43:12 +0000 (21:43 +0100)]
Add an exception printer for `getaddrinfo-error'.

* module/ice-9/boot-9.scm (getaddrinfo-error-printer): New procedure.
  Use it as the `getaddrinfo-error' exception printer.

12 years agopeval: Truncate multiple values when extending the environment.
Ludovic Courtès [Tue, 6 Dec 2011 20:36:49 +0000 (21:36 +0100)]
peval: Truncate multiple values when extending the environment.

Reported by Cédric Cellier <rixed@happyleptic.org>.

* module/language/tree-il/peval.scm (truncate-values): New procedure.
  (make-operand): Call `truncate-values' SOURCE.

* test-suite/tests/tree-il.test ("partial evaluation"): New tests for
  multiple value truncation.

12 years agoallow URIs of the form file:///etc/hosts
Andy Wingo [Tue, 6 Dec 2011 10:47:41 +0000 (11:47 +0100)]
allow URIs of the form file:///etc/hosts

* module/web/uri.scm (parse-authority): Allow empty authorities, so that
  we accept URIs of the form, file:///etc/hosts.
* test-suite/tests/web-uri.test ("string->uri"): Add tests.

12 years agoUpdate a comment in (web client)
Andy Wingo [Tue, 6 Dec 2011 10:46:58 +0000 (11:46 +0100)]
Update a comment in (web client)

* module/web/client.scm: Update a comment.

12 years agowarnings written to warning port
Andy Wingo [Mon, 5 Dec 2011 14:43:18 +0000 (15:43 +0100)]
warnings written to warning port

* libguile/deprecation.c (scm_c_issue_deprecation_warning):
* libguile/load.c (auto_compile_catch_handler):
  (scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path):
* module/ice-9/boot-9.scm (warn, %load-announce, duplicate-handlers)
  (load-in-vicinity):
* module/system/base/message.scm (warning): Write to the warning port.
  (*current-warning-port*): Alias the warning port.

12 years agoadd current-warning-port
Andy Wingo [Tue, 28 Jun 2011 21:24:43 +0000 (23:24 +0200)]
add current-warning-port

* libguile/ports.h:
* libguile/ports.c (scm_current_warning_port)
  (scm_set_current_warning_port): New functions, wrapping the Scheme
  parameter.

* module/ice-9/boot-9.scm (current-warning-port): New parameter,
  defining a port for warnings.

12 years agosetting a parameter returns the previous value
Andy Wingo [Mon, 5 Dec 2011 15:37:17 +0000 (16:37 +0100)]
setting a parameter returns the previous value

* module/ice-9/boot-9.scm (make-parameter): Setting a parameter by
  invoking it with an argument now returns the previous value.

12 years agoadd srfi-39 parameters to boot-9
Andy Wingo [Mon, 5 Dec 2011 13:20:09 +0000 (14:20 +0100)]
add srfi-39 parameters to boot-9

* module/ice-9/boot-9.scm (<parameter>, make-parameter, parameter?)
  (parameter-fluid, parameter-converter, parameterize): New top-level
  bindings, implementing SRFI-39 parameters.  Currently,
  current-input-port and similar procedures are not yet parameters.

* test-suite/Makefile.am:
* test-suite/tests/parameters.test: Add tests, taken from srfi-39
  tests.

12 years agoice-9/poll: verify sizeof(struct pollfd)
Andy Wingo [Sun, 4 Dec 2011 21:45:03 +0000 (22:45 +0100)]
ice-9/poll: verify sizeof(struct pollfd)

* libguile/poll.c (scm_init_poll): Define %sizeof-struct-pollfd.
* module/ice-9/poll.scm: Check %sizeof-struct-pollfd.

12 years agonew print option escape-newlines, defaults to #t
Andy Wingo [Sun, 4 Dec 2011 21:37:27 +0000 (22:37 +0100)]
new print option escape-newlines, defaults to #t

* libguile/private-options.h (SCM_PRINT_ESCAPE_NEWLINES_P):
* libguile/print.c: Add new escape-newlines print option, defaulting to
  on.
  (write_character): For newlines, if SCM_PRINT_ESCAPE_NEWLINES_P, then
  print them as \n.
  (scm_init_print): Refactor print options initialization.

12 years ago,language at REPL sets current-language
Andy Wingo [Sun, 4 Dec 2011 20:56:13 +0000 (21:56 +0100)]
,language at REPL sets current-language

* module/system/repl/command.scm (language): Set the
  *current-language*.
* module/system/repl/repl.scm (start-repl): Create a new dynamic scope
  for *current-language*.

12 years agofix `free' of mpz_to_str
Andy Wingo [Fri, 2 Dec 2011 18:18:05 +0000 (19:18 +0100)]
fix `free' of mpz_to_str

* libguile/numbers.c (scm_number_to_string): Don't `free' the result of
  mpz_get_str; use the mp free function.

12 years agoscm_gc_register_collectable_memory calls scm_gc_register_allocation
Andy Wingo [Fri, 2 Dec 2011 18:07:21 +0000 (19:07 +0100)]
scm_gc_register_collectable_memory calls scm_gc_register_allocation

* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Call
  scm_gc_register_allocation.

12 years agoinstall gmp memory functions that let libgc know about allocations
Andy Wingo [Fri, 2 Dec 2011 10:22:46 +0000 (11:22 +0100)]
install gmp memory functions that let libgc know about allocations

* libguile/numbers.c (custom_gmp_malloc, custom_gmp_realloc,
  custom_gmp_free): New static functions used by GMP for allocation.
  These are just wrappers for scm_malloc, scm_realloc, and free.

  (scm_init_numbers): If scm_install_gmp_memory_functions is nonzero,
  use mp_set_memory_functions to configure GMP to use
  custom_gmp_{malloc,realloc,free} for memory allocation.

  (scm_bigprint): Ask gmp for the function used to deallocate the string
  returned by mpz_get_str.

* libguile/numbers.h: Declare scm_install_gmp_memory_functions.

* libguile/guile.c: When running the Guile binary, install the
  gmp_memory_functions.

Based on a patch by Mark H Weaver <mhw@netris.org>.

12 years agofix deadlock in before-gc-hook on certain 7.2alpha gc versions
Andy Wingo [Thu, 1 Dec 2011 11:57:49 +0000 (12:57 +0100)]
fix deadlock in before-gc-hook on certain 7.2alpha gc versions

* libguile/gc.c (scm_init_gc): Only adjust gc frequency in the gc start
  hook if we know that it won't take a lock.

12 years agoattempt to handle steady-state mallocations better
Andy Wingo [Tue, 29 Nov 2011 20:36:31 +0000 (21:36 +0100)]
attempt to handle steady-state mallocations better

* libguile/gc-malloc.c (scm_realloc): Call the new
  scm_gc_register_allocation() here.  If we have to collect, do a
  GC_gcollect_and_unmap.

* libguile/gc.c (scm_gc_register_allocation): Add a routine to track
  steady-state mallocation, and cause gc to run if there is a high
  mallocation rate.
  (adjust_gc_frequency): Reset the bytes-until-GC countdown timer.

12 years agocollect a little in call-with-new-thread
Andy Wingo [Tue, 29 Nov 2011 19:26:40 +0000 (20:26 +0100)]
collect a little in call-with-new-thread

* libguile/threads.c (scm_call_with_new_thread): Collect a little before
  making a new thread.  Our adjust_gc_frequency hack doesn't work well
  if the main allocation load is thread creation, as in
  https://savannah.gnu.org/bugs/?34140.  This does not appreciably
  affect the speed of the test in that bug, but does effectively limit
  the image size.

12 years agoadjust_gc_frequency before gc, for more precision
Andy Wingo [Tue, 29 Nov 2011 19:24:23 +0000 (20:24 +0100)]
adjust_gc_frequency before gc, for more precision

* libguile/gc.c (scm_init_gc): Run the adjust_gc_frequency from the
  before-gc-hook, not the after-gc-hook.  More precise, this way.

12 years agofix uninitialized variable in gc.c
Andy Wingo [Tue, 29 Nov 2011 12:43:52 +0000 (13:43 +0100)]
fix uninitialized variable in gc.c

* libguile/gc.c (get_image_size): Fix use of uninitialized variable.

12 years agoswitch off debugging flag that was mistakenly left on
Andy Wingo [Tue, 29 Nov 2011 09:17:07 +0000 (10:17 +0100)]
switch off debugging flag that was mistakenly left on

* libguile/gc.c (HEURISTICS_DEBUG): Whoops, switch this off.

12 years agoincrease garbage collection rate if the process is growing
Andy Wingo [Mon, 28 Nov 2011 23:48:56 +0000 (00:48 +0100)]
increase garbage collection rate if the process is growing

* configure.ac: Check for GC_get_free_space_divisor.
* libguile/gc.c (GC_get_free_space_divisor): Define an implementation,
  if needed.
  (accumulate_gc_timer): Fix indentation.
  (get_image_size): New terrible hack.  Needs implementations on other
  platforms.
  (adjust_gc_frequency): Attempt to adjust the GC frequency based on
  process image growth.  Needs more comments.
  (scm_init_gc): Add the adjust_gc_frequency to the after_gc_c_hook.

12 years agoget heap stats with GC_get_heap_usage_safe, if available.
Andy Wingo [Mon, 28 Nov 2011 18:58:53 +0000 (19:58 +0100)]
get heap stats with GC_get_heap_usage_safe, if available.

* configure.ac: Check for GC_get_heap_usage_safe.
* libguile/gc.c (SCM_DEFINE): Use GC_get_heap_usage_safe.

12 years agoFFI: Hold a weak reference to the procedure passed to `procedure->pointer'.
Ludovic Courtès [Sat, 26 Nov 2011 21:27:32 +0000 (22:27 +0100)]
FFI: Hold a weak reference to the procedure passed to `procedure->pointer'.

* libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference
  to PROC.

* test-suite/tests/foreign.test ("procedure->pointer")["procedure is
  retained"]: New test.

12 years agoweb-http.test validates headers
Daniel Hartwig [Wed, 23 Nov 2011 19:56:30 +0000 (20:56 +0100)]
web-http.test validates headers

* test-suite/tests/web-http.test (pass-if-parse): Validate header values
  as well.

12 years agofix validators for various list-style headers
Daniel Hartwig [Wed, 23 Nov 2011 19:56:10 +0000 (20:56 +0100)]
fix validators for various list-style headers

* module/web/http.scm (default-val-validator): Valid with no value.
  (key-value-list?): Keys are always symbols, do not accept strings.
  (validate-param-list): Apply `valid?' to list elements.
  (validate-credentials): Validate param for Basic scheme, which
  is parsed as a string.
  (declare-symbol-list-header!): `list-of?' args were in wrong order.
  ("Cache-Control"): Replace `default-val-validator' with more
  specific procedure.
  ("Accept"): Validate on first param which has no value.

12 years agoUpdate cross-compilation instructions.
Ludovic Courtès [Wed, 23 Nov 2011 21:19:40 +0000 (22:19 +0100)]
Update cross-compilation instructions.

* README (Cross building Guile): Update.

12 years agoconfigure: Make sure $GUILE_FOR_BUILD is suitable.
Ludovic Courtès [Wed, 23 Nov 2011 21:05:53 +0000 (22:05 +0100)]
configure: Make sure $GUILE_FOR_BUILD is suitable.

* acinclude.m4 (GUILE_CHECK_VERSION, GUILE_CHECK_GUILE_FOR_BUILD): New
  macros.

* configure.ac: Remove $GUILE_FOR_BUILD tests.  Use
  `GUILE_CHECK_GUILE_FOR_BUILD'.

12 years agoAllow $GUILE_FOR_BUILD to use its own environment when cross-compiling.
Ludovic Courtès [Wed, 23 Nov 2011 14:29:18 +0000 (15:29 +0100)]
Allow $GUILE_FOR_BUILD to use its own environment when cross-compiling.

* am/guilec (.scm.go): Use `-L' to specify the search path.
* module/Makefile.am (ice-9/psyntax-pp.go): Likewise.

* meta/uninstalled-env.in (top_builddir): Leave $GUILE_LOAD_PATH,
  $GUILE_SYSTEM_PATH, and $GUILE_SYSTEM_EXTENSIONS_PATH unchanged when
  cross-compiling.

12 years agoUse default value for make-fluid in Scheme files
Andy Wingo [Wed, 23 Nov 2011 11:40:33 +0000 (12:40 +0100)]
Use default value for make-fluid in Scheme files

* module/ice-9/boot-9.scm (%exception-handler)
  (%running-exception-handlers, read-eval?, *repl-stack*)
  (make-mutable-parameter):
* module/ice-9/getopt-long.scm (%program-name):
* module/language/elisp/runtime.scm (built-in-macro, defspecial):
* module/srfi/srfi-39.scm (make-parameter/helper):
* module/system/base/language.scm (*current-language*):
* module/system/base/message.scm (*current-warning-port*):
  (*current-warning-prefix*):
* module/system/base/target.scm (%target-type, %target-endianness)
  (%target-word-size):
* module/texinfo/plain-text.scm (*indent*, *itemizer*):
* benchmark-suite/lib.scm (prefix-fluid):
* test-suite/lib.scm (prefix-fluid): Give fluids a useful default
  value.

12 years agouse new scm_make_fluid_with_default
Andy Wingo [Wed, 23 Nov 2011 11:21:22 +0000 (12:21 +0100)]
use new scm_make_fluid_with_default

* libguile/load.c (scm_init_load):
* libguile/ports.c (scm_init_ports):
* libguile/read.c (scm_init_read): Use scm_make_fluid_with_default.

12 years agooptional default-value arg to make-fluid
Andy Wingo [Wed, 23 Nov 2011 11:13:12 +0000 (12:13 +0100)]
optional default-value arg to make-fluid

* libguile/fluids.c (grow_dynamic_state, new_fluid): Arrange for the
  default value in the dynamic-state vector to be SCM_UNDEFINED instead
  of SCM_BOOL_F.  If the value in the dynamic-state is #f, default to a
  value attached to the fluid instead.  This allows useful default
  values.
  (scm_make_fluid_with_default): New function, allows the user to
  specify a default value for the fluid.  Defaults to #f.  Bound to
  `make-fluid' on the Scheme side.
  (scm_make_unbound_fluid): Use SCM_UNDEFINED as the default in all
  threads.
  (scm_fluid_unset_x): Also unset the default value.  Not sure if this
  is the right thing.
  (fluid_ref): Update to the new default-value strategy.

* libguile/threads.c (scm_i_reset_fluid): Reset to SCM_UNDEFINED.
* libguile/threads.h: Remove extra arg to scm_i_reset_fluid.
* libguile/vm-i-system.c (fluid-ref): Update to new default-value
  strategy.

* module/ice-9/vlist.scm (block-growth-factor): Default to 2 in all
  threads.  Fixes http://debbugs.gnu.org/10093.

12 years agoLeave $GUILE_LOAD_COMPILED_PATH unchanged when cross-compiling.
Ludovic Courtès [Tue, 22 Nov 2011 09:09:27 +0000 (10:09 +0100)]
Leave $GUILE_LOAD_COMPILED_PATH unchanged when cross-compiling.

* meta/uninstalled-env.in: Don't define $GUILE_LOAD_COMPILED_PATH when
  cross-compiling.

12 years agoBuild `psyntax-pp.go' with `--target=$(host)'.
Ludovic Courtès [Tue, 22 Nov 2011 08:07:25 +0000 (09:07 +0100)]
Build `psyntax-pp.go' with `--target=$(host)'.

* module/Makefile.am (ice-9/psyntax-pp.go): Pass `--target=$(host)'.

12 years agoRun `guild compile' with `--target=$(host)'.
Ludovic Courtès [Mon, 21 Nov 2011 23:21:39 +0000 (00:21 +0100)]
Run `guild compile' with `--target=$(host)'.

* am/guilec (.scm.go): Run `guild compile' with `--target=$(host)'.

12 years agoAdd a `--target' option to `guild compile'.
Ludovic Courtès [Mon, 21 Nov 2011 23:19:03 +0000 (00:19 +0100)]
Add a `--target' option to `guild compile'.

* module/scripts/compile.scm (%options)["--target"]: New option.
  (show-version): Update copyright year.
  (compile): Use `with-target' to install the target.

* doc/ref/api-evaluation.texi (Compilation): Mention `--target' option.

12 years agoAdd missing implicit `SCM_API' for `scm_c_make_objcode_slice'.
Ludovic Courtès [Mon, 21 Nov 2011 23:09:22 +0000 (00:09 +0100)]
Add missing implicit `SCM_API' for `scm_c_make_objcode_slice'.

* libguile/objcodes.h (scm_c_make_objcode_slice): Add implicit `SCM_API'.

12 years agoComplete cross-compilation support.
Ludovic Courtès [Mon, 21 Nov 2011 21:08:22 +0000 (22:08 +0100)]
Complete cross-compilation support.

* module/system/base/target.scm (%target-endianness, %target-word-size):
  New fluids.
  (%native-word-size): New variable.
  (with-target): Set these fluids.
  (cpu-endianness, cpu-word-size, triplet-cpu, triplet-vendor,
  triplet-os): New procedures.
  (target-cpu, target-vendor, target-os): Use them.
  (target-endianness, target-word-size): Refer to the corresponding
  fluid.

* libguile/objcodes.c (target_endianness_var, target_word_size_var): New
  global variables.
  (NATIVE_ENDIANNESS): New macro.
  (target_endianness, target_word_size, to_native_order): New functions.
  (make_objcode_from_file): Use `scm_bytecode_to_native_objcode' instead
  of `scm_bytecode_to_objcode'.
  (bytecode_to_objcode): New function, based on `scm_bytecode_to_objcode',
  with the addition of an `endianness' and `word_size' parameters.
  (scm_bytecode_to_objcode): Use it.
  (scm_bytecode_to_native_objcode): New function.
  (scm_write_objcode): Use `target_word_size' and `target_endianness'.
  Convert OBJCODE's len and meta-len to native byte order.
  (scm_init_objcodes): Initialize `target_endianness_var' and
  `target_word_size_var'.

* libguile/objcodes.h (scm_bytecode_to_native_objcode): New declaration.

* libguile/vm.c (really_make_boot_program): Use
  `scm_bytecode_to_native_objcode' instead of `scm_bytecode_to_objcode'.

* test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size): New
  variable.
  (test-target): New procedure.
  ("cross-compilation"): Add `test-target' calls and the "unknown
  target" test.

12 years agoFix `validate-target' in (system base target).
Ludovic Courtès [Mon, 21 Nov 2011 20:55:13 +0000 (21:55 +0100)]
Fix `validate-target' in (system base target).

* module/system/base/target.scm (validate-target): Accept any tuple with
  at least 3 parts.

* test-suite/tests/asm-to-bytecode.test (test-triplet): New procedure.
  ("cross-compilation"): New test prefix.

12 years agodeprecate direct scm_protects access
Andy Wingo [Fri, 18 Nov 2011 10:09:48 +0000 (11:09 +0100)]
deprecate direct scm_protects access

* libguile/gc.h:
* libguile/gc.c: Deprecate direct access to scm_protects.

12 years agoAllow overlapping regions to be passed to `bytevector-copy!'.
Ludovic Courtès [Sun, 20 Nov 2011 00:10:58 +0000 (01:10 +0100)]
Allow overlapping regions to be passed to `bytevector-copy!'.

Reported by Dmitry Chestnykh <dmitry@codingrobots.com>.
Fixes <http://debbugs.gnu.org/10070>.

* libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not
  `memcpy'.

* test-suite/tests/bytevectors.test ("2.2 General
  Operations")["bytevector-copy! overlapping"]: New test.

* doc/ref/api-data.texi (Bytevector Manipulation): Mention possible
  overlapping.

12 years agoeval.test work
Andy Wingo [Thu, 17 Nov 2011 09:52:06 +0000 (10:52 +0100)]
eval.test work

* test-suite/tests/eval.test ("stacks"): Enable another test, fix to use
  with-throw-handler, and remove a duplicate test, now that there is no
  difference between subrs and gsubrs.

12 years agoFFI: Hold a weak reference to the CIF made by `procedure->pointer'.
Ludovic Courtès [Wed, 16 Nov 2011 22:53:58 +0000 (23:53 +0100)]
FFI: Hold a weak reference to the CIF made by `procedure->pointer'.

* libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference
  to CIF so that it is not reclaimed before POINTER.  Before that it
  could be reclaimed and typically reused to store the CIF of another
  procedure with the same arity, leading to obscure wrong-type-arg
  errors.

12 years agoFFI: Add a `procedure->pointer' test.
Ludovic Courtès [Wed, 16 Nov 2011 22:51:34 +0000 (23:51 +0100)]
FFI: Add a `procedure->pointer' test.

* test-suite/tests/foreign.test ("procedure->pointer")["procedures
  returning a pointer"]: New test.

12 years agofix urls in docs
Andy Wingo [Wed, 16 Nov 2011 22:21:59 +0000 (23:21 +0100)]
fix urls in docs

* doc/ref/intro.texi (Introduction):
* doc/ref/scheme-reading.texi (Further Reading):
* doc/ref/srfi-modules.texi (SRFI Support): Fix some urls.  Thanks to
  Henrik Sandklef for the report.

12 years agofix web.texi typo
Andy Wingo [Wed, 16 Nov 2011 22:17:51 +0000 (23:17 +0100)]
fix web.texi typo

* doc/ref/web.texi (HTTP Headers): Fix a typo.  Thanks to Brian Gough
  for the report.

12 years agohack the port-column of current-output-port after printing a prompt
Andy Wingo [Wed, 16 Nov 2011 22:13:55 +0000 (23:13 +0100)]
hack the port-column of current-output-port after printing a prompt

* module/ice-9/boot-9.scm (repl-reader): Reset the output-column to 0
  after printing the prompt.  Fixes bug 9664.

12 years agoeval-when tidying up
Andy Wingo [Wed, 16 Nov 2011 19:15:26 +0000 (20:15 +0100)]
eval-when tidying up

* module/ice-9/psyntax.scm: Rename expand-when-list to parse-when-list,
  and simplify to compare literal values.
* module/ice-9/psyntax-pp.scm: Regenerate.

12 years agopsyntax: s/chi/expand/g
Andy Wingo [Wed, 16 Nov 2011 19:08:40 +0000 (20:08 +0100)]
psyntax: s/chi/expand/g

* module/ice-9/psyntax.scm: Rename all instances of "chi" to "expand".
  Addded a hack to expand-eval-when that will be fixed later.
* module/ice-9/psyntax-pp.scm: Regenerated.

12 years agofix bug in make-repl when lang is actually a language
Andy Wingo [Wed, 16 Nov 2011 18:44:04 +0000 (19:44 +0100)]
fix bug in make-repl when lang is actually a language

* module/system/repl/common.scm (make-repl): Fix to accept language
  objects in addition to symbols.  Fixes http://debbugs.gnu.org/9857.
  Thanks to Tristan Colgate for the report.

12 years agoRe-enable a couple of evaluator tests.
Ludovic Courtès [Wed, 16 Nov 2011 14:11:55 +0000 (15:11 +0100)]
Re-enable a couple of evaluator tests.

These tests had been disabled as part of
b7742c6b7132544b9d6cd9cb32c09e2084ad9e52 ("new evaluator, y'all").

* test-suite/tests/eval.test ("define set procedure-name")["closure"]:
  Change to `pass-if' since it now works, as a result of
  ee15aa46e3fb29e609bd7c431e8f2676f6573d57 ("set names of functions
  defined at the toplevel from `eval'").
  ("stacks")["arguments of a gsubr stack frame"]: Remove (throw
  'unresolved).

12 years agomemoize: booleanify the rest arg
Andy Wingo [Wed, 16 Nov 2011 12:33:52 +0000 (13:33 +0100)]
memoize: booleanify the rest arg

* libguile/memoize.c (memoize): Turn the rest arg into a boolean.  Fixes
  an error when rest gets passed to set-procedure-minimum-arity!.

12 years agoset names of functions defined at the toplevel from `eval'
Andy Wingo [Tue, 15 Nov 2011 22:38:40 +0000 (23:38 +0100)]
set names of functions defined at the toplevel from `eval'

* module/ice-9/eval.scm (primitive-eval): Set the name of
  toplevel-defined functions.

12 years agobetter debuggability for interpreted procedures
Andy Wingo [Tue, 15 Nov 2011 22:36:07 +0000 (23:36 +0100)]
better debuggability for interpreted procedures

* libguile/procprop.c (scm_set_procedure_minimum_arity_x): New
  function, allows a user to override a function's arity.
  (scm_i_procedure_arity): Look up in the overrides table first.

* libguile/procprop.h: Add scm_set_procedure_minimum_arity_x.

* module/ice-9/eval.scm (primitive-eval): Override arity of "general
  closures".

* test-suite/tests/procprop.test ("procedure-arity"): Add tests.

Based on a patch from Stefan Israelsson Tampe.  Test based on work by
Patrick Bernaud.

12 years agoupdate letrec compilation test
Andy Wingo [Fri, 11 Nov 2011 15:39:28 +0000 (16:39 +0100)]
update letrec compilation test

* test-suite/tests/tree-il.test ("letrec"): Update to clear the
  temporary `let' bindings.

12 years agofix bit-set*! bug (!)
Andy Wingo [Thu, 10 Nov 2011 21:30:02 +0000 (22:30 +0100)]
fix bit-set*! bug (!)

* libguile/bitvectors.c (scm_bit_set_star_x): Fix a long-standing (since
  2005) bug in which instead of using the kv bitvector, we actually use
  the `v' bitvector.  Also, change to allow `kv' being shorter than
  `v'.

* test-suite/tests/bitvectors.test ("bit-set*!"): Add tests.

12 years agowhen leaving a non-tail let, allow bound vals to be collected
Andy Wingo [Wed, 9 Nov 2011 22:45:53 +0000 (23:45 +0100)]
when leaving a non-tail let, allow bound vals to be collected

* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Clear
  lexical stack slots at the end of a non-tail let, letrec, or fix.
  Fixes http://debbugs.gnu.org/9900.

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

12 years agosimplify primitives.scm for dynwind
Andy Wingo [Wed, 9 Nov 2011 15:44:59 +0000 (16:44 +0100)]
simplify primitives.scm for dynwind

* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Remove a dynwind hack, as we have a good inliner now.

12 years agopeval: fix dynwind bug.
Andy Wingo [Wed, 9 Nov 2011 14:23:58 +0000 (15:23 +0100)]
peval: fix dynwind bug.

* module/language/tree-il/peval.scm (peval): The <dynwind> compiler will
  copy the winder and unwinder values, so make sure that they are
  constant, and if not, create lexical bindings.  Fixes
  http://debbugs.gnu.org/9844.

* test-suite/tests/tree-il.test ("partial evaluation"): Add a couple
  <dynwind> tests.

12 years agofix <dynwind> serialization.
Andy Wingo [Wed, 9 Nov 2011 15:41:56 +0000 (16:41 +0100)]
fix <dynwind> serialization.

* module/language/tree-il.scm (unparse-tree-il): Fix <dynwind>
  serialization.

12 years agopeval: don't copy assigned lexical bindings
Andy Wingo [Wed, 9 Nov 2011 14:22:01 +0000 (15:22 +0100)]
peval: don't copy assigned lexical bindings

* module/language/tree-il/peval.scm (peval): Since constant-expression?
  is used to determine whether to copy values, return #f if any lexical
  is assigned.

12 years agoFix R6RS `fold-left' so the accumulator is the first argument.
Ian Price [Wed, 26 Oct 2011 19:24:05 +0000 (20:24 +0100)]
Fix R6RS `fold-left' so the accumulator is the first argument.

* module/rnrs/lists.scm (fold-left): New procedure.

* module/rnrs/records/syntactic.scm (define-record-type): Fix to use
  corrected `fold-left'.

* test-suite/tests/r6rs-lists.test: Add tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
12 years agoUpdate `NEWS'.
Ludovic Courtès [Sat, 22 Oct 2011 14:53:43 +0000 (16:53 +0200)]
Update `NEWS'.

12 years agoFix compilation of `deprecated.c' with SCM_DEBUG_TYPING_STRICTNESS=2.
Ludovic Courtès [Sat, 22 Oct 2011 14:48:46 +0000 (16:48 +0200)]
Fix compilation of `deprecated.c' with SCM_DEBUG_TYPING_STRICTNESS=2.

* libguile/deprecated.c (init_module_stuff,
  scm_primitive_make_property): Use `scm_is_false' instead of direct
  comparison to SCM_BOOL_F'.
  (maybe_close_port, scm_close_all_ports_except): Use `SCM2PTR' and
  `PTR2SCM' instead of wild casts.

12 years agoBump version number for 2.0.3.
Ludovic Courtès [Sat, 22 Oct 2011 14:29:20 +0000 (16:29 +0200)]
Bump version number for 2.0.3.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions
  `scm_is_exact' etc.
  (LIBGUILE_INTERFACE_AGE): Increment.

12 years agoUpdate Gnulib to v0.0-6523-gb3609c1.
Ludovic Courtès [Sat, 22 Oct 2011 14:24:32 +0000 (16:24 +0200)]
Update Gnulib to v0.0-6523-gb3609c1.

12 years agodoc: Document the `sitedir' and `extensiondir' pkg-config variables.
Ludovic Courtès [Sat, 22 Oct 2011 14:11:01 +0000 (16:11 +0200)]
doc: Document the `sitedir' and `extensiondir' pkg-config variables.

* doc/ref/libguile-parallel.texi (Parallel Installations): Document the
  `sitedir' and `extensiondir' pkg-config variables.  This fixes
  <https://savannah.gnu.org/bugs/index.php?32515>, reported by
  Dale. P. Smith.

12 years agoFix compilation with `--enable-debug-malloc'.
Bake Timmons [Sat, 22 Oct 2011 11:28:53 +0000 (13:28 +0200)]
Fix compilation with `--enable-debug-malloc'.

* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Add the
  missing second argument in the call to scm_malloc_register.

12 years agoInitialize `get_internal_run_time' before it is used.
Ludovic Courtès [Sat, 22 Oct 2011 11:25:11 +0000 (13:25 +0200)]
Initialize `get_internal_run_time' before it is used.

* libguile/init.c (scm_i_init_guile): Call `scm_init_stime' before
  `scm_init_gc'.  Fixes <https://savannah.gnu.org/bugs/?34616> reported
  by Bake Timmons.

12 years agoset width for `,trace' command
BT Templeton [Fri, 22 Jul 2011 15:35:30 +0000 (11:35 -0400)]
set width for `,trace' command

* module/system/repl/command.scm (trace): Set trace width to terminal
  width by default.

12 years agofix segfault in goops if class fields are redefined
Andy Wingo [Thu, 20 Oct 2011 22:22:44 +0000 (00:22 +0200)]
fix segfault in goops if class fields are redefined

* libguile/goops.c (map, filter_cpl, remove_duplicate_slots): Use
  scm_is_pair instead of !scm_is_null, given that we use accessor
  macros.
  (check_cpl, build_slots_list): Check that descendents of <class> can't
  redefine slots of <class>.

* test-suite/tests/goops.test ("defining classes"): Add a test.

Patch originally by Stefan Israelsson Tampe.

12 years agofix misallocation of some <fix> procedures
Andy Wingo [Thu, 20 Oct 2011 21:50:05 +0000 (23:50 +0200)]
fix misallocation of some <fix> procedures

* module/language/tree-il/analyze.scm (analyze-lexicals): When stepping
  into a non-tail form, we know that labels allocation will be invalid,
  so use an empty labels set.  Fixes http://debbugs.gnu.org/9769.

* test-suite/tests/tree-il.test ("labels allocation"): Add a test.

12 years agoslight frames.h refactor
Andy Wingo [Wed, 19 Oct 2011 09:55:27 +0000 (11:55 +0200)]
slight frames.h refactor

* libguile/frames.h: Instead of doing a lot of nasty pointer match and
  casts here, simply define a struct that aliases the contents of a
  stack frame.  There are some naming issues here, that the SCM_FRAME
  macros access the scm_vm_frame structure, but SCM_VM_FRAME macros
  access scm_frame; oh well.