Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: LETARTARE on November 28, 2020, 10:58:41 AM

Title: Check 'Variable expansion'
Post by: LETARTARE on November 28, 2020, 10:58:41 AM
Hello,
How to simply check the contents of an expansion variable before using it ?
Title: Re: Check 'Variable expansion'
Post by: oBFusCATed on November 28, 2020, 01:20:56 PM
I don't know of an easy way, but you can use the ReplaceMacros squirrel function, probably.
Title: Re: Check 'Variable expansion'
Post by: LETARTARE on November 28, 2020, 02:53:55 PM
Thanks,
Of course, but it would be convenient to have a tool to do this work at each location where an expansion variable can be used:
- Project Build Option...
- Tools-> Configure tools->Edit
- ...
A plugin expansion ?
Title: Re: Check 'Variable expansion'
Post by: ollydbg on November 28, 2020, 03:37:23 PM
Quote from: LETARTARE on November 28, 2020, 02:53:55 PM
Thanks,
Of course, but it would be convenient to have a tool to do this work at each location where an expansion variable can be used:
- Project Build Option...
- Tools-> Configure tools->Edit
- ...
A plugin expansion ?

I think the Menu->Tools is a good place to test the variable expansion.

You can wrote some command like

echo $TDAY


Then run the command, this command will shown in the console window as "echo 20201128".
Title: Re: Check 'Variable expansion'
Post by: oBFusCATed on November 28, 2020, 04:09:09 PM
Quote from: LETARTARE on November 28, 2020, 02:53:55 PM
Of course, but it would be convenient to have a tool to do this work at each location where an expansion variable can be used:
...
I don't understand.
What do you mean by test?
Put the variable, run the command and test it.
Title: Re: Check 'Variable expansion'
Post by: LETARTARE on November 28, 2020, 07:11:51 PM
1- Choose a variable in a list of expansion variables,
2- Show the contents (to check if it's the right variable)
Title: Re: Check 'Variable expansion'
Post by: oBFusCATed on November 28, 2020, 08:18:14 PM
I still don't understand. What do you mean by "right variable"?
Title: Re: Check 'Variable expansion'
Post by: LETARTARE on November 28, 2020, 11:57:50 PM
the variable that corresponds to my need
Title: Re: Check 'Variable expansion'
Post by: oBFusCATed on November 29, 2020, 12:19:12 AM
I still have no idea what you're trying to achieve.  And you aren't even trying to explain. :shrug:

Title: Re: Check 'Variable expansion'
Post by: BlueHazzard on November 29, 2020, 08:57:46 PM
Probably the easiest way is to create a squirrel script, that expands every variable. Call this script before your need with the [[]] variable expansion...
The problem is, that variables have different values in different steps for example in compiling, so you would need a UI where you can set the build state....
So the easiest way is to create a squirrel script
Create a script that logs all your requested variables. Something like this:
Log(_T("$(PROJECT_FILENAME) = " +  ReplaceMacros(_T("$(PROJECT_FILENAME)")))

and call the script with
[[Require(_T("Path to test script file"))]]
on every place you want to know the variables...
Title: Re: Check 'Variable expansion'
Post by: LETARTARE on November 30, 2020, 10:24:51 AM
@BlueHazzard
Thanks, I will follow your advice.