VSI DECset for OpenVMS Language-Sensitive Editor Command-Line Interface and Callable Routines Reference Manual
- Software Version:
- DECset Version 12.7
- Operating System and Version:
- VSI OpenVMS IA-64 Version 8.4-1H1 or higher
VSI OpenVMS Alpha Version 8.4-2L1 or higher
Preface
This reference provides information on how to use the VSI Language-Sensitive Editor (LSE) command-line interface and callable routines on OpenVMS systems.
1. About VSI
VMS Software, Inc. (VSI) is an independent software company licensed by Hewlett Packard Enterprise to develop and support the OpenVMS operating system.
2. Intended Audience
This reference is intended for experienced programmers and technical managers.
3. Document Structure
Chapter 1, Using LSE on OpenVMS Systems provides OpenVMS operating system-specific information for using LSE.
Chapter 2, Using LSE Callable Routines describes the LSE callable interface routines and how to use them.
4. Related Documents
The following documents are also helpful when using LSE:
The VSI DECset for OpenVMS Language-Sensitive Editor/Source Code Analyzer Reference Manual provides a description of the LSE commands.
The VSI DECset for OpenVMS Guide to Language-Sensitive Editor provides a tutorial description on the use of the LSE commands from the DECwindows interface, and contains other important user information.
LSE is a component of the VSI DECset toolkit. For more information on other VSI DECset components, see the reference manuals for the individual components.
5. References to Other Products
Note
These references serve only to provide examples to those who continue to use these products with VSI DECset.
Refer to the Software Product Description for a current list of the products that the VSI DECset components are warranted to interact with and support.
6. OpenVMS Documentation
The full VSI OpenVMS documentation set can be found on the VMS Software Documentation webpage at https://docs.vmssoftware.com.
7. VSI Encourages Your Comments
You may send comments or suggestions regarding this manual or any VSI document by sending electronic mail to the following Internet address: <docinfo@vmssoftware.com>
. Users who have VSI OpenVMS support contracts through VSI can contact <support@vmssoftware.com>
for help with this product.
8. Conventions
VMScluster systems are now referred to as OpenVMS Cluster systems. Unless otherwise specified, references to OpenVMS Cluster systems or clusters in this document are synonymous with VMScluster systems.
The contents of the display examples for some utility commands described in this manual may differ slightly from the actual output provided by these commands on your system. However, when the behavior of a command differs significantly between OpenVMS Alpha and Integrity servers, that behavior is described in text and rendered, as appropriate, in separate examples.
In this manual, every use of DECwindows and DECwindows Motif refers to DECwindows Motif for OpenVMS software.
Convention | Meaning |
---|---|
Ctrl/ x |
A sequence such as Ctrl/ x indicates that you must hold down the key labeled Ctrl while you press another key or a pointing device button. |
PF1 x |
A sequence such as PF1 x indicates that you must first press and release the key labeled PF1 and then press and release another key or a pointing device button. |
Return |
In examples, a key name enclosed in a box indicates that you press a key on the keyboard. (In text, a key name is not enclosed in a box.) |
… |
A horizontal ellipsis in examples indicates one of the
following possibilities:
|
. . . |
A vertical ellipsis indicates the omission of items from a code example or command format; the items are omitted because they are not important to the topic being discussed. |
( ) |
In command format descriptions, parentheses indicate that you must enclose the options in parentheses if you choose more than one. |
[ ] |
In command format descriptions, brackets indicate optional choices. You can choose one or more items or no items. Do not type the brackets on the command line. However, you must include the brackets in the syntax for OpenVMS directory specifications and for a substring specification in an assignment statement. |
[ |] |
In command format descriptions, vertical bars separate choices within brackets or braces. Within brackets, the choices are options; within braces, at least one choice is required. Do not type the vertical bars on the command line. |
{ } |
In command format descriptions, braces indicate required choices; you must choose at least one of the items listed. Do not type the braces on the command line. |
bold text |
This typeface represents the introduction of a new term. It also represents the name of an argument, an attribute, or a reason. |
italic text |
Italic text indicates important information, complete titles of manuals, or variables. Variables include information that varies in system output (Internal error number), in command lines (/PRODUCER= name), and in command parameters in text (where dd represents the predefined code for the device type). |
UPPERCASE TEXT |
Uppercase text indicates a command, the name of a routine, the name of a file, or the abbreviation for a system privilege. |
|
Monospace type indicates code examples and interactive screen displays. In the C programming language, monospace type in text identifies the following elements: keywords, the names of independently compiled external functions and files, syntax summaries, and references to variables or identifiers introduced in an example. |
- |
A hyphen at the end of a command format description, command line, or code line indicates that the command or statement continues on the following line. |
numbers |
All numbers in text are assumed to be decimal unless otherwise noted. Nondecimal radixes—binary, octal, or hexadecimal—are explicitly indicated. |
Chapter 1. Using LSE on OpenVMS Systems
1.1. Introduction
This chapter describes basic information for using VSI Language-Sensitive Editor (LSE) on OpenVMS systems.
LSE is a multilanguage text editor that speeds up writing and compiling source code. It is part of the DECset family of software development tools. Each of the DECset tools enable you to take advantage of the multilanguage software development capabilities on OpenVMS systems.
How logical names are used by LSE
Format of the LSE command line and detailed descriptions of each command-line qualifier
Using the command languages
Templates for subroutine packages
Diagnostic file support
The LSE commands referenced in this document are for the VMSLSE and Portable command languages. For information on the LSE callable interface, see Chapter 2, Using LSE Callable Routines.
1.2. LSE Logical Names
Logical Name |
Description |
---|---|
LSE$READ_ONLY_DIRECTORY |
Logical for read-only directories. Same as using the SET DIRECTORY READONLY command, except it can be executed from the DCL command line. Define this logical to be a list of directories for which LSE will create read-only buffers for input files from within them. |
LSE$SOURCE |
Logical for source directories. Same as using the SET DIRECTORY SOURCE command, except it can be executed from the DCL command line. Define this logical to be a list of directories for LSE to use when locating files. |
LSE$INITIALIZATION |
Logical for an initialization file. Same as invoking LSE with the /INITIALIZATION qualifier. |
LSE$COMMAND |
Logical for a command file. Same as invoking LSE with the /COMMAND qualifier. |
LSE$ENVIRONMENT |
Logical for an environment file. Same as invoking LSE with the /ENVIRONMENT qualifier. |
LSE$SECTION |
Logical for a command file. Same as invoking LSE with the /SECTION qualifier. |
LSE$SYSTEM_ENVIRONMENT |
Logical for an environment file. Same as invoking LSE with the /SYSTEM_ENVIRONMENT qualifier. |
LSE$CURRENT_FILE |
Logical for the current file. Set to the last file edited by LSE and used when LSE is started, if no file is specified (unless the qualifier /NOCURRENT_FILE is specified ). |
LSE$START_LINE |
Logical for the current file. Holds the line of the last editing position in the last file edited by LSE. |
LSE$START_CHARACTER |
Logical for the current file. Holds the character of the last editing position in the last file edited by LSE. |
LSE$EXAMPLE |
Logical that points to the LSE examples directory. |
1.3. Using Command Languages
LSE has two command languages available: VMSLSE and Portable. The VMSLSE command language is the original LSE command language that has always been present in LSE, and has remained the most used. In addition, the VMSLSE command language is required for integration with DECwindows SCA. The Portable command language is a more recent command language devised for use in environments other than OpenVMS. The choice of default command language is made at DECset installation time, but can always be changed.
LSE> PLSE SHOW ATTRIBUTES
For information on integrating LSE with VSI Source Code Analyzer (SCA) and VSI Code Management System (CMS), see Section 1.3.4, “Integrating LSE with SCA and CMS” and Section 1.3.5, “Integrating DECwindows LSE with DECwindows SCA”.
Note
LSE> PLSE HELP VMSLSE_Command_Translation_Table
LSE> PLSE HELP Customizing_Command_Language
1.3.1. Setting the Default Command Language
In LSE—Enter SET COMMAND LANGUAGE VMSLSE or SET COMMAND LANGUAGE Portable.
In an initialization file—Specify the desired SET COMMANDLANGUAGE command.
LSE procedure calls in a command file—Enter LSE_SET_COMMAND_LANGUAGE ('VMSLSE') or LSE_SET_COMMAND_LANGUAGE ('PORTABLE').
1.3.2. Invoking LSE Command Languages
- VMSLSE commands in a VMSLSE language setting (normal—no special command syntax needed)
LSE> CHECK LANGUAGE/HELP PASCAL
- Portable commands in a VMSLSE language setting
LSE> PLSE CHECK LANGUAGE HELP PASCAL
VMSLSE commands in a Portable language setting
LSE> TPU LSE$DO_COMMAND ('SET SCREEN HEIGHT=18')
Portable commands in a Portable language setting (normal—no special command syntax needed)
LSE> SET HEIGHT 18
You can also set your own defaults in private section files, such as saving all current settings into a binary file when you execute the SAVE_ENVIRONMENT command.
1.3.3. Using the SET PROMPT KEYPAD Command
LSE>
PLSE SET PROMPT KEYPAD keypad_name
DEFAULT—Allows the use of any default key definition within a prompt (for example, REMOVE and INSERT)
USER—Allows the use of any key definition within a prompt, including user-defined keys
VMSLSE—Allows the use of the VMSLSE keypad (the default setting)
By default, the Portable command language uses the DEFAULT keypad.
1.3.4. Integrating LSE with SCA and CMS
LSE>
ENABLE VMS INTEGRATION
This command sets the VMSSCA_ and VMSCMS_ grammar prefixes, enabling access to VMSLSE-compatible SCA and CMS commands. This command also redefines key bindings and menu labels related to cross referencing to SCA (for example, Ctrl/D is redefined to GOTODECLARATION).
Note
- Execute Help with a SPAWN command:
LSE> SPAWN CMS HELP cms-command LSE> SPAWN SCA HELP sca-command
Interrupt operations with the DISABLE VMS INTEGRATION command, access the Help you need, then resume operations with the ENABLE VMS INTEGRATION command.
1.3.5. Integrating DECwindows LSE with DECwindows SCA
To integrate DECwindows LSE with DECwindows SCA requires that your default command language setting be VMSLSE. Once that has been ensured, you need to redefine some commands. (This is unlike the integration described in Section 1.3.4, “Integrating LSE with SCA and CMS”.)
LSE> SET COMMAND LANGUAGE VMSLSE
- Redefine the DECwindows LSE menu commands—From the DECwindows LSE Options menu, select Menus... to display the "LSE: Menus" dialog box, then perform the following steps:
From the right-hand list box, titled Labels, select the Find Occurrences label. In the TPU Code text field at the bottom, remove the "$KEY" string so the label definition appears as follows:
LSE_FIND_OCCURRENCES
After changing the label definition, click the Add Entry Arrow button to add the modified label.
From the right-hand list box, titled Labels, select the Goto Declaration label. In the TPU Code text field at the bottom, remove the "$KEY" string so the label definition appears as follows:
LSE_GOTO_DECLARATION
After changing the label definition, click the Add Entry Arrow button to add the modified label.
- Optionally redefine the DECwindows LSE key bindings—From the DECwindows LSE command line, redefine the following key bindings by executing each of these commands:
LSE> DEFINE KEY CTRL/D "TPU LSE_GOTO_DECLARATION" LSE> DEFINE KEY GOLD-CTRL/D "TPU VMSSCA_GOTO_CONTEXT_DECLARATION('/INDICATED')" LSE> DEFINE KEY GOLD-CTRL/F "TPU LSE_FIND_OCCURRENCES"
Redefine these key bindings if you expect that you might, at any time, use the CTRL keys instead of the menu commands.
Note
If a DECwindows SCA session was not active when you executed the previous commands, attempts to use the changed "Find Occurrences" or "Goto Declaration" Source menu options or key bindings will result in the error message, "Cross reference utility not running". You simply need to launch DECwindows SCA; there is no need to redo the commands.
1.4. LSE Command Line
This section describes the format of the LSE command line and includes detailed descriptions of each command-line qualifier.
The LSEDIT command invokes LSE. This command has the following syntax:
LSEDIT [/qualifiers] [file-spec]
/qualifiers
Specifies the LSEDIT command qualifiers.
file-spec
Specifies the file to be edited. It must be an OpenVMS file specification. LSE uses the setting of the SET DIRECTORY SOURCE command or the corresponding LSE$SOURCE logical name to resolve the file specification.
LSE reads the file into a buffer if the file exists. The buffer name is taken from the name and type of the file specification in the command line. The file type determines the language for the buffer. For example, .FOR is the file type for Fortran, .PLI is the file type for PL/I, and .PAS is the file type for Pascal. If the file does not exist, it is created when you use the EXIT command to leave LSE.
If you do not specify a file name in your file specification, LSE uses the file name specified in your last LSEDIT command, provided you entered the EXIT command to end that editing session. If you do not specify a file type in your file specification, LSE adds .LSE if your default command language is VMSLSE, or .PLSE if your default command language is the Portable command language.
The cursor is positioned at the same place as when you last left LSE. The file name, type, and position are collectively called the current file information. The current file information is updated only when you use the EXIT command to leave LSE. If you use the /NOCURRENT_FILE qualifier, LSE does not use the file specification from the previous LSEDIT command as the input file specification. The QUIT command or Ctrl/Y does not change the current file information.
1.4.1. LSE Command-Line Qualifiers
Qualifier |
Default |
---|---|
/[NO]COMMAND=file-spec |
See text |
/[NO]CREATE |
/CREATE |
/[NO]CURRENT_FILE |
/CURRENT_FILE |
/[NO]DEBUG |
/NODEBUG |
/[NO]DISPLAY |
/DISPLAY=CHARACTER_CELL |
/[NO]ENVIRONMENT=file-spec-list |
/NOENVIRONMENT |
/[NO]INITIALIZATION=file-spec |
See text |
/[NO]INTERFACE |
/INTERFACE=CHARACTER_CELL |
/[NO]JOURNAL[=file-name] |
/JOURNAL |
/LANGUAGE=language |
See text |
/[NO]MODIFY |
See text |
/[NO]OUTPUT[=file-spec] |
/OUTPUT[=file-spec] |
/[NO]READ_ONLY |
See text |
/[NO]RECOVER |
/NORECOVER |
/[NO]SECTION=file-spec |
/SECTION=LSE$SECTION |
/START_POSITION=(line,character) |
See text |
/[NO]SYSTEM_ENVIRONMENT |
/SYSTEM_ENVIRONMENT=LSE$SYSTEM_ENVIRONMENT |
/[NO]WRITE |
See text |
- /COMMAND=file-spec, /NOCOMMAND
Specifies a file containing DECTPU statements to be executed as part of the LSE initialization.
If you specify the /NOCOMMAND qualifier, LSE does not use a DECTPU initialization command file. (See the DEC Text Processing Utility Reference Manual for more information.)
You can define the logical name LSE$COMMAND to point to a file containing DECTPU statements. If neither the /COMMAND nor /NOCOMMAND qualifier appears on the command line, LSE tries to translate the logical name LSE$COMMAND. If it has a translation, that value is used in the same way as the /COMMAND qualifier value.
- /CREATE ( D ), /NOCREATE
Controls whether LSE creates a new file when the specified input file is not found. By default, LSE provides a buffer in which to create the file. When you exit from LSE or write out the contents of the buffer with the WRITE or COMPILE command, LSE creates a new file with the input file specification in the appropriate directory.
When you specify the /NOCREATE qualifier on the LSE command line and the name of a file to edit and the named file does not exist, LSE displays an error message and places you in a buffer called $MAIN.
- /CURRENT_FILE ( D ), /NOCURRENT_FILE
Specifies whether LSE uses the last file edited as the input file specification if no file is specified on the command line.
- /DEBUG[=debug-filespec], /NODEBUG ( D )
Determines whether you will run a DECTPU debugger. This is useful in testing DECTPU procedures for an application you are creating. LSE reads, compiles, and executes the debug file before executing TPU$INIT_PROCEDURE.
The default debug file specification is SYS$SHARE:LSE$DEBUG.TPU. You can override this default on the command line to specify a debug file of your own. For example, the following command invokes LSE, using a debug file called SYS$SHARE:MYDEBUG.TPU:$ LSEDIT/DEBUG=mydebug
You can define the logical name LSE$DEBUG to specify a debug file of your own. This is useful if you want to keep the debug file in a directory other than SYS$SHARE. You cannot use wildcards in the debug file specification. The TPU debugger provides commands to manipulate variables and control program execution. To start editing the code in the file you are debugging, use the debugger command GO. For more information about the DECTPU debugger, read the comments in the source file in SYS$SHARE:LSE$DEBUG.TPU, or see the DEC Text Processing Utility Reference Manual.
- /DISPLAY=CHARACTER_CELL ( D ), /DISPLAY=DECWINDOWS, /DISPLAY=screen_manager_filespec, /NODISPLAY
Specifies which screen manager you want to run.
The /DISPLAY command qualifier is optional. By default, LSE uses the character-cell screen manager. As an alternative to the /DISPLAY qualifier, you can define the logical name LSE$DISPLAY_MANAGER as DECWINDOWS, CHARACTER_CELL, or as a screen-manager file specification.
Note that this qualifier is synonymous to the /INTERFACE qualifier. In addition, it allows you to specify the negative form, /NODISPLAY.
If you specify /DISPLAY=CHARACTER_CELL, LSE uses the character-cell screen manager, which runs in a DECterm terminal emulator or on a physical terminal.
If you specify /DISPLAY=DECWINDOWS, LSE uses the DECwindows screen manager, which creates a DECwindows window in which to run LSE.
You cannot use the /NODISPLAY qualifier if the logical name LSE$DISPLAY_MANAGER is pointing to the DECwindows window manager.
- /ENVIRONMENT=file-spec-list, /NOENVIRONMENT ( D )
Specifies the name of one or more binary environment files containing LSE language, token, placeholder, alias, or package definitions. LSE reads in these definitions as part of the LSE startup procedure. If you specify more than one file, you must enclose the files in parentheses and separate them with commas.
If definitions or deletions of items appear in more than one file, the definition that appears in the file listed first takes precedence.
SYS$LIBRARY: is the default device. The default file type is .ENV.
The logical name LSE$ENVIRONMENT is an alternative to the /ENVIRONMENT command qualifier. If the /ENVIRONMENT or /NOENVIRONMENT qualifier does not appear on the command line, LSE tries to translate the logical name LSE$ENVIRONMENT. If it has a translation, the value is used in the same way as the /ENVIRONMENT qualifier value. LSE translates the first ten indexes of the logical name LSE$ENVIRONMENT.
See the SAVE ENVIRONMENT command in the LSE command dictionary for information on using environment files.
- /INITIALIZATION=file-spec, /NOINITIALIZATION
Specifies the name of a file containing a sequence of LSE commands to be executed as part of the LSE startup procedure. This file usually contains the occurrences of the NEW KEY command.
The logical name LSE$INITIALIZATION is an alternative to the /INITIALIZATION qualifier. If /INITIALIZATION or /NOINITIALIZATION does not appear on the command line, LSE tries to translate the logical name LSE$INITIALIZATION. If it has a translation, the value is used in the same way as the /INITIALIZATION qualifier value.
- /INTERFACE=CHARACTER_CELL ( D ), /INTERFACE=DECWINDOWS, /INTERFACE=screen_manager_filespec
Specifies which screen manager you want to run.
The /INTERFACE qualifier is optional. By default, LSE uses the character-cell screen manager. As an alternative to the /INTERFACE qualifier, you can define the logical name LSE$DISPLAY_MANAGER as DECWINDOWS, CHARACTER_CELL, or as a screen-manager file specification.
Note that this qualifier is synonymous to the /DISPLAY qualifier, but unlike /DISPLAY, you cannot specify negation.
If you specify /INTERFACE=CHARACTER_CELL, LSE uses the character-cell screen manager, which runs in a DECterm terminal emulator, or on a physical terminal.
If you specify /INTERFACE=DECWINDOWS, LSE uses the DECwindows screen manager, which creates a DECwindows window in which to run LSE.
- /JOURNAL ( D ), /JOURNAL[=file-name], /NOJOURNAL
Enables journaling for the editing session.
The /JOURNAL qualifier without any value enables buffer-change journaling only. One buffer-change journal file is created for each editing buffer. The name of each buffer-change journal file corresponds to the name of the buffer it is journaling. The default file type for buffer-change journal files is .TPU$JOURNAL.
If you supply a file name as the value to the /JOURNAL qualifier, keystroke journaling is also performed. The name of the keystroke journal is taken from the value supplied to the /JOURNAL qualifier. There is one keystroke journal file for the editing session. The default file type for keystroke journal files is .TJL.
To perform a recovery using a buffer-change journal file, use the RECOVER BUFFER command after starting the editor. Use the /RECOVER command-line qualifier only when attempting to recover using a keystroke journal file. If you perform a recovery using a keystroke journal file, be sure to restore the editing session that you began.
If you do not want to create a journal file of either type, use the /NOJOURNAL qualifier.
- /LANGUAGE=language
Sets the language for the current input file by overriding the language indicated by the file type of the input file.
- /MODIFY, /NOMODIFY
Specifies whether the buffer you create is modifiable or unmodifiable. If you specify the /MODIFY qualifier, the LSEDIT command creates a modifiable buffer. If you specify the /NOMODIFY qualifier, the LSEDIT command creates an unmodifiable buffer. If you do not specify either qualifier, LSE determines the buffer's modifiable status from the read-only or write setting. By default, a read-only buffer is unmodifiable and a write buffer is modifiable.
- /OUTPUT[=file-spec] ( D ), /NOOUTPUT
Specifies the name of the file that LSE creates from the input file when you exit from the editing session. Specifying a file specification on the /OUTPUT qualifier causes LSE to ignore the current file information. By default, LSE creates a new version of the input file.
Missing components of the file specification in the /OUTPUT qualifier take their values from the corresponding fields of the input file specification.
When you exit from the editing session, LSE writes other buffers to their associated files if the buffer contents have been modified during the session. If you specify the /NOOUTPUT qualifier, LSE prevents writing back the main buffer when you exit.
- /READ_ONLY, /NOREAD_ONLY
Specifies that LSE create a read-only buffer for the input file. LSE does not create a new output file. Any changes to the file are lost when you exit from the editing session. This qualifier does not affect writing back other buffers to their associated files if they were modified during the editing session.
If the /[NO]READ_ONLY qualifier is not specified explicitly, the read or write status of the buffer for the input file is determined by the default settings of the SET DIRECTORY command, or LSE$READ_ONLY_DIRECTORY logical name.
- /RECOVER, /NORECOVER ( D )
- Directs LSE to use the latest version of the file specified as the value to the /JOURNAL qualifier to recover changes that might have been lost due to a previous abnormal LSE termination.
Note
The qualifier /RECOVER should be used only when attempting to recover using a keystroke journal file. If you want to recover using a buffer-change journal file, use the RECOVER BUFFER command in LSE after the editor has been started.
When you recover a session, all files must be in the same state as they were at the start of the editing session being recovered. You must enter the LSEDIT/RECOVER command with the same qualifiers, initialization file, section file, and environment file as you did for the session being recovered.
All terminal characteristics must be in the same state as they were at the start of the editing session being recovered. If you changed the width or page length of the terminal, you must change it back to the value it had at the start of the editing session you want to recover. Check the following values by using the DCL command SHOW TERMINAL:Device type
Edit mode
Eight bit
Page
Width
- /SECTION=file-spec, /SECTION=LSE$SECTION ( D ), /NOSECTION
Specifies whether LSE is to map a section file containing DECTPU procedures, key definitions, and variables. By default, LSE maps section file LSE$SECTION. If you supply another file specification, LSE applies the default SYS$LIBRARY:.TPU$SECTION when it opens the file.
If you specify the /NOSECTION qualifier, LSE does not use a section file, and many LSE commands will not work. Therefore, when using the /NOSECTION qualifier, you should specify the /COMMAND qualifier. The command file should use only standard DECTPU built-ins.
- /START_POSITION=(line,character)
Specifies the starting line and character in the file (top-of-file is /START_POSITION=(1,1)). If you do not specify /START_POSITION, LSE starts either at the top of the file, or at the position of the cursor when you last edited the file.
- /SYSTEM_ENVIRONMENT=file-spec, /SYSTEM_ENVIRONMENT=LSE$SYSTEM_ENVIRONMENT ( D ), /NOSYSTEM_ENVIRONMENT
Specifies the name of a system environment file. The difference between the file specified by this qualifier and the file specified by the /ENVIRONMENT qualifier is that definitions from the system environment file are not saved by a SAVE ENVIRONMENT command.
The default device is SYS$LIBRARY: and the default file type is .ENV.
- /WRITE, /NOWRITE
Specifies that LSE create a new output file when you exit from the editing session. Any changes you made to the file are saved.
If the /[NO]WRITE qualifier is not specified explicitly, the read or write status of the buffer for the input file is determined by the default settings of the SET DIRECTORY command, or the LSE$READ_ONLY_DIRECTORY logical name.
1.5. Packages
LSE provides templates for subroutine packages. These packages define OpenVMS System Services, Run-Time Library (LIB$, STR$, SMG$), and Record Management System (RMS) routines. In addition, LSE provides a mechanism for defining packages for your own subroutine libraries.
DEC Ada
DEC BASIC
VAX BLISS-32
VSI C
VSI C++
VSI COBOL
VAX COBOL
VSI Fortran
VAX MACRO
VSI Pascal
VAX PL/I
sys$filescan ( {srcstr}, {valuelst}, [fldflags] )
Most languages access OpenVMS System Services and RMS routines with the prefix SYS$. These languages must use the SYSTEM_SERVICES package. Other languages use different prefixes. For example, DEC Ada prohibits the prefix dollar sign ( $ ) and must use the STARLET package. VAX BLISS and DEC Pascal require the prefix dollar sign ( $ ) and must use the KEYWORD_SYSTEM_SERVICES package.
status := sys$sndopr
status := sys$sndopr ( {msgbuf}, [chan])
This indicates that the $SNDOPR system service has two parameters: MSGBUF, which is required and CHAN, which is optional. Because CHAN is optional, LSE expands it with an optional placeholder that you can either delete or expand. Languages other than DEC Ada and VAX BLISS have similar features.
starlet.sndopr
STARLET.SNDOPR ( STATUS => {status}, MSGBUF => {msgbuf}, [CHAN => {chan}]);
status = $sndopr
status = $sndopr ( msgbuf = {~msgbuf~}, [~chan = {~chan~}~])
You can access OpenVMS online help for any of the system services in any language. If you want help on any routine, place the cursor on the routine name and press the HELP INDICATED key (PF1-PF2). You cannot use HELP INDICATED on the parameter names; however, the HELP entry for the system service will contain information on the parameters.
If you want to see the contents of a given package, parameter, or routine, use the SHOW command. If you want to modify the definitions of a package, use the EXTRACT command.
1.6. Diagnostic File Support
Diagnostic files communicate diagnostic messages to LSE from various tools. A tool, such as a compiler, generates a diagnostic file that LSE uses to display the diagnostics. After you display a diagnostic file in LSE, you can navigate through the file from one diagnostic to the next. You can use the GOTO SOURCE command to display the source that corresponds to a diagnostic in another window.
User-file format—Provides a simple format for customer tools to communicate diagnostic information to LSE. You can list this format without a special dump utility.
VSI internal-file format—Binary format that is used by VSI products to communicate diagnostic messages to LSE.
You can concatenate user-file and VSI internal-file diagnostic modules into one file and review them together.
Regions — Define the location of the source associated with the diagnostic. There can be more than one region.
Messages — Textual descriptions that explain the diagnostic. There can be more than one message.
The rules that apply to DCL apply to the user-file format. For example, nonquoted strings are converted to uppercase.
Section 1.6.1, “The /DIAGNOSTICS Qualifier” describes the use of the /DIAGNOSTICS qualifier with the COMPILE command. Section 1.6.2, “User-File Format” shows an example diagnostic module in the user-file format and explains how the module is used. Section 1.6.3, “User-File Format Command Descriptions” describes each of the commands used in the user-file format.
1.6.1. The /DIAGNOSTICS Qualifier
The /DIAGNOSTICS qualifier is used with the COMPILE command to specify that diagnostic files are generated by the compiler.
This command-line qualifier is required for Portable LSE and must be added to the language's compile command. For VMSLSE, the qualifier is added by default.
In VMSLSE, when you specify the /CAPABILITIES=DIAGNOSTICS qualifier for the DEFINE LANGUAGE and MODIFY LANGUAGE commands, a /DIAGNOSTICS qualifier is automatically appended to the COMPILE command. In Portable LSE, the /DIAGNOSTICS qualifier must be added to the COMPILE command.
1.6.2. User-File Format
Key to Example 1.1, “User-File Format Diagnostic”
The first diagnostic shows how regions and messages work together. | |
The file regions refer to lines in the source that cause the error described in the text message. | |
The nested regions in each of the file regions refer to the location in each line that contributes to the error. | |
The second diagnostic shows how a text region can be used to display macro text for error messages. |
1.6.3. User-File Format Command Descriptions
The following section describes the commands that define the user-file format.
END DIAGNOSTIC
END DIAGNOSTIC — Ends a diagnostic that begins with a START DIAGNOSTIC command.
Format
END DIAGNOSTIC
Description
This command ends a sequence of commands that make up a diagnostic.
Example
See Example 1.1, “User-File Format Diagnostic” for a sample of the END DIAGNOSTIC command.
END MODULE
END MODULE — Ends a module in the user-file format that begins with the START MODULE command.
Format
END MODULE
Description
This command ends a sequence of commands that make up a user-file format diagnostic module.
Example
See Example 1.1, “User-File Format Diagnostic” for a sample of the END MODULE command.
MESSAGE/FILE
MESSAGE/FILE — Defines a message in a file for a diagnostic that appears in the REVIEW buffer during a review session.
Format
MESSAGE/FILE file-spec
Command Parameter
file-spec
Specifies the file containing the message
Description
This command specifies a file that contains the message to be displayed in the REVIEW buffer for a diagnostic. The entire file is displayed in the REVIEW buffer. The message is usually an error message.
Example
MESSAGE/FILE DEV$:[USER]MESSAGE.TXT
The contents of the file specified are displayed as the message in the REVIEW buffer.
MESSAGE/TEXT
MESSAGE/TEXT — Defines a quoted or unquoted message for a diagnostic that appears in the REVIEW buffer during a review session.
Format
MESSAGE/TEXT=[UN]QUOTED message-definition
Command Parameter
message-definition
Specifies the message.
Description
The MESSAGE/TEXT=QUOTED command specifies that the message for the diagnostic is a quoted string. A quoted message is enclosed in double quotes (“”) with embedded double quotes (“ ‘’ ”) used to place quotes in the string.
The MESSAGE/TEXT=UNQUOTED command specifies that the message is the remaining text in the line. It does not have to be quoted. Nonquoted text is converted to uppercase and leading and trailing white space is removed.
The message is usually an error message. If no qualifier is specified for the MESSAGE command, /TEXT_QUOTED is the default.
Examples
MESSAGE/TEXT=UNQUOTED Here is another message.
This message is displayed in the REVIEW buffer. Leading and trailing white space is truncated and the lowercase letters are converted to uppercase, as follows:HERE IS ANOTHER MESSAGE.
MESSAGE "Inserted "";"" at end of line"
If no qualifier is specified, or /TEXT alone is specified, the default becomes /TEXT=QUOTED. This message is included in the REVIEW buffer without the beginning and trailing quotes, as follows:Inserted “;” at end of line.
REGION/FILE
REGION/FILE — Specifies that the source location associated with a diagnostic is in a file.
Format
REGION/FILE file-spec
Command Qualifiers |
Defaults |
---|---|
/LINE=number |
/LINE=1 |
/COLUMN_RANGE= (number,number ) |
/COLUMN_RANGE= (1,1 ) |
/LABEL=string |
See text |
/PRIMARY |
Qualifiers
- /LINE=number, /LINE=1 (D)
Specifies the line number in the file for the region. The first line in a file is 1. The valid range for the /LINE qualifier is −1 and higher. The −1 indicates a line after the last line and 0 indicates a line before the first line. If the line value is 0 or −1, any column range values specified are ignored.
- /COLUMN_RANGE= (number,number), /COLUMN_RANGE= (1,1 ) (D)
Specifies a range of columns in the file that defines the region. If only the first number is specified, the second number defaults to the value of the first number; that is, /COLUMN_RANGE=5 is equivalent to /COLUMN_RANGE=(5,5). The valid range of numbers for a column range is 1 to 65535, inclusive, with 65535 indicating the end-of-line and 1 indicating the first column on a line. Therefore, /COLUMN_RANGE=(12,65535) defines a region that starts in column 12 and runs to the end-of-line.
- /LABEL=string
Specifies a short message that is appended to the beginning of the region in the REVIEW buffer. The default is line n, where n is the line number of the source specified with the /LINE qualifier and the default for text regions is supplied text. The string must contain 14 or fewer characters.
- /PRIMARY
Specifies the primary region among a group of regions. LSE positions the cursor on the primary region for a diagnostic when reviewing that diagnostic. If no region is specified as primary, the first sequential region (any region but a nested region) is assumed to be primary. If more than one region in a diagnostic is marked primary, the first one is used.
Command Parameter
file-spec
Specifies the file that contains the region. The full file specification for the file region, which includes the device, directory, and version, should be used to help ensure that LSE accesses the correct file when the GOTO SOURCE command is executed.
Description
This command defines an area in a file that is associated with a diagnostic. This area cannot span more than one line. If /FILE, /LIBRARY, /NESTED, or /TEXT is not specified with the REGION command, /FILE is the default and need not be entered.
Example
REGION/FILE DEV$:[user]program.src;23 - /LINE=10 - /COLUMN_RANGE=1 - /Label="Src Line 10:" - /PRIMARY
This region points to the first column of the tenth line in file DEV$:[user]program.src;23. The region has a user-specified label and is a primary region.
REGION/LIBRARY
REGION/LIBRARY — Specifies that the source location associated with a diagnostic is in a module within a text library.
Format
REGION/LIBRARY file-spec
Command Qualifiers |
Defaults |
---|---|
/MODULE=module-name | |
/LINE=number |
/LINE=1 |
/COLUMN_RANGE= (number,number ) |
/COLUMN_RANGE= (1,1 ) |
/LABEL=string |
See text |
/PRIMARY |
Qualifiers
- /MODULE=module-name
Specifies the module in the library that contains the region.
- /LINE=number, /LINE=1 (D)
Specifies the line number in the library module for the region. The first line in the module is 1. The valid range for the /LINE qualifier is −1 and higher. The −1 indicates a line after the last line and 0 indicates a line before the first line. If the line value is 0 or −1, any column range values specified are ignored.
- /COLUMN_RANGE= (number,number), /COLUMN_RANGE= (1,1) (D)
Specifies a range of columns in a module that defines the region. If only the first number is specified, then the second number defaults to the value of the first number; that is, /COLUMN_RANGE=5 is equivalent to /COLUMN_RANGE=(5,5). The valid range of numbers for a column range is 1 to 65535, inclusive, with 65535 indicating the end-of-line and 1 indicating the first column on a line. Therefore, /COLUMN_RANGE=(12,65535) defines a region that starts in column 12 and runs to the end-of-line.
- /LABEL=string
Specifies a short message that is appended to the beginning of the region in the REVIEW buffer. The default is line n, where n is the line number of the source specified with the /LINE qualifier and the default for text regions is supplied text. The string must contain 14 or fewer characters.
- /PRIMARY
Specifies the primary region among a group of regions. LSE positions the cursor on the primary region for a diagnostic when reviewing that diagnostic. If no region is specified as primary, the first sequential region (any region but a nested region) is assumed to be primary. If more than one region in a diagnostic is marked primary, the first one is used.
Command Parameter
file-spec
Specifies the library that contains the region. The full file specification for the library region, which includes the device, directory, and version, should be used to help ensure that LSE accesses the correct file when the GOTO SOURCE command is executed.
Description
This command defines an area in a library module for a diagnostic. This area cannot span more than one line.
EXAMPLE
REGION/LIBRARY DEV$:[user]textlib.tlb;3 - /MODULE=textmod - /LINE=1 - /COLUMN_RANGE=(1,65535)
This region defines the entire first line in module textmod of library DEV$:[user]textlib.tlb;3. No label is specified, so the default of line 1 is used. This is not a primary region.
REGION/NESTED
REGION/NESTED — Specifies that the source location associated with a diagnostic is a subregion of the previous region.
Format
REGION/NESTED
Command Qualifier |
Default |
---|---|
/COLUMN_RANGE= (number,number) |
/COLUMN_RANGE= (1,1) |
Command Qualifier
- /COLUMN_RANGE= (number,number), /COLUMN_RANGE= (1,1) (D)
Specifies a range of columns that define a subregion of the previous region. If only the first number is specified, the second number defaults to the value of the first number; that is, /COLUMN_RANGE=5 is equivalent to /COLUMN_RANGE=(5,5). The valid range of numbers for a column range is 1 to 65535, inclusive, with 65535 indicating the end-of-line and 1 indicating the first column on a line. Therefore, /COLUMN_RANGE=(12,65535) defines a region that starts in column 12 and runs to the end-of-line.
Description
This command defines an area that is a subregion of the /FILE, /TEXT, /LIBRARY, or /NESTED region. This area cannot span more than one line.
Each type of sequential region (file, text, or library) can have a nested region inside it. Nested regions can have nested regions. However, each subsequent nested region must fit inside the previous region. Regions of the same size are considered to fit inside each other. A nested region cannot appear by itself; it must be a subregion of a sequential region. If more than four nested regions follow a sequential region, the rest are ignored.
If the GOTO SOURCE command is executed when reviewing a diagnostic file, LSE moves to the beginning of the innermost region of the region it is positioned on in the REVIEW buffer.
Example
REGION/FILE DEV$:[user]program.src;1 - /LINE=10 - /COLUMN_RANGE=(1,65535) REGION/NESTED/COLUMN_RANGE=(2,10) REGION/NESTED/COLUMN_RANGE=10
The nested regions define subregions of the file region. The first nested region defines the area from column 2 to column 10, inclusive, on line 10 in file DEV$:[user]program.src;1. The second nested region defines the last column in that region.
REGION/TEXT
REGION/TEXT — Specifies that the source location associated with a diagnostic is in the text that is included in this command as arguments.
Format
REGION/TEXT string [,string...]
Command Qualifiers |
Defaults |
---|---|
/LINE=number |
/LINE=1 |
/COLUMN_RANGE= (number,number) |
/COLUMN_RANGE= (1,1) |
/LABEL=string |
See text |
/PRIMARY |
Qualifiers
- /LINE=number, /LINE=1 (D)
Specifies the line number of the strings included in the region. The first string included is line 1. The valid range for the /LINE qualifier is −1 and higher. The −1 indicates a line after the last line and 0 indicates a line before the first line. If the line value is 0 or −1, any column range values specified are ignored.
- /COLUMN_RANGE= (number,number), /COLUMN_RANGE= (1,1) (D)
Specifies a range of columns in the specified string that defines the region. If only the first number is specified, the second number defaults to the value of the first number; that is, /COLUMN_RANGE=5 is equivalent to /COLUMN_RANGE=(5,5). The valid range of numbers for a column range is 1 to 65535, inclusive, with 65535 indicating the end-of-line and 1 indicating the first column on a line. Therefore, /COLUMN_RANGE=(12,65535) defines a region that starts in column 12 and runs to the end-of-line.
- /LABEL=string
Specifies a short message that is appended to the beginning of the region in the REVIEW buffer. The default is line n, where n is the line number of the source specified with the /LINE qualifier and the default for text regions is supplied text. The string must contain 14 or fewer characters.
- /PRIMARY
Specifies the primary region among a group of regions. LSE positions the cursor on the primary region for a diagnostic when reviewing that diagnostic. If no region is specified as primary, the first sequential region (any region but a nested region) is assumed to be primary. If more than one region in a diagnostic is marked primary, the first one is used.
Command Parameter
string [,string...]
A quoted string (or strings separated by commas) that is the supplied text for this command. This text appears in the REVIEW buffer for the region.
Description
This command defines an area in the text supplied with the command for a diagnostic. This area cannot span more than one line.
Example
REGION/TEXT "A := B;", - "C := D," - /LINE=1 - /COLUMN_RANGE=(7,7) /PRIMARY
This region points to the last column of the first supplied string. No label is specified, so the default of supplied text is used. This is a primary region. See Example 1.1, “User-File Format Diagnostic” for more samples.
START DIAGNOSTIC
START DIAGNOSTIC — Specifies the start of a diagnostic.
Format
START DIAGNOSTIC
Diagnostic Body
END DIAGNOSTIC
Command Parameter
Diagnostic Body
A diagnostic consists of a START DIAGNOSTIC command, one or more regions, one or more messages, and an END DIAGNOSTIC command.
Description
This command marks the start of a diagnostic module in the user format.
Example
See Example 1.1, “User-File Format Diagnostic” for samples of the START DIAGNOSTIC command.
START MODULE
START MODULE — Specifies the start of a diagnostic module in the user format.
Format
START MODULE
Module Body
END MODULE
Command Parameter
Module Body
A module consists of a START MODULE command, zero or more diagnostics, and an END MODULE command.
Description
This command marks the start of a diagnostic module in the user format.
Example
See Example 1.1, “User-File Format Diagnostic” for a sample of the START MODULE command.
Chapter 2. Using LSE Callable Routines
This chapter describes the LSE callable routines. It describes the purpose of the LSE callable routines, the parameters for a routine call, and the primary status returns. The parameter in the call syntax represents the object that you pass to an LSE routine. Each parameter description lists the data type and the passing mechanism for the object. The data types are standard OpenVMS data types. The passing mechanism indicates how the parameter list is interpreted.
2.1. LSE Callable Routines
Callable LSE routines make LSE accessible from within other languages and applications. You can call LSE from a program written in any language that generates calls using the OpenVMS Procedure Calling and Condition Handling Standard. You can also call LSE from OpenVMS utilities, for example, MAIL. With callable LSE, you can perform text-processing functions within your program.
Callable LSE consists of a set of callable routines that reside in the LSE shareable image, LSESHR.EXE. You access callable LSE by linking to this shareable image, which includes the callable interface routine names and constants. As with the DCL-level LSE interface, you can use files for input to and output from callable LSE. You can also write your own routines for processing file input, output, and messages.
The OpenVMS Procedure Calling and Condition Handling Standard
The OpenVMS Run-Time Library (RTL)
The precise manner in which data types are represented on an OpenVMS system
The method for calling routines written in a language other than the one you are using for the main program
The calling program must ensure that parameters passed to a called procedure, in this case LSE, are of the type and form that the LSE procedure accepts.
The LSE routines described in this reference return condition values indicating the routine's completion status. When comparing a returned condition value with a test value, use the LIB$MATCH routine from the RTL. Do not test the condition value as if it were a simple integer.
2.1.1. Two Interfaces to Callable LSE
There are two interfaces that you can use to access callable LSE: the simplified callable interface and the full callable interface.
Simplified Callable Interface
Initialize LSE
Provide the editor with the parameters necessary for its operation
Control the editing session
Perform error handling
When using the simplified callable interface, you can use the LSE$LSE routine to specify an OpenVMS command line for LSE, or you can call the LSE$EDIT routine to specify an input file and an output file. LSE$EDIT builds a command string that is then passed to the LSE$LSE routine. These two routines are described in detail in Section 2.2, “Simplified Callable Interface”.
If your application parses information that is not related to the operation of LSE, make sure the application obtains and uses all non-LSE parse information before the application calls the simplified callable interface. The reason is that the simplified callable interface destroys all parse information obtained and stored before the simplified callable interface was called.
If your application calls the DECwindows version of LSE, the application may call LSE$EDIT or LSE$LSE a single time only. Also, the application may not call XtInitialize before calling LSE.
Full Callable Interface
The full callable interface consists of the main callable LSE routines and the LSE Utility routines.
Initialize LSE (LSE$INITIALIZE)
Execute LSE procedures (LSE$EXECUTE_INIFILE and LSE$EXECUTE_COMMAND)
Give control to the editor (LSE$CONTROL)
Terminate the editing session (LSE$CLEANUP)
Parse the OpenVMS command line and build the item list used for initializing LSE
Handle file operations
Output error messages
Handle conditions
If your application calls the DECwindows version of LSE, the application may call LSE$INITIALIZE a single time only. Also, the application may not call XtInitialize before calling LSE.
Section 2.3, “Full Callable Interface” briefly describes the interface.
Section 2.3.1, “Main Callable LSE Utility Routines” describes the main callable LSE routines (LSE$INITIALIZE, LSE$EXECUTE_INIFILE, LSE$CONTROL, LSE$EXECUTE_COMMAND, and LSE$CLEANUP).
Section 2.3.2, “Other LSE Utility Routines” discusses additional routines that LSE provides for use with the full callable interface.
Section 2.3.3, “User-Written Routines” defines the requirements for routines that you can write for use with the full callable interface.
2.1.2. Shareable Image
TPU$GL_VERSION, the version of the shareable image
TPU$GL_UPDATE, the update number of the shareable image
TPU$_FACILITY, the DECTPU facility code
2.1.3. Passing Parameters to Callable LSE Routines
Parameters are passed to callable LSE by reference or descriptor, using standard OpenVMS mechanisms. When the parameter is a routine, the parameter is passed by descriptor as a bound procedure value (BPV) data type.
A bound procedure value is a two-longword entity in which the first longword contains the address of a procedure entry mask, and the second longword is the environment value. The environment value is determined in a language-specific manner when the original bound procedure value is generated. When the bound procedure is called, the calling program loads the second longword into R1.
Figure 2.1, “Bound Procedure Value” shows the structure of a bound procedure value.
Name of Your Routine |
Environment |
2.1.4. Error Handling
You can use LSE's default condition handler.
You can write your own condition handler to process some of the errors, and you can call LSE$HANDLER to process the rest.
2.1.5. Return Values
All LSE condition codes are declared as universal symbols. Therefore, you automatically have access to these symbols when you link your program to the shareable image. The condition code values are returned in R0.
Additional information about condition codes is provided in the descriptions of callable LSE routines found in subsequent sections. This information is provided under the section heading Condition Values Returned and indicates the values that are returned when the default condition handler is established.
2.2. Simplified Callable Interface
Those able to specify all the editing parameters on a single command line
Those that need to specify only an input file and an output file
If your application parses information that is not related to the operation of LSE, make sure the application gets, and uses, all non-LSE parse information before the application calls the simplified callable interface. The simplified callable interface destroys all parse information obtained and stored before the simplified callable interface was called.
/* Sample C program that calls LSE. This program uses LSE$EDIT to provide the names of the input and output files. */ #include descrip int return_status; static $DESCRIPTOR (input_file, "infile.dat"); static $DESCRIPTOR (output_file, "outfile.dat"); main (argc, argv) int argc; char *argv[]; { /* Call LSE to edit text in "infile.dat" and write the result to "outfile.dat". Return the condition code from LSE as the status of this program. */ return_status = LSE$EDIT (&input_file, &output_file); exit (return_status); }
/* Sample C program that calls LSE. This program uses LSE$LSE and specifies a command string */ #include descrip int return_status; static $DESCRIPTOR (command_prefix, "LSE/NOJOURNAL/NOCOMMAND/OUTPUT="); static $DESCRIPTOR (input_file, "infile.dat"); static $DESCRIPTOR (output_file, "outfile.dat"); static $DESCRIPTOR (space_desc, " "); char command_line [100]; static $DESCRIPTOR (command_desc, command_line); main (argc, argv) int argc; char *argv[]; { /* Build the command line for LSE. Note that the command verb is LSEDIT. The string we construct in the buffer command_line will be LSEDIT/NOJOURNAL/NOCOMMAND/OUTPUT=outfile.dat infile.dat */ return_status = STR$CONCAT (&command_desc, &command_prefix, &output_file, &space_desc, &input_file); if (! return_status) exit (return_status); /* Now call LSE to edit the file */ return_status = LSE$LSE (&command_desc); exit (return_status); }
2.3. Full Callable Interface
Specify initialization parameters
Control file input/output (I/O)
Specify commands to be executed by LSE
Control how conditions are handled
You can call the individual LSE routines that perform these functions from a user-written program.
This interface has two sets of routines: the main LSE callable routines and the LSE Utility routines. These LSE routines, and your own routines that pass parameters to the LSE routines, are the mechanism that your application uses to control LSE.
The following sections describe the main callable routines, how parameters are passed to these routines, the LSE Utility routines, and the requirements of user-written routines.
2.3.1. Main Callable LSE Utility Routines
LSE$INITIALIZE
LSE$EXECUTE_INIFILE
LSE$CONTROL
LSE$EXECUTE_COMMAND
LSE$CLEANUP
Note
Before calling any of these routines, you must establish LSE$HANDLER or provide your own condition handler. See the routine description of LSE$HANDLER in Section 2.5, “LSE Routines” for information about establishing a condition handler.
2.3.2. Other LSE Utility Routines
LSE$CLIPARSE—Parses a command line and builds the item list for LSE$INITIALIZE.
LSE$PARSEINFO—Parses a command and builds an item list for LSE$INITIALIZE.
LSE$FILEIO—Is the default file I/O routine.
LSE$MESSAGE—Writes error messages and strings by using the built-in procedure MESSAGE.
LSE$HANDLER—Is the default condition handler.
LSE$CLOSE_TERMINAL—Closes DECTPU's channel to the terminal (and its associated mailbox) for the duration of a CALL_USER routine.
Note that LSE$CLIPARSE and LSE$PARSEINFO destroy the context maintained by the CLI$ routines for parsing commands.
2.3.3. User-Written Routines
Routine for initialization callback This is a routine that LSE$INITIALIZE calls to obtain values for initialization parameters. The initialization parameters are returned as an item list.
Routine for file I/O This is a routine that handles file operations. Instead of writing your own file I/O routine, you can use the LSE$FILEIO utility routine. LSE does not use this routine for journal file operations or for operations performed by the built-in procedure SAVE.
Routine for condition handling This is a routine that handles error conditions. Instead of writing your own condition handler, you can use the default condition handler, LSE$HANDLER.
Routine for the built-in procedure CALL_USER This is a routine that is called by the built-in procedure CALL_USER. You can use this mechanism to cause your program to get control during an editing session.
2.4. Examples of Using LSE Routines
2.5. LSE Routines
The following pages describe the individual LSE routines.
In this section, VMS Usage refers to OpenVMS Alpha and OpenVMS I64 usage.
LSE$CLEANUP
LSE$CLEANUP — Cleans up internal data structures, frees memory, and restores terminals to their initial state. This is the final routine called in each interaction with LSE.
Format
LSE$CLEANUP flags
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value. Most utility routines return a condition value in R0. The condition value that this routine can return is listed in the Condition Value Returned section.
Argument
flags
VMS Usage: | mask_longword |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by reference |
Flags (or mask) defining the cleanup options. The flags argument is the address of a longword bit mask defining the cleanup options or the address of a 32-bit mask defining the cleanup options. This mask is the logical OR of the flag bits you want to set. LSE$V . . . indicates a bit item and LSE$M . . . indicates a mask. Table 2.1, “LSE$CLEANUP Options” describes the various cleanup options.
Symbol ? |
Function |
---|---|
LSE$M_DELETE_JOURNAL |
Closes and deletes the journal file if it is open. |
LSE$M_DELETE_EXITH |
Deletes LSE's exit handler. |
LSE$M_DELETE_BUFFERS |
Deletes all text buffers. If this is not the last time you are calling LSE, then all variables referring to these data structures are reset as if by the built-in procedure DELETE. If a buffer is deleted, then all ranges and markers within that buffer, and any subprocesses using that buffer, are also deleted. |
LSE$M_DELETE_WINDOWS |
Deletes all windows. If this is not the last time you are calling LSE, then all variables referring to these data structures are reset as if by the built-in procedure DELETE. |
LSE$M_DELETE_CACHE |
Deletes the virtual file manager's data structures and caches. If this deletion is requested, then all buffers are also deleted. If the cache is deleted, the initialization routine has to reinitialize the virtual file manager the next time it is called. |
LSE$M_PRUNE_CACHE |
Frees up any virtual file manager caches that have no pages allocated to buffers. This frees up any caches that may have been created during the session but that are no longer needed. |
LSE$M_EXECUTE_FILE |
Reexecutes the command file if LSE$EXECUTE_INIFILE is called again. You must set this bit if you plan to specify a new file name for the command file. This option is used in conjunction with the option bit passed to LSE$INITIALIZE indicating the presence of the /COMMAND qualifier. |
LSE$M_EXECUTE_PROC |
Looks up LSE$INIT_PROCEDURE and executes it the next time LSE$EXECUTE_INIFILE is called. |
LSE$M_DELETE_CONTEXT |
Deletes the entire context of LSE. If this option is specified, then all other options are implied, except for executing the initialization file and initialization procedure. |
LSE$M_RESET_TERMINAL |
Resets the terminal to the state it was in upon entry to LSE. The terminal mailbox and all windows are deleted. If the terminal is reset, then it is reinitialized the next time LSE$INITIALIZE is called. |
LSE$M_KILL_PROCESSES |
Deletes all subprocesses created during the session. |
LSE$M_CLOSE_SECTION ? |
Closes the section file and releases the associated memory. All buffers, windows, and processes are deleted. The cache is purged and the flags are set for reexecution of the initialization file and initialization procedure. If the section is closed and if the option bit indicates the presence of the /SECTION qualifier, then the next call to LSE$INITIALIZE attempts a new restore operation. |
LSE$M_DELETE_OTHERS |
Deletes all miscellaneous preallocated data structures, whose memory is reallocated the next time LSE$INITIALIZE is called. |
LSE$M_LAST_TIME |
This bit should be set only when you are calling LSE for the last time. Note that if you set this bit and then recall LSE, the results are unpredictable. |
Condition Value Returned
TPU$_SUCCESS | Normal successful completion. |
Description
This routine is the final routine called in each interaction with LSE. It tells LSE to clean up its internal data structures and to prepare for additional invocations. You can control what this routine resets by setting or clearing the flags described previously.
When you finish with LSE, call this routine to free the memory and restore the characteristics of the terminal to their original settings.
If you intend to exit after calling LSE$CLEANUP, do not delete the data structures; the OpenVMS system, does this automatically. Allowing your OpenVMS system to delete the structures improves the performance of your program.
Notes
- When you use the simplified interface, LSE automatically sets the following flags:
LSE$V_RESET_TERMINAL
LSE$V_DELETE_BUFFERS
LSE$V_DELETE_JOURNAL
LSE$V_DELETE_WINDOWS
LSE$V_DELETE_EXITH
LSE$V_EXECUTE_PROC
LSE$V_EXECUTE_FILE
LSE$V_PRUNE_CACHE
LSE$V_KILL_PROCESSES
If this routine does not return a success status, no other calls to the editor should be made.
LSE$CLIPARSE
LSE$CLIPARSE — Parses a command line and builds the item list for LSE$INITIALIZE. It calls CLI$DCL_PARSE to establish a command table and a command to parse. It then calls LSE$PARSEINFO to build an item list for LSE$INITIALIZE. If your application parses information that is not related to the operation of LSE, make sure the application gets, and uses, all non-LSE parse information before the application calls LSE$CLIPARSE. LSE$CLIPARSE destroys all parse information obtained and stored before LSE$CLIPARSE was called.
Format
LSE$CLIPARSE string, fileio, call_user
Returns
VMS Usage: | item_list |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by reference |
Arguments
string
VMS Usage: | char_string |
type: | character string |
access: | read-only |
mechanism: | by descriptor |
Command line. The string argument is the address of a descriptor of an LSE command.
fileio
VMS Usage: | vector_longword_unsigned |
type: | bound procedure value |
access: | read-only |
mechanism: | by descriptor |
File I/O routine. The fileio argument is the address of a descriptor of a file I/O routine.
call_user
VMS Usage: | vector_longword_unsigned |
type: | bound procedure value |
access: | read-only |
mechanism: | by descriptor |
Call-user routine. The call_user argument is the address of a descriptor of a call-user routine.
LSE$CLOSE_TERMINAL
LSE$CLOSE_TERMINAL — Closes the LSE channel to the terminal.
Format
LSE$CLOSE_TERMINAL
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value. Most utility routines return a condition value in R0. The condition value that this routine can return is listed in the Condition Value Returned section.
Condition Value Returned
TPU$_SUCCESS | Normal successful completion. |
Description
This routine is used with the built-in procedure CALL_USER and its associated call-user routine to control LSE access to the terminal. When a call-user routine invokes LSE$CLOSE_TERMINAL, LSE closes its channel to the terminal and the channel of LSE's associated mailbox.
When the call-user routine returns control to it, LSE automatically reopens a channel to the terminal and redisplays the visible windows.
A call-user routine can use LSE$CLOSE_TERMINAL at any point in the program and as many times as necessary. If the terminal is already closed to LSE when LSE$CLOSE_TERMINAL is used, the call is ignored.
LSE$CONTROL
LSE$CONTROL — Is the main processing routine of LSE. It is responsible for reading the text and commands and executing them. When you call this routine (after calling LSE$INITIALIZE), control is turned over to LSE.
Format
LSE$CONTROL (last-line, last-char, out-file)
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value. Most utility routines return a condition value inR0. Condition values that this routine can return are listed in the Condition Values Returned section.
Arguments
last-line
VMS Usage: | integer |
type: | longword (signed) |
access: | write-only |
mechanism: | by reference |
A signed longword to receive the final position in buffer LSE$MAIN_BUFFER. The first line in the file is line 1.
last-char
VMS Usage: | integer |
type: | longword (signed) |
access: | write-only |
mechanism: | by reference |
A signed longword to receive the final column position in buffer LSE$MAIN_BUFFER. The first column on a line is column 1.
out-file
VMS Usage: | char-string |
type: | character string |
access: | write-only |
mechanism: | by descriptor |
A character string that receives the file specification of the file to which the buffer, pointed to by the DECTPU variable LSE$MAIN_BUFFER, was written on exit. If LSE$MAIN_BUFFER was not written to its designated output file, the out-file is the file specification of the file read into LSE$MAIN_BUFFER. If you enter the QUIT command, this specification is the null string. You can use this information to return to this file during a subsequent edit. LSE uses STR$COPY to fill in this string.
The last-line and last-char arguments together describe the last current position in the buffer pointed to by the DECTPU variable LSE$MAIN_BUFFER. You can use this information to return to this file position in a subsequent edit.
Condition Value Returned
TPU$_EXITING | A result of EXIT (when the default condition handler is enabled). |
TPU$_QUITTING | A result of QUIT (when the default condition handler is enabled). |
TPU$_RECOVERFAIL | A recovery operation was terminated abnormally. |
Description
This routine controls the edit session. It is responsible for reading the text and commands and executing them. Windows on the screen are updated to reflect the edits that are performed.
LSE$EDIT
LSE$EDIT — Builds a command string from its parameters and passes it to the LSE$LSE routine. LSE$EDIT is another entry point to the LSE simplified callable interface.
Format
LSE$EDIT input, output
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value. Most utility routines return a condition value in R0. Condition values that this routine can return are listed in the Condition Values Returned section.
Arguments
input
VMS Usage: | char_string |
type: | character string |
access: | read-only |
mechanism: | by descriptor |
Input file name. The input argument is the address of a descriptor of a file specification.
output
VMS Usage: | char_string |
type: | character string |
access: | read-only |
mechanism: | by descriptor |
Output file name. The output argument is the address of a descriptor of an output file specification. It is used with the /OUTPUT command qualifier.
Condition Value Returned
The LSE$EDIT routine returns any value returned by LSE$LSE.
Description
LSEDIT [/OUTPUT= output] input
If your application parses information that is not related to the operation of LSE, make sure the application gets, and uses, all non-LSE parse information before the application calls LSE$EDIT. LSE$EDIT destroys all parse information obtained and stored before LSE$EDIT is called.
LSE$EXECUTE_COMMAND
LSE$EXECUTE_COMMAND — Allows your program to execute DECTPU statements.
Format
LSE$EXECUTE_COMMAND string
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value. Most utility routines return a condition value in R0. Condition values that this routine can return are listed in the Condition Values Returned section.
Arguments
string
VMS Usage: | char_string |
type: | character string |
access: | read-only |
mechanism: | by value |
DECTPU statement. The string argument is the address of a descriptor of a character string denoting one or more DECTPU statements.
Condition Values Returned
TPU$_SUCCESS | Normal successful completion. |
TPU$_EXITING | EXIT built-in procedure was invoked. |
TPU$_QUITTING | QUIT built-in procedure was invoked. |
TPU$_EXECUTEFAIL | Execution aborted. This could be because of execution errors or compilation errors. |
Description
This routine performs the same function as the built-in procedure EXECUTE described in the DEC Text Processing Utility Reference Manual.
LSE$EXECUTE_INIFILE
LSE$EXECUTE_INIFILE — Allows you to execute a user-written initialization file. This routine must be executed after the editor is initialized, but before any other commands are processed.
Format
LSE$EXECUTE_INIFILE
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value. Most utility routines return a condition value in R0. Condition values that this routine can return are listed in the Condition Values Returned section.
Condition Values Returned
TPU$_SUCCESS | Normal successful completion. |
TPU$_EXITING | A result of EXIT. If the default condition handler is being used, the session is terminated. |
TPU$_QUITTING | A result of QUIT. If the default condition handler is being used, the session is terminated. |
TPU$_COMPILEFAIL | The compilation of the initialization file was unsuccessful. |
TPU$_EXECUTEFAIL | The execution of the statements in the initialization file was unsuccessful. |
TPU$_FAILURE | General code for all other errors. |
Description
The command file is read into a buffer. If you specified a file on the command line that cannot be found, an error message is displayed and the routine is aborted. The default is LSE$COMMAND.TPU.
If you specified the /DEBUG qualifier on the command line, the DEBUG file is read into a buffer. The default is SYS$SHARE:LSE$DEBUG.TPU.
The DEBUG file is compiled and executed (if available).
TPU$INIT_PROCEDURE is executed (if available).
The command buffer is compiled and executed (if available).
TPU$INIT_POSTPROCEDURE is executed (if available).
Note
If you call this routine after calling LSE$CLEANUP, you must have set the flags LSE$M_EXECUTE_PROC and LSE$M_EXECUTE_FILE beforehand. Otherwise, the initialization file will not execute.
LSE$FILEIO
LSE$FILEIO — Handles all LSE file operations. Your own file I/O routine can call this routine to perform some operations for it. However, the routine that opens the file must perform all operations for that file. For example, if LSE$FILEIO opens the file it must also close it.
Format
LSE$FILEIO code, stream, data
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value. Most utility routines return a condition value in R0. Condition values that this routine can return are listed in the Condition Values Returned section.
Arguments
VMS Usage: | longword_unsigned |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by reference |
Item code specifying an LSE function. The code argument is the address of a longword containing an item code from LSE specifying a function to perform. You can specify the following item codes in the file I/O routine:
LSE$K_OPEN This item code specifies that the data parameter is the address of an item list. This item list contains the information necessary to open the file. The stream parameter should be filled in with a unique identifying value to be used for all future references to this file. The resultant file name should also be copied with a dynamic string descriptor.
LSE$K_CLOSE The file specified by the stream argument is to be closed. All memory being used by its structures can be released.
LSE$K_CLOSE_DELETE The file specified by the stream argument is to be closed and deleted. All memory being used by its structures can be released.
LSE$K_GET The data parameter is the address of a dynamic string descriptor to be filled with the next record from the file specified by the stream argument. The routine should use the routines provided by the OpenVMS Run-Time Library to copy text into this descriptor. LSE frees the memory allocated for the data read when the file I/O routine indicates that the end of the file has been reached.
LSE$K_PUT The data parameter is the address of a descriptor for the data to be written to the file specified by the stream argument.
stream
VMS Usage: | unspecified |
type: | longword (unsigned) |
access: | modify |
mechanism: | by reference |
File description. The stream argument is the address of a data structure consisting of four longwords. This data structure is used to describe the file to be manipulated.
This data structure is used to refer to all files. It is written to when an open file request is made. All other requests use information in this structure to determine which file is being referenced.
Figure 2.2, “Stream Data Structure” shows the stream data structure.
File Identifier | ||
RFM | Allocation | |
Class | Type | Length |
Address of Name |
The first longword is used to hold a unique identifier for each file. The user-written file I/O routine is restricted to values between 0 and 511. Thus, you can have up to 512 files open simultaneously.
The second longword is divided into three fields. The low word is used to store the allocation quantity, that is, the number of blocks allocated to this file from the FAB (FAB$L_ALQ). This value is used later to calculate the output file size for preallocation of disk space. The low-order byte of the second word is used to store the record attribute byte (FAB$B_RAT) when an existing file is opened. The high-order byte is used to store the record format byte (FAB$B_RFM) when an existing file is opened. The values in the low word and the low-order and high-order bytes of the second word are used for creating the output file in the same format as the input file. These three fields are to be filled in by the routine opening the file.
The last two longwords are used as a descriptor for the resultant or the expanded file name. This name is used later when LSE processes EXIT commands. This descriptor is to be filled in with the file name after an open operation. It should be allocated with either the routine LIB$SCOPY_R_DX or the routine LIB$SCOPY_DX from the RTL. This space is freed by LSE when it is no longer needed.
data
VMS Usage: | item_list_3 |
type: | longword (unsigned) |
access: | modify |
mechanism: | by reference |
Stream data. The data argument is either the address of an item list or the address of a descriptor.
Note
The meaning of this parameter depends on the item code specified in the code field.
- LSE$_ACCESS allows you to specify one of three item codes in the buffer address field, as follows:
LSE$K_IO
LSE$K_INPUT
LSE$K_OUTPUT
LSE$_FILENAME is used for specifying the address of a string to use as the name of the file you are opening. The length field contains the length of this string, and the address field contains the address.
LSE$_DEFAULTFILE is used for assigning a default file name to the file being opened. The buffer-length field contains the length, and the buffer-address field contains the address of the default file name.
LSE$_RELATEDFILE is used for specifying a related file name for the file being opened. The buffer-length field contains the length, and the buffer-address field contains the address of a string to use as the related file name.
LSE$_RECORD_ATTR specifies that the buffer-address field contains the value for the record attribute byte in the FAB (FAB$B_RAT) used for file creation.
LSE$_RECORD_FORM specifies that the buffer-address field contains the value for the record format byte in the FAB (FAB$B_RFM) used for file creation.
LSE$_MAXIMIZE_VER specifies that the version number of the output file should be one higher than the highest existing version number.
LSE$_FLUSH specifies that the file should have every record flushed after it is written.
LSE$_FILESIZE specifies the value for the allocation quantity when creating the file. The value is specified in the buffer-address field.
LSE$_EOF_BLOCK specifies the end-of-file block number of the file. The BUFADR field is the address of a longword into which the file I/O routine must write the file's end-of-file block number (from XAB$L_EBK in $XABFHC).
LSE$_EOF_FFB specifies the file's first free byte offset into the end-of-file block. The BUFADR field is the address of a word into which the file I/O routine must write the file's first free byte offset into the end-of-file block (XAB$W_FFB in $XABFHC).
Condition Values Returned
The LSE$FILEIO routine returns an RMS status code to LSE. The file I/O routine is responsible for signaling all errors if you want any messages displayed.
Description
By default, LSE$FILEIO creates variable-length files with carriage-return record attributes (FAB$B_RFM = VAR, FAB$B_RAT = CR). If you pass to it the LSE$_RECORD_ATTR or LSE$_RECORD_FORM item, that item is used instead. The following combinations of formats and attributes are acceptable:
All other combinations are converted to VAR format with CR attributes.
Note
LSE uses LSE$FILEIO by default when you use the simplified callable interface. When you use the full callable interface, you must explicitly invoke LSE$FILEIO or provide your own file I/O routine.
LSE$HANDLER
LSE$HANDLER — Is the LSE condition handler. The LSE condition handler invokes the Put Message (SYS$PUTMSG) system service, passing it the address of LSE$MESSAGE.
Format
LSE$HANDLER signal_vector, mechanism_vector
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value.
Arguments
signal_vector
VMS Usage: | arg_list |
type: | longword (unsigned) |
access: | modify |
mechanism: | by reference |
Signal vector. See the VSI OpenVMS System Services Reference Manual for information about the signal vector passed to a condition handler.
mechanism_vector
VMS Usage: | arg_list |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by reference |
Mechanism vector. See the VSI OpenVMS System Services Reference Manual for information about the mechanism vector passed to a condition handler.
Description
This routine performs the actual output of the message. The Put Message (SYS$PUTMSG) system service formats only the message. It gets the settings for the message flags and facility name from the variables described in Section 2.1, “LSE Callable Routines”. You must use the DECTPU built-in procedure SET to modify those values.
If the condition value received by the handler has a fatal status or does not have an LSE, DECTPU, CLI$, or SCA facility code, the condition is resignaled.
If the condition is TPU$_QUITTING, TPU$_EXITING, or TPU$_RECOVERFAIL, a request to unwind is made to the establisher of the condition handler.
After handling the message, the condition handler returns with a continue status. DECTPU error message requests are made by signaling a condition to indicate which message should be written out. The arguments in the signal array are a correctly formatted message argument vector. This vector sometimes contains multiple conditions and formatted ASCII output (FAO) arguments for the associated messages. For example, if the editor attempts to open a file that does not exist, the DECTPU message TPU$_NOFILEACCESS is signaled. The FAO argument to this message is a string for the name of the file. This condition has an error status, followed by the RMS status field (STS) and status-value field (STV). Because this condition does not have a fatal severity, LSE continues after handling the error.
The editor does not automatically return from LSE$CONTROL. If you call the LSE$CONTROL routine, you must explicitly establish a way to regain control (for example, using the built-in procedure CALL_USER). Also, if you establish your own condition handler but call the LSE handler for certain conditions, the default condition handler must be established at the point in your program where you want to return control.
See the VSI OpenVMS Calling Standard for information about the OpenVMS Condition Handling Standard.
LSE$INITIALIZE
LSE$INITIALIZE — Initializes LSE for editing. This routine allocates global data structures, initializes global variables, and calls the appropriate setup routines for each of the major components of the editor, including the Virtual File Manager, Screen Manager, and I/O subsystem.
Format
LSE$INITIALIZE callback [,user_arg]
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value. Most utility routines return a condition value in R0. Condition values that this routine can return are listed in the Condition Values Returned section.
Arguments
callback
VMS Usage: | vector_longword_unsigned |
type: | bound procedure value |
access: | read-only |
mechanism: | by descriptor |
Callback routine. The callback argument is the address of a user-written routine that returns the address of an item list containing initialization parameters or a routine for handling file I/O operations. This callback routine must call a parsing routine, which can be LSE$CLIPARSE or a user-written parsing routine.
Callable LSE defines thirteen item codes that you can use for specifying initialization parameters. You do not have to arrange the item codes in any particular order in the list. Figure 2.3, “Format of an Item Descriptor” shows the general format of an item descriptor. For information about how to build an item list, see the OpenVMS programmer's manual associated with the language you are using.
Item Code | Buffer Length |
Buffer Address | |
Return Address |
The return address in an item descriptor is usually 0.
Item Code |
Description |
---|---|
LSE$_OPTIONS |
Enables the command qualifiers. Ten bits in the buffer-address field correspond to the various LSE command qualifiers. The remaining 22 bits in the buffer-address field are reserved. |
LSE$_JOURNALFILE |
Passes the string specified with the /JOURNAL qualifier. The buffer-length field is the length of the string, and the buffer-address field is the address of the string. This string is available with GET_INFO (COMMAND_LINE, “JOURNAL_FILE”). This string may be a null string. |
LSE$_SECTIONFILE |
Passes the string that is the name of the binary initialization file (section file) to be mapped in. The buffer-length field is the length of the string and the buffer-address field is the address of the string. The LSE CLD file has a default value for this string. If the LSE$V_SECTION bit is set, this item code must be specified. |
LSE$_OUTPUTFILE |
Passes the string specified with the /OUTPUT qualifier. The buffer-length field is the length of the string, and the buffer-address field specifies the address of the string. This string is returned by the built-in procedure GET_INFO (COMMAND_LINE, “OUTPUT_FILE”). The string may be a null string. |
LSE$_DISPLAYFILE |
Passes the string specified with the /DISPLAY qualifier. The buffer-length field is the length of the string, and the buffer-address field specifies the address of the string. |
LSE$_COMMANDFILE |
Passes the string specified with the /COMMAND qualifier. The buffer-length field is the length of the string, and the buffer-address field is the address of the string. This string is returned by the built-in procedure GET_INFO (COMMAND_LINE, “COMMAND_FILE”). The string may be a null string. |
LSE$_FILENAME |
Passes the string that is the name of the input file specified in the command line. The buffer-length field specifies the length of this string, and the buffer-address field specifies its address. This string is returned by the built-in procedure GET_INFO (COMMAND_LINE, “FILE_NAME”). This file name may be a null string. |
LSE$_FILEIO |
Passes the bound procedure value of a routine to be used for handling file operations. You may provide your own file I/O routine, or you can call LSE$FILEIO, the utility routine provided by LSE for handling file operations. The buffer-address field specifies the address of a two-longword vector. The first longword of the vector contains the address of the routine. The second longword specifies the environment value that LSE loads into R1 before calling the routine. |
LSE$_CALLUSER |
Passes the bound procedure value of the user-written routine that the built-in procedure CALL_USER is to call. The buffer-address field specifies the address of a two-longword vector. The first longword of the vector contains the address of the routine. The second longword specifies the environment value that LSE loads into R1 before calling the routine. |
LSE$_INIT_FILE |
Passes the string specified with the /INITIALIZATION qualifier. The buffer-length field is the length of the string, and the buffer-address field is the address of the string. This string is returned by using the built-in procedure GET_INFO (COMMAND_LINE, “INIT_FILE”). |
LSE$_START_LINE |
Passes the starting line number for the edit. The buffer-address field contains the first of the two integer values you specified as part of the /START_POSITION command qualifier. The value is available by using the built-in procedure GET_INFO (COMMAND_LINE, “LINE”). Usually an initialization procedure uses this information to set the starting position in the main editing buffer. The first line in the buffer is line 1. |
LSE$_START_CHAR |
Passes the starting column position for the edit. The buffer-address field contains the second of the two integer values you specified as part of the /START_POSITION command qualifier. The value is available using the built-in procedure GET_INFO (COMMAND_LINE, “CHARACTER”). Usually an initialization procedure uses this information to set the starting position in the main editing buffer. The first column on a line corresponds to character 1. |
LSE$_CTRL_C_ROUTINE |
Passes the bound procedure value of a routine to be used for handling Ctrl/C ASTs. LSE calls the routine when a Ctrl/C AST occurs. If the routine returns a FALSE value, LSE assumes that the Ctrl/C has been handled. If the routine returns a TRUE value, LSE aborts any currently executing LSE procedure. The buffer-address field specifies the address of a two-longword vector. The first longword of the vector contains the address of the routine. The second longword specifies the environment value that LSE loads into R1 before calling the routine. |
LSE$_DEBUGFILE |
Passes the string specified with the /DEBUG command qualifier. The buffer-length field is the length of the string, and the buffer-address field is the address of the string. |
Mask ? |
Bit ? |
Function |
---|---|---|
LSE$M_RECOVER |
LSE$V_RECOVER |
Performs a recovery operation. |
LSE$M_JOURNAL |
LSE$V_JOURNAL |
Journals the edit session. |
LSE$M_READ |
LSE$V_READ |
Makes this a READ_ONLY edit session for the main buffer. |
LSE$M_SECTION |
LSE$V_SECTION |
Maps in a binary initialization file (a DECTPU section file) during startup. |
LSE$M_CREATE |
LSE$V_CREATE |
Creates an input file if the one specified does not exist. |
LSE$M_OUTPUT |
LSE$V_OUTPUT |
Writes the modified input file upon exiting. |
LSE$M_COMMAND |
LSE$V_COMMAND |
Executes a command file during startup. |
LSE$M_DISPLAY |
LSE$V_DISPLAY |
Attempts to use the terminal for screen oriented editing and display purposes. |
LSE$M_INIT |
LSE$V_INIT |
Indicates the presence of an initialization file. |
LSE$M_COMMAND_DFLTED |
LSE$V_COMMAND_DFLTED |
Indicates whether the user defaulted the name of the command line. A setting of TRUE means the user did not specify a command file. If this bit is set to FALSE and the user did not specify a file, LSE$INITIALIZE fails. |
LSE$M_WRITE |
LSE$V_WRITE |
Indicates whether the /WRITE qualifier was specified on the command line. |
LSE$M_MODIFY |
LSE$V_MODIFY |
Indicates whether the /MODIFY qualifier was specified on the command line. |
LSE$M_NOMODIFY |
LSE$V_NOMODIFY |
Indicates whether the /NOMODIFY qualifier was specified on the command line. |
LSE$M_DEBUG |
LSE$V_DEBUG |
Indicates whether the /DEBUG qualifier was specified. |
To create the bits, start with the value 0, then use the OR operator on the mask (LSE$M . . . ) of each item you want to set. Another way to create the bits is to treat the 32 bits as a bit vector and set the bit (LSE$V . . . ) corresponding to the item you want.
user_arg
VMS Usage: | user_arg |
type: | bound procedure value |
access: | read-only |
mechanism: | by value |
User argument. The user_arg argument is passed to the user-written initialization routine INITIALIZE.
The user_arg argument is provided to allow an application to pass information through LSE$INITIALIZE to the user-written initialization routine. LSE does not interpret this data in any way.
Condition Values Returned
TPU$_SUCCESS | Initialization was completed successfully. |
TPU$_SYSERROR | A system service did not work correctly. |
TPU$_NONANSICRT | The input device (SYS$INPUT) is not a supported terminal. |
TPU$_RESTOREFAIL | An error occurred during the restore operation. |
TPU$_NOFILEROUTINE | No routine has been established to perform file operations. |
TPU$_INSVIRMEM | Insufficient virtual memory exists for the editor to initialize. |
TPU$_FAILURE | General code for all other errors during initialization. |
Description
This routine is the first routine that must be called after establishing a condition handler.
This routine initializes the editor according to the information received from the callback routine. The initialization routine defaults all file specifications to the null string and all options to off. However, it does not default the file I/O or call-user routine addresses.
If you do not specify a section file, the software features of the editor are limited.
LSE$LSE
LSE$LSE — Invokes LSE and is equivalent to the DCL command LSEDIT.
Format
LSE$LSE command
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value. Most utility routines return a condition value in R0. Condition values that this routine can return are listed in the Condition Values Returned section.
Arguments
command
VMS Usage: | char_string |
type: | character string |
access: | read-only |
mechanism: | by descriptor |
Command string. The command argument is the address of a descriptor of a command line.
Condition Values Returned
The LSE$LSE routine returns any condition value returned by LSE$INITIALIZE, LSE$EXECUTE_INFILE, LSE$CONTROL, and LSE$CLEANUP.
Description
This routine takes the command string specified and passes it to the editor. LSE uses the information from this command string for initialization purposes, just as though you had entered the command at the DCL level.
Using the simplified callable interface does not set LSE$V_CLOSE_SECTION. This feature allows you to make multiple calls to LSE$LSE without requiring you to open and close the section file on each call.
If your application parses information that is not related to the operation of LSE, make sure the application gets, and uses, all non-LSE parse information before the application calls LSE$LSE. LSE$LSE destroys all parse information obtained and stored before LSE$LSE was called.
LSE$MESSAGE
LSE$MESSAGE — Writes error messages and strings by using the built-in procedure, MESSAGE. You can call this routine to have messages written and handled in a manner consistent with LSE. This routine should be used only after LSE$EXECUTE_INIFILE.
Format
LSE$MESSAGE string
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value.
Note
The return status should be ignored because it is intended for use by the Put Message (SYS$PUTMSG) system service.
Argument
VMS Usage: | char_string |
type: | character string |
access: | read-only |
mechanism: | by descriptor |
Formatted message. The string argument is the address of a descriptor of text to be written. It must be completely formatted. This routine does not append the message prefixes. However, the text is appended to the message buffer if one exists. In addition, if the buffer is mapped to a window, the window is updated.
LSE$PARSEINFO
LSE$PARSEINFO — Parses a command and builds the item list for LSE$INITIALIZE.
Format
LSE$PARSEINFO fileio, call_user
Returns
VMS Usage: | item_list |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by reference |
The routine returns the address of an item list.
Arguments
fileio
VMS Usage: | vector_longword_unsigned |
type: | bound procedure value |
access: | read-only |
mechanism: | by descriptor |
File I/O routine. The fileio argument is the address of a descriptor of a file I/O routine.
call_user
VMS Usage: | vector_longword_unsigned |
type: | bound procedure value |
access: | read-only |
mechanism: | by descriptor |
Call-user routine. The call_user argument is the address of a descriptor of a call-user routine.
Description
This routine parses a command and builds the item list for LSE$INITIALIZE.
This routine uses the Command Language Interpreter (CLI) routines to parse the current command. It makes queries about the command parameters and qualifiers that LSE expects. The results of these queries are used to set up the proper information in an item list. The addresses of the user routines are used for those items in the list. The address of this list is the return value of the routine.
If your application parses information that is not related to the operation of LSE, make sure the application gets, and uses, all non-LSE parse information before the application calls LSE$PARSEINFO interface. LSE$PARSEINFO destroys all parse information obtained and stored before LSE$PARSEINFO was called.
FILEIO
FILEIO — Handles LSE file operations. The name of this routine can be either your own file I/O routine or the name of the LSE file I/O routine (LSE$FILEIO).
Format
FILEIO code, stream, data
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by reference |
Longword condition value. Most utility routines return a condition value in R0. Condition values that this routine can return are listed in the Condition Values Returned section.
Arguments
code
VMS Usage: | longword_unsigned |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by reference |
Item code specifying an LSE function. The code argument is the address of a longword containing an item code from LSE that specifies a function to perform.
stream
VMS Usage: | unspecified |
type: | longword (unsigned) |
access: | modify |
mechanism: | by reference |
File description. The stream argument is the address of a data structure containing four longwords. This data structure is used to describe the file to be manipulated.
data
VMS Usage: | item_list_3 |
type: | longword (unsigned) |
access: | modify |
mechanism: | by reference |
Stream data. The data argument is either the address of an item list or the address of a descriptor.
Note
The value of this parameter depends on which item code you specify.
Condition Values Returned
The condition values returned are determined by the user and should indicate success or failure of the operation.
Description
The bound procedure value of the FILEIO routine is specified in the item list built by the callback routine. This routine is called to perform file operations. Instead of using your own file I/O routine, you can call LSE$FILEIO and pass it the parameters for any file operation that you do not want to handle. Note, however, that LSE$FILEIO must handle all I/O requests for any file it opens. Also, if it does not open the file, it cannot handle any I/O requests for the file. In other words, you cannot intermix the file operations between your own file I/O routine and the one supplied by LSE.
HANDLER
HANDLER — Performs condition handling. It is a user-written routine.
Format
HANDLER signal_vector, mechanism_vector
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value.
Arguments
signal_vector
VMS Usage: | arg_list |
type: | longword (unsigned) |
access: | modify |
mechanism: | by reference |
Signal vector. See the VSI OpenVMS System Services Reference Manual for information about the signal vector passed to a condition handler.
mechanism_vector
VMS Usage: | arg_list |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by reference |
Mechanism vector. See the VSI OpenVMS System Services Reference Manual for information about the mechanism vector passed to a condition handler.
Description
If you need more information about writing condition handlers and the OpenVMS Condition Handling Standard, refer to the Introduction to VMS System Routines.
Instead of writing your own condition handler, you can use the default condition handler, LSE$HANDLER. If you want to write your own routine, you must call LSE$HANDLER with the same parameters that your routine received to handle LSE internal signals.
INITIALIZE
INITIALIZE — Is passed to LSE$INITIALIZE as a bound procedure value and called to supply information needed to initialize LSE. It is a user-written routine.
Format
INITIALIZE [user_arg]
Returns
VMS Usage: | item_list |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by reference |
This routine returns the address of an item list.
Arguments
VMS Usage: | user_arg |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by value |
User argument.
Description
The user-written INITIALIZE routine is passed to LSE$INITIALIZE as a bound procedure value and called to supply information needed to initialize LSE.
If the user_arg parameter was specified in the call to
LSE$INITIALIZE, the initialization callback routine is called with only that
parameter. If user_arg
was not specified in the call to
LSE$INITIALIZE, the initialization callback routine is called with no
parameters.
The user_arg parameter is provided to allow an application to pass information through LSE$INITIALIZE to the user-written initialization routine. LSE does not interpret this data in any way.
The user-written callback routine is expected to return the address of an item list containing initialization parameters. Because the item list is used outside the scope of the initialization callback routine, it should be allocated in static memory.
The item list entries are discussed in the section on LSE$INITIALIZE. Most of the initialization parameters have a default value: strings default to the null string and flags default to false. The only required initialization parameter is the address of a routine for file I/O. If an entry for the file I/O routine address is not present in the item list, LSE$INITIALIZE returns with a failure status.
USER
USER — Allows your program to get control during an LSE editing session (for example, to leave the editor temporarily and perform a calculation). This user-written routine is invoked by the DECTPU built-in procedure CALL_USER. The built-in procedure CALL_USER passes three parameters to this routine. These parameters are then passed to the appropriate part of your application to be used as specified. (For example, they may be used as operands in a calculation within a FORTRAN program.) Using the string routines provided by the OpenVMS Run-Time Library (RTL), your application fills in the stringout parameter in the call-user routine, which returns the stringout value to the built-in procedure CALL_USER.
Format
USER integer, stringin, stringout
Returns
VMS Usage: | cond_value |
type: | longword (unsigned) |
access: | write-only |
mechanism: | by value |
Longword condition value.
Arguments
integer
VMS Usage: | longword_unsigned |
type: | longword (unsigned) |
access: | read-only |
mechanism: | by descriptor |
First parameter to the built-in procedure CALL_USER. This is an input-only parameter and must not be modified.
stringin
VMS Usage: | char_string |
type: | character string |
access: | read-only |
mechanism: | by descriptor |
Second parameter to the built-in procedure CALL_USER. This is an input-only parameter and must not be modified.
stringout
VMS Usage: | char_string |
type: | character string |
access: | read-only |
mechanism: | by descriptor |
Return value for the built-in procedure CALL_USER. Your program should fill in this descriptor with a dynamic string allocated by the string routines provided by the RTL. LSE frees this string when necessary.
Description
The description of the built-in procedure CALL_USER in the DEC Text Processing Utility Reference Manual shows an example of a BASIC program that is a call-user routine.
Example
INTEGER FUNCTION TPU$CALLUSER (x,y,z) IMPLICIT NONE INTEGER X CHARACTER*(*) Y STRUCTURE /dynamic/ Z INTEGER*2 length BYTE dtype BYTE class INTEGER ptr END STRUCTURE RECORD /dynamic/ Z CHARACTER*80 local_copy INTEGER rs,lclen INTEGER STR$COPY_DX local_copy = '<' // y // '>' lclen = LEN(Y) + 2 RS = STR$COPY_DX(Z,local_copy(l:lclen)) TPU$CALLUSER = RS END
You can call this FORTRAN program with a DECTPU procedure. The following is an example of one such procedure:
PROCEDURE MY_CALL local status; status := CALL_USER (0,'ABCD'); MESSAGE('"' + '"'); ENDPROCEDURE
The prefix can be LSE$M_ or LSE$V_. LSE$M_ denotes a mask corresponding to the specific field in which the bit is set. LSE$V_ is a bit number.
Using the simplified callable interface does not set LSE$_CLOSE_SECTION. Therefore, you can make multiple calls to LSE$LSE without having to open and close the section file on each call.
LSE$M … indicates a mask.
LSE$V … indicates a bit item.