|
|
Macro list. Lists the specified macro definition(s).
Syntax
MACL[IST] [pattern] [options]
Macros are always listed in alphabetical order.
Parameters
- pattern
The name(s) of the macro(s) to be listed.
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`
By default, all macros are listed.
- options
Display Options
Special options can be specified to control the level of detail that is
presented for each macro definition.
Any number of the following options can be specified in any order,
separated by blanks:
- NAME
Display the macro name, type. (Default value)
- PARMS
Display parameter names, types, default values.
- NOPARMS
Skip parameter display.
- BODY
Display the macro body as a string.
- FMTBODY
Format the macro body command lines.
- NOBODY
Skip body display.
- VER
Display the MACVER string.
- NOVER
Skip version display.
- KEY
Display the MACKEY string.
- NOKEY
Skip keyword display.
- HELP
Display the MACHELP string.
- NOHELP
Skip help display.
- ALL | @
Display all fields. Same as: NAME PARMS FMTBODY VER KEY
HELP.
- PAGE
Page eject after each macro definition. Useful for paged (list
file) output.
- NOPAGE
No special page ejects. (Default)
If none of the options above are specified, NAME is displayed by
default. If any options are specified, they are accumulated to describe
which fields are printed.
Filter Options
The following options can be used to further restrict which macro
definitions are printed, based on keyword and version matching:
- KEY=keyword
Display only those macros that contain the specified
keyword in their MACKEY keyword string.
- VER=version
Display only those macros that contain the specified
version in their MACVER version string.
The parameters keyword and version are
entered as a single word, or a quoted text string. The interpreter will
search for an exact occurrence of the pattern within the specified string.
Keyword and version comparisons are case sensitive.
- REF
Display the macro reference counts.
- ECHO
Display only macros that have ECHO set.
- TRACE
Display only macros that have TRACE set.
These three special filter options are used to display macro reference
counts, and to display those macros that have special macro debugging
enabled. When any of these three options are specified, only the macro
names are displayed (that is, implicit NOPARMS, NOBODY,
NOHELP, NOKEY, NOVER). A special page of
examples for these options is provided.
Refer to the MACECHO, MACTRACE, and MACREF
commands.
Examples
$nmdat > macl
macro cmpin_db : PTR/LPTR = $0.0
macro cmport_context : PTR/LPTR = $0.0
macro cmport_dst : INT/U16 = $0
macro cmport_name : INT/U16 = $0
macro cmport_record : PTR/LPTR = $0.0
macro config_device_ldev
macro config_device_path
macro config_memory
macro console_ldev
macro convert_string : STR/STR =
macro delete_blanks : STR/STR =
macro event_ci_history
macro event_footprint
macro event_io_trace
macro event_process
macro event_process_errors
macro file_in_use
macro first_entry : PTR/LPTR = $0.0
control-Y encountered
$nmdat >
The MACLIST command, when entered without parameters, lists
all currently defined macros in alphabetically sorted order. By
default, only the macro names, and default return value and type
(if declared) are displayed.
Note that Control-Y can be used to interrupt any MACLIST command.
$nmdat > macl fs_disc_alloc parms
macro fs_disc_alloc : PTR/LPTR = $0.0
([pin_num : INT / U16 = $0] ,
fnum : INT ,
[detail : INT / U16 = $5] ,
[error_parm : STR = 'pad'] )
Display the PARMS (parameters) for macro fs_disc_alloc_parms
$nmdat > macl fs_table all nobody
macro fs_table : UNKN/U16 = $0
( entry_ptr : PTR ,
table : STR ,
[detail : INT / U16 = $1] ,
[field_name : STR = ] )
machelp = 'Print the table and optionally returns the field value'
mackey = 'MXFS HP Q_FS_X_NM EL FS TABLE PLFD GDPD GUFD LACB PACB MVT' +^S
'FMAVT AFT FLAB'
macver = 'A.00.01'
For the macro fs_table, display all macro attributes, except for the
macro body (NOBODY). The macro parameters, help string, keywords
string, and version string are displayed.
$nmdat > macl @sem@
macro pm_semaphores : PTR/LPTR = $0.0
macro rm_build_semaphore_wait_list : STR/STR =
macro rm_sem_blocked_proc : STR/STR =
macro rm_sem_deadlock : STR/STR =
macro rm_sem_owner : INT/U16 = $0
macro rm_semaphore
macro rm_semaphore_info : UNKN/U16 = $0
macro xm_semp
List all macros that match the pattern "@sem@". By default,
only the names of the macros are displayed. Note that default types
and return values are displayed for those macros that have specified
defaults.
$nmdat > macl `.*port_.*`
macro cmport_context : PTR/LPTR = $0.0
macro cmport_dst : INT/U16 = $0
macro cmport_name : INT/U16 = $0
macro cmport_record : PTR/LPTR = $0.0
macro global_port_name : STR/STR =
macro io_ioldm_port_fv
macro io_port_data : UNKN/U16 = $0
macro port_data : PTR/LPTR = $0.0
macro port_global : INT/U16 = $0
macro port_message : PTR/LPTR = $0.0
macro port_record : PTR/LPTR = $0.0
macro ui_job_port_msg : UNKN/U16 = $0
macro ui_jsmain_port_msg : UNKN/U16 = $0
List all macros that match the regular expression pattern
".*port_.*". By default, only the macro names (and default return
values/types) are displayed.
$nmdat > macl @timer@ help
macro format_timer_msg
machelp = 'Formats the timer request list entrys message.'
macro io_timer_list
machelp = 'Formats the timer request list.'
macro start_timer
machelp = 'Sets variable cpustart to current value of HPCPUSECS CI' +
'variable.'
macro stop_timer
machelp = 'Sets variable cputime to current value of HPCPUSECS CI' +
'variable - variable cpustart.'
macro timer
machelp = 'Times events and then prints elapsed cpu time.'
List all macros that match the pattern "@timer@", and display
the MACHELP string for each macro.
$nmdat > macl @ key=CHAIN
macro io_data_chain : UNKN/U16 = $0
macro io_getnext_data_chain : PTR/LPTR = $0.0
List all macros, but only if the pattern CHAIN can be located within
the macro's keyword string, defined with the MACKEY option. By
default, only the names of the macros are displayed.
$nmdat > macl @ key=CHAIN help
macro io_data_chain : UNKN/U16 = $0
machelp = 'Print or returns the specified field form the data chain' +
'record.'
macro io_getnext_data_chain : PTR/LPTR = $0.0
machelp = 'Returns the address of the next data chain entry '+
'associated with the specified I/O request'
List all macros, but only if the keyword CHAIN can be located within
the macro's keyword string, defined with the MACKEY option. Display
the macro name and the MACHELP string for those macros.
$nmdat > macl @ key=GUFD key
macro fs_addr : PTR/LPTR = $0.0
mackey = 'MXFS HP Q_FS_X_NM EL FS FILENAME FILE ADDRESS GUFD'
macro fs_fname_nm : STR/STR =
mackey = 'MXFS HP Q_FS_X_NM EL FS FNAME GUFD'
macro fs_fname_to_gufd : PTR/LPTR = $0.0
mackey = 'MXFS HP Q_FS_X_NM EL FS GUFD GLOBAL UNIQUE FILE DESCRIPTOR'
macro fs_gufd : PTR/LPTR = $0.0
mackey = 'MXFS HP Q_FS_X_NM EL FS GUFD PLFD'
macro fs_table : UNKN/U16 = $0
mackey = 'MXFS HP Q_FS_X_NM EL FS PLFD GDPD GUFD LACB PACB MVT' +
'FMAVT AFT FLAB'
macro fs_ufid_str : STR/STR =
mackey = 'MXFS HP Q_FS_X_NM EL FS GUFD UFID STR'
macro fs_ufid_to_gufd : PTR/LPTR = $0.0
mackey = 'MXFS HP Q_FS_X_NM EL FS UFID TO GUFD'
List all macros, but only those that contain the keyword GUFD within
the macro's keyword string, defined with the MACKEY option. List the
names and the keyword string for those macros.
$nmdat > macl fs_fname_to_gufd all
macro fs_fname_to_gufd : PTR/LPTR = $0.0
( filename : STR )
machelp = 'Returns the address of the GUFD for the specified filename'
mackey = 'MXFS HP Q_FS_X_NM EL FS GUFD GLOBAL UNIQUE FILE DESCRIPTOR FILE'
macver = 'A.00.01'
{ loc save_error_action error_action;
loc vsod_hdr = kso_pointer (kso_number ('kso_vs_od_gu_fd_header'));
loc entry_size = symval (vsod_hdr, 'tbl_hdr.' + 'hdr_entry_size');
loc vsod_rec_size = symlen ('!vs_som:vs_od_type');
ignore quiet;
loc first_entry_ptr = first_entry (vsod_hdr);
if error <> 0
then return NMNIL;
loc max_entry_ptr = first_entry_ptr + symval (vsod_hdr, 'tbl_hdr.' + 'hdr_rs^
rc_block.body_current_size') - vsod_rec_size;
loc filename = strup(filename);
loc vsod_ptr = first_entry_ptr;
var error_action = 'pa';
while vsod_ptr < max_entry_ptr do
{ loc gufd_ptr = vsod_ptr + vsod_rec_size;
loc fname = fs_fname_nm (gufd_ptr);
if fname = filename
then { var error_action = save_error_action;
return gufd_ptr
};
loc vsod_ptr = vsod_ptr + entry_size
};
var error_action = save_error_action;
stderr (HP_FILENAME_NOT_FOUND, 'fs_fname_to_gufd', filename);
return NMNIL
}
Display macro fs_fname_to_gufd. Since the ALL option is
specified, all macros attributes are displayed, including the name, parameters,
help, version, and the full formatted body.
This is a typical macro from the DAT Macros package.
Examples of the ECHO, REF, and TRACE options
$nmdat > macl format@ ref
macro format ref = 0
macro format_job ref = 1
macro format_raw_table ref = 0
macro format_timer ref = 3
Display the REF (reference counts) for all macros that match the
pattern "format@". Macro format_job has been called one time, and
macro format_timer has been called three times.
$nmdat > macl @ trace
macro get_disp_wait_event trace = 3
macro get_element trace = 1
macro get_entry_ptr trace = 3
macro get_sublist trace = 3
macro get_table_info trace = 3
macro kso_number trace = 1
macro kso_pointer trace = 2
List all macros for which the MACTRACE command has been used to enable
tracing of the macro execution. The trace level number is displayed.
$nmdat > maclist @ echo
macro kso_number echo
macro kso_pointer echo
macro port_data echo
List all macros for which the MACECHO command has been used to enable
the echoing of each macro command line during macro execution.
$nmdat > macl @ trace echo all
macro kso_number echo trace = 1
macro kso_pointer echo trace = 2
List all macros that have tracing and echoing enabled. Note that only the macro
names, and the echo and trace information is displayed, even though the
ALL option was requested.
The keywords ECHO, REF, and TRACE restrict the
output display to macro names and the selected option(s). Parameters, keywords,
help strings, versions, and macro bodies are not listed when any one of these
three options are specified on the MACLIST command.
Listing Macros to a File
The following example demonstrates how to produce a paged
listing of all currently defined macros, formatted to a file, one
macro per page. The example is explained command by command, based
on the command numbers that appear within the prompt lines.
%10 (%53) cmdat > list macros
%11 (%53) cmdat > env term_loud false
%12 (%53) cmdat > maclist @ all page
%13 (%53) cmdat > list close
%14 (%53) cmdat > set def
Command %10 opens an offline list file, named
MACROS. All System Debug input and output is recorded into
this file, including the code we intend to display.
Command %11 sets the environment variable
term_loud to FALSE. This prevents subsequent System Debug
output from being displayed on the terminal. We capture the output
in the list file (macros), but we do not want to watch all
of the output on the terminal.
Command %12 contains the MACLIST command. All
attributes of all currently defined macros are displayed. The
PAGE option causes each macro to start on a new page. The
list file contains CCTL (carriage control) information for the
paging.
Command %13 closes (and saves) the current list file
(macros).
Command %14 uses the SET DEFAULT command to
effectively reset the environment variable term_loud back to
TRUE. System Debug output is once again displayed on the terminal.
Limitations, Restrictions
Macros listed into a file are not currently formatted in a style that allows
the macro to be redefined by reading the file back in as a USE file.
The macro pretty printer attempts to format the macro body in a reasonable
manner. Occasionally, the formatting includes extra blank lines, usually as a
result of unnecessary semicolons within the original macro body.
When macros are defined, all comments are removed, and the macro body is stored
in compressed form. The MACLIST command does not display the original
form of the macro body.
|