comp.lang.ada
 help / color / mirror / Atom feed
* Ada.Streams.Stream_IO.Stream_Access
@ 2004-11-16  4:16 Alex
  2004-11-16  8:06 ` Ada.Streams.Stream_IO.Stream_Access Marius Amado Alves
  2004-11-16  8:28 ` Ada.Streams.Stream_IO.Stream_Access Martin Krischik
  0 siblings, 2 replies; 6+ messages in thread
From: Alex @ 2004-11-16  4:16 UTC (permalink / raw)


Hi,

I am having a problem with ADA Streams.

I need to access a file which is >2Gb and read data from it in chunks.

Firstly I was having problems getting the file size as
Ada.Streams.Stream_IO.Size didn't seem to want to go over Integer'last
(2*31)
Worked fine for files up until the 2Gb range and then it went funny!

I had to call a 'c' routine (returned an Integer64...i.e. 2*63) to get
the file size and decide how many chunks I wanted.

Ok, now I try to read from the huge file....and bang I am getting a
Constraint error. Is this a case that I just can't use ADA Streams on
files bigger then 2*31 bytes??

This is driving me nuts and I don't want to call 'c' routines again
and spoil my ADA :)

Cheers

Alex



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada.Streams.Stream_IO.Stream_Access
  2004-11-16  4:16 Ada.Streams.Stream_IO.Stream_Access Alex
@ 2004-11-16  8:06 ` Marius Amado Alves
  2004-11-16  8:28 ` Ada.Streams.Stream_IO.Stream_Access Martin Krischik
  1 sibling, 0 replies; 6+ messages in thread
From: Marius Amado Alves @ 2004-11-16  8:06 UTC (permalink / raw)
  To: comp.lang.ada

> Firstly I was having problems getting the file size as
> Ada.Streams.Stream_IO.Size didn't seem to want to go over Integer'last
> (2*31)

GNAT ties Count to Stream_Element_Offset which is a 32-bit integer on my 
Pentium 3 installation. So I have this problem too, and probably you 
have a similar installation. Maybe there is a GNAT version for 64-bit.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada.Streams.Stream_IO.Stream_Access
  2004-11-16  4:16 Ada.Streams.Stream_IO.Stream_Access Alex
  2004-11-16  8:06 ` Ada.Streams.Stream_IO.Stream_Access Marius Amado Alves
@ 2004-11-16  8:28 ` Martin Krischik
  2004-11-16 18:19   ` Ada.Streams.Stream_IO.Stream_Access Alex
  1 sibling, 1 reply; 6+ messages in thread
From: Martin Krischik @ 2004-11-16  8:28 UTC (permalink / raw)


Alex wrote:

> Hi,
> 
> I am having a problem with ADA Streams.
> 
> I need to access a file which is >2Gb and read data from it in chunks.
> 
> Firstly I was having problems getting the file size as
> Ada.Streams.Stream_IO.Size didn't seem to want to go over Integer'last
> (2*31)
> Worked fine for files up until the 2Gb range and then it went funny!
> 
> I had to call a 'c' routine (returned an Integer64...i.e. 2*63) to get
> the file size and decide how many chunks I wanted.
> 
> Ok, now I try to read from the huge file....and bang I am getting a
> Constraint error. Is this a case that I just can't use ADA Streams on
> files bigger then 2*31 bytes??
> 
> This is driving me nuts and I don't want to call 'c' routines again
> and spoil my ADA :)

I take it that you are not a AdaCore customer - otherwise you would not ask
here. However there is a communication channel for non customer as well:
"GNAT Discussion List" <gnatlist@lyris.seas.gwu.edu>. You might want to
raise the point there.

With Regards

Martin


-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada.Streams.Stream_IO.Stream_Access
  2004-11-16  8:28 ` Ada.Streams.Stream_IO.Stream_Access Martin Krischik
@ 2004-11-16 18:19   ` Alex
  2004-11-16 18:52     ` Ada.Streams.Stream_IO.Stream_Access tmoran
  0 siblings, 1 reply; 6+ messages in thread
From: Alex @ 2004-11-16 18:19 UTC (permalink / raw)


