1 – Overview
LSE is a multilanguage, advanced text editor that is layered on the VAX Text Processing Utility (VAXTPU). LSE works with VMS languages and other VMS productivity tools to enhance program development. LSE allows you to control your editing environment and use LSE's knowledge of specific languages to develop programs quickly and accurately. LSE provides the following features: o Error Correction and Review This feature allows you to compile, review, and correct compilation errors within a single editing session. LSE provides an interface to the supported VMS language compilers so that you can perform compilations without leaving LSE. The compilers provide LSE with compilation diagnostics in a way that allows you to review compilation errors in one editing window while displaying the related source in another window. o Language-Specific Templates Templates permit fast and efficient source code entry. LSE accesses a collection of formatted language constructs, called templates, that provide keywords, punctuation, and placeholders, for each supported VMS language. LSE allows you to modify existing templates or define your own language or text templates. o Integrated Programming Environment LSE is integrated into the OpenVMS development environment. It is invoked using the DIGITAL Command Language (DCL). LSE works with supported OpenVMS languages, the Source Code Analyzer (SCA), the Code Management System (CMS), the Debugger, and the Performance and Coverage Analyzer (PCA) to provide a highly interactive environment. This environment enables you to create and edit code, to view multiple source modules, to compile programs, and to review and correct compile-time errors in one editing session. LSE can be invoked directly from the debugger to correct source code problems found during debugging sessions. In addition, LSE can be invoked from the Performance and Coverage Analyzer to correct performance problems found during analyzing sessions. o Online HELP Facility LSE provides online HELP for information on unfamiliar language constructs and routines. HELP is also provided for all of LSE's commands and key definitions. o Source Code Analysis LSE's integration with SCA allows you to search for specific information contained in your source files. SCA is a source code cross-reference and static analysis tool that helps programmers familiarize themselves with complex systems. SCA accesses source information generated by supported VMS language compilers. Thus, SCA allows you to move through this information and gain access to related source files as necessary. You can find out how a program symbol was declared, where a particular routine is called, or what module needs to be recompiled. o Source Code Management An interface with CMS simplifies the functions of program development. All CMS commands can be issued within LSE. LSE can be directed to fetch files directly from a CMS library when you issue standard LSE file manipulation commands. In addition, LSE has commands RESERVE, REPLACE and UNRESERVE which perform the corresponding CMS operation on LSE buffers. o Program Design The /DESIGN qualifier allows the compiler to process an input file as a detailed design. Used with LSE and SCA, this new capability provides an integrated software development environment that includes the low-level design phase of the software development life cycle. During the design phase, any supported VAX language can be your Program Design Language (PDL). In the VMS environment, you create detailed designs as follows: - Using a supported VAX language - Embedding design information in comments - Writing algorithms with pseudocode and regular placeholders With LSE, you can use pseudocode placeholders to express design information. Supported VAX languages use the special brackets « and » to delimit pseudocode placeholders. You can express other design information in tagged header comments. In addition, you can convert pseudocode placeholders into comments and store the design information in SCA libraries. With SCA, you can perform cross-referencing and static analysis on the design information. In addition, SCA provides a report tool that allows you to process and analyze designs to produce a variety of design reports. Design reports can show the current state of design work and help you understand existing code. You can generate help libraries and routine templates from these design reports. o LSE Customization LSE allows you to extend your editing environment to handle highly specialized editing needs. LSE provides an interface to VAXTPU. VAXTPU is part of the VMS operating system. VAXTPU features include a compiler and an interpreter, and procedures for screen management and text manipulation. The VAXTPU language is block-structured and provides looping, conditional, case, and assignment statements, and many built-in procedures to allow you to perform more powerful editing tasks. o EVE/EDT Keypads LSE provides a SET MODE KEYPAD command that sets the key definitions to be similiar to EVE or EDT. o System Services and Run-Time Library Templates LSE provides packages for VMS Systems Services and for the LIB$, SMG$, and STR$ Run-Time Library routines. In addition, LSE allows you to define templates for packages of subroutine libraries.
2 – Issuing Commands
LSE provides two ways to issue commands: keypad mode and command line mode. When you invoke LSE, you are in keypad mode. In keypad mode, text that you type is inserted into a buffer. Keypad, cursor, and control keys execute LSE functions. Thus, you can press keys to perform editing functions rather than typing commands on the command line. LSE provides two keypads: EDT keypad and EVE keypad. The default is the EDT keypad. You can use the SET MODE KEYPAD command to get the EVE keypad. The EDT key bindings are used in the examples in the manual. Some LSE commands are not bound to keys. Therefore, they must be entered in command line mode. There are two command line prompts: LSE Command> and LSE>. The LSE Command> prompt will process one command. After that command is processed, LSE returns to keypad mode. There are two ways to get the LSE command> prompt: pressing the DO key or COMMAND key (PF1-KP7). LSE will place the LSE Command> prompt near the bottom of the screen. Alternatively, the LSE> prompt allows you to issue as many commands as you want. To get the LSE> prompt, you press CTRL/Z. LSE will place the LSE> prompt near the bottom of the screen. To return to keypad mode, you can press CTRL/Z again or issue the CONTINUE command.
3 – Windows
A window is a section of your screen that displays the contents of a buffer. LSE allows you to create two text windows, each mapped to a different buffer. By splitting the screen into two windows, you can view any two buffers simultaneously. The status line is highlighted and provides information about the associated buffer. The status line tells you the name of the buffer, whether you are in insert or overstrike mode, whether the buffer is in a forward or reverse direction, and whether the buffer is a write or read-only buffer. The message area is located at the bottom and displays broadcast messages and messages issued by LSE and SCA. The prompt area overlays the top line of the message window with the LSE> or LSE Command> prompts, which prompt for commands or required parameters for commands. LSE commands can be used to manipulate the screen and its format. The following describes a common use of some of the commands and default key bindings used to manipulate screens. If, for example, you are editing a file called MODULES.AS, you can issue the following commands to move a procedure from the MODULE2.AS file to the current file. 1. Press the CHANGE WINDOW_MODE key (PF1-=). This command will split the screen into two windows. Both windows will contain the current buffer. The cursor will be placed in the bottom window. 2. Issue the command: GOTO FILE MODULE2.PAS. This command will put the contents of the file, MODULE2.AS, into the bottom window. Now that the two files are displayed on the screen, you can locate both the procedure you want to select and the location in the current file where you want the procedure placed. 3. Move to the desired procedure and press the SELECT (Keypad Period) key. Use the arrow keys to select the entire procedure and press the CUT (Keypad 6) key to capture the procedure. 4. Press the PREVIOUS WINDOW key (PF1-(UPARROW)) to place the cursor in file MODULE1.PAS. 5. Press the PASTE key (PF1-KP6) at the location where the procedure should be placed. 6. Press the CHANGE WINDOW_MODE key (PF1-=) to return the screen to one window containing the current buffer. The commands for manipulating buffers, along with the default key bindings, are listed under subtopic "Screen_Commands".
3.1 – Screen Commands
LSE provides the following commands for manipulating screens: CHANGE WINDOW_MODE (PF1-=) toggles the number of windows (between one and two) displayed. DELETE WINDOW deletes the current window. GOTO BUFFER moves to the specified buffer. GOTO FILE moves the cursor to the buffer containing the specified file. GOTO SCREEN moves the cursor by the number of lines in the current window. NEXT WINDOW (PF1-(DOWN ARROW)) selects the alternate window. PREVIOUS WINDOW (PF1-(UP ARROW)) selects the alternate window. REFRESH rewrites the display screen. SET SCREEN defines the display screen characteristics. SHIFT scrolls a window to the left or to the right.
4 – Buffers
A buffer is a temporary holding area that provides a work space for editing text. You can create a new file or edit an existing file in a buffer. A buffer becomes visible when it is associated with a window that is mapped to the screen. Buffers exist only for the duration of your editing session. When you exit from LSE, the current buffer is discarded and the contents of the buffer are stored in a file. LSE allows you to create multiple buffers. Thus, you can edit several different files in one editing session. You can create additional buffers to store portions of text that you might want to look at, but not edit, during your editing session. BUFFER ATTRIBUTES Buffers have many attributes. This section provides details on buffer attributes and properties. You can use the SHOW BUFFER command to display the characteristics of one or more buffers. Buffer Names A buffer has a name that is displayed in the status line. Buffers are usually named by the name and type of their associated input file. The GOTO FILE or GOTO BUFFER commands can create buffers. Insert/Overstrike LSE has two text entry modes: insert and overstrike. In insert mode, text gets inserted into the buffer at the cursor position. Text to the right of the cursor gets moved. In overstrike mode, text typed at the cursor replaces text that is currently under the cursor. When you start an editing session, the buffer is automatically placed in insert mode. To change the text entry modes, you use the CHANGE TEXT_ENTRY_MODE command. Forward/Reverse LSE maintains a current direction for each buffer. The current direction is displayed in the status line. This direction is used for SEARCH operations and the GOTO and ERASE commands. When you start an editing session, the buffer direction is set to forward. To set the current direction to forward, you use the SET FORWARD command. To set the current direction to reverse, you use the SET REVERSE command. Alternatively, you can use the CHANGE DIRECTION command to change the current direction. Input/Output Buffers may have an associated input or output file. An input file is a file that is read into a buffer when a buffer is created. An output file indicates where LSE will write a buffer. This is usually a new version of an input file. You can change the output file name with the SET OUTPUT_FILE command. The GOTO FILE command creates a buffer and reads a file into it. Read/Write Buffers have either the read-only or write attribute. The read-only attribute indicates that the contents of the buffer will not be written to a file on exit. The write attribute indicates that the buffer will be written to a file on exit. Usually, a file is associated with a buffer by the GOTO FILE command, which creates a buffer and fills it with the contents of a file. When the buffer is written, it is written to a new version of the file. If no file is associated with a buffer that has the write attribute, LSE prompts for a file specification on exit. Note that a buffer is written only if its contents have been modified. Modifiable/Unmodifiable Buffers are either modifiable or unmodifiable. Unmodifiable buffers protect the contents of a given buffer. You cannot change an unmodifiable buffer. The GOTO FILE/READ_ONLY and GOTO SOURCE/READ_ONLY commands create unmodifiable buffers. If you want to modify an unmodifiable buffer, you must issue the SET MODIFY or SET WRITE command. There are some relationships between the READ-ONLY/WRITE buffer attributes and the UNMODIFIABLE/MODIFIABLE buffer attributes. Given these attributes, a buffer may be in one of four possible states. The following list describes these states and explains how to create these states for a buffer. o MODIFIABLE - WRITE The GOTO FILE/WRITE, GOTO SOURCE/WRITE, SET WRITE, and RESERVE commands set buffers to this state. It is also the default for the file specified in the LSEDIT command line. The buffer may be modified and will be written on exit if it has been modified. o MODIFIABLE - READ-ONLY This is the default for the GOTO BUFFER/CREATE command that is used to create a "scratch" buffer. The buffer may be modified, but it will not be written on exit. o UNMODIFIABLE - READ-ONLY The GOTO FILE/READ_ONLY and GOTO SOURCE/READ_ONLY commands create buffers in this state. The buffer cannot be modified. If you issue a SET MODIFY command on this buffer and modify the contents, LSE will not write the contents on exit unless you also issue the SET WRITE command for the buffer. o UNMODIFIABLE - WRITE A buffer can be set to this state by a user who has completed a set of changes to a buffer in the MODIFIABLE - WRITE state and then issued a SET NOMODIFY command for the buffer to protect the buffer from accidental change for the remainder of the editing session. LSE will write the file on exit if it has been changed during the editing session. System Buffers Some buffers are used by LSE for special purposes. These are called system buffers. Unlike user buffers, system buffers do not correspond to files. You can edit a system buffer like any other buffer, but you should avoid changing its contents. By convention, system buffer names start with a dollar sign ($). The most frequently used system buffers are $HELP, $MESSAGES, $REVIEW, and $SHOW. System buffers are not displayed by the SHOW BUFFER command unless you use the /SYSTEM_BUFFERS qualifier. Languages Buffers may have a language associated with them. This determines which language is used for the language-sensitive features. The file type of your current buffer determines the language LSE uses. Thus, you can move between different languages in different buffers, and LSE will provide the interfaces to the appropriate compilers. The SET LANGUAGE command associates a language with a buffer. Current Indentation and Tab Settings LSE maintains two settings to control the action of the tab key: current indentation level and tab increment. When you are at the left margin, the tab key indents to the current indentation level. If you are not at the left margin, the tab key takes you to the next tab column based on the tab increment setting. The SET INDENTATION command sets the current indentation level; the SET TAB_INCREMENT command sets the size of the tab increment. Key Bindings Buffer commands, along with default key bindings are listed under subtopic "Buffer_Commands".
4.1 – Buffer Commands
LSE provides the following commands for manipulating buffers: CHANGE DIRECTION Alters the direction of the current buffer. This command is bound to Key F11 (PF3 in EVE VT100). CHANGE TEXT_ENTRY_MODE Alters the text entry mode of the current buffer between insert and overstrike. This command is bound to Key F14 (ENTER in EVE VT100). COMPILE compiles the source code in the buffers. CUT [/BUFFER=name] deletes and moves text in the select range to the paste or specified buffer. DO [/BUFFER=name] directs LSE to execute LSE commands or VAXTPU program statements from the current or specified buffer. EXIT terminates an editing session and saves all modified buffers. EXTEND compiles one or more VAXTPU procedures to extend LSE. GOTO FILE file-spec moves to the buffer containing the specified file or creates a new buffer for the file. GOTO BUFFER name moves the cursor to the last position held in the specified buffer. GOTO SOURCE moves to the source buffer related to the diagnostic or query item. This command is bound to CTRL/G. PASTE [/BUFFER=name] copies the content of the paste or specified buffer to the current buffer. QUIT terminates an editing session without saving any modified buffers. READ file-spec [buffer] inputs a specified file to the current or specified buffer. SET AUTO_ERASE enables automatic erasing of placeholders. SET FORWARD [/BUFFER=name] sets the direction of the current or specified buffer forward. This command is bound to Keypad 4 (no binding for EVE VT100). SET INDENTATION [/BUFFER=name] changes the indentation level for the current or specified buffer. SET INSERT [/BUFFER=name] sets the text entry mode of the current or specified buffer to insert mode. SET LANGUAGE [/BUFFER=name] changes the language associated with the current or specified buffer. SET LEFT_MARGIN [/BUFFER=name] specifies the left margin for the buffer for FILL and ENTER space commands. SET MODIFY [/BUFFER=name] sets buffer status to modifiable. SET NOAUTO_ERASE disables automatic erasing of placeholders. SET NOMODIFY sets buffer to unmodifiable. SET NOWRAP disables wrapping in the indicated buffer. SET OUTPUT_FILE [/BUFFER=name] changes the output file associated with the current or the specified buffer. SET OVERSTRIKE [/BUFFER=name] sets the text entry of the current or specified buffer to overstrike mode. SET REVERSE [/BUFFER=name] sets the direction of the current or specified buffer to reverse. This command is bound to Keypad 5 (no binding for EVE VT100). SET RIGHT_MARGIN [/BUFFER=name] specifies the right margin for the buffer for FILL and ENTER space commands. SET TAB_INCREMENT [/BUFFER=name] specifies the number of columns between tab stops for the current or specified buffer. SET WRAP enables wrapping in the indicated buffer. SET WRITE [/BUFFER=name] specifies that following a COMPILE command or an exit from LSE, the specified buffer will be written to a file. SHOW BUFFER [name | *] displays the characteristics of a specified or default buffer. WRITE [/BUFFER=name] [file] outputs the content of the current or specified buffer to to a specified file.
5 – Placeholders
To use LSE to create or edit source code requires an understanding of the concepts of tokens and placeholders. Tokens and placeholders are language elements that have been predefined for each of the supported languages. These elements can be expanded into templates for language constructs. Placeholders Placeholders are markers in the source code that indicate locations where you can provide program text. These placeholders help you to supply the appropriate syntax in a given context. Generally, you do not need to type placeholders, rather, they are inserted for you by LSE. Placeholders can be recognized because they are surrounded by brackets or braces. The exact choice for placeholder brackets is language dependent. There are three types of placeholders: o Terminal placeholders o Nonterminal placeholders o Menu placeholders Terminal placeholders provide text strings that describe valid replacements for the placeholder. Nonterminal placeholders expand into additional language constructs. Menu placeholders provide a list of options corresponding to the placeholder. The type of a placeholder is a property of the placeholder name. Placeholders are either optional or required. Required placeholders, indicated by braces, represent places in the source code where you must provide program text. Optional placeholders, indicated by brackets, represent places in the source code where you can either provide additional constructs or erase the placeholder. For example, the declaration INTEGER {identifier}... when expanded becomes INTEGER id, [identifier]... The first appearance of the identifier placeholder is surrounded by braces because you need at least one identifier in this declaration. The second appearance is surrounded by brackets because additional identifiers are optional. Some placeholders are duplicated when expanded. These placeholders are followed by an ellipsis. Generally, these placeholders represent items such as identifiers, statements, expressions, datatypes, or any location where lists of items are expected. A placeholder is duplicated either vertically or horizontally, depending on the context and the placeholder definition. For example, the placeholder [identifier] in the previous example was duplicated vertically. You may move forward or backward from placeholder to placeholder. In addition, you can delete or expand placeholders as needed. LSE allows you to specify uppercase, lowercase, or as defined for all text expanded into the buffer. You may modify placeholder definitions by means of the EXTRACT command. See Chapter 6 for information on modifying placeholders. Placeholder definitions may be stored in an environment file. See Chapter 7 for information on defining your own placeholders. TOKENS Tokens are typically keywords in programming languages. When expanded, tokens provide additional language constructs. Tokens are typed directly into the buffer. Generally, tokens are used in situations when you want to add additional language constructs where there are no placeholders. For example, typing IF and pressing the EXPAND key causes a template for an IF construct to appear on your screen. Tokens are also used to bypass long menus in situations where expanding a placeholder, such as {statement}, would result in a lengthy menu. You can use tokens to insert text when editing an existing file. Because most languages have tokens for built-in functions and keywords, you type the name for a function or keyword and press the EXPAND key. In addition, most languages provide a token named 'statement' or 'expression' that expands into a menu of all possible statements or expressions. The following example demonstrates how to use tokens to edit an existing program. In this case, the buffer, TEST.EXAMPLE, contains the following code: PROCEDURE test () IF A = B THEN A = C + 1 ENDIF ENDPROCEDURE test If you want to add more statements to this program before the IF construct, do the following: 1. Move the cursor to the beginning of the IF procedure line. 2. Press the OPEN LINE key (PF1-KP0). 3. Press the TAB key. Note that the cursor is placed at the same level of indentation as the next line. 4. Type statement and press the EXPAND key. A menu of statements will now appear on your screen. You use the arrow keys to scroll through the menu. To select a menu item, you press the EXPAND, ENTER, or RETURN key. You can press the space bar to exit a menu without selecting an item.
5.1 – Terminal Placeholders
If the current position is on a terminal placeholder when the EXPAND key is pressed, the Editor displays a description of valid replacements for the terminal placeholder. Pressing the up and down arrows (bound to the GOTO CHARACTER/VERTICAL command) allows you to move within the text. Pressing the space bar removes the text and returns you to the original buffer without making any changes. Pressing any other key clears the text and performs the operation normally associated with the key.
5.2 – Nonterminal Placeholders
If the current position is on a nonterminal placeholder when the EXPAND key is pressed, the Editor deletes the placeholder and replaces it with the text of the placeholder body.
5.3 – Menu Placeholders
When a menu placeholder is expanded, the Editor displays a list of options. Pressing the up and down arrow keys (bound to the GOTO CHARACTER/VERTICAL command) allows you to move from one option to another. To obtain help text on an indicated option, press the GOLD-HELP (PF2) sequence. Pressing the EXPAND, ENTER, or RETURN key allows you to expand the selected option and remove the menu display. Pressing the key bound to the GOTO SCREEN command (Keypad 8 key) also allows you to move through the menu, skipping several options at a time. Pressing any other key removes the menu display and performs the operation normally associated with the key. If the option is a placeholder name, the placeholder is enclosed in the same class of delimiter as the menu option being expanded (unless the /LIST qualifier on DEFINE PLACEHOLDER specifies otherwise) and the Editor then automatically performs an EXPAND operation. If /LIST is specified, the list form of the delimiter found on the menu option is used. If there is a description associated with the placeholder or token name appearing as a choice in a menu, the Editor displays the description along with the name. For example: IF: tests an expression and establishes an action
6 – Languages
LSE allows you to use its knowledge of programming languages to develop software. LSE also allows you to design your own languages. In addition to programming languages, you can define languages for other things, such as memos or letters. Once you have defined a language, you can save it in an environment file and recall it for subsequent editing and update sessions. To create a new language, you first create a source file (.LSE), within LSE, into which you put the LSE commands that define the elements of your language. Once the source file is completed, use the DO command to process the definitions. You may then use the SAVE ENVIRONMENT command to save the definitions in binary form for subsequent use by LSE. For example, to create a file for a new language, you do the following: 1. Create a source file in an empty buffer, with a .LSE extension. 2. Put all language, token, and placeholder definitions in the source file. 3. Execute the commands in the source file by executing a DO command (to load the definitions for the current editing session). 4. Execute a SAVE ENVIRONMENT command to save your new language definitions in a binary file (.ENV), for subsequent use. Thus, to create a binary image file (.ENV) for your language, you use the following sequence of commands: LSE> DO LSE> SAVE ENVIRONMENT filename LSE> EXIT
6.1 – Defining a Language
All template definitions, whether text or language-oriented, begin with a language definition command (DEFINE LANGUAGE) that specifies language characteristics. For example, to define a language, you use the DEFINE LANGUAGE command to specify: 1. The name of your language (DEFINE LANGUAGE). 2. The file types (/FILE_TYPES) for the language. 3. The identifier characters to be used in token and alias names (/IDENTIFER_CHARACTERS). 4. The punctuation and delimiter characters (/PUNCTUATION_CHARACTERS). 5. The required and optional placeholder delimiters (/OPT, /OPTL, /REQ, /REQL). 6. The initial text heading for the new file (/INITIAL_STRING). 7. The indentation control for tokens and placeholders (/TAB_INCREMENT). Example: DEFINE LANGUAGE MEMO - /IDENTIFIER CHARACTERS = - "abcd....XYZ0123456789" - /INITIAL_STRING ={memo_template}" - /FILE_TYPES = (.MEMO) - /TAB_INCREMENT = 4 - /OPT = ("[","]") - /OPTL = ("[","]...") - /PUNCTUATION_CHARACTERS = ".,':*+-/" - /REQ = ("[","]") - /REQL = ("[","]...") - To define a placeholder, you use the DEFINE PLACEHOLDER command to specify: 1. The name of your placeholder (DEFINE PLACEHOLDER). 2. The associated language (/LANGUAGE). 3. The type of placeholder: terminal, nonterminal, or menu (/TYPE). 4. The description that you want displayed when the placeholder is used in a menu or in the SHOW PLACEHOLDER command. 5. The end of the placeholder definition (END DEFINE). Example: . . DEFINE PLACEHOLDER subject_line - /LANGUAGE = MEMO - /TYPE = TERMINAL - "Subject of the memo." END DEFINE To define a token you use the DEFINE TOKEN command to specify: 1. The name of your token (DEFINE TOKEN). 2. The associated language (/LANGUAGE). 3. The description that you want displayed when the token is used in a menu or in the SHOW TOKEN command. 4. The end of the token definition (END DEFINE). Example: . . DEFINE TOKEN location - /LANGUAGE = MEMO - /DESCRIPTION = "Office location" "LOC: URE-0096" END DEFINE
6.2 – Language Commands
LSE provides the following commands for creating and manipulating language elements: DEFINE ALIAS [/LANGUAGE=name] specifies the alias name to be defined in the specified language. DEFINE LANGUAGE name specifies characteristics for the current language. DEFINE PLACEHOLDER [/LANGUAGE=name] specifies placeholder characteristics for the specified language. DEFINE TOKEN [/LANGUAGE=name] specifies token characteristics for the specified language. DELETE ALIAS [/LANGUAGE=name] cancels the effect of a DEFINE ALIAS command used for the specified language. DELETE LANGUAGE name cancels the effect of a DEFINE LANGUAGE command. DELETE PLACEHOLDER [/LANGUAGE=name] cancels the effects of a DEFINE PLACEHOLDER command used for the specified language. DELETE TOKEN [/LANGUAGE=name] cancels the effect of DEFINE TOKEN command used in the specified language. DO executes LSE commands or VAXTPU program statements. END DEFINE terminates a DEFINE TOKEN or DEFINE PLACEHOLDER command. EXTRACT LANGUAGE language-name selects the definition of the named language and formats it as a command. HELP/LANGUAGE [name | * ] displays help information about the specified language. MODIFY LANGUAGE name modifies the characteristics of a specified language. SAVE ENVIRONMENT file-spec writes all user-defined languages, tokens, and placeholders to a specified file. SHOW ALIAS name [/LANGUAGE=name] displays the characteristics of the specified alias for the specified language. SHOW LANGUAGE [ name | * ] displays the characteristics of the specified language. SHOW TOKEN name [/LANGUAGE=name] displays the characteristics of the specified token for the specified language. SHOW PLACEHOLDER name [/LANGUAGE=name] displays the characteristics of the specified placeholder for the specified language.
7 – Getting Started
If you are experimenting with a new file associated with one of the supported languages, the following procedures may be helpful (see also topic "Entering_Code"). o Once you have invoked LSE, and the initial string appears on the screen, press the EXPAND key (CTRL/E) and the structure of a program associated with your language will appear. o Using the arrow keys, move through the menu and expand your choice by pressing CTRL/E, the ENTER key, or the RETURN key. o Using the GOTO PLACEHOLDER/FORWARD key (CTRL/N), move from one placeholder to the next, expanding and typing in text as you go. If you need help on a placeholder (or token), press the HELP/INDICATED key sequence (PF1-PF2) while you are positioned on the placeholder. o For those optional placeholders you do not want, press the ERASE PLACEHOLDER/FORWARD key (CTRL/K). o Enter command mode by pressing CTRL/Z, for the LSE> prompt, or the GOLD COMMAND key sequence (PF1 and keypad 7) for the LSE Command> prompt. When using the LSE> prompt, type CONTINUE to return to editing. Type the EXIT or QUIT command to leave LSE; however, if you make modifications to the file, you must type the EXIT command to save the changes you have made. If you wish to get more general information about LSE, do the following: o To see a diagram of the keypad, press the HELP key (PF2). o To obtain a listing of the keys and their descriptions, press CTRL/Z to get the LSE> prompt, and type the SHOW KEY command. o To see a list of LSE commands and their explanations, press CTRL/Z to get the LSE> prompt, and type HELP COMMANDS. o To display a list of all the predefined tokens or placeholders for the language of the current buffer, press CTRL/Z to get the LSE> prompt, and type the SHOW TOKEN or SHOW PLACEHOLDER command. o To get language-specific help on a particular keyword or placeholder, position the cursor on the keyword or placeholder and press GOLD PF2. Help is not available for all keywords and placeholders.
7.1 – Using Menus
Each option in a menu is either a token, a placeholder, or a string. If you select a token or placeholder, the expansion of that option appears in the buffer. If you choose a string the string appears in the buffer. The menu is removed from the screen after you select a menu option. When a menu first appears on the screen, you can: 1. Move through the menu by pressing the up or down arrow keys. (This causes the indicator to move from one option to the next.) 2. Select an option from the menu by pressing the EXPAND key (CTRL/E), the ENTER key, or the RETURN key, while the indicator is on the desired option. 3. Press the PF2 or HELP key to get additional help. 4. Press the space bar to cause the menu to disappear (this has no effect on the user's buffer). Pressing any other key also makes the menu disappear, however, the key's function is performed.
8 – Command Categories
The following information describes the use of LSE commands by task and function.
8.1 – Edit Sessions
ATTACH allows you to switch control of your terminal to another process. CONTINUE exits line mode and enters keypad mode. DCL executes a DCL command from within your editing session DO executes LSE commands or VAXTPU program statements. EXIT terminates an edit session, returns to the calling program, and saves buffers. GOTO COMMAND produces the LSE Command> prompt at which LSE or SCA commands can be issued. QUIT terminates an edit session and returns to the calling program without saving buffers. REPEAT repeat-count [command] executes a specified command a specified number of times. SET DEFAULT_DIRECTORY changes your default device and directory specifications. SET FONT sets the specified fonts for the screen. SET JOURNALING enables buffer journaling for the specified buffers. SET NOJOURNALING disables buffer journaling for the specified buffers. SPAWN suspends the edit session and spawns a subprocess at the DCL level.
8.2 – Entering Code
ENTER COMMENT converts pseudocode into comments. ENTER PSEUDOCODE inserts pseudocode placeholder delimiters. EXPAND expands the token name at the current cursor position. ERASE PLACEHOLDER deletes placeholder text and related punctuation. GOTO PLACEHOLDER moves the cursor to a placeholder MODIFY LANGUAGE modifies the characteristics of a specified language. SET AUTO_ERASE enables automatic erasing of placeholders. SET LANGUAGE sets the specified language associated with the specified buffer SET NOAUTO_ERASE disables automatic erasing of placeholders. SET NOLANGUAGE disassociates the language associated with the indicated buffer. UNDO ENTER COMMENT reverses the effect of the last ENTER COMMENT command. UNERASE PLACEHOLDER restores placeholder text to its original postion. UNEXPAND reverses the effect of the last EXPAND command.
8.3 – Text Manipulation
CANCEL SELECT_MARK cancels the select range of the SET SELECT_MARK command. CAPITALIZE WORD capitalizes the first letter of the current word, or words, in a selected range. CENTER LINE centers the current line between the left and right margins. CHANGE CASE changes the case (upper/lower) of each letter in the specified range. CHANGE DIRECTION changes the current direction of the current buffer. CHANGE INDENTATION adds or deletes leading blanks or tabs in the select range. CHANGE TEXT_ENTRY_MODE changes the edit mode (insert/overstrike) of the current buffer. CUT deletes and moves text in the select range to the current buffer. ENTER LINE inserts a blank line at the end of a line and repositions the cursor to it. ENTER SPACE inserts a blank character and performs a fill at the current cursor position. ENTER SPECIAL [ASCII-code] inserts a specified ASCII character in decimal at the current cursor position. ENTER TAB inserts tabs and blanks at the current cursor position. ENTER TEXT quoted-string inserts a specified string at the current cursor position. ERASE CHARACTER deletes a character from the current buffer. ERASE LINE deletes a line of text from the current buffer. ERASE PLACEHOLDER deletes placeholder text and related punctuation. ERASE SELECTION removes the text within the selected range. ERASE WORD deletes a word from the current buffer. EXPAND replaces placeholders, token, alias, or routine names at the current cursor position with appropriate text or code. FILL fills the line in the select range. LOWERCASE WORD changes the letters in the current word to lowercase. PASTE copies the contents of the paste buffer to the current buffer. QUOTE enters a control code or other character, either as text in the buffer you are editing or as a string command SELECT ALL selects the entire contents of the current buffer. SET AUTO_ERASE enables automatic erasing of placeholders. SET FORWARD sets the direction of the current buffer forward. SET INSERT sets the text entry mode of the current buffer to insert mode. SET NOAUTO_ERASE disables automatic erasing of placeholders. SET NOWRAP disables wrapping in the indicated buffer. SET OVERSTRIKE sets the text entry mode of the current buffer to overstrike mode. SET REVERSE sets the direction of the current buffer to reverse. SET SELECT_MARK marks a position as one end of a select mark. SET WRAP enables wrapping in the indicated buffer. SPELL runs DECspell to check the currently selected text or the entire buffer. SUBSTITUTE quoted-search-string quoted-replace-string searches for a specified string and replaces it with a specified string. TAB inserts blanks and tabs to move cursor to current indentation level or next tab stop. TOGGLE SELECT_MARK sets and resets the state of SELECT_MARK. UNERASE erase-command-option restores text deleted by an ERASE command option. UNEXPAND reverses the effect of the last EXPAND command. UNTAB removes blanks and tabs to the left of the cursor moving the cursor to the previous tab stop. UPPERCASE WORD changes the current word to uppercase.
8.4 – Compile and Review
COMPILE compiles the contents of a buffer without leaving LSE END REVIEW ends an LSE REVIEW session. GOTO SOURCE displays the source related to the current diagnostic or query item. GOTO REVIEW moves to the currently active review session. NEXT ERROR selects the next diagnostic in the current set. PREVIOUS ERROR selects the previous diagnostic in the current set. REVIEW selects and displays a set of diagnostic messages resulting from a compilation.
8.5 – CMS Interface
CMS [cms-command] enables the execution of CMS command within LSE. GOTO FILE moves the cursor to the buffer containing the specified file. GOTO SOURCE moves from a dignostic or symbol in a review or query buffer to the related item in the associated source buffer. READ opens a specified file for input and places its contents in a specified buffer. RESERVE [element-name] Reserves the element specified in your current CMS library. REPLACE Replaces the element (with the same specification as the input file for your current buffer) into your current CMS library. SET CMS sets the default values for reservations and fetches that LSE performs. SET MODIFY sets buffer status to modifiable. SET SOURCE_DIRECTORY specifies a search list of directories for your CMS source files. UNRESERVE unreserves the element specified by the last RESERVE command.
8.6 – Indenting Code
CHANGE INDENTATION adds or deletes leading blanks or tabs in the select range. ENTER TAB inserts indentation at the beginning of a line or a tab at the cursor position. SET INDENTATION changes the inentation level for the buffer. SET TAB_INCREMENT specifies the number of columns between tab stops. TAB inserts blanks and tabs to move cursor to current indentation level or next tab stop. UNTAB removes blanks and tabs to the left of the cursor moving the cursor to the previous tab stop.
8.7 – Cursor Movement
CANCEL MARK disassociates a mark and deletes the specified name. CHANGE DIRECTION changes cursor direction (forward/reverse) through the current buffer. GOTO BOTTOM moves the cursor to the bottom of the current buffer. GOTO BUFFER moves to the last cursor position held in the specified buffer. GOTO CHARACTER moves the cursor to the next character. GOTO FILE file-spec moves the cursor to the last position held in the buffer specified by the file-spec. GOTO LINE moves the cursor to the next line. GOTO MARK moves the cursor to the mark-name specified by the SET MARK command. GOTO PAGE moves the cursor to the next page. GOTO PLACEHOLDER moves the cursor to the next placeholder. GOTO SCREEN moves the cursor the current direction by the number of lines in the current window. GOTO SOURCE moves to the source associated with the current diagnostic or query item. GOTO TOP moves the cursor to the top of the current buffer. GOTO WORD moves the cursor to the next word in the current buffer. LINE moves the cursor in the current buffer to the start of the source line you specify. NEXT ERROR selects the next diagnostic in the current set. PREVIOUS ERROR selects the previous diagnostic in the current set. SEARCH quoted-string moves the cursor to a specified string in the current buffer. SET CURSOR selects either bound cursor motion or free cursor motion. SET FORWARD sets the current buffer direction forward. SET MARK specifies a name at the current cursor position for a GOTO MARK command. SET REVERSE sets the current buffer direction backward. SET SEARCH sets text search options.
8.8 – Screen Control
CHANGE WINDOW_MODE alters the number of displayed windows. DELETE WINDOW deletes the current window. ENLARGE WINDOW enlarges the current window. GOTO BUFFER moves the cursor to the last position held in the specified buffer. GOTO FILE moves the cursor to a buffer containing the specified file. GOTO SCREEN moves the cursor in the current direction by the number of lines in the current window. GOTO SOURCE uses the current cursor position in the review or query buffer to select an associated diagnostic or item in the related source buffer. NEXT WINDOW selects the alternate window. ONE WINDOW deletes all but the current window. OTHER WINDOW moves the cursor from the current window to the next window if the screen is split into multiple windows PREVIOUS WINDOW selects the alternate window. REFRESH rewrites the display screen SET SCREEN defines the display screen characteristics. SET SCROLL_MARGINS delimits the lines at which the cursor triggers scrolling. SHIFT scrolls a window horizontally. SHRINK WINDOW shrinks the current window. SPLIT WINDOW divides the current window into two or more windows. TWO WINDOWS splits the current window into two windows.
8.9 – Tailor Environments
CALL evokes a specified VAXTPU procedure. DEFINE ALIAS specifies the alias name to be defined in the specified language. DEFINE ADJUSTMENT defines the behavior of the LSE viewing commands on individual lines of a source file. DEFINE COMMAND specifies a user command or an abbreviation for an LSE command. DEFINE KEY binds an LSE command to a key. DEFINE KEYWORDS defines the indicated keyword list. DEFINE LANGUAGE specifies the characteristics of a language. DEFINE PACKAGE specifies a subroutine package for which call templates are automaically generated. DEFINE PARAMETER specifies a parameter within a specified package. DEFINE PLACEHOLDER specifies a placeholder and characteristics for a specified language. DEFINE ROUTINE specifies templates for a routine within a package. DEFINE TOKEN specifies a token and characteristics for a specified language. DELETE ALIAS deletes the definition of an alias name. DELETE ADJUSTMENT removes a name from the list of adjustments associated with a language. DELETE COMMAND deletes the definition of a user-defined command. DELETE KEY deletes the definition of a specified key. DELETE KEYWORDS cancels the indicated keywords definition. DELETE LANGUAGE deletes the definition of a specified language. DELETE PACKAGE deletes the definition of a specified package. DELETE PARAMETER deletes the definition of a specified parameter. DELETE PLACEHOLDER deletes the definition of a specified placeholder. DELETE ROUTINE deletes the definition of a specified routine. DELETE TOKEN deletes the definition of a specified token. DO executes LSE commands or VAXTPU program statements. END DEFINE terminates a DEFINE TOKEN or DEFINE PLACEHOLDER command. EXTEND compiles one or more VAXTPU procedures to extend LSE. EXTRACT ADJUSTMENT extracts the definition of the named adjustment and formats the definition as a command. EXTRACT ALIAS selects the definition of the alias name and formats it as a command. EXTRACT KEYWORDS extracts the definition of the named keyword list and formats the definition as a command. EXTRACT LANGUAGE selects the definition of the named language and formats it as a command. EXTRACT MODULE extracts specified modules of source analysis data from an SCA library. EXTRACT PACKAGE extracts the definition of the named package and formats the definition as a command. EXTRACT PARAMETER extracts the definition of the named parameter and formats the definition as a command. EXTRACT PLACEHOLDER extracts the definition of the named placeholder and formats the definition as a command. EXTRACT ROUTINE extracts the definition of the named routine and formats the definition as a command. EXTRACT TAG extracts the definition of the named tag and formats the definition as a command. EXTRACT TOKEN extracts the definition of the named token and formats the definition as a command. MODIFY LANGUAGE name modifies the characteristics of a specified language. SAVE SECTION writes the binary form of current key definitions, learn sequences, user-defined commands, mode settings, and VAXTPU procedures and variables to a section file. SAVE ENVIRONMENT writes all user-defined languages, tokens, and placeholders to a specified file. SET MODE changes the setting of the BELL, KEYPAD, and MENU modes. SET SEARCH sets text search options.
8.10 – Files and Buffers
CHANGE TEXT_ENTRY_MODE switches the text entry mode between insert and overstrike. CLOSE BUFFER deletes the current buffer CUT moves selected text to a specified buffer. DELETE BUFFER deletes a specified buffer. GOTO BUFFER moves to the specified buffer. GOTO FILE moves to a buffer containing the specified file or reads the file into a new buffer. GOTO SOURCE moves to the source associated with the current diagnostic message or query item. INCLUDE inserts the specified file at the current cursor position. NEXT BUFFER moves your next buffer into the current window, returning to your last position in that buffer. PASTE copies the contents of a specified buffer to the current cursor position in the current buffer. PREVIOUS BUFFER moves your previous buffer into the current window, returning to your last position in that buffer. READ file-spec inputs a specified file to the current buffer. RECOVER BUFFER reconstructs the contents of a buffer from a buffer change journal file. SET DEFAULT_DIRECTORY changes your default device and directory specifications. SET DIRECTORY sets the default read-only/writeable status of files in a specified directory. SET FORWARD sets the direction of the specified buffer to forward. SET INDENTATION changes the indentation level for the current buffer. SET INSERT sets the text entry mode of the specified buffer to insert mode. SET LEFT_MARGIN specifies the left margin of the current buffer for FILL and ENTER SPACE commands. SET MODIFY sets buffer status to modifiable. SET NOMODIFY sets buffer to unmodifiable (display-only). SET NOSOURCE_DIRECTORY specifies a directory to be removed from the list of source directories. SET OUTPUT_FILE changes the output file associated with the current buffer. SET OVERSTRIKE sets the text entry mode of the specified buffer to overstrike mode. SET READ_ONLY specifies that following a COMPILE command or an exit from LSE, the buffer not be written to a file. SET REVERSE sets the direction of the specified buffer backward. SET RIGHT_MARGIN specifies the right margin for FILL and ENTER SPACE commands. SET SOURCE_DIRECTORY specifies a search list of source file directories. SET TAB_INCREMENT specifies the number of columns between tab stops for the current buffer. SET WRAP enables wrapping in the indicated buffer. SHOW BUFFER displays specified buffer characteristics. WRITE writes the contents of the specified buffer or select range to a specified file.
8.11 – Help and Status
HELP [topic-list] displays information about a specified topic. SHOW ADJUSTMENT displays the characteristics of indicated adjustments. SHOW ALIAS displays the characteristics of the specified alias. SHOW BUFFER displays the characteristics of the specified buffer. SHOW CMS displays the current SET CMS settings. SHOW DEFAULT_DIRECTORY displays the current default device and directory. SHOW COMMAND displays the characteristics of the specified user-defined command. SHOW DIRECTORY displays the setting of the SET DIRECTORY command. SHOW KEY displays the characteristics of the specified keyboard binding. SHOW KEYWORDS displays the characteristics of the specified keyword. SHOW LANGUAGE displays the characteristics of the specified language. SHOW LIBRARY displays the directory specifications of SCA libraries. SHOW MARK displays the setting of the specified mark. SHOW MODE Displays the current mode settings. SHOW MODULE displays SCA library module information. SHOW PACKAGE displays the characteristics of the specified package. SHOW PARAMETER displays the characteristics of the specified parameter. SHOW PLACEHOLDER displays the characteristics of the specified placeholder. SHOW QUERY displays information about current SCA query sessions. SHOW ROUTINE displays the characteristics of the specified routine. SHOW SCREEN displays information about current SCA query sessions. SHOW SEARCH displays the settings of text search options. SHOW SOURCE_DIRECTORY displays the directories set by the SET SOURCE_DIRECTORY command. SHOW SUMMARY shows statistics and other information about LSE. SHOW TAG displays the characteristics of indicated tags. SHOW TOKEN displays the characteristics of the specified token. SHOW VERSION displays the current version of LSE and SCA. WHAT LINE shows the current line number and total number of lines in the buffer. Also shows what percentage of the lines in the buffer are located above the current line.
9 – Entering Code
To support rapid source code development and decrease the occurrence of syntactic errors, LSE provides language-specific tokens and placeholders. Tokens and placeholders allow for the insertion of source code, within language constructs, by expanding the name a user types and by further expanding tokens and placeholders on syntactic markers. On-line help for language features is also provided that is keyed to the names of tokens and placeholders.
9.1 – Tokens
Tokens are models of program language constructs that are referenced by name from a template buffer. When a token name is entered, LSE replaces the name with the specified template body from the buffer (see also topic "Tokens_and_Placeholders"). The LSE commands used for the manipulation of tokens are: DEFINE TOKEN name specifies template characteristics for an EXPAND command. DELETE TOKEN name cancels the effect of a DEFINE TEMPLATE command. END DEFINE terminates a DEFINE command. EXPAND expands the token name at the current cursor position. EXTRACT TOKEN token-name selects the definition of the named token and formats it as a command. SAVE ENVIRONMENT [ file-spec ] writes all user-defined tokens to a specified file SHOW TOKEN [ name | * ] displays information about the specified token. UNEXPAND reverses the effect of the last EXPAND command.
9.2 – Placeholders
Placeholders are syntactic character strings that hold the place of program language constructs. When a placeholder name is expanded, it expands to either an actual value (terminal node) or another construct (nonterminal node) requiring further expansion (see also Topics "Tokens_and_Placeholders"). The LSE commands used for the manipulation of placeholders are: DEFINE PLACEHOLDER name specifies placeholder characteristics for the current language. DELETE PLACEHOLDER name cancels the effect of a DEFINE PLACEHOLDER command. END DEFINE terminates a DEFINE command. ERASE PLACEHOLDER deletes the text of a selected placeholder. EXPAND expands the placeholder-name at the current cursor postion. EXTRACT PLACEHOLDER placeholder-name selects the definition of the named placeholder and formats it as a command. GOTO PLACEHOLDER moves the cursor to the next placeholder. SAVE ENVIRONMENT [file-spec] writes all user-defined placeholders to the specified file. SHOW PLACEHOLDER [name | * ] displays the characteristics of the specified placeholder. UNEXPAND reverses the effect of the last EXPAND command.
9.3 – Aliases
Aliases are abbreviated reference names for long identifiers that have been entered in the source code. To define an alias for an identifier on which the cursor is currently located, press the GOLD-CTRL/A key sequence and type the abbreviation at the prompt: _Alias name: name Whenever the abbreviated reference name is typed and expanded (CTRL/E), the original identifier string will appear in the buffer. The LSE commands used for the manipulation of aliases are: EXTRACT ALIAS alias-name selects the definition of the alias name and formats it as a command. DEFINE ALIAS name [value] specifies the alias name to be assigned and the value of the string to be referenced. DELETE ALIAS name specifies the alias name to be deleted.
9.4 – New Files
To edit a new file in one of the supported languages, the following commands are required for the manipulation of tokens and placeholders: o ERASE PLACEHOLDER/FORWARD (CTRL/K) o EXPAND (CTRL/E) o GOTO PLACEHOLDER/FORWARD (CTRL/N) o GOTO PLACEHOLDER/REVERSE (CTRL/P) o UNERASE PLACEHOLDER (PF1-CTRL/K) o UNEXPAND (PF1-CTRL/E) When you press the EXPAND key (CTRL/E), while the cursor is on a placeholder name, one of the following will occur: o The placeholder will be replaced automatically with a template consisting of language constructs. This type of placeholder is called a "nonterminal placeholder" because it will insert a template into the buffer when expanded. o Text will appear in a separate window to aid you in supplying a value. This type of placeholder is called a "terminal placeholder" because it does not insert a template into the buffer when expanded. Instead, you must supply the necessary text. You can press the spacebar to remove the window. o A menu will appear that provides you with options that can be selected and expanded into templates. This type of placeholder is called a "menu placeholder". In any of these three cases, you may type in the desired text over the placeholder, and the placeholder will be erased automatically. When expanding a menu placeholder, you can move through the options by using the up and down arrow keys. To select an option, you press the EXPAND key, the RETURN key, or the ENTER key. To exit the menu without selecting an option, you press the spacebar. You can construct a complete program by repeatedly expanding templates. You do not have to continuously expand templates until you reach a terminal placeholder. Rather, you may find it more appropriate to type in the desired value yourself at a higher level (see also topics "Tokens_and_Placeholders" and "Getting_Started").
9.5 – Old Files
To edit an existing file, in one of the supported languages, you use tokens. Since tokens exist for many reserved words, simply type the token name and press the EXPAND key (CTRL/E). For example, typing IF followed by a CTRL/E causes a template for an IF construct to appear on your screen. (Use the SHOW TOKEN command to acquire a listing of all the predefined tokens.)
10 – Compiling
While writing your program, you can use the COMPILE and REVIEW commands to compile your code and review compilation errors without leaving the editing session. Supported VMS language compilers generate a file of compile-time diagnostic information that LSE can use to review compilation errors. The diagnostic information is generated with the /DIAGNOSTICS qualifier. The COMPILE command issues a DCL command in a subprocess to invoke the appropriate compiler. LSE checks to see if the language provides /DIAGNOSTICS capabilities. If so, LSE appends the /DIAGNOSTICS qualifier onto the compilation command. For example, if you issue the COMPILE command while in the buffer TEST.ADA, the resulting DCL command is as follows: $ ADA DEV:[DIRECTORY]TEST.ADA/DIAGNOSTICS=DEV:[DIRECTORY]TEST.DIA LSE supports all of the compiler's command qualifiers as well as user-supplied command procedures. You can specify DCL qualifiers, such as /LIBRARY, when invoking the compiler from LSE. (See the Command Dictionary for details on the COMPILE command.) The REVIEW command displays any diagnostic messages that resulted from a compilation. LSE displays the compilation errors in one window, with the corresponding source code displayed in a second window. This multiwindow capability allows you to review your errors while examining the associated source code. This eliminates tedious steps in the error correction process and helps ensure that all the errors are fixed before looping back through the compilation process. LSE provides several commands to help you review errors and exam your source code. The following lists these commands and their default key bindings. COMPILE/REVIEW compiles and reviews the content of the current buffer. END REVIEW terminates the current review session. GOTO SOURCE uses the current cursor position in $REVIEW to select the diagnostic in the source buffer. This command is bound to CTRL/G. NEXT ERROR selects the next diagnostic message from $REVIEW. NEXT STEP selects the next diagnostic message from $REVIEW. This command is bound to CTRL/F. PREVIOUS ERROR selects the previous diagnostic message from $REVIEW. PREVIOUS STEP selects the previous diagnostic message from $REVIEW. This command is bound to CTRL/B. REVIEW displays the diagnostic messages resulting from a compilation.
11 – CMS Interface
LSE V3.0 provides for invoking CMS from the LSE command line using the CMS command. Also, when LSE must access a file from the directory that is the user's CMS library, LSE will automatically use CMS to FETCH the file. LSE also has a RESERVE command to reserve the element in your current CMS library that has the same name and type as the file associated with your current buffer. The UNRESERVE and REPLACE commands also provide the corresonding CMS operation for the file in your current buffer. See the manual for information "File Manipulation" and for descriptions of the following new or enhanced commands related to source code management and CMS: CMS GOTO FILE GOTO SOURCE READ REPLACE RESERVE SET CMS UNRESERVE
12 – Patterns
The three pattern styles VMS, ULTRIX and TPU can be used in search and substitute commands. The pattern style is set by the SET SEARCH command.
12.1 – VMS
The VMS pattern style enables the special interpretation of wildcard characters and a quote character in the search-string parameter as shown below: VMS-Style Wildcards Wildcard Matches * One or more characters of any kind on a line. ** One or more characters of any kind crossing lines. % A single character. \< Beginning of a line. \> End of a line. \[set-of- Any character in the specified set. For example, characters] \[abc] matches any letter in the set "abc" and \[c-t] matches any letter in the set "c" through "t." \[~set-of- Anything not in the specified set of characters. characters] \ Lets you specify the characters \,*,% or ] within wildcard expressions. For example, \\ matches the backslash character (\). \. Repeats the previous pattern zero or more times, including the original. \: Repeats the previous pattern at least once, including the original; that is, a null occurrence does not match. \w Any empty space created by the space bar or tab stops, including no more than one line break. \d Any decimal digit. \o Any octal digit. \x Any hexadecimal digit. \a Any alphabetic character, including accented letters, other marked letters, and non-English letters. \n Any alphanumeric character. \s Any character that can be used in a symbol: alphanumeric, dollar sign, and underscore. \l Any lowercase letter. \u Any uppercase letter. \p Any punctuation character. \f Any formatting characters: backspace, tab, line feed, vertical tab, form feed, and carriage return. \^ Any control character. \+ Any character with bit 7 set; that is, ASCII decimal values from 128 through 255. For example the following command will find a line starting with an uppercase letter: SEARCH/PATTERN "\<\u"
12.2 – ULTRIX
The ULTRIX pattern style enables the special interpretation of wildcard characters and a quote character in the search-string parameter as shown below: ULTRIX-Style Wildcards Wildcard Matches . A single character. ^ Beginning of a line. $ End of a line. [set-of- Any character in the specified set. For example, characters] [abc] matches any letter in the set "abc" and [c-t] matches any letter in the set "c" through "t." [^set-of- Anything not in the specified set of characters. characters] \ Lets you specify the characters \,.,^,$,[,],or * in wildcard expressions. For example, \\ matches the backslash character (\). * Repeats the previous pattern zero or more times, including the original. + Repeats the previous pattern at least once, including the original; that is, a null occurrence does not match. For example the following command will find a line starting with a, b or c: SEARCH/PATTERN "^[abc]"
12.3 – TPU
The TPU pattern style enables the use of TPU patterns. For full details of TPU patterns see the DEC Text Processing Utility Manual. 1. Simple examples The first example searches for abc or def and the second example substitutes all occurrences of abc or def by ghi: SEARCH/PATTERN "'abc' | 'def'" SUBSTITUTE/PATTERN/ALL "'abc' | 'def'" "'ghi'" In the examples 'abc', 'def' and 'ghi' are TPU strings and | is the TPU pattern alternation operator. The outermost quotes in the examples must be omitted if the parameters are prompted for or if a dialog box is used. 2. Search string The search string is a TPU expression that must evaluate to a TPU pattern. 3. Replace string The replace string is a TPU expression that must evaluate to a TPU string. 4. Partial pattern assignment variables Partial pattern assignment variables allow a substitution to be a function of the found pattern. For example, the following command replaces a date of the form yyyy/mm/dd with one of the form dd/mm/yyyy: SUBSTITUTE/PATTERN - "(_year@_v1)+'/'+(_month@_v2)+'/'+(_day@_v3)" - "str(_v3)+'/'+str(_v2)+'/'+ str(_v1)" when applied to: 1998/04/21 generates: 21/04/1998 In the above example _year, _month and _day are TPU variables holding patterns that match the year, month and day parts of a date, for details of how to set up these variables see Section 8. @ is the TPU partial pattern assignment operator and _v1, _v2 and _v3 are partial pattern assignment variables that are set to the found year, date and day. A partial pattern assignment variable holds a TPU range and when used in the replacement string must be converted to a string using the TPU procedure STR. For example, the following command will prefix any lines that start with any three characters from ABCDEFGHI with XYZ_ : SUBSTITUTE/PATTERN/ALL - "LINE_BEGIN + (ANY('ABCDEFGHI',3)@_v1)" - "'XYZ_'+ str(_v1)" when applied to: abc generates: XYZ_abc 012 012 defghi XYZ_defghi In the above example LINE_BEGIN is a TPU keyword that matches the beginning of a line and ANY is a TPU pattern procedure that matches a specified number of characters from a specified set of characters. 5. New line A new line will be generated for each line feed character in the replacement string, a line feed character can be introduced by means of the TPU procedure ASCII with the value 10 as a parameter. For example, to replace any numbers at the end of lines with the string 'xxx' (a line feed is necessary because the search pattern includes the end of the line): SUBSTITUTE/PATTERN/ALL - "_n + LINE_END" - "'xxx' + ASCII(10)" when applied to: 123 456 generates: 123 xxx 789 xxx In the above example LINE_END is a TPU keyword that matches the end of a line and _n is TPU variable holding a pattern that matches a number. When a partial pattern assignment variable is converted to a string by the TPU procedure STR an optional second parameter can be set to ASCII(10) to cause any end of lines in the range described by the variable to be converted to line feed characters (without the parameter they are represented by the null string). For example: SUBSTITUTE/PATTERN/ALL - "(LINE_BEGIN + _n + LINE_END + _n + LINE_END)@_v1" - "STR(_v1, ASCII(10)) + STR(_v1, ASCII(10))" when applied to: 123 generates: 123 456 456 123 456 Carriage return characters adjacent to line feed characters in the replacement string are ignored. 6. Errors The search and replace strings are TPU expressions which have to be evaluated and may generate various TPU compilation / evaluation error messages. The following error messages are generated for invalid search or replace strings: Error in search pattern Error in replacement string These messages will normally be preceded by various TPU error messages. For example, the search string "'aaa' + bbb" would result in the following error messages: Undefined procedure call BBB Operand combination STRING + INTEGER unsupported Error in search pattern 7. Global variables Partial pattern assignment variables and pattern variables (such as _year in an earlier example) need to be global and must not clash with any TPU global variables used by LSE. This can be achieved by starting any such variable names with an underscore character. 8. Pattern variables Any complicated search or substitution is likely to need various pattern variables to have already been set up. This can be achieved in various ways. The definitions can be setup by issuing DO/TPU commands, for example: DO/TPU "_digits:='0123456789'" DO/TPU "_digit:=any(_digits)" DO/TPU "_year:=any(_digits,4)" DO/TPU "_month:=any('01',1)+_digit" DO/TPU "_day:=any('0123',1)+_digit" DO/TPU "_n:=span(_digits)" The file LSE$PATTERNS.TPU in the LSE$EXAMPLE directory contains some examples of patterns which can be added to LSE by means of the following commands: GOTO FILE LSE$EXAMPLE:LSE$PATTERNS.TPU EXTEND * DO/TPU "LSE$PATTERNS_MODULE_INIT" 9. Use for developing DTM user filters The user defined filters global replace feature introduced in Digital Test Manager for OpenVMS Version V4.0 can be simulated using the SUBSTITUTE/PATTERN/ALL command. This allows DTM user defined filters to be developed interactively using LSE. For example, to replace any numbers at the end of lines with the string 'xxx': global_replace( _n + LINE_END, 'xxx' + ASCII(10), NO_EXACT, OFF, ON); The LSE equivalent (assuming that the current search attributes are equivalent to NO_EXACT) is: SUBSTITUTE/PATTERN/ALL - "_n + LINE_END" - "'xxx' + ASCII(1O)" The LSE equivalent of the pattern to replace parameter (first parameter of the global_replace routine) is the same except that the parameter has to be in quotes. The LSE equivalent of the replacement string parameter (second parameter) is the same if the evaluate replacement parameter (fourth parameter) is set to ON and is the same except that the parameter has to be in quotes if the evaluate replacement parameter is set to OFF. The LSE equivalent of the search mode parameter (third parameter) is the setting of the search options (set by the SET SEARCH command). LSE does not have equivalents of the evaluate replacement parameter (fourth parameter) or the convert linefeeds parameter (fifth parameter). It always evaluates the replacement string parameter and it always converts linefeed characters (and ignores adjacent carriage return characters).