|
|
Resets the reference count to zero for the specified macro(s).
Syntax
MACREF pattern
Reference counts are maintained for macros. Each time a macro is invoked, the
reference count for the macro is incremented.
Current reference counts can be displayed with the MACLIST command.
This MACREF command is used to reset macro reference counts.
Parameters
- pattern
The name(s) of the macro(s) for which the reference counts are to be
reset to zero.
This parameter can be specified with wildcards or with a full regular
expression. Refer to appendix A for additional information about pattern
matching and regular expressions.
The following wildcards are supported:
- @
Matches any character(s).
- ?
Matches any alphabetic character.
- #
Matches any numeric character.
The following are valid name pattern specifications:
- @
Matches everything; all names.
- pib@
Matches all names that start with "pib".
- log2##4
Matches "log2004", "log2754", and so on.
The following regular expressions are equivalent to the patterns with
wildcards that are listed above:
`.*`
`pib.*`
`log2[0-9][0-9]4`
Examples
$nmdat > macl @ all
macro driver
machelp = 'This macro calls macros "triple", "min", and "inc" in order' +
'to demonstrate the MACECHO, MACREF, and MACTRACE commands'
{ loc one 1;
loc two 2;
wl min ( triple(two) inc(one) )
}
macro inc
( num : ANY )
machelp = 'returns the increment of "num"'
{ loc temp num;
loc temp temp + 1;
return temp
}
macro min
( parm1 : ANY ,
parm2 : ANY )
machelp = 'returns the min of "parm1" or "parm2"'
{ if parm1 < parm2
then return parm1
else return parm2
}
macro triple
( input : ANY )
machelp = 'triples the parameter "input"'
{ return input *3
}
Assume that the macros listed above have been defined. A few of the
macros use local variables inefficiently, for the purpose of demonstration.
$nmdat > macl @ ref
macro driver ref = #0
macro inc ref = #0
macro min ref = #0
macro triple ref = #0
The MACLIST command is used to display the current reference counts
for all macros. At this point, the reference counts for all macros are zero.
$nmdat > wl inc(4)
$5
$nmdat > wl min(inc(3) inc(0))
$1
$nmdat > macl @ ref
macro driver ref = #0
macro inc ref = #3
macro min ref = #1
macro triple ref = #0
A few macros are invoked, then the MACLIST command is used again to
display the current reference counts. Macro inc has been called three
times, and macro min has been called one time.
$nmdat > macref inc
$nmdat > macl @ ref
macro driver ref = #0
macro inc ref = #0
macro min ref = #1
macro triple ref = #0
The MACREF command is used to reset the reference count for macro
inc. The MACLIST command is used to verify that the count has been
successfully reset.
$nmdat > driver
$2
$nmdat > macl @ ref
macro driver ref = #1
macro inc ref = #1
macro min ref = #2
macro triple ref = #1
Macro driver is invoked, then the reference counts are checked again.
$nmdat > macref @
$nmdat > macl @ ref
macro driver ref = #0
macro inc ref = #0
macro min ref = #0
macro triple ref = #0
The reference counts for all macros are reset to zero.
Limitations, Restrictions
The macro reference count is incremental at macro entry, after
parameter type checking, but before actual execution of the macro
body. The actual macro execution may result in errors and be terminated.
Reference counts, therefore, indicate the number of times the macro
has been called (not the number of times that the macro has been
successfully executed to completion).
|