Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Stefan V. Pantazi
Haev a look at rtti and the functionality available in the typinfo unit. The tests included in fpc are a good resource. Have a look at the trtti*.pp tests: https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/tests/test/ Start with trtti4.pp and work your way up to more complex examples. On 7

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread James Richters
I’m curious how use classes together with published properties would work, is there a sample of how to use this somewhere? James From: fpc-pascal On Behalf Of Sven Barth via fpc-pascal Sent: Monday, July 8, 2019 5:31 PM To: FPC-Pascal users discussions Cc: Sven Barth Subject: Re: [fpc-pa

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Sven Barth via fpc-pascal
James Richters schrieb am Mo., 8. Juli 2019, 22:44: > SetStoragePinByName('Ini_Opto_Enable_Positive_Pin', True) ; > > And it would somehow get the value of 'Ini_Opto_Enable_Positive_Pin > That indeed sounds like something where you could use classes together with published properties. At least i

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread James Richters
Well what it’s for, is not just debugging, I’m trying to manage outputs to ports that are defined by port numbers and pins in an ini file, the ports and pins can really be anything but I need to keep track of the output states of all the pins by specific port value because I can only output

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Santiago A.
El 07/07/2019 a las 21:58, James Richters escribió: This might sound silly, but is it possible to somehow specify a variable with a string containing the name of the variable? For example: Var MyVariable1 : Word; MyVariableName : String; Procedure ShowVariable(Variablename); Begin Wr

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Stefan V. Pantazi
sure, but you end up with a separate dictionary for each type. Or, you can try variants, as originally suggested, but then you need to declare all your variables as a Variant type. uses fgl, variants; type TVariableDictionary = specialize TFPGMap; On 7/8/19 11:20 AM, James Richters wrote:

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Darius Blaszyk
> This might sound silly, but is it possible to somehow specify a variable > with a string containing the name of the variable? Yes it certainly is. I wrote a unit that can handle arbitrary variable types for my project pmake. Pmake it a build tool for pascal. https://github.com/daar/pmake/blob

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread James Richters
Thank you, using fgl; did work. Am I correct in assuming that if I want other types of Variables I would change PWord in specialize TFPGMap; to something else, maybe PString, PDouble, PLongint etc? James -Original Message- From: fpc-pascal On Behalf Of Stefan V. Pantazi Sent: M

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Stefan V. Pantazi
You can use the TFPGMap class in fgl unit to implement the dictionary. fgl should be available in 3.0.4. Try to replace the Generics.Collections with fgl and the type definition in the example code from zh loza. The rest should be identical. [...] uses fgl; type TVariableDictionary = specia

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Martin Frb
On 08/07/2019 14:09, James Richters wrote: I'm on windows Generics.Collections seems to be something that was added after 3.0.4, I've downloaded the current FPC source code, but I’m not sure how to build it.. can someone point me in the right direction on how to compile the current source

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Martin Frb
On 08/07/2019 14:09, James Richters wrote: I'm on windows Generics.Collections seems to be something that was added after 3.0.4, I've downloaded the current FPC source code, but I’m not sure how to build it.. can someone point me in the right direction on how to compile the current source

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread James Richters
I'm on windows Generics.Collections seems to be something that was added after 3.0.4, I've downloaded the current FPC source code, but I’m not sure how to build it.. can someone point me in the right direction on how to compile the current source code? James -Original Message- F

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread James Richters
Generics.Collections seems to be something that was added after 3.0.4, I've downloaded the current FPC source code, but I’m not sure how to build it.. can someone point me in the right direction on how to compile the current source code? James -Original Message- From: fpc-pascal On Be

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread James Richters
Thank you for the answer and the example... I didn't know there was such a thing as a variable dictionary, but It looks like that may work for me, I'll give it a try! James -Original Message- From: fpc-pascal On Behalf Of zh loza Sent: Sunday, July 7, 2019 4:34 PM To: FPC-Pascal users d