Changes from arch/CVS synchronization
[bpt/guile.git] / doc / ref / api-control.texi
index 3d1549e..ed6411f 100644 (file)
@@ -1164,7 +1164,7 @@ lexical variables, this will be, well, inconvenient.
 
 Therefore, Guile offers the functions @code{scm_dynwind_begin} and
 @code{scm_dynwind_end} to delimit a dynamic extent.  Within this
-dynamic extent, which is calles a @dfn{dynwind context}, you can
+dynamic extent, which is called a @dfn{dynwind context}, you can
 perform various @dfn{dynwind actions} that control what happens when
 the dynwind context is entered or left.  For example, you can register
 a cleanup routine with @code{scm_dynwind_unwind_handler} that is
@@ -1234,28 +1234,29 @@ non-locally, @var{out_guard} is called.  If the dynamic extent of
 the dynamic-wind is re-entered, @var{in_guard} is called.  Thus
 @var{in_guard} and @var{out_guard} may be called any number of
 times.
+
 @lisp
 (define x 'normal-binding)
 @result{} x
-(define a-cont  (call-with-current-continuation
-                  (lambda (escape)
-                     (let ((old-x x))
-                       (dynamic-wind
-                          ;; in-guard:
-                          ;;
-                          (lambda () (set! x 'special-binding))
-
-                          ;; thunk
-                          ;;
-                          (lambda () (display x) (newline)
-                                     (call-with-current-continuation escape)
-                                     (display x) (newline)
-                                     x)
-
-                          ;; out-guard:
-                          ;;
-                          (lambda () (set! x old-x)))))))
-
+(define a-cont
+  (call-with-current-continuation
+   (lambda (escape)
+     (let ((old-x x))
+       (dynamic-wind
+           ;; in-guard:
+           ;;
+           (lambda () (set! x 'special-binding))
+
+           ;; thunk
+           ;;
+           (lambda () (display x) (newline)
+                      (call-with-current-continuation escape)
+                      (display x) (newline)
+                      x)
+
+           ;; out-guard:
+           ;;
+           (lambda () (set! x old-x)))))))
 ;; Prints:
 special-binding
 ;; Evaluates to:
@@ -1356,6 +1357,13 @@ The function @code{scm_dynwind_rewind_handler_with_scm} takes care that
 @var{data} is protected from garbage collection.
 @end deftypefn
 
+@deftypefn {C Function} void scm_dynwind_free (void *mem)
+Arrange for @var{mem} to be freed automatically whenever the current
+context is exited, whether normally or non-locally.
+@code{scm_dynwind_free (mem)} is an equivalent shorthand for
+@code{scm_dynwind_unwind_handler (free, mem, SCM_F_WIND_EXPLICITLY)}.
+@end deftypefn
+
 
 @node Handling Errors
 @subsection How to Handle Errors
@@ -1468,7 +1476,7 @@ In the following C functions, @var{SUBR} and @var{MESSAGE} parameters
 can be @code{NULL} to give the effect of @code{#f} described above.
 
 @deftypefn {C Function} SCM scm_error (SCM @var{key}, char *@var{subr}, char *@var{message}, SCM @var{args}, SCM @var{rest})
-Throw an error, as per @code{scm-error} above.
+Throw an error, as per @code{scm-error} (@pxref{Error Reporting}).
 @end deftypefn
 
 @deftypefn {C Function} void scm_syserror (char *@var{subr})