comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Embedding Text Data in Source (Was Re: String to Integer)
Date: 1997/07/19
Date: 1997-07-19T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680001907972352240001@news.ni.net> (raw)
In-Reply-To: 5ql62v$8dp@acmey.gatech.edu


In article <5ql62v$8dp@acmey.gatech.edu>, jm59@prism.gatech.edu (John M.
Mills) wrote:


>I now provide object parameters for a program in the form of a number of small
>files whose names are passed to the <ObjectType1>.Create(ParamFileName1, ...)
>procedures for each of the objects in my model.  This works fine.  I would
>also like to have a set of default parameters compiled into the code.  Hard-
>coding this would be simple, but I want instead to include as the default
>a specified file from my source tree, verbatim, then use the same parsing
>routines to process either the file image embedded in the code or one read
>under a file name, as transparently as possible using approaches similar to
>the earlier suggestions in this thread: String'Value( ParamStr ) ... etc.

I'm not sure exactly what you're trying to do, but here's a suggestion. 
Can't you use a function call that returns a string as your default value? 
ie

function Default_Value return String;

procedure P (O : T := Default_Value);

and then the Default_Value function could parse a file, read an environment
variable, etc.  The function gets invoked at run-time, and only then if the
call of P doesn't have an explicit value as an argument.

Of course, if it's the same value every time it's invoked (it only changes
across program executions), then you can calculate that value once at
initialization, either via an explicit package initialization subprogram or
implicitly via package elaboration (be careful of the latter).

Is this in the ballpark of what you wish to do?

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  parent reply	other threads:[~1997-07-19  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-15  0:00 String to Integer Charles Hill
1997-07-15  0:00 ` John Herro
1997-07-16  0:00 ` Martin C. Carlisle
1997-07-16  0:00 ` Robert Dewar
1997-07-17  0:00   ` Embedding Text Data in Source (Was Re: String to Integer) John M. Mills
1997-07-17  0:00     ` Samuel T. Harris
1997-07-19  0:00     ` Matthew Heaney [this message]
1997-07-16  0:00 ` String to Integer Samuel Mize
1997-07-17  0:00 ` Michael F Brenner
     [not found]   ` <5qlrue$3ft@top.mitre.org>
1997-07-18  0:00     ` Samuel Mize
replies disabled

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