deprecate lookup closures
[bpt/guile.git] / libguile / deprecated.h
index 9832cfb..e777d2f 100644 (file)
@@ -5,7 +5,7 @@
 #ifndef SCM_DEPRECATED_H
 #define SCM_DEPRECATED_H
 
-/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 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
@@ -26,6 +26,8 @@
 #include "libguile/__scm.h"
 #include "libguile/strings.h"
 #include "libguile/eval.h"
+#include "libguile/throw.h"
+#include "libguile/iselect.h"
 
 #if (SCM_ENABLE_DEPRECATED == 1)
 
@@ -131,16 +133,27 @@ SCM_DEPRECATED SCM scm_internal_with_fluids (SCM fluids, SCM vals,
 
 SCM_DEPRECATED SCM scm_make_gsubr (const char *name,
                                   int req, int opt, int rst,
-                                  SCM (*fcn)());
+                                  scm_t_subr fcn);
 SCM_DEPRECATED SCM scm_make_gsubr_with_generic (const char *name,
                                                int req,
                                                int opt,
                                                int rst,
-                                               SCM (*fcn)(),
+                                               scm_t_subr fcn,
                                                SCM *gf);
 
 SCM_DEPRECATED SCM scm_create_hook (const char* name, int n_args);
 
+
+/* Deprecated 13-05-2011 because it's better just to scm_dynwind_begin.
+   That also avoids the temptation to stuff pointers in an SCM.  */
+
+typedef SCM (*scm_t_inner) (void *);
+SCM_DEPRECATED SCM scm_internal_dynamic_wind (scm_t_guard before,
+                                              scm_t_inner inner,
+                                              scm_t_guard after,
+                                              void *inner_data,
+                                              void *guard_data);
+
 #define SCM_LIST0 SCM_EOL
 #define SCM_LIST1(e0) scm_cons ((e0), SCM_EOL)
 #define SCM_LIST2(e0, e1) scm_cons2 ((e0), (e1), SCM_EOL)
@@ -171,7 +184,8 @@ SCM_DEPRECATED SCM scm_read_and_eval_x (SCM port);
 
 #define SCM_SUBR_DOC(x) SCM_BOOL_F
 
-SCM_DEPRECATED SCM scm_call_catching_errors (SCM (*thunk)(), SCM (*err_filter)(),
+SCM_DEPRECATED SCM scm_call_catching_errors (scm_t_subr thunk,
+                                            scm_t_subr err_filter,
                                             void * closure);
 
 SCM_DEPRECATED long scm_make_smob_type_mfpe (char *name, size_t size,
@@ -392,10 +406,10 @@ SCM_DEPRECATED double scm_round (double x);
 SCM_DEPRECATED SCM scm_sys_expt (SCM x, SCM y);
 
 /* if your platform doesn't have asinh et al */
-SCM_API double scm_asinh (double x);
-SCM_API double scm_acosh (double x);
-SCM_API double scm_atanh (double x);
-SCM_API SCM scm_sys_atan2 (SCM z1, SCM z2);
+SCM_DEPRECATED double scm_asinh (double x);
+SCM_DEPRECATED double scm_acosh (double x);
+SCM_DEPRECATED double scm_atanh (double x);
+SCM_DEPRECATED SCM scm_sys_atan2 (SCM z1, SCM z2);
 
 /* Deprecated because we don't want people to access the internal
    representation of strings directly.
@@ -611,6 +625,208 @@ SCM_DEPRECATED int scm_i_subr_p (SCM x);
 
 \f
 
+/* Deprecated 2010-01-31, use with-throw-handler instead */
+SCM_DEPRECATED SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
+SCM_DEPRECATED SCM scm_internal_lazy_catch (SCM tag,
+                                            scm_t_catch_body body,
+                                            void *body_data,
+                                            scm_t_catch_handler handler,
+                                            void *handler_data);
+
+\f
+
+/* Deprecated 2010-03-31, use array-equal? instead */
+SCM_DEPRECATED SCM scm_raequal (SCM ra0, SCM ra1);
+
+/* Deprecated 2010-04-01, use the dynamic FFI instead */
+SCM_DEPRECATED SCM scm_dynamic_args_call (SCM symb, SCM dobj, SCM args);
+
+/* Deprecated 2010-05-12, no replacement */
+SCM_DEPRECATED int scm_badargsp (SCM formals, SCM args);
+
+/* Deprecated 2010-06-19, use call-with-error-handling instead */
+SCM_DEPRECATED SCM scm_internal_stack_catch (SCM tag,
+                                             scm_t_catch_body body,
+                                             void *body_data,
+                                             scm_t_catch_handler handler,
+                                             void *handler_data);
+
+\f
+
+/* These functions were "discouraged" in 1.8, and now are deprecated. */
+
+/* scm_to_int, scm_from_int are the official functions to do the job,
+   but there is nothing wrong with using scm_num2int, etc.
+
+   These could be trivially defined via macros, but we leave them as
+   functions since existing code may take their addresses.
+*/
+
+SCM_DEPRECATED SCM scm_short2num (short n);
+SCM_DEPRECATED SCM scm_ushort2num (unsigned short n);
+SCM_DEPRECATED SCM scm_int2num (int n);
+SCM_DEPRECATED SCM scm_uint2num (unsigned int n);
+SCM_DEPRECATED SCM scm_long2num (long n);
+SCM_DEPRECATED SCM scm_ulong2num (unsigned long n);
+SCM_DEPRECATED SCM scm_size2num (size_t n);
+SCM_DEPRECATED SCM scm_ptrdiff2num (scm_t_ptrdiff n);
+SCM_DEPRECATED short scm_num2short (SCM num, unsigned long int pos,
+                            const char *s_caller);
+SCM_DEPRECATED unsigned short scm_num2ushort (SCM num, unsigned long int pos,
+                                      const char *s_caller);
+SCM_DEPRECATED int scm_num2int (SCM num, unsigned long int pos,
+                        const char *s_caller);
+SCM_DEPRECATED unsigned int scm_num2uint (SCM num, unsigned long int pos,
+                                  const char *s_caller);
+SCM_DEPRECATED long scm_num2long (SCM num, unsigned long int pos,
+                          const char *s_caller);
+SCM_DEPRECATED unsigned long scm_num2ulong (SCM num, unsigned long int pos,
+                                    const char *s_caller);
+SCM_DEPRECATED scm_t_ptrdiff scm_num2ptrdiff (SCM num, unsigned long int pos,
+                                       const char *s_caller);
+SCM_DEPRECATED size_t scm_num2size (SCM num, unsigned long int pos,
+                            const char *s_caller);
+#if SCM_SIZEOF_LONG_LONG != 0
+SCM_DEPRECATED SCM scm_long_long2num (long long sl);
+SCM_DEPRECATED SCM scm_ulong_long2num (unsigned long long sl);
+SCM_DEPRECATED long long scm_num2long_long (SCM num, unsigned long int pos,
+                                    const char *s_caller);
+SCM_DEPRECATED unsigned long long scm_num2ulong_long (SCM num, unsigned long int pos,
+                                              const char *s_caller);
+#endif
+
+SCM_DEPRECATED SCM scm_make_real (double x);
+SCM_DEPRECATED double scm_num2dbl (SCM a, const char * why);
+SCM_DEPRECATED SCM scm_float2num (float n);
+SCM_DEPRECATED SCM scm_double2num (double n);
+
+/* The next two are implemented in numbers.c since they use features
+   only available there.
+*/
+SCM_DEPRECATED float scm_num2float (SCM num, unsigned long int pos,
+                            const char *s_caller);
+SCM_DEPRECATED double scm_num2double (SCM num, unsigned long int pos,
+                              const char *s_caller);
+
+SCM_DEPRECATED SCM scm_make_complex (double x, double y);
+
+/* Discouraged because they don't make the encoding explicit.
+ */
+
+SCM_DEPRECATED SCM scm_mem2symbol (const char *mem, size_t len);
+SCM_DEPRECATED SCM scm_mem2uninterned_symbol (const char *mem, size_t len);
+SCM_DEPRECATED SCM scm_str2symbol (const char *str);
+
+SCM_DEPRECATED SCM scm_take_str (char *s, size_t len);
+SCM_DEPRECATED SCM scm_take0str (char *s);
+SCM_DEPRECATED SCM scm_mem2string (const char *src, size_t len);
+SCM_DEPRECATED SCM scm_str2string (const char *src);
+SCM_DEPRECATED SCM scm_makfrom0str (const char *src);
+SCM_DEPRECATED SCM scm_makfrom0str_opt (const char *src);
+
+/* Discouraged because scm_c_make_string has a better name and is more
+   consistent with make-string.
+ */
+SCM_DEPRECATED SCM scm_allocate_string (size_t len);
+
+/* Discouraged because they are just strange.
+ */
+
+SCM_DEPRECATED SCM scm_make_keyword_from_dash_symbol (SCM symbol);
+SCM_DEPRECATED SCM scm_keyword_dash_symbol (SCM keyword);
+
+/* Discouraged because it does not state what encoding S is in.
+ */
+
+SCM_DEPRECATED SCM scm_c_make_keyword (const char *s);
+
+SCM_DEPRECATED unsigned int scm_thread_sleep (unsigned int);
+SCM_DEPRECATED unsigned long scm_thread_usleep (unsigned long);
+SCM_DEPRECATED int scm_internal_select (int fds,
+                                        SELECT_TYPE *rfds,
+                                        SELECT_TYPE *wfds,
+                                        SELECT_TYPE *efds,
+                                        struct timeval *timeout);
+\f
+/* Deprecated because the cuserid call is deprecated.
+ */
+SCM_DEPRECATED SCM scm_cuserid (void);
+
+\f
+
+/* Deprecated because it's yet another property interface.
+ */
+SCM_DEPRECATED SCM scm_primitive_make_property (SCM not_found_proc);
+SCM_DEPRECATED SCM scm_primitive_property_ref (SCM prop, SCM obj);
+SCM_DEPRECATED SCM scm_primitive_property_set_x (SCM prop, SCM obj, SCM val);
+SCM_DEPRECATED SCM scm_primitive_property_del_x (SCM prop, SCM obj);
+
+\f
+
+/* {The old whash table interface}
+ * Deprecated, as the hash table interface is sufficient, and accessing
+ * handles of weak hash tables is no longer supported.
+ */
+
+#define scm_whash_handle SCM
+
+SCM_DEPRECATED SCM scm_whash_get_handle (SCM whash, SCM key);
+SCM_DEPRECATED int SCM_WHASHFOUNDP (SCM h);
+SCM_DEPRECATED SCM SCM_WHASHREF (SCM whash, SCM handle);
+SCM_DEPRECATED void SCM_WHASHSET (SCM whash, SCM handle, SCM obj);
+SCM_DEPRECATED SCM scm_whash_create_handle (SCM whash, SCM key);
+SCM_DEPRECATED SCM scm_whash_lookup (SCM whash, SCM obj);
+SCM_DEPRECATED void scm_whash_insert (SCM whash, SCM key, SCM obj);
+
+
+\f
+
+/* No need for a table for names, and the struct->class mapping is
+   maintained by GOOPS now.  */
+#define SCM_STRUCT_TABLE_NAME(X) SCM_CAR (X)
+#define SCM_SET_STRUCT_TABLE_NAME(X, NAME) SCM_SETCAR (X, NAME)
+#define SCM_STRUCT_TABLE_CLASS(X) SCM_CDR (X)
+#define SCM_SET_STRUCT_TABLE_CLASS(X, CLASS) SCM_SETCDR (X, CLASS)
+
+SCM_DEPRECATED SCM scm_struct_table;
+SCM_DEPRECATED SCM scm_struct_create_handle (SCM obj);
+
+
+\f
+
+/* Deprecated 26-05-2011, as the GC_STUBBORN API doesn't do anything any
+   more.  */
+SCM_DEPRECATED SCM scm_immutable_cell (scm_t_bits car, scm_t_bits cdr);
+SCM_DEPRECATED SCM scm_immutable_double_cell (scm_t_bits car, scm_t_bits cbr,
+                                      scm_t_bits ccr, scm_t_bits cdr);
+
+\f
+
+SCM_DEPRECATED scm_t_bits scm_i_deprecated_asrtgo (scm_t_bits condition);
+
+/* Deprecated 08-01-2012, as it's undocumented and unused.  */
+#define SCM_ASRTGO(_cond, _label)              \
+  do { if (!scm_i_deprecated_asrtgo(_cond)) goto _label; } while (0)
+
+\f
+
+/* Deprecated 23-05-2012, as as it's undocumented, poorly named, and
+   adequately replaced by scm_module_variable /
+   scm_ensure_module_variable / scm_define / scm_module_define.  */
+SCM_DEPRECATED SCM scm_sym2var (SCM sym, SCM thunk, SCM definep);
+
+\f
+
+/* Eval closure deprecation, 23-05-2012.  */
+#define SCM_TOP_LEVEL_LOOKUP_CLOSURE (scm_current_module_lookup_closure())
+
+SCM_DEPRECATED SCM scm_lookup_closure_module (SCM proc);
+SCM_DEPRECATED SCM scm_module_lookup_closure (SCM module);
+SCM_DEPRECATED SCM scm_current_module_lookup_closure (void);
+
+
+\f
+
 void scm_i_init_deprecated (void);
 
 #endif