[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: goops C interface

From: Dale P. Smith
Subject: Re: goops C interface
Date: Thu, 19 Oct 2000 08:52:06 -0400

Eric Moore wrote:
> The most important thing we mostly have, a way for a C program using
> guile to wrap up it's internal data structures in goops objects.  The
> most notable lack I see from preusing it at this point is that adding
> slots with non-trivial getters and setters using SCM_VIRTUAL_SLOT or
> te like are kinda nasty.

I have started looking at fdi.[cx] and goops-snarf.h.

First, a question: How do you wrap a C struct containing char *'s? 
Would this work?

#define SCM_SLOT_CHARP(C_CLASS, C_TYPE, C_SLOT, SCM_SLOT, A)            \
SCM_I_SLOT (C_CLASS, C_TYPE, C_SLOT, SCM_SLOT, scm_class_string,        \
            gh_string_p(x),                                             \
            gh_str02scm(o->C_SLOT),                                     \
            o->C_SLOT = gh_scm2str(x),                                  \

What would be really cool, it to have a program (written in guile scheme
of course!) that takes a description of you C structures, and writes out
the C goops interface glue.  This description would just be a scheme
program that generates the C file. This is sort of what the macros in
goops-snarf.h are doing, but you are limited to the power of cpp.

It would be cool to have a program that parsed your headers and spit out
a file that would be a starting point.  You might not want access to
some members, or you need some members to be read-only.  Maybe a way to
add snippets of code to access certain members in certain ways.

There already are tools out there, g-wrap and swig come to mind, that
might be a good starting point for this tool.

What do you think?

Dale P. Smith
Altus Technologies Corp.
400-746-9000 x309

reply via email to

[Prev in Thread] Current Thread [Next in Thread]