From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5b7ee26df9f9c357 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.78.MISMATCH!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!.POSTED!not-for-mail From: BrianG Newsgroups: comp.lang.ada Subject: Re: OpenGL in Ada Date: Sat, 10 Jul 2010 00:00:49 -0400 Organization: A noiseless patient Spider Message-ID: References: <68dd0333-f502-4351-9e50-4ec83bddc44e@k39g2000yqd.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 10 Jul 2010 03:57:42 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="vvBPJT09arwmd97Fw4UIhw"; logging-data="20750"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Vt9rJTShqeU2p9wFw0jsG" User-Agent: Thunderbird 2.0.0.24 (X11/20100317) In-Reply-To: Cancel-Lock: sha1:aAKe/awloJezCkTxT/RVgkWXDG4= Xref: g2news1.google.com comp.lang.ada:12304 Date: 2010-07-10T00:00:49-04:00 List-Id: Shark8 wrote: > On Jul 9, 9:11 am, Gene wrote: >> On Jul 7, 10:42 pm, Shark8 wrote: >>> Hello everyone, >>> I posted about wanting to write an OS in Ada a while ago and, as part >>> of that effort I've taken to translating the OpenGL API. No, I don't >>> mean JUST running the headers through ato-Ada converter but actually >>> translating the API into a more Ada-natural form. >>> As an example, here is the glColor-'family' of functions: ... >>> which was rewritten as: >>> -- Color Formats >>> Procedure Color ( red, green, blue : in Byte ); >>> Procedure Color ( v : RGB_Byte_Vector ); >>> Procedure Color ( red, green, blue : in double ); >>> Procedure Color ( v : RGB_Double_Vector ); >>> Procedure Color ( red, green, blue : in float ); >>> Procedure Color ( V : RGB_Float_Vector ); >>> Procedure Color ( red, green, blue : int ); One problem you'll have is if a user wants to make a call with all literals, i.e. Color(1, 2, 3) or Color(1.0, 2.0, 3.0), the compiler won't know which version to use. The best solution I've found (besides making users specify a type) is to have a second name which is defined for int and float only (or whatever the default is), but I've come up with no good format for the second name: Color_Literal, Color_L, Color1, ...? (I've tried starting a similar effort, but never got very far. I was using the OpenGL "red book" as a basis; I find it interesting that the OpenGL definition recognizes that "some languages like Ada and C++" could implement names this way, but every Ada library I've seen follows the C naming scheme.)