* sizeof in ADA
@ 2005-08-05 14:42 sisi.ard
2005-08-05 14:57 ` Lutz Donnerhacke
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: sisi.ard @ 2005-08-05 14:42 UTC (permalink / raw)
I would like to know how to write an equivolent of the C function
"sizeof "
in Win32ADA to use with the GDI function " getobject " like this :
Buffer_Size:=Getobject(Mon_Bitmap,
Sizeof(Bitmap), -- this line obviously don't works
Buffer);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: sizeof in ADA
2005-08-05 14:42 sizeof in ADA sisi.ard
@ 2005-08-05 14:57 ` Lutz Donnerhacke
2005-08-05 15:19 ` Marc A. Criley
2005-08-05 15:15 ` Georg Bauhaus
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Lutz Donnerhacke @ 2005-08-05 14:57 UTC (permalink / raw)
* sisi.ard@laposte.net wrote:
> I would like to know how to write an equivolent of the C function "sizeof
> " in Win32ADA to use with the GDI function " getobject " like this :
'Size_in_Storage_Elements
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: sizeof in ADA
2005-08-05 14:42 sizeof in ADA sisi.ard
2005-08-05 14:57 ` Lutz Donnerhacke
@ 2005-08-05 15:15 ` Georg Bauhaus
2005-08-05 15:46 ` cdm
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Georg Bauhaus @ 2005-08-05 15:15 UTC (permalink / raw)
sisi.ard@laposte.net wrote:
> I would like to know how to write an equivolent of the C function
> "sizeof "
> in Win32ADA to use with the GDI function " getobject " like this :
>
> Buffer_Size:=Getobject(Mon_Bitmap,
> Sizeof(Bitmap), -- this line obviously don't works
> Buffer);
What is the Ada type of Bitmap?
from GetObject:
hObject ...
nCount int Secifies the number of bytes to be copied
to the buffer
lpObject ...
What do you want to copy?
The bitmap related structures in the Window API provide
information to compute the size of the bitmap in bytes
IIRC.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: sizeof in ADA
2005-08-05 14:57 ` Lutz Donnerhacke
@ 2005-08-05 15:19 ` Marc A. Criley
2005-08-05 15:46 ` Lutz Donnerhacke
0 siblings, 1 reply; 8+ messages in thread
From: Marc A. Criley @ 2005-08-05 15:19 UTC (permalink / raw)
Lutz Donnerhacke wrote:
>
> 'Size_in_Storage_Elements
Did you mean 'Max_Size_In_Storage_Elements?
There's no Size_In_Storage_Elements attribute listed in either the RM or
amongst GNAT's implementation defined attributes.
-- Marc A. Criley
-- www.mckae.com
-- DTraq - XPath In Ada - XML EZ Out
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: sizeof in ADA
2005-08-05 14:42 sizeof in ADA sisi.ard
2005-08-05 14:57 ` Lutz Donnerhacke
2005-08-05 15:15 ` Georg Bauhaus
@ 2005-08-05 15:46 ` cdm
2005-08-05 16:00 ` Jeffrey Carter
2005-08-05 17:16 ` Martin Krischik
4 siblings, 0 replies; 8+ messages in thread
From: cdm @ 2005-08-05 15:46 UTC (permalink / raw)
Ada 83 says X'SIZE returns the number of bits allocated to hold the
object.
sisi.ard@laposte.net wrote:
> I would like to know how to write an equivolent of the C function
> "sizeof "
> in Win32ADA to use with the GDI function " getobject " like this :
>
> Buffer_Size:=Getobject(Mon_Bitmap,
> Sizeof(Bitmap), -- this line obviously don't works
> Buffer);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: sizeof in ADA
2005-08-05 15:19 ` Marc A. Criley
@ 2005-08-05 15:46 ` Lutz Donnerhacke
0 siblings, 0 replies; 8+ messages in thread
From: Lutz Donnerhacke @ 2005-08-05 15:46 UTC (permalink / raw)
* Marc A. Criley wrote:
> Lutz Donnerhacke wrote:
>> 'Size_in_Storage_Elements
>
> Did you mean 'Max_Size_In_Storage_Elements?
Yes.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: sizeof in ADA
2005-08-05 14:42 sizeof in ADA sisi.ard
` (2 preceding siblings ...)
2005-08-05 15:46 ` cdm
@ 2005-08-05 16:00 ` Jeffrey Carter
2005-08-05 17:16 ` Martin Krischik
4 siblings, 0 replies; 8+ messages in thread
From: Jeffrey Carter @ 2005-08-05 16:00 UTC (permalink / raw)
sisi.ard@laposte.net wrote:
> I would like to know how to write an equivolent of the C function
> "sizeof "
There is the 'Max_Size_In_Storage_Units attribute, which may be what you
want.
The 'Size attribute gives the size in bits of a subtype or object. For a
stand-alone object, 'Size is usually a multiple of System.Storage_Unit,
which is the number of bits in a storage unit (8 on a byte-oriented
processor).
Note that 'Size can differ between a subtype and an object. For many
platforms and compilers:
Boolean'Size = 1
Natural'Size = 31
B : Boolean;
N : Natural;
B'Size = 8;
N'Size = 32
So Object'Size / System.Storage_Unit will give you the correct value for
an object. It may be better to base your values on the object than on
the subtype.
Another way is to instantiate Ada.Storage_IO for the subtype. This then
gives you the constant Buffer_Size, which is what you want. This is
rather a heavyweight solution, however.
--
Jeffrey Carter
"Now go away or I shall taunt you a second time."
Monty Python and the Holy Grail
E-mail: jeffrey_r_carter-nr [commercial-at]
raytheon [period | full stop] com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: sizeof in ADA
2005-08-05 14:42 sizeof in ADA sisi.ard
` (3 preceding siblings ...)
2005-08-05 16:00 ` Jeffrey Carter
@ 2005-08-05 17:16 ` Martin Krischik
4 siblings, 0 replies; 8+ messages in thread
From: Martin Krischik @ 2005-08-05 17:16 UTC (permalink / raw)
sisi.ard@laposte.net wrote:
> I would like to know how to write an equivolent of the C function
> "sizeof "
> in Win32ADA to use with the GDI function " getobject " like this :
>
> Buffer_Size:=Getobject(Mon_Bitmap,
> Sizeof(Bitmap), -- this line obviously don't works
> Buffer);
See:
http://en.wikibooks.org/wiki/Programming:Ada:Attributes:'Size
Martin
--
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-08-05 17:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-05 14:42 sizeof in ADA sisi.ard
2005-08-05 14:57 ` Lutz Donnerhacke
2005-08-05 15:19 ` Marc A. Criley
2005-08-05 15:46 ` Lutz Donnerhacke
2005-08-05 15:15 ` Georg Bauhaus
2005-08-05 15:46 ` cdm
2005-08-05 16:00 ` Jeffrey Carter
2005-08-05 17:16 ` Martin Krischik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox