Page 1 of 1

Code for parsing variable lists and handling substitutions

Posted: Thu Jul 12, 2012 8:12 am
by tofutim
The variable list in EXEPlug is delievered in a COMMATEXT format, however, it turns out that handling all the rules is not straight-forward. Is there some official code available showing how to parse the variable list, re-encode and handle the substitutions efficiently? I was thinking about writing my own, or using something like boost Tokenizer, but the best would be to use whatever IA is using already - since the plugin needs to return the NewVariables list in the same way that it received the Variables list.

In my case, I just want to return a value as true, but I think the steps need to be:

1. Parse the Variables string into some kind of map or hashtable (correctly handling quotes, double-quotes, \", commas in between quotes)
2. Handle all substitutions of incoming text (e.g., $TITLE$)
3. Change the value of the target variable (I guess we can't just append, since the target variable must be created ahead of time with Set Variable)
3. Re-encode into the correct IA variables string format (values are not always double-quoted, for example)

Thank you much.

Respectfully,
Tim

Re: Code for parsing variable lists and handling substitutio

Posted: Thu Jul 12, 2012 8:46 am
by tofutim
In case anyone wonders, IA uses double-double-quotes (hmm, that makes me hungry), which needs to be accounted for if you use boost Tokenizer.

HASIT,"George's ""companion"" wasn't happy. "

Probably \ stay where they are.

Re: Code for parsing variable lists and handling substitutio

Posted: Thu Jul 12, 2012 8:50 am
by FrancescoT
Dear Tim,

unfortunately doesn't exist an official IA function or routine to handle COMMATEXT format.

I suppose that every developer have realized a custom one ( ... as I have done with my plug-ins).

I can only suggest you to have a look at the following link (if you haven't):
http://www.installaware.com/forum/viewtopic.php?f=3&t=3424

The source code available is a good starting point.

Regards

Re: Code for parsing variable lists and handling substitutio

Posted: Thu Jul 12, 2012 3:35 pm
by tofutim
"every developer have realized a custom one"

Doesn't that seem crazy? ;)

Re: Code for parsing variable lists and handling substitutio

Posted: Fri Jul 13, 2012 8:18 am
by FrancescoT
I don't agree.

The target is to handle the COMMATEXT format as it is required but it is not required to have a standard strategy to do it.

For example in my case, I have developed a custom C++ Framework class to handle all IA plugin low level functionality.
Every plugin that I realize is derived from that class.

The class is also responsable of all required COMMATEXT format operations and I use a very personalized approach to manage variables and values.

Honestly ... I do not feel crazy! 8)

Regards

Re: Code for parsing variable lists and handling substitutions

Posted: Tue Oct 13, 2020 7:35 am
by mihai
IMO, @tofutim is making a valid point above. A good framework to develop plug-ins should have such helper functions.

Re: Code for parsing variable lists and handling substitutions

Posted: Tue Oct 13, 2020 11:27 am
by FrancescoT
In fact, we don't provide a framework...but a SDK. Of course, @tofutim is making a valid point above ...and this may be something to add in future versions.