Referring to other variables within a compiler variable definition in install4j - install4j

Inside an install4j project, is it possible to refer to a compiler variable within the value of another compiler variable? For example, if I've defined the variable "revision" earlier in the list of variables, is it possible to have another variable named "outputDir" with the following value:
somedir/${revision}/otherdir

Yes, that's possible, you just set the value of outputDir to
somedir/${compiler:revision}/otherdir

Related

Get parameter name in Clion plugin

I am developing a plugin for Clion (C++) that needs to access caller parameter name, e.g. if a function is declared:
void fun(int a);
and called
fun(42);
when the intent is invoked on 42 PsiElement it should get the corresponding parameter name, "a" in this case.
In a similar plugin for Intellij (Java), I get the parameter name with PsiCallExpression.resolveMethod() which contains the list of parameters. However, I cannot figure out how to do this in a Clion plugin. I can get a reference of a corresponding OCCallExpression, but it does not seem to contain a reference to the declared function. I tried to play around with ReferencesSearch.search(), but it did not find the declaration of the function.
At the same time, the IDE itself displays all the parameter name hints:
so I suppose it must be possible.
How can I get the parameter name for a given caller argument expression?
Please, look at InlayParameterHintsExtension.forLanguage(OCLanguage.getInstance()) and InlayParameterHintsProvider.getParameterHints

Can't find variable error on Smartface

I have a problem about global variables on Smartface. I create a dataset and I gave a criteria with a value which name is param1. Although I define a variable which name is param1 in Global file, even the code runs correctly I get an error like;
Can't find variable:
param1
*undefined
*1
*global code
As I said, my code runs correctly, but why I always get this error?
I have got such an error like that. Probably, you defined that variable into the one of the functions that are in the Global file. You should directly define global variables into the Global file.
function Global_Events_OnStart(e) {
...
}
--> For example you should define your global variables here, so outside of all the functions.
function Global_Events_OnError(e) {
...
}

Drools: using the same DSL definition twice with a variable throws a duplicate variable error

If you define a DSL file with some lines, and one of them uses a variable, you cannot use it twice in a rule because you will get a duplicate variable error.
What's the best way to avoid this? Ideally I would like to avoid to create two copies of the DSL line to just change the variable name.
ie, the DSL line:
[when][]For all qualifications of type Higher=$highers: Higher()
this cannot be used twice in the same rule or we get a duplicate $highers variable.
You can synthesize the name of a binding variable like any other chunk of text:
[when][]there is a qualification of type {qualification}=
${qualification}: {qualification}()
But it's going to be tricky because you'll have to make references to this variable variable variable, too:
[then] print {qualification}=System.out.println( ${qualification} );
instead of the straightforward
[then] print qualification=System.out.println( $qualification );
A lurking danger is that the amount of text that remains as a "landmark" around the macro variables is reduced which may result in multiple matches.

Can't update variable inside CMake marcro

How can I modify a parameter inside a CMake Macro?
I'm using CMake version 2.6 and I can't update the variable!
Here's a basic example:
# macro definition
MACRO(MYTEST RETVAL)
message("input RETVAL=${RETVAL}")
SET(RETVAL "new return value")
message("after update RETVAL=${RETVAL}")
ENDMACRO(MYTEST)
# call macro with parameter '_test' set to 'init'
SET(_test "init")
MYTEST("${_test}")
message("after macro call:${_test}")
This prints:
input RETVAL=init
after update RETVAL=init
after macro call:init
The variable _test is never modified. What can I do to make it work?
Thanks
With CMake macros, you need to very carefully distinguish between macro parameter name, variable name, variable value etc. It's not quite clear from your CMake code what you want to achieve, but I assume you want to set _test to the string new return value using the macro.
This is the code to accomplish that:
macro(MYTEST RETVAL)
message("input variable name: RETVAL=${RETVAL}")
message("input variable value: ${${RETVAL}}")
set(${RETVAL} "new return value")
message("variable name after update: RETVAL=${RETVAL}")
message("variable value after update: ${${RETVAL}}")
endmacro()
set(_test "init")
MYTEST(_test)
message("after macro call: ${_test}")
Points to note:
You want the macro to modify the variable which was passed in. That variable's name is stored in the macro parameter RETVAL. So you need to set(${RETVAL} ...) to set the varibale. Your code was creating a variable named RETVAL.
You need to pass the name of the variable to change to the macro. So you must pass _test, and not ${_test}. Your code was calling the macro with the text init.

Difference between Introduce Parameter and Change Method signature in Eclipse?

Difference between Introduce Parameter and Change Method signature in Eclipse?
Introduce parameter lets you convert a local expression to a parameter of the current method that will be added to the end of the parameter's list.
Change method signature allows you to introduce parameters without any special relation to your method's body, reorder or modify existing parameters.
A good overview can be found in Eclipse's help
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/ref-menu-refactor.htm (Galileo)
respectively
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/ref-menu-refactor.htm (Helios)
If you are speaking of the Introduce parameter Object refactoring, one answer can be found here:
http://www.refactoring.com/catalog/introduceParameterObject.html
In fact this creates a new class representing your parameters where as the Change method signature allows to change method return type, visibility and parameters.
If you are speaking about the introduce parameter when a field or local variable is selected, this will just add a new parameter to the enclosing method with the same name and the same type than the selected field or local variable and thus use this parameter instead.
Manu