This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
new snarf macro: SCM_VAR
- To: guile at sourceware dot cygnus dot com
- Subject: new snarf macro: SCM_VAR
- From: Keisuke Nishida <kxn30 at po dot cwru dot edu>
- Date: 04 May 2000 03:27:01 -0400
Hello,
I'm defining some classes in C by using GOOPS. One is a superclass and
others are subclasses. So I suppose I have to define them like this:
SCM_CLASS (foo, "<foo>", SCM_EOL, 0, 0, 0);
static SCM supers;
SCM_INIT (supers = scm_cons (foo, SCM_EOL));
SCM_CLASS (bar, "<bar>", supers, 0, 0, 0);
I'd rather like to write them like this:
SCM_CLASS (foo, "<foo>", SCM_EOL, 0, 0, 0);
SCM_VAR (supers, scm_cons (foo, SCM_EOL));
SCM_CLASS (bar, "<bar>", supers, 0, 0, 0);
Defining SCM_VAR is pretty easy and generally useful, I think.
So, how about defining the following macros in Guile's snarf.h?
#define SCM_VAR(NAME, CODE) \
SCM_HERE (static SCM NAME) \
SCM_INIT (NAME = CODE)
#define SCM_GLOBAL_VAR(NAME, CODE) \
SCM_HERE (SCM NAME) \
SCM_INIT (NAME = CODE)
Some macros such as SCM_SYMBOL can be simply defined like this:
#define SCM_SYMBOL(c_name, scheme_name) \
SCM_VAR(c_name, scm_permanent_object (SCM_CAR (scm_intern0 (scheme_name))))
Thanks,
Keisuke Nishida