calling macro
The way to call the macro is as follows
1. Simple call
Used in function template and item data
2. Line-by-line call
Used in function template and item data
--- Notice : If a macro exists, its name as same as an item name, it implicitly corresponds.
3. Call state by state
Used in the output section
1. Simple call
Used in function template and item data
$macro:MacroName$ $macro:MacroName (argument 1 [, argument 2 ...])$
2. Line-by-line call
Used in function template and item data
[[ItemName->@macroName]]--- Macro conversion corresponding to each line of data item.
--- Notice : If a macro exists, its name as same as an item name, it implicitly corresponds.
3. Call state by state
Used in the output section
// [PSGG OUTPUT START] indent(20) $/regularExpression/->#macroName$--- Macro conversion for each state after all states is filtered by a regular expression.
normal macro and argument
Concerning normal macro,macro name will be as argument 0 and first parameter as argument 1 and so on.
i.e)
i.e)
$macro:hoge(a,b)$the above will be analyzed as the followings.
argument 0 : hoge argument 1:a argument 2:b
split string to arguments for line macro
Comma Separated Data: Arguments 0, 1,.
Example)
Function: function name is assumed as argument 0 then the arguments of the function are argument 1, argument 2 · · ·.
Example)
Example)
tokyo, osaka, yokohama--- Argument 0 = "tokyo" Argument 1 = "osaka" Argument 2 = "yokohama"
Function: function name is assumed as argument 0 then the arguments of the function are argument 1, argument 2 · · ·.
Example)
hoge (tokyo, osaka)--- Argument 0 = "hoge" Argument 1 = "tokyo" Argument 2 = "yokohama"
where to define macro
There are three places to define the macro
1. [macro] category in setting.ini
2. user macro file.
3. Between: psgg-macro-start and: psgg-macro-end in the destination file
※As methods 1 and 2 had been bothersome, method 3 was added.
1. [macro] category in setting.ini
2. user macro file.
3. Between: psgg-macro-start and: psgg-macro-end in the destination file
: psgg-macro-start Macro definitions : psgg-macro-end
※As methods 1 and 2 had been bothersome, method 3 was added.
how to define macro
MacroName = converted valueOr
MacroName = @@@ Conversion value @@@
how to use arguments
{%Number}ie)
#Macro
hoge=I will go to {%1} and {%2}.#Call
$macro:hoge(tokyo,osaka)$#Converted
I will go to tokyo and osaka.
how to use arguments (delete double-quotes)
{%~Number}Delete head and tail double-quotes of the argument string.
ie)
#Macro
hoge=I will go to {%~1}.#Call
$macro:hoge("tokyo and osaka")$#Convert
I will go to tokyo and osaka.
line macro
@Macro-name
Corresponding macro for each row of item value
Example)
#macro
#template
Value of #points
#conversion
Corresponding macro for each row of item value
Example)
#macro
@set = @@@ SetPosition({% 0}, {% 1}); @@@
#template
[[points -> @set]]
Value of #points
100, 50 100, 150 100, 200
#conversion
SetPosition(100, 50); SetPosition(100, 150); SetPosition(100, 200);
special line macro
If there is the same line macro as the item name, it is automatically assigned.
Example)
#macro
#template
Value of #points
#conversion
Example)
#macro
@ points = @ @ @ SetPosition ({% 0}, {% 1}); @@@
#template
[[points]]
Value of #points
100, 50 100, 150 100, 200
#conversion
SetPosition (100, 50); SetPosition (100, 150); SetPosition (100, 200);
line number argument
{% N}At line macro, it indicates the line number.
Radix is 0.
defined macro
$statemachine$ //asis $stateMachine$ //lower camel $StateMachine$ //upper camel $state_machine$ //snakeIt will be converted to state machine name. State machine name is defined at statemachine in setting.ini.
camel macro
$uc:WORD$ //Upper Camel $lc:WORD$ //Lower Camel