ACL FFI question 
Author Message
 ACL FFI question

Question about Allegro FFI:

Suppose I have C-function that returns ENUM, something
like

typedef enum
{
        CONNECTION_OK,
        CONNECTION_BAD,
.............

Quote:
};

Is it possible somehow arrange that in Allegro FFI, like
ENUM in CMUCL's ALIEN for example ?

Do you now ?

--
Vladimir Zolotykh



Thu, 28 Oct 2004 22:18:30 GMT  
 ACL FFI question

Quote:

> Question about Allegro FFI:

> Suppose I have C-function that returns ENUM, something
> like

> typedef enum
> {
>    CONNECTION_OK,
>    CONNECTION_BAD,
> .............
> };

> Is it possible somehow arrange that in Allegro FFI, like
> ENUM in CMUCL's ALIEN for example ?

> Do you now ?

Not that I know.

In theory it is not too difficult to provide a macro that does
somenting like DEFINE-ENUM.  But you are taking advntage of the fact
that your C compiler may accept things like

        typedef enum {uno = 1, dos, tres} caballeros;
        int x = 1;

        void foo(caballeros z) { ... }

        ...

        foo(x);

In any case, it would be a nice thing to have in the ACL FFI.

Cheers

--
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.



Fri, 29 Oct 2004 06:55:16 GMT  
 ACL FFI question

Quote:

> Is it possible somehow arrange that in Allegro FFI, like
> ENUM in CMUCL's ALIEN for example ?

UFFI (http://uffi.med-info.com) has a DEF-ENUM macro that supports ACL.

--
Kevin Rosenberg



Fri, 29 Oct 2004 07:35:04 GMT  
 ACL FFI question
I've took a glance to it. The DEF-ENUM interns some
symbols and defines constants also it issues:

  (ff:def-foreign-type my-enum-type :int)

This my-enum-type should be passed to uffi:def-function as
RETURNING argument which in turn gives

  (ff:def-foreign-call foo
    ......
    :returning my-enum-type
     .....
    )

Here is the point I still don't understand. After calling FOO
I should COND result to see match with defined by DEF-ENUM
constants, while CMUCL ALIEN allows me just write

  (case (foo ...)
    (:one ..)
    (:two ..)
    )

Still additional (though very small) layer remains. There is a
chance that I just don't understand what UFFI can and can't do. If
so please correct me.

Quote:


> > Is it possible somehow arrange that in Allegro FFI, like
> > ENUM in CMUCL's ALIEN for example ?

> UFFI (http://uffi.med-info.com) has a DEF-ENUM macro that supports ACL.

--
Vladimir Zolotykh


Fri, 29 Oct 2004 21:22:57 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. FFI question in ACL/W 2.0

2. ACL FFI and C enums.

3. ffi in acl problems

4. ACL Unix vs. ACL Linux

5. Fun-O Win32 FFI Question

6. c-ffi question involving c-struct

7. C FFI question

8. FFI question #2: Getting the address of a C function

9. FFI question: Setting array elements

10. FFI questions

11. C-FFI: GC questions, wchar_t, Melange redesign

12. C-FFI: GC questions, wchar_t, Melange redesign

 

 
Powered by phpBB® Forum Software