From: john@assen.demon.co.uk (John McCabe)
Subject: Re: Ada equivalent of C "static" structures
Date: 1997/03/08
Date: 1997-03-08T00:00:00+00:00 [thread overview]
Message-ID: <332146fc.891048@news.demon.co.uk> (raw)
In-Reply-To: 33206981.84E@mccabe.com
Michael Ibarra <ibarra@mccabe.com> wrote:
>I'm wondering if anyone can point me in the right direction:
>
>I need to declare a record which has "file" scope. This would be
>something that every unit within this file could access, but could
>not be accessed from any unit outside of this file.
>
>Any ideas???
>
>thanks in advance
>-Mike
This really depends on exactly what you require. If you have 1 package
to each file then Mr. Schneider's answer should be adequate, however
if you are intending to have more than 1 package in a file then you
will need to look closer at the overall structure. I'm sure I'll be
corrected if I'm wrong here, but Ada doesn't support e.g.
with System;
type X is record
:
:
end record;
package body p_1 is
:
:
end p_1;
package body p_2 is
:
:
end p_2;
All type and object definitions must be within a program unit, and a
file isn't one of those. You cold put a package definition round the
above stuff, but then (In Ada 83) you would run into complications.
My advice would be to define a separate package with the type or
object definition you require, and only "with" it in a single file
e.g:
*file1*
package data_package is
type x is record
:
:
end record;
x_value : x;
end data_package;
*file2*
with data_package;
package body p_1 is
:
:
end p_1;
package body p_2 is
:
:
end p_2;
etc.
Best Regards
John McCabe <john@assen.demon.co.uk>
next prev parent reply other threads:[~1997-03-08 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-03-07 0:00 Ada equivalent of C "static" structures Michael Ibarra
1997-03-07 0:00 ` Robert Dewar
1997-03-07 0:00 ` john schneider
1997-03-08 0:00 ` John McCabe [this message]
1997-03-08 0:00 ` Robert Dewar
1997-03-09 0:00 ` John McCabe
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox