* scheme-io.texi: Removed obsolete section Binary IO. Added
[bpt/guile.git] / libguile / options.c
index bb63cb2..c5260e6 100644 (file)
@@ -1,4 +1,4 @@
-/*     Copyright (C) 1995, 1996, 1998 Free Software Foundation
+/*     Copyright (C) 1995, 1996, 1998, 2000 Free Software Foundation
  * 
  * 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
 
 \f
 
-#include <stdio.h>
-#include "_scm.h"
-#include "strings.h"
+#include "libguile/_scm.h"
+#include "libguile/strings.h"
 
-#include "options.h"
+#include "libguile/options.h"
 \f
 
 /* {Run-time options}
@@ -124,9 +123,7 @@ static SCM protected_objects;
 SCM
 scm_options (SCM arg, scm_option options[], int n, const char *s)
 {
-  int i, docp = (!SCM_UNBNDP (arg)
-                && !SCM_NULLP (arg)
-                && (SCM_IMP (arg) || SCM_NCONSP (arg)));
+  int i, docp = (!SCM_UNBNDP (arg) && !SCM_NULLP (arg) && !SCM_CONSP (arg));
   /* Let `arg' GC protect the arguments */
   SCM new_mode = arg, ans = SCM_EOL, ls;
   for (i = 0; i < n; ++i)
@@ -187,12 +184,13 @@ scm_options (SCM arg, scm_option options[], int n, const char *s)
                  goto cont;
                case SCM_OPTION_SCM:
                  new_mode = SCM_CDR (new_mode);
-                 flags[i] = SCM_UNPACK_CAR (new_mode);
+                 flags[i] = SCM_UNPACK (SCM_CAR (new_mode));
                  goto cont;
                }
 #ifndef SCM_RECKLESS
          scm_must_free ((char *) flags);
-         scm_wta (SCM_CAR (new_mode), "Unknown mode flag", s);
+         scm_misc_error (s, "Unknown mode flag: ~S", 
+                         SCM_LIST1 (SCM_CAR (new_mode)));
 #endif
        cont:
          new_mode = SCM_CDR (new_mode);
@@ -220,9 +218,15 @@ scm_init_opts (SCM (*func) (SCM), scm_option options[], int n)
 
   for (i = 0; i < n; ++i)
     {
-      options[i].name =        (char *) SCM_CAR (scm_sysintern0 (options[i].name));
-      options[i].doc = (char *) scm_permanent_object (scm_take0str
-                                                     (options[i].doc));
+      SCM name;
+      SCM doc;
+
+      name = scm_str2symbol (options[i].name);
+      options[i].name =        (char *) name;
+      scm_permanent_object (name);
+      doc = scm_take0str (options[i].doc);
+      options[i].doc = (char *) doc;
+      scm_permanent_object (doc);
       if (options[i].type == SCM_OPTION_SCM)
        SCM_SETCDR (protected_objects,
                    scm_cons (SCM_PACK(options[i].val), SCM_CDR (protected_objects)));
@@ -235,7 +239,9 @@ void
 scm_init_options ()
 {
   protected_objects = scm_permanent_object (scm_cons (SCM_UNDEFINED, SCM_EOL));
-#include "options.x"
+#ifndef SCM_MAGIC_SNARFER
+#include "libguile/options.x"
+#endif
 }
 
 /*