Code for parsing variable lists and handling substitutions

Interested in developing new plug-ins? Got one to share? Post here!
tofutim
Posts: 176
Joined: Thu Mar 01, 2012 1:16 pm

Code for parsing variable lists and handling substitutions

Postby tofutim » Thu Jul 12, 2012 8:12 am

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

tofutim
Posts: 176
Joined: Thu Mar 01, 2012 1:16 pm

Re: Code for parsing variable lists and handling substitutio

Postby tofutim » Thu Jul 12, 2012 8:46 am

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.

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Code for parsing variable lists and handling substitutio

Postby FrancescoT » Thu Jul 12, 2012 8:50 am

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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

tofutim
Posts: 176
Joined: Thu Mar 01, 2012 1:16 pm

Re: Code for parsing variable lists and handling substitutio

Postby tofutim » Thu Jul 12, 2012 3:35 pm

"every developer have realized a custom one"

Doesn't that seem crazy? ;)

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Code for parsing variable lists and handling substitutio

Postby FrancescoT » Fri Jul 13, 2012 8:18 am

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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mihai
Posts: 32
Joined: Fri Nov 29, 2013 3:53 am

Re: Code for parsing variable lists and handling substitutions

Postby mihai » Tue Oct 13, 2020 7:35 am

IMO, @tofutim is making a valid point above. A good framework to develop plug-ins should have such helper functions.

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Code for parsing variable lists and handling substitutions

Postby FrancescoT » Tue Oct 13, 2020 11:27 am

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.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Plug-In Development”

Who is online

Users browsing this forum: No registered users and 43 guests