Work around `#define except' on Tru64.
[bpt/guile.git] / libguile / deprecated.c
index 91cb86c..da11608 100644 (file)
@@ -2,7 +2,7 @@
    deprecate something, move it here when that is feasible.
 */
 
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 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
  */
 
 #include "libguile/_scm.h"
+#include "libguile/async.h"
 #include "libguile/deprecated.h"
 #include "libguile/discouraged.h"
 #include "libguile/deprecation.h"
@@ -43,6 +44,7 @@
 #include "libguile/smob.h"
 #include "libguile/alist.h"
 #include "libguile/keywords.h"
+#include "libguile/feature.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -199,7 +201,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)
     {
@@ -208,7 +210,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
@@ -317,14 +319,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_is_null (except))
+  while (!scm_is_null (except_set))
     {
-      SCM p = SCM_COERCE_OUTPORT (SCM_CAR (except));
+      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);
@@ -687,7 +689,7 @@ scm_sym2ovcell_soft (SCM sym, SCM 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))
@@ -695,11 +697,11 @@ scm_sym2ovcell_soft (SCM sym, SCM obarray)
       z = SCM_CAR (lsym);
       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;
 }
 
@@ -872,7 +874,7 @@ SCM_DEFINE (scm_intern_symbol, "intern-symbol", 2, 0, 0,
   SCM_VALIDATE_VECTOR (1,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;
@@ -883,7 +885,7 @@ SCM_DEFINE (scm_intern_symbol, "intern-symbol", 2, 0, 0,
        sym = SCM_CAR (lsym);
        if (scm_is_eq (SCM_CAR (sym), s))
          {
-           SCM_REALLOW_INTS;
+           SCM_CRITICAL_SECTION_END;
            return SCM_UNSPECIFIED;
          }
       }
@@ -891,7 +893,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
@@ -913,7 +915,7 @@ SCM_DEFINE (scm_unintern_symbol, "unintern-symbol", 2, 0, 0,
     return SCM_BOOL_F;
   SCM_VALIDATE_VECTOR (1,o);
   hval = scm_i_symbol_hash (s) % SCM_VECTOR_LENGTH (o);
-  SCM_DEFER_INTS;
+  SCM_CRITICAL_SECTION_START;
   {
     SCM lsym_follow;
     SCM lsym;
@@ -930,12 +932,12 @@ SCM_DEFINE (scm_unintern_symbol, "unintern-symbol", 2, 0, 0,
              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
@@ -1108,7 +1110,7 @@ SCM_DEFINE (scm_gentemp, "gentemp", 0, 2, 0,
 #undef FUNC_NAME
 
 SCM
-SCM_MAKINUM (scm_t_signed_bits val)
+scm_i_makinum (scm_t_signed_bits val)
 {
   scm_c_issue_deprecation_warning
     ("SCM_MAKINUM is deprecated.  Use scm_from_int or similar instead.");
@@ -1116,7 +1118,7 @@ SCM_MAKINUM (scm_t_signed_bits val)
 }
 
 int
-SCM_INUMP (SCM obj)
+scm_i_inump (SCM obj)
 {
   scm_c_issue_deprecation_warning
     ("SCM_INUMP is deprecated.  Use scm_is_integer or similar instead.");
@@ -1124,7 +1126,7 @@ SCM_INUMP (SCM obj)
 }
 
 scm_t_signed_bits
-SCM_INUM (SCM obj)
+scm_i_inum (SCM obj)
 {
   scm_c_issue_deprecation_warning
     ("SCM_INUM is deprecated.  Use scm_to_int or similar instead.");
@@ -1205,7 +1207,7 @@ scm_round (double x)
 }
 
 char *
-SCM_SYMBOL_CHARS (SCM sym)
+scm_i_deprecated_symbol_chars (SCM sym)
 {
   scm_c_issue_deprecation_warning
     ("SCM_SYMBOL_CHARS is deprecated.  Use scm_symbol_to_string.");
@@ -1214,7 +1216,7 @@ SCM_SYMBOL_CHARS (SCM sym)
 }
 
 size_t
-SCM_SYMBOL_LENGTH (SCM sym)
+scm_i_deprecated_symbol_length (SCM sym)
 {
   scm_c_issue_deprecation_warning
     ("SCM_SYMBOL_LENGTH is deprecated.  Use scm_symbol_to_string.");
@@ -1222,7 +1224,7 @@ SCM_SYMBOL_LENGTH (SCM sym)
 }
 
 int
-SCM_KEYWORDP (SCM obj)
+scm_i_keywordp (SCM obj)
 {
   scm_c_issue_deprecation_warning
     ("SCM_KEYWORDP is deprecated.  Use scm_is_keyword instead.");
@@ -1230,7 +1232,7 @@ SCM_KEYWORDP (SCM obj)
 }
 
 SCM
-SCM_KEYWORDSYM (SCM keyword)
+scm_i_keywordsym (SCM keyword)
 {
   scm_c_issue_deprecation_warning
     ("SCM_KEYWORDSYM is deprecated.  See scm_keyword_to_symbol instead.");
@@ -1238,7 +1240,7 @@ SCM_KEYWORDSYM (SCM keyword)
 }
 
 int
-SCM_VECTORP (SCM x)
+scm_i_vectorp (SCM x)
 {
   scm_c_issue_deprecation_warning
     ("SCM_VECTORP is deprecated.  Use scm_is_vector instead.");
@@ -1246,7 +1248,7 @@ SCM_VECTORP (SCM x)
 }
 
 unsigned long
-SCM_VECTOR_LENGTH (SCM x)
+scm_i_vector_length (SCM x)
 {
   scm_c_issue_deprecation_warning
     ("SCM_VECTOR_LENGTH is deprecated.  Use scm_c_vector_length instead.");
@@ -1254,7 +1256,7 @@ SCM_VECTOR_LENGTH (SCM x)
 }
 
 const SCM *
-SCM_VELTS (SCM x)
+scm_i_velts (SCM x)
 {
   scm_c_issue_deprecation_warning
     ("SCM_VELTS is deprecated.  Use scm_vector_elements instead.");
@@ -1262,7 +1264,7 @@ SCM_VELTS (SCM x)
 }
 
 SCM *
-SCM_WRITABLE_VELTS (SCM x)
+scm_i_writable_velts (SCM x)
 {
   scm_c_issue_deprecation_warning
     ("SCM_WRITABLE_VELTS is deprecated.  "
@@ -1271,7 +1273,7 @@ SCM_WRITABLE_VELTS (SCM x)
 }
 
 SCM
-SCM_VECTOR_REF (SCM x, size_t idx)
+scm_i_vector_ref (SCM x, size_t idx)
 {
   scm_c_issue_deprecation_warning
     ("SCM_VECTOR_REF is deprecated.  "
@@ -1280,7 +1282,7 @@ SCM_VECTOR_REF (SCM x, size_t idx)
 }
 
 void
-SCM_VECTOR_SET (SCM x, size_t idx, SCM val)
+scm_i_vector_set (SCM x, size_t idx, SCM val)
 {
   scm_c_issue_deprecation_warning
     ("SCM_VECTOR_SET is deprecated.  "
@@ -1297,6 +1299,199 @@ scm_vector_equal_p (SCM x, SCM y)
   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) || SCM_I_ENCLOSED_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);
+}
+
+void
+scm_i_defer_ints_etc ()
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_DEFER_INTS etc are deprecated.  "
+     "Use a mutex instead if appropriate.");
+}
+
+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
+
 void
 scm_i_init_deprecated ()
 {