This section describes window
subcommands, how to issue commands, and how placeholders are used in debugger
commands.
This section explains window
commands that are issued outside the PROFILE and configuration files. See Debugger PROFILEs, Configuration Files, and EXECs for information
about the window
command in a PROFILE or configuration
file.
The window
command is
used to perform a variety of window functions: clearing windows, closing
windows, moving windows, opening windows, resizing windows, scrolling windows,
and so on. Each of these functions is performed by a subcommand of the window
command. For example, to use the scroll
source up
subcommand, you type window scroll
source up
; scroll
is a subcommand
of the window
command.
On completing its execution of most window-oriented
commands, the debugger does not move the cursor out of the window. Therefore,
the following commands, which are issued when the debugger is running, are
useful when they are assigned to PF keys:
The usual abbreviation conventions, which apply to all
debugger commands, also apply to these subcommands. A complete description
of each subcommand is provided in Command Directory.
Commands can
be issued by typing them in the Command window and
pressing the ENTER key. However, this can be quite cumbersome for frequently
used commands, for example, scroll up
, scroll down
, and close
.
Window commands,
like most other commands, can be assigned
to PF keys. See Using PF Keys for details about default PF key assignments and how they may be modified.
Many
commands, including window
subcommands and
commands that take expressions as arguments, can be assigned to PF keys using
a placeholder to indicate the position at which an argument is to be inserted.
If a command contains a placeholder, then the position of the cursor is used
to determine the value of the argument that is inserted in place of the placeholder.
Several of the window
subcommands take WINDOW-NAME as a command argument. If you want to use the
cursor to point to the window, a placeholder (syntax <
>) is used in these subcommands instead of the window
name.
The following example illustrates the use of placeholders
with window
subcommands. Most windows can be
scrolled back using the following command:
window scroll WINDOW-NAME up
You could assign this command to a PF key as a text
string, substituting the name of a window for WINDOW-NAME. Whenever you press
the assigned PF key, the window would be scrolled up. However, you can also
assign the following command to a PF key:
window scroll < > up
Pressing the PF key that is assigned to this command
causes the window that the cursor is in to scroll up.
You
can also use placeholders with commands that take expressions, thus simplifying
the execution of frequently used expression-handling commands. One or more
placeholders, < >, can be specified in a command that is assigned to a
PF key. When you issue this command by pressing the PF key, you can use the
cursor to point to the expression that replaces all occurrences of the placeholder
in the command.
For example, the print
command can be submitted, like any other command, in the Command window.
However, as print
is one of the most commonly
used commands to display expressions, you can assign print
< > to a PF key. Moving the cursor to an expression and
pressing that PF key would cause the debugger to replace the placeholder with
the expression, and issue the print
command.
Similarly, in an application that performs much text-string
manipulation, you may frequently issue a dump expression str
command. You can assign dump < > str
to a PF key. Moving the cursor to an expression and pressing that PF key
would cause the debugger to replace the placeholder with the expression, and
dump the string.
Expression extraction Expressions
occupying contiguous characters on one line in a window can be substituted
for a placeholder in a command that is assigned to a PF key. The process of
extracting an expression for substitution in a command is referred to as expression extraction. If the area of the window that contains
the expression is unprotected, you can modify the expression before extraction.
The debugger uses an algorithm to identify the portion
of the expression that replaces the placeholder. The rules for determining
the extracted expression are described in the following section.
The debugger uses an algorithm to
extract expressions from the
surrounding text. The debugger first does a preliminary backward scan until
it encounters one of the following characters: a left parenthesis, a right
parenthesis, a left bracket, or a character that is valid in an identifier.
For debugger purposes,
$
is also considered to be a character
that is valid in an identifier. (If the debugger is already on such a character,
this preliminary scan is not needed.) If the backward scan cannot find one
of these characters, there is no expression to be extracted. Processing then
depends on the character that is encountered:
-
If the character is a left parenthesis, the debugger
scans forward through all text until it sees a matching right parenthesis
that is considered part of the expression. Both parentheses are also included
in the expression.
-
If the character is a right parenthesis, the debugger
scans backward through all text until it sees a matching left parenthesis
that is considered part of the expression. Both parentheses are also included
in the expression.
-
If the character is not a parenthesis, it must
be a left bracket or a character that is valid in an identifier. This position
is marked as the tentative end.
Note:
If this character
that is valid in an identifier is not part of an identifier, results may be
unpredictable.
A backward scan now begins, either from the character
in question (if it is valid in an identifier) or from the character that is
before the character in question (if on a left bracket). The debugger scans
over characters that are valid in identifiers, dot operators, and arrow operators.
White space terminates the scan. If it encounters any right brackets in the
backward scan, all text (including white space) up to the corresponding left
bracket is automatically included, and the scan then resumes. Any right parenthesis
that immediately precedes a dot or arrow has the result that all text up to
the corresponding left parenthesis is automatically included. The position
at which the scan terminates marks the start of the expression to be extracted.
A forward scan is done next from the tentative end to
obtain the actual end of the expression to be extracted. If the tentative
end was a left bracket, the forward scan ends at the corresponding right bracket;
otherwise, the rest of the identifier is scanned.
Placeholder Expression Extraction illustrates how the
expression to be extracted depends on cursor position.
When you read the table, assume the cursor is at the position shown in the
expression in the first column. The third column shows the extracted text.
The examples illustrate what would happen if the cursor were in one of several
positions. In those cases, the cursor appears somewhere within the range
indicated by the text shown in the second column of Placeholder Expression Extraction.
TABLE NOTE 1:
All of the ranges listed in the Cursor Position
column include a leading blank
space except for mem2
and pntr
. Placing your cursor in the leading blank returns the extracted
text the same as placing your cursor within the rest of the range.
As shown by Placeholder Expression Extraction,
arbitrary expressions may be extracted by surrounding them with parentheses.
When the cursor is moved under the expression that is
to replace the placeholder, and one of the methods described in Methods of Issuing Commands is used to execute the
command, the debugger extracts the expression and substitutes it for the placeholder
in the command being issued.
The algorithm used by the debugger to extract expressions
does not handle numeric constants; positioning the cursor on numeric constants
may lead to unpredictable results. However, numeric constants can be specified
as part of an expression enclosed in parentheses.
Copyright © 2001
by SAS Institute Inc., Cary, NC, USA. All rights reserved.