comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: How to get the mouse position with JEWL?
Date: Wed, 20 Oct 2010 19:59:16 -0700
Date: 2010-10-20T19:59:16-07:00	[thread overview]
Message-ID: <i9oal3$7nr$1@tornado.tornevall.net> (raw)
In-Reply-To: <i9nroj$r03$1@speranza.aioe.org>

On 10/20/2010 03:51 PM, tmoran@acm.org wrote:
> This works for me for Windows
>      type Points is record
>        x,y : interfaces.c.int;
>      end record;

I'd add

pragma Convention (C, Points);

just to be safe.

>      type bool is new interfaces.c.int;
>      function GetCursorPos(point : access points) return bool;

(Point : in Points)

should work just as well, and has the advantages that

>      pragma import(stdcall,GetCursorPos, "GetCursorPos");
>      current : aliased points;

you don't need "aliased"

>      ...
>        if getcursorpos(current'access) = 0 then

and you don't need 'access.

This works because of ARM B.3: "An Ada parameter of a record type T, of any 
mode, other than an in parameter of a type of convention C_Pass_By_Copy, is 
passed as a t* argument to a C function, where t is the C struct corresponding 
to the Ada type T."

It is a little confusing because an "in" parameter is modified.

-- 
Jeff Carter
"You empty-headed animal-food-trough wiper."
Monty Python & the Holy Grail
04



  reply	other threads:[~2010-10-21  2:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-20  9:04 How to get the mouse position with JEWL? tolkamp
2010-10-20 11:42 ` Manuel Collado
2010-10-20 17:20   ` tolkamp
2010-10-20 22:22     ` Manuel Collado
2010-10-20 22:51       ` tmoran
2010-10-21  2:59         ` Jeffrey Carter [this message]
2010-10-21  4:08           ` tmoran
2010-10-21  7:31         ` Dmitry A. Kazakov
2010-10-21 19:10           ` tmoran
2010-10-21 19:38             ` Dmitry A. Kazakov
2010-10-22  0:39               ` tmoran
2010-10-22  7:35                 ` Dmitry A. Kazakov
2010-10-22 10:10                 ` Frank J. Lhota
2010-10-21 15:23         ` tolkamp
2010-10-21 16:47           ` Georg Bauhaus
2010-10-21 17:09             ` tolkamp
2010-10-21 17:24               ` Niklas Holsti
2010-10-21 20:34         ` tolkamp
2010-10-22 13:55       ` tolkamp
2010-10-22 22:15         ` Manuel Collado
2010-10-23 15:26           ` tolkamp
2010-10-21 21:50 ` Manuel Collado
2010-10-22 10:40   ` tolkamp
replies disabled

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