Really disable thread-local storage on NetBSD 5.0.
[bpt/guile.git] / libguile / deprecated.c
index 042deba..30e939b 100644 (file)
@@ -2,31 +2,41 @@
    deprecate something, move it here when that is feasible.
 */
 
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006, 2008, 2009 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
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3 of
+ * the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * 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
  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#define SCM_BUILDING_DEPRECATED_CODE
+
 #include "libguile/_scm.h"
+#include "libguile/async.h"
 #include "libguile/deprecated.h"
+#include "libguile/discouraged.h"
 #include "libguile/deprecation.h"
 #include "libguile/snarf.h"
 #include "libguile/validate.h"
 #include "libguile/strings.h"
-#include "libguile/strop.h"
+#include "libguile/srfi-13.h"
 #include "libguile/modules.h"
+#include "libguile/generalized-arrays.h"
 #include "libguile/eval.h"
 #include "libguile/smob.h"
 #include "libguile/procprop.h"
 #include "libguile/strports.h"
 #include "libguile/smob.h"
 #include "libguile/alist.h"
+#include "libguile/keywords.h"
+#include "libguile/socket.h"
+#include "libguile/feature.h"
 
 #include <stdio.h>
 #include <string.h>
 
+#include <arpa/inet.h>
+
 #if (SCM_ENABLE_DEPRECATED == 1)
 
 /* From print.c: Internal symbol names of isyms.  Deprecated in guile 1.7.0 on
@@ -179,8 +194,8 @@ SCM_DEFINE (scm_registered_modules, "c-registered-modules", 0, 0, 0,
 
   res = SCM_EOL;
   for (md = registered_mods; md; md = md->link)
-    res = scm_cons (scm_cons (scm_makfrom0str (md->module_name),
-                             scm_ulong2num ((unsigned long) md->init_func)),
+    res = scm_cons (scm_cons (scm_from_locale_string (md->module_name),
+                             scm_from_ulong ((unsigned long) md->init_func)),
                    res);
   return res;
 }
@@ -197,7 +212,7 @@ SCM_DEFINE (scm_clear_registered_modules, "c-clear-registered-modules", 0, 0, 0,
 {
   struct moddata *md1, *md2;
 
-  SCM_DEFER_INTS;
+  SCM_CRITICAL_SECTION_START;
 
   for (md1 = registered_mods; md1; md1 = md2)
     {
@@ -206,7 +221,7 @@ SCM_DEFINE (scm_clear_registered_modules, "c-clear-registered-modules", 0, 0, 0,
     }
   registered_mods = NULL;
 
-  SCM_ALLOW_INTS;
+  SCM_CRITICAL_SECTION_END;
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
@@ -271,7 +286,7 @@ static SCM
 scm_module_full_name (SCM name)
 {
   init_module_stuff ();
-  if (SCM_EQ_P (SCM_CAR (name), scm_sym_app))
+  if (scm_is_eq (SCM_CAR (name), scm_sym_app))
     return name;
   else
     return scm_append (scm_list_2 (module_prefix, name));
@@ -315,14 +330,14 @@ scm_load_scheme_module (SCM name)
 static void
 maybe_close_port (void *data, SCM port)
 {
-  SCM except = (SCM)data;
+  SCM except_set = (SCM) data;
 
-  while (!SCM_NULLP (except))
+  while (!scm_is_null (except_set))
     {
-      SCM p = SCM_COERCE_OUTPORT (SCM_CAR (except));
-      if (SCM_EQ_P (p, port))
+      SCM p = SCM_COERCE_OUTPORT (SCM_CAR (except_set));
+      if (scm_is_eq (p, port))
        return;
-      except = SCM_CDR (except);
+      except_set = SCM_CDR (except_set);
     }
 
   scm_close_port (port);
@@ -341,7 +356,7 @@ SCM_DEFINE (scm_close_all_ports_except, "close-all-ports-except", 0, 0, 1,
   SCM p;
   SCM_VALIDATE_REST_ARGUMENT (ports);
   
-  for (p = ports; !SCM_NULLP (p); p = SCM_CDR (p))
+  for (p = ports; !scm_is_null (p); p = SCM_CDR (p))
     SCM_VALIDATE_OPPORT (SCM_ARG1, SCM_COERCE_OUTPORT (SCM_CAR (p)));
 
   scm_c_port_for_each (maybe_close_port, ports);
@@ -379,17 +394,17 @@ SCM
 scm_makstr (size_t len, int dummy)
 {
   scm_c_issue_deprecation_warning
-    ("'scm_makstr' is deprecated.  Use 'scm_allocate_string' instead.");
-  return scm_allocate_string (len);
+    ("'scm_makstr' is deprecated.  Use 'scm_c_make_string' instead.");
+  return scm_c_make_string (len, SCM_UNDEFINED);
 }
 
 SCM 
 scm_makfromstr (const char *src, size_t len, int dummy SCM_UNUSED)
 {
   scm_c_issue_deprecation_warning ("`scm_makfromstr' is deprecated. "
-                                  "Use `scm_mem2string' instead.");
+                                  "Use `scm_from_locale_stringn' instead.");
 
-  return scm_mem2string (src, len);
+  return scm_from_locale_stringn (src, len);
 }
 
 SCM
@@ -429,7 +444,7 @@ scm_create_hook (const char *name, int n_args)
     ("'scm_create_hook' is deprecated.  "
      "Use 'scm_make_hook' and 'scm_c_define' instead.");
   {
-    SCM hook = scm_make_hook (SCM_MAKINUM (n_args));
+    SCM hook = scm_make_hook (scm_from_int (n_args));
     scm_c_define (name, hook);
     return scm_permanent_object (hook);
   }
@@ -445,9 +460,9 @@ SCM_DEFINE (scm_sloppy_memq, "sloppy-memq", 2, 0, 0,
   scm_c_issue_deprecation_warning
     ("'sloppy-memq' is deprecated.  Use 'memq' instead.");
 
-  for(;  SCM_CONSP (lst);  lst = SCM_CDR(lst))
+  for(;  scm_is_pair (lst);  lst = SCM_CDR(lst))
     {
-      if (SCM_EQ_P (SCM_CAR (lst), x))
+      if (scm_is_eq (SCM_CAR (lst), x))
        return lst;
     }
   return lst;
@@ -465,9 +480,9 @@ SCM_DEFINE (scm_sloppy_memv, "sloppy-memv", 2, 0, 0,
   scm_c_issue_deprecation_warning
     ("'sloppy-memv' is deprecated.  Use 'memv' instead.");
 
-  for(;  SCM_CONSP (lst);  lst = SCM_CDR(lst))
+  for(;  scm_is_pair (lst);  lst = SCM_CDR(lst))
     {
-      if (! SCM_FALSEP (scm_eqv_p (SCM_CAR (lst), x)))
+      if (! scm_is_false (scm_eqv_p (SCM_CAR (lst), x)))
        return lst;
     }
   return lst;
@@ -485,9 +500,9 @@ SCM_DEFINE (scm_sloppy_member, "sloppy-member", 2, 0, 0,
   scm_c_issue_deprecation_warning
     ("'sloppy-member' is deprecated.  Use 'member' instead.");
 
-  for(;  SCM_CONSP (lst);  lst = SCM_CDR(lst))
+  for(;  scm_is_pair (lst);  lst = SCM_CDR(lst))
     {
-      if (! SCM_FALSEP (scm_equal_p (SCM_CAR (lst), x)))
+      if (! scm_is_false (scm_equal_p (SCM_CAR (lst), x)))
        return lst;
     }
   return lst;
@@ -623,6 +638,21 @@ scm_set_smob_mfpe (long tc,
   if (equalp) scm_set_smob_equalp (tc, equalp);
 }
 
+size_t
+scm_smob_free (SCM obj)
+{
+  long n = SCM_SMOBNUM (obj);
+
+  scm_c_issue_deprecation_warning
+    ("`scm_smob_free' is deprecated.  "
+     "It is no longer needed.");
+
+  if (scm_smobs[n].size > 0)
+    scm_gc_free ((void *) SCM_CELL_WORD_1 (obj), 
+                scm_smobs[n].size, SCM_SMOBNAME (n));
+  return 0;
+}
+
 SCM
 scm_read_0str (char *expr)
 {
@@ -653,8 +683,7 @@ char *
 scm_i_object_chars (SCM obj)
 {
   scm_c_issue_deprecation_warning 
-    ("SCM_CHARS is deprecated.  Use SCM_STRING_CHARS or "
-     "SCM_SYMBOL_CHARS instead.");
+    ("SCM_CHARS is deprecated.  See the manual for alternatives.");
   if (SCM_STRINGP (obj))
     return SCM_STRING_CHARS (obj);
   if (SCM_SYMBOLP (obj))
@@ -666,7 +695,8 @@ long
 scm_i_object_length (SCM obj)
 {
   scm_c_issue_deprecation_warning 
-    ("SCM_LENGTH is deprecated.  Use SCM_STRING_LENGTH instead, for example.");
+    ("SCM_LENGTH is deprecated.  "
+     "Use scm_c_string_length instead, for example, or see the manual.");
   if (SCM_STRINGP (obj))
     return SCM_STRING_LENGTH (obj);
   if (SCM_SYMBOLP (obj))
@@ -680,24 +710,24 @@ SCM
 scm_sym2ovcell_soft (SCM sym, SCM obarray)
 {
   SCM lsym, z;
-  size_t hash = SCM_SYMBOL_HASH (sym) % SCM_VECTOR_LENGTH (obarray);
+  size_t hash = scm_i_symbol_hash (sym) % SCM_VECTOR_LENGTH (obarray);
 
   scm_c_issue_deprecation_warning ("`scm_sym2ovcell_soft' is deprecated. "
                                   "Use hashtables instead.");
 
-  SCM_REDEFER_INTS;
+  SCM_CRITICAL_SECTION_START;
   for (lsym = SCM_VECTOR_REF (obarray, hash);
        SCM_NIMP (lsym);
        lsym = SCM_CDR (lsym))
     {
       z = SCM_CAR (lsym);
-      if (SCM_EQ_P (SCM_CAR (z), sym))
+      if (scm_is_eq (SCM_CAR (z), sym))
        {
-         SCM_REALLOW_INTS;
+         SCM_CRITICAL_SECTION_END;
          return z;
        }
     }
-  SCM_REALLOW_INTS;
+  SCM_CRITICAL_SECTION_END;
   return SCM_BOOL_F;
 }
 
@@ -712,7 +742,7 @@ scm_sym2ovcell (SCM sym, SCM obarray)
                                   "Use hashtables instead.");
 
   answer = scm_sym2ovcell_soft (sym, obarray);
-  if (!SCM_FALSEP (answer))
+  if (scm_is_true (answer))
     return answer;
   SCM_MISC_ERROR ("uninterned symbol: ~S", scm_list_1 (sym));
   return SCM_UNSPECIFIED;              /* not reached */
