From: Ingo Rohlfs
Subject: [CMUCL] Aliend Converting of C header to Lisp
Date:
Message-ID: <m3663eiz2j.fsf@linux.local>
I had to convert this structur to an CMUCL Alien Function .. but had no
idea how to do this (cause of the little complicated types).
Can anybody give me a hint ?
typedef struct T_SYS {
int (*type) (struct T_SYS *context, int tred );
union {
struct {
int account;
FILE *filep;
} sysio;
struct {
int mem
} system;
}
} T_SYS;
Ingo
From: Tim Moore
Subject: Re: [CMUCL] Aliend Converting of C header to Lisp
Date:
Message-ID: <a83lfm$79u$0@216.39.145.192>
On 30 Mar 2002 03:12:04 +0100, Ingo Rohlfs <·······@ex-astris.org> wrote:
>I had to convert this structur to an CMUCL Alien Function .. but had no
>idea how to do this (cause of the little complicated types).
>Can anybody give me a hint ?
>
>typedef struct T_SYS {
> int (*type) (struct T_SYS *context, int tred );
> union {
> struct {
> int account;
> FILE *filep;
> } sysio;
> struct {
> int mem
> } system;
> }
>} T_SYS;
>
>
>
>Ingo
Assuming that you don't actually want a union that defines no member:
(ALIEN:DEF-ALIEN-TYPE T-SYS
(ALIEN:STRUCT T-SYS
(TYPE
(*
(FUNCTION C-CALL:INT (* (ALIEN:STRUCT T-SYS))
C-CALL:INT)))
(FOO
(UNION NIL
(SYSIO
(ALIEN:STRUCT NIL (ACCOUNT C-CALL:INT)
(FILEP (* (* T)))))
(SYSTEM
(ALIEN:STRUCT NIL (MEM C-CALL:INT)))))))
Tim