bpt/guile.git
13 years agoadd scm_frame_address / frame-address
Andy Wingo [Thu, 23 Sep 2010 11:19:49 +0000 (13:19 +0200)]
add scm_frame_address / frame-address

* libguile/frames.h:
* libguile/frames.c (scm_frame_address): New accessor, returns a frame's
  fp.

13 years agotracing in terms of traps
Andy Wingo [Thu, 23 Sep 2010 09:56:21 +0000 (11:56 +0200)]
tracing in terms of traps

* module/system/vm/traps.scm (trap-frame-finish)
  (trap-in-dynamic-extent, trap-calls-in-dynamic-extent)
  (trap-instructions-in-dynamic-extent): New traps, for implementing
  tracing, and the `finish' command.

* module/system/vm/trace.scm (trace-calls-in-procedure)
  (trace-instructions-in-procedure): New tracing traps.
  (vm-trace): Reimplement in terms of the new traps.

* module/system/vm/trap-state.scm (add-trap!): New helper; not used in
  this commit, though.

13 years agoExplain examples of user-defined classes
Neil Jerram [Wed, 22 Sep 2010 00:27:31 +0000 (01:27 +0100)]
Explain examples of user-defined classes

* doc/ref/goops.texi (User-defined classes): New text added to explain
  the example code.

13 years agoExplain built-in classes like <string>
Neil Jerram [Tue, 21 Sep 2010 23:52:30 +0000 (00:52 +0100)]
Explain built-in classes like <string>

* doc/ref/goops.texi (Built-in classes): New node.
  (User-defined classes): Show is-a? v and class-of v here, instead of
  in next node.
  (Asking for the class of an object): Deleted, no longer needed.

13 years agoImprove GOOPS `Quick Start' doc
Neil Jerram [Tue, 21 Sep 2010 23:20:38 +0000 (00:20 +0100)]
Improve GOOPS `Quick Start' doc

* doc/ref/goops.texi (Quick Start): Remove words that only reiterate
  "quick start".

* doc/ref/goops.texi (Methods, User-defined classes, Asking for the
  class of an object): Say "class" instead of "type".  They
  are called classes elsewhere, and in an object-oriented system, people
  expect classes!

13 years agoMove GOOPS chapter's Stk copyright notice upfront
Neil Jerram [Tue, 21 Sep 2010 23:15:25 +0000 (00:15 +0100)]
Move GOOPS chapter's Stk copyright notice upfront

So as to enable more free refactoring of the rest of the chapter

* doc/ref/goops.texi (Copyright Notice): New section containing the
  Stk copyright.

* doc/ref/goops-tutorial.texi (Copyright): Equivalent section here
  deleted.

13 years agoGOOPS doc simplification
Neil Jerram [Sun, 12 Sep 2010 20:07:55 +0000 (21:07 +0100)]
GOOPS doc simplification

* doc/ref/goops.texi (GOOPS): Simplify the introductory blurb.

13 years ago(system repl command) cleanups
Andy Wingo [Tue, 21 Sep 2010 19:48:09 +0000 (21:48 +0200)]
(system repl command) cleanups

* module/system/repl/command.scm (profile, trace, inspect)
  (pretty-print): Use repl-prepare-eval-thunk instead of the lower-level
  compile and make-program.

13 years agobreakpoints from recursive prompts work
Andy Wingo [Tue, 21 Sep 2010 19:37:11 +0000 (21:37 +0200)]
breakpoints from recursive prompts work

* module/system/vm/traps.scm (new-disabled-trap): Don't manipulate the
  VM trace level in the enable and disable handlers. Unfortunately, this
  makes traps not work unless you enable hooks, but given that
  vm_dispatch_hook has to set trace-level to 0, there needs to be an
  object with a broader view of what traps are enabled. That object is
  the hook state.

* module/system/vm/trap-state.scm (trap-state->trace-level): New
  procedure.
  (with-default-trap-handler): Add an optional trap-state argument. Now
  makes sure that the vm-trace-level is set appropriately during the
  execution of the thunk, allowing for breakpoints from recursive
  prompts.

13 years agoSRFI-1: Rewrite `alist-copy' in Scheme.
Ludovic Courtès [Sun, 19 Sep 2010 22:00:44 +0000 (00:00 +0200)]
SRFI-1: Rewrite `alist-copy' in Scheme.

This partially reverts commit b1fff4e793619b20342cba0015b9367680d3a0bd
(Sat Apr 2 2005).

* libguile/srfi-1.c (scm_srfi1_alist_copy): Remove.
* libguile/srfi-1.h (scm_srfi1_alist_copy): Remove declaration.

* module/srfi/srfi-1.scm (alist-copy): New procedure.

13 years agoRemove the SRFI-1 C proxies.
Ludovic Courtès [Sun, 19 Sep 2010 21:41:17 +0000 (23:41 +0200)]
Remove the SRFI-1 C proxies.

* libguile/srfi-1.c (srfi1_module, CACHE_VAR): Remove.
  (scm_srfi1_break, scm_srfi1_break_x, scm_srfi1_car_plus_cdr,
  scm_srfi1_drop_right_x, scm_srfi1_drop_while, scm_srfi1_eighth,
  scm_srfi1_fifth, scm_srfi1_fold, scm_srfi1_last, scm_srfi1_list_index,
  scm_srfi1_list_tabulate, scm_srfi1_lset_adjoin, scm_srfi1_ninth,
  scm_srfi1_not_pair_p, scm_srfi1_reduce, scm_srfi1_reduce_right,
  scm_srfi1_seventh, scm_srfi1_sixth, scm_srfi1_span, scm_srfi1_span_x,
  scm_srfi1_take_x, scm_srfi1_take_while, scm_srfi1_take_while_x,
  scm_srfi1_tenth, scm_srfi1_xcons): Remove.

* libguile/srfi-1.h: Remove the corresponding declarations.

13 years agodefault-trap-handler bugfix
Andy Wingo [Sun, 19 Sep 2010 10:20:58 +0000 (12:20 +0200)]
default-trap-handler bugfix

* module/system/vm/trap-state.scm (default-trap-handler): Fix thinko.

13 years agoFix make-variable-transformer export
Göran Weinholt [Sat, 18 Sep 2010 16:35:30 +0000 (18:35 +0200)]
Fix make-variable-transformer export

* module/rnrs/syntax-case.scm: Add make-variable-transformer to the
  imports. This was causing an unbound variable error even though
  (rnrs) had been imported.

13 years agoadd ,traps ,delete ,disable ,enable
Andy Wingo [Sun, 19 Sep 2010 09:32:47 +0000 (11:32 +0200)]
add ,traps ,delete ,disable ,enable

* module/system/repl/command.scm (traps, delete, disable, enable): New
  meta-commands.

13 years agoimplement breakpoints in the repl
Andy Wingo [Sun, 19 Sep 2010 09:16:32 +0000 (11:16 +0200)]
implement breakpoints in the repl

* module/system/vm/trap-state.scm: New file, tracks a VM-specific set of
  traps.
* module/Makefile.am: Add trap-state.scm.

* module/system/repl/error-handling.scm: While in a with-error-handling
  block, bind a default trap handler that invokes a recursive prompt.

* module/system/repl/command.scm: Add a `break' repl meta-command.

13 years agoadd (system vm traps)
Andy Wingo [Fri, 17 Sep 2010 11:33:47 +0000 (13:33 +0200)]
add (system vm traps)

* module/system/vm/traps.scm: New module, implements higher-level traps
  based on the VM hooks. Inspired by (ice-9 debugging traps). Instead of
  the ice-9's variety, these traps have a procedural interface instead
  of a GOOPS interface.

* module/Makefile.am: Add the new module.

13 years agovm hooks run without hooks
Andy Wingo [Fri, 17 Sep 2010 08:59:36 +0000 (10:59 +0200)]
vm hooks run without hooks

* libguile/vm.c (vm_dispatch_hook): Run hooks with the trace-level set
  to 0. We really don't want hooks running while hooks are running.

13 years agofix bad Makefile.am addition
Andy Wingo [Thu, 16 Sep 2010 16:28:29 +0000 (18:28 +0200)]
fix bad Makefile.am addition

13 years agoinstruction tracing tweak
Andy Wingo [Thu, 16 Sep 2010 11:04:57 +0000 (13:04 +0200)]
instruction tracing tweak

* module/system/vm/trace.scm (vm-trace): No need to output the opcode
  number, and display the ip as a decimal, not a hexidecimal.

13 years agoonly trace instructions inside the thunk
Andy Wingo [Thu, 16 Sep 2010 10:58:59 +0000 (12:58 +0200)]
only trace instructions inside the thunk

* module/system/vm/trace.scm (vm-trace): Only trace instructions when
  we're in the dynamic extent of the thunk.

13 years agoupdate vm hooks doc
Andy Wingo [Thu, 16 Sep 2010 10:52:17 +0000 (12:52 +0200)]
update vm hooks doc

* doc/ref/api-evaluation.texi (VM Behaviour): Half-hearted doc update.

13 years agoadd vm-abort-continuation-hook, vm-restore-continuation-hook
Andy Wingo [Thu, 16 Sep 2010 10:48:41 +0000 (12:48 +0200)]
add vm-abort-continuation-hook, vm-restore-continuation-hook

* libguile/vm-i-system.c (call_cc, tail_call_cc): Call the new
  RESTORE_CONTINUATION_HOOK when a continuation is restored.
  (prompt): Call the new ABORT_CONTINUATION_HOOK when entering the abort
  handler's continuation.

* libguile/vm-engine.h (ABORT_CONTINUATION_HOOK)
  (RESTORE_CONTINUATION_HOOK):
* libguile/vm.h (SCM_VM_ABORT_CONTINUATION_HOOK)
  (SCM_VM_RESTORE_CONTINUATION_HOOK):
* libguile/vm.c: (scm_vm_abort_continuation_hook): New hook, called when
  entering an abort handler.
  (scm_vm_restore_continuation_hook): New hook, called after returning
  to a continuation.

* module/system/vm/vm.scm: Add hooks to export list.

13 years agotrim our set of vm hooks
Andy Wingo [Thu, 16 Sep 2010 10:14:55 +0000 (12:14 +0200)]
trim our set of vm hooks

* libguile/vm.h (SCM_VM_PUSH_CONTINUATION_HOOK)
  (SCM_VM_POP_CONTINUATION_HOOK): New hooks, to replace
  enter/exit/return.
  (SCM_VM_BOOT_HOOK, SCM_VM_HALT_HOOK, SCM_VM_BREAK_HOOK): Remove these
  useless hooks.

* libguile/vm.c (scm_vm_push_continuation_hook)
  (scm_vm_pop_continuation_hook): New accessors.

* libguile/vm-i-system.c: Remove boot, halt, break, enter, exit, and
  return hooks. Also remove the break instruction. Instead now when we
  push a new continuation onto the stack we call PUSH_CONTINUATION_HOOK,
  and when we pop via a return we call POP_CONTINUATION_HOOK. APPLY_HOOK
  is now decoupled from continuation pushes and pops.

* libguile/vm-engine.h:
* libguile/vm-engine.c: Adapt for hooks.

* module/system/vm/trace.scm (vm-trace): Adapt for hooks. Also revive
  the #:instructions? #t mode.

* module/system/vm/vm.scm: Adapt exports for new set of hooks.

13 years agoremove unused (system vm profile)
Andy Wingo [Thu, 16 Sep 2010 10:03:10 +0000 (12:03 +0200)]
remove unused (system vm profile)

* module/Makefile.am:
* module/system/vm/profile.scm: Remove (system vm profile). We use
  statprof.

13 years agoFix write-beyond-end-of-string error in the conversion to R6RS string escapes.
Ludovic Courtès [Wed, 15 Sep 2010 21:32:28 +0000 (23:32 +0200)]
Fix write-beyond-end-of-string error in the conversion to R6RS string escapes.

Reported by Mike Gran <spk121@yahoo.com>.

* libguile/strings.c (scm_i_unistring_escapes_to_guile_escapes,
  scm_i_unistring_escapes_to_r6rs_escapes): Augment comments.
  (scm_to_stringn): When `handler ==
  SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE && SCM_R6RS_ESCAPES_P', realloc
  BUF so that it's large enough for the worst case.

* libguile/print.c (display_character): When `result != NULL && strategy
  == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE && SCM_R6RS_ESCAPES_P', make
  LOCALE_ENCODED large enough to hold an R6RS escape.

13 years agoOptimize `peek-char'.
Ludovic Courtès [Wed, 15 Sep 2010 16:38:57 +0000 (18:38 +0200)]
Optimize `peek-char'.

This makes `peek-char' 40x faster on a port whose encoding is
faster on a UTF-8 port containing multi-byte codepoints.

The `xml->sxml' procedure is 4x faster on a 2.7 MiB XML file.

* libguile/ports.c (get_codepoint): New procedure, moved here from
  `scm_getc', with the additional BUF and LEN parameters.
  (scm_getc): Use it.
  (scm_peek_char): Use it instead of the `scm_getc'/`scm_ungetc'
  sequence.

* test-suite/tests/ports.test ("string ports")["peek-char [latin-1]",
  "peek-char [utf-8]"]: New tests.

* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add
  `benchmarks/ports.bm'.

* benchmark-suite/benchmarks/ports.bm: New file.

13 years agoFix copyright year and module name of `write.bm'.
Ludovic Courtès [Wed, 15 Sep 2010 16:27:47 +0000 (18:27 +0200)]
Fix copyright year and module name of `write.bm'.

* benchmark-suite/benchmarks/write.bm: Fix copyright year and module
  name.

13 years agoRe-introduce pretty-printing of combining characters.
Ludovic Courtès [Tue, 14 Sep 2010 22:52:40 +0000 (00:52 +0200)]
Re-introduce pretty-printing of combining characters.

This had been removed by commit 07f49ac786e0f1c007eb336e2fb7a572e8405316
("Factorize and optimize `write' for strings and characters.").
Thanks Mike!

* libguile/print.c (write_combining_character): New procedure.
  (write_character): Use it.

* test-suite/tests/chars.test ("basic char handling")["combining accent
  is pretty-printed", "combining X is pretty-printed"]: New tests.

* test-suite/tests/encoding-iso88591.test ("characters")["write A
  followed by combining accent"]: New test.

* test-suite/tests/encoding-utf8.test ("characters")["write A followed
  by combining accent"]: New test.

13 years agoRemove commented out code from `print.c'.
Ludovic Courtès [Tue, 14 Sep 2010 14:09:11 +0000 (16:09 +0200)]
Remove commented out code from `print.c'.

* libguile/print.c (scm_write, scm_display, scm_write_char): Remove
  `#if 0'-d code.

13 years agoFactorize and optimize `write' for strings and characters.
Ludovic Courtès [Tue, 14 Sep 2010 14:10:52 +0000 (16:10 +0200)]
Factorize and optimize `write' for strings and characters.

According to `write.bm', this makes `write' 2.6 times faster for strings.

* libguile/print.c (iprin1): Use `write_character' when
  `SCM_WRITINGP (pstate)' and `SCM_CHARP (exp)' or `scm_is_string (exp)'.
  (scm_i_charprint): Remove.
  (display_character, write_character): New functions.
  (scm_write_char): Use `display_character' instead of
  `scm_i_charprint'.

* libguile/print.h (scm_i_charprint): Remove declaration.

* benchmark-suite/benchmarks/write.bm: New file.

* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add
  `benchmarks/write.bm'.

13 years agoInternally expose `scm_i_unistring_escapes_to_{guile,r6rs}_escapes'.
Ludovic Courtès [Tue, 14 Sep 2010 14:04:26 +0000 (16:04 +0200)]
Internally expose `scm_i_unistring_escapes_to_{guile,r6rs}_escapes'.

* libguile/strings.c (unistring_escapes_to_guile_escapes): Rename to...
  (scm_i_unistring_escapes_to_guile_escapes): ... this.  Change `char **bufp'
  to `char *buf'; leave realloc responsibility to the caller.  Update caller.
  (unistring_escapes_to_r6rs_escapes): Rename to...
  (scm_i_unistring_escapes_to_r6rs_escapes): ... this.  Likewise.

13 years agodoc/ref lib-version.texi removal
Andy Wingo [Sun, 12 Sep 2010 21:44:16 +0000 (23:44 +0200)]
doc/ref lib-version.texi removal

* doc/ref/.gitignore:
* doc/ref/Makefile.am:
* doc/ref/guile.texi: Remove rules for generating an unused
  lib-version.texi.

13 years agolibguile gitignore
Andy Wingo [Sun, 12 Sep 2010 21:39:52 +0000 (23:39 +0200)]
libguile gitignore

* libguile/.gitignore: Fix for recent cpp-{E,SIG} change.

13 years agobuild tweak to remove SRFI version definitions
Andy Wingo [Sun, 12 Sep 2010 21:30:43 +0000 (23:30 +0200)]
build tweak to remove SRFI version definitions

* GUILE-VERSION: Remove SRFI version definitions, as they are no longer
  needed.

13 years agomove srfi-1 and srfi-60 C impl to libguile, without public C api
Andy Wingo [Sun, 12 Sep 2010 21:18:54 +0000 (23:18 +0200)]
move srfi-1 and srfi-60 C impl to libguile, without public C api

* libguile/srfi-1.c:
* libguile/srfi-1.h:
* libguile/srfi-60.c:
* libguile/srfi-60.h:
* libguile/ChangeLog-srfi: Move here, from the srfi/ dir. The C API is
  internal. Add API to register the extensions, called by init.c.

* libguile/init.c: Verily, register srfi extensions.

* libguile/Makefile.am: Add srfi files.

* module/srfi/srfi-1.scm:
* module/srfi/srfi-60.scm: Update load-extension invocation.

* Makefile.am:
* configure.ac: Remove srfi/ dir.

* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-srfi-1.c: Remove srfi-1 C test, we don't
  support this API any more.

13 years agoremove empty srfi-4, srfi-13, and srfi-14 shlibs
Andy Wingo [Sun, 12 Sep 2010 20:41:15 +0000 (22:41 +0200)]
remove empty srfi-4, srfi-13, and srfi-14 shlibs

* srfi/srfi-13.c:
* srfi/srfi-13.h:
* srfi/srfi-14.c:
* srfi/srfi-14.h:
* srfi/srfi-4.c:
* srfi/srfi-4.h:
* srfi/Makefile.am:
* configure.ac: Remove empty shlibs and headers for srfis 4, 13, and
  14. The "version" was never programmatically exported, so there's no
  possible way people could have used these.

13 years agoCreate tags for Scheme source
Neil Jerram [Sat, 11 Sep 2010 17:39:00 +0000 (18:39 +0100)]
Create tags for Scheme source

* am/guilec: Set ETAGS_ARGS.

* module/Makefile.am: When adding sources to EXTRA_DIST, add them to
  ETAGS_ARGS too.

13 years agoProvide non-locale C/Scheme string conversion functions
Michael Gran [Sun, 12 Sep 2010 15:29:31 +0000 (08:29 -0700)]
Provide non-locale C/Scheme string conversion functions

* doc/ref/api-data.texi: document scm_to_stringn, scm_from_stringn,
  scm_to_latin1_stringn, and scm_from_latin1_stringn
* libguile/strings.h (scm_to_stringn): make public
  (scm_to_latin1_stringn): new declaration
  (scm_from_latin1_stringn): new declaration
* libguile/strings.c (scm_to_latin1_stringn): new function
  (scm_from_latin1_stringn): new function

13 years agoDocument scm_wrong_type_arg_msg
Neil Jerram [Sat, 11 Sep 2010 17:37:02 +0000 (18:37 +0100)]
Document scm_wrong_type_arg_msg

* doc/ref/api-control.texi: New def for scm_wrong_type_arg_msg.

13 years agoRemove non-existent *environment* APIs from api-undocumented.texi
Neil Jerram [Sat, 11 Sep 2010 15:34:19 +0000 (16:34 +0100)]
Remove non-existent *environment* APIs from api-undocumented.texi

* doc/ref/api-undocumented.texi: Remove entries for the never used,
  and now removed, environment API.

13 years agoRemove unnecessary blank "Indices" page.
Neil Jerram [Sat, 11 Sep 2010 14:45:05 +0000 (15:45 +0100)]
Remove unnecessary blank "Indices" page.

* doc/ref/guile.texi: Remove `Indices' heading.

13 years agonew procedure: source-procedures
Andy Wingo [Fri, 10 Sep 2010 11:29:56 +0000 (13:29 +0200)]
new procedure: source-procedures

* module/system/xref.scm (source-procedures): New public procedure,
  gives the procedures defined at a given source location.

13 years ago(system xref) uses module-submodules
Andy Wingo [Fri, 10 Sep 2010 10:55:09 +0000 (12:55 +0200)]
(system xref) uses module-submodules

* module/system/xref.scm (ensure-callers-db): Fix up to use
  module-submodules.

13 years agoregenerate psyntax-pp.scm
Andy Wingo [Fri, 10 Sep 2010 09:03:59 +0000 (11:03 +0200)]
regenerate psyntax-pp.scm

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

13 years agosimplify module/Makefile.am rules to not require touch
Andy Wingo [Fri, 10 Sep 2010 09:01:23 +0000 (11:01 +0200)]
simplify module/Makefile.am rules to not require touch

* module/Makefile.am (ice-9/psyntax-pp.go, ice-9/psyntax-pp.scm.gen)
  (ice-9/eval.go): Simplify rules to not require `touch', now that .go
  files are checked for freshness, not for synchronicity.

13 years agoClarify feature macro conditionals.
Ludovic Courtès [Tue, 7 Sep 2010 22:38:49 +0000 (00:38 +0200)]
Clarify feature macro conditionals.

* libguile/numbers.c (scm_log10): Check whether `HAVE_COMPLEX_DOUBLE'
  and `HAVE_CLOG10' are defined instead of checking whether they are
  non-zero.
  (scm_sqrt): Likewise for `HAVE_COMPLEX_DOUBLE' and
  `HAVE_USABLE_CSQRT'.

13 years agoUse Gnulib's `isnan' and `isinf' modules.
Ludovic Courtès [Tue, 7 Sep 2010 22:34:27 +0000 (00:34 +0200)]
Use Gnulib's `isnan' and `isinf' modules.

This updates Gnulib to v0.0-4219-g84cdd8b.

* m4/gnulib-cache.m4: Add `isinf' and `isnan'.

* configure.ac: Remove checks for `floatingpoint.h', `ieeefp.h', and
  `nan.h'.

* libguile/gen-scmconfig.c (main): Remove definitions of
  `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', and
  `SCM_HAVE_NAN_H'.

* libguile/numbers.c (isnan)[SCO && !HAVE_ISNAN]: Remove.
  (isinf)[SCO && !HAVE_ISINF]: Remove.
  (xisinf, xisnan): Remove.  Change callers to use `isinf' and `isnan'.
  (guile_ieee_init): Remove the `defined HAVE_ISINF' and `define
  HAVE_ISNAN' conditions.

* libguile/numbers.h: Remove code conditional on
  `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', or `SCM_HAVE_NAN_H'.

13 years agoUse `have-lib' when checking for libltdl.
Ludovic Courtès [Mon, 6 Sep 2010 20:49:24 +0000 (22:49 +0200)]
Use `have-lib' when checking for libltdl.

Suggested by primus <rprimus@gmail.com>.

* configure.ac: Use `AC_LIB_HAVE_LINKFLAGS' when checking for libltdl.

* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD):
  Add $(LTLIBLTDL).

* README: Update to make it clear that libgc and libffi don't have a
  `--with-XXX-prefix' option.

13 years agoRename `make-foreign-function' to `pointer->procedure'.
Ludovic Courtès [Mon, 6 Sep 2010 20:24:44 +0000 (22:24 +0200)]
Rename `make-foreign-function' to `pointer->procedure'.

* libguile/foreign.c (scm_make_foreign_function): Rename to...
  (scm_pointer_to_procedure): ... this.
* libguile/foreign.h: Adjust accordingly.
* module/system/foreign.scm: Likewise.
* test-suite/standalone/test-ffi: Likewise.
* test-suite/tests/foreign.test: Likewise.
* doc/ref/api-foreign.texi: Likewise.

13 years agofix to program-module
Andy Wingo [Mon, 6 Sep 2010 11:58:13 +0000 (13:58 +0200)]
fix to program-module

* libguile/programs.c (scm_program_module): Fix an edge case in which
  this function returned non-modules. Thanks to José Antonio Ortega
  Ruiz, Caballero del Cálculo Lambda for the report.

13 years agoAdd `.version' to the distribution.
Ludovic Courtès [Sat, 4 Sep 2010 18:37:34 +0000 (20:37 +0200)]
Add `.version' to the distribution.

* Makefile.am (EXTRA_DIST): Add `.version'.  Remove `m4/autobuild.m4'.

13 years agoBump version number for 1.9.12.
Ludovic Courtès [Sat, 4 Sep 2010 18:20:14 +0000 (20:20 +0200)]
Bump version number for 1.9.12.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.

13 years agofix guile-tools --help and --version
Andy Wingo [Sat, 4 Sep 2010 18:00:33 +0000 (11:00 -0700)]
fix guile-tools --help and --version

* meta/guile-tools.in: Fix --help and --version.

13 years agoboot-9 refactor
Andy Wingo [Sat, 4 Sep 2010 17:24:52 +0000 (10:24 -0700)]
boot-9 refactor

* module/ice-9/boot-9.scm (make-root-module, make-scm-module): Remove
  these functions; they are only called once, so we inline them at their
  call sites.
  (the-root-module, the-scm-module): The aforementioned call sites.

13 years agoUpdate `NEWS' for 1.9.12.
Ludovic Courtès [Sat, 4 Sep 2010 14:56:15 +0000 (16:56 +0200)]
Update `NEWS' for 1.9.12.

* NEWS: Update.

13 years agoDon't say "source file is newer" when either file is inaccessible.
Ludovic Courtès [Sat, 4 Sep 2010 14:13:42 +0000 (16:13 +0200)]
Don't say "source file is newer" when either file is inaccessible.

* libguile/load.c (compiled_is_fresh): Don't emit "source file is newer"
  warning when either FULL_FILENAME or COMPILED_FILENAME could not be
  stat'd.  This is consistent with what load/compiled-file-name do.

13 years agoCompare source/compiled file timestamps with nano-second resolution.
Ludovic Courtès [Sat, 4 Sep 2010 14:07:58 +0000 (16:07 +0200)]
Compare source/compiled file timestamps with nano-second resolution.

* libguile/load.c (compiled_is_fresh): Rename `res' to
  `compiled_is_newer'.  Use `get_stat_mtime' to compare with nano-second
  resolution when available.

* module/ice-9/boot-9.scm (load)[fresh-compiled-file-name]: Likewise,
  using `stat:mtimensec'.

13 years agoUse Gnulib's `stat-time' module; update Gnulib.
Ludovic Courtès [Sat, 4 Sep 2010 13:16:35 +0000 (15:16 +0200)]
Use Gnulib's `stat-time' module; update Gnulib.

This updates Gnulib files to v0.0-4207-gc82b481.

* m4/gnulib-cache.m4: Add `stat-time'.

13 years agoAdd an entertaining `procedure->pointer' test.
Ludovic Courtès [Sat, 4 Sep 2010 12:38:20 +0000 (14:38 +0200)]
Add an entertaining `procedure->pointer' test.

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

13 years agoFix the `put-bytevector' tests.
Ludovic Courtès [Fri, 3 Sep 2010 14:23:02 +0000 (16:23 +0200)]
Fix the `put-bytevector' tests.

* libguile/vports.c (sf_write): Add comment about what happens when DATA
  contains binary data.

* test-suite/tests/r6rs-ports.test ("7.2.11 Binary
  Output")["put-bytevector [2 args]", "put-bytevector [3 args]",
  "put-bytevector [4 args]"]: Require a Latin-1 locale.

13 years agoAdd license header to `test-ffi'.
Ludovic Courtès [Fri, 3 Sep 2010 13:32:31 +0000 (15:32 +0200)]
Add license header to `test-ffi'.

* test-suite/standalone/test-ffi: Add license header.

13 years agoAdd `procedure->pointer' to the FFI.
Ludovic Courtès [Fri, 3 Sep 2010 13:12:54 +0000 (15:12 +0200)]
Add `procedure->pointer' to the FFI.

* libguile/foreign.c (make_cif): New procedure, with code formerly in
  `scm_make_foreign_function'.
  (scm_make_foreign_function): Use it.
  (invoke_closure, scm_procedure_to_pointer)[FFI_CLOSURES]: New
  functions.

* libguile/foreign.h (scm_procedure_to_pointer): New declaration.

* module/system/foreign.scm: Export `procedure->pointer' when available.

* test-suite/standalone/test-ffi (f-callback-1, f-callback-2): New
  procedures and related tests.

* test-suite/standalone/test-ffi-lib.c (test_ffi_callback_1,
  test_ffi_callback_2): New functions.

* test-suite/tests/foreign.test ("procedure->pointer"): New test prefix.

* doc/ref/api-foreign.texi (Dynamic FFI): Document `procedure->pointer'.

13 years agoFix for `submodules' in (ice-9 session) (closes #30062)
Jose A. Ortega Ruiz [Tue, 31 Aug 2010 12:13:43 +0000 (14:13 +0200)]
Fix for `submodules' in (ice-9 session) (closes #30062)

* module/ice-9/session.scm (submodules): replace implementation to
  use `module-submodules' instead of `module-obarray' (the latter
  doesn't include submodules anymore).

* test-suite/tests/session.test: new test suite for session, checking
  the exported procedures that use `submodules'.

Signed-off-by: Jose A. Ortega Ruiz <jao@gnu.org>
13 years agomodule-ref-submodule deprecation fixes
Andy Wingo [Tue, 31 Aug 2010 16:22:59 +0000 (09:22 -0700)]
module-ref-submodule deprecation fixes

* module/ice-9/boot-9.scm (module-ref-submodule)
  (module-define-submodule!): Pull deprecated shims here, as we need
  them before loading (ice-9 deprecated). Also bugfix to only define the
  module if there is no local variable, even if it is unbound.

* module/ice-9/deprecated.scm: Remove from here.

13 years agoback-compat in (rnrs) for deprecated modules-in-value-namespace
Andy Wingo [Fri, 3 Sep 2010 04:29:26 +0000 (21:29 -0700)]
back-compat in (rnrs) for deprecated modules-in-value-namespace

* module/rnrs.scm (rnrs): Work around some unavoidable (I think)
  behavior when back-compatible unified namespaces are enabled; see
  comments in source.

13 years agomodule-local-variable optimization
Andy Wingo [Fri, 3 Sep 2010 03:48:08 +0000 (20:48 -0700)]
module-local-variable optimization

* libguile/modules.c (scm_module_local_variable): An optimization in the
  common no-module-binder case.

13 years agoFix memory leak in `lock-mutex' (aka. `scm_lock_mutex'.)
Ludovic Courtès [Thu, 2 Sep 2010 12:42:14 +0000 (14:42 +0200)]
Fix memory leak in `lock-mutex' (aka. `scm_lock_mutex'.)

The memory leak is trivially reproducible with:

  (define m (make-mutex))
  (let loop () (lock-mutex m) (unlock-mutex m) (loop))

or similarly with:

  (define p (delay (+ 1 2)))
  (let loop () (force p) (loop))

since `force' acquires P's mutex.

It could also lead to premature release of a thread waiting in
`fat_mutex_lock' when a former owner's `do_thread_exit' is run.

* libguile/threads.c (fat_mutex_unlock): When `m->level' becomes 0,
  remove MUTEX from `t->mutexes'.
  (fat_mutex_lock): Update comment above the `t->mutexes' assignment.
  (do_thread_exit): Add an assertion making sure that each mutex in
  `t->mutexes' is owned by T.

13 years agoAvoid calls to `scm_current_thread' in `fat_mutex_unlock'.
Ludovic Courtès [Thu, 2 Sep 2010 09:22:01 +0000 (11:22 +0200)]
Avoid calls to `scm_current_thread' in `fat_mutex_unlock'.

* libguile/threads.c (fat_mutex_unlock): Use `t->handle' instead of
  calling `scm_current_thread'.

13 years agoFix typos.
Ludovic Courtès [Wed, 1 Sep 2010 22:04:39 +0000 (00:04 +0200)]
Fix typos.

* module/system/repl/repl.scm (run-repl): Fix variable name: `k', not
  `key'.

* module/texinfo/docbook.scm: Use `(srfi srfi-1)' for `fold'.

13 years agoSRFI-1: Rewrite `drop-right!', `drop-while', `reduce', etc. in Scheme.
Ludovic Courtès [Wed, 1 Sep 2010 22:03:07 +0000 (00:03 +0200)]
SRFI-1: Rewrite `drop-right!', `drop-while', `reduce', etc. in Scheme.

This partially reverts commit e9508fbb7df0b1ead007637f16d80cf831776307
(May 3 2005).

* module/srfi/srfi-1.scm (take!, drop-right!, reduce, reduce-right,
  take-while, take-while!, drop-while, span, span!, lset-adjoin): New
  procedures.

* srfi/srfi-1.c (scm_srfi1_drop_right_x, scm_srfi1_drop_while,
  scm_srfi1_lset_adjoin, scm_srfi1_reduce, scm_srfi1_reduce_right,
  scm_srfi1_span, scm_srfi1_span_x, scm_srfi1_take_x,
  scm_srfi1_take_while, scm_srfi1_take_while_x): Rewrite as
  proxies to the corresponding Scheme procedures.

* benchmark-suite/benchmarks/srfi-1.bm ("drop-while"): New benchmark
  prefix.

13 years agoRewrite `fport_flush' using Gnulib's `full_write'.
Ludovic Courtès [Wed, 1 Sep 2010 13:04:59 +0000 (15:04 +0200)]
Rewrite `fport_flush' using Gnulib's `full_write'.

* libguile/fports.c (fport_flush): Rewrite using `full_write'.

13 years agopopen.test: Don't auto-compile `popen-child.scm'.
Ludovic Courtès [Wed, 1 Sep 2010 13:03:24 +0000 (15:03 +0200)]
popen.test: Don't auto-compile `popen-child.scm'.

* test-suite/tests/popen.test ("open-output-pipe")["no duplicate"]:
  Disable auto-compilation of `popen-child.scm'.

13 years agoAdd `test-suite/tests/popen-child.scm' to the distribution.
Ludovic Courtès [Wed, 1 Sep 2010 12:52:36 +0000 (14:52 +0200)]
Add `test-suite/tests/popen-child.scm' to the distribution.

* test-suite/Makefile.am (SCM_TESTS): Add `tests/popen-child.scm'.

13 years agoAdd new debug meta-command ,error-message
Jose A. Ortega Ruiz [Mon, 30 Aug 2010 04:37:24 +0000 (06:37 +0200)]
Add new debug meta-command ,error-message

* module/system/repl/error-handling.scm: use the error string to
  construct the <debug> instance.

* module/system/repl/command.scm: new debug command `error-message'
  that extracts the new <debug> field, available to stack commands as
  `message'.

* doc/ref/scheme-using.texi: documentation for new command.

* module/system/repl/debug.scm: <debug> stores the error string in a
  new field.

13 years agofix #y back-compat shim
Andy Wingo [Mon, 30 Aug 2010 04:01:54 +0000 (21:01 -0700)]
fix #y back-compat shim

* module/ice-9/deprecated.scm (#\y): #y was in fact a syntax for
  s8vectors, not bitvectors. Fix.

13 years agobitvector work
Andy Wingo [Mon, 30 Aug 2010 03:48:32 +0000 (20:48 -0700)]
bitvector work

* test-suite/Makefile.am:
* test-suite/tests/bitvectors.test: Add a new file to test bitvectors.

* libguile/uniform.c (scm_c_uniform_vector_length): Don't call
  scm_uniform_vector_elements, as we don't need to be able to access the
  elements with pointers to bytes. Fixes uniform-vector-length on
  bitvectors.

13 years agodocstrings in syntax-rules
Andy Wingo [Mon, 30 Aug 2010 02:27:23 +0000 (19:27 -0700)]
docstrings in syntax-rules

* module/ice-9/psyntax.scm (syntax-rules): Allow a docstring between the
  literals and the first clause.

13 years agodefine* usage in boot-9
Andy Wingo [Sun, 29 Aug 2010 18:59:10 +0000 (11:59 -0700)]
define* usage in boot-9

* module/ice-9/boot-9.scm (make-module, make-mutable-parameter): Use
  define*.

13 years agoadd flag to vtables to indicate that their layout is valid
Andy Wingo [Sun, 29 Aug 2010 18:37:29 +0000 (11:37 -0700)]
add flag to vtables to indicate that their layout is valid

* libguile/struct.h (SCM_VTABLE_FLAG_VALIDATED): New flag, indicates
  that the layout of a vtable has been validated. The other flags have
  been renumbered.

* libguile/struct.c (scm_i_struct_inherit_vtable_magic): Set the
  VALIDATED flag if everything goes through.
  (scm_struct_vtable_p): If the struct should be a vtable but isn't
  validated, throw an error.
  (scm_make_vtable_vtable): Validate the incoming user_fields layout
  bit. Set the VALIDATED flag.
  (scm_c_make_structv): Add a comment about the case in which we delay
  scm_i_struct_inherit_vtable_magic.

13 years agodeprecate passing a number as the destination to `format'
Andy Wingo [Sat, 28 Aug 2010 20:43:46 +0000 (13:43 -0700)]
deprecate passing a number as the destination to `format'

* module/ice-9/format.scm (format): Deprecate having a number as the
  destination.
* doc/ref/misc-modules.texi (Formatted Output): Update docs.

13 years agothreadsafety in deprecation, extensions
Andy Wingo [Sat, 28 Aug 2010 19:15:53 +0000 (12:15 -0700)]
threadsafety in deprecation, extensions

* libguile/deprecation.c (scm_c_issue_deprecation_warning):
* libguile/extensions.c (scm_c_register_extension, load_extension): Add
  locks around global data structures.

13 years agonet-db.test tweak
Andy Wingo [Sat, 28 Aug 2010 19:02:12 +0000 (12:02 -0700)]
net-db.test tweak

* test-suite/tests/net-db.test: Throw 'unresolved if we have a crap DNS
  that is returning results for all addresses.

13 years agothreadsafe object properties
Andy Wingo [Sat, 28 Aug 2010 18:57:51 +0000 (11:57 -0700)]
threadsafe object properties

* libguile/objprop.c: Add locking around the properties weak hash, to
  avoid corrupting the whash.

13 years agoREADME fix for PKG_CONFIG=true
Andy Wingo [Sat, 28 Aug 2010 17:41:27 +0000 (10:41 -0700)]
README fix for PKG_CONFIG=true

* README: Add note that if you override pkg-config, you need to set
  libffi flags as well. Thanks to Mark Weaver.

13 years agoSeveral fixes to R6RS libraries
Andreas Rottmann [Sat, 28 Aug 2010 17:16:30 +0000 (10:16 -0700)]
Several fixes to R6RS libraries

* module/rnrs/arithmetic/fixnums.scm (fixnum-width): Make this return an
  an exact integer instead of an inexact number.

* module/rnrs/base.scm (assertion-violation): Implement.

* module/rnrs/conditions.scm (simple-conditions): Allow also simple
  conditions as argument.

* module/rnrs/enums.scm (define-enumeration): Properly construct empty
  enumeration sets.

* module/rnrs/exceptions.scm (guard): Don't restrict the body to a
  single expression.

* module/rnrs/records/syntactic.scm (define-record-type0): Expand into a
  series of definitions only.

13 years agoRevert "don't autocompile while snarfing"
Andy Wingo [Fri, 27 Aug 2010 20:11:17 +0000 (13:11 -0700)]
Revert "don't autocompile while snarfing"

This reverts commit 176ee5c82a9e6c775722cfe96711f2a02cdb7672, which
added autocomp inhibitions in the wrong place.

13 years agoRevert "[build] Rewrite guile-func-name-check in Scheme, adding features."
Andy Wingo [Fri, 27 Aug 2010 20:05:23 +0000 (13:05 -0700)]
Revert "[build] Rewrite guile-func-name-check in Scheme, adding features."

This reverts commit 6832604efa0f175a70be700624c365547fb27878. Not only
does this fail on a fresh build due to a lack of "guile", but even if it
did have its Makefile fixed, it would take too long to run, because the
rest of Guile isn't compiled.

The right thing is to avoid invoking Guile until after at least psyntax
and boot-9 have been compiled.

This commit can be reinstated if we move doc snarfing to a phase that
happens after module/ is compiled.

13 years agodon't autocompile while snarfing
Andy Wingo [Fri, 27 Aug 2010 19:56:54 +0000 (12:56 -0700)]
don't autocompile while snarfing

* am/snarf (GUILE_SNARF): Don't autocompile while snarfing, as we
  probably don't have a compiled Guile at this point.

13 years agoDocument (ice-9 match).
Ludovic Courtès [Fri, 27 Aug 2010 16:58:13 +0000 (18:58 +0200)]
Document (ice-9 match).

* doc/ref/Makefile.am (guile_TEXINFOS): Add `match.texi'.

* doc/ref/guile.texi (Guile Modules): Include `match.texi'.

* doc/ref/match.texi: New file.

* doc/ref/sxml-match.texi (sxml-match): Add xref to `match.texi'.

* module/ice-9/match.scm: Note lack of support for `(pat => exp)'.

13 years agoSRFI-1: Choose better benchmark names.
Ludovic Courtès [Fri, 27 Aug 2010 13:44:55 +0000 (15:44 +0200)]
SRFI-1: Choose better benchmark names.

* benchmark-suite/benchmarks/srfi-1.bm ("fold"): Rename sub-tests to
  "big" and "small".

13 years agoSRFI-1: Rewrite `break' and `break!' in Scheme.
Ludovic Courtès [Fri, 27 Aug 2010 13:43:30 +0000 (15:43 +0200)]
SRFI-1: Rewrite `break' and `break!' in Scheme.

This partially reverts commit 6e9f3c2676c0101590d4229653e9c628cb293064
(Tue May 3 2005).

* module/srfi/srfi-1.scm (break, break!): New procedures.

* srfi/srfi-1.c (scm_srfi1_break, scm_srfi1_break_x): Rewrite as
  proxies to the corresponding Scheme procedures.

* test-suite/standalone/test-srfi-1.c (failure): New function.
  (tests): Add `scm_srfi1_break' test.  Use `failure'.

13 years agoSRFI-1: Rewrite `fifth', `sixth', etc. in Scheme.
Ludovic Courtès [Fri, 27 Aug 2010 10:51:47 +0000 (12:51 +0200)]
SRFI-1: Rewrite `fifth', `sixth', etc. in Scheme.

This partially reverts commit 03731332d5dc8d650b947f5126427402c2b1d8bb
(Tue May 3 2005).

* module/srfi/srfi-1.scm (fifth, sixth, seventh, eighth, ninth, tenth):
  New procedures.

* srfi/srfi-1.c (scm_srfi1_fifth, scm_srfi1_sixth, scm_srfi1_seventh,
  scm_srfi1_eighth, scm_srfi1_ninth, scm_srfi1_tenth): Rewrite as
  proxies to the corresponding Scheme procedure.

* test-suite/tests/srfi-1.test ("eighth")["() -1"]: Change exception
  type to `exception:wrong-type-arg'.
  ("fifth")["() -1"]: Likewise.
  ("ninth")["() -1"]: Likewise.
  ("seventh")["() -1"]: Likewise.
  ("sixth")["() -1"]: Likewise.
  ("tenth")["() -1"]: Likewise.

13 years agoRemove unneeded #:use-module.
Ludovic Courtès [Fri, 27 Aug 2010 10:36:23 +0000 (12:36 +0200)]
Remove unneeded #:use-module.

* module/system/vm/frame.scm: Remove use of (srfi srfi-1).

13 years agoAssorted `syntax-check' fixes.
Ludovic Courtès [Fri, 20 Aug 2010 19:08:49 +0000 (21:08 +0200)]
Assorted `syntax-check' fixes.

* doc/ref/Makefile.am ($(snarf_doc).am): Untabify.

* libguile/eval.c: Remove unnecessary <assert.h> inclusion.

* .x-sc_m4_quote_check: Update.

* libguile/error.c (scm_error_scm): Use `EXIT_FAILURE' instead of 1.
* libguile/init.c (fixconfig, scm_boot_guile): Likewise.
* libguile/null-threads.h (scm_i_pthread_exit): Likewise.
* libguile/script.c (scm_compile_shell_switches): Likewise.
* test-suite/standalone/test-conversion.c: Likewise.
* test-suite/standalone/test-list.c: Likewise.
* test-suite/standalone/test-unwind.c: Likewise.

* libguile/async.c: Remove unnecessary inclusion of <signal.h>.

* NEWS: "filesystem" -> "file system".
* doc/ref/r6rs.texi: Ditto.

* cfg.mk (local-checks-to-skip): New variable.

* .x-sc_m4_quote_check, .x-sc_obsolete_symbols, .x-sc_program_name,
  .x-sc_prohibit_atoi_atof, .x-sc_prohibit_magic_number_exit: New
  files.

* .gitignore: Update.

13 years agofix <letrec> docs
Andy Wingo [Fri, 27 Aug 2010 16:16:44 +0000 (09:16 -0700)]
fix <letrec> docs

* doc/ref/compiler.texi (Tree-IL): Fix docs for external representation
  of letrec. Thanks to No Itisnt.

13 years ago[build] Rewrite guile-func-name-check in Scheme, adding features.
Thien-Thi Nguyen [Thu, 26 Aug 2010 21:21:41 +0000 (23:21 +0200)]
[build] Rewrite guile-func-name-check in Scheme, adding features.

* libguile/guile-func-name-check: Rewrite in Scheme; add inhibition
  directives, string-literal handling, failureful exit on error.
* libguile/guile-snarf-docs.in: Use ‘@top_builddir@/meta/guile’.
* libguile/pairs.c: Add guile-func-name-check inhibition directive.

13 years ago[build] Refine libguile/*.doc snarfing.
Thien-Thi Nguyen [Thu, 26 Aug 2010 16:36:48 +0000 (18:36 +0200)]
[build] Refine libguile/*.doc snarfing.

* libguile/guile-snarf-docs.in: Rewrite to incorporate all
  three phases of snarfing: func-name check, cpp, tokenization.
  Also, require/check new command-line syntax.
* libguile/Makefile.am (AM_V_FILTER): Delete var.
  (AM_V_FILTER_, AM_V_FILTER_0): Likewise.
  (.c.doc): Run ./guile-snarf-docs; use new command-line syntax.

13 years agoconsolidate sitedir definition
Andy Wingo [Wed, 25 Aug 2010 14:24:27 +0000 (10:24 -0400)]
consolidate sitedir definition

* configure.ac (sitedir): Fix definition to point to the
  version-specific sitedir.

* libguile/Makefile.am (libpath.h): Take sitedir definition from
  configure.ac.

13 years agoupdate download location in manual
Andy Wingo [Wed, 25 Aug 2010 13:49:09 +0000 (09:49 -0400)]
update download location in manual

* doc/ref/intro.texi (Obtaining and Installing Guile): Update download
  location.

13 years ago[build] Use AM_SILENT_RULES for generating cpp-E.c, cpp-SIG.c.
Thien-Thi Nguyen [Thu, 19 Aug 2010 09:11:25 +0000 (11:11 +0200)]
[build] Use AM_SILENT_RULES for generating cpp-E.c, cpp-SIG.c.

* libguile/Makefile.am (.syms.c): Prefix first command
  with $(AM_V_GEN); unconditionally silence second command.