bpt/guile.git
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.

14 years agore-expand psyntax-pp
Andy Wingo [Fri, 19 Feb 2010 11:07:40 +0000 (12:07 +0100)]
re-expand psyntax-pp

* module/ice-9/psyntax-pp.scm: Expand again so we actually use
  with-fluids.

14 years agofix tree-il->scheme bug for <dynlet>
Andy Wingo [Fri, 19 Feb 2010 11:07:02 +0000 (12:07 +0100)]
fix tree-il->scheme bug for <dynlet>

* module/language/tree-il.scm (tree-il->scheme): Bugfix for dynlet.

14 years agopsyntax support for with-fluids
Andy Wingo [Thu, 18 Feb 2010 21:11:57 +0000 (22:11 +0100)]
psyntax support for with-fluids

* module/ice-9/psyntax.scm (build-dynlet, with-fluids): Use psyntax to
  recognize `with-fluids' as a core form, producing <dynlet> if we are
  compiling.
  (sc-expand): To spice up the mix, use with-fluids here in the
  implementation.

* module/ice-9/psyntax-pp.scm: Bootstrapped twice (!).

* module/ice-9/boot-9.scm: Remove with-fluids definition, it's in the
  core now.

14 years agoadd tree-il->glil compilation for dynlet
Andy Wingo [Thu, 18 Feb 2010 17:43:21 +0000 (18:43 +0100)]
add tree-il->glil compilation for dynlet

* module/language/tree-il/compile-glil.scm (flatten): Compile <dynlet>.

14 years agoadd wind-fluids, unwind-fluids VM ops
Andy Wingo [Thu, 18 Feb 2010 17:42:54 +0000 (18:42 +0100)]
add wind-fluids, unwind-fluids VM ops

* libguile/vm-i-system.c (wind-fluids, unwind-fluids): New instructions,
  for dynamic binding.

14 years agoadd dynlet to tree-il
Andy Wingo [Thu, 18 Feb 2010 17:05:24 +0000 (18:05 +0100)]
add dynlet to tree-il

* module/language/tree-il.scm (<dynlet>, dynlet?, make-dynlet)
  (dynlet-src, dynlet-fluids, dynlet-vals, dynlet-body): New tree-il
  construct, mapping to `with-fluids'.
  (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold):
  (make-tree-il-folder, post-order!, pre-order!): Wire it up.
* module/language/tree-il/analyze.scm (analyze-lexicals): Add dynlet
  support.

14 years agoadd with-fluids objects and primitive syntax
Andy Wingo [Thu, 18 Feb 2010 16:10:29 +0000 (17:10 +0100)]
add with-fluids objects and primitive syntax

* libguile/tags.h (scm_tc7_with_fluids): Allocate a tc7 for
  "with-fluids" objects, which will only live on the dynamic stack (wind
  list), not in normal scheme-land.

* libguile/fluids.h (SCM_WITH_FLUIDS_P, SCM_WITH_FLUIDS_LEN)
  (SCM_WITH_FLUIDS_NTH_FLUID, SCM_WITH_FLUIDS_NTH_VAL)
  (SCM_WITH_FLUIDS_SET_NTH_VAL): Add some accessors.
* libguile/fluids.c (scm_i_make_with_fluids, scm_i_swap_with_fluids):
  New internal functions.
  (scm_c_with_fluids, scm_c_with_fluid): Push with-fluids objects on the
  dynwind list, not winders.

* libguile/dynwind.c (scm_i_dowinds): Add cases for winding and
  unwinding with-fluids objects.

* libguile/memoize.h (scm_sym_with_fluids, SCM_M_BEGIN): New public
  data.
* libguile/memoize.c (scm_m_with_fluids): Define with-fluids as a
  primitive syntax.
  (unmemoize): Add with-fluids case.

* libguile/eval.c (eval):
* module/ice-9/eval.scm (primitive-eval): Add with-fluids cases.

* test-suite/tests/fluids.test
  ("fluids not modified if nonfluid passed to with-fluids"): Enable a
  now-passing test.

14 years agoadd fluid tests
Andy Wingo [Wed, 17 Feb 2010 21:36:14 +0000 (22:36 +0100)]
add fluid tests

