summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-05-13 12:16:56 +0200
committerAndy Wingo <wingo@pobox.com>2011-05-13 13:49:30 +0200
commitb2feee6bc0d440a20c2c8cbb7b3d03c957c2c417 (patch)
tree946f117f76fe54be3f8cbc7005d2ae2defb749b6
parentb5df9cda41231785feb548da46d97a1af2c79251 (diff)
downloadguile-b2feee6bc0d440a20c2c8cbb7b3d03c957c2c417.tar.gz
deprecate scm_internal_dynamic_wind
* 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.
-rw-r--r--libguile/deprecated.c23
-rw-r--r--libguile/deprecated.h11
-rw-r--r--libguile/dynwind.c19
-rw-r--r--libguile/dynwind.h8
4 files changed, 36 insertions, 25 deletions
diff --git a/libguile/deprecated.c b/libguile/deprecated.c
index 41e4dbcd3..c7e2aae2d 100644
--- a/libguile/deprecated.c
+++ b/libguile/deprecated.c
@@ -2574,6 +2574,29 @@ scm_struct_create_handle (SCM obj)
+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;
+}
+
+
+
void
scm_i_init_deprecated ()
{
diff --git a/libguile/deprecated.h b/libguile/deprecated.h
index 5353cab5d..6e832b8ec 100644
--- a/libguile/deprecated.h
+++ b/libguile/deprecated.h
@@ -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)
diff --git a/libguile/dynwind.c b/libguile/dynwind.c
index f4d19bd0a..14dd861dc 100644
--- a/libguile/dynwind.c
+++ b/libguile/dynwind.c
@@ -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;
diff --git a/libguile/dynwind.h b/libguile/dynwind.h
index b178bc429..6e952c4db 100644
--- a/libguile/dynwind.h
+++ b/libguile/dynwind.h
@@ -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
@@ -28,14 +28,8 @@
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);