bpt/guile.git
14 years agoUpdate Gnulib; use the `func' module.
Ludovic Courtès [Thu, 18 Mar 2010 19:34:01 +0000 (20:34 +0100)]
Update Gnulib; use the `func' module.

Update Gnulib to v0.0-3575-g128e4b8.

* m4/gnulib-cache.m4: Add `func'.

14 years agoAdd `%null-pointer' to `(system foreign)'.
Ludovic Courtès [Wed, 17 Mar 2010 23:27:38 +0000 (00:27 +0100)]
Add `%null-pointer' to `(system foreign)'.

* libguile/foreign.c (sym_null, null_pointer): New variables.
  (scm_foreign_to_bytevector): Raise an error when PTR is NULL.
  (scm_init_foreign): Define SYM_NULL.

* module/system/foreign.scm (%null-pointer): New exported binding.

14 years agoRemove obsolete test directory.
Ludovic Courtès [Tue, 16 Mar 2010 23:52:52 +0000 (00:52 +0100)]
Remove obsolete test directory.

* test-suite/tests/c-api: Remove.

14 years agoChange `dynamic-link' to return a global handle when the argument is omitted.
Ludovic Courtès [Tue, 16 Mar 2010 23:51:22 +0000 (00:51 +0100)]
Change `dynamic-link' to return a global handle when the argument is omitted.

* libguile/dynl.c (sysdep_dynl_link): Handle FNAME == NULL.
  (scm_dynamic_link): Make argument optional.  Adjust body accordingly.

* test-suite/standalone/test-ffi (global, strerror, strlen): New
  bindings.
  Add test for these bindings.

* doc/ref/api-modules.texi (Low level dynamic linking): Update
  description of `dynamic-link'.

14 years agoProvide `int', `long', `size_t', etc. in `(system foreign)'.
Ludovic Courtès [Tue, 16 Mar 2010 23:45:57 +0000 (00:45 +0100)]
Provide `int', `long', `size_t', etc. in `(system foreign)'.

* libguile/foreign.c (sym_int, sym_long, sym_unsigned_int,
  sym_unsigned_long, sym_size_t): New variables.
  (scm_init_foreign): Define them at the Scheme level.

* module/system/foreign.scm (int, unsigned-int, long,
  unsigned-long, size_t): New exported bindings.

14 years agoFix doc string of `dynamic-pointer'.
Ludovic Courtès [Tue, 16 Mar 2010 23:06:13 +0000 (00:06 +0100)]
Fix doc string of `dynamic-pointer'.

* libguile/dynl.c (scm_dynamic_pointer): Fix doc string.  Reformat body.

14 years agoUse GC-managed pointerless memory in the FFI.
Ludovic Courtès [Tue, 16 Mar 2010 22:51:21 +0000 (23:51 +0100)]
Use GC-managed pointerless memory in the FFI.

* libguile/foreign.c (scm_make_foreign_function): Use
  `scm_gc_malloc_pointerless ()' when allocating memory for CIF.
  (pack): Likewise for the `FFI_TYPE_STRUCT' case.

14 years agoupdate NEWS for 1.9.9
Andy Wingo [Tue, 16 Mar 2010 22:58:34 +0000 (23:58 +0100)]
update NEWS for 1.9.9

* NEWS: Update.

14 years agocull 1.9.8 NEWS items
Andy Wingo [Tue, 16 Mar 2010 21:56:37 +0000 (22:56 +0100)]
cull 1.9.8 NEWS items

* NEWS: Remove 1.9.8 items; they have been folded in already.

14 years agoadd a section to the manual on prompts
Andy Wingo [Tue, 16 Mar 2010 21:47:35 +0000 (22:47 +0100)]
add a section to the manual on prompts

* doc/ref/api-control.texi (Prompts): Add a section on prompts.

14 years agoparallel installability for libguile*.h
Andy Wingo [Tue, 16 Mar 2010 20:37:12 +0000 (21:37 +0100)]
parallel installability for libguile*.h

* Makefile.am:
* libguile/Makefile.am (modincludedir): Install into
  $pkgincludedir/$GUILE_EFFECTIVE_VERSION. This allows multiple Guile
  development packages to be installed at once.

* guile-readline/Makefile.am (modincludedir):
* srfi/Makefile.am (srfiincludedir): Likewise.

* meta/guile-2.0.pc.in (Cflags): Add the appropriate -I line so that
  user code picks up the new location transparently.

14 years agorename libguile to libguile-@EFFECTIVE_VERSION@, currently libguile-2.0
Andy Wingo [Tue, 16 Mar 2010 20:18:12 +0000 (21:18 +0100)]
rename libguile to libguile-@EFFECTIVE_VERSION@, currently libguile-2.0

* libguile/Makefile.am (lib_LTLIBRARIES): Instead of just "libguile.la",
  make "libguile-@EFFECTIVE_VERSION@.la". This allows multiple versions
  of Guile to be installed at once. See
  http://www106.pair.com/rhp/parallel.html for a rationale.

  (libguile_@GUILE_EFFECTIVE_VERSION@_la_CFLAGS):
  (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  (libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES):
  (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD):
  (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Fixup automake vars
  to include the effective version.
  (guile_LDADD): Fix up the spelling of libguile.

* libguile/bytevectors.c (scm_bootstrap_bytevectors):
* libguile/foreign.c (scm_register_foreign):
* libguile/i18n.c (scm_bootstrap_i18n):
* libguile/instructions.c (scm_bootstrap_instructions):
* libguile/objcodes.c (scm_bootstrap_objcodes):
* libguile/programs.c (scm_bootstrap_programs):
* libguile/vm.c (scm_bootstrap_vm): Register extensions using e.g.
  "libguile-2.0" as the libname -- i.e., including the effective version
  in the libname.

* module/ice-9/i18n.scm:
* module/rnrs/bytevector.scm:
* module/rnrs/io/ports.scm:
* module/system/foreign.scm:
* module/system/vm/instruction.scm:
* module/system/vm/objcode.scm:
* module/system/vm/program.scm:
* module/system/vm/vm.scm: When doing a load-extension for something in
  Guile, use the effective version also.

* meta/guile-2.0-uninstalled.pc.in (Libs):
* meta/guile-2.0.pc.in (Libs): Use -lguile-@EFFECTIVE_VERSION@. This
  change should mean that code built against Guile should not be
  affected by the libguile rename.

* guile-readline/Makefile.am (libguilereadline_v_@LIBGUILEREADLINE_MAJOR@_la_LIBADD):
* srfi/Makefile.am
  (libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_LIBADD):
  (libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_LIBADD):
  (libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_LIBADD):
  (libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_LIBADD):
* test-suite/standalone/Makefile.am (test_num2integral_LDADD):
  (test_round_LDADD):
  (libtest_asmobs_la_LIBADD):
  (libtest_ffi_la_LIBADD):
  (test_list_LDADD):
  (test_unwind_LDADD):
  (test_conversion_LDADD):
  (test_loose_ends_LDADD):
  (test_scm_c_read_LDADD):
  (test_scm_take_locale_symbol_LDADD):
  (test_scm_take_u8vector_LDADD):
  (libtest_extensions_la_LIBADD):
  (test_with_guile_module_LDADD):
  (test_scm_with_guile_LDADD): Fix up the spelling of libguile.la.

14 years agoversion.h has SCM_EFFECTIVE_VERSION; effective-version uses that
Andy Wingo [Tue, 16 Mar 2010 19:58:24 +0000 (20:58 +0100)]
version.h has SCM_EFFECTIVE_VERSION; effective-version uses that

* libguile/version.c (scm_effective_version): Use SCM_EFFECTIVE_VERSION.
* libguile/version.h.in (SCM_EFFECTIVE_VERSION): Define from
  GUILE_EFFECTIVE_VERSION.

* libguile/Makefile.am (version.h): Subst in GUILE_EFFECTIVE_VERSION.

* test-suite/tests/version.test ("version reporting works"): The
  effective version is not necessarily MAJOR.MINOR. Remove check.

14 years agoBump GUILE_EFFECTIVE_VERSION to 2.0
Andy Wingo [Tue, 16 Mar 2010 19:27:47 +0000 (20:27 +0100)]
Bump GUILE_EFFECTIVE_VERSION to 2.0

* GUILE-VERSION (GUILE_EFFECTIVE_VERSION): Bump to 2.0.

14 years agodecouple GUILE_VERSION from GUILE_EFFECTIVE_VERSION.
Andy Wingo [Tue, 16 Mar 2010 19:27:10 +0000 (20:27 +0100)]
decouple GUILE_VERSION from GUILE_EFFECTIVE_VERSION.

* GUILE-VERSION (GUILE_VERSION): Decouple from GUILE_EFFECTIVE_VERSION.
  This allows us to bumpt the effective version to 2.0 before reaching 2.0.

14 years agomore vm gc fixen
Andy Wingo [Tue, 16 Mar 2010 14:55:24 +0000 (15:55 +0100)]
more vm gc fixen

* libguile/vm-i-system.c (continuation_call): Sync before calling a
  continuation. Shouldn't much matter, but it seems like a good idea.
  (wind-fluids): More importantly, sync before allocating a with-fluids
  object.

14 years agoconfigure: Abort when GMP is not found.
Ludovic Courtès [Mon, 15 Mar 2010 16:54:45 +0000 (17:54 +0100)]
configure: Abort when GMP is not found.

* configure.ac: Fix erroneous `AC_LIB_HAVE_LINKFLAGS' invocation.  Above
  when $HAVE_LIBGMP is not "yes".

14 years agoMake sure the whole VM stack is always scanned by the GC.
Ludovic Courtès [Mon, 15 Mar 2010 14:39:43 +0000 (15:39 +0100)]
Make sure the whole VM stack is always scanned by the GC.

Thanks to Andy for noticing this.

* libguile/vm-engine.h (SYNC_REGISTER, CACHE_REGISTER): Add comment.

* libguile/vm-i-scheme.c (make_struct): Call `SYNC_REGISTER ()' in all
  cases since the GC is going to run.
  (struct_ref, struct_set): Call `SYNC_REGISTER ()' on the slow path.
  (BV_REF_WITH_ENDIANNESS, BV_FIXABLE_INT_REF, BV_INT_REF): Likewise.
  (BV_FLOAT_REF): Always `SYNC_REGISTER ()'.

14 years agodoc: Update "Multi-Threading" node.
Ludovic Courtès [Sun, 14 Mar 2010 22:37:00 +0000 (23:37 +0100)]
doc: Update "Multi-Threading" node.

* doc/ref/libguile-concepts.texi (Multi-Threading): Remove bits about
  the requirement not to block in guile mode.

14 years agodoc: Remove obsolete reference to the lack of Unicode support.
Ludovic Courtès [Sun, 14 Mar 2010 22:28:12 +0000 (23:28 +0100)]
doc: Remove obsolete reference to the lack of Unicode support.

* doc/ref/api-data.texi (Bytevectors as Strings): Remove obsolete
  footnote on the lack of Unicode support.

* test-suite/tests/bytevectors.test ("2.9 Operations on
  Strings")["string->utf8 [latin-1]", "utf8->string [latin-1]"]: Remove
  use of `with-latin1-locale'.
  ["string->utf32 [Greek]"]: New tests.

14 years agosmall vm.texi updates
Andy Wingo [Sun, 14 Mar 2010 22:28:26 +0000 (23:28 +0100)]
small vm.texi updates

* doc/ref/vm.texi (A Virtual Machine for Guile):
  (VM Concepts, Variables and the VM, Branch Instructions): Small
  updates.

14 years agoadd some vm hook docs
Andy Wingo [Sun, 14 Mar 2010 22:09:56 +0000 (23:09 +0100)]
add some vm hook docs

* doc/ref/api-evaluation.texi (VM Behaviour): Add docs for
  vm-trace-level and set-vm-trace-level!.

14 years ago(debug) at the repl invokes the vm debugger
Andy Wingo [Sun, 14 Mar 2010 22:06:58 +0000 (23:06 +0100)]
(debug) at the repl invokes the vm debugger

* module/ice-9/boot-9.scm (top-repl): Map (debug) at the repl to (system
  vm debug).

* module/system/vm/debug.scm (run-debugger, debugger-repl): Don't take
  the index as an arg, for now anyway.
  (debug): New wrapper.

14 years agoUpdate api-debug.texi; there is a ways to go.
Andy Wingo [Sun, 14 Mar 2010 22:05:42 +0000 (23:05 +0100)]
Update api-debug.texi; there is a ways to go.

* doc/ref/api-debug.texi: Update a bit.

14 years agopmatch license clarification clarifications
Andy Wingo [Sun, 14 Mar 2010 16:48:49 +0000 (17:48 +0100)]
pmatch license clarification clarifications

* module/system/base/pmatch.scm: Clarify the clarifications (somehow
  didn't make it into my last commit).

14 years agoclarify pmatch licensing
Andy Wingo [Sun, 14 Mar 2010 16:46:13 +0000 (17:46 +0100)]
clarify pmatch licensing

* module/system/base/pmatch.scm: Clarify licensing.

14 years agofix critical bug in history.texi
Andy Wingo [Sun, 14 Mar 2010 14:07:44 +0000 (15:07 +0100)]
fix critical bug in history.texi

* doc/ref/history.texi (A Timeline of Selected Guile Releases): Ahem :)

14 years agoupdate "data representation" part of guile internals doc
Andy Wingo [Sun, 14 Mar 2010 13:39:47 +0000 (14:39 +0100)]
update "data representation" part of guile internals doc

* doc/ref/api-control.texi (Handling Errors): Move the "Signalling Type
  Errors" section here.

* doc/ref/data-rep.texi (Data Representation): Refactor, lopping and
  cropping and stitching.

* doc/ref/libguile-concepts.texi (Dynamic Types):
* doc/ref/libguile-smobs.texi (Describing a New Type, Double Smobs):
* doc/ref/guile.texi (Guile Implementation, Programming in C): Adapt to
  refactorings.

