comp.lang.ada
 help / color / mirror / Atom feed
From: sbelmont700@gmail.com
Subject: Re: Question[s] about aliased extended return.
Date: Fri, 9 Nov 2012 12:53:13 -0800 (PST)
Date: 2012-11-09T12:53:13-08:00	[thread overview]
Message-ID: <77906f56-8ea0-4d87-8ace-4db1172958cd@googlegroups.com> (raw)
In-Reply-To: <bc5c504b-6261-4a18-a7b6-36bb95fabd7f@googlegroups.com>

On Friday, November 9, 2012 2:42:37 PM UTC-5, Shark8 wrote:
> 
> Ah that's kinda the point, this is WRT the implementation part [of my OpenGL binding] and therefore the interface between the thin/raw-imports and the more useful/friendly Ada world. (By Vector I mean something like "Array (Positive Range <>) of Float" [or whatever], not the Containers's Vector.)
> 


Perhaps something like this:

Function GetTexGen (coord : Texture_Coordinate_Type; 
                    pname : Texture_Coordinate_Generation) 
                    Return Double_Vector_Type is

  procedure Thin (coord  : in Texture_Coordinate_Type; 
                  pname  : in Texture_Coordinate_Generation) 
                  params : aliased in out Double_Vector_Type) is
  begin
    glGetTexGendv(coord  => coord, 
                  pname  => pname, 
                  params => params'Unchecked_Access);
  end Thin;
                  
begin 
  return Result : Double_Vector_Type(1..Get_Elements( pname )) do 
   C_Kludge(coord  => coord, 
            pname  => pname, 
            params => Result);
   End Return; 
end GetTexGen;

In either case, I'm always of the opinion that the 'thin' binding should match the API and just change types (pointers to arrays, etc), and the 'thick' binding should change the structure (procedures to functions, return codes to exceptions, etc).

-ab



  reply	other threads:[~2012-11-09 20:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-02 15:55 Question[s] about aliased extended return Shark8
2012-11-09  0:43 ` Randy Brukardt
2012-11-09  3:40   ` Yannick Duchêne (Hibou57)
2012-11-10  7:34     ` Randy Brukardt
2012-11-09 19:42   ` Shark8
2012-11-09 20:53     ` sbelmont700 [this message]
2012-11-09 21:44       ` Yannick Duchêne (Hibou57)
2012-11-09 22:04         ` sbelmont700
2012-11-09 22:56           ` Shark8
2012-11-09 22:54         ` Shark8
2012-11-10  7:27           ` Randy Brukardt
2012-11-10 16:08             ` Shark8
2012-11-10  1:08     ` Jeffrey Carter
2012-11-10  1:52       ` Shark8
2012-11-10  2:17         ` Yannick Duchêne (Hibou57)
2012-11-10 10:59         ` Bill Findlay
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox