| United States-English |
|
|
|
![]() |
HP OpenVMS Systems Documentation |
DECset
|
| Previous | Contents | Index |
You can transport user-written TPU procedures from EVE to LSE. Therefore, you can use code that calls EVE procedures within LSE.
The following LSE variables are now procedures. If a TPU procedure accesses the value of the corresponding variable, but does not assign a value to it, the TPU procedure should continue to work. If a TPU procedure must change the value of one of the following variables, you should change the TPU code to use the corresponding EVE variable, if any, shown in parentheses.
To tailor window-status lines, see the information on EVE status-line
fields in the DIGITAL Text Processing Utility Manual.
A.2.1 Adding User-Written TPU Procedures
You can add user-written TPU procedures to LSE with the DECTPU tool EVE$BUILD. You use EVE$BUILD for modifying or adding user-written TPU procedures to LSE. EVE$BUILD compiles DECTPU code with an existing LSE section file to produce a new section file. See the DIGITAL Text Processing Utility Manual for more information on using EVE$BUILD.
To extend LSE with EVE$BUILD, do the following:
sys$login:abbreviation.tpu lseplus:auto_indent.tpu sys$login:customizations.tpu |
$ BUILD == "LSEDIT/NODISP/NOINIT/COMM=SYS$EXAMPLES:EVE$BUILD" |
$ BUILD USER %TPU-S-FILEIN, xxx lines read from file SYS$EXAMPLES:EVE$BUILD.TPU Definition of procedure EVE$BUILD_MODULE_INDENT superceded . . . Definition of procedure EVE$BUILD superceded Section file name [default = product name USER]: |
To use this newly created section file, invoke LSE with the /SECTION
qualifier and supply the full file specification that corresponds to
the section file. Alternatively, you can define the logical name
LSE$SECTION to be the full file specification for this new section file.
A.2.2 DECTPU Programming with Hidden Records in LSE
With LSE, you use the COLLAPSE, EXPAND, FOCUS, and VIEW SOURCE commands for viewing source code. This code elision feature means that there can be four different types of records (or lines) in a buffer. A record can be a source record or an overview record, and can be visible or hidden.
Source records correspond to the actual text that is read from a file, edited, and written to a file. Overview records are inserted by LSE and are representatives for source records that have been hidden or omitted. Overview records themselves are hidden when the corresponding source is made visible. Overview records might also be hidden along with source records, such as when a set of lines containing both source lines and overview lines is collapsed to an overview.
Thus, the four types of records are as follows:
With TPU, the current position in a buffer can be on any one of these types of records. The TPU built-ins MOVE_VERTICAL and MOVE_HORIZONTAL move from record to record and are not influenced by the visibility or whether the record is an overview. A TPU procedure that does not consider visibility or overview records might not function as intended if you use the elision facility prior to calling the procedure.
After each LSE command, if the current position is not on a visible record, LSE makes the record visible. If the current position is on a hidden source record, LSE expands sufficient overviews to make the record visible. If the current position is on a hidden overview record, LSE collapses the source to make the overview visible.
Overview records are not modifiable. If you attempt to alter the text, split the record, or append the record to another record, it will fail.
A number of built-ins are available for you to enhance or develop TPU procedures to work when there are overviews or hidden records in a buffer. The built-ins are listed here and described in Section A.3:
LSE supports new DECTPU built-in procedures and extends some of the
existing built-ins, as described in the following sections.
A.3.1 LSE$DO_COMMAND (String)
Takes a single character string as its argument. It executes the string
as an LSE command. You can use this built-in to execute LSE commands
from within your DECTPU procedures.
A.3.2 LSE$GET_ENVIRONMENT( String, Keyword)
Incorporates the definitions contained in an environment file into the editing session. There are two arguments, as follows:
Returns a string representing the name of the language currently
associated with the given buffer. If there is no language associated
with the buffer, the integer 0 is returned.
A.3.4 GET_INFO(buffer, "overviews")
Returns the keyword ON or OFF, based on whether overview operations are
allowed in the given buffer.
A.3.5 GET_INFO(COMMAND_LINE, item)
LSE provides the following additional COMMAND_LINE items for the GET_INFO built-in:
Returns a range that corresponds to the first open-comment delimiter found after the marker, but on the same line as the marker.
Returns 0 if there is no language associated with the buffer containing
the marker.
A.3.7 LSE$FIND_CLOSE_COMMENT (marker)
Returns a range that corresponds to the first close-comment delimiter found after the marker, but on the same line as the marker.
Returns 0 if there is no language associated with the buffer, or if no
close comment is found.
A.3.8 LSE$IS_OVERVIEW [(marker)]
Returns 1 if the indicated record is an overview record and 0 if it is
a source record. If the marker parameter is not specified, the current
record is used.
A.3.9 LSE$IS_VISIBLE [(marker)]
Returns 1 if the indicated record is a visible record and 0 if it is a
hidden record. If the marker parameter is not specified, the current
record is used.
A.3.10 LSE$MOVE_HORIZONTAL (integer)
Restricts the cursor to visible records. LSE does not count the
characters or end-of-line on hidden lines when determining where to
establish the new editing point. If the original editing point is on a
hidden record, the movement to a visible record counts as a move of one
line. (Similar to the TPU MOVE_HORIZONTAL built-in.)
A.3.11 LSE$MOVE_VERTICAL (integer)
Restricts the cursor to visible records. Hidden records are not counted
as they are traversed and the cursor cannot be left on a hidden record.
A.3.12 LSE$MOVE_BY_SOURCE (integer)
Restricts the cursor to source records only. LSE does not count
overview lines when determining where to establish the new editing
point. If the original editing point is on an overview line, the
movement to a source line counts as a move of one line. If the source
line on to which the cursor is to move is hidden, LSE$MOVE_BY_SOURCE
makes the source line visible. (Similar to the TPU MOVE_VERTICAL
built-in.)
A.3.13 LSE$MAKE_VISIBLE (marker|range)
Makes the specified records visible. If a marker is specified, LSE
makes the corresponding record visible by expanding overview lines. If
a range is specified, LSE makes all the source records in the range
visible by expanding sufficient overviews.
A.3.14 LSE$NEAREST_VISIBLE (marker)
Moves the editing position to the beginning of the visible line nearest
to the specified position. If the record at the specified position is
visible, it moves the current editing position there. If the marker
parameter is not specified, the current editing position is used. This
is useful for operations that move the editing position to a new record
but should not change the view, for example, moving the cursor by using
a scroll bar, or moving the cursor to a window where the last position
in that window has become hidden.
A.3.15 LSE$SOURCE_ONLY (range)
Returns 1 if all the source records within the range are visible;
otherwise it returns 0. If all the source records within the range are
visible, then, as a side effect, all the hidden overview records in the
range are deleted. This function is useful when writing a TPU procedure
that operates on a range. It does not operate properly if there are
hidden records or overview records in the range. For example, this
built-in is used in the procedure that implements the FILL operation.
A.3.16 LSE$MOVE_TEXT and LSE$COPY_TEXT (string|range|buffer)
Move or copy the text from the specified string, range, or buffer to the current editing position and return the resultant range. If the input is a string, these functions are equivalent to MOVE_TEXT and COPY_TEXT. For ranges and buffers, the LSE functions preserve overview information. (Similar to the TPU built-ins MOVE_TEXT and COPY_TEXT.)
Overview information is language-dependent, so the language associated with the input range or buffer must be the same as the language associated with the current buffer. If the input language is not the same as the language for the current buffer, there are side effects, as follows:
If LSE$MOVE_TEXT is given a range, any hidden overview lines immediately preceding the range are deleted.
If there are overview records in a range or buffer, the TPU functions MOVE_TEXT and COPY_TEXT change the overview records into source records. Visibility of records is preserved.
LSE$COPY_TEXT and LSE$MOVE_TEXT will not operate on an input range that
includes part, but not all, of an overview line. An overview line
includes the line break at its end.
A.3.17 SET (LSE$LANGUAGE, buffer, language)
Associates or disassociates a language and a buffer. See the descriptions of the SET LANGUAGE and SET NOLANGUAGE commands in this manual for a more complete discussion of associating a language with a buffer.
The arguments to the built-in are the keyword LSE$LANGUAGE, followed by
a buffer variable, followed by the language string. The literal current
buffer can be used as the buffer variable. The language string can be
passed as double quotes (""), which results in disassociating
the language from the buffer.
A.3.18 SET (LSE$OVERVIEWS, buffer, on/off)
Enables or disables overview operations in the indicated buffer. See the descriptions of the SET OVERVIEW and SET NOOVERVIEW commands in this manual for a more complete description of overview operations.
The arguments to the built-in are the keyword LSE$OVERVIEWS, followed
by a buffer variable, followed by either the keyword ON or the keyword
OFF. You can use the literal current_buffer as the buffer varible.
A.3.19 TPU Built-ins for the SCA Callable Interface
There are TPU built-ins for the SCA$QUERY_xxx functions in the new SCA callable interface. Specifically, the built-ins are as follows:
None of the other routines are available. LSE calls SCA$INITIALIZE and SCA$CLEANUP automatically for you. The command context created by LSE is available in the TPU variable LSE$SCA_COMMAND_CONTEXT; you must use this as the first parameter to call SCA$QUERY_INITIALIZE.
SCA message codes are available as TPU keywords, as in the conventional format SCA$_xxx. These can be used as message constants for the TPU MESSAGE built-in.
SCA constants for the attribute kinds are available as TPU constants in
the form SCA$K_ATTRI_xxx. These can be passed directly to
SCA$QUERY_GET_ATTRI_VALUE_T.
LSE handles the calling sequences for you. You need not be concerned with whether objects are passed by value or reference.
Note that TPU does not produce a traceback if an SCA routine signals an error.
This appendix contains information of interest to DIGITAL Fortran and
DIGITAL COBOL programmers. Section B.1 provides information on using
DIGITAL Fortran with LSE. Section B.2 provides information on using
DIGITAL COBOL with LSE.
B.1 DIGITAL Fortran
Some LSE commands behave differently when the definition of the current language includes the /FORTRAN qualifier. The syntax of this qualifier is as follows:
/FORTRAN=[NO]ANSI_FORMAT |
ANSI_FORMAT specifies that templates should be expanded in ANSI format. The default is NOANSI_FORMAT (tab format).
To choose a format that is different from the format specified in the /FORTRAN qualifier on the language definition, use the MODIFY LANGUAGE command and specify /FORTRAN=ANSI_FORMAT or /FORTRAN=NOANSI_FORMAT. (See the MODIFY LANGUAGE command in the Command Dictionary for more information on the /FORTRAN=[NO]ANSI_FORMAT qualifier.)
The DIGITAL Fortran compiler supports two source-line formats: ANSI format and tab format.
DIGITAL Fortran differs from the other languages supported by LSE in that each source line is divided into three fields. These fields are as follows:
In ANSI format, the first five characters contain the line number and padding blanks. The sixth character is nonblank and nonzero if the line is a continuation of the last line. The DIGITAL Fortran statement field begins at the seventh character and the line terminates with the 72nd character. Any characters after the 72nd character are ignored.
In tab format, the optional line number appears first on the line and
is terminated by a tab character. If the character after the tab is a
nonzero digit, that digit is the continuation field. The character
after the continuation field begins the statement field. If the
character after the tab is a nondigit character, that character begins
the statement field.
B.1.1 Token and Placeholder Definitions
The bodies of DIGITAL Fortran tokens and placeholders should be entered
as legal source lines in tab format. This allows LSE to determine the
fields and permit the lines to contain statement number and
continuation fields. If ANSI_FORMAT is specified, LSE converts the body
to ANSI format when the body is expanded into the source file. A
placeholder appearing in the statement number field is limited to five
characters and must be a terminal placeholder.
B.1.2 Entering and Erasing Text
When a placeholder is erased from the statement number field in ANSI_FORMAT mode, it is replaced with blanks.
When a placeholder in the statement field is expanded, the statement number and continuation fields of the first line of the placeholder body are ignored and the statement field is inserted at the position vacated by the placeholder.
Note that the procedure for expanding tokens is identical.
B.1.3 Indentation
Indentation of FORTRAN statements is done only in the statement field, rather than at the beginning of a line as for other languages. Tab stops are set for the statement field only, with column 1 being the first character of the statement field.
An ENTER TAB or TAB command (bound to the TAB key) entered at the beginning of a line inserts a tab character in NOANSI mode. In ANSI mode, a tab at the beginning of a line moves the cursor to the statement field. Erasing one character backwards at that point puts the cursor in the continuation field.
An ENTER TAB or TAB command entered at the beginning of the statement
field inserts the current indentation.
B.2 DIGITAL COBOL
Within the DIGITAL COBOL placeholders, you see the following three notations:
In the notation [placeholder ..], the space and two dots following the placeholder indicate that, upon expansion, you will see more details of the placeholder and not just the keywords that appear within the brackets.
The notation [placeholder]... is a list placeholder. The three dots indicate that the placeholder will be duplicated upon expansion.
The notation [placeholder].... is a list placeholder followed by punctuation, in this case, a period. The first three dots indicate that the placeholder will be duplicated upon expansion. Upon removal of the duplicated placeholder, a period will end the line.
| Previous | Next | Contents | Index |
|
|||||||||||||||