1996-10-29 20:49:56 +00:00
|
|
|
|
/* classes: h_files */
|
|
|
|
|
|
|
2001-08-31 11:17:06 +00:00
|
|
|
|
#ifndef SCM_SNARF_H
|
|
|
|
|
|
#define SCM_SNARF_H
|
1996-10-29 20:49:56 +00:00
|
|
|
|
|
2003-03-06 12:51:57 +00:00
|
|
|
|
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003 Free Software Foundation, Inc.
|
2001-08-31 11:17:06 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2001-08-31 11:17:06 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
1996-10-29 20:49:56 +00:00
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
* Lesser General Public License for more details.
|
2001-08-31 11:17:06 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
*/
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
1996-10-29 20:49:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
2001-08-31 11:17:06 +00:00
|
|
|
|
/* Macros for snarfing initialization actions from C source. */
|
|
|
|
|
|
|
2000-01-07 23:05:04 +00:00
|
|
|
|
#if defined(__cplusplus) || defined(GUILE_CPLUSPLUS_SNARF)
|
2001-05-06 21:19:53 +00:00
|
|
|
|
|
|
|
|
|
|
/* This used to be "SCM (*)(...)" but GCC on RedHat 7.1 doesn't seem
|
|
|
|
|
|
to like it.
|
|
|
|
|
|
*/
|
|
|
|
|
|
#define SCM_FUNC_CAST_ARBITRARY_ARGS SCM (*)()
|
|
|
|
|
|
|
2000-01-07 00:29:28 +00:00
|
|
|
|
#else
|
2000-01-07 23:05:04 +00:00
|
|
|
|
#define SCM_FUNC_CAST_ARBITRARY_ARGS SCM (*)()
|
2000-01-07 00:29:28 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2000-01-07 23:33:29 +00:00
|
|
|
|
/* Generic macros to be used in user macro definitions.
|
|
|
|
|
|
*
|
|
|
|
|
|
* For example, in order to define a macro which creates ints and
|
|
|
|
|
|
* initializes them to the result of foo (), do:
|
|
|
|
|
|
*
|
|
|
|
|
|
* #define SCM_FOO(NAME) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
* SCM_SNARF_HERE (int NAME) \
|
|
|
|
|
|
* SCM_SNARF_INIT (NAME = foo ())
|
2000-01-07 23:53:20 +00:00
|
|
|
|
*
|
2000-06-12 11:59:57 +00:00
|
|
|
|
* The SCM_SNARF_INIT text goes into the corresponding .x file
|
2000-06-21 08:43:12 +00:00
|
|
|
|
* up through the first occurrence of SCM_SNARF_DOC_START on that
|
|
|
|
|
|
* line, if any.
|
2000-01-07 23:33:29 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
2001-05-31 13:15:54 +00:00
|
|
|
|
#ifdef SCM_MAGIC_SNARF_INITS
|
|
|
|
|
|
# define SCM_SNARF_HERE(X)
|
2002-03-14 22:23:43 +00:00
|
|
|
|
# define SCM_SNARF_INIT(X) ^^ X ^:^
|
2001-11-16 09:55:54 +00:00
|
|
|
|
# define SCM_SNARF_DOCS(TYPE, CNAME, FNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING)
|
2000-01-07 23:53:20 +00:00
|
|
|
|
#else
|
2001-05-31 13:15:54 +00:00
|
|
|
|
# ifdef SCM_MAGIC_SNARF_DOCS
|
2000-06-12 11:59:57 +00:00
|
|
|
|
# define SCM_SNARF_HERE(X)
|
2001-05-31 13:15:54 +00:00
|
|
|
|
# define SCM_SNARF_INIT(X)
|
2001-11-16 09:55:54 +00:00
|
|
|
|
# define SCM_SNARF_DOCS(TYPE, CNAME, FNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING) \
|
2001-06-25 03:30:02 +00:00
|
|
|
|
^^ { \
|
2001-11-16 09:55:54 +00:00
|
|
|
|
cname CNAME ^^ \
|
2001-06-25 03:30:02 +00:00
|
|
|
|
fname FNAME ^^ \
|
|
|
|
|
|
type TYPE ^^ \
|
|
|
|
|
|
location __FILE__ __LINE__ ^^ \
|
|
|
|
|
|
arglist ARGLIST ^^ \
|
|
|
|
|
|
argsig REQ OPT VAR ^^ \
|
|
|
|
|
|
DOCSTRING ^^ }
|
2001-05-31 13:15:54 +00:00
|
|
|
|
# else
|
|
|
|
|
|
# define SCM_SNARF_HERE(X) X
|
|
|
|
|
|
# define SCM_SNARF_INIT(X)
|
2001-11-16 09:55:54 +00:00
|
|
|
|
# define SCM_SNARF_DOCS(TYPE, CNAME, FNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING)
|
2001-05-31 13:15:54 +00:00
|
|
|
|
# endif
|
2000-01-07 23:53:20 +00:00
|
|
|
|
#endif
|
2000-01-07 23:33:29 +00:00
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
#define SCM_DEFINE(FNAME, PRIMNAME, REQ, OPT, VAR, ARGLIST, DOCSTRING) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(\
|
2000-01-07 23:05:04 +00:00
|
|
|
|
static const char s_ ## FNAME [] = PRIMNAME; \
|
|
|
|
|
|
SCM FNAME ARGLIST\
|
|
|
|
|
|
)\
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_INIT(\
|
(scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
scm_c_define_gsubr_with_generic): New functions. They replace
scm_make_gsubr and scm_make_gsubr_with_generic. The `make' variants
only create the gsubr object, while the `define' variants also put it
into the current module. Changed all callers. (scm_make_gsubr,
scm_make_gsubr_with_generic): Deprecated.
(scm_c_make_subr, scm_c_define_subr, scm_c_make_subr_with_generic,
scm_c_define_subr_with_generic): New functions. They replace
scm_make_subr, scm_make_subr_opt and scm_make_subr_with_generic. The
`make' variants only create the subr object, while the `define'
variants also put it into the current module. Changed all callers.
(scm_make_subr, scm_make_subr_opt, scm_make_subr_with_generic):
Deprecated.
2001-05-20 00:35:43 +00:00
|
|
|
|
scm_c_define_gsubr (s_ ## FNAME, REQ, OPT, VAR, \
|
|
|
|
|
|
(SCM_FUNC_CAST_ARBITRARY_ARGS) FNAME); \
|
2000-01-09 01:07:17 +00:00
|
|
|
|
)\
|
2001-11-16 09:55:54 +00:00
|
|
|
|
SCM_SNARF_DOCS(primitive, FNAME, PRIMNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2003-03-06 12:51:57 +00:00
|
|
|
|
#define SCM_PRIMITIVE_GENERIC(FNAME, PRIMNAME, REQ, OPT, VAR, ARGLIST, DOCSTRING) \
|
|
|
|
|
|
SCM_SNARF_HERE(\
|
|
|
|
|
|
static const char s_ ## FNAME [] = PRIMNAME; \
|
|
|
|
|
|
static SCM g_ ## FNAME; \
|
|
|
|
|
|
SCM FNAME ARGLIST\
|
|
|
|
|
|
)\
|
|
|
|
|
|
SCM_SNARF_INIT(\
|
|
|
|
|
|
g_ ## FNAME = SCM_PACK (0); \
|
|
|
|
|
|
scm_c_define_gsubr_with_generic (s_ ## FNAME, REQ, OPT, VAR, \
|
|
|
|
|
|
(SCM_FUNC_CAST_ARBITRARY_ARGS) FNAME, \
|
|
|
|
|
|
&g_ ## FNAME); \
|
|
|
|
|
|
)\
|
|
|
|
|
|
SCM_SNARF_DOCS(primitive, FNAME, PRIMNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING)
|
|
|
|
|
|
|
2002-09-01 16:19:18 +00:00
|
|
|
|
#define SCM_DEFINE_PUBLIC(FNAME, PRIMNAME, REQ, OPT, VAR, ARGLIST, DOCSTRING) \
|
|
|
|
|
|
SCM_SNARF_HERE(\
|
|
|
|
|
|
static const char s_ ## FNAME [] = PRIMNAME; \
|
|
|
|
|
|
SCM FNAME ARGLIST\
|
|
|
|
|
|
)\
|
|
|
|
|
|
SCM_SNARF_INIT(\
|
|
|
|
|
|
scm_c_define_gsubr (s_ ## FNAME, REQ, OPT, VAR, \
|
|
|
|
|
|
(SCM_FUNC_CAST_ARBITRARY_ARGS) FNAME); \
|
|
|
|
|
|
scm_c_export (s_ ## FNAME, NULL); \
|
|
|
|
|
|
)\
|
|
|
|
|
|
SCM_SNARF_DOCS(primitive, FNAME, PRIMNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING)
|
|
|
|
|
|
|
2000-01-06 19:51:45 +00:00
|
|
|
|
#define SCM_DEFINE1(FNAME, PRIMNAME, TYPE, ARGLIST, DOCSTRING) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(\
|
2000-01-07 23:05:04 +00:00
|
|
|
|
static const char s_ ## FNAME [] = PRIMNAME; \
|
|
|
|
|
|
SCM FNAME ARGLIST\
|
2000-01-09 01:07:17 +00:00
|
|
|
|
)\
|
(scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
scm_c_define_gsubr_with_generic): New functions. They replace
scm_make_gsubr and scm_make_gsubr_with_generic. The `make' variants
only create the gsubr object, while the `define' variants also put it
into the current module. Changed all callers. (scm_make_gsubr,
scm_make_gsubr_with_generic): Deprecated.
(scm_c_make_subr, scm_c_define_subr, scm_c_make_subr_with_generic,
scm_c_define_subr_with_generic): New functions. They replace
scm_make_subr, scm_make_subr_opt and scm_make_subr_with_generic. The
`make' variants only create the subr object, while the `define'
variants also put it into the current module. Changed all callers.
(scm_make_subr, scm_make_subr_opt, scm_make_subr_with_generic):
Deprecated.
2001-05-20 00:35:43 +00:00
|
|
|
|
SCM_SNARF_INIT(scm_c_define_subr (s_ ## FNAME, TYPE, FNAME); ) \
|
2001-11-16 09:55:54 +00:00
|
|
|
|
SCM_SNARF_DOCS(1, FNAME, PRIMNAME, ARGLIST, 2, 0, 0, DOCSTRING)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2003-03-06 12:51:57 +00:00
|
|
|
|
#define SCM_PRIMITIVE_GENERIC_1(FNAME, PRIMNAME, TYPE, ARGLIST, DOCSTRING) \
|
|
|
|
|
|
SCM_SNARF_HERE(\
|
|
|
|
|
|
static const char s_ ## FNAME [] = PRIMNAME; \
|
|
|
|
|
|
static SCM g_ ## FNAME; \
|
|
|
|
|
|
SCM FNAME ARGLIST\
|
|
|
|
|
|
)\
|
|
|
|
|
|
SCM_SNARF_INIT(\
|
|
|
|
|
|
g_ ## FNAME = SCM_PACK (0); \
|
|
|
|
|
|
scm_c_define_subr_with_generic (s_ ## FNAME, TYPE, FNAME, &g_ ## FNAME); \
|
|
|
|
|
|
)\
|
|
|
|
|
|
SCM_SNARF_DOCS(1, FNAME, PRIMNAME, ARGLIST, 2, 0, 0, DOCSTRING)
|
|
|
|
|
|
|
1999-12-14 18:54:31 +00:00
|
|
|
|
#define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(static const char RANAME[]=STR) \
|
(scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
scm_c_define_gsubr_with_generic): New functions. They replace
scm_make_gsubr and scm_make_gsubr_with_generic. The `make' variants
only create the gsubr object, while the `define' variants also put it
into the current module. Changed all callers. (scm_make_gsubr,
scm_make_gsubr_with_generic): Deprecated.
(scm_c_make_subr, scm_c_define_subr, scm_c_make_subr_with_generic,
scm_c_define_subr_with_generic): New functions. They replace
scm_make_subr, scm_make_subr_opt and scm_make_subr_with_generic. The
`make' variants only create the subr object, while the `define'
variants also put it into the current module. Changed all callers.
(scm_make_subr, scm_make_subr_opt, scm_make_subr_with_generic):
Deprecated.
2001-05-20 00:35:43 +00:00
|
|
|
|
SCM_SNARF_INIT(scm_c_define_gsubr (RANAME, REQ, OPT, VAR, \
|
|
|
|
|
|
(SCM_FUNC_CAST_ARBITRARY_ARGS) CFN))
|
1999-12-14 18:54:31 +00:00
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define SCM_REGISTER_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(static const char RANAME[]=STR) \
|
(scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
scm_c_define_gsubr_with_generic): New functions. They replace
scm_make_gsubr and scm_make_gsubr_with_generic. The `make' variants
only create the gsubr object, while the `define' variants also put it
into the current module. Changed all callers. (scm_make_gsubr,
scm_make_gsubr_with_generic): Deprecated.
(scm_c_make_subr, scm_c_define_subr, scm_c_make_subr_with_generic,
scm_c_define_subr_with_generic): New functions. They replace
scm_make_subr, scm_make_subr_opt and scm_make_subr_with_generic. The
`make' variants only create the subr object, while the `define'
variants also put it into the current module. Changed all callers.
(scm_make_subr, scm_make_subr_opt, scm_make_subr_with_generic):
Deprecated.
2001-05-20 00:35:43 +00:00
|
|
|
|
SCM_SNARF_INIT(scm_c_define_gsubr (RANAME, REQ, OPT, VAR, \
|
|
|
|
|
|
(SCM_FUNC_CAST_ARBITRARY_ARGS) CFN);) \
|
2001-11-16 09:55:54 +00:00
|
|
|
|
SCM_SNARF_DOCS(register, CFN, STR, (), REQ, OPT, VAR, \
|
2001-05-31 13:15:54 +00:00
|
|
|
|
"implemented by the C function \"" #CFN "\"")
|
1999-12-12 23:37:40 +00:00
|
|
|
|
|
* procs.c, procs.h (scm_subr_entry): New type: Stores data
associated with subrs.
(SCM_SUBRNUM, SCM_SUBR_ENTRY, SCM_SUBR_GENERIC, SCM_SUBR_PROPS,
SCM_SUBR_DOC): New macros.
(scm_subr_table): New variable.
(scm_mark_subr_table): New function.
* init.c (scm_boot_guile_1): Call scm_init_subr_table.
* gc.c (scm_gc_mark): Don't mark subr names here.
(scm_igc): Call scm_mark_subr_table.
* snarf.h (SCM_GPROC, SCM_GPROC1): New macros.
* procs.c, procs.h (scm_subr_p): New function (used internally).
* gsubr.c, gsubr.h (scm_make_gsubr_with_generic): New function.
* objects.c, objects.h (scm_primitive_generic): New class.
* objects.h (SCM_CMETHOD_CODE, SCM_CMETHOD_ENV): New macros.
* print.c (scm_iprin1): Print primitive-generics.
* __scm.h (SCM_WTA_DISPATCH_1, SCM_GASSERT1,
SCM_WTA_DISPATCH_2, SCM_GASSERT2): New macros.
* eval.c (SCM_CEVAL, SCM_APPLY): Replace scm_wta -->
SCM_WTA_DISPATCH_1 for scm_cxr's (unary floating point
primitives). NOTE: This means that it is now *required* to use
SCM_GPROC1 when creating float scm_cxr's (float scm_cxr's is an
obscured representation that will be removed in the future anyway,
so backward compatibility is no problem here).
* numbers.c: Converted most numeric primitives (all but bit
comparison operations and bit operations) to dispatch on generic
if args don't match.
* eval.c, eval.h (scm_eval_body): New function.
* objects.c (scm_call_generic_0, scm_call_generic_1,
scm_call_generic_2, scm_call_generic_3, scm_apply_generic): New
functions.
* eval.c (SCM_CEVAL): Apply the cmethod directly after having
called scm_memoize_method instead of doing a second lookup.
* objects.h (scm_memoize_method): Now returns the memoized cmethod.
* procs.c (scm_make_subr_opt): Use scm_sysintern0 instead of
scm_sysintern so that the binding connected with the subr name
isn't cleared when we give set = 0.
1999-08-26 04:24:42 +00:00
|
|
|
|
#define SCM_GPROC(RANAME, STR, REQ, OPT, VAR, CFN, GF) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(\
|
2000-01-07 23:05:04 +00:00
|
|
|
|
static const char RANAME[]=STR;\
|
2000-04-03 08:47:51 +00:00
|
|
|
|
static SCM GF \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
)SCM_SNARF_INIT(\
|
2000-04-03 08:47:51 +00:00
|
|
|
|
GF = SCM_PACK (0); /* Dirk:FIXME:: Can we safely use #f instead of 0? */ \
|
(scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
scm_c_define_gsubr_with_generic): New functions. They replace
scm_make_gsubr and scm_make_gsubr_with_generic. The `make' variants
only create the gsubr object, while the `define' variants also put it
into the current module. Changed all callers. (scm_make_gsubr,
scm_make_gsubr_with_generic): Deprecated.
(scm_c_make_subr, scm_c_define_subr, scm_c_make_subr_with_generic,
scm_c_define_subr_with_generic): New functions. They replace
scm_make_subr, scm_make_subr_opt and scm_make_subr_with_generic. The
`make' variants only create the subr object, while the `define'
variants also put it into the current module. Changed all callers.
(scm_make_subr, scm_make_subr_opt, scm_make_subr_with_generic):
Deprecated.
2001-05-20 00:35:43 +00:00
|
|
|
|
scm_c_define_gsubr_with_generic (RANAME, REQ, OPT, VAR, \
|
|
|
|
|
|
(SCM_FUNC_CAST_ARBITRARY_ARGS) CFN, &GF) \
|
2000-01-07 23:05:04 +00:00
|
|
|
|
)
|
1999-12-12 23:37:40 +00:00
|
|
|
|
|
2000-01-07 23:05:04 +00:00
|
|
|
|
#define SCM_PROC1(RANAME, STR, TYPE, CFN) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(static const char RANAME[]=STR) \
|
|
|
|
|
|
SCM_SNARF_INIT(\
|
(scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
scm_c_define_gsubr_with_generic): New functions. They replace
scm_make_gsubr and scm_make_gsubr_with_generic. The `make' variants
only create the gsubr object, while the `define' variants also put it
into the current module. Changed all callers. (scm_make_gsubr,
scm_make_gsubr_with_generic): Deprecated.
(scm_c_make_subr, scm_c_define_subr, scm_c_make_subr_with_generic,
scm_c_define_subr_with_generic): New functions. They replace
scm_make_subr, scm_make_subr_opt and scm_make_subr_with_generic. The
`make' variants only create the subr object, while the `define'
variants also put it into the current module. Changed all callers.
(scm_make_subr, scm_make_subr_opt, scm_make_subr_with_generic):
Deprecated.
2001-05-20 00:35:43 +00:00
|
|
|
|
scm_c_define_subr (RANAME, TYPE, (SCM_FUNC_CAST_ARBITRARY_ARGS) CFN) \
|
2000-01-07 23:05:04 +00:00
|
|
|
|
)
|
1999-12-14 18:54:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-07 23:05:04 +00:00
|
|
|
|
#define SCM_GPROC1(RANAME, STR, TYPE, CFN, GF) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(\
|
2000-01-07 23:05:04 +00:00
|
|
|
|
static const char RANAME[]=STR; \
|
2000-04-03 08:47:51 +00:00
|
|
|
|
static SCM GF \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
)SCM_SNARF_INIT(\
|
2000-04-03 08:47:51 +00:00
|
|
|
|
GF = SCM_PACK (0); /* Dirk:FIXME:: Can we safely use #f instead of 0? */ \
|
(scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
scm_c_define_gsubr_with_generic): New functions. They replace
scm_make_gsubr and scm_make_gsubr_with_generic. The `make' variants
only create the gsubr object, while the `define' variants also put it
into the current module. Changed all callers. (scm_make_gsubr,
scm_make_gsubr_with_generic): Deprecated.
(scm_c_make_subr, scm_c_define_subr, scm_c_make_subr_with_generic,
scm_c_define_subr_with_generic): New functions. They replace
scm_make_subr, scm_make_subr_opt and scm_make_subr_with_generic. The
`make' variants only create the subr object, while the `define'
variants also put it into the current module. Changed all callers.
(scm_make_subr, scm_make_subr_opt, scm_make_subr_with_generic):
Deprecated.
2001-05-20 00:35:43 +00:00
|
|
|
|
scm_c_define_subr_with_generic (RANAME, TYPE, \
|
|
|
|
|
|
(SCM_FUNC_CAST_ARBITRARY_ARGS) CFN, &GF) \
|
2000-01-07 23:05:04 +00:00
|
|
|
|
)
|
1996-10-29 20:49:56 +00:00
|
|
|
|
|
1998-12-14 15:19:59 +00:00
|
|
|
|
#define SCM_SYNTAX(RANAME, STR, TYPE, CFN) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(static const char RANAME[]=STR)\
|
|
|
|
|
|
SCM_SNARF_INIT(scm_make_synt (RANAME, TYPE, CFN))
|
1998-12-14 15:19:59 +00:00
|
|
|
|
|
1996-10-29 20:49:56 +00:00
|
|
|
|
#define SCM_SYMBOL(c_name, scheme_name) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(static SCM c_name) \
|
2000-12-08 17:08:34 +00:00
|
|
|
|
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_str2symbol (scheme_name)))
|
1996-10-29 20:49:56 +00:00
|
|
|
|
|
1997-03-21 22:53:08 +00:00
|
|
|
|
#define SCM_GLOBAL_SYMBOL(c_name, scheme_name) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(SCM c_name) \
|
2000-12-08 17:08:34 +00:00
|
|
|
|
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_str2symbol (scheme_name)))
|
1997-03-21 22:53:08 +00:00
|
|
|
|
|
1999-06-23 11:16:52 +00:00
|
|
|
|
#define SCM_KEYWORD(c_name, scheme_name) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(static SCM c_name) \
|
|
|
|
|
|
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_c_make_keyword (scheme_name)))
|
1999-06-23 11:16:52 +00:00
|
|
|
|
|
|
|
|
|
|
#define SCM_GLOBAL_KEYWORD(c_name, scheme_name) \
|
2000-06-12 11:59:57 +00:00
|
|
|
|
SCM_SNARF_HERE(SCM c_name) \
|
|
|
|
|
|
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_c_make_keyword (scheme_name)))
|
1996-10-29 20:49:56 +00:00
|
|
|
|
|
2001-05-15 14:57:22 +00:00
|
|
|
|
#define SCM_VARIABLE(c_name, scheme_name) \
|
|
|
|
|
|
SCM_SNARF_HERE(static SCM c_name) \
|
|
|
|
|
|
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_c_define (scheme_name, SCM_BOOL_F));)
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_GLOBAL_VARIABLE(c_name, scheme_name) \
|
|
|
|
|
|
SCM_SNARF_HERE(SCM c_name) \
|
|
|
|
|
|
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_c_define (scheme_name, SCM_BOOL_F));)
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_VARIABLE_INIT(c_name, scheme_name, init_val) \
|
|
|
|
|
|
SCM_SNARF_HERE(static SCM c_name) \
|
|
|
|
|
|
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_c_define (scheme_name, init_val));)
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_GLOBAL_VARIABLE_INIT(c_name, scheme_name, init_val) \
|
|
|
|
|
|
SCM_SNARF_HERE(SCM c_name) \
|
|
|
|
|
|
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_c_define (scheme_name, init_val));)
|
|
|
|
|
|
|
* __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): New definitions.
Simply lock a thread C API recursive mutex.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): Removed.
* eval.c: Replaced SOURCE_SECTION_START / SOURCE_SECTION_END with
direct calls to scm_rec_mutex_lock / unlock around the three calls
to scm_m_expand_body.
* eval.c, eval.h (promise_free): New function.
(scm_force): Rewritten; Now thread-safe; Removed
SCM_DEFER/ALLOW_INTS.
* pthread-threads.h: Added partially implemented plugin interface
for recursive mutexes. These are, for now, only intended to be
used internally within the Guile implementation.
* pthread-threads.c: New file.
* threads.c: Conditionally #include "pthread-threads.c".
* eval.c, eval.h (scm_makprom, scm_force): Rewritten to be
thread-safe;
* snarf.h (SCM_MUTEX, SCM_GLOBAL_MUTEX, SCM_REC_MUTEX,
SCM_GLOBAL_REC_MUTEX): New macros.
* eval.c, threads.c, threads.h, snarf.h: Rewrote critical section
macros---use mutexes instead.
* tags.h (SCM_IM_FUTURE): New tag.
* eval.c (scm_m_future): New primitive macro.
(SCM_CEVAL): Support futures.
(unmemocopy): Support unmemoization of futures.
* print.c (scm_isymnames): Name of future isym.
2002-12-15 14:24:34 +00:00
|
|
|
|
#define SCM_MUTEX(c_name) \
|
|
|
|
|
|
SCM_SNARF_HERE(static scm_t_mutex c_name) \
|
|
|
|
|
|
SCM_SNARF_INIT(scm_i_plugin_mutex_init (&c_name, &scm_i_plugin_mutex))
|
* __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): New macros.
(SCM_CRITICAL_SECTION_START/END): Defined here.
* eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around
the three calls to scm_m_expand_body.
* gc.h: #include "libguile/pthread-threads.h";
(SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros.
* gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type
scm_t_key;
* gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist
access.
* gc-freelist.c (scm_gc_init_freelist): Create freelist keys.
* gc-freelist.c, threads.c (really_launch): Use
SCM_FREELIST_CREATE.
* gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory):
* gc.c (scm_i_expensive_validation_check, scm_gc,
scm_gc_for_newcell): Put threads to sleep before doing GC-related
heap administration so that those pieces of code are executed
single-threaded. We might consider rewriting these code sections
in terms of a "call_gc_code_singly_threaded" construct instead of
calling the pair of scm_i_thread_put_to_sleep () and
scm_i_thread_wake_up (). Also, we would want to have as many of
these sections eleminated.
* init.c (scm_init_guile_1): Call scm_threads_prehistory.
* inline.h: #include "libguile/threads.h"
* pthread-threads.h: Macros now conform more closely to the
pthreads interface. Some of them now take a second argument.
* threads.c, threads.h: Many changes.
* configure.in: Temporarily replaced "copt" threads option with new
option "pthreads".
(USE_PTHREAD_THREADS): Define if pthreads configured.
2002-12-09 13:42:58 +00:00
|
|
|
|
|
* __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): New definitions.
Simply lock a thread C API recursive mutex.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): Removed.
* eval.c: Replaced SOURCE_SECTION_START / SOURCE_SECTION_END with
direct calls to scm_rec_mutex_lock / unlock around the three calls
to scm_m_expand_body.
* eval.c, eval.h (promise_free): New function.
(scm_force): Rewritten; Now thread-safe; Removed
SCM_DEFER/ALLOW_INTS.
* pthread-threads.h: Added partially implemented plugin interface
for recursive mutexes. These are, for now, only intended to be
used internally within the Guile implementation.
* pthread-threads.c: New file.
* threads.c: Conditionally #include "pthread-threads.c".
* eval.c, eval.h (scm_makprom, scm_force): Rewritten to be
thread-safe;
* snarf.h (SCM_MUTEX, SCM_GLOBAL_MUTEX, SCM_REC_MUTEX,
SCM_GLOBAL_REC_MUTEX): New macros.
* eval.c, threads.c, threads.h, snarf.h: Rewrote critical section
macros---use mutexes instead.
* tags.h (SCM_IM_FUTURE): New tag.
* eval.c (scm_m_future): New primitive macro.
(SCM_CEVAL): Support futures.
(unmemocopy): Support unmemoization of futures.
* print.c (scm_isymnames): Name of future isym.
2002-12-15 14:24:34 +00:00
|
|
|
|
#define SCM_GLOBAL_MUTEX(c_name) \
|
|
|
|
|
|
SCM_SNARF_HERE(scm_t_mutex c_name) \
|
|
|
|
|
|
SCM_SNARF_INIT(scm_i_plugin_mutex_init (&c_name, &scm_i_plugin_mutex))
|
* __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): New macros.
(SCM_CRITICAL_SECTION_START/END): Defined here.
* eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around
the three calls to scm_m_expand_body.
* gc.h: #include "libguile/pthread-threads.h";
(SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros.
* gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type
scm_t_key;
* gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist
access.
* gc-freelist.c (scm_gc_init_freelist): Create freelist keys.
* gc-freelist.c, threads.c (really_launch): Use
SCM_FREELIST_CREATE.
* gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory):
* gc.c (scm_i_expensive_validation_check, scm_gc,
scm_gc_for_newcell): Put threads to sleep before doing GC-related
heap administration so that those pieces of code are executed
single-threaded. We might consider rewriting these code sections
in terms of a "call_gc_code_singly_threaded" construct instead of
calling the pair of scm_i_thread_put_to_sleep () and
scm_i_thread_wake_up (). Also, we would want to have as many of
these sections eleminated.
* init.c (scm_init_guile_1): Call scm_threads_prehistory.
* inline.h: #include "libguile/threads.h"
* pthread-threads.h: Macros now conform more closely to the
pthreads interface. Some of them now take a second argument.
* threads.c, threads.h: Many changes.
* configure.in: Temporarily replaced "copt" threads option with new
option "pthreads".
(USE_PTHREAD_THREADS): Define if pthreads configured.
2002-12-09 13:42:58 +00:00
|
|
|
|
|
* __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): New definitions.
Simply lock a thread C API recursive mutex.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): Removed.
* eval.c: Replaced SOURCE_SECTION_START / SOURCE_SECTION_END with
direct calls to scm_rec_mutex_lock / unlock around the three calls
to scm_m_expand_body.
* eval.c, eval.h (promise_free): New function.
(scm_force): Rewritten; Now thread-safe; Removed
SCM_DEFER/ALLOW_INTS.
* pthread-threads.h: Added partially implemented plugin interface
for recursive mutexes. These are, for now, only intended to be
used internally within the Guile implementation.
* pthread-threads.c: New file.
* threads.c: Conditionally #include "pthread-threads.c".
* eval.c, eval.h (scm_makprom, scm_force): Rewritten to be
thread-safe;
* snarf.h (SCM_MUTEX, SCM_GLOBAL_MUTEX, SCM_REC_MUTEX,
SCM_GLOBAL_REC_MUTEX): New macros.
* eval.c, threads.c, threads.h, snarf.h: Rewrote critical section
macros---use mutexes instead.
* tags.h (SCM_IM_FUTURE): New tag.
* eval.c (scm_m_future): New primitive macro.
(SCM_CEVAL): Support futures.
(unmemocopy): Support unmemoization of futures.
* print.c (scm_isymnames): Name of future isym.
2002-12-15 14:24:34 +00:00
|
|
|
|
#define SCM_REC_MUTEX(c_name) \
|
|
|
|
|
|
SCM_SNARF_HERE(static scm_t_rec_mutex c_name) \
|
|
|
|
|
|
SCM_SNARF_INIT(scm_i_plugin_rec_mutex_init (&c_name, &scm_i_plugin_rec_mutex))
|
* __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): New macros.
(SCM_CRITICAL_SECTION_START/END): Defined here.
* eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around
the three calls to scm_m_expand_body.
* gc.h: #include "libguile/pthread-threads.h";
(SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros.
* gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type
scm_t_key;
* gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist
access.
* gc-freelist.c (scm_gc_init_freelist): Create freelist keys.
* gc-freelist.c, threads.c (really_launch): Use
SCM_FREELIST_CREATE.
* gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory):
* gc.c (scm_i_expensive_validation_check, scm_gc,
scm_gc_for_newcell): Put threads to sleep before doing GC-related
heap administration so that those pieces of code are executed
single-threaded. We might consider rewriting these code sections
in terms of a "call_gc_code_singly_threaded" construct instead of
calling the pair of scm_i_thread_put_to_sleep () and
scm_i_thread_wake_up (). Also, we would want to have as many of
these sections eleminated.
* init.c (scm_init_guile_1): Call scm_threads_prehistory.
* inline.h: #include "libguile/threads.h"
* pthread-threads.h: Macros now conform more closely to the
pthreads interface. Some of them now take a second argument.
* threads.c, threads.h: Many changes.
* configure.in: Temporarily replaced "copt" threads option with new
option "pthreads".
(USE_PTHREAD_THREADS): Define if pthreads configured.
2002-12-09 13:42:58 +00:00
|
|
|
|
|
* __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): New definitions.
Simply lock a thread C API recursive mutex.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): Removed.
* eval.c: Replaced SOURCE_SECTION_START / SOURCE_SECTION_END with
direct calls to scm_rec_mutex_lock / unlock around the three calls
to scm_m_expand_body.
* eval.c, eval.h (promise_free): New function.
(scm_force): Rewritten; Now thread-safe; Removed
SCM_DEFER/ALLOW_INTS.
* pthread-threads.h: Added partially implemented plugin interface
for recursive mutexes. These are, for now, only intended to be
used internally within the Guile implementation.
* pthread-threads.c: New file.
* threads.c: Conditionally #include "pthread-threads.c".
* eval.c, eval.h (scm_makprom, scm_force): Rewritten to be
thread-safe;
* snarf.h (SCM_MUTEX, SCM_GLOBAL_MUTEX, SCM_REC_MUTEX,
SCM_GLOBAL_REC_MUTEX): New macros.
* eval.c, threads.c, threads.h, snarf.h: Rewrote critical section
macros---use mutexes instead.
* tags.h (SCM_IM_FUTURE): New tag.
* eval.c (scm_m_future): New primitive macro.
(SCM_CEVAL): Support futures.
(unmemocopy): Support unmemoization of futures.
* print.c (scm_isymnames): Name of future isym.
2002-12-15 14:24:34 +00:00
|
|
|
|
#define SCM_GLOBAL_REC_MUTEX(c_name) \
|
|
|
|
|
|
SCM_SNARF_HERE(scm_t_rec_mutex c_name) \
|
2002-12-16 15:24:13 +00:00
|
|
|
|
SCM_SNARF_INIT(scm_i_plugin_rec_mutex_init (&c_name, &scm_i_plugin_rec_mutex))
|
* __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): New macros.
(SCM_CRITICAL_SECTION_START/END): Defined here.
* eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around
the three calls to scm_m_expand_body.
* gc.h: #include "libguile/pthread-threads.h";
(SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros.
* gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type
scm_t_key;
* gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist
access.
* gc-freelist.c (scm_gc_init_freelist): Create freelist keys.
* gc-freelist.c, threads.c (really_launch): Use
SCM_FREELIST_CREATE.
* gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory):
* gc.c (scm_i_expensive_validation_check, scm_gc,
scm_gc_for_newcell): Put threads to sleep before doing GC-related
heap administration so that those pieces of code are executed
single-threaded. We might consider rewriting these code sections
in terms of a "call_gc_code_singly_threaded" construct instead of
calling the pair of scm_i_thread_put_to_sleep () and
scm_i_thread_wake_up (). Also, we would want to have as many of
these sections eleminated.
* init.c (scm_init_guile_1): Call scm_threads_prehistory.
* inline.h: #include "libguile/threads.h"
* pthread-threads.h: Macros now conform more closely to the
pthreads interface. Some of them now take a second argument.
* threads.c, threads.h: Many changes.
* configure.in: Temporarily replaced "copt" threads option with new
option "pthreads".
(USE_PTHREAD_THREADS): Define if pthreads configured.
2002-12-09 13:42:58 +00:00
|
|
|
|
|
2001-05-31 13:15:54 +00:00
|
|
|
|
#ifdef SCM_MAGIC_SNARF_DOCS
|
2000-01-07 23:05:04 +00:00
|
|
|
|
#undef SCM_ASSERT
|
2001-06-25 03:30:02 +00:00
|
|
|
|
#define SCM_ASSERT(_cond, _arg, _pos, _subr) ^^ argpos _arg _pos __LINE__ ^^
|
2001-05-31 13:15:54 +00:00
|
|
|
|
#endif /* SCM_MAGIC_SNARF_DOCS */
|
1998-09-29 19:57:22 +00:00
|
|
|
|
|
2001-08-31 11:17:06 +00:00
|
|
|
|
#endif /* SCM_SNARF_H */
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|