1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Renamed scm_frame_unwind to scm_frame_unwind_handler, and

scm_frame_rewind to scm_frame_rewind_handler.
This commit is contained in:
Marius Vollmer 2004-01-11 00:56:05 +00:00
parent 16c5cac25a
commit f1da8e4e0b
3 changed files with 25 additions and 23 deletions

8
NEWS
View file

@ -593,11 +593,11 @@ prevent a potential memory leak:
scm_frame_begin (0);
mem = scm_malloc (100);
scm_frame_unwind (free, mem, SCM_F_WIND_EXPLICITELY);
scm_frame_unwind_handler (free, mem, SCM_F_WIND_EXPLICITELY);
/* MEM would leak if BAR throws an error.
SCM_FRAME_UNWIND_HANDLER frees it nevertheless. */
/* MEM would leak if BAR throws an error. SCM_FRAME_UNWIND frees it
nevertheless.
*/
bar ();
scm_frame_end ();

View file

@ -1167,10 +1167,10 @@ scm_foo (SCM s1, SCM s2)
scm_frame_begin (0);
c_s1 = scm_to_string (s1);
scm_frame_unwind (free, c_s1, SCM_F_WIND_EXPLICITLY);
scm_frame_unwind_handler (free, c_s1, SCM_F_WIND_EXPLICITLY);
c_s2 = scm_to_string (s2);
scm_frame_unwind (free, c_s2, SCM_F_WIND_EXPLICITLY);
scm_frame_unwind_handler (free, c_s2, SCM_F_WIND_EXPLICITLY);
c_res = foo (c_s1, c_s2);
if (c_res == NULL)
@ -1226,8 +1226,8 @@ End the current frame explicitly and make the previous frame current.
@deftp {C Type} scm_t_wind_flags
This is an enumeration of several flags that modify the behavior of
@code{scm_on_unwind} and @code{scm_on_rewind}. The flags are listed in
the following table.
@code{scm_on_unwind_handler} and @code{scm_on_rewind_handler}. The
flags are listed in the following table.
@table @code
@item SCM_F_WIND_EXPLICITLY
@ -1236,26 +1236,26 @@ left locally.
@end table
@end deftp
@deftypefn {C Function} void scm_frame_unwind (void (*func)(void *), void *data, scm_t_wind_flags flags)
@deftypefnx {C Function} void scm_frame_unwind_with_scm (void (*func)(SCM), SCM data, scm_t_wind_flags flags)
@deftypefn {C Function} void scm_frame_unwind_handler (void (*func)(void *), void *data, scm_t_wind_flags flags)
@deftypefnx {C Function} void scm_frame_unwind_handler_with_scm (void (*func)(SCM), SCM data, scm_t_wind_flags flags)
Arranges for @var{func} to be called with @var{data} as its arguments
when the current frame ends implicitly. If @var{flags} contains
@code{SCM_F_WIND_EXPLICITLY}, @var{func} is also called when the frame
ends explicitly with @code{scm_frame_end}.
The function @code{scm_frame_unwind_with_scm} takes care that @var{data}
is protected from garbage collection.
The function @code{scm_frame_unwind_handler_with_scm} takes care that
@var{data} is protected from garbage collection.
@end deftypefn
@deftypefn {C Function} void scm_frame_rewind (void (*func)(void *), void *data, scm_t_wind_flags flags)
@deftypefnx {C Function} void scm_frame_rewind_with_scm (void (*func)(SCM), SCM data, scm_t_wind_flags flags)
@deftypefn {C Function} void scm_frame_rewind_handler (void (*func)(void *), void *data, scm_t_wind_flags flags)
@deftypefnx {C Function} void scm_frame_rewind_handler_with_scm (void (*func)(SCM), SCM data, scm_t_wind_flags flags)
Arrange for @var{func} to be called with @var{data} as its argument when
the current frame is restarted by rewinding the stack. When @var{flags}
contains @code{SCM_F_WIND_EXPLICITLY}, @var{func} is called immediately
as well.
The function @code{scm_frame_rewind_with_scm} takes care that @var{data}
is protected from garbage collection.
The function @code{scm_frame_rewind_handler_with_scm} takes care that
@var{data} is protected from garbage collection.
@end deftypefn

View file

@ -35,7 +35,7 @@ func1 ()
{
scm_frame_begin (0);
flag1 = 0;
scm_frame_unwind (set_flag, &flag1, 0);
scm_frame_unwind_handler (set_flag, &flag1, 0);
scm_frame_end ();
}
@ -47,7 +47,7 @@ func2 ()
{
scm_frame_begin (0);
flag1 = 0;
scm_frame_unwind (set_flag, &flag1, SCM_F_WIND_EXPLICITLY);
scm_frame_unwind_handler (set_flag, &flag1, SCM_F_WIND_EXPLICITLY);
scm_frame_end ();
}
@ -59,7 +59,7 @@ func3 ()
{
scm_frame_begin (0);
flag1 = 0;
scm_frame_unwind (set_flag, &flag1, 0);
scm_frame_unwind_handler (set_flag, &flag1, 0);
scm_misc_error ("func3", "gratuitous error", SCM_EOL);
scm_frame_end ();
}
@ -72,7 +72,7 @@ func4 ()
{
scm_frame_begin (0);
flag1 = 0;
scm_frame_unwind (set_flag, &flag1, SCM_F_WIND_EXPLICITLY);
scm_frame_unwind_handler (set_flag, &flag1, SCM_F_WIND_EXPLICITLY);
scm_misc_error ("func4", "gratuitous error", SCM_EOL);
scm_frame_end ();
}
@ -179,7 +179,8 @@ check_ports ()
{
SCM port = scm_open_file (scm_str2string (filename),
scm_str2string ("w"));
scm_frame_unwind_with_scm (close_port, port, SCM_F_WIND_EXPLICITLY);
scm_frame_unwind_handler_with_scm (close_port, port,
SCM_F_WIND_EXPLICITLY);
scm_frame_current_output_port (port);
scm_write (scm_version (), SCM_UNDEFINED);
@ -191,8 +192,9 @@ check_ports ()
SCM port = scm_open_file (scm_str2string (filename),
scm_str2string ("r"));
SCM res;
scm_frame_unwind_with_scm (close_port, port, SCM_F_WIND_EXPLICITLY);
scm_frame_unwind (delete_file, filename, SCM_F_WIND_EXPLICITLY);
scm_frame_unwind_handler_with_scm (close_port, port,
SCM_F_WIND_EXPLICITLY);
scm_frame_unwind_handler (delete_file, filename, SCM_F_WIND_EXPLICITLY);
scm_frame_current_input_port (port);
res = scm_read (SCM_UNDEFINED);