\input texinfo @c -*-texinfo-*-

@node Top
@top Basic macro calls

Define a  simple macro
@example
@@macro macro1 @{arg1, arg2 @}
result: @@emph@{\arg1\@} protected \\ -> \\arg1\\  @@emp@{\arg2\@}
@@end macro
@end example

before macro after end macro

Calling (normal)
@example
the @@macro1 @{ @@samp@{f\irst arg@}, second arg @} after macro
@end example
==================================

the result: @emph{@samp{first arg}} protected \ -> \arg1\ @emph{second arg } after macro

-----------------------------------

the result: @emph{@samp{first arg}} protected \ -> \arg1\ @emph{second arg } after macro

====================================

Calling (one arg)
@example
@@macro1 @{ @@samp@{f\irst arg@}@}
@end example
==================================

result: @emph{@samp{first arg}} protected \ -> \arg1\ @emph{}

-----------------------------------

result: @emph{@samp{first arg}} protected \ -> \arg1\ @emph{}

====================================

Calling (no args)
@example
@@macro1 @@samp@{f\irst arg@}, second arg
@end example
==================================

result: @emph{} protected \ -> \arg1\ @emph{} @samp{f\irst arg}, second arg

-----------------------------------

result: @emph{} protected \ -> \arg1\ @emph{} @samp{f\irst arg}, second arg

====================================

Calling (three args)
@example
@@macro1 @{ @@samp@{f\irst arg@}, second arg, third arg@}
@end example
==================================

result: @emph{@samp{first arg}} protected \ -> \arg1\ @emph{second arg}

-----------------------------------

result: @emph{@samp{first arg}} protected \ -> \arg1\ @emph{second arg}

====================================

define a macro with one arg
@example
@@macro macro2 @{ arg @}
we get \arg\ and another \arg\
and a last one on another line \arg\

and a last in another paragraph
@@end macro
@end example


Calling
@example
@@macro2 @{ arg, comma \, @}
@end example
==================================

we get arg, comma ,  and another arg, comma , 
and another one on another line arg, comma , 

and a last in another paragraph

-----------------------------------

we get arg, comma , and another arg, comma ,
and another one another line arg, comma ,

and a last in another paragraph

==================================

Calling
@example
@@macro2  arg,  comma \, 
@end example
==================================

we get   arg,  comma \, and another   arg,  comma \,
and another one on another line   arg,  comma \,

and a last in another paragraph

-----------------------------------

we get arg, comma \, and another arg, comma \,
and another one on another line arg, comma \,

and a last in another paragraph

==================================



now @@set comma ,  
@set comma ,

@@set flagab @@ab 
@set flagab @ab

the values:

======================================

flagab: a

b

--------------------------------------

makeinfo result (the macro in set is expanded and all the resulting lines
are replaced):

flagab: a

b

======================================

comma: ,

Calling macro1 with value
@example
@@macro1 @{ arg1 @@value@{comma@} arg2 @}
@end example
=======================================

result: @emph{arg1 , arg2 } protected \ -> \arg1\ @emph{}

---------------------------------------

makeinfo result (the comma don't separate args ; the value is expanded after
arguments parsing):

result: @emph{arg1 , arg2 } protected \ -> \arg1\ @emph{}

=======================================

In verbatim
@verbatim
comma: @value{comma}
@macro1{ bidule, truc}
@end verbatim

@set argument arg 
@set bodyarg \arg\ 

Define macro
@example
@@macro testvaluebody @{ arg @}
result: @@emph@{\@@value@{bodyarg@}\  @} 
@@end macro
@end example


==================================

result: @emph{\\arg\   }

----------------------------------

makeinfo result (according to error message, the value isn't expanded
when the body is expanded; it is kept, but the second \ isn't):

result: @emph{\\arg\  }

==================================

Define macro
@example
@@macro testvalue @{ arg , the@@value@{argument@} @}
result: @@emph@{\arg\@} the \the\ thearg \thearg\ with value \the@@value@{argument@}\
@@end macro
@end example


==================================

result: @emph{macro_arg1} the \the thearg \thearg with value \thearg 

----------------------------------

makeinfo (breaks) result:

result: @emph{macro_arg1} the \the thearg \thearg with value \thearg

==================================

Define macro without arg
@example
@@macro test1
test1
@@end macro
@end example


Call with @{@}:

==================================

test1 abc

----------------------------------

test1 abc

==================================

Call with something on the line

==================================

test1 abc

----------------------------------

test1 abc

==================================

An empty set value

@set myspace

1  1

@contents
@bye