* doc/ref/history.texi (A Scheme of Many Maintainers):
  (A Timeline of Selected Guile Releases, Status): Update.

14 years agonarrowing stacks to prompts; backtrace shows frames from start-stack
Andy Wingo [Sat, 13 Mar 2010 20:03:06 +0000 (21:03 +0100)]
narrowing stacks to prompts; backtrace shows frames from start-stack

* libguile/stacks.c (scm_sys_stacks): New global variable, moved here
  from boot-9.scm.
  (scm_init_stacks): Define scm_sys_stacks to %stacks.
  (stack_depth): Remove narrowing by frame pointer.
  (find_prompt): New helper.
  (narrow_stack): Clean up a bit, and allow narrowing by prompt tag.
  (scm_make_stack): Update docs, and use scm_stack_id to get the stack
  id.
  (scm_stack_id): The current stack id may be fetched as the cdar of
  %stacks.
  (stack_id_with_fp): Remove helper.

* module/ice-9/boot-9.scm (%start-stack): Fix indentation.
  (%stacks): Remove definition, it's in stacks.c now.
  (default-pre-unwind-handler): Narrow by another frame.
  (save-stack): Remove special handling for certain stack ids, as it is
  often possible that the function isn't on the stack -- in the
  interpreter, or after a tail call. Better to narrow by prompt ids.

* module/system/vm/debug.scm (print-frames): Change to operate on a
  vector of frames.
  (run-debugger): Change to receive a vector of frames. The debugger
  also has the full stack, so it can re-narrow (or widen) to get the
  whole stack, if the user wants.
  (stack->vector): New helper.
  (debug-pre-unwind-handler): Narrow by more frames, and to the most
  recent start-stack invocation. Adapt to run-debugger change.

14 years agoremove repl-vm; repl evaluation does not cause recursive vm invocation
Andy Wingo [Fri, 12 Mar 2010 11:10:23 +0000 (12:10 +0100)]
remove repl-vm; repl evaluation does not cause recursive vm invocation

* module/system/repl/common.scm (<repl>): Remove "vm" field and repl-vm
  accessor. I think the correct model is to just use the-vm. This change
  was prompted by the need to have the REPL itself not cause a recursive
  VM invocation, so that captured prompts at the REPL are rewindable.
  (make-repl): Remove treatment of #:vm.
  (repl-eval): Load a compiled expression as a simple thunk, avoiding a
  recursive VM call.

* module/system/repl/command.scm (profile, trace): Remove repl-vm
  treatment.
  (backtrace, debugger, step): Remove, as they were not implemented.

14 years agoprompt around REPL evaluations, and around `guile' program invocation
Andy Wingo [Fri, 12 Mar 2010 10:54:26 +0000 (11:54 +0100)]
prompt around REPL evaluations, and around `guile' program invocation

* module/ice-9/control.scm (%): Add a single-argument case, which
  instates a default prompt with a default handler.

* libguile/script.c (scm_compile_shell_switches): Wrap user programs in
  a default prompt.

* module/system/repl/common.scm (repl-eval): REPL expressions are user
  programs too; wrap each one in a default prompt.

14 years agoadd abort to unknown prompt test
Andy Wingo [Thu, 11 Mar 2010 21:36:15 +0000 (22:36 +0100)]
add abort to unknown prompt test

* libguile/control.c (scm_c_abort): Change error string if a prompt
  isn't found.

* test-suite/tests/control.test ("abort to unknown prompt"): New test.

14 years agoremove internal treatment of default prompt tag, it seems there was no need
Andy Wingo [Thu, 11 Mar 2010 21:31:29 +0000 (22:31 +0100)]
remove internal treatment of default prompt tag, it seems there was no need

* libguile/control.h (scm_sys_default_prompt_tag):
* libguile/control.c (scm_init_control): Remove the logic that defined
  %default-prompt-tag.
  (scm_c_abort): Remove check for default prompt tag, it wasn't useful.

* libguile/throw.c (sym_pre_init_catch_tag): Define as the pre-init
  prompt tag.
  (pre_init_catch, pre_init_throw): Use sym_pre_init_catch_tag.

* module/ice-9/boot-9.scm (default-prompt-tag): Define as a simple
  value, not a fluid. Perhaps we can expose it as a fluid later.

14 years agoprompt, abort -> call-with-prompt, abort-to-prompt
Andy Wingo [Tue, 9 Mar 2010 21:24:25 +0000 (22:24 +0100)]
prompt, abort -> call-with-prompt, abort-to-prompt

* module/ice-9/boot-9.scm (default-prompt-tag, make-prompt-tag): New
  functions.
  (call-with-prompt, abort-to-prompt): Rename from `prompt' and `abort',
  respectively. These names are more clear, and allow `prompt' and
  `abort' to have more convenient, less general bindings.
  (default-throw-handler, custom-throw-handler, catch, %start-stack):
  Adapt callers.

* module/ice-9/control.scm: Adapt re-export list.
  (control): Remove binding, until we're sure that it is Sitaram's
  control.
  (abort): New binding, aborts to the nearest prompt with the default
  tag.
  (%): Use call-with-prompt.

* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  (*interesting-primitive-names*): Adapt for prompt/abort changes.

* test-suite/tests/control.test: Take advantage of the defaults for %
  and abort.

14 years ago%start-stack in Scheme, in terms of prompts
Andy Wingo [Sun, 7 Mar 2010 21:37:57 +0000 (22:37 +0100)]
%start-stack in Scheme, in terms of prompts

* libguile/debug.h:
* libguile/debug.c (scm_sys_start_stack): Removed, we implement this in
  Scheme now.

* libguile/vm.h:
* libguile/vm.c (scm_vm_call_with_new_stack): Likewise removed.

* module/ice-9/boot-9.scm (%start-stack): Implement in terms of prompts.
  (%stacks): New fluid, for tracking active stacks.
  (start-stack): Implement using syntax-rules.

14 years agofix continuation printing bug
Andy Wingo [Sun, 7 Mar 2010 21:19:13 +0000 (22:19 +0100)]
fix continuation printing bug

* libguile/programs.c (scm_i_program_print): Fix bug printing
  continuations.

14 years agoDon't export `write-bytecode' from `(language assembly compile-bytecode)'.
Ludovic Courtès [Sun, 7 Mar 2010 22:53:22 +0000 (23:53 +0100)]
Don't export `write-bytecode' from `(language assembly compile-bytecode)'.

* module/language/assembly/compile-bytecode.scm: Don't export
  `write-bytecode'.

* test-suite/tests/asm-to-bytecode.test (write-bytecode): New global
  variable.

14 years agoAdd wide-string compilation test.
Ludovic Courtès [Sun, 7 Mar 2010 22:51:40 +0000 (23:51 +0100)]
Add wide-string compilation test.

* test-suite/tests/asm-to-bytecode.test ("compiler")[load-wide-string
  "λ"]: New test.

14 years agoFix miscompilation of non-ASCII Latin-1 strings.
Ludovic Courtès [Sun, 7 Mar 2010 22:45:14 +0000 (23:45 +0100)]
Fix miscompilation of non-ASCII Latin-1 strings.

The bug was introduced dad6817f ("Use the R6RS I/O API in
`write-bytecode'.").

