1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

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.
This commit is contained in:
Andy Wingo 2010-03-04 12:02:02 +01:00
parent 2b2746a831
commit 2150e9a84a
3 changed files with 10 additions and 1 deletions

View file

@ -182,7 +182,7 @@ reify_partial_continuation (SCM vm, SCM prompt, SCM extwinds,
scm_vector (scm_list_2 (vm_cont, intwinds)),
SCM_BOOL_F);
SCM_SET_CELL_WORD_0 (ret,
SCM_CELL_WORD_0 (ret) | SCM_F_PROGRAM_IS_CONTINUATION);
SCM_CELL_WORD_0 (ret) | SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION);
return ret;
}

View file

@ -86,6 +86,13 @@ scm_i_program_print (SCM program, SCM port, scm_print_state *pstate)
scm_uintprint (SCM_UNPACK (program), 16, port);
scm_putc ('>', port);
}
if (SCM_PROGRAM_IS_PARTIAL_CONTINUATION (program))
{
/* twingliness */
scm_puts ("#<partial-continuation ", port);
scm_uintprint (SCM_UNPACK (program), 16, port);
scm_putc ('>', port);
}
else if (scm_is_false (write_program) || print_error)
{
scm_puts ("#<program ", port);

View file

@ -30,6 +30,7 @@
#define SCM_F_PROGRAM_IS_PRIMITIVE 0x200
#define SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC 0x400
#define SCM_F_PROGRAM_IS_CONTINUATION 0x800
#define SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION 0x1000
#define SCM_PROGRAM_P(x) (!SCM_IMP (x) && SCM_TYP7(x) == scm_tc7_program)
#define SCM_PROGRAM_OBJCODE(x) (SCM_CELL_OBJECT_1 (x))
@ -44,6 +45,7 @@
#define SCM_PROGRAM_IS_PRIMITIVE(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_PRIMITIVE)
#define SCM_PROGRAM_IS_PRIMITIVE_GENERIC(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC)
#define SCM_PROGRAM_IS_CONTINUATION(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_CONTINUATION)
#define SCM_PROGRAM_IS_PARTIAL_CONTINUATION(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION)
SCM_API SCM scm_make_program (SCM objcode, SCM objtable, SCM free_variables);