mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-21 20:20:24 +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"));
|
"continuation"));
|
||||||
SCM_SET_CELL_TYPE (scm_rootcont, scm_tc7_contin);
|
SCM_SET_CELL_TYPE (scm_rootcont, scm_tc7_contin);
|
||||||
SCM_SEQ (scm_rootcont) = 0;
|
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
|
/* Create the look-aside stack for variables that are shared between
|
||||||
* captured continuations.
|
* 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);
|
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);
|
scm_boot_guile_1 (&dummy, &c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void *scm_get_stack_base ();
|
||||||
|
|
||||||
/* Record here whether SCM_BOOT_GUILE_1 has already been called. This
|
void
|
||||||
variable is now here and not inside SCM_BOOT_GUILE_1 so that one
|
scm_init_guile ()
|
||||||
can tweak it. This is necessary for unexec to work. (Hey, "1-live"
|
{
|
||||||
is the name of a local radiostation...) */
|
scm_init_guile_1 ((SCM_STACKITEM *)scm_get_stack_base ());
|
||||||
|
}
|
||||||
int scm_boot_guile_1_live = 0;
|
|
||||||
|
|
||||||
int scm_initialized_p = 0;
|
int scm_initialized_p = 0;
|
||||||
|
|
||||||
static void
|
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; */
|
if (scm_initialized_p)
|
||||||
setjmp_type setjmp_val;
|
return;
|
||||||
|
|
||||||
/* This function is not re-entrant. */
|
if (base == NULL)
|
||||||
if (scm_boot_guile_1_live)
|
{
|
||||||
|
fprintf (stderr, "cannot determine stack base!\n");
|
||||||
abort ();
|
abort ();
|
||||||
|
}
|
||||||
scm_boot_guile_1_live = 1;
|
|
||||||
|
|
||||||
scm_ints_disabled = 1;
|
scm_ints_disabled = 1;
|
||||||
scm_block_gc = 1;
|
scm_block_gc = 1;
|
||||||
|
|
||||||
if (scm_initialized_p)
|
|
||||||
{
|
|
||||||
restart_stack (base);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scm_ports_prehistory ();
|
scm_ports_prehistory ();
|
||||||
scm_smob_prehistory ();
|
scm_smob_prehistory ();
|
||||||
scm_tables_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_hash ();
|
||||||
scm_init_hashtab ();
|
scm_init_hashtab ();
|
||||||
scm_init_objprop ();
|
scm_init_objprop ();
|
||||||
|
scm_init_properties ();
|
||||||
scm_init_hooks (); /* Requires objprop until hook names are removed */
|
scm_init_hooks (); /* Requires objprop until hook names are removed */
|
||||||
scm_init_gc (); /* Requires hooks, async */
|
scm_init_gc (); /* Requires hooks, async */
|
||||||
#ifdef GUILE_ISELECT
|
#ifdef GUILE_ISELECT
|
||||||
|
@ -590,7 +587,6 @@ scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
|
||||||
scm_init_lang ();
|
scm_init_lang ();
|
||||||
scm_init_script ();
|
scm_init_script ();
|
||||||
scm_initialized_p = 1;
|
scm_initialized_p = 1;
|
||||||
}
|
|
||||||
|
|
||||||
scm_block_gc = 0; /* permit the gc to run */
|
scm_block_gc = 0; /* permit the gc to run */
|
||||||
/* ints still disabled */
|
/* ints still disabled */
|
||||||
|
@ -599,14 +595,29 @@ scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
|
||||||
scm_stack_checking_enabled_p = SCM_STACK_CHECKING_P;
|
scm_stack_checking_enabled_p = SCM_STACK_CHECKING_P;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setjmp_val = setjmp (SCM_JMPBUF (scm_rootcont));
|
|
||||||
if (!setjmp_val)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
invoke_main_func (closure);
|
||||||
|
|
||||||
scm_restore_signals ();
|
scm_restore_signals ();
|
||||||
|
|
||||||
/* This tick gives any pending
|
/* This tick gives any pending
|
||||||
|
@ -620,7 +631,6 @@ scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static SCM
|
static SCM
|
||||||
invoke_main_func (void *body_data)
|
invoke_main_func (void *body_data)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue