[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] define-foreign-enum with a typedef
From: |
Hans Bulfone |
Subject: |
Re: [Chicken-users] define-foreign-enum with a typedef |
Date: |
Thu, 13 Dec 2007 22:03:56 +0100 |
User-agent: |
Mutt/1.5.16 (2007-06-09) |
hi,
On Wed, Dec 12, 2007 at 11:48:48PM -0700, Shawn Rutledge wrote:
> > > (define-foreign-enum (dbus:bus (enum "DBusBusType"))
> > > (dbus:session-bus DBUS_BUS_SESSION)
> > > (dbus:system-bus DBUS_BUS_SYSTEM)
> > > (dbus:starter-bus DBUS_BUS_STARTER) )
> >
> > i've been using
> >
> > (define-foreign-enum (dbus:bus int) ...)
> >
> > in cases like this. don't know if it's the best solution, but it works.
>
> That seems like it ought to work, but the enum constants don't end up
> being defined.
yes, but the define-foreign-enum defines a foreign type named
dbus:bus that converts between the symbols and the enumeration values.
so you can just pass e.g. 'dbus:session-bus to a foreign procedure
that expects a dbus:bus argument, it doesn't need to have a value as
a variable. you can also pass '(dbus:session-bus dbus:system-bus)
and get the two values or-ed together.
afaik the dbus:bus foreign-type is only available in the same compilation
unit as the define-foreign-enum, so you need to have the foreign-lambdas
that use dbus:bus in the same file (but you can use the foreign functions
from any file)
hth&bye,
hans.
- Re: [Chicken-users] define-foreign-enum with a typedef, (continued)
- Re: [Chicken-users] define-foreign-enum with a typedef, Shawn Rutledge, 2007/12/13
- Re: [Chicken-users] define-foreign-enum with a typedef, felix winkelmann, 2007/12/13
- Re: [Chicken-users] define-foreign-enum with a typedef, Shawn Rutledge, 2007/12/13
- Re: [Chicken-users] define-foreign-enum with a typedef, felix winkelmann, 2007/12/13
- Re: [Chicken-users] define-foreign-enum with a typedef, felix winkelmann, 2007/12/13
- Re: [Chicken-users] define-foreign-enum with a typedef, Shawn Rutledge, 2007/12/13
- Re: [Chicken-users] define-foreign-enum with a typedef, Shawn Rutledge, 2007/12/13
- Re: [Chicken-users] define-foreign-enum with a typedef, felix winkelmann, 2007/12/17
- Re: [Chicken-users] define-foreign-enum with a typedef, Zbigniew, 2007/12/13
- Re: [Chicken-users] define-foreign-enum with a typedef, Shawn Rutledge, 2007/12/13
- Re: [Chicken-users] define-foreign-enum with a typedef,
Hans Bulfone <=
- Re: [Chicken-users] define-foreign-enum with a typedef, Shawn Rutledge, 2007/12/13