123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- \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 @macro macro1 { arg1 , arg2 }
- result: @emph{\arg1\} protected \\ -> \\arg1\\ @emph{\arg2\}
- @end macro after end macro
- Calling (normal)
- @example
- the @@macro1 @{ @@samp@{f\irst arg@}, second arg @} after macro
- @end example
- ==================================
- the @macro1 { @samp{f\irst arg}, 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
- ==================================
- @macro1 { @samp{f\irst arg}}
- -----------------------------------
- result: @emph{@samp{first arg}} protected \ -> \arg1\ @emph{}
- ====================================
- Calling (no args)
- @example
- @@macro1 @@samp@{f\irst arg@}, second arg
- @end example
- ==================================
- @macro1 @samp{f\irst arg}, second arg
- -----------------------------------
- result: @emph{} protected \ -> \arg1\ @emph{} @samp{f\irst arg}, second arg
- ====================================
- @ifhtml
- Calling (three args)
- @example
- @@macro1 @{ @@samp@{f\irst arg@}, second arg, third arg@}
- @end example
- ==================================
- @macro1 { @samp{f\irst arg}, second arg, third arg}
- -----------------------------------
- result: @emph{@samp{first arg}} protected \ -> \arg1\ @emph{second arg}
- ====================================
- @end ifhtml
- 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
- @macro macro2 { arg }
- we get \arg\ and another \arg\
- and another one on another line \arg\
- and a last in another paragraph
- @end macro
- Calling
- @example
- @@macro2 @{ arg, comma \, @}
- @end example
- ==================================
- @macro2 { arg, comma \, }
- -----------------------------------
- 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
- ==================================
- @macro2 arg, comma \,
- -----------------------------------
- we get arg, comma \, and another arg, comma \,
- and another one on another line arg, comma \,
- and a last in another paragraph
- ==================================
- @macro ab
- a
- b
- @end macro
- now @@set comma ,
- @set comma ,
- @@set flagab @@ab
- @set flagab @ab
- the values:
- ======================================
- flagab: @value{flagab}
- --------------------------------------
- makeinfo result (the macro in set is expanded and all the resulting lines
- are replaced):
- flagab: a
- b
- ======================================
- comma: @value{comma}
- Calling macro1 with value
- @example
- @@macro1 @{ arg1 @@value@{comma@} arg2 @}
- @end example
- =======================================
- @macro1 { arg1 @value{comma} arg2 }
- ---------------------------------------
- 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
- @macro testvaluebody { arg }
- result: @emph{\@value{bodyarg}\ }
- @end macro
- ==================================
- @testvaluebody{macro_arg1}
- ----------------------------------
- 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
- @macro testvalue { arg , the@value{argument} }
- result: @emph{\arg\} the \the\ thearg \thearg\ with value \the@value{argument}\
- @end macro
- ==================================
- @testvalue{macro_arg1}
- ----------------------------------
- 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
- @macro test1
- test1
- @end macro
- Call with @{@}:
- ==================================
- @test1{} abc
- ----------------------------------
- test1 abc
- ==================================
- Call with something on the line
- ==================================
- @test1 abc
- ----------------------------------
- test1 abc
- ==================================
- An empty set value
- @set myspace
- 1 @value{myspace} 1
- @contents
- @bye
|