* module/language/assembly/compile-bytecode.scm
  (write-bytecode)[write-string]: Rename to...
  [write-latin1-string]: ... this.  Add the `write-loader-len' call.
  Write each character individually instead of using `string->utf8'.
  [write-loader]: Remove.

* test-suite/tests/asm-to-bytecode.test ("compiler")[load-string "æ"]:
  New test.

14 years agoRecycle fluid numbers.
Ludovic Courtès [Fri, 5 Mar 2010 12:38:28 +0000 (13:38 +0100)]
Recycle fluid numbers.

* libguile/fluids.c: Remove outdated comment on the complexity of fluid GC.
  (FLUID_GROW): Increase to 128.
  (allocated_fluids): Change to `void **'.
  (allocated_fluids_num): Remove.
  (grow_dynamic_state): Remove race-condition checker.  Grow to
  ALLOCATED_FLUIDS_LEN.
  (next_fluid_num): Rename to...
  (new_fluid): ... this.  Return a fluid instead of a fluid number.
  Assume ALLOCATED_FLUIDS is sparse and search for a free number in it.
  Make ALLOCATED_FLUIDS point to pointerless memory and initialize
  individual elements with a pointer to the new fluid.  Register a
  disappearing link from there to the fluid.
  (scm_make_fluid): Use `new_fluid ()'.
  (scm_fluid_ref, scm_fluid_set_x, scm_i_swap_with_fluids): Remove
  assertion that wasn't checked in a thread-safe way.

14 years agoAdd new fluid tests.
Ludovic Courtès [Fri, 5 Mar 2010 10:41:42 +0000 (11:41 +0100)]
Add new fluid tests.

* test-suite/tests/fluids.test ("initial fluid values")["initial value
  is inherited from parent thread"]: New test.
  ("fluid values are thread-local"): New test.

14 years agoDon't gratuitously over-engineer things...
Ludovic Courtès [Fri, 5 Mar 2010 08:49:04 +0000 (09:49 +0100)]
Don't gratuitously over-engineer things...

* libguile/eval.c (eval)[SCM_M_CALL]: Always use `alloca' for ARGV.

14 years agoSlightly optimize the memoizer, bootstrap evaluator, and `(ice-9 eval)'.
Ludovic Courtès [Thu, 4 Mar 2010 23:20:18 +0000 (00:20 +0100)]
Slightly optimize the memoizer, bootstrap evaluator, and `(ice-9 eval)'.

* libguile/eval.c (CAR, CDR, CAAR, CADR, CDAR, CDDR, CADDR, CDDDR): Use
  the macro variants, not the functions.
  (eval)[SCM_M_CALL]: When invoking a VM program, accumulate its
  arguments on the stack rather than on the heap.

* libguile/memoize.c (CAR, CDR, CAAR, CADR, CDAR, CDDR, CADDR, CDDDR,
  CADDR): Use the macro variants, not the functions.
  (scm_memoized_expression_typecode): Use `SCM_I_MAKINUM' instead of
  `scm_from_uint16'.

14 years agoRemove obsolete compile-time option for freelist debugging.
Ludovic Courtès [Thu, 4 Mar 2010 22:28:38 +0000 (23:28 +0100)]
Remove obsolete compile-time option for freelist debugging.

* configure.ac: Remove `--enable-debug-freelist' option and
  `SCM_I_GSC_GUILE_DEBUG_FREELIST' substitution variable.

* libguile/gen-scmconfig.c (main): Remove references to
  `SCM_I_GSC_GUILE_DEBUG_FREELIST' and `GUILE_DEBUG_FREELIST'.

* libguile/gen-scmconfig.h.in (SCM_I_GSC_GUILE_DEBUG_FREELIST): Remove.

14 years agosome with-fluid* -> with-fluids
Andy Wingo [Thu, 4 Mar 2010 15:50:11 +0000 (16:50 +0100)]
some with-fluid* -> with-fluids

* module/ice-9/boot-9.scm (false-if-exception, load)
  (try-module-autoload):
* module/language/tree-il/compile-glil.scm (compile-glil): Turn some
  with-fluid* invocations into with-fluids.

14 years agopartial continuations print as #<partial-continuation ...>
Andy Wingo [Thu, 4 Mar 2010 11:02:02 +0000 (12:02 +0100)]
partial continuations print as #<partial-continuation ...>

* libguile/control.c (reify_partial_continuation):
* libguile/programs.c (scm_i_program_print):
* libguile/programs.h (SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION)
  (SCM_PROGRAM_IS_PARTIAL_CONTINUATION): Distinguish partial
  continuations from full continuations.

14 years agotighten up scm_i_dowinds, fixing invalid SCM_CAR (prompt)
Andy Wingo [Thu, 4 Mar 2010 10:37:03 +0000 (11:37 +0100)]
tighten up scm_i_dowinds, fixing invalid SCM_CAR (prompt)

* libguile/dynwind.c: Update comment regarding what can be on the wind
  stack.
  (scm_i_dowinds): Clean up to remove @bind and catch/throw-handler
  cases, to add a case for prompts, and to be more strict in general
  regarding the set of things that can be on the wind stack. Fixes a bug
  whereby prompts were accessed via SCM_CAR; thanks to Ken Raeburn for
  the report.

14 years agoadd printers for prompts and with-fluids objects
Andy Wingo [Thu, 4 Mar 2010 10:25:22 +0000 (11:25 +0100)]
add printers for prompts and with-fluids objects

* libguile/control.c:
* libguile/control.h (scm_i_prompt_print):
* libguile/fluids.c:
* libguile/fluids.h (scm_i_with_fluids_print):
* libguile/print.c (iprin1): Add printers for prompts and with-fluids
  objects.

14 years agoTry to avoid `guile-test' failures when it can't display the name of a test.
Ludovic Courtès [Thu, 4 Mar 2010 10:32:51 +0000 (11:32 +0100)]
Try to avoid `guile-test' failures when it can't display the name of a test.

This can happen, e.g., when printing "UNRESOLVED: regexp.test: TEST-NAME",
where TEST-NAME contains characters that cannot be converted to the
encoding of the current output or error port.

* test-suite/guile-test (main): Set the conversion strategy for the
  output and error ports to `escape'.

* test-suite/tests/regexp.test (current-output-port): Likewise.

14 years agoThe load-module routine tries to interpret relative paths relative to
Ken Raeburn [Sun, 21 Feb 2010 20:35:37 +0000 (15:35 -0500)]
The load-module routine tries to interpret relative paths relative to
the module currently being loaded (i.e., make-texinfo.scm itself),
resulting in confusing behavior for offset builds.  So, don't use
them.

* doc/ref/Makefile.am ($(snarf_doc).texi): Use an absolute path for
  the input file.

14 years agoWrite the test suite log file in UTF-8.
Ludovic Courtès [Wed, 3 Mar 2010 23:54:18 +0000 (00:54 +0100)]
Write the test suite log file in UTF-8.

* test-suite/guile-test (main): Set LOG-PORT's encoding to UTF-8.

14 years agoUse `with-latin1-locale' in `regexp.test'.
Ludovic Courtès [Wed, 3 Mar 2010 23:47:21 +0000 (00:47 +0100)]
Use `with-latin1-locale' in `regexp.test'.

As a side effect, it fixes tests on platforms with no 8-bit locale and
where executing regexps on characters >= 128 can lead to errors such as
`cannot convert to output locale "US-ASCII": ""\x80""'.

This commit partially reverts 7583976b ("More setlocale robustness in
regexp tests").

* test-suite/tests/regexp.test (mysetlocale, set-latin-1): Remove.
  ("regexp-quote"): Use `with-latin1-locale' instead of the above
  procedures.

14 years agoMove Latin-1 locale fiddling to `(test-suite lib)'.
Ludovic Courtès [Wed, 3 Mar 2010 23:39:18 +0000 (00:39 +0100)]
Move Latin-1 locale fiddling to `(test-suite lib)'.

* test-suite/lib.scm (with-latin1-locale*): New procedure.
  (with-latin1-locale): New macro.

* test-suite/tests/bytevectors.test (with-locale, with-latin1-locale):
  Remove.  Adjust users.

14 years agoFix `with-locale*' in `(test-suite lib)'.
Ludovic Courtès [Wed, 3 Mar 2010 22:57:50 +0000 (23:57 +0100)]
Fix `with-locale*' in `(test-suite lib)'.

* test-suite/lib.scm (with-locale*): Set LOC to the previous locale
  name, not to the new locale name.  Only restore LOC when it's not #f.
  (with-locale): Use `syntax-rules'.

14 years agopsyntax expander tracks changes to current module in top-level begin
Andy Wingo [Wed, 3 Mar 2010 22:09:08 +0000 (23:09 +0100)]
psyntax expander tracks changes to current module in top-level begin

* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/psyntax.scm (chi-top-sequence): Track changes to the
  current module. Allows e.g. top-level `define-module' within a begin
  to work.

* test-suite/tests/syncase.test ("changes to expansion environment"):
  Enable test.

14 years agouse anonymous mv-bind in compile-glil.scm; fix abort compilation bug
Andy Wingo [Wed, 3 Mar 2010 19:57:18 +0000 (20:57 +0100)]
use anonymous mv-bind in compile-glil.scm; fix abort compilation bug

* module/language/tree-il/compile-glil.scm (flatten): Change to use the
  anonymous <glil-mv-bind> form when truncating to 0 or 1 values. In
  those cases, remove the <glil-unbind> statements. As a side effect,
  fixes compilation of abort in a "values" context.

  Thanks to Tristan Colgate for the bug report.

* test-suite/tests/tree-il.test: Update to expect anonymous mv-bind.

14 years ago<glil-mv-bind> can truncate values anonymously
Andy Wingo [Wed, 3 Mar 2010 19:55:42 +0000 (20:55 +0100)]
<glil-mv-bind> can truncate values anonymously

* module/language/glil/compile-assembly.scm (glil->assembly): Allow an
  integer for `vars', which means simply to truncate the values, and not
  pass binding metadata to the compiler.

14 years agoadd more tests to control.test
Andy Wingo [Wed, 3 Mar 2010 19:54:05 +0000 (20:54 +0100)]
add more tests to control.test

* test-suite/tests/control.test ("restarting partial continuations"):
  Add more tests, for `abort' in different positions. All succeed in the
  evaluator but fail with the compiler.

14 years agoFix off-by-one error in the off-by-one fix of `make-srfi-4-vector'.
Ludovic Courtès [Wed, 3 Mar 2010 09:18:41 +0000 (10:18 +0100)]
Fix off-by-one error in the off-by-one fix of `make-srfi-4-vector'.

This is a followup to d900a8557db21641413db8995a7cdc1453adbe1f ("Fix
off-by-one error when initializing vectors in `make-srfi-4-vector'.").

* libguile/srfi-4.c (scm_make_srfi_4_vector): Don't initialize RET when
  LEN is zero.

14 years agoAdd test checking whether fluids are GC'd.
Ludovic Courtès [Tue, 2 Mar 2010 23:36:41 +0000 (00:36 +0100)]
Add test checking whether fluids are GC'd.

* test-suite/tests/fluids.test ("fluids are GC'd"): New test.

14 years agoFix "coding:" cookies in the test suite.
Ludovic Courtès [Tue, 2 Mar 2010 22:36:29 +0000 (23:36 +0100)]
Fix "coding:" cookies in the test suite.

* test-suite/tests/bytevectors.test, test-suite/tests/keywords.test,
  test-suite/tests/procprop.test, test-suite/tests/srfi-35.test,
  test-suite/tests/srfi-88.test: Add "coding:" cookie on the first line.

14 years agoFix off-by-one error when initializing vectors in `make-srfi-4-vector'.
Ludovic Courtès [Tue, 2 Mar 2010 22:16:26 +0000 (23:16 +0100)]
Fix off-by-one error when initializing vectors in `make-srfi-4-vector'.

* libguile/srfi-4.c (scm_make_srfi_4_vector): When FILL is bound and
  non-zero, initialize the last element.

* test-suite/tests/srfi-4.test ("TAG vectors")["make-TAGvector"]: New
  tests.

14 years agoUse libguile/control.x explicitly.
Ken Raeburn [Sun, 21 Feb 2010 20:13:10 +0000 (15:13 -0500)]
Use libguile/control.x explicitly.

14 years agoChange failing syncase test case to UNRESOLVED.
Julian Graham [Tue, 2 Mar 2010 03:15:45 +0000 (22:15 -0500)]
Change failing syncase test case to UNRESOLVED.

* test-suite/tests/syncase.test:
  ("expander detects changes to current-module"): Throw 'unresolved instead of
  returning #f.

14 years agoadd (currently failing) test case for changing the current module inside
Julian Graham [Sat, 27 Feb 2010 20:04:56 +0000 (15:04 -0500)]
add (currently failing) test case for changing the current module inside
`begin' form

* test-suite/tests/syncase.scm: ("expander detects changes to current-module"):
  New test case.

14 years agorewinding prompts works
Andy Wingo [Fri, 26 Feb 2010 12:05:25 +0000 (13:05 +0100)]
rewinding prompts works

* libguile/control.h (SCM_PROMPT_HANDLER): Remove, it was unused.
  (SCM_PROMPT_DYNWINDS): Rename from SCM_PROMPT_DYNENV.

* libguile/control.c: (scm_c_make_prompt): Take another arg, the winds
  that are to be in place for the prompt. Fix allocation to be 4 words
  instead of 5 (the handler was never used).

* libguile/eval.c (eval):
* libguile/throw.c (pre_init_catch): Adapt to scm_c_make_prompt change.

* libguile/vm-i-system.c (partial-cont-call): Grovel the new elements of
  the wind list in order to call setjmp() on the new prompts. Pass
  cookie to vm_reinstate_partial_continuation.
  (prompt): Adapt to scm_c_make_prompt change.

* libguile/vm.c (vm_reinstate_partial_continuation): Take a cookie arg,
  used when winding captured prompts onto the stack. Winding a prompt
  implies making a new prompt, actually -- with new registers, a new
  jump buffer, new winds, etc.

* test-suite/tests/control.test ("rewinding prompts"): Add a test for
  rewinding prompts.

14 years agocatch, throw, with-throw-handler implemented in Scheme
Andy Wingo [Sun, 31 Jan 2010 12:02:39 +0000 (13:02 +0100)]
catch, throw, with-throw-handler implemented in Scheme

* libguile/throw.c (tc16_jmpbuffer, tc16_pre_unwind_data): Remove these
  smob types, and associated constructors and accessors (all internal).
  (scm_catch, scm_catch_with_pre_unwind_handler):
  (scm_with_throw_handler, scm_throw): Simply dispatch to scheme.
  Lovely.
  (tc16_catch_closure): Introduce a new applicable smob type, for use by
  the C catch interface. All constructors and accessors are internal.
  (scm_c_catch, scm_internal_catch, scm_c_with_throw_handler): Build
  applicable smobs out of the C procedure arguments, so we can then
  dispatch through scm_catch et al.
  (scm_ithrow): Dispatch to scm_throw.
  (pre_init_catch, pre_init_throw): Restricted catch/throw
  implementation for use before boot-9 runs.
  (scm_init_throw): Bind the pre-init catch and throw definitions.

* module/ice-9/boot-9.scm (prompt, abort): Move these definitions up in
  the file.
  (catch, throw, with-throw-handler): Implement in Scheme. Whee!

14 years agodeprecate lazy-catch
Andy Wingo [Sun, 31 Jan 2010 11:35:19 +0000 (12:35 +0100)]
deprecate lazy-catch

* libguile/deprecated.h:
* libguile/deprecated.c (scm_internal_lazy_catch, scm_lazy_catch):
  Deprecate, and print out a nasty warning that people should change to
  with-throw-handler.

* libguile/throw.h:
* libguile/throw.c (scm_c_with_throw_handler): Deprecate the use of the
  lazy_catch_p argument, printing out a nasty warning if someone
  actually passes 1 as that argument. The combination of the pre-unwind
  and post-unwind handlers should be sufficient.

* test-suite/tests/exceptions.test: Remove lazy-catch tests, as they are
  deprecated. Two of them fail:
  * throw/catch: effect of lazy-catch unwinding on throw to another key
  * throw/catch: repeat of previous test but with lazy-catch
  Hopefully people are not depending on this behavior, and the warning is
  sufficiently nasty for people to switch. We will see.

* test-suite/tests/eval.test ("promises"): Use with-throw-handler
  instead of lazy-catch.

* doc/ref/api-debug.texi:
* doc/ref/api-control.texi: Update to remove references to lazy-catch,
  folding in the useful bits to with-throw-handler.

14 years agofix a prompt bug
Andy Wingo [Thu, 25 Feb 2010 16:33:12 +0000 (17:33 +0100)]
fix a prompt bug

* libguile/control.h:
* libguile/control.c (scm_c_make_prompt): Instead of taking a VM arg,
  take the registers directly.
  (scm_c_abort): Declare as returning void. In fact it will never
  return.

* libguile/eval.c (eval):
* libguile/throw.c (pre_init_catch): Adapt to prompt API change.

* libguile/vm-i-system.c (prompt): Pass the abort ip as the ip to
  scm_c_make_prompt. This fixes a bug in which we used the "offset"
  local var, but it wasn't guaranteed to be around after a longjmp.

14 years agosimplify handling of nonlocal prompt returns from c
Andy Wingo [Thu, 25 Feb 2010 12:17:34 +0000 (13:17 +0100)]
simplify handling of nonlocal prompt returns from c

* libguile/control.h:
* libguile/control.c (scm_i_prompt_pop_abort_args_x): New helper.

* libguile/eval.c (eval): Use the new helper.

14 years agomore substance to control.test
Andy Wingo [Wed, 24 Feb 2010 23:41:03 +0000 (00:41 +0100)]
more substance to control.test

* test-suite/tests/control.test ("suspend/resume with fluids"):
  ("restarting partial continuations"):
  ("reified continuations", "escape-only continuations"): More tests.
eval.scm's handling of with-fluids doesn't leave the VM

* module/ice-9/eval.scm (primitive-eval): Implement with-fluids in terms
  of with-fluids, to avoid recursively calling the VM via with-fluids*.

14 years agoeval.scm's handling of with-fluids doesn't leave the VM
Andy Wingo [Wed, 24 Feb 2010 23:32:40 +0000 (00:32 +0100)]
eval.scm's handling of with-fluids doesn't leave the VM

* module/ice-9/eval.scm (primitive-eval): Implement with-fluids in terms
  of with-fluids, to avoid recursively calling the VM via with-fluids*.

14 years agoerror if given an unrewindable partial continuation
Andy Wingo [Wed, 24 Feb 2010 23:18:07 +0000 (00:18 +0100)]
error if given an unrewindable partial continuation

* libguile/vm-engine.c (vm_error_continuation_not_rewindable):
* libguile/vm-i-system.c (partial-cont-call):
* libguile/vm.h (SCM_VM_CONT_PARTIAL_P):
  (SCM_VM_CONT_REWINDABLE_P): Fix a bug in which we weren't checking if
  a partial continuation was actually rewindable.

14 years agofix embarrassing bug
Andy Wingo [Wed, 24 Feb 2010 23:43:44 +0000 (00:43 +0100)]
fix embarrassing bug

* libguile/vm.c: Fix embarrassing error regarding the symbolitude of
  vm-error and friends.

14 years agostart of tests for (ice-9 control)
Andy Wingo [Wed, 24 Feb 2010 22:33:20 +0000 (23:33 +0100)]
start of tests for (ice-9 control)

* test-suite/Makefile.am:
* test-suite/tests/control.test: Add the beginnings of a delimited
  continuations test suite.

14 years agofix symbol initialization in vm.c
Andy Wingo [Wed, 24 Feb 2010 22:32:04 +0000 (23:32 +0100)]
fix symbol initialization in vm.c

* libguile/vm.c (scm_bootstrap_vm): Fix case in which some symbols
  wouldn't be initialized by the time they were needed.

14 years ago(ice-9 control) fixes
Andy Wingo [Wed, 24 Feb 2010 22:20:38 +0000 (23:20 +0100)]
(ice-9 control) fixes

* module/ice-9/control.scm (%): Fix to allow tagged and default-tagged
  prompts.
  (abort): Re-export.

14 years agofix escape-only prompts
Andy Wingo [Wed, 24 Feb 2010 22:19:41 +0000 (23:19 +0100)]
fix escape-only prompts

* libguile/control.c (scm_c_make_prompt): Whoops, set the escape-only
  flag properly here.

14 years agoadd %default-prompt-tag, and error (not abort()) on an abort to bad tag
Andy Wingo [Wed, 24 Feb 2010 17:55:34 +0000 (18:55 +0100)]
add %default-prompt-tag, and error (not abort()) on an abort to bad tag

* libguile/init.c (scm_i_init_guile): Call scm_init_control after
  initing fluids.
* libguile/control.h (scm_sys_default_prompt_tag): New internal var.
* libguile/control.c (scm_c_abort): If abort is called for an unknown
  tag, raise an exception, except if the tag was the default prompt tag,
  in which case really abort -- to prevent recursion when some other
  patches land.
  (scm_init_control): Define %default-prompt-tag in the default
  environment.

14 years agoturn abort() calls in vm.c into exceptions
Andy Wingo [Wed, 24 Feb 2010 17:51:25 +0000 (18:51 +0100)]
turn abort() calls in vm.c into exceptions

* libguile/vm.c (vm_return_to_continuation, vm_abort):
  (vm_reinstate_partial_continuation, really_make_boot_program): Turn
  some abort()s into scm_misc_errors.

14 years agorewind the dynamic state when entering a partial continuation
Andy Wingo [Wed, 24 Feb 2010 16:43:02 +0000 (17:43 +0100)]
rewind the dynamic state when entering a partial continuation

* libguile/control.c (cont_objcode):
* libguile/vm-i-system.c (partial-cont-call):
* libguile/vm.c (vm_reinstate_partial_continuation): Don't keep the
  "external winds" in a partial continuation, as they aren't logically
  part of the continuation. Reinstate the "internal winds" when entering
  a partial continuation. Things seem to work!

14 years agopartial-cont-call works
Andy Wingo [Wed, 24 Feb 2010 15:56:45 +0000 (16:56 +0100)]
partial-cont-call works

* libguile/vm-i-system.c (partial-cont-call): Sync registers before
  splatting a partial continuation, and cache them back afterwards.

* libguile/vm.c (vm_reinstate_partial_continuation): Actually implement,
  except dynamic-wind.

14 years agorecord IP in partial continuations
Andy Wingo [Wed, 24 Feb 2010 15:56:05 +0000 (16:56 +0100)]
record IP in partial continuations

* libguile/control.c (reify_partial_continuation): Assert some
  invariants, and record the IP as the MVRA of the continuation.

14 years agoensure non-escape-only prompts have a thunk application as their body
Andy Wingo [Tue, 23 Feb 2010 23:32:07 +0000 (00:32 +0100)]
ensure non-escape-only prompts have a thunk application as their body

* module/language/tree-il/inline.scm (inline!): Fix indenting for
  lambda-case. In an amusing turn of events, use the inliner to
  de-inline prompt bodies, if the prompt is not escape-only.

14 years agoactually capture partial continuations
Andy Wingo [Mon, 22 Feb 2010 22:00:19 +0000 (23:00 +0100)]
actually capture partial continuations

* libguile/control.c (cont_objcode): Along with a bunch of boilerplate
  that certainly needs to go in some central place, define this
  continuation-calling trampoline.
  (reify_partial_continuation): New function, returns a procedure that
  when called will reinstate a partial continuation.
  (scm_c_abort): Take an extra arg, the cookie. Actually reify a
  continuation.
  (scm_at_abort): Adapt to scm_c_abort change.

* libguile/control.h: Declare scm_c_abort change.

* libguile/vm-i-system.c (partial_cont_call): New instruction.
  (call/cc, tail-call/cc): Adapt to scm_i_vm_capture_stack change.
  (abort): Pass vm_cookie to abort.

* libguile/vm.h (SCM_F_VM_CONT_PARTIAL, SCM_F_VM_CONT_REWINDABLE): New
  flags.
  (struct scm_vm_cont): Add flags field.
  (SCM_VM_CONT_PARTIAL_P, SCM_VM_CONT_REWINDABLE_P): New predicates.

* libguile/vm.c (scm_i_vm_capture_stack): Rename from
  vm_capture_continuation, and make internal instead of static. Take a
  flags argument.
  (scm_i_vm_capture_continuation): Adapt to scm_i_vm_capture_stack
  change.
  (vm_abort): Plumb cookie to scm_c_abort.
  (vm_reinstate_partial_continuation): New stub.

14 years agotweaks to default program printer
Andy Wingo [Mon, 22 Feb 2010 21:41:34 +0000 (22:41 +0100)]
tweaks to default program printer

* libguile/programs.c (scm_i_program_print): Instead of printing the
  address of the objcode, print the address of the program itself. Also
  for continuations.

14 years agoabort always dispatches to VM bytecode, to detect same-invocation aborts
Andy Wingo [Mon, 22 Feb 2010 20:53:24 +0000 (21:53 +0100)]
abort always dispatches to VM bytecode, to detect same-invocation aborts

* libguile/control.h:
* libguile/control.c (scm_c_make_prompt): Take an extra arg, a cookie.
  Continuations will be rewindable only if the abort has the same cookie
  as the prompt.
  (scm_at_abort): Redefine from scm_abort, and instead of taking rest
  args, take the abort values as a list directly. Also, don't allow
  rewinding, because we won't support rewinding the C stack with
  delimited continuations.

* libguile/eval.c (eval): Adapt to scm_c_make_prompt change.

* libguile/vm-engine.c (vm_engine): Use vp->cookie to get a unique value
  corresponding to this VM invocation.
* libguile/vm-i-system.c (prompt): Pass the cookie to scm_c_make_prompt.
  (abort): Take an additional tail arg.
* libguile/vm.c (vm_abort): Parse out the abort tail arg. This is for
  the @abort case, or the (apply abort ...) case.
  (make_vm): Initialize the cookie to 0.
* libguile/vm.h (struct scm_vm): Add cookie.

* module/ice-9/boot-9.scm (abort): Define here as a trampoline to
  @abort. Needed to make sure that a call to abort dispatches to a VM
  opcode, so the cookie will be the same.

* module/language/tree-il.scm (<tree-il>): Add a "tail" field to
  <abort>, for the (apply abort ...) case, or (@abort tag args). Should
  be #<const ()> in the normal case. Add support throughout.
* module/language/tree-il/analyze.scm (analyze-lexicals): Add abort-tail
  support here too.

* module/language/tree-il/compile-glil.scm (flatten): Compile the tail
  argument appropriately.
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Fix
  @abort and abort cases to pass the tail arg to make-abort.

14 years agoprompt and abort inlining
Andy Wingo [Mon, 22 Feb 2010 19:29:10 +0000 (20:29 +0100)]
prompt and abort inlining

* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*): Add abort.
  (*primitive-expand-table*): Fix so that we inline `prompt' and
  `abort', and remove obsolete code dealing in `control'.

14 years agofix <prompt> compilation bug
Andy Wingo [Mon, 22 Feb 2010 19:19:32 +0000 (20:19 +0100)]
fix <prompt> compilation bug

* module/language/tree-il/analyze.scm (analyze-lexicals): Fix bug
  analysing <prompt> expressions.

14 years agoprompt as part of guile's primitive language
Andy Wingo [Fri, 19 Feb 2010 21:44:24 +0000 (22:44 +0100)]
prompt as part of guile's primitive language

* libguile/control.h:
* libguile/control.c: Remove scm_atcontrol and scm_atprompt.
  (scm_c_make_prompt): Remove handler arg, as the handler is inline.
  (scm_abort): New primitive, exported to Scheme as `abort'. The
  compiler will also recognize calls to `abort', but this is the base
  case.
  (scm_init_control): Remove scm_register_control, just have this
  function, which adds `abort' to the `(guile)' module.

* libguile/eval.c (eval): Add SCM_M_PROMPT case.

* libguile/init.c (scm_i_init_guile): Change scm_register_control call
  into a nice orderly scm_init_control call.

* libguile/memoize.h: (scm_sym_at_prompt, SCM_M_PROMPT):
* libguile/memoize.c (MAKMEMO_PROMPT, scm_m_at_prompt, unmemoize): Add
  prompt support to the memoizer.

* libguile/vm-i-system.c (prompt): Fix to not expect a handler on the
  stack.

* module/ice-9/boot-9.scm (prompt): Add definition in terms of @prompt.

* module/ice-9/control.scm: Simplify, and don't play with the compiler
  here, now that prompt and abort are primitive.

* module/ice-9/eval.scm (primitive-eval): Add a prompt case.

* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*): Add @prompt and prompt.

