* Simple Ada-95 Question (regarding X11Ada bindings)
@ 1997-01-20 0:00 Ralf Lundberg
1997-01-27 0:00 ` Keith Allan Shillington
0 siblings, 1 reply; 3+ messages in thread
From: Ralf Lundberg @ 1997-01-20 0:00 UTC (permalink / raw)
I did some Ada programming som ten years ago, but I have been off
for quite some time. I have not used Ada95 until now.
However I now have to port an application from Telesoft Ada with
Telewindows X-bindings to gnat (GNU) with X11Ada Ada95 X-bindings.
In the library I will use the ada procedures matches the original
C-versions very closely.
Some arrays are passed as a pointer to the element type, plus a
number telling the length of the array, in the traditional C way.
---------
QUESTION:
How do I make something of type access A actually point to the
first element in an array of A's?
---------
I have found out that if I take 'Address on a variable of type
A that is declared as aliased I get something of the right type.
I would like to do that with the first element in the array,
bu I can't make that aliased..
Anwer by mail preferred, but I will poll this newsgroup as well..
----------------------------------------------
This is one procedure I would like to call...
procedure XFillPolygon(
display: access XDisplay;
d : X.Drawable;
gc : access XGC;
points : access XPoint; -- ..and this is the evil one..
npoints: X.signed_int;
shape : X.signed_int;
mode : X.signed_int); -- Xlib.h:2595
type XPoint is -- Xlib.h:398
record
XX: X.signed_short; -- Xlib.h:397
y : X.signed_short; -- Xlib.h:397
end record;
--
___________________________________________________________________
Ralf Lundberg http://www.cd.chalmers.se/~ralf/index.html
<ralf@carmenta.se> (email home: <ralf@cs.chalmers.se>)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Simple Ada-95 Question (regarding X11Ada bindings)
@ 1997-01-27 0:00 G. Vincent Castellano
0 siblings, 0 replies; 3+ messages in thread
From: G. Vincent Castellano @ 1997-01-27 0:00 UTC (permalink / raw)
% QUESTION:
% How do I make something of type access A actually point to the
% first element in an array of A's?
% ---------
%
% I have found out that if I take 'Address on a variable of type
^^^^^^^^
Do you mean 'Access here?
% A that is declared as aliased I get something of the right type.
% I would like to do that with the first element in the array,
% bu I can't make that aliased..
%
You need to declare an 'array of aliased' objects, as illustrated
by the following declarations and call to a procedure with a
simlar interface:
type Vector_Of_Point_Type is array (X11.Signed_Int range <>)
of aliased X.Xlib.XPoint;
Points: Vector_Of_Point_Type := ((C.X1, C.Y1),
(C.X2, C.Y1),
(C.X2, C.Y2),
(C.X1, C.Y2),
(C.X1, C.Y1));
begin
X11.XLib.XDrawLines(
Display,
X11.Drawable(C.Gw.Window),
C.Gw.Gc_Always,
Points(Points'First)'Access,
Points'Length,
X11.Coordmodeorigin);
== G. Vincent Castellano :: X/Ada WWW => http://www.ocsystems.com/xada ==
== "If virtual memory did not exist, it would have ==
== become necessary for us to invent it." ==
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Simple Ada-95 Question (regarding X11Ada bindings)
1997-01-20 0:00 Ralf Lundberg
@ 1997-01-27 0:00 ` Keith Allan Shillington
0 siblings, 0 replies; 3+ messages in thread
From: Keith Allan Shillington @ 1997-01-27 0:00 UTC (permalink / raw)
Ralf Lundberg <rl@carmenta.se> wrote in article
<32E34E8E.FDD@carmenta.se>...
> QUESTION:
> How do I make something of type access A actually point to the
> first element in an array of A's?
type A is ....
type A_Array is array(1..10) of aliased A;
type Access_A is access all A;
My_Array : A_Array;
First_One : Access_A := My_Array(1)'Access;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-01-27 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-27 0:00 Simple Ada-95 Question (regarding X11Ada bindings) G. Vincent Castellano
-- strict thread matches above, loose matches on Subject: below --
1997-01-20 0:00 Ralf Lundberg
1997-01-27 0:00 ` Keith Allan Shillington
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox