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
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
Code
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
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:
Code
Log(_T("$(PROJECT_FILENAME) = " +  ReplaceMacros(_T("$(PROJECT_FILENAME)"))) 

and call the script with
Code
[[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.