Author Topic: Check 'Variable expansion'  (Read 5793 times)

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Check 'Variable expansion'
« on: November 28, 2020, 10:58:41 am »
Hello,
How to simply check the contents of an expansion variable before using it ?
« Last Edit: November 28, 2020, 11:04:24 am by LETARTARE »
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Check 'Variable expansion'
« Reply #1 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Check 'Variable expansion'
« Reply #2 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 ?
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Check 'Variable expansion'
« Reply #3 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".
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Check 'Variable expansion'
« Reply #4 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Check 'Variable expansion'
« Reply #5 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)
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Check 'Variable expansion'
« Reply #6 on: November 28, 2020, 08:18:14 pm »
I still don't understand. What do you mean by "right variable"?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Check 'Variable expansion'
« Reply #7 on: November 28, 2020, 11:57:50 pm »
the variable that corresponds to my need
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Check 'Variable expansion'
« Reply #8 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:

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Check 'Variable expansion'
« Reply #9 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...

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Check 'Variable expansion'
« Reply #10 on: November 30, 2020, 10:24:51 am »
@BlueHazzard
Thanks, I will follow your advice.


CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl