HPlogo System Debug Reference Manual > Chapter 6 System Debug Command Specifications M-X

MACECHO

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Controls the "echoing" of each macro command line prior to its execution.

Syntax



   MACECHO pattern [level]

Parameters


pattern

The name(s) of the macro(s) for which echoing is to be enabled/disabled.

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`

level

Echoing can be enabled or disabled (default). The following values are valid:

0

Disabled (default).

1

Enabled.

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 > driver
   $2

When a macro is called, the commands in the macro body are typically executed silently. They are not displayed as they are being executed. In this example, macro driver executes silently, and only the expected macro output is displayed.

   $nmdat > macecho driver 1
   $nmdat > driver
     driver > loc one 1
     driver > loc two 2
     driver > wl min ( triple(two) inc(one) )
   $2

In this example, echoing is enabled for macro driver. Then, when the macro is executed, each command line in the macro body is displayed just prior to the execution of that line.

   $nmdat > macecho min 1
   $nmdat > driver
     driver > loc one 1
     driver > loc two 2
     driver > wl min ( triple(two) inc(one) )
        min > if parm1 < parm2 then return parm1 else return parm2
        min > return parm2
   $2

In this example, echoing is enabled for macro min, in addition to macro driver which remains enabled from above. Command lines are displayed for both macros. Notice that the command lines for macro min are indented, since it is called by macro driver. At each nested level of macro invocation, an additional three blanks are added as indentation.

   $nmdat > macecho @ 1
   $nmdat > driver
     driver > loc one 1
     driver > loc two 2
     driver > wl min ( triple(two) inc(one) )
        triple > return input *3
        inc > loc temp num
        inc > loc temp temp + 1
        inc > return temp
        min > if parm1 < parm2 then return parm1 else return parm2
        min > return parm2
   $2

In this example, echoing is enabled for all ("@") currently defined macros. Each command line, for every macro, is displayed before the command line is executed.

   $nmdat > macecho @
   $nmdat > driver
   $2

In this example, echoing is disabled for all macros. Since the level parameter is not specified, the default of disabled is assumed. Execution of the macro driver is silent once again.

   $nmdat > macecho min 1
   $nmdat > driver
        min > if parm1 < parm2 then return parm1 else return parm2
        min > return parm2
   $2
   $nmdat > macl @ echo
   macro min  echo

In this example, echoing is enabled for macro min. The command lines for macro min are displayed, indented. The MACLIST command is used to display all macros that currently have ECHO enabled, and macro min is indicated.

Limitations, Restrictions


none




MACD[EL]


MACL[IST]