* eval.c (RETURN): Wrap in do{}while(0) in order to make it
[bpt/guile.git] / libguile / init.c
index 2c079df..5c96be4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -39,8 +39,6 @@
  * whether to permit this exception to apply to your modifications.
  * If you do not wish that, delete this exception notice.  */
 
-/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
-   gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
 
 \f
 /* Include the headers for just about everything.
@@ -66,6 +64,7 @@
 #ifdef GUILE_DEBUG_MALLOC
 #include "libguile/debug-malloc.h"
 #endif
+#include "libguile/deprecation.h"
 #include "libguile/dynl.h"
 #include "libguile/dynwind.h"
 #include "libguile/environments.h"
 #include "libguile/random.h"
 #include "libguile/rdelim.h"
 #include "libguile/read.h"
+#include "libguile/rw.h"
 #include "libguile/scmsigs.h"
 #include "libguile/script.h"
 #include "libguile/simpos.h"
 #include "libguile/strports.h"
 #include "libguile/struct.h"
 #include "libguile/symbols.h"
-#include "libguile/tag.h"
 #include "libguile/throw.h"
 #include "libguile/unif.h"
 #include "libguile/values.h"
 #include "libguile/vports.h"
 #include "libguile/weaks.h"
 #include "libguile/guardians.h"
+#include "libguile/extensions.h"
 
 #include "libguile/init.h"
 
@@ -162,7 +162,6 @@ restart_stack (void *base)
   SCM_DFRAME (scm_rootcont) = scm_last_debug_frame = 0;
 #endif
   SCM_BASE (scm_rootcont) = base;
-  scm_continuation_stack_ptr = SCM_MAKINUM (0);
 }
 
 static void
@@ -176,29 +175,17 @@ start_stack (void *base)
 
   scm_exitval = SCM_BOOL_F;    /* vestigial */
 
-#if SCM_DEBUG_DEPRECATED == 0
-  scm_top_level_lookup_closure_var = SCM_BOOL_F;
-#endif
-  scm_system_transformer = SCM_BOOL_F;
-
   scm_root->fluids = scm_make_initial_fluids ();
 
   /* Create an object to hold the root continuation.
    */
   {
-    scm_contregs *contregs = scm_must_malloc (sizeof (scm_contregs),
+    scm_t_contregs *contregs = scm_must_malloc (sizeof (scm_t_contregs),
                                              "continuation");
     contregs->num_stack_items = 0;
     contregs->seq = 0;
     SCM_NEWSMOB (scm_rootcont, scm_tc16_continuation, contregs);
   }
-  /* The root continuation is further initialized by restart_stack. */
-
-  /* Create the look-aside stack for variables that are shared between
-   * captured continuations.
-   */
-  scm_continuation_stack = scm_make_vector (SCM_MAKINUM (512), SCM_UNDEFINED);
-  /* The continuation stack is further initialized by restart_stack. */
 
   /* The remainder of stack initialization is factored out to another
    * function so that if this stack is ever exitted, it can be
@@ -226,7 +213,7 @@ fixconfig (char *s1,char *s2,int s)
 static void
 check_config (void)
 {
-  scm_sizet j;
+  size_t j;
 
   j = HEAP_SEG_SIZE;
   if (HEAP_SEG_SIZE != j)
@@ -276,7 +263,9 @@ stream_body (void *data)
 
 /* exception handler for stream_body.  */
 static SCM
-stream_handler (void *data, SCM tag, SCM throw_args)
+stream_handler (void *data SCM_UNUSED,
+               SCM tag SCM_UNUSED,
+               SCM throw_args SCM_UNUSED)
 {
   return SCM_BOOL_F;
 }
@@ -364,8 +353,6 @@ scm_load_startup_files ()
       /* Load the init.scm file.  */
       if (SCM_NFALSEP (init_path))
        scm_primitive_load (init_path);
-  
-      scm_post_boot_init_modules ();
     }
 }
 
@@ -469,12 +456,14 @@ scm_init_guile_1 (SCM_STACKITEM *base)
 #ifdef GUILE_DEBUG_MALLOC
   scm_debug_malloc_prehistory ();
 #endif
-  scm_init_storage ();
+  scm_init_storage ();           /* requires smob_prehistory */
   scm_struct_prehistory ();      /* requires storage */
   scm_symbols_prehistory ();      /* requires storage */
   scm_weaks_prehistory ();       /* requires storage */
   scm_init_subr_table ();
   scm_environments_prehistory (); /* requires storage */
+  scm_modules_prehistory ();      /* requires storage */
+  scm_init_variable ();           /* all bindings need variables */
   scm_init_continuations ();
   scm_init_root ();              /* requires continuations */
 #ifdef USE_THREADS
@@ -503,9 +492,10 @@ scm_init_guile_1 (SCM_STACKITEM *base)
   scm_init_gdbint ();           /* Requires strports */
   scm_init_hash ();
   scm_init_hashtab ();
+  scm_init_deprecation ();      /* Requires hashtabs */
   scm_init_objprop ();
   scm_init_properties ();
-  scm_init_hooks ();        /* Requires objprop until hook names are removed */
+  scm_init_hooks ();            /* Requires smob_prehistory */
   scm_init_gc ();              /* Requires hooks, async */
 #ifdef GUILE_ISELECT
   scm_init_iselect ();
@@ -538,21 +528,19 @@ scm_init_guile_1 (SCM_STACKITEM *base)
   scm_init_srcprop ();
 #endif
   scm_init_stackchk ();
-  scm_init_struct ();
-  scm_init_stacks ();   /* Requires struct */
+  scm_init_strings ();
+  scm_init_struct ();   /* Requires strings */
+  scm_init_stacks ();   /* Requires strings, struct */
   scm_init_symbols ();
-  scm_init_tag ();
   scm_init_values ();   /* Requires struct */
-  scm_init_load ();
+  scm_init_load ();     /* Requires strings */
   scm_init_objects (); /* Requires struct */
-  scm_init_print ();   /* Requires struct */
+  scm_init_print ();   /* Requires strings, struct */
   scm_init_read ();
   scm_init_stime ();
-  scm_init_strings ();
   scm_init_strorder ();
   scm_init_strop ();
   scm_init_throw ();
-  scm_init_variable ();
   scm_init_vectors ();
   scm_init_version ();
   scm_init_weaks ();
@@ -574,8 +562,8 @@ scm_init_guile_1 (SCM_STACKITEM *base)
   scm_init_dynamic_linking ();
   scm_init_lang ();
   scm_init_script ();
-  
-  scm_init_oop_goops_goopscore_module ();
+
+  scm_init_goops ();
   
   scm_initialized_p = 1;
 
@@ -586,12 +574,11 @@ scm_init_guile_1 (SCM_STACKITEM *base)
   scm_stack_checking_enabled_p = SCM_STACK_CHECKING_P;
 #endif
 
-  scm_load_startup_files ();
-
-  /* this is located here, not from a deep understanding of the
-     module system, but as a way of avoiding segv and other
-     undesirable side effects that arise from various alternatives.  */
   scm_init_rdelim ();
+  scm_init_rw ();
+  scm_init_extensions ();
+
+  scm_load_startup_files ();
 }
 
 /* Record here whether SCM_BOOT_GUILE_1 has already been called.  This