scm_t_bits scm_tc16_promise;
- SCM
- scm_makprom (SCM code)
- {
+ SCM_DEFINE (scm_make_promise, "make-promise", 1, 0, 0,
+ (SCM thunk),
+ "Create a new promise object.\n\n"
+ "@code{make-promise} is a procedural form of @code{delay}.\n"
+ "These two expressions are equivalent:\n"
+ "@lisp\n"
+ "(delay @var{exp})\n"
+ "(make-promise (lambda () @var{exp}))\n"
+ "@end lisp\n")
+ #define FUNC_NAME s_scm_make_promise
+ {
+ SCM_VALIDATE_THUNK (1, thunk);
SCM_RETURN_NEWSMOB2 (scm_tc16_promise,
- SCM_UNPACK (code),
+ SCM_UNPACK (thunk),
scm_make_recursive_mutex ());
}
+ #undef FUNC_NAME
-static SCM
-promise_mark (SCM promise)
-{
- scm_gc_mark (SCM_PROMISE_MUTEX (promise));
- return SCM_PROMISE_DATA (promise);
-}
-
-static size_t
-promise_free (SCM promise)
-{
- return 0;
-}
static int
promise_print (SCM exp, SCM port, scm_print_state *pstate)
;
}
- return SCM_BOOL_F;
+ if (SCM_HASHTABLE_N_ITEMS (symbols) < SCM_HASHTABLE_LOWER (symbols))
+ /* We removed many symbols in this pass so trigger a rehashing. */
+ scm_i_rehash (symbols, scm_i_hash_symbol, 0, "lookup_interned_symbol");
+
+ return result;
}
+ /* Intern SYMBOL, an uninterned symbol. */
+ static void
+ intern_symbol (SCM symbol)
+ {
+ SCM slot, cell;
+ unsigned long hash;
+
+ hash = scm_i_symbol_hash (symbol) % SCM_HASHTABLE_N_BUCKETS (symbols);
+ slot = SCM_HASHTABLE_BUCKET (symbols, hash);
+ cell = scm_cons (symbol, SCM_UNDEFINED);
+
+ SCM_SET_HASHTABLE_BUCKET (symbols, hash, scm_cons (cell, slot));
+ SCM_HASHTABLE_INCREMENT (symbols);
+
+ if (SCM_HASHTABLE_N_ITEMS (symbols) > SCM_HASHTABLE_UPPER (symbols))
+ scm_i_rehash (symbols, scm_i_hash_symbol, 0, "intern_symbol");
+ }
+
static SCM
scm_i_c_mem2symbol (const char *name, size_t len)
{
{
scm_i_thread *t = SCM_I_CURRENT_THREAD;
+ t->guile_mode = 1;
+
SCM_NEWSMOB (t->handle, scm_tc16_thread, t);
- scm_gc_register_collectable_memory (t, sizeof (scm_i_thread), "thread");
+
t->continuation_root = scm_cons (t->handle, SCM_EOL);
t->continuation_base = t->base;
+ t->vm = SCM_BOOL_F;
if (scm_is_true (parent))
t->dynamic_state = scm_make_dynamic_state (parent);
;;; installed-scm-file
- ;;;; Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008
-;;;; Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2009
++;;;; Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009
;;;; Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or