* __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
[bpt/guile.git] / libguile / init.c
index f768cc7..076b05c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002 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
@@ -83,9 +83,7 @@
 #include "libguile/hash.h"
 #include "libguile/hashtab.h"
 #include "libguile/hooks.h"
-#ifdef GUILE_ISELECT
 #include "libguile/iselect.h"
-#endif
 #include "libguile/ioext.h"
 #include "libguile/keywords.h"
 #include "libguile/lang.h"
@@ -162,7 +160,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
@@ -181,19 +178,12 @@ start_stack (void *base)
   /* Create an object to hold the root continuation.
    */
   {
-    scm_t_contregs *contregs = scm_must_malloc (sizeof (scm_t_contregs),
+    scm_t_contregs *contregs = scm_gc_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_c_make_vector (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
@@ -207,7 +197,7 @@ static char remsg[] = "remove\n#define ", addmsg[] = "add\n#define ";
 
 
 static void 
-fixconfig (char *s1,char *s2,int s)
+fixconfig (char *s1, char *s2, int s)
 {
   fputs (s1, stderr);
   fputs (s2, stderr);
@@ -319,20 +309,17 @@ scm_init_standard_ports ()
      buffered input on stdin can reset \ex{(current-input-port)} to
      block buffering for higher performance.  */
 
-  scm_def_inp
+  scm_cur_inp
     = scm_standard_stream_to_port (0, 
                                   isatty (0) ? "r0" : "r",
                                   "standard input");
-  scm_def_outp = scm_standard_stream_to_port (1,
+  scm_cur_outp = scm_standard_stream_to_port (1,
                                              isatty (1) ? "w0" : "w",
                                              "standard output");
-  scm_def_errp = scm_standard_stream_to_port (2,
+  scm_cur_errp = scm_standard_stream_to_port (2,
                                              isatty (2) ? "w0" : "w",
                                              "standard error");
 
-  scm_cur_inp = scm_def_inp;
-  scm_cur_outp = scm_def_outp;
-  scm_cur_errp = scm_def_errp;
   scm_cur_loadp = SCM_BOOL_F;
 }
 
@@ -457,14 +444,17 @@ scm_init_guile_1 (SCM_STACKITEM *base)
 
   scm_ints_disabled = 1;
   scm_block_gc = 1;
-  
+
+  scm_threads_prehistory ();
   scm_ports_prehistory ();
   scm_smob_prehistory ();
   scm_tables_prehistory ();
 #ifdef GUILE_DEBUG_MALLOC
   scm_debug_malloc_prehistory ();
 #endif
-  scm_init_storage ();           /* requires smob_prehistory */
+  if (scm_init_storage ())        /* requires threads and smob_prehistory */
+    abort ();
+  
   scm_struct_prehistory ();      /* requires storage */
   scm_symbols_prehistory ();      /* requires storage */
   scm_weaks_prehistory ();       /* requires storage */
@@ -474,11 +464,10 @@ scm_init_guile_1 (SCM_STACKITEM *base)
   scm_init_variable ();           /* all bindings need variables */
   scm_init_continuations ();
   scm_init_root ();              /* requires continuations */
-#ifdef USE_THREADS
   scm_init_threads (base);
-#endif
   start_stack (base);
   scm_init_gsubr ();
+  scm_init_thread_procs ();       /* requires gsubrs */
   scm_init_procprop ();
   scm_init_environments ();
   scm_init_feature ();
@@ -505,9 +494,6 @@ scm_init_guile_1 (SCM_STACKITEM *base)
   scm_init_properties ();
   scm_init_hooks ();            /* Requires smob_prehistory */
   scm_init_gc ();              /* Requires hooks, async */
-#ifdef GUILE_ISELECT
-  scm_init_iselect ();
-#endif
   scm_init_ioext ();
   scm_init_keywords ();
   scm_init_list ();
@@ -567,8 +553,12 @@ scm_init_guile_1 (SCM_STACKITEM *base)
   scm_init_simpos ();
   scm_init_load_path ();
   scm_init_standard_ports ();  /* Requires fports */
+#ifdef DYNAMIC_LINKING
   scm_init_dynamic_linking ();
+#endif
+#ifdef SCM_ENABLE_ELISP
   scm_init_lang ();
+#endif /* SCM_ENABLE_ELISP */
   scm_init_script ();
 
   scm_init_goops ();