[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Guile C preprocessor
From: |
Keisuke Nishida |
Subject: |
Guile C preprocessor |
Date: |
08 Dec 2000 22:10:27 -0500 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.92 |
Hello,
Is it a good idea to write a C preprocessor for Guile that can be used
in place of guile-snarf like this?
----------------------------------------
@(define-module (hogehoge))
@(define-static foo 1)
@(define (bar (string s) (inum n))
"This is bar."
{
int i = SCM_INUM (n);
return SCM_STRING_CHARS (s)[i];
})
----------------------------------------
is expanded into
----------------------------------------
SCM scm_module_hogehoge;
static SCM foo;
SCM
scm_bar (SCM s, SCM n)
#define scm_s_bar "bar"
#define FUNC_NAME scm_s_bar
{
SCM_VALIDATE_STRING (1, s);
SCM_VALIDATE_INUM (2, n);
{
int i = SCM_INUM (n);
return SCM_STRING_CHARS (s)[i];
}
}
#undef FUNC_NAME
void
scm_init_hogehoge ()
{
SCM __old_module;
scm_module_hogehoge = scm_make_module (scm_read_0str ("(hogehoge)"));
__old_module = scm_select_module (scm_module_hogehoge);
foo = SCM_INUM (1);
scm_make_gsubr (scm_s_bar, 2, 0, 0, (SCM (*)()) scm_bar);
scm_select_module (__old_module);
}
void
scm_init_hogehoge_module ()
{
scm_register_module_xxx ("hogehoge", (void *) scm_init_hogehoge);
}
----------------------------------------
-- Kei
- Guile C preprocessor,
Keisuke Nishida <=