comp.lang.ada
 help / color / mirror / Atom feed
From: chris <spamoff.danx@ntlworld.com>
Subject: generic imports?  void* -> generics?
Date: Fri, 19 Sep 2003 20:20:18 +0100
Date: 2003-09-19T20:20:18+01:00	[thread overview]
Message-ID: <FBIab.3309$DM5.35123@newsfep4-glfd.server.ntli.net> (raw)

Hi,

Should the following C code be mapped to a generic?

void *lua_touserdata (Lua_State* L, int pos)



I was thinking of something like

generic
    type Userdata is private;
function to_userdata (L   : in Lua_State_Access;
                       Pos : in Index) return Userdata;

but am unsure how to complete it...  I tried

    function To_Userdata (L   : in Lua_State_Access;
                          Pos : in Index) return Userdata is
       function Lua_ToUserData (L   : in Lua_State_Access;
                                Pos : in Index) return Userdata;
       pragma Import (C, Lua_ToUserData);
    begin
       return Lua_Touserdata (L, Pos);
    end To_Userdata;

and it compiles ok, but is it right?  It looks odd to me.  Will the 
function Lua_ToUserData be imported upon instantiation of the 
To_Userdata function?



Cheers,
Chris




             reply	other threads:[~2003-09-19 19:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-19 19:20 chris [this message]
2003-09-19 20:46 ` generic imports? void* -> generics? 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
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