comp.lang.ada
 help / color / mirror / Atom feed
From: "John B. Matthews" <nospam@nospam.com>
Subject: Re: Efficiently setting up large quantities of constant data
Date: Fri, 17 Dec 2004 02:32:28 GMT
Date: 2004-12-17T02:32:28+00:00	[thread overview]
Message-ID: <nospam-2E9301.21354316122004@news-server-fe-02.columbus.rr.com> (raw)
In-Reply-To: 32di5rF3lj4ggU1@individual.net

In article <32di5rF3lj4ggU1@individual.net>,
 "Marc A. Criley" <mcNOSPAM@mckae.com> wrote:

> "Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk> wrote:
> 
> > A similar question I have is how to link in regular files and access
> > their contents in Ada.
> >
> > For example, suppose I have a binary file "distances.dat" containing
> > the (road) distances between 1000 different cities.  This could be a 2MB
> > file computed by another application. How can I build a single executable
> > file containing the data and access it from the Ada code?
> >
> > I presume this needs to be done at the linker stage, but I don't
> > see any options to link in non-object files.  The obvious alternative
> > of distributing the data files separately and reading them in
> > is slower and much less tidy than having a single self-contained binary.
> 
> I don't know the answer to your real question about linking in such files,
> but the way we dealt with this problem _many_ years ago with some very large
> tables of math constants was to write a little tool that read in the file
> and then generated Ada source code that initialized a suitably defined data
> structure with the constants.  (And I don't think we used big aggregates,
> because they were...well...too big.  I think we had the tool generate
> thousands of assignment statements.)
> 
> The generated file was quite large and took awhile to compile (it was 1985
> after all :-), but it worked just fine for us.  Of course it was a one-shot
> effort as well, since math constants don't change very often, so YMMV if
> you're dealing with changing data.
> 
> Marc A. Criley
> McKae Technologies
> www.mckae.com

For several projects, we've used a script (SQL*Plus, PL/SQL, Java) 
to read from a database and generate executable code (Ada, Java). 
The script was part of the build, so each new release had the latest 
data.

-- 
John
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/



  reply	other threads:[~2004-12-17  2:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-13 21:48 Efficiently setting up large quantities of constant data Michael Mounteney
2004-12-13 22:09 ` Stephen Leake
2004-12-13 22:15 ` Luke A. Guest
2004-12-14  0:20 ` Jeffrey Carter
2004-12-14  8:43 ` Martin Krischik
2004-12-14 12:18 ` Simon Wright
2004-12-15 21:10   ` Brian May
2004-12-16 23:18     ` Nick Roberts
2004-12-16 12:36 ` Dr. Adrian Wrigley
2004-12-16 13:50   ` Marc A. Criley
2004-12-17  2:32     ` John B. Matthews [this message]
2004-12-16 14:06   ` rien
2004-12-16 14:24   ` Vinzent 'Gadget' Hoefler
2004-12-16 18:12     ` Dr. Adrian Wrigley
2004-12-16 23:25       ` Nick Roberts
2004-12-17  5:20     ` tmoran
2004-12-17  8:38       ` Vinzent 'Gadget' Hoefler
2004-12-17 13:53     ` Dr. Adrian Wrigley
2004-12-17 14:16       ` Alex R. Mosteo
2004-12-16 17:11   ` Andre
2004-12-16 21:52     ` Larry Kilgallen
2004-12-16 23:23       ` Nick Roberts
2004-12-16 23:47       ` Dr. Adrian Wrigley
2004-12-19 14:34         ` Simon Wright
2004-12-16 18:29 ` Alex R. Mosteo
replies disabled

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