comp.lang.ada
 help / color / mirror / Atom feed
From: tconiam@ionet.net (Todd Coniam)
Subject: Re: String to Variable Name Mapping
Date: 1996/04/19
Date: 1996-04-19T00:00:00+00:00	[thread overview]
Message-ID: <4l72r6$rj2@ionews.ionet.net> (raw)
In-Reply-To: 4kjico$emb@newssvr.cacd.rockwell.com

In article <4kjico$emb@newssvr.cacd.rockwell.com>, fbsnodgr@cacd.rockwell.com 
says...
>
>Is there an attribute or some other way to use the contents of a string
>variable to point to another variable?
>
>For example, if I have the following declarations,
>
>  Int_Var : Integer;
>  Str_Var : String (1..32) := "Int_Var";
>
>can I somehow use the contents of Str_Var to make an assignment to 
>Int_Var?
>
>I'd like to do this as a way of initializing variables by reading from a 
>text file containing the variable name and the desired initial value.
>
>Thanks,
>Britt Snodgrass  (mailto:britt@acm.org)
>

-- 

Yes, but it involves writing a small parser that determines which variable is 
listed in the file, reads the value, and assigns it to the appropriate actual 
variable.

What your wanting is not directly supported by Ada as it is in some other 
languages.  It is not considered "safe" (which I agree with) but I do see the 
utility of your need (it's a initialization file, and done all the time).

Sorry, there is no fast answer.  If you are having problems creating the 
necessary procedure let us (c.l.a) know and we can help you out.

-------------------------------------------------------------------------
Todd Coniam       | Member: Team Ada
tconiam@ionet.net | Ada 95 - The international standard in OO languages
-------------------------------------------------------------------------
Check: http://lglwww.epfl.ch/Ada/     Free compiler: http://www.gnat.com/





  parent reply	other threads:[~1996-04-19  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-11  0:00 String to Variable Name Mapping F. Britt Snodgrass
1996-04-13  0:00 ` Laurent Guerby
1996-04-13  0:00 ` Robert Dewar
1996-04-19  0:00 ` Todd Coniam [this message]
1996-04-25  0:00 ` Felaco
replies disabled

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