| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
$x)
To invoke a macro defined by the Define Macro command, you simply use
$macro-id. Cogsys saves the current input position
on the macro stack. The macro-body for the macro is executed
until an "\0" character is read, then processing is resumed
from the saved location.
Starting with Cogsys 3.0.9, macros can take arguments. See Define Macro, for details on defining macros and arguments. To call a macro with arguments, simply enclose the arguments in square brackets immediately after the call.
The "\0" character is appended automatically by the Macro Definition command and users should not normally be concerned about it. However, if your testlist is giving unexpected `MACSTACK_UNDERFLOW' errors, look for accidental insertions of the "\0" character.
Because the default macro definition is simply the "\0" character, calling a macro before it is defined does nothing.
$x
$macro-id
$macro-id[arg1...]
$$a[val]#W1000@C@1411 val #R$$
$$b@C@1414z#R$$
$$1@C#W500@1410#I(R<250) {TOO FAST#W3000} {}$$
$$2#I(R>2000) {TOO SLOW#W1000} {}$$
$$3@C@1410#I(K=&z OR K=&Z) {Correct} { Error} #W2000$$
$$4@C@1410#I(K=&/ OR K=&?) {Correct} { Error} #W2000$$
@C
@1010Press '/' or 'z' when you see that key appear
@1110Be as fast as possible
@1310Press space bar now#R
$a[/]$4$1$2#S/1/
$a[z]$3$1$2#S/2/
$a[z]$3$1$2#S/2/
$a[/]$4$1$2#S/1/
$a[/]$4$1$2#S/1/
$a[z]$3$1$2#S/2/
$a[/]$4$1$2#S/1/
$a[z]$3$1$2#S/2/
@C
@1010Done#W5000
|
$$aPress <return> to continue: #R$$ ... $a |
a. At the $a macro call, Cogsys prints
`Press <return> to continue:' and waits for keypress.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |