From: "Martin Dowie" <martin.m.dowie@no.spam.ntlworld.com>
Subject: Re: Circular type definition problem
Date: Mon, 11 Jun 2001 21:16:27 +0100
Date: 2001-06-11T21:16:27+01:00 [thread overview]
Message-ID: <yG9V6.9160$6d5.1914559@news2-win.server.ntlworld.com> (raw)
In-Reply-To: 1s7V6.4021$Il5.510814@newsread1.prod.itd.earthlink.net
you could split out the implementation specifics into a seperate package
e.g.
with System.Direct_IO;
package Project_Specifics is
-- Specific to GNAT
--
Direct_IO_Count_Last : constant := System.Direct_IO.Count'Last;
end Project_Specifics;
with Ada.Direct_Io;
with Project_Specifics;
package Temp is
type Byte is mod 256;
type Block;
type Blockdata is array (0 .. 511) of Byte;
type Node_Count is range 0 .. Project_Specifics.Direct_IO_Count_Last;
type Block is
record
Next_Node : Node_Count;
Data : Blockdata;
end record; -- Block
pragma Pack(Blockdata);
pragma Pack(Block);
package Node_Io is new Ada.Direct_Io(Block);
use Node_Io;
end Temp;
"Charles Hixson" <charleshixsn@earthlink.net> wrote in message
news:1s7V6.4021$Il5.510814@newsread1.prod.itd.earthlink.net...
> This is what I'm trying to do:
> type Block;
> package Node_IO is new Ada.Direct_IO(Block);
> use Node_IO;
> type BlockData is array (0..511) of Byte;
> type Block is record
> next_node : Node_IO.Count;
> data : BlockData;
> end record; -- Block
> pragma pack(BlockData);
> pragma pack(Block);
>
> Not too much to my surprise, it didn't work. Node_IO needs to be
> defined with a real type. OTOH, the type Node_IO.Count is
> defined within Node_IO, so I can't put it after the declaration
> of Block.
>
> I suppose that I could just give up, and declare next_node to be
> Long_Integer, but that seems so inelegant. Node_IO.Count is,
> essentially, an Access variable (it says where in the file to
> find the next Block). But I'm not really sure how to approach
> this. Any suggestions?
next prev parent reply other threads:[~2001-06-11 20:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-11 17:44 Circular type definition problem Charles Hixson
2001-06-11 20:16 ` Martin Dowie [this message]
2001-06-11 21:18 ` Charles Hixson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox