1996-07-25 22:56:11 +00:00
|
|
|
|
/* classes: h_files */
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef THROWH
|
|
|
|
|
|
#define THROWH
|
2000-06-12 12:28:24 +00:00
|
|
|
|
/* Copyright (C) 1995,1996,1998, 2000 Free Software Foundation, Inc.
|
1996-07-25 22:56:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
|
* any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this software; see the file COPYING. If not, write to
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
|
|
|
* Boston, MA 02111-1307 USA
|
1996-07-25 22:56:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* As a special exception, the Free Software Foundation gives permission
|
|
|
|
|
|
* for additional uses of the text contained in its release of GUILE.
|
|
|
|
|
|
*
|
|
|
|
|
|
* The exception is that, if you link the GUILE library with other files
|
|
|
|
|
|
* to produce an executable, this does not by itself cause the
|
|
|
|
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
|
|
|
|
* Your use of that executable is in no way restricted on account of
|
|
|
|
|
|
* linking the GUILE library code into it.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception does not however invalidate any other reasons why
|
|
|
|
|
|
* the executable file might be covered by the GNU General Public License.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception applies only to the code released by the
|
|
|
|
|
|
* Free Software Foundation under the name GUILE. If you copy
|
|
|
|
|
|
* code from other Free Software Foundation releases into a copy of
|
|
|
|
|
|
* GUILE, as the General Public License permits, the exception does
|
|
|
|
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
|
|
|
|
* anyone as to the status of such modified files, you must delete
|
|
|
|
|
|
* this exception notice from them.
|
|
|
|
|
|
*
|
|
|
|
|
|
* If you write modifications of your own for GUILE, it is your choice
|
|
|
|
|
|
* whether to permit this exception to apply to your modifications.
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* If you do not wish that, delete this exception notice. */
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
* alist.h, append.h, arbiters.h, async.h, boolean.h, chars.h,
continuations.h, debug.h, dynwind.h, error.h, eval.h, fdsocket.h,
feature.h, filesys.h, fports.h, gc.h, gdbint.h, genio.h, gsubr.h,
hash.h, init.h, ioext.h, kw.h, list.h, markers.h, marksweep.h,
mbstrings.h, numbers.h, objprop.h, options.h, pairs.h, ports.h,
posix.h, print.h, procprop.h, procs.h, ramap.h, read.h, root.h,
sequences.h, smob.h, socket.h, srcprop.h, stackchk.h, stime.h,
strings.h, strop.h, strorder.h, strports.h, struct.h, symbols.h,
tag.h, throw.h, unif.h, variable.h, vectors.h, version.h,
vports.h, weaks.h: #include "libguile/__scm.h", not
<libguile/__scm.h>. This allows 'gcc -MM' to determine which
dependencies are within libguile properly.
1996-09-05 21:19:08 +00:00
|
|
|
|
#include "libguile/__scm.h"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
1996-10-01 03:19:58 +00:00
|
|
|
|
|
2001-06-14 19:50:43 +00:00
|
|
|
|
typedef SCM (*scm_t_catch_body) (void *data);
|
|
|
|
|
|
typedef SCM (*scm_t_catch_handler) (void *data,
|
2000-03-02 20:54:43 +00:00
|
|
|
|
SCM tag, SCM throw_args);
|
1996-12-09 02:15:17 +00:00
|
|
|
|
|
2000-03-02 20:54:43 +00:00
|
|
|
|
extern SCM scm_internal_catch (SCM tag,
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_catch_body body,
|
2000-03-02 20:54:43 +00:00
|
|
|
|
void *body_data,
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_catch_handler handler,
|
2000-03-02 20:54:43 +00:00
|
|
|
|
void *handler_data);
|
* throw.c (scm_internal_catch): Make body funcs and handler funcs
use separate data pointers, to allow them to be designed
independently and reused.
(scm_body_thunk, scm_handle_by_proc, scm_handle_by_message):
Renamed from catch_body, catch_handler, and uncaught_throw; made
generically useful.
(struct scm_catch_body_data): Renamed from catch_body_data; moved
to throw.h.
(scm_catch): Use the above.
(scm_throw): Don't bother printing a message for an uncaught
throw; we establish a default handler in init.
* throw.h (scm_internal_catch): Prototype updated.
(scm_body_thunk, scm_handle_by_proc, scm_handle_by_message): New
decls.
(struct scm_body_thunk_data): New structure, used as data
argument to scm_body_thunk.
* init.c (struct main_func_closure): New structure, packaging up
the data to pass to the user's main function.
(scm_boot_guile): Create one. Pass it to scm_boot_guile_1.
(scm_boot_guile_1): Pass it through to invoke_main_func. Use
scm_internal_catch to establish a catch-all handler, using
scm_handle_by_message. This replaces the special-case code in
scm_throw.
(invoke_main_func): Body function for scm_internal_catch; invoke
the user's main function, using the main_func_closure pointer to
decide what to pass it.
* root.c (struct cwdr_body_data): Remove handler_proc member.
(cwdr): Use scm_handle_by_proc instead of cwdr_handler.
(cwdr_handler): Removed.
1996-12-21 04:48:21 +00:00
|
|
|
|
|
2000-03-02 20:54:43 +00:00
|
|
|
|
extern SCM scm_internal_lazy_catch (SCM tag,
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_catch_body body,
|
2000-03-02 20:54:43 +00:00
|
|
|
|
void *body_data,
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_catch_handler handler,
|
2000-03-02 20:54:43 +00:00
|
|
|
|
void *handler_data);
|
1997-02-07 22:38:27 +00:00
|
|
|
|
|
2000-03-02 20:54:43 +00:00
|
|
|
|
extern SCM scm_internal_stack_catch (SCM tag,
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_catch_body body,
|
2000-03-02 20:54:43 +00:00
|
|
|
|
void *body_data,
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_catch_handler handler,
|
2000-03-02 20:54:43 +00:00
|
|
|
|
void *handler_data);
|
1997-08-13 14:54:49 +00:00
|
|
|
|
|
* throw.c (scm_internal_catch): Make body funcs and handler funcs
use separate data pointers, to allow them to be designed
independently and reused.
(scm_body_thunk, scm_handle_by_proc, scm_handle_by_message):
Renamed from catch_body, catch_handler, and uncaught_throw; made
generically useful.
(struct scm_catch_body_data): Renamed from catch_body_data; moved
to throw.h.
(scm_catch): Use the above.
(scm_throw): Don't bother printing a message for an uncaught
throw; we establish a default handler in init.
* throw.h (scm_internal_catch): Prototype updated.
(scm_body_thunk, scm_handle_by_proc, scm_handle_by_message): New
decls.
(struct scm_body_thunk_data): New structure, used as data
argument to scm_body_thunk.
* init.c (struct main_func_closure): New structure, packaging up
the data to pass to the user's main function.
(scm_boot_guile): Create one. Pass it to scm_boot_guile_1.
(scm_boot_guile_1): Pass it through to invoke_main_func. Use
scm_internal_catch to establish a catch-all handler, using
scm_handle_by_message. This replaces the special-case code in
scm_throw.
(invoke_main_func): Body function for scm_internal_catch; invoke
the user's main function, using the main_func_closure pointer to
decide what to pass it.
* root.c (struct cwdr_body_data): Remove handler_proc member.
(cwdr): Use scm_handle_by_proc instead of cwdr_handler.
(cwdr_handler): Removed.
1996-12-21 04:48:21 +00:00
|
|
|
|
/* The first argument to scm_body_thunk should be a pointer to one of
|
|
|
|
|
|
these. See the implementation of catch in throw.c. */
|
|
|
|
|
|
struct scm_body_thunk_data
|
|
|
|
|
|
{
|
|
|
|
|
|
/* The tag being caught. We only use it to figure out what
|
|
|
|
|
|
arguments to pass to the body procedure; see scm_catch_thunk_body for
|
|
|
|
|
|
details. */
|
|
|
|
|
|
SCM tag;
|
|
|
|
|
|
|
|
|
|
|
|
/* The Scheme procedure object constituting the catch body.
|
|
|
|
|
|
scm_body_by_proc invokes this. */
|
|
|
|
|
|
SCM body_proc;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2000-03-02 20:54:43 +00:00
|
|
|
|
extern SCM scm_body_thunk (void *);
|
* throw.c (scm_internal_catch): Make body funcs and handler funcs
use separate data pointers, to allow them to be designed
independently and reused.
(scm_body_thunk, scm_handle_by_proc, scm_handle_by_message):
Renamed from catch_body, catch_handler, and uncaught_throw; made
generically useful.
(struct scm_catch_body_data): Renamed from catch_body_data; moved
to throw.h.
(scm_catch): Use the above.
(scm_throw): Don't bother printing a message for an uncaught
throw; we establish a default handler in init.
* throw.h (scm_internal_catch): Prototype updated.
(scm_body_thunk, scm_handle_by_proc, scm_handle_by_message): New
decls.
(struct scm_body_thunk_data): New structure, used as data
argument to scm_body_thunk.
* init.c (struct main_func_closure): New structure, packaging up
the data to pass to the user's main function.
(scm_boot_guile): Create one. Pass it to scm_boot_guile_1.
(scm_boot_guile_1): Pass it through to invoke_main_func. Use
scm_internal_catch to establish a catch-all handler, using
scm_handle_by_message. This replaces the special-case code in
scm_throw.
(invoke_main_func): Body function for scm_internal_catch; invoke
the user's main function, using the main_func_closure pointer to
decide what to pass it.
* root.c (struct cwdr_body_data): Remove handler_proc member.
(cwdr): Use scm_handle_by_proc instead of cwdr_handler.
(cwdr_handler): Removed.
1996-12-21 04:48:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-03-02 20:54:43 +00:00
|
|
|
|
extern SCM scm_handle_by_proc (void *, SCM, SCM);
|
|
|
|
|
|
extern SCM scm_handle_by_proc_catching_all (void *, SCM, SCM);
|
|
|
|
|
|
extern SCM scm_handle_by_message (void *, SCM, SCM);
|
|
|
|
|
|
extern SCM scm_handle_by_message_noexit (void *, SCM, SCM);
|
|
|
|
|
|
extern SCM scm_handle_by_throw (void *, SCM, SCM);
|
|
|
|
|
|
extern int scm_exit_status (SCM args);
|
1996-12-09 02:15:17 +00:00
|
|
|
|
|
2000-03-02 20:54:43 +00:00
|
|
|
|
extern SCM scm_catch (SCM tag, SCM thunk, SCM handler);
|
|
|
|
|
|
extern SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
|
|
|
|
|
|
extern SCM scm_ithrow (SCM key, SCM args, int noreturn);
|
1997-03-02 07:32:19 +00:00
|
|
|
|
|
2000-03-02 20:54:43 +00:00
|
|
|
|
extern SCM scm_throw (SCM key, SCM args);
|
|
|
|
|
|
extern void scm_init_throw (void);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif /* THROWH */
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|