@@ -740,18 +770,14 @@ scm_sym2ovcell (SCM sym, SCM obarray)
    return (SYMBOL . SCM_UNDEFINED).  */
 
 
-SCM 
-scm_intern_obarray_soft (const char *name,size_t len,SCM obarray,unsigned int softness)
+static SCM 
+intern_obarray_soft (SCM symbol, SCM obarray, unsigned int softness)
 {
-  SCM symbol = scm_mem2symbol (name, len);
-  size_t raw_hash = SCM_SYMBOL_HASH (symbol);
+  size_t raw_hash = scm_i_symbol_hash (symbol);
   size_t hash;
   SCM lsym;
 
-  scm_c_issue_deprecation_warning ("`scm_intern_obarray_soft' is deprecated. "
-                                  "Use hashtables instead.");
-
-  if (SCM_FALSEP (obarray))
+  if (scm_is_false (obarray))
     {
       if (softness)
        return SCM_BOOL_F;
@@ -766,7 +792,7 @@ scm_intern_obarray_soft (const char *name,size_t len,SCM obarray,unsigned int so
     {
       SCM a = SCM_CAR (lsym);
       SCM z = SCM_CAR (a);
-      if (SCM_EQ_P (z, symbol))
+      if (scm_is_eq (z, symbol))
        return a;
     }
   
@@ -786,6 +812,18 @@ scm_intern_obarray_soft (const char *name,size_t len,SCM obarray,unsigned int so
 }
 
 
+SCM 
+scm_intern_obarray_soft (const char *name, size_t len, SCM obarray,
+                         unsigned int softness)
+{
+  SCM symbol = scm_from_locale_symboln (name, len);
+
+  scm_c_issue_deprecation_warning ("`scm_intern_obarray_soft' is deprecated. "
+                                  "Use hashtables instead.");
+
+  return intern_obarray_soft (symbol, obarray, softness);
+}
+  
 SCM
 scm_intern_obarray (const char *name,size_t len,SCM obarray)
 {
@@ -826,26 +864,23 @@ SCM_DEFINE (scm_string_to_obarray_symbol, "string->obarray-symbol", 2, 1, 0,
   int softness;
 
   SCM_VALIDATE_STRING (2, s);
-  SCM_ASSERT (SCM_BOOLP (o) || SCM_VECTORP (o), o, SCM_ARG1, FUNC_NAME);
+  SCM_ASSERT (scm_is_bool (o) || SCM_VECTORP (o), o, SCM_ARG1, FUNC_NAME);
 
   scm_c_issue_deprecation_warning ("`string->obarray-symbol' is deprecated. "
                                   "Use hashtables instead.");
 
-  softness = (!SCM_UNBNDP (softp) && !SCM_FALSEP(softp));
+  softness = (!SCM_UNBNDP (softp) && scm_is_true(softp));
   /* iron out some screwy calling conventions */
-  if (SCM_FALSEP (o))
+  if (scm_is_false (o))
     {
       /* nothing interesting to do here. */
       return scm_string_to_symbol (s);
     }
-  else if (SCM_EQ_P (o, SCM_BOOL_T))
+  else if (scm_is_eq (o, SCM_BOOL_T))
     o = SCM_BOOL_F;
     
-  vcell = scm_intern_obarray_soft (SCM_STRING_CHARS(s),
-                                  SCM_STRING_LENGTH (s),
-                                  o,
-                                  softness);
-  if (SCM_FALSEP (vcell))
+  vcell = intern_obarray_soft (scm_string_to_symbol (s), o, softness);
+  if (scm_is_false (vcell))
     return vcell;
   answer = SCM_CAR (vcell);
   return answer;
@@ -861,16 +896,16 @@ SCM_DEFINE (scm_intern_symbol, "intern-symbol", 2, 0, 0,
 {
   size_t hval;
   SCM_VALIDATE_SYMBOL (2,s);
-  if (SCM_FALSEP (o))
+  if (scm_is_false (o))
     return SCM_UNSPECIFIED;
 
   scm_c_issue_deprecation_warning ("`intern-symbol' is deprecated. "
                                   "Use hashtables instead.");
 
   SCM_VALIDATE_VECTOR (1,o);
-  hval = SCM_SYMBOL_HASH (s) % SCM_VECTOR_LENGTH (o);
+  hval = scm_i_symbol_hash (s) % SCM_VECTOR_LENGTH (o);
   /* If the symbol is already interned, simply return. */
-  SCM_REDEFER_INTS;
+  SCM_CRITICAL_SECTION_START;
   {
     SCM lsym;
     SCM sym;
@@ -879,9 +914,9 @@ SCM_DEFINE (scm_intern_symbol, "intern-symbol", 2, 0, 0,
         lsym = SCM_CDR (lsym))
       {
        sym = SCM_CAR (lsym);
-       if (SCM_EQ_P (SCM_CAR (sym), s))
+       if (scm_is_eq (SCM_CAR (sym), s))
          {
-           SCM_REALLOW_INTS;
+           SCM_CRITICAL_SECTION_END;
            return SCM_UNSPECIFIED;
          }
       }
@@ -889,7 +924,7 @@ SCM_DEFINE (scm_intern_symbol, "intern-symbol", 2, 0, 0,
                    scm_acons (s, SCM_UNDEFINED,
                               SCM_VECTOR_REF (o, hval)));
   }
-  SCM_REALLOW_INTS;
+  SCM_CRITICAL_SECTION_END;
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
@@ -907,11 +942,11 @@ SCM_DEFINE (scm_unintern_symbol, "unintern-symbol", 2, 0, 0,
                                   "Use hashtables instead.");
 
   SCM_VALIDATE_SYMBOL (2,s);
-  if (SCM_FALSEP (o))
+  if (scm_is_false (o))
     return SCM_BOOL_F;
   SCM_VALIDATE_VECTOR (1,o);
-  hval = SCM_SYMBOL_HASH (s) % SCM_VECTOR_LENGTH (o);
-  SCM_DEFER_INTS;
+  hval = scm_i_symbol_hash (s) % SCM_VECTOR_LENGTH (o);
+  SCM_CRITICAL_SECTION_START;
   {
     SCM lsym_follow;
     SCM lsym;
@@ -921,19 +956,19 @@ SCM_DEFINE (scm_unintern_symbol, "unintern-symbol", 2, 0, 0,
         lsym_follow = lsym, lsym = SCM_CDR (lsym))
       {
        sym = SCM_CAR (lsym);
-       if (SCM_EQ_P (SCM_CAR (sym), s))
+       if (scm_is_eq (SCM_CAR (sym), s))
          {
            /* Found the symbol to unintern. */
-           if (SCM_FALSEP (lsym_follow))
+           if (scm_is_false (lsym_follow))
              SCM_VECTOR_SET (o, hval, lsym);
            else
              SCM_SETCDR (lsym_follow, SCM_CDR(lsym));
-           SCM_ALLOW_INTS;
+           SCM_CRITICAL_SECTION_END;
            return SCM_BOOL_T;
          }
       }
   }
-  SCM_ALLOW_INTS;
+  SCM_CRITICAL_SECTION_END;
   return SCM_BOOL_F;
 }
 #undef FUNC_NAME
@@ -952,7 +987,7 @@ SCM_DEFINE (scm_symbol_binding, "symbol-binding", 2, 0, 0,
                                   "Use hashtables instead.");
 
   SCM_VALIDATE_SYMBOL (2,s);
-  if (SCM_FALSEP (o))
+  if (scm_is_false (o))
     return scm_variable_ref (scm_lookup (s));
   SCM_VALIDATE_VECTOR (1,o);
   vcell = scm_sym2ovcell (s, o);
@@ -973,7 +1008,7 @@ SCM_DEFINE (scm_symbol_interned_p, "symbol-interned?", 2, 0, 0,
                                   "Use hashtables instead.");
 
   SCM_VALIDATE_SYMBOL (2,s);
-  if (SCM_FALSEP (o))
+  if (scm_is_false (o))
     {
       SCM var = scm_sym2var (s, SCM_BOOL_F, SCM_BOOL_F);
       if (var != SCM_BOOL_F)
@@ -1005,7 +1040,7 @@ SCM_DEFINE (scm_symbol_bound_p, "symbol-bound?", 2, 0, 0,
                                   "Use hashtables instead.");
 
   SCM_VALIDATE_SYMBOL (2,s);
-  if (SCM_FALSEP (o))
+  if (scm_is_false (o))
     {
       SCM var = scm_sym2var (s, SCM_BOOL_F, SCM_BOOL_F);
       if (SCM_VARIABLEP(var) && !SCM_UNBNDP(SCM_VARIABLE_REF(var)))
@@ -1014,7 +1049,7 @@ SCM_DEFINE (scm_symbol_bound_p, "symbol-bound?", 2, 0, 0,
     }
   SCM_VALIDATE_VECTOR (1,o);
   vcell = scm_sym2ovcell_soft (s, o);
-  return SCM_BOOL (SCM_NIMP (vcell) && !SCM_UNBNDP (SCM_CDR (vcell)));
+  return scm_from_bool (SCM_NIMP (vcell) && !SCM_UNBNDP (SCM_CDR (vcell)));
 }
 #undef FUNC_NAME
 
@@ -1032,7 +1067,7 @@ SCM_DEFINE (scm_symbol_set_x, "symbol-set!", 3, 0, 0,
                                   "Use the module system instead.");
 
   SCM_VALIDATE_SYMBOL (2,s);
-  if (SCM_FALSEP (o))
+  if (scm_is_false (o))
     {
       scm_define (s, v);
       return SCM_UNSPECIFIED;
@@ -1061,7 +1096,8 @@ SCM_DEFINE (scm_gentemp, "gentemp", 0, 2, 0,
 {
   char buf[MAX_PREFIX_LENGTH + SCM_INTBUFLEN];
   char *name = buf;
-  int len, n_digits;
+  int n_digits;
+  size_t len;
 
   scm_c_issue_deprecation_warning ("`gentemp' is deprecated. "
                                   "Use `gensym' instead.");
@@ -1074,22 +1110,21 @@ SCM_DEFINE (scm_gentemp, "gentemp", 0, 2, 0,
   else
     {
       SCM_VALIDATE_STRING (1, prefix);
-      len = SCM_STRING_LENGTH (prefix);
-      if (len > MAX_PREFIX_LENGTH)
-       name = SCM_MUST_MALLOC (MAX_PREFIX_LENGTH + SCM_INTBUFLEN);
-      strncpy (name, SCM_STRING_CHARS (prefix), len);
+      len = scm_i_string_length (prefix);
+      name = scm_to_locale_stringn (prefix, &len);
+      name = scm_realloc (name, len + SCM_INTBUFLEN);
     }
 
   if (SCM_UNBNDP (obarray))
     return scm_gensym (prefix);
   else
-    SCM_ASSERT ((SCM_VECTORP (obarray) || SCM_WVECTP (obarray)),
+    SCM_ASSERT ((scm_is_vector (obarray) || SCM_I_WVECTP (obarray)),
                obarray,
                SCM_ARG2,
                FUNC_NAME);
   do
     n_digits = scm_iint2str (gentemp_counter++, 10, &name[len]);
-  while (!SCM_FALSEP (scm_intern_obarray_soft (name,
+  while (scm_is_true (scm_intern_obarray_soft (name,
                                               len + n_digits,
                                               obarray,
                                               1)));
@@ -1099,12 +1134,464 @@ SCM_DEFINE (scm_gentemp, "gentemp", 0, 2, 0,
                                         obarray,
                                         0);
     if (name != buf)
-      scm_must_free (name);
+      free (name);
     return SCM_CAR (vcell);
   }
 }
 #undef FUNC_NAME
 
+SCM
+scm_i_makinum (scm_t_signed_bits val)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_MAKINUM is deprecated.  Use scm_from_int or similar instead.");
+  return SCM_I_MAKINUM (val);
+}
+
+int
+scm_i_inump (SCM obj)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_INUMP is deprecated.  Use scm_is_integer or similar instead.");
+  return SCM_I_INUMP (obj);
+}
+
+scm_t_signed_bits
+scm_i_inum (SCM obj)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_INUM is deprecated.  Use scm_to_int or similar instead.");
+  return scm_to_intmax (obj);
+}
+
+char *
+scm_c_string2str (SCM obj, char *str, size_t *lenp)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_c_string2str is deprecated.  Use scm_to_locale_stringbuf or similar instead.");
+  
+  if (str == NULL)
+    {
+      char *result = scm_to_locale_string (obj);
+      if (lenp)
+       *lenp = scm_i_string_length (obj);
+      return result;
+    }
+  else
+    {
+      /* Pray that STR is large enough.
+       */
+      size_t len = scm_to_locale_stringbuf (obj, str, SCM_I_SIZE_MAX);
+      str[len] = '\0';
+      if (lenp)
+       *lenp = len;
+      return str;
+    }
+}
+
+char *
+scm_c_substring2str (SCM obj, char *str, size_t start, size_t len)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_c_substring2str is deprecated.  Use scm_substring plus scm_to_locale_stringbuf instead.");
+
+  if (start)
+    obj = scm_substring (obj, scm_from_size_t (start), SCM_UNDEFINED);
+
+  scm_to_locale_stringbuf (obj, str, len);
+  return str;
+}
+
+/* Converts the given Scheme symbol OBJ into a C string, containing a copy
+   of OBJ's content with a trailing null byte.  If LENP is non-NULL, set
+   *LENP to the string's length.
+
+   When STR is non-NULL it receives the copy and is returned by the function,
+   otherwise new memory is allocated and the caller is responsible for 
+   freeing it via free().  If out of memory, NULL is returned.
+
+   Note that Scheme symbols may contain arbitrary data, including null
+   characters.  This means that null termination is not a reliable way to 
+   determine the length of the returned value.  However, the function always 
+   copies the complete contents of OBJ, and sets *LENP to the length of the
+   scheme symbol (if LENP is non-null).  */
+char *
+scm_c_symbol2str (SCM obj, char *str, size_t *lenp)
+{
+  return scm_c_string2str (scm_symbol_to_string (obj), str, lenp);
+}
+
+double
+scm_truncate (double x)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_truncate is deprecated.  Use scm_c_truncate instead.");
+  return scm_c_truncate (x);
+}
+
+double
+scm_round (double x)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_round is deprecated.  Use scm_c_round instead.");
+  return scm_c_round (x);
+}
+
+char *
+scm_i_deprecated_symbol_chars (SCM sym)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_SYMBOL_CHARS is deprecated.  Use scm_symbol_to_string.");
+
+  return (char *)scm_i_symbol_chars (sym);
+}
+
+size_t
+scm_i_deprecated_symbol_length (SCM sym)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_SYMBOL_LENGTH is deprecated.  Use scm_symbol_to_string.");
+  return scm_i_symbol_length (sym);
+}
+
+int
+scm_i_keywordp (SCM obj)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_KEYWORDP is deprecated.  Use scm_is_keyword instead.");
+  return scm_is_keyword (obj);
+}
+
+SCM
+scm_i_keywordsym (SCM keyword)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_KEYWORDSYM is deprecated.  See scm_keyword_to_symbol instead.");
+  return scm_keyword_dash_symbol (keyword);
+}
+
+int
+scm_i_vectorp (SCM x)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_VECTORP is deprecated.  Use scm_is_vector instead.");
+  return SCM_I_IS_VECTOR (x);
+}
+
+unsigned long
+scm_i_vector_length (SCM x)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_VECTOR_LENGTH is deprecated.  Use scm_c_vector_length instead.");
+  return SCM_I_VECTOR_LENGTH (x);
+}
+
+const SCM *
+scm_i_velts (SCM x)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_VELTS is deprecated.  Use scm_vector_elements instead.");
+  return SCM_I_VECTOR_ELTS (x);
+}
+
+SCM *
+scm_i_writable_velts (SCM x)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_WRITABLE_VELTS is deprecated.  "
+     "Use scm_vector_writable_elements instead.");
+  return SCM_I_VECTOR_WELTS (x);
+}
+
+SCM
+scm_i_vector_ref (SCM x, size_t idx)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_VECTOR_REF is deprecated.  "
+     "Use scm_c_vector_ref or scm_vector_elements instead.");
+  return scm_c_vector_ref (x, idx);
+}
+
+void
+scm_i_vector_set (SCM x, size_t idx, SCM val)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_VECTOR_SET is deprecated.  "
+     "Use scm_c_vector_set_x or scm_vector_writable_elements instead.");
+  scm_c_vector_set_x (x, idx, val);
+}
+
+SCM
+scm_vector_equal_p (SCM x, SCM y)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_vector_euqal_p is deprecated.  "
+     "Use scm_equal_p instead.");
+  return scm_equal_p (x, y);
+}
+
+int
+scm_i_arrayp (SCM a)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_ARRAYP is deprecated.  Use scm_is_array instead.");
+  return SCM_I_ARRAYP(a);
+}
+
+size_t
+scm_i_array_ndim (SCM a)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_ARRAY_NDIM is deprecated.  "
+     "Use scm_c_array_rank or scm_array_handle_rank instead.");
+  return scm_c_array_rank (a);
+}
+
+int
+scm_i_array_contp (SCM a)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_ARRAY_CONTP is deprecated.  Do not use it.");
+  return SCM_I_ARRAY_CONTP (a);
+}
+
+scm_t_array *
+scm_i_array_mem (SCM a)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_ARRAY_MEM is deprecated.  Do not use it.");
+  return (scm_t_array *)SCM_I_ARRAY_MEM (a);
+}
+
+SCM
+scm_i_array_v (SCM a)
+{
+  /* We could use scm_shared_array_root here, but it is better to move
+     them away from expecting vectors as the basic storage for arrays.
+  */
+  scm_c_issue_deprecation_warning
+    ("SCM_ARRAY_V is deprecated.  Do not use it.");
+  return SCM_I_ARRAY_V (a);
+}
+
+size_t
+scm_i_array_base (SCM a)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_ARRAY_BASE is deprecated.  Do not use it.");
+  return SCM_I_ARRAY_BASE (a);
+}
+
+scm_t_array_dim *
+scm_i_array_dims (SCM a)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_ARRAY_DIMS is deprecated.  Use scm_array_handle_dims instead.");
+  return SCM_I_ARRAY_DIMS (a);
+}
+
+SCM
+scm_i_cur_inp (void)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_cur_inp is deprecated.  Use scm_current_input_port instead.");
+  return scm_current_input_port ();
+}
+
+SCM
+scm_i_cur_outp (void)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_cur_outp is deprecated.  Use scm_current_output_port instead.");
+  return scm_current_output_port ();
+}
+
+SCM
+scm_i_cur_errp (void)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_cur_errp is deprecated.  Use scm_current_error_port instead.");
+  return scm_current_error_port ();
+}
+
+SCM
+scm_i_cur_loadp (void)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_cur_loadp is deprecated.  Use scm_current_load_port instead.");
+  return scm_current_load_port ();
+}
+
+SCM
+scm_i_progargs (void)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_progargs is deprecated.  Use scm_program_arguments instead.");
+  return scm_program_arguments ();
+}
+
+SCM
+scm_i_deprecated_dynwinds (void)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_dynwinds is deprecated.  Do not use it.");
+  return scm_i_dynwinds ();
+}
+
+scm_t_debug_frame *
+scm_i_deprecated_last_debug_frame (void)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_last_debug_frame is deprecated.  Do not use it.");
+  return scm_i_last_debug_frame ();
+}
+
+SCM_STACKITEM *
+scm_i_stack_base (void)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_stack_base is deprecated.  Do not use it.");
+  return SCM_I_CURRENT_THREAD->base;
+}
+
+int
+scm_i_fluidp (SCM x)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_FLUIDP is deprecated.  Use scm_is_fluid instead.");
+  return scm_is_fluid (x);
+}
+
+\f
+/* Networking.  */
+
+SCM_DEFINE (scm_inet_aton, "inet-aton", 1, 0, 0, 
+            (SCM address),
+           "Convert an IPv4 Internet address from printable string\n"
+           "(dotted decimal notation) to an integer.  E.g.,\n\n"
+           "@lisp\n"
+           "(inet-aton \"127.0.0.1\") @result{} 2130706433\n"
+           "@end lisp")
+#define FUNC_NAME s_scm_inet_aton
+{
+  scm_c_issue_deprecation_warning
+    ("`inet-aton' is deprecated.  Use `inet-pton' instead.");
+
+  return scm_inet_pton (scm_from_int (AF_INET), address);
+}
+#undef FUNC_NAME
+
+
+SCM_DEFINE (scm_inet_ntoa, "inet-ntoa", 1, 0, 0, 
+            (SCM inetid),
+           "Convert an IPv4 Internet address to a printable\n"
+           "(dotted decimal notation) string.  E.g.,\n\n"
+           "@lisp\n"
+           "(inet-ntoa 2130706433) @result{} \"127.0.0.1\"\n"
+           "@end lisp")
+#define FUNC_NAME s_scm_inet_ntoa
+{
+  scm_c_issue_deprecation_warning
+    ("`inet-ntoa' is deprecated.  Use `inet-ntop' instead.");
+
+  return scm_inet_ntop (scm_from_int (AF_INET), inetid);
+}
+#undef FUNC_NAME
+
+
+\f
+void
+scm_i_defer_ints_etc ()
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_DEFER_INTS etc are deprecated.  "
+     "Use a mutex instead if appropriate.");
+}
+
+int
+scm_i_mask_ints (void)
+{
+  scm_c_issue_deprecation_warning ("`scm_mask_ints' is deprecated.");
+  return (SCM_I_CURRENT_THREAD->block_asyncs != 0);
+}
+
+\f
+SCM
+scm_guard (SCM guardian, SCM obj, int throw_p)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_guard is deprecated.  Use scm_call_1 instead.");
+
+  return scm_call_1 (guardian, obj);
+}
+
+SCM
+scm_get_one_zombie (SCM guardian)
+{
+  scm_c_issue_deprecation_warning
+    ("scm_guard is deprecated.  Use scm_call_0 instead.");
+
+  return scm_call_0 (guardian);
+}
+
+SCM_DEFINE (scm_guardian_destroyed_p, "guardian-destroyed?", 1, 0, 0, 
+            (SCM guardian),
+            "Return @code{#t} if @var{guardian} has been destroyed, otherwise @code{#f}.")
+#define FUNC_NAME s_scm_guardian_destroyed_p       
+{
+  scm_c_issue_deprecation_warning
+    ("'guardian-destroyed?' is deprecated.");
+  return SCM_BOOL_F;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_guardian_greedy_p, "guardian-greedy?", 1, 0, 0,
+            (SCM guardian),
+            "Return @code{#t} if @var{guardian} is a greedy guardian, otherwise @code{#f}.")
+#define FUNC_NAME s_scm_guardian_greedy_p  
+{
+  scm_c_issue_deprecation_warning
+    ("'guardian-greedy?' is deprecated.");
+  return SCM_BOOL_F;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_destroy_guardian_x, "destroy-guardian!", 1, 0, 0, 
+            (SCM guardian),
+            "Destroys @var{guardian}, by making it impossible to put any more\n"
+            "objects in it or get any objects from it.  It also unguards any\n"
+            "objects guarded by @var{guardian}.")
+#define FUNC_NAME s_scm_destroy_guardian_x
+{
+  scm_c_issue_deprecation_warning
+    ("'destroy-guardian!' is deprecated and ineffective.");
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+\f
+/* GC-related things.  */
+
+unsigned long scm_mallocated, scm_mtrigger;
+size_t scm_max_segment_size;
+
+#if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
+SCM
+scm_map_free_list (void)
+{
+  return SCM_EOL;
+}
+#endif
+
+#if defined (GUILE_DEBUG_FREELIST)
+SCM
+scm_gc_set_debug_check_freelist_x (SCM flag)
+{
+  return SCM_UNSPECIFIED;
+}
+#endif
+
+\f
 void
 scm_i_init_deprecated ()
 {