comp.lang.ada
 help / color / mirror / Atom feed
From: achrist@easystreet.com
Subject: Re: Problem with Gnat.Dynamic_Tables
Date: Wed, 10 Jul 2002 17:19:40 -0700
Date: 2002-07-10T17:19:40-07:00	[thread overview]
Message-ID: <3D2CCF1C.8CA24AC1@easystreet.com> (raw)
In-Reply-To: 3D2B6BFB.D4468F57@easystreet.com

Update:

I got several kinds of memory errors and problems trying to use the
Gnat Dynamic_Tables, so I tried switching to the mw_components 
Dynamic_Arrays.  This package was similar enough that I could
pretty much substitute the operations of one package for the other,
just about one-for-one.  That fixed everthing; the whole program 
works fine now.

Al

achrist@easystreet.com wrote:
> 
> I've got a problem with Gnat.Dynamic_Tables.  I want to use a dynamic
> table of Ada.Strings.Unbounded.Unbounded_String data.  To do this I
> use:
> 
>       package Csv_Table is new Gnat.Dynamic_Tables(
>          Ada.Strings.Unbounded.Unbounded_String,
>          Csv_Row_Index_Type,
>          0, 1200, 100
>       );
> 
>       type Object is access all Csv_Table.Instance;
> 
> I set the size of the table with
> 
>       Csv_Table.Increment_Last( The_Table.all );
> 
> Before I assign to elements in the table, I check that the
> subscript is equal to Last.  This all works, but sometimes
> it crashes with a program error in the assignment:
> 
>    procedure Add_Row (
>          The_Table : in out Object;
>          New_Row   :        String  ) is
>    begin
>       Csv_Table.Increment_Last( The_Table.all );
>       The_Table.Table( Csv_Table.Last(The_Table.all) )
>          := Ada.Strings.Unbounded.To_Unbounded_String(New_Row);
>    end Add_Row;
> 
> The statement number that comes back from the crash is a-strunb.ads 368.
> This is (gnat 3.14p1) the statement of the declaration of the
> Unbounded_String type.  I'm loading the data from a file, and the crash
> happens around row 169 of my data, ie I get 168 values into the table
> fine, then it crashes.  The crash happens in the statement that
> attempts to assign the unbounded string to the table entry.
> 
> I see in the Gnat.Dynamic_Tables comments that no initialization of
> the array elements is done.  Does an unbounded_string need some
> initialization?  If so, how can I make this work?
> 
> TIA for any help.
> 
> Al



  reply	other threads:[~2002-07-11  0:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-09 23:04 Problem with Gnat.Dynamic_Tables achrist
2002-07-11  0:19 ` achrist [this message]
2002-07-11 15:13 ` Robert Dewar
2002-07-11 20:35   ` achrist
2002-07-12  3:42     ` Robert Dewar
2002-07-12  7:01       ` achrist
2002-07-12 14:23         ` Mats Weber
2002-07-12 16:56           ` achrist
2002-07-12 22:52             ` Mats Weber
2002-07-12 23:02               ` achrist
replies disabled

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