From: Jeffrey Carter <spam@spam.com>
Subject: Re: generic imports? void* -> generics?
Date: Sat, 20 Sep 2003 01:59:56 GMT
Date: 2003-09-20T01:59:56+00:00 [thread overview]
Message-ID: <wwOab.10461$BS5.10210@newsread4.news.pas.earthlink.net> (raw)
In-Reply-To: <uwuc4mmeo.fsf@earthlink.net>
Matthew Heaney wrote:
> function To_Userdata
> (L : lua_state_access;
> Pos : Index) return Userdata is
>
> type Userdata_Access is access all Userdata;
> for Userdata_Access'Storage_Size use 0;
> pragma Convention (C, Userdata_Access);
>
> function lua_touserdata
> (L : Lua_State_Access;
> Pos : C.int) return Userdata_Access; --ok now
>
> pragma Import (C, lua_touserdata);
You probably need to specify the C name:
pragma Import (C, lua_touserdata, "lua_touserdata");
> pragma Convention (C, lua_touserdata);
This is unnecessary. Import defines the convention.
>
> Result : constant Userdata_Access :=
> lua_touserdata(L, Pos);
> begin
> return Result.all;
> end;
Or just
return Lua_Touserdata (L, Pos).all;
This is probably the best way to implement it; I was going to suggest
something along these lines until I saw this. Of course, this would be a
generic, with type Userdata the generic formal.
--
Jeff Carter
"You've got the brain of a four-year-old boy,
and I bet he was glad to get rid of it."
Horse Feathers
47
next prev parent reply other threads:[~2003-09-20 1:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-19 19:20 generic imports? void* -> generics? chris
2003-09-19 20:46 ` chris
2003-09-19 21:18 ` Nick Roberts
2003-09-19 23:12 ` chris
2003-09-20 16:52 ` Simon Wright
2003-09-22 21:30 ` Randy Brukardt
2003-09-23 5:45 ` Simon Wright
2003-09-23 19:07 ` Randy Brukardt
2003-09-23 20:28 ` Simon Wright
2003-09-24 18:16 ` Randy Brukardt
2003-09-19 22:40 ` Matthew Heaney
2003-09-19 23:01 ` chris
2003-09-20 1:59 ` Jeffrey Carter [this message]
2003-09-20 13:52 ` Matthew Heaney
2003-09-23 22:39 ` chris
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox