2 // nazghul - an old-school RPG engine
3 // Copyright (C) 2004 Gordon McNutt
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 2 of the License, or (at your option)
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 // You should have received a copy of the GNU General Public License along with
16 // this program; if not, write to the Free Foundation, Inc., 59 Temple Place,
17 // Suite 330, Boston, MA 02111-1307 USA
20 // gmcnutt@users.sourceforge.net
32 typedef struct closure {
39 #define closure_unref_safe(clx) if ((clx)) closure_unref(clx)
41 extern closure_t *closure_new(scheme *interp, pointer code);
42 extern closure_t *closure_new_ref(scheme *interp, pointer code);
43 extern void closure_init(closure_t *closure, scheme *interp, pointer code);
44 extern int closure_exec(closure_t *closure, const char *fmt, ...);
45 extern pointer closure_execv(closure_t *closure, const char *fmt, va_list args);
46 extern int closure_translate_result(scheme *sc, pointer result);
47 extern void closure_save(closure_t *closure, struct save *save);
48 extern void closure_ref(closure_t *closure);
49 extern void closure_unref(closure_t *closure);
51 /* Special form of closure_exec() made for running object hooks. */
52 int closure_execlpv(closure_t *closure, pointer gob, void *obj,
53 const char *fmt, va_list args);
55 /* Special form of closure_exec() made for running object hooks where an effect
56 * is attached to more than one hook. */
57 int closure_execlpiv(closure_t *closure, pointer gob, void *obj, int hook_id,
58 const char *fmt, va_list args);
60 /* Another special form - for session_run_hook */
61 int closure_execvl(closure_t *closure, const char *fmt, va_list args, pointer cell);