deprecate scm_internal_dynamic_wind
authorAndy Wingo <wingo@pobox.com>
Fri, 13 May 2011 10:16:56 +0000 (12:16 +0200)
committerAndy Wingo <wingo@pobox.com>
Fri, 13 May 2011 11:49:30 +0000 (13:49 +0200)
* libguile/dynwind.c:
* libguile/dynwind.h:

* libguile/deprecated.h (scm_t_inner):
* libguile/deprecated.c (scm_internal_dynamic_wind): Deprecate, as the
  scm_dynwind API is better, and this API encourages users to stuff SCM
  values into pointers.

libguile/deprecated.c
libguile/deprecated.h
libguile/dynwind.c
libguile/dynwind.h

index 41e4dbc..c7e2aae 100644 (file)
@@ -2574,6 +2574,29 @@ scm_struct_create_handle (SCM obj)
 
 \f
 
+SCM
+scm_internal_dynamic_wind (scm_t_guard before,
+                          scm_t_inner inner,
+                          scm_t_guard after,
+                          void *inner_data,
+                          void *guard_data)
+{
+  SCM ans;
+
+  scm_c_issue_deprecation_warning
+    ("`scm_internal_dynamic_wind' is deprecated.  "
+     "Use the `scm_dynwind_begin' / `scm_dynwind_end' API instead.");
+
+  scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE);
+  scm_dynwind_rewind_handler (before, guard_data, SCM_F_WIND_EXPLICITLY);
+  scm_dynwind_unwind_handler (after, guard_data, SCM_F_WIND_EXPLICITLY);
+  ans = inner (inner_data);
+  scm_dynwind_end ();
+  return ans;
+}
+
+\f
+
 void
 scm_i_init_deprecated ()
 {
index 5353cab..6e832b8 100644 (file)
@@ -143,6 +143,17 @@ SCM_DEPRECATED SCM scm_make_gsubr_with_generic (const char *name,
 
 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)
index f4d19bd..14dd861 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2003, 2004, 2006, 2008, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2003, 2004, 2006, 2008, 2010, 2011 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
@@ -68,23 +68,6 @@ scm_dynamic_wind (SCM in_guard, SCM thunk, SCM out_guard)
 }
 #undef FUNC_NAME
 
-SCM
-scm_internal_dynamic_wind (scm_t_guard before,
-                          scm_t_inner inner,
-                          scm_t_guard after,
-                          void *inner_data,
-                          void *guard_data)
-{
-  SCM ans;
-
-  scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE);
-  scm_dynwind_rewind_handler (before, guard_data, SCM_F_WIND_EXPLICITLY);
-  scm_dynwind_unwind_handler (after, guard_data, SCM_F_WIND_EXPLICITLY);
-  ans = inner (inner_data);
-  scm_dynwind_end ();
-  return ans;
-}
-
 /* Frames and winders. */
 
 static scm_t_bits tc16_frame;
index b178bc4..6e952c4 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef SCM_DYNWIND_H
 #define SCM_DYNWIND_H
 
-/* Copyright (C) 1995,1996,1998,1999,2000,2003,2004, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,1999,2000,2003,2004, 2006, 2008, 2011 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
 \f
 
 typedef void (*scm_t_guard) (void *);
-typedef SCM (*scm_t_inner) (void *);
 
 SCM_API SCM scm_dynamic_wind (SCM thunk1, SCM thunk2, SCM thunk3);
-SCM_API SCM scm_internal_dynamic_wind (scm_t_guard before,
-                                      scm_t_inner inner,
-                                      scm_t_guard after,
-                                      void *inner_data,
-                                      void *guard_data);
 SCM_API void scm_dowinds (SCM to, long delta);
 SCM_INTERNAL void scm_i_dowinds (SCM to, long delta,
                                 void (*turn_func) (void *), void *data);