From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd4e0f4e248c8168 X-Google-Attributes: gid103376,public From: bcf@ssd.ray.com (Felaco) Subject: Re: String to Variable Name Mapping Date: 1996/04/25 Message-ID: #1/1 X-Deja-AN: 151429908 sender: news@ssd.ray.com (Administrator) x-nntp-posting-host: shamu.ssd.ray.com references: <4kjico$emb@newssvr.cacd.rockwell.com> organization: Raytheon Electronic Systems, Portsmouth RI Facility newsgroups: comp.lang.ada Date: 1996-04-25T00:00:00+00:00 List-Id: 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 -------------------------------------------------------------------------------