14 years agofix prompt disassembly bug
Andy Wingo [Fri, 19 Feb 2010 21:35:00 +0000 (22:35 +0100)]
fix prompt disassembly bug

* module/language/assembly/disassemble.scm (code-annotation): Fix a bug
  disassembling `prompt'.

14 years agoadd scm_c_abort, wire it up to the abort opcode
Andy Wingo [Fri, 19 Feb 2010 15:55:36 +0000 (16:55 +0100)]
add scm_c_abort, wire it up to the abort opcode

* libguile/control.h:
* libguile/control.c (scm_c_abort): Add an implementation of `abort',
  but it doesn't reify the continuation yet.

* libguile/vm-i-system.c (abort):
* libguile/vm.c (vm_abort): Wire up the call to `abort', avoiding
  consing the args into a list.

* module/language/tree-il/compile-glil.scm (flatten): Add some compily
  bits that can allow the abort to be resumed.

14 years agoprompt handlers are always inline
Andy Wingo [Fri, 19 Feb 2010 14:30:34 +0000 (15:30 +0100)]
prompt handlers are always inline

* libguile/control.h (SCM_F_PROMPT_INLINE, SCM_PROMPT_INLINE_P): Remove;
  prompts always have "inline" handlers now.
* libguile/control.c (scm_c_make_prompt): Remove inline_handler_p arg.

* libguile/vm-i-system.c (prompt):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/compile-bytecode.scm (write-bytecode):
 Adapt to prompt changes.

* module/language/glil.scm (make-glil-prompt, glil-prompt-inline?):
  Remove inline? flag.
  (parse-glil, unparse-glil):
* module/language/glil/compile-assembly.scm (glil->assembly): Adapt to
  <glil-prompt> change.

* module/language/tree-il/compile-glil.scm (flatten): Require the
  handler of a <prompt> to be a lambda-case.

* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Ensure that the handler of a <prompt> is a lambda-case.

* module/language/tree-il/inline.scm (inline!): Simplify a degenerate
  case: (lambda args (apply (lambda ...) args)) => (lambda ...).

14 years agofluid-ref / fluid-set! compile to dynref/dynset
Andy Wingo [Fri, 19 Feb 2010 10:50:51 +0000 (11:50 +0100)]
fluid-ref / fluid-set! compile to dynref/dynset

* module/language/tree-il/primitives.scm: Resolve fluid-ref and
  fluid-set! as primitives, and thence to dynref/dynset.

14 years agoadd <dynref> and <dynset> to tree-il
Andy Wingo [Fri, 19 Feb 2010 10:42:00 +0000 (11:42 +0100)]
add <dynref> and <dynset> to tree-il

* module/language/tree-il.scm (<dynref>, <dynset>): New tree-il language
  elements, corresponding to fluid-ref and fluid-set.
* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm: Wire them up in the usual
  manner.

14 years agonew VM operations: fluid-ref, fluid-set
Andy Wingo [Fri, 19 Feb 2010 10:40:09 +0000 (11:40 +0100)]
new VM operations: fluid-ref, fluid-set

* libguile/vm-i-system.c (fluid-ref, fluid-set): New VM ops.

14 years agofluids.h exposes more of its interface, internally at least
Andy Wingo [Fri, 19 Feb 2010 10:39:44 +0000 (11:39 +0100)]
fluids.h exposes more of its interface, internally at least

* libguile/fluids.h (SCM_I_FLUID_P, SCM_I_FLUID_NUM)
  (SCM_I_DYNAMIC_STATE_P, SCM_I_DYNAMIC_STATE_FLUIDS): Expose these
  predicates and accessors, internally at least.
* libguile/fluids.c (IS_FLUID, FLUID_NUM, IS_DYNAMIC_STATE)
  (DYNAMIC_STATE_FLUIDS): Implement in terms of the exposed macros.

14 years agovm caches the dynamic state in a local var
Andy Wingo [Fri, 19 Feb 2010 10:37:42 +0000 (11:37 +0100)]
vm caches the dynamic state in a local var

* libguile/vm-engine.c (vm_engine): Cache the dynamic state in a local
  var when we enter the VM.
* libguile/vm-i-system.c (wind-fluids, unwind-fluids): Use the cached
  dynamic state instead of going through SCM_I_CURRENT_THREAD.

14 years agorename <control> to <abort>
Andy Wingo [Fri, 19 Feb 2010 09:49:24 +0000 (10:49 +0100)]
rename <control> to <abort>

* libguile/vm-i-system.c (abort): Rename instruction from `throw'.
* libguile/vm.c (vm_abort): Rename from vm_throw.
* module/language/tree-il.scm (<abort>, make-abort, abort-src,
  abort-tag, abort-args: Rename from <control> & company.

* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/primitives.scm: Fix all callers.

14 years ago<prompt> has no pre-unwind-handler, it's unnecessary
Andy Wingo [Thu, 18 Feb 2010 22:56:12 +0000 (23:56 +0100)]
<prompt> has no pre-unwind-handler, it's unnecessary

* libguile/control.h:
* libguile/control.c (scm_c_make_prompt, SCM_PROMPT_PRE_UNWIND_HANDLER):
* libguile/vm-i-system.c (prompt)
* module/language/tree-il.scm (<prompt> prompt-pre-unwind-handler):
* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/inline.scm:
* module/language/tree-il/primitives.scm: Remove the "pre-unwind"
  handler from prompt; it turns out not to be necessary. Adapt all
  references.