* Re: Inheriting from foreign objects
[not found] ` <m3lmbvwd32.fsf@laruns.ossau.uklinux.net>
@ 2002-04-23 20:43 ` Thien-Thi Nguyen
[not found] ` <E17078m-000118-00@giblet>
1 sibling, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2002-04-23 20:43 UTC (permalink / raw)
Cc: guile-devel, guile-user
From: Neil Jerram <neil@ossau.uklinux.net>
Date: 10 Apr 2002 20:47:13 +0100
Andreas> Is there a way I can cleanly derive from C-created classes?
I'd say you're in virgin territory here, and that any advice you can
give on such problems, and on defining a C API for GOOPS, would be
very useful.
it looks like foreign bit is set when superclass list is empty. perhaps
a good guideline would be to use at least `(list <object>)' for `supers'
for normal operation. btw, it doesn't look like user-supplied ctor/dtor
are suppressed based on foreign bit in any case.
[cc guile-user in order to ask survey question: which goops-related C
functions do people use now? the answer to this helps shape definition
of the C interface to goops -- thanks!]
thi
_______________________________
SCM
scm_make_class (SCM meta, char *s_name, SCM supers, size_t size,
void * (*constructor) (SCM initargs),
size_t (*destructor) (void *))
{
SCM name, class;
name = scm_str2symbol (s_name);
if (SCM_NULLP (supers))
supers = scm_list_1 (scm_class_foreign_object);
class = scm_basic_basic_make_class (meta, name, supers, SCM_EOL);
scm_sys_inherit_magic_x (class, supers);
if (destructor != 0)
{
SCM_SET_SLOT (class, scm_si_destructor, (SCM) destructor);
SCM_SET_CLASS_DESTRUCTOR (class, scm_free_foreign_object);
}
else if (size > 0)
{
SCM_SET_CLASS_DESTRUCTOR (class, scm_struct_free_light);
SCM_SET_CLASS_INSTANCE_SIZE (class, size);
}
SCM_SET_SLOT (class, scm_si_layout, scm_str2symbol (""));
SCM_SET_SLOT (class, scm_si_constructor, (SCM) constructor);
return class;
}
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inheriting from foreign objects
[not found] ` <E17078m-000118-00@giblet>
@ 2002-04-30 10:23 ` Andreas Rottmann
[not found] ` <874rht7aet.fsf@alice.rhinosaur.lan>
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Rottmann @ 2002-04-30 10:23 UTC (permalink / raw)
Thien-Thi Nguyen <ttn@giblet.glug.org> writes:
> From: Neil Jerram <neil@ossau.uklinux.net>
> Date: 10 Apr 2002 20:47:13 +0100
>
> Andreas> Is there a way I can cleanly derive from C-created classes?
>
> I'd say you're in virgin territory here, and that any advice you can
> give on such problems, and on defining a C API for GOOPS, would be
> very useful.
>
> it looks like foreign bit is set when superclass list is empty. perhaps
> a good guideline would be to use at least `(list <object>)' for `supers'
> for normal operation.
I can't test your statement, since I have switched to create a
'normal' class and have a special slot being a smob containing the
pointer to the C++ object.
> btw, it doesn't look like user-supplied ctor/dtor
> are suppressed based on foreign bit in any case.
>
When you inherit from a 'foreign' class, the constructor/destructor
fields of the new class are set NULL.
I suggest you write some 'test' code that uses the various
goops-related C functions, as that would both make them easier to
understand and they can be validated this way.
> [cc guile-user in order to ask survey question: which goops-related C
> functions do people use now? the answer to this helps shape definition
> of the C interface to goops -- thanks!]
>
I use, in my C++ <-> GOOPS bindings:
scm_load_goops()
scm_make()
scm_basic_make_class()
scm_sys_allocate_instance()
scm_sys_initialize_object()
scm_slot_set_x()
SCM_IS_A_P()
scm_add_method()
scm_generic_function_methods()
scm_method_procedure()
scm_method_specializers()
scm_slot_exists_p()
scm_slot_ref()
I may have overlooked some.
BTW: Has anybody of the developers looked at my GOOPS-related
bugreport yet? Since I have included a program documenting the bug it
shouldn't be too hard to investigate...
Regards, Andy
--
Andreas Rottmann | Dru@ICQ | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inheriting from foreign objects
[not found] ` <874rht7aet.fsf@alice.rhinosaur.lan>
@ 2002-05-15 12:30 ` Thien-Thi Nguyen
0 siblings, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2002-05-15 12:30 UTC (permalink / raw)
Cc: guile-devel, guile-user
From: Andreas Rottmann <a.rottmann@gmx.at>
Date: 30 Apr 2002 12:23:06 +0200
I suggest you write some 'test' code that uses the various
goops-related C functions, as that would both make them easier to
understand and they can be validated this way.
i've added "write goops test cases in C" under "Eventually" in the TODO.
> [cc guile-user in order to ask survey question: which goops-related C
> functions do people use now? the answer to this helps shape definition
> of the C interface to goops -- thanks!]
>
I use, in my C++ <-> GOOPS bindings: [...]
recorded in $workbook/policy/api.text -- thanks.
BTW: Has anybody of the developers looked at my GOOPS-related
bugreport yet? Since I have included a program documenting the bug it
shouldn't be too hard to investigate...
i believe this is bug `goops-1'.
thi
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-05-15 12:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <873cy47mxs.fsf@alice.rhinosaur.lan>
[not found] ` <m3lmbvwd32.fsf@laruns.ossau.uklinux.net>
2002-04-23 20:43 ` Inheriting from foreign objects Thien-Thi Nguyen
[not found] ` <E17078m-000118-00@giblet>
2002-04-30 10:23 ` Andreas Rottmann
[not found] ` <874rht7aet.fsf@alice.rhinosaur.lan>
2002-05-15 12:30 ` Thien-Thi Nguyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).