continuations.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /* Copyright (C) 1995,1996,1998,2000,2001,2004, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
  2. *
  3. * This library is free software; you can redistribute it and/or
  4. * modify it under the terms of the GNU Lesser General Public License
  5. * as published by the Free Software Foundation; either version 3 of
  6. * the License, or (at your option) any later version.
  7. *
  8. * This library is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * Lesser General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Lesser General Public
  14. * License along with this library; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. * 02110-1301 USA
  17. */
  18. #ifdef HAVE_CONFIG_H
  19. # include <config.h>
  20. #endif
  21. #include "libguile/_scm.h"
  22. #include <string.h>
  23. #include <stdio.h>
  24. #include "libguile/async.h"
  25. #include "libguile/debug.h"
  26. #include "libguile/root.h"
  27. #include "libguile/stackchk.h"
  28. #include "libguile/smob.h"
  29. #include "libguile/ports.h"
  30. #include "libguile/dynwind.h"
  31. #include "libguile/eval.h"
  32. #include "libguile/vm.h"
  33. #include "libguile/instructions.h"
  34. #include "libguile/validate.h"
  35. #include "libguile/continuations.h"
  36. static scm_t_bits tc16_continuation;
  37. #define SCM_CONTREGSP(x) SCM_TYP16_PREDICATE (tc16_continuation, x)
  38. #define SCM_CONTREGS(x) ((scm_t_contregs *) SCM_SMOB_DATA_1 (x))
  39. #define SCM_CONTINUATION_LENGTH(x) (SCM_CONTREGS (x)->num_stack_items)
  40. #define SCM_SET_CONTINUATION_LENGTH(x, n)\
  41. (SCM_CONTREGS (x)->num_stack_items = (n))
  42. #define SCM_JMPBUF(x) ((SCM_CONTREGS (x))->jmpbuf)
  43. #define SCM_DYNENV(x) ((SCM_CONTREGS (x))->dynenv)
  44. #define SCM_CONTINUATION_ROOT(x) ((SCM_CONTREGS (x))->root)
  45. #define SCM_DFRAME(x) ((SCM_CONTREGS (x))->dframe)
  46. /* scm_i_make_continuation will return a procedure whose objcode contains an
  47. instruction to reinstate the continuation. Here, as in gsubr.c and smob.c, we
  48. define the form of that trampoline function.
  49. */
  50. #ifdef WORDS_BIGENDIAN
  51. #define OBJCODE_HEADER(main,meta) 0, 0, 0, main, 0, 0, 0, meta+8
  52. #define META_HEADER(meta) 0, 0, 0, meta, 0, 0, 0, 0
  53. #else
  54. #define OBJCODE_HEADER(main,meta) main, 0, 0, 0, meta+8, 0, 0, 0
  55. #define META_HEADER(meta) meta, 0, 0, 0, 0, 0, 0, 0
  56. #endif
  57. #define OBJCODE_TAG SCM_MAKE_OBJCODE_TAG (SCM_OBJCODE_TYPE_STATIC, 0)
  58. #if defined (SCM_ALIGNED) && 0
  59. #define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \
  60. static const type sym[]
  61. #define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \
  62. static SCM_ALIGNED (alignment) const type sym[]
  63. #define SCM_STATIC_OBJCODE(sym) \
  64. SCM_DECLARE_STATIC_ALIGNED_ARRAY (scm_t_uint8, sym##__bytecode); \
  65. SCM_STATIC_ALIGNED_ARRAY (8, scm_t_cell, sym##__cells) = { \
  66. { SCM_PACK (OBJCODE_TAG), SCM_PACK (sym##__bytecode) }, \
  67. { SCM_BOOL_F, SCM_PACK (0) } \
  68. }; \
  69. static const SCM sym = SCM_PACK (sym##__cells); \
  70. SCM_STATIC_ALIGNED_ARRAY (8, scm_t_uint8, sym##__bytecode)
  71. #else
  72. #define SCM_STATIC_OBJCODE(sym) \
  73. static SCM sym; \
  74. static scm_t_uint8 *sym##_bytecode; \
  75. SCM_SNARF_INIT(sym##_bytecode = scm_gc_malloc_pointerless (sizeof(sym##_bytecode__unaligned), "partial continuation stub"); \
  76. memcpy (sym##_bytecode, sym##_bytecode__unaligned, sizeof(sym##_bytecode__unaligned));) \
  77. SCM_SNARF_INIT(sym = scm_double_cell (OBJCODE_TAG, \
  78. (scm_t_bits)sym##_bytecode, \
  79. SCM_UNPACK (SCM_BOOL_F), \
  80. 0);) \
  81. static const scm_t_uint8 sym##_bytecode__unaligned[]
  82. #endif
  83. SCM_STATIC_OBJCODE (cont_objcode) = {
  84. /* This code is the same as in gsubr.c, except we use continuation_call
  85. instead of subr_call. */
  86. OBJCODE_HEADER (8, 19),
  87. /* leave args on the stack */
  88. /* 0 */ scm_op_object_ref, 0, /* push scm_t_contregs smob */
  89. /* 2 */ scm_op_continuation_call, /* and longjmp (whee) */
  90. /* 3 */ scm_op_nop, /* pad to 8 bytes */
  91. /* 4 */ scm_op_nop, scm_op_nop, scm_op_nop, scm_op_nop,
  92. /* 8 */
  93. /* We could put some meta-info to say that this proc is a continuation. Not sure
  94. how to do that, though. */
  95. META_HEADER (19),
  96. /* 0 */ scm_op_make_eol, /* bindings */
  97. /* 1 */ scm_op_make_eol, /* sources */
  98. /* 2 */ scm_op_make_int8, 0, scm_op_make_int8, 3, /* arity: from ip 0 to ip 3 */
  99. /* 6 */ scm_op_make_int8_0, /* the arity is 0 required args */
  100. /* 7 */ scm_op_make_int8_0, /* 0 optionals */
  101. /* 8 */ scm_op_make_true, /* and a rest arg */
  102. /* 9 */ scm_op_list, 0, 5, /* make a list of those 5 vals */
  103. /* 12 */ scm_op_list, 0, 1, /* and the arities will be a list of that one list */
  104. /* 15 */ scm_op_list, 0, 3, /* pack bindings, sources, and arities into list */
  105. /* 18 */ scm_op_return /* and return */
  106. /* 19 */
  107. };
  108. SCM_STATIC_OBJCODE (call_cc_objcode) = {
  109. /* Before Scheme's call/cc is compiled, eval.c will use this hand-coded
  110. call/cc. */
  111. OBJCODE_HEADER (8, 17),
  112. /* 0 */ scm_op_assert_nargs_ee, 0, 1, /* assert that nargs==1 */
  113. /* 3 */ scm_op_local_ref, 0, /* push the proc */
  114. /* 5 */ scm_op_tail_call_cc, /* and call/cc */
  115. /* 6 */ scm_op_nop, scm_op_nop, /* pad to 8 bytes */
  116. /* 8 */
  117. META_HEADER (17),
  118. /* 0 */ scm_op_make_eol, /* bindings */
  119. /* 1 */ scm_op_make_eol, /* sources */
  120. /* 2 */ scm_op_make_int8, 3, scm_op_make_int8, 6, /* arity: from ip 0 to ip 6 */
  121. /* 6 */ scm_op_make_int8_1, /* the arity is 0 required args */
  122. /* 7 */ scm_op_list, 0, 3, /* make a list of those 5 vals */
  123. /* 10 */ scm_op_list, 0, 1, /* and the arities will be a list of that one list */
  124. /* 13 */ scm_op_list, 0, 3, /* pack bindings, sources, and arities into list */
  125. /* 16 */ scm_op_return /* and return */
  126. /* 17 */
  127. };
  128. static SCM
  129. make_continuation_trampoline (SCM contregs)
  130. {
  131. SCM ret = scm_make_program (cont_objcode,
  132. scm_c_make_vector (1, contregs),
  133. SCM_BOOL_F);
  134. SCM_SET_CELL_WORD_0 (ret,
  135. SCM_CELL_WORD_0 (ret) | SCM_F_PROGRAM_IS_CONTINUATION);
  136. return ret;
  137. }
  138. /* {Continuations}
  139. */
  140. static int
  141. continuation_print (SCM obj, SCM port, scm_print_state *state SCM_UNUSED)
  142. {
  143. scm_t_contregs *continuation = SCM_CONTREGS (obj);
  144. scm_puts ("#<continuation ", port);
  145. scm_intprint (continuation->num_stack_items, 10, port);
  146. scm_puts (" @ ", port);
  147. scm_uintprint (SCM_SMOB_DATA_1 (obj), 16, port);
  148. scm_putc ('>', port);
  149. return 1;
  150. }
  151. /* this may return more than once: the first time with the escape
  152. procedure, then subsequently with SCM_UNDEFINED (the vals already having been
  153. placed on the VM stack). */
  154. #define FUNC_NAME "scm_i_make_continuation"
  155. SCM
  156. scm_i_make_continuation (int *first, SCM vm, SCM vm_cont)
  157. {
  158. scm_i_thread *thread = SCM_I_CURRENT_THREAD;
  159. SCM cont;
  160. scm_t_contregs *continuation;
  161. long stack_size;
  162. SCM_STACKITEM * src;
  163. SCM_FLUSH_REGISTER_WINDOWS;
  164. stack_size = scm_stack_size (thread->continuation_base);
  165. continuation = scm_gc_malloc (sizeof (scm_t_contregs)
  166. + (stack_size - 1) * sizeof (SCM_STACKITEM),
  167. "continuation");
  168. continuation->num_stack_items = stack_size;
  169. continuation->dynenv = scm_i_dynwinds ();
  170. continuation->root = thread->continuation_root;
  171. src = thread->continuation_base;
  172. #if ! SCM_STACK_GROWS_UP
  173. src -= stack_size;
  174. #endif
  175. continuation->offset = continuation->stack - src;
  176. memcpy (continuation->stack, src, sizeof (SCM_STACKITEM) * stack_size);
  177. continuation->vm = vm;
  178. continuation->vm_cont = vm_cont;
  179. SCM_NEWSMOB (cont, tc16_continuation, continuation);
  180. *first = !SCM_I_SETJMP (continuation->jmpbuf);
  181. if (*first)
  182. {
  183. #ifdef __ia64__
  184. continuation->backing_store_size =
  185. (char *) scm_ia64_ar_bsp(&continuation->jmpbuf.ctx)
  186. -
  187. (char *) thread->register_backing_store_base;
  188. continuation->backing_store = NULL;
  189. continuation->backing_store =
  190. scm_gc_malloc (continuation->backing_store_size,
  191. "continuation backing store");
  192. memcpy (continuation->backing_store,
  193. (void *) thread->register_backing_store_base,
  194. continuation->backing_store_size);
  195. #endif /* __ia64__ */
  196. return make_continuation_trampoline (cont);
  197. }
  198. else
  199. return SCM_UNDEFINED;
  200. }
  201. #undef FUNC_NAME
  202. SCM
  203. scm_i_call_with_current_continuation (SCM proc)
  204. {
  205. static SCM call_cc = SCM_BOOL_F;
  206. if (scm_is_false (call_cc))
  207. call_cc = scm_make_program (call_cc_objcode, SCM_BOOL_F, SCM_BOOL_F);
  208. return scm_call_1 (call_cc, proc);
  209. }
  210. SCM
  211. scm_i_continuation_to_frame (SCM continuation)
  212. {
  213. SCM contregs;
  214. scm_t_contregs *cont;
  215. contregs = scm_c_vector_ref (scm_program_objects (continuation), 0);
  216. cont = SCM_CONTREGS (contregs);
  217. if (scm_is_true (cont->vm_cont))
  218. {
  219. struct scm_vm_cont *data = SCM_VM_CONT_DATA (cont->vm_cont);
  220. return scm_c_make_frame (cont->vm_cont,
  221. data->fp + data->reloc,
  222. data->sp + data->reloc,
  223. data->ra,
  224. data->reloc);
  225. }
  226. else
  227. return SCM_BOOL_F;
  228. }
  229. SCM
  230. scm_i_contregs_vm (SCM contregs)
  231. {
  232. return SCM_CONTREGS (contregs)->vm;
  233. }
  234. SCM
  235. scm_i_contregs_vm_cont (SCM contregs)
  236. {
  237. return SCM_CONTREGS (contregs)->vm_cont;
  238. }
  239. /* {Apply}
  240. */
  241. /* Invoking a continuation proceeds as follows:
  242. *
  243. * - the stack is made large enough for the called continuation
  244. * - the old windchain is unwound down to the branching point
  245. * - the continuation stack is copied into place
  246. * - the windchain is rewound up to the continuation's context
  247. * - the continuation is invoked via longjmp (or setcontext)
  248. *
  249. * This order is important so that unwind and rewind handlers are run
  250. * with their correct stack.
  251. */
  252. static void scm_dynthrow (SCM);
  253. /* Grow the stack by a fixed amount to provide space to copy in the
  254. * continuation. Possibly this function has to be called several times
  255. * recursively before enough space is available. Make sure the compiler does
  256. * not optimize the growth array away by storing it's address into a global
  257. * variable.
  258. */
  259. static scm_t_bits scm_i_dummy;
  260. static void
  261. grow_stack (SCM cont)
  262. {
  263. scm_t_bits growth[100];
  264. scm_i_dummy = (scm_t_bits) growth;
  265. scm_dynthrow (cont);
  266. }
  267. /* Copy the continuation stack into the current stack. Calling functions from
  268. * within this function is safe, since only stack frames below this function's
  269. * own frame are overwritten. Thus, memcpy can be used for best performance.
  270. */
  271. typedef struct {
  272. scm_t_contregs *continuation;
  273. SCM_STACKITEM *dst;
  274. } copy_stack_data;
  275. static void
  276. copy_stack (void *data)
  277. {
  278. copy_stack_data *d = (copy_stack_data *)data;
  279. memcpy (d->dst, d->continuation->stack,
  280. sizeof (SCM_STACKITEM) * d->continuation->num_stack_items);
  281. #ifdef __ia64__
  282. SCM_I_CURRENT_THREAD->pending_rbs_continuation = d->continuation;
  283. #endif
  284. }
  285. static void
  286. copy_stack_and_call (scm_t_contregs *continuation,
  287. SCM_STACKITEM * dst)
  288. {
  289. long delta;
  290. copy_stack_data data;
  291. delta = scm_ilength (scm_i_dynwinds ()) - scm_ilength (continuation->dynenv);
  292. data.continuation = continuation;
  293. data.dst = dst;
  294. scm_i_dowinds (continuation->dynenv, delta, copy_stack, &data);
  295. SCM_I_LONGJMP (continuation->jmpbuf, 1);
  296. }
  297. #ifdef __ia64__
  298. void
  299. scm_ia64_longjmp (scm_i_jmp_buf *JB, int VAL)
  300. {
  301. scm_i_thread *t = SCM_I_CURRENT_THREAD;
  302. if (t->pending_rbs_continuation)
  303. {
  304. memcpy (t->register_backing_store_base,
  305. t->pending_rbs_continuation->backing_store,
  306. t->pending_rbs_continuation->backing_store_size);
  307. t->pending_rbs_continuation = NULL;
  308. }
  309. setcontext (&JB->ctx);
  310. }
  311. #endif
  312. /* Call grow_stack until the stack space is large enough, then, as the current
  313. * stack frame might get overwritten, let copy_stack_and_call perform the
  314. * actual copying and continuation calling.
  315. */
  316. static void
  317. scm_dynthrow (SCM cont)
  318. {
  319. scm_i_thread *thread = SCM_I_CURRENT_THREAD;
  320. scm_t_contregs *continuation = SCM_CONTREGS (cont);
  321. SCM_STACKITEM *dst = thread->continuation_base;
  322. SCM_STACKITEM stack_top_element;
  323. if (thread->critical_section_level)
  324. {
  325. fprintf (stderr, "continuation invoked from within critical section.\n");
  326. abort ();
  327. }
  328. #if SCM_STACK_GROWS_UP
  329. if (dst + continuation->num_stack_items >= &stack_top_element)
  330. grow_stack (cont);
  331. #else
  332. dst -= continuation->num_stack_items;
  333. if (dst <= &stack_top_element)
  334. grow_stack (cont);
  335. #endif /* def SCM_STACK_GROWS_UP */
  336. SCM_FLUSH_REGISTER_WINDOWS;
  337. copy_stack_and_call (continuation, dst);
  338. }
  339. void
  340. scm_i_check_continuation (SCM cont)
  341. {
  342. scm_i_thread *thread = SCM_I_CURRENT_THREAD;
  343. scm_t_contregs *continuation = SCM_CONTREGS (cont);
  344. if (!scm_is_eq (continuation->root, thread->continuation_root))
  345. scm_misc_error
  346. ("%continuation-call",
  347. "invoking continuation would cross continuation barrier: ~A",
  348. scm_list_1 (cont));
  349. }
  350. void
  351. scm_i_reinstate_continuation (SCM cont)
  352. {
  353. scm_dynthrow (cont);
  354. }
  355. SCM
  356. scm_i_with_continuation_barrier (scm_t_catch_body body,
  357. void *body_data,
  358. scm_t_catch_handler handler,
  359. void *handler_data,
  360. scm_t_catch_handler pre_unwind_handler,
  361. void *pre_unwind_handler_data)
  362. {
  363. SCM_STACKITEM stack_item;
  364. scm_i_thread *thread = SCM_I_CURRENT_THREAD;
  365. SCM old_controot;
  366. SCM_STACKITEM *old_contbase;
  367. SCM result;
  368. /* Establish a fresh continuation root.
  369. */
  370. old_controot = thread->continuation_root;
  371. old_contbase = thread->continuation_base;
  372. thread->continuation_root = scm_cons (thread->handle, old_controot);
  373. thread->continuation_base = &stack_item;
  374. /* Call FUNC inside a catch all. This is now guaranteed to return
  375. directly and exactly once.
  376. */
  377. result = scm_c_catch (SCM_BOOL_T,
  378. body, body_data,
  379. handler, handler_data,
  380. pre_unwind_handler, pre_unwind_handler_data);
  381. /* Return to old continuation root.
  382. */
  383. thread->continuation_base = old_contbase;
  384. thread->continuation_root = old_controot;
  385. return result;
  386. }
  387. static int
  388. should_print_backtrace (SCM tag, SCM stack)
  389. {
  390. return SCM_BACKTRACE_P
  391. && scm_is_true (stack)
  392. && scm_initialized_p
  393. /* It's generally not useful to print backtraces for errors reading
  394. or expanding code in these fallback catch statements. */
  395. && !scm_is_eq (tag, scm_from_latin1_symbol ("read-error"))
  396. && !scm_is_eq (tag, scm_from_latin1_symbol ("syntax-error"));
  397. }
  398. static void
  399. print_exception_and_backtrace (SCM port, SCM tag, SCM args)
  400. {
  401. SCM stack, frame;
  402. /* We get here via a throw to a catch-all. In that case there is the
  403. throw frame active, and this catch closure, so narrow by two
  404. frames. */
  405. stack = scm_make_stack (SCM_BOOL_T, scm_list_1 (scm_from_int (2)));
  406. frame = scm_is_true (stack) ? scm_stack_ref (stack, SCM_INUM0) : SCM_BOOL_F;
  407. if (should_print_backtrace (tag, stack))
  408. {
  409. scm_puts ("Backtrace:\n", port);
  410. scm_display_backtrace_with_highlights (stack, port,
  411. SCM_BOOL_F, SCM_BOOL_F,
  412. SCM_EOL);
  413. scm_newline (port);
  414. }
  415. scm_print_exception (port, frame, tag, args);
  416. }
  417. struct c_data {
  418. void *(*func) (void *);
  419. void *data;
  420. void *result;
  421. };
  422. static SCM
  423. c_body (void *d)
  424. {
  425. struct c_data *data = (struct c_data *)d;
  426. data->result = data->func (data->data);
  427. return SCM_UNSPECIFIED;
  428. }
  429. static SCM
  430. c_handler (void *d, SCM tag, SCM args)
  431. {
  432. struct c_data *data;
  433. /* If TAG is `quit', exit() the process. */
  434. if (scm_is_eq (tag, scm_from_latin1_symbol ("quit")))
  435. exit (scm_exit_status (args));
  436. data = (struct c_data *)d;
  437. data->result = NULL;
  438. return SCM_UNSPECIFIED;
  439. }
  440. static SCM
  441. pre_unwind_handler (void *error_port, SCM tag, SCM args)
  442. {
  443. /* Print the exception unless TAG is `quit'. */
  444. if (!scm_is_eq (tag, scm_from_latin1_symbol ("quit")))
  445. print_exception_and_backtrace (PTR2SCM (error_port), tag, args);
  446. return SCM_UNSPECIFIED;
  447. }
  448. void *
  449. scm_c_with_continuation_barrier (void *(*func) (void *), void *data)
  450. {
  451. struct c_data c_data;
  452. c_data.func = func;
  453. c_data.data = data;
  454. scm_i_with_continuation_barrier (c_body, &c_data,
  455. c_handler, &c_data,
  456. pre_unwind_handler,
  457. SCM2PTR (scm_current_error_port ()));
  458. return c_data.result;
  459. }
  460. struct scm_data {
  461. SCM proc;
  462. };
  463. static SCM
  464. scm_body (void *d)
  465. {
  466. struct scm_data *data = (struct scm_data *)d;
  467. return scm_call_0 (data->proc);
  468. }
  469. static SCM
  470. scm_handler (void *d, SCM tag, SCM args)
  471. {
  472. /* Print a message. Note that if TAG is `quit', this will exit() the
  473. process. */
  474. scm_handle_by_message_noexit (NULL, tag, args);
  475. return SCM_BOOL_F;
  476. }
  477. SCM_DEFINE (scm_with_continuation_barrier, "with-continuation-barrier", 1,0,0,
  478. (SCM proc),
  479. "Call @var{proc} and return its result. Do not allow the invocation of\n"
  480. "continuations that would leave or enter the dynamic extent of the call\n"
  481. "to @code{with-continuation-barrier}. Such an attempt causes an error\n"
  482. "to be signaled.\n"
  483. "\n"
  484. "Throws (such as errors) that are not caught from within @var{proc} are\n"
  485. "caught by @code{with-continuation-barrier}. In that case, a short\n"
  486. "message is printed to the current error port and @code{#f} is returned.\n"
  487. "\n"
  488. "Thus, @code{with-continuation-barrier} returns exactly once.\n")
  489. #define FUNC_NAME s_scm_with_continuation_barrier
  490. {
  491. struct scm_data scm_data;
  492. scm_data.proc = proc;
  493. return scm_i_with_continuation_barrier (scm_body, &scm_data,
  494. scm_handler, &scm_data,
  495. pre_unwind_handler,
  496. SCM2PTR (scm_current_error_port ()));
  497. }
  498. #undef FUNC_NAME
  499. void
  500. scm_init_continuations ()
  501. {
  502. tc16_continuation = scm_make_smob_type ("continuation", 0);
  503. scm_set_smob_print (tc16_continuation, continuation_print);
  504. #include "libguile/continuations.x"
  505. }
  506. /*
  507. Local Variables:
  508. c-file-style: "gnu"
  509. End:
  510. */