Martin Krischik <martin@krischik.com> wrote in message news:<8880854.x4B7rzzIl0@linux1.krischik.com>...
> Alex wrote:
> 
> > Hi,
> > 
> > I am having a problem with ADA Streams.
> > 
> > I need to access a file which is >2Gb and read data from it in chunks.
> > 
> > Firstly I was having problems getting the file size as
> > Ada.Streams.Stream_IO.Size didn't seem to want to go over Integer'last
> > (2*31)
> > Worked fine for files up until the 2Gb range and then it went funny!
> > 
> > I had to call a 'c' routine (returned an Integer64...i.e. 2*63) to get
> > the file size and decide how many chunks I wanted.
> > 
> > Ok, now I try to read from the huge file....and bang I am getting a
> > Constraint error. Is this a case that I just can't use ADA Streams on
> > files bigger then 2*31 bytes??
> > 
> > This is driving me nuts and I don't want to call 'c' routines again
> > and spoil my ADA :)
> 
> I take it that you are not a AdaCore customer - otherwise you would not ask
> here. However there is a communication channel for non customer as well:
> "GNAT Discussion List" <gnatlist@lyris.seas.gwu.edu>. You might want to
> raise the point there.
> 
> With Regards
> 
> Martin

Thanks,

I am not an ADACORE custumer, just a frustrated ADA programmer trying
to read from a <2Gb file.

Not ADA related, but as a side issue, I am new to 64 bit
representation.
I understand it is split into High/Low (high-order 32 bits and low
order 32 bits
representations of the value). At the moment for files 3Gb in size,
High
is always zero, however, what happens if both High and Low have value?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada.Streams.Stream_IO.Stream_Access
  2004-11-16 18:19   ` Ada.Streams.Stream_IO.Stream_Access Alex
@ 2004-11-16 18:52     ` tmoran
  2004-11-17  9:31       ` Ada.Streams.Stream_IO.Stream_Access Martin Krischik
  0 siblings, 1 reply; 6+ messages in thread
From: tmoran @ 2004-11-16 18:52 UTC (permalink / raw)


>> > Ok, now I try to read from the huge file....and bang I am getting a
>> > Constraint error. Is this a case that I just can't use ADA Streams on
>> > files bigger then 2*31 bytes??
  Works fine for me.  I read a 7GB file in 449,000 16K chunks.  What size
chunks are you using?

>Not ADA related, but as a side issue, I am new to 64 bit
>representation.
>I understand it is split into High/Low (high-order 32 bits and low
>order 32 bits
>representations of the value). At the moment for files 3Gb in size,
>High
>is always zero, however, what happens if both High and Low have value?
  The value is High*2**32+Low



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada.Streams.Stream_IO.Stream_Access
  2004-11-16 18:52     ` Ada.Streams.Stream_IO.Stream_Access tmoran
@ 2004-11-17  9:31       ` Martin Krischik
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Krischik @ 2004-11-17  9:31 UTC (permalink / raw)


tmoran@acm.org wrote:

>>> > Ok, now I try to read from the huge file....and bang I am getting a
>>> > Constraint error. Is this a case that I just can't use ADA Streams on
>>> > files bigger then 2*31 bytes??
>   Works fine for me.  I read a 7GB file in 449,000 16K chunks.  What size
> chunks are you using?
> 
>>Not ADA related, but as a side issue, I am new to 64 bit
>>representation.
>>I understand it is split into High/Low (high-order 32 bits and low
>>order 32 bits
>>representations of the value). At the moment for files 3Gb in size,
>>High
>>is always zero, however, what happens if both High and Low have value?

>   The value is High*2**32+Low

And need to be stored in

type File_Position is range -2**32 .. +2*32-1;
for File_Integer'Size use 64;

or prehaps:

type File_Position is mod 2**64;
for File_Integer'Size use 64;

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-11-17  9:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-16  4:16 Ada.Streams.Stream_IO.Stream_Access Alex
2004-11-16  8:06 ` Ada.Streams.Stream_IO.Stream_Access Marius Amado Alves
2004-11-16  8:28 ` Ada.Streams.Stream_IO.Stream_Access Martin Krischik
2004-11-16 18:19   ` Ada.Streams.Stream_IO.Stream_Access Alex
2004-11-16 18:52     ` Ada.Streams.Stream_IO.Stream_Access tmoran
2004-11-17  9:31       ` Ada.Streams.Stream_IO.Stream_Access Martin Krischik

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