rejetto forum

Macros: '^' , 'call' and 'set' Be a prelude to the wiki

Mars · 6 · 3498

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Defined as:

{{set | A | B }}   and called by  {{^A}} or {{call | A }}

A is the name of the variable that you want to define
B is the text of replacement

{{set | rejetto | is the big boss }}       {{^rejetto}}  {{call | rejetto}}


*********************************************************

{{set | A | $1...  $2 .. $3  ...   /set}}   

A is the name of the variable that you want to define
$1,$2,..... are the parameters by defined order

{{set | rejetto | $1 $2  $3  $4 }}         {{^rejetto| is |the | big| boss}}   {{call | rejetto | is |the | big| boss}}


{{set | rejetto | $4 $3  $2  $1 }}         {{^rejetto| boss | big | the | is}}    {{call |rejetto| boss | big | the | is}}



*********************************************************

{{set | A | {{\ {{macroname | $1 | $2 | $3 | ...}}  /}} /set}}

A is the name the macro that you want to redefine
$1,$2,..... are the parameters by defined order

examples:


{{set | left | {{\ {{cut | 1 | $1 | $2}}  /}} }}    {{^left | 7 |Rejetto is the big boss}}
{{set | right | {{\ {{cut | -$1 | -1 | $2}}  /}} }}    {{^right | 4 |Rejetto is the big boss}}
{{set | mid | {{\ {{cut | $1 | $2 | $3}}  /}} }}    {{^mid | 8 |11 |Rejetto is the big boss}}


The call of the function or of the variable can be made by two manners:

{{^A | B | C | D |....}}
or
{{call | A | B | C | D |....}}

{{call | left | 7 |Rejetto is the big boss}}

*******************************************************

you can use A as a numeric value

{set | nb | 5 }}

{{^nb}}  = 5

{{inc | nb | 6 }}      {{^nb}}  = 11

-----------

{set | nb | 5 }}

{{dec | nb | 8 }}       {{^nb}}  = -3

{{inc | nb }}   and   {{dec | nb }}   They also work by step of 1



Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
by reading this explanation someone may think i'm an arrogant, while i'm just somewhat conceited.

inc will work with no parameters from next build.
dec is not planned. i guess {{inc|x| -5}} is enough.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
Quote
|Rejetto is the big boss}}

by reading this explanation someone may think i'm an arrogant, while i'm just somewhat conceited.

It is just of the gratitude for all the work made with hfs

Quote
inc will work with no parameters from next build.
dec is not planned. i guess {{inc|x| -5}} is enough.

if inc will work with no parameter as {{inc|x}} then we must have {{dec|x}}

if (name ='inc') and (pars.count=1) then result:=p+1else result:=p+par(1)
if (name ='dec') and (pars.count=1) then result:=p-1 else result:=p-par(1)      juste une petite ligne en plus  ;D ;D ;D

It is possible somewhere to have the necessity of writing

{{dec|x|{{^y}} }}  and nothing as  {{inc|x|  - {{^y}} }} 

forget - and result is not same as you like



Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
il n'est pas une ligne mais quatre ;)
of course if you forget "-" the result is not the same, just as if you forget "^", you must always be careful, almost every character is important.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
yes but if you forget ^

{{name}} return an error text, when name is not an implemented macro as CUT, ce qui est quand même plus facile à détecter dans le template  mais une erreur de signe ca ne pardonne pas, ça peut vous envoyer dans des boucles sans fin

Quote
i=10
x=2
while  i > 0 do begin
...
inc (i,-x)
end