* test-suite/Makefile.am:
* test-suite/tests/fluids.test: Add some fluid tests. One is an XFAIL
  right now.

14 years agorename <dynamic-wind> to <dynwind>
Andy Wingo [Thu, 18 Feb 2010 16:23:49 +0000 (17:23 +0100)]
rename <dynamic-wind> to <dynwind>

* module/language/tree-il.scm (<dynwind>): Rename from <dynamic-wind>.
* module/language/tree-il/analyze.scm:
* module/language/tree-il/primitives.scm:
* module/language/tree-il/compile-glil.scm: All accessors and callers
  changed.

14 years agofix unmemoization bug
Andy Wingo [Thu, 18 Feb 2010 15:53:30 +0000 (16:53 +0100)]
fix unmemoization bug

* libguile/memoize.c (unmemoize): Fix unmemoization of memoized
  toplevel-ref and module-ref forms.

14 years agoeval.c tweaks
Andy Wingo [Thu, 18 Feb 2010 15:50:57 +0000 (16:50 +0100)]
eval.c tweaks

* libguile/eval.c (eval): Fix a couple of uses of scm_cdr that should
  use CDR.

14 years agofix comment in continuations.c
Andy Wingo [Thu, 18 Feb 2010 15:50:26 +0000 (16:50 +0100)]
fix comment in continuations.c

* libguile/continuations.c: Fix a comment.

14 years agomemoize (begin foo) to foo
Andy Wingo [Thu, 18 Feb 2010 11:28:37 +0000 (12:28 +0100)]
memoize (begin foo) to foo

* libguile/memoize.c (memoize_sequence): Don't make a `begin' if there's
  only one form.

14 years agoreorder eval clauses
Andy Wingo [Thu, 18 Feb 2010 15:59:41 +0000 (16:59 +0100)]
reorder eval clauses

* module/ice-9/eval.scm: Add a comment explaining the frequencies of the
  various memoized expression types.
  (eval): Reorder the cases based the profile.

14 years agodynwind is now a part of guile's primitive language
Andy Wingo [Tue, 16 Feb 2010 22:01:09 +0000 (23:01 +0100)]
dynwind is now a part of guile's primitive language

* libguile/memoize.h (scm_sym_at_dynamic_wind, SCM_M_DYNWIND)
* libguile/memoize.c (memoized_tags, MAKMEMO_DYNWIND)
  (scm_m_at_dynamic_wind, unmemoize): Add dynwind as a primitive
  expression type.

* libguile/dynwind.c (scm_dynamic_wind): Downgrade to a normal C
  function.

* libguile/eval.c (eval):
* module/ice-9/eval.scm (primitive-eval): Add dynwind support.

* module/ice-9/r4rs.scm: More relevant docs.
  (apply): Define in a more regular way.
  (dynamic-wind): Add to this file, with docs, dispatching to
  @dynamic-wind.

* module/language/tree-il/primitives.scm: Parse @dynamic-wind into a
  tree-il dynamic-wind.

14 years agoBump version number for 1.9.8.
Ludovic Courtès [Wed, 17 Feb 2010 17:11:49 +0000 (18:11 +0100)]
Bump version number for 1.9.8.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.

14 years agoUpdate to Gnulib v0.0-3448-g6078aa4 for its <netdb.h> fix.
Ludovic Courtès [Wed, 17 Feb 2010 16:50:43 +0000 (17:50 +0100)]
Update to Gnulib v0.0-3448-g6078aa4 for its <netdb.h> fix.

Reverts commit 691b9ec196203fa5d6da3530d5355b2f73e707d1 ("getaddrinfo:
Define macros lacking in NetBSD 5.0.").

* libguile/net_db.c (AI_ALL, AI_V4MAPPED, AI_ADDRCONFIG): Remove
  placeholder definitions, how provided by Gnulib's <netdb.h>.

14 years agoslight NEWS tweaks
Andy Wingo [Wed, 17 Feb 2010 16:34:58 +0000 (17:34 +0100)]
slight NEWS tweaks

* NEWS: Slight tweaks.

14 years agogetaddrinfo: Define macros lacking in NetBSD 5.0.
Ludovic Courtès [Wed, 17 Feb 2010 00:14:26 +0000 (01:14 +0100)]
getaddrinfo: Define macros lacking in NetBSD 5.0.

* libguile/net_db.c (AI_ALL, AI_V4MAPPED, AI_ADDRCONFIG): New
  macros, when not already defined.

14 years agoUpdate `NEWS'.
Ludovic Courtès [Tue, 16 Feb 2010 23:50:24 +0000 (00:50 +0100)]
Update `NEWS'.

14 years agoMention libffi dependency in `README'.
Ludovic Courtès [Tue, 16 Feb 2010 23:44:56 +0000 (00:44 +0100)]
Mention libffi dependency in `README'.

14 years agoInclude <libguile/__scm.h> in "foreign.h".
Ludovic Courtès [Tue, 16 Feb 2010 23:44:14 +0000 (00:44 +0100)]
Include <libguile/__scm.h> in "foreign.h".

* libguile/foreign.h: Include <libguile/__scm.h>.

14 years agoRemove misplaced tabs from the manual.
Ludovic Courtès [Tue, 16 Feb 2010 23:31:04 +0000 (00:31 +0100)]
Remove misplaced tabs from the manual.

* doc/ref/posix.texi (Network Databases): Remove tabs from `getaddrinfo'
  example.

* .dir-locals.el: Set `indent-tabs-mode' to `t' for `texinfo-mode'.

14 years agoa start at NEWS
Andy Wingo [Tue, 16 Feb 2010 22:45:28 +0000 (23:45 +0100)]
a start at NEWS

* NEWS: A start at NEWS; now to sleep.

14 years agodelete the tutorial
Andy Wingo [Tue, 16 Feb 2010 20:47:34 +0000 (21:47 +0100)]
delete the tutorial

* configure.ac:
* doc/Makefile.am:
* doc/tutorial/ChangeLog-2008:
* doc/tutorial/ChangeLog-guile-doc-tutorial:
* doc/tutorial/Makefile.am:
* doc/tutorial/guile-tut.texi: Remove the tutorial. The history was out
  of date (whereas the manual is current), the C examples are no longer
  valid (and the manual does provide C examples), it was incomplete, and
  its first person no longer hacks on Guile. So tutorial, you had a good
  run, but the manual does your job now!

14 years agofix a bug in the tutorial
Andy Wingo [Tue, 16 Feb 2010 20:35:57 +0000 (21:35 +0100)]
fix a bug in the tutorial

* doc/tutorial/guile-tut.texi (c_builtins.c): Fix a typo with an
  undeclared variable. Thanks to Raimon Grau for the pointer. This
  tutorial is quite out of date, though...

14 years ago`load' doesn't cause the compiler to be loaded in some cases
Andy Wingo [Tue, 16 Feb 2010 20:11:27 +0000 (21:11 +0100)]
`load' doesn't cause the compiler to be loaded in some cases

* module/system/base/compile.scm (compiled-file-name): Add a comment.
* module/ice-9/boot-9.scm (load): Avoid loading up (system base compile)
  just to compute an autocompiled file name. Fixes the issue whereby
  guile-tools snarf-check-and-output-texi was inadvertantly loading up
  srfi-1, and thereby a stale library, just to see if guile-tools itself
  had a compiled version.

  Not sure what the right unit test is here, other than vigilance.

14 years agoAdd missing $(LTLIBINTL), suggested by Gnulib.
Ludovic Courtès [Tue, 16 Feb 2010 19:50:27 +0000 (20:50 +0100)]
Add missing $(LTLIBINTL), suggested by Gnulib.

* libguile/Makefile.am (libguile_la_LIBADD): Add $(LTLIBINTL).

14 years agoi18n: Define `nl_item' when it's not available (needed for Cygwin).
Ludovic Courtès [Tue, 16 Feb 2010 19:46:49 +0000 (20:46 +0100)]
i18n: Define `nl_item' when it's not available (needed for Cygwin).

* configure.ac: Add check for `nl_item'.

* libguile/i18n.c: Separate check for `HAVE_LANGINFO_H' and
  `HAVE_NL_TYPES_H'.
  [!HAVE_NL_ITEM]: Define `nl_item'.

14 years agoSkip "wrong service name" `getaddrinfo' test on Darwin 9.2.
Ludovic Courtès [Tue, 16 Feb 2010 18:13:56 +0000 (19:13 +0100)]
Skip "wrong service name" `getaddrinfo' test on Darwin 9.2.

* test-suite/tests/net-db.test ("getaddrinfo")["wrong service name"]:
  Skip test on Darwin 9.2.

14 years agoFaster read of semicolon comments
Michael Gran [Tue, 16 Feb 2010 04:45:58 +0000 (20:45 -0800)]
Faster read of semicolon comments

There is no need to do character encoding processing within
semicolon comments.

* libguile/read.c (scm_read_semicolon_comment): changed

14 years agoFix builds of `i18n.c' on non-GNU systems.
Ludovic Courtès [Mon, 15 Feb 2010 18:40:42 +0000 (19:40 +0100)]
Fix builds of `i18n.c' on non-GNU systems.

* libguile/i18n.c (chr_to_case, str_to_case): Add `func_name' argument
  and `FUNC_NAME' macro.  Update callers.

14 years agoAdd `getaddrinfo' test.
Ludovic Courtès [Mon, 15 Feb 2010 17:43:20 +0000 (18:43 +0100)]
Add `getaddrinfo' test.

* test-suite/tests/net-db.test ("getaddrinfo")["port 80 with family and
  socket type"]: New test.

14 years agoUse `#f' for `addrinfo:canonname' when it wasn't supplied by getaddrinfo(3).
Ludovic Courtès [Mon, 15 Feb 2010 17:42:34 +0000 (18:42 +0100)]
Use `#f' for `addrinfo:canonname' when it wasn't supplied by getaddrinfo(3).

* libguile/net_db.c (scm_from_addrinfo): Use `#f' when `ai_canonname'
  isn't set.

14 years agoFix `getaddrinfo' tests.
Ludovic Courtès [Mon, 15 Feb 2010 15:10:01 +0000 (16:10 +0100)]
Fix `getaddrinfo' tests.

Thanks to Ken Raeburn.

* test-suite/tests/net-db.test ("getaddrinfo")["port 80"]: Fix bogus
  check of `addrinfo:flags' (POSIX says that the "contents of the
  ai_flags field of the returned structures are undefined.").
  ("wrong service name"): Accept `EAI_NONAME' as a valid error code.

14 years agoMake the `getaddrinfo' "no name" test more robust.
Ludovic Courtès [Sun, 14 Feb 2010 23:43:20 +0000 (00:43 +0100)]
Make the `getaddrinfo' "no name" test more robust.

* test-suite/tests/net-db.test ("getaddrinfo")["no name"]: Check for
  `EAI_EAGAIN' too.

14 years agoAdd missing Gnulib files; update `.gitignore'.
Ludovic Courtès [Sun, 14 Feb 2010 21:37:39 +0000 (22:37 +0100)]
Add missing Gnulib files; update `.gitignore'.

This files were missing from commit
61cd9dc907b8a09990b14e9aeac7e20fe77cecc6 ("Use Gnulib's `getaddrinfo'
module.").

14 years agoAdd `getaddrinfo' and related procedures.
Ludovic Courtès [Sun, 14 Feb 2010 19:56:31 +0000 (20:56 +0100)]
Add `getaddrinfo' and related procedures.

* libguile/net_db.c (sym_getaddrinfo_error, sym_ai_passive,
  sym_ai_canonname, sym_ai_numerichost, sym_ai_numericserv,
  sym_ai_v4mapped, sym_ai_all, sym_ai_addrconfig, sym_eai_badflags,
  sym_eai_noname, sym_eai_again, sym_eai_fail, sym_eai_family,
  sym_eai_socktype, sym_eai_service, sym_eai_memory, sym_eai_system,
  sym_eai_overflow, sym_eai_nodata, sym_eai_addrfamily,
  sym_eai_inprogress, sym_eai_canceled, sym_eai_notcanceled,
  sym_eai_alldone, sym_eai_intr, sym_eai_idn_encode): New variables.
  (scm_from_addrinfo, scm_getaddrinfo, scm_gai_strerror): New functions.

* libguile/net_db.h (scm_getaddrinfo, scm_gai_strerror): New functions.

* module/ice-9/networking.scm (addrinfo:flags, addrinfo:fam,
  addrinfo:socktype, addrinfo:protocol, addrinfo:addr,
  addrinfo:canonname): New procedures.

* test-suite/tests/net-db.test: New file.

* test-suite/Makefile.am (SCM_TESTS): Add `tests/net-db.test'.

* doc/ref/posix.texi (Network Databases)[getaddrinfo]: New subsection.
  [The Host Database]: Suggest using `getaddrinfo'.

14 years agoUse Gnulib's `getaddrinfo' module.
Ludovic Courtès [Sun, 14 Feb 2010 16:06:13 +0000 (17:06 +0100)]
Use Gnulib's `getaddrinfo' module.

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

* libguile/Makefile.am (libguile_la_LDFLAGS): Add `$(GETADDRINFO_LIB)
  $(HOSTENT_LIB) $(SERVENT_LIB)'.

14 years agoDocument trailing whitespace policy.
Thien-Thi Nguyen [Tue, 9 Feb 2010 13:29:36 +0000 (14:29 +0100)]
Document trailing whitespace policy.

* HACKING (Coding standards): Delete trailing whitespace.
Add blurb documenting trailing whitespace policy.

Signed-off-by: Thien-Thi Nguyen <ttn@gnuvola.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
14 years agoDocument the maximum number of arguments for a subr.
Ludovic Courtès [Sat, 13 Feb 2010 22:50:06 +0000 (23:50 +0100)]
Document the maximum number of arguments for a subr.

* doc/ref/api-procedures.texi (Primitive Procedures): Specify the
  maximum number of arguments.  Patch by guign@mails.selgrad.org.

14 years agoReinstate `scm_protects', for backward compatibility.
Ludovic Courtès [Sat, 13 Feb 2010 18:33:51 +0000 (19:33 +0100)]
Reinstate `scm_protects', for backward compatibility.

Partly reverts e7efe8e793fa51ea898aea4477939c598b3e9fac ("decruftify
scm_sys_protects").

* libguile/gc.c (protects): Rename to...
  (scm_protects): ... this.

* libguile/gc.h (scm_protects): Add declaration.

14 years agoFix documentation of the `string->utf' and `utf->string' functions.
Ludovic Courtès [Tue, 9 Feb 2010 23:39:25 +0000 (00:39 +0100)]
Fix documentation of the `string->utf' and `utf->string' functions.

* doc/ref/api-data.texi (Bytevectors as Strings): Describe optional
  parameter of `string->utf{16,32}' and `utf{16,32}->string'.

14 years agoUse the R6RS I/O API in `write-bytecode'.
Ludovic Courtès [Tue, 9 Feb 2010 23:34:05 +0000 (00:34 +0100)]
Use the R6RS I/O API in `write-bytecode'.

* module/language/assembly/compile-bytecode.scm
  (write-bytecode)[u32-bv]: New variable.
  [write-char, write-uint16-be, write-uint16-le, write-uint32-le]:
  Remove.
  [write-string, write-uint32-be, write-uint32, write-wide-string,
  write-bytevector]: Rewrite using the `(rnrs io ports)' API.
  [write-uint24-be]: Rename to...
  [write-int24-be]: ... this.  Use `(rnrs io ports)' API.  Callers
  updated.
  [write-uint16]: Remove.

14 years agoChange `write-bytecode' to accept a bytevector.
Ludovic Courtès [Fri, 5 Feb 2010 10:11:56 +0000 (11:11 +0100)]
Change `write-bytecode' to accept a bytevector.

* module/language/assembly/compile-bytecode.scm (write-bytecode):
  Replace the WRITE-BYTE and GET-ADDR parameters with PORT.  New ADDRESS
  and EMIT-OPCODE? parameters.  Callers updated.
  [write-byte, get-addr]: New procedures.
  Adjust to write to PORT.
  (compile-bytecode): Update accordingly.

* test-suite/tests/asm-to-bytecode.test (munge-bytecode): Return a
  bytevector instead of a u8vector.
  (comp-test): Deal with bytevectors.

14 years agovlist: Slightly improve readability and consistency.
Ludovic Courtès [Fri, 5 Feb 2010 09:38:38 +0000 (10:38 +0100)]
vlist: Slightly improve readability and consistency.

* module/ice-9/vlist.scm (define-inline): Fix case with non-singleton
  body.
  (make-vhash-assoc): Remove.  Change to...
  (%vhash-assoc): ... this, using `define-inline'.

14 years agocontinuations return multiple values on the stack
Andy Wingo [Mon, 8 Feb 2010 21:59:25 +0000 (22:59 +0100)]
continuations return multiple values on the stack

* libguile/vm.h (struct scm_vm_cont): Instead of saving the "IP", save
  "RA" and "MVRA". That is, save singly-valued and multiply-valued
  return addresses, so that we can return multiple values on the stack.
  (scm_i_vm_reinstate_continuation): Remove.
* libguile/vm.c (vm_capture_continuation): Rename from capture_vm_cont,
  and change the prototype so we can capture the RA and MVRA, and so
  that tail calls to call/cc can capture a continuation without the
  call/cc application frame.
  (vm_return_to_continuation): Rename from reinstate_vm_cont, and take
  arguments to return to the continuation. Handles returning to single
  or multiple-value RA.
  (scm_i_vm_capture_continuation): Change to invoke
  vm_capture_continuation. Kept around for the benefit of make-stack.

* libguile/vm-i-system.c (continuation-call): Handle reinstatement of
  the VM stack, with arguments.
  (call/cc, tail-call/cc): Adapt to new vm_capture_continuation
  prototype. tail-call/cc captures tail continuations.

* libguile/stacks.c (scm_make_stack): Update for scm_vm_cont structure
  change.

* libguile/continuations.h (struct scm_contregs): Remove throw_value
  member, which was used to return a value to a continuation.
  (scm_i_check_continuation): New internal function, checks that a
  continuation may be reinstated.
  (scm_i_reinstate_continuation): Replaces scm_i_continuation_call; just
  reinstates the C stack.
  (scm_i_contregs_vm, scm_i_contregs_vm_cont): New internal accessors.
* libguile/continuations.c (scm_i_make_continuation): Return
  SCM_UNDEFINED if we are returning again.
  (grow_stack, copy_stack_and_call, scm_dynthrow): Remove extra arg, as
  vm opcodes handle value returns.
  (copy_stack): No need to instate VM continuation.
  (scm_i_reinstate_continuation): Adapt.

14 years agoscm_i_make_continuation takes vm and vm_cont args explicitly
Andy Wingo [Sun, 7 Feb 2010 13:50:51 +0000 (14:50 +0100)]
scm_i_make_continuation takes vm and vm_cont args explicitly

* libguile/continuations.h:
* libguile/continuations.c (scm_i_make_continuation): Take VM and VM
  continuation arguments as well; I'm not convinced that saving all VM
  continuations was the right thing, and in any case we only ever saved
  the latest. Running a new VM should create a continuation barrier.

* libguile/stacks.c (scm_make_stack):
* libguile/vm-i-system.c (call/cc, tail-call/cc): Adapt callers.

* libguile/vm.h (scm_i_vm_capture_continuation)
  (scm_i_vm_reinstate_continuation): Change to be internal, and to only
  capture and reinstate continuations for a particular VM.

14 years agomake scm_make_continuation internal
Andy Wingo [Sun, 7 Feb 2010 13:16:54 +0000 (14:16 +0100)]
make scm_make_continuation internal

* libguile/continuations.h:
* libguile/continuations.c (scm_i_make_continuation): Change from
  scm_make_continuation, and make internal.

* libguile/vm-i-system.c (call/cc, tail-call/cc): Adapt callers.

* test-suite/standalone/test-unwind.c (check_cont_body): Adapt a test.

* doc/ref/api-control.texi (Continuations): Update docs.