comp.lang.ada
 help / color / mirror / Atom feed
From: "Magnus Sparf" <magnus-s@dsv.su.se>
Subject: Re: Direct_IO problem -- generic package problem
Date: Thu, 12 Jul 2001 13:41:04 +0200
Date: 2001-07-12T13:41:04+02:00	[thread overview]
Message-ID: <9ik2qt$1p2$1@mercur.foa.se> (raw)
In-Reply-To: 9ijpom$bed$1@s1.read.news.oleane.net

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4497 bytes --]

Thanks for the quick reply
I just tried  "pragma Ada_83;" but the only result is a new error message
from GNAT related to the same problem?:
db.adb:58:07: instantiation error at a-direio.adb:190
db.adb:58:07: unconstrained subtype not allowed (need initialization)
db.adb:58:07: instantiation error at a-direio.adb:210
db.adb:58:07: unconstrained subtype not allowed (need initialization)

Is there a way to get around the problem without the use of "pragma Ada_83;"
to this point I have managed to use pure Ada95 standard packages to replace
the old ones specific for the VAX environment. It would be very nice without
compilerdependent solutions.

/Magnus

"nicolas" <n.brunot@cadwin.com> skrev i meddelandet
news:9ijpom$bed$1@s1.read.news.oleane.net...
> If you are using gnat, you can add
> pragma Ada_83;
> in this body to enforce Ada_83 restrictions (provided you don't use
specific
> Ada95 features in this body)
> But this is really a bug of Ada83 cerrected in Ada95
> Nicolas
>
> "Magnus Sparf" <magnus-s@dsv.su.se> a �crit dans le message news:
> 9ijobe$qb4$1@mercur.foa.se...
> > I�m new to ADA (hopefully picking up track fast) and this summer I have
> the
> > task of converting an old Ada83 application (VAX environment) to Ada95
(PC
> > environment).
> > In the very heart of this application there is a homemade database that
> > compiles without problem in the VAX environment. When I compile it on
GNAT
> > 3.13p in the PC environment. I get the following error:
> >
> >  db.adb:58:49: actual for "Element_Type" must be a definite subtype
> :::(the
> > last line in the extract)
> >
> > Extract of code (DB is a generic package and used to create a lot of
> > different databases):
>
> --------------------------------------------------------------------------
> --
> > -----------
> > package body DB is
> >
> >       type FILLED_TABLES is array (SMALL_NAT range <>) of BOOLEAN;
> >    pragma pack (FILLED_TABLES);
> >
> >       type LINE_COL is
> >          record
> >             X_V : SMALL_NAT := 1;
> >             Y_V : SMALL_NAT := 1;
> >          end record;
> >
> >       type TABLE_VALUES  is array (SMALL_NAT range <>) of LINE_COL;
> >
> >       type M_T             is array (SMALL_NAT range <>,
> >       SMALL_NAT range <>) of ITEM;
> >       type B_T             is array (SMALL_NAT range <>,
> >       SMALL_NAT range <>) of BOOLEAN;
> >
> >
> >       type MATRIX (MAX : SMALL_NAT;
> >       FIRST_RECORD : BOOLEAN;
> >       ROWS_FIRST     : SMALL_NAT;
> >       ROWS_LAST      : SMALL_NAT;
> >       COLUMNS_FIRST  : SMALL_NAT;
> >       COLUMNS_LAST   : SMALL_NAT) is
> >
> >          record
> >             case FIRST_RECORD is
> >                when TRUE =>
> >                -- description of entire file with tables
> >                   FILLED              : FILLED_TABLES(2..MAX) :=
> >                   (others => FALSE);
> >                   DISCRIMANT_VALUES : TABLE_VALUES(2..MAX) :=
> >                   (others => (1, 1));
> >                when FALSE =>
> >                -- tables
> >                   VALUE        : M_T (ROWS_FIRST..ROWS_LAST,
> >                   COLUMNS_FIRST..COLUMNS_LAST);
> >                   ITEM_PUT  : B_T (ROWS_FIRST..ROWS_LAST,
> >                   COLUMNS_FIRST..COLUMNS_LAST);
> >                   RAD_INDEX    : R_T (ROWS_FIRST..ROWS_LAST);
> >                   COLUMN_INDEX : C_T (COLUMNS_FIRST..COLUMNS_LAST);
> >             end case;
> >          end record;
> >
> >       package MY_DIRECT_IO is new Ada.DIRECT_IO(MATRIX);
>
> --------------------------------------------------------------------------
> --
> > -------------
> >
> > If I give type MATRIX default values it compiles with warnings about
> Storage
> > constraints errors in runtime (that also occurs...). MATRIX is used at a
> lot
> > of other places further down.
> >
> > Are there any quick (not dirty) solutions to this problem? My own ideas
is
> > to create separate databases for all eight databases that uses DB
(CAR_DB,
> > BOAT_DB, HOUSE_DB...) with specified values for MATRIX, but that seems
> like
> > a lot of work and not very objectoriented.
> > I�ve read the GNAT RM about the problem (Ada95 <-> Ada83) "Indefinite
> > subtypes in generics" but don`t seem to understand, especially when
> there�s
> > a standard package involved.
> >
> > All you experienced ones out there leave the "Ada is dead"-discussions
and
> > pleaseeeeee help me out...
> >
> > Magnus Sparf
> > magnus-s@dsv.su.se
> >
> >
> >
>
>





  parent reply	other threads:[~2001-07-12 11:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-12  8:42 Direct_IO problem -- generic package problem Magnus Sparf
2001-07-12  9:19 ` nicolas
2001-07-12 11:38   ` David C. Hoos, Sr.
2001-07-12 12:14     ` nicolas
2001-07-12 11:41   ` Magnus Sparf [this message]
2001-07-12 12:25     ` nicolas
2001-07-12 11:33 ` David C. Hoos, Sr.
2001-07-12 16:58 ` Jeffrey Carter
2001-07-12 19:23   ` tmoran
2001-07-13  8:16     ` Magnus Sparf
replies disabled

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