Use `SCM_SNAME ()' when requesting the name of a subr.
[bpt/guile.git] / libguile / procs.c
index a625b6e..acd7e46 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1999,2000,2001, 2006, 2008 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 
 \f
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
 #include "libguile/_scm.h"
 
@@ -41,14 +44,14 @@ scm_t_subr_entry *scm_subr_table;
 /* Increased to 800 on 2001-05-07 -- Guile now has 779 primitives on
    startup, 786 with guile-readline.  'martin */
 
-long scm_subr_table_size = 0;
-long scm_subr_table_room = 800;
+static unsigned long scm_subr_table_size = 0;
+static unsigned long scm_subr_table_room = 800;
 
 SCM 
 scm_c_make_subr (const char *name, long type, SCM (*fcn) ())
 {
   register SCM z;
-  long entry;
+  unsigned long entry;
 
   if (scm_subr_table_size == scm_subr_table_room)
     {
@@ -63,7 +66,7 @@ scm_c_make_subr (const char *name, long type, SCM (*fcn) ())
   entry = scm_subr_table_size;
   z = scm_cell ((entry << 8) + type, (scm_t_bits) fcn);
   scm_subr_table[entry].handle = z;
-  scm_subr_table[entry].name = scm_str2symbol (name);
+  scm_subr_table[entry].name = scm_from_locale_symbol (name);
   scm_subr_table[entry].generic = 0;
   scm_subr_table[entry].properties = SCM_EOL;
   scm_subr_table_size++;
@@ -75,7 +78,7 @@ SCM
 scm_c_define_subr (const char *name, long type, SCM (*fcn) ())
 {
   SCM subr = scm_c_make_subr (name, type, fcn);
-  scm_define (SCM_SUBR_ENTRY(subr).name, subr);
+  scm_define (SCM_SNAME (subr), subr);
   return subr;
 }
 
@@ -96,7 +99,7 @@ scm_c_make_subr_with_generic (const char *name,
                              long type, SCM (*fcn) (), SCM *gf)
 {
   SCM subr = scm_c_make_subr (name, type, fcn);
-  SCM_SUBR_ENTRY(subr).generic = gf;
+  SCM_SUBR_GENERIC (subr) = gf;
   return subr;
 }
 
@@ -105,7 +108,7 @@ scm_c_define_subr_with_generic (const char *name,
                                long type, SCM (*fcn) (), SCM *gf)
 {
   SCM subr = scm_c_make_subr_with_generic (name, type, fcn, gf);
-  scm_define (SCM_SUBR_ENTRY(subr).name, subr);
+  scm_define (SCM_SNAME (subr), subr);
   return subr;
 }
 
@@ -204,7 +207,7 @@ SCM_DEFINE (scm_thunk_p, "thunk?", 1, 0, 0,
       switch (SCM_TYP7 (obj))
        {
        case scm_tcs_closures:
-         return scm_from_bool (!SCM_CONSP (SCM_CLOSURE_FORMALS (obj)));
+         return scm_from_bool (!scm_is_pair (SCM_CLOSURE_FORMALS (obj)));
        case scm_tc7_subr_0:
        case scm_tc7_subr_1o:
        case scm_tc7_lsubr:
@@ -255,7 +258,7 @@ SCM_DEFINE (scm_procedure_documentation, "procedure-documentation", 1, 0, 0,
     {
     case scm_tcs_closures:
       code = SCM_CLOSURE_BODY (proc);
-      if (SCM_NULLP (SCM_CDR (code)))
+      if (scm_is_null (SCM_CDR (code)))
        return SCM_BOOL_F;
       code = SCM_CAR (code);
       if (scm_is_string (code))