deprecate lookup closures
[bpt/guile.git] / libguile / deprecated.h
index 5570a43..e777d2f 100644 (file)
@@ -5,7 +5,7 @@
 #ifndef SCM_DEPRECATED_H
 #define SCM_DEPRECATED_H
 
-/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009 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
  */
 
 #include "libguile/__scm.h"
-#include "libguile/arrays.h"
 #include "libguile/strings.h"
 #include "libguile/eval.h"
+#include "libguile/throw.h"
+#include "libguile/iselect.h"
 
 #if (SCM_ENABLE_DEPRECATED == 1)
 
@@ -132,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)
@@ -172,17 +184,8 @@ SCM_DEPRECATED SCM scm_read_and_eval_x (SCM port);
 
 #define SCM_SUBR_DOC(x) SCM_BOOL_F
 
-SCM_DEPRECATED SCM scm_make_subr (const char *name, int type, SCM (*fcn) ());
-SCM_DEPRECATED SCM scm_make_subr_with_generic (const char *name,
-                                              int type,
-                                              SCM (*fcn) (),
-                                              SCM *gf);
-SCM_DEPRECATED SCM scm_make_subr_opt (const char *name,
-                                     int type,
-                                     SCM (*fcn) (),
-                                     int set);
-
-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,
@@ -240,11 +243,8 @@ SCM_DEPRECATED SCM scm_gentemp (SCM prefix, SCM obarray);
 #define scm_option scm_t_option
 #define scm_srcprops scm_t_srcprops
 #define scm_srcprops_chunk scm_t_srcprops_chunk
-#define scm_info_frame scm_t_info_frame
-#define scm_stack scm_t_stack
 #define scm_array scm_t_array
 #define scm_array_dim scm_t_array_dim
-#define SCM_ARRAY_CONTIGUOUS SCM_ARRAY_FLAG_CONTIGUOUS
 #define SCM_FUNC_NAME (scm_makfrom0str (FUNC_NAME))
 
 #define SCM_WTA(pos, scm) \
@@ -402,6 +402,14 @@ SCM_DEPRECATED char *scm_c_symbol2str (SCM obj, char *str, size_t *lenp);
 */
 SCM_DEPRECATED double scm_truncate (double x);
 SCM_DEPRECATED double scm_round (double x);
+/* Deprecated, use scm_expt */
+SCM_DEPRECATED SCM scm_sys_expt (SCM x, SCM y);
+
+/* if your platform doesn't have asinh et al */
+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.
@@ -489,6 +497,15 @@ SCM_DEPRECATED scm_t_array_dim *scm_i_array_dims (SCM a);
 #define SCM_ARRAY_BASE(a)  scm_i_array_base(a)
 #define SCM_ARRAY_DIMS(a)  scm_i_array_dims(a)
 
+SCM_DEPRECATED SCM scm_uniform_vector_read_x (SCM v, SCM port_or_fd,
+                                             SCM start, SCM end);
+SCM_DEPRECATED SCM scm_uniform_vector_write (SCM v, SCM port_or_fd,
+                                            SCM start, SCM end);
+SCM_DEPRECATED SCM scm_uniform_array_read_x (SCM ra, SCM port_or_fd,
+                                            SCM start, SCM end);
+SCM_DEPRECATED SCM scm_uniform_array_write (SCM v, SCM port_or_fd,
+                                           SCM start, SCM end);
+
 /* Deprecated because they should not be lvalues and we want people to
    use the official interfaces.
  */
@@ -499,7 +516,6 @@ SCM_DEPRECATED scm_t_array_dim *scm_i_array_dims (SCM a);
 #define scm_cur_loadp         scm_i_cur_loadp ()
 #define scm_progargs          scm_i_progargs ()
 #define scm_dynwinds          scm_i_deprecated_dynwinds ()
-#define scm_last_debug_frame  scm_i_deprecated_last_debug_frame ()
 #define scm_stack_base        scm_i_stack_base ()
 
 SCM_DEPRECATED SCM scm_i_cur_inp (void);
@@ -508,7 +524,6 @@ SCM_DEPRECATED SCM scm_i_cur_errp (void);
 SCM_DEPRECATED SCM scm_i_cur_loadp (void);
 SCM_DEPRECATED SCM scm_i_progargs (void);
 SCM_DEPRECATED SCM scm_i_deprecated_dynwinds (void);
-SCM_DEPRECATED scm_t_debug_frame *scm_i_deprecated_last_debug_frame (void);
 SCM_DEPRECATED SCM_STACKITEM *scm_i_stack_base (void);
 
 /* Deprecated because it evaluates its argument twice.
@@ -596,6 +611,222 @@ SCM_DEPRECATED scm_t_trampoline_1 scm_trampoline_1 (SCM proc);
 SCM_DEPRECATED scm_t_trampoline_2 scm_trampoline_2 (SCM proc);
 
 \f
+
+/* Deprecated 2009-12-06, use the procedures instead */
+#define SCM_PROCEDURE_WITH_SETTER_P(obj) (scm_is_true (scm_procedure_with_setter_p (obj)))
+#define SCM_PROCEDURE(obj) SCM_STRUCT_PROCEDURE (obj, 0)
+#define SCM_SETTER(obj) SCM_STRUCT_SETTER (obj, 1)
+
+\f
+
+/* Deprecated 2010-01-05, use SCM_PRIMITIVE_P instead */
+SCM_DEPRECATED int scm_i_subr_p (SCM x);
+#define scm_subr_p(x) (scm_i_subr_p (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