mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
* init.c (scm_init_guile, scm_init_guile_1): New interface for
initializing Guile that does return to the caller. (scm_boot_guile_1): Use scm_init_guile_1 to initialize Guile. Do not establish a catch-all, this is no longer needed.
This commit is contained in:
parent
faf6a29b1f
commit
7ad3a9782e
1 changed files with 134 additions and 124 deletions
|
@ -186,7 +186,7 @@ start_stack (void *base)
|
|||
"continuation"));
|
||||
SCM_SET_CELL_TYPE (scm_rootcont, scm_tc7_contin);
|
||||
SCM_SEQ (scm_rootcont) = 0;
|
||||
/* The root continuation if further initialized by restart_stack. */
|
||||
/* The root continuation is further initialized by restart_stack. */
|
||||
|
||||
/* Create the look-aside stack for variables that are shared between
|
||||
* captured continuations.
|
||||
|
@ -397,7 +397,9 @@ struct main_func_closure
|
|||
};
|
||||
|
||||
|
||||
static void scm_boot_guile_1(SCM_STACKITEM *base, struct main_func_closure *closure);
|
||||
static void scm_init_guile_1 (SCM_STACKITEM *base);
|
||||
static void scm_boot_guile_1 (SCM_STACKITEM *base,
|
||||
struct main_func_closure *closure);
|
||||
static SCM invoke_main_func(void *body_data);
|
||||
|
||||
|
||||
|
@ -446,37 +448,31 @@ scm_boot_guile (int argc, char ** argv, void (*main_func) (), void *closure)
|
|||
scm_boot_guile_1 (&dummy, &c);
|
||||
}
|
||||
|
||||
extern void *scm_get_stack_base ();
|
||||
|
||||
/* Record here whether SCM_BOOT_GUILE_1 has already been called. This
|
||||
variable is now here and not inside SCM_BOOT_GUILE_1 so that one
|
||||
can tweak it. This is necessary for unexec to work. (Hey, "1-live"
|
||||
is the name of a local radiostation...) */
|
||||
|
||||
int scm_boot_guile_1_live = 0;
|
||||
void
|
||||
scm_init_guile ()
|
||||
{
|
||||
scm_init_guile_1 ((SCM_STACKITEM *)scm_get_stack_base ());
|
||||
}
|
||||
|
||||
int scm_initialized_p = 0;
|
||||
|
||||
static void
|
||||
scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
|
||||
scm_init_guile_1 (SCM_STACKITEM *base)
|
||||
{
|
||||
/* static int live = 0; */
|
||||
setjmp_type setjmp_val;
|
||||
if (scm_initialized_p)
|
||||
return;
|
||||
|
||||
/* This function is not re-entrant. */
|
||||
if (scm_boot_guile_1_live)
|
||||
if (base == NULL)
|
||||
{
|
||||
fprintf (stderr, "cannot determine stack base!\n");
|
||||
abort ();
|
||||
|
||||
scm_boot_guile_1_live = 1;
|
||||
}
|
||||
|
||||
scm_ints_disabled = 1;
|
||||
scm_block_gc = 1;
|
||||
|
||||
if (scm_initialized_p)
|
||||
{
|
||||
restart_stack (base);
|
||||
}
|
||||
else
|
||||
{
|
||||
scm_ports_prehistory ();
|
||||
scm_smob_prehistory ();
|
||||
scm_tables_prehistory ();
|
||||
|
@ -519,6 +515,7 @@ scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
|
|||
scm_init_hash ();
|
||||
scm_init_hashtab ();
|
||||
scm_init_objprop ();
|
||||
scm_init_properties ();
|
||||
scm_init_hooks (); /* Requires objprop until hook names are removed */
|
||||
scm_init_gc (); /* Requires hooks, async */
|
||||
#ifdef GUILE_ISELECT
|
||||
|
@ -590,7 +587,6 @@ scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
|
|||
scm_init_lang ();
|
||||
scm_init_script ();
|
||||
scm_initialized_p = 1;
|
||||
}
|
||||
|
||||
scm_block_gc = 0; /* permit the gc to run */
|
||||
/* ints still disabled */
|
||||
|
@ -599,13 +595,28 @@ scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
|
|||
scm_stack_checking_enabled_p = SCM_STACK_CHECKING_P;
|
||||
#endif
|
||||
|
||||
setjmp_val = setjmp (SCM_JMPBUF (scm_rootcont));
|
||||
if (!setjmp_val)
|
||||
{
|
||||
}
|
||||
|
||||
/* Record here whether SCM_BOOT_GUILE_1 has already been called. This
|
||||
variable is now here and not inside SCM_BOOT_GUILE_1 so that one
|
||||
can tweak it. This is necessary for unexec to work. (Hey, "1-live"
|
||||
is the name of a local radiostation...) */
|
||||
|
||||
int scm_boot_guile_1_live = 0;
|
||||
|
||||
static void
|
||||
scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
|
||||
{
|
||||
scm_init_guile_1 (base);
|
||||
|
||||
/* This function is not re-entrant. */
|
||||
if (scm_boot_guile_1_live)
|
||||
abort ();
|
||||
|
||||
scm_boot_guile_1_live = 1;
|
||||
|
||||
scm_set_program_arguments (closure->argc, closure->argv, 0);
|
||||
scm_internal_lazy_catch (SCM_BOOL_T, invoke_main_func, closure,
|
||||
scm_handle_by_message, 0);
|
||||
}
|
||||
invoke_main_func (closure);
|
||||
|
||||
scm_restore_signals ();
|
||||
|
||||
|
@ -620,7 +631,6 @@ scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
|
|||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
static SCM
|
||||
invoke_main_func (void *body_data)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue