From: bcf@ssd.ray.com (Felaco)
Subject: Re: String to Variable Name Mapping
Date: 1996/04/25
Date: 1996-04-25T00:00:00+00:00 [thread overview]
Message-ID: <DqFM12.Hu7@ssd.ray.com> (raw)
In-Reply-To: 4kjico$emb@newssvr.cacd.rockwell.com
F. Britt Snodgrass (fbsnodgr@cacd.rockwell.com) wrote:
: 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.
The answer is no, there is no way to map an arbitrary string to an
arbitrary variable name. However, you can convert strings to enumeration
literals and vice versa. With a little more programming, you can define
all of your user defined variables in an array indexed by the variable
name. The "variable name" will be an enumerated type you defined. You
can use Text_Io.Enumeration_Io to read in the variable names, or just use
the 'Value attribute of the enumerated type you defined.
Anyway, I don't know too much about it, but I have read that Tcl was
designed specifically for this purpose. I wonder if anyone has set up
Ada bindings for Tcl or maybe even ported it entirely?
--
-------------------------------------------------------------------------------
Chris Felaco Phone: x4631 (Raynet 444, Local 842)
Raytheon Company Email: bcf@ssd.ray.com
-------------------------------------------------------------------------------
prev parent reply other threads:[~1996-04-25 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
1996-04-25 0:00 ` Felaco [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox