Home
Compaq AA-PWCBD-TE User's Manual
Contents
1. Tab key procedure Always inserts a tab even if current mode is overstrike PROCEDURE user_tab LOCAL this_mode Local variable for current mode this mode GET INFO CURRENT BUFFER mode Save current mode SET INSERT CURRENT BUFFER Set mode to insert user tab char ASCII 9 Define the tab char COPY TEXT user tab char Insert tab SET this mode CURRENT BUFFER Reset original mode ENDPROCEDURE Lexical Elements of the DEC Text Processing Utility Language 4 5 Lexical Elements of the DEC Text Processing Utility Language 4 5 Variables The global variable user tab char is assigned a value when the procedure user_tab is executing Since the variable is a global variable it could have been assigned a value outside the procedure user tab The local variable this mode has the value established in the procedure user tab only when this procedure is executing You can have a variable also named this mode in another procedure The two variables are not the same and may have different values You can also have a global variable named this mode However using this mode as a global variable when you are also using it as a local variable is likely to confuse people who read your code DECTPU will return an informational message during compilation if a local variable has the same name as a global variable 4 6 Constants DECTPU has three types of constants e Integers Strings Keywords Integer constants can
2. DEC Text Processing Utility Data Types 3 6 Marker Data Type e ERASE_LINE MOVE HORIZONTAL MOVE TEXT MOVE VERTICAL SELECT SELECT RANGE SPLIT LINE Example 3 1 shows how to suppress padding while using these built ins The example assumes that the editing point is free The code in this example assigns the string representation of the current line to the variable bat without adding padding blanks to the buffer Example 3 1 Suppressing the Addition of Padding Blanks x MARK FREE CURSOR Places a marker at the detached editing point POSITION SEARCH QUIETLY FORWARD Moves the active editing point to the nearest text character bat CURRENT LINE Assigns the string representation of the current line to bat without adding padding blanks POSITION x Returns the active editing point to the free marker To remove a marker use the DELETE built in procedure with the marker as a parameter For example the following statement deletes the marker mark1 DELETE markl You can also set all variables referring to the marker to refer to something else for example tpu k unspecified or 0 The following statement sets the variable mark1 to 0 markl 0 If mark1 were the only variable referring to a marker that marker would be deleted upon execution of the previous statement The marker data type is returned by the MARK SELECT BEGINNING OF END OF and GET INFO built i
3. DECTPU identifiers for built in procedures constants keywords and global variables are reserved words You can create your own identifiers to name programs procedures constants and variables Any symbol that is neither declared nor used as the target of an assignment statement is assumed to be an undefined procedure 4 5 Variables Variables are names given to DECTPU storage locations that hold values A variable name can be any valid DECTPU identifier that is not a DECTPU reserved word or the name of a DECTPU procedure You assign a value to a variable by using a valid identifier as the left hand side of an assignment statement Following is an example of a variable assignment new buffer CREATE BUFFER new buffer name Compaq suggests that you establish some convention for naming variables so that you can distinguish your variables from the variables in the section file that you are using DECTPU allows two kinds of variables global and local Global variables are in effect throughout a DECTPU environment Local variables are evaluated only within the procedure or unbound code in which they are dedared A variable is implicitly global unless you use the LOCAL declaration You can also declare global variables with the VARIABLE declaration Example 4 1 shows a global variable declaration and a procedure that contains a local variable dedaration Example 4 1 Global and Local Variable Declarations VARIABLE user_tab_char
4. If you link elements other than pattern variables the search is an anchored search unless you specify otherwise Strings constants and the results of built in procedures are not pattern variables For example suppose you defined two subpattern variables as follows a amp ANY 012345678 c amp ARB 1 pl p2 You then define the following pattern variable pat var pl amp p2 DEC Text Processing Utility Data Types 3 13 DEC Text Processing Utility Data Types 3 7 Pattern Data Type Given this sequence of definitions a search for pat_var succeeds if DECTPU encounters the following string a5xcd Because two pattern variables are linked DECTPU searches first for the text that matches p1 then unanchors the search and then searches for the text that matches p2 To specify an anchored search when the right hand subpattern is a pattern or keyword variable use a plus sign You must use a plus sign to anchor the search if the right hand subpattern is a keyword variable If the right hand subpattern is a pattern variable you can use the ANCHOR keyword as the first element of that subpattern to anchor the right hand subpattern For example suppose you defined the following patterns LINE BEGIN a p LINE END pl Das You anchor the search for p2 by using as follows pat_var pl p2 If you use an ampersand amp you unanchor the search for p2 You can also anchor the sear
5. Index Examples 2 4 2 2 2 3 2 4 8 1 4 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9 4 10 4 11 4 12 4 13 4 14 4 15 5 2 5 3 5 4 5 5 5 6 5 7 Sample User Written Procedure DCL Command Procedure FI LENAM DCL Command Procedure FORTRAN ESCO Mais suture oodd era es CIS COMIU inet eris sectors DCL Command Procedure INVISIBLE TPU COM DECTPU Command File GSR TPU Suppressing the Addition of Padding Blanka iaa ee eo VES x Global and Local VariableDedarations lese Global and Local Constant Declarations esee Procedure That Uses Relational Operators on Markers Simple Procedure with Parameters Complex Procedure with Optional Parameters Procedure That Returns a Result Procedure Within Another Procedure Recursive Procedure Procedure That Uses the CASE State ment enn Procedure That Uses the ON ERROR Statement Procedure with a Case Style Error Handler 00 ee Procedure That Returns a Value Procedure That Returns a Status Using RETURN in an ON ERROR Section 0005 Simple Error Handler SHOW SUMMARY Display Syntax of a DECTPU Program Sample DECTPU Programs Sample Program for a Section File Source Code for Minimal Interface to DE CT PW erre da Sateen Command File for GOTO TEXT MARKER 00 eee eaee S
6. READ ONLY or NOWRITE EVE makes the first user buffer of the editing session modifiable If you specify NOMODIFY EVE makes the first user buffer unmodifiable Regardless of what qualifiers you use on the DCL command line EVE makes all user buffers after the first buffer modifiable If you do not specify either form of the MODIFY qualifier EVE checks whether you have used any form of the READ ONLY or WRITE qualifier By default a read only buffer is unmodifiable and a write buffer is modifiable However if you specify READ ONLY and MODIFY or NOWRITE and MODIF Y the buffer is modifiable Similarly if you specify WRITE and NOMODIFY or AROREAD ONLY and NOM ODIF Y the buffer is unmodifiable 2 6 10 OUTPUT OUTPUT Sinput_ file type default NOOUTPUT The OUTPUT qualifier determines whether the output of your DECTPU session is written to a file The application layered on DECTPU is responsible for processing this qualifier To determine whether you specified JOUTPUT on the DCL command line use the following call in the application X GET INFO COMMAND LINE output The preceding call returns 1 if JOUTPUT was specified O otherwise To fetch the name of the output file specified on the command line use the following call X GET INFO COMMAND LINE output file For more information on GET INFO see the DEC Text Processing Utility Reference Manual If you do not specify any form of JOUTPUT on the D
7. When you invoke DECTPU with the NOSECTION qualifier DECTPU does not use any binary file to provide an interface Even the Return and Delete keys are not defined Use NOSECTION when you are running a standalone command file or when you are creating a new section file and do not want the procedures variables and definitions from an existing section file to be included See Section 2 6 and Chapter 5 for more information on NOSECTION An initialization file contains commands for a DECTPU based application For example an initialization file for EVE can contain commands that define keys or set margins Initialization files are easy to create but they cause DECTPU to start up somewhat more slowly than section and command files do To invoke an initialization file use the INITIALIZATION qualifier For more information on using initialization files see Chapter 5 You can use either a command file or a section file or both to customize or extend an existing interface Generally you use a command file for minor customization of an interface Because startup time is faster with a section file you should use a section file when the customization is lengthy or complex or when you are creating an interface that is not layered on an existing editor or application You can use an initialization file only if your application supports the use of such a file The source files for EVE arein SYS EXAMPLES To see a list of the EVE source fi
8. 0 LEARN ABORT RETURN FALSE If the error or warning is not trapped by any selector DECTPU writes the associated error or warning message in the message buffer Next DECTPU performs the equivalent of the following sequence Special error symbol 0 LEARN ABORT RETURN FALSE If an error or warning is generated during execution of a case style error handler DECTPU behaves as follows If you press Ctrl C during the error handler DECTPU sets ERROR to TPU CONTROLC ERROR LINE to the line being executed when Ctrl C was pressed and ERROR TEXT to the message associated with TPU _ CONTROLC If one of the case selectors in the error handler is TPU CONTROLC DECTPU executes the code associated with the selector If the code does not return to the calling procedure or program DECTPU performs the equivalent of the following sequence Special error symbol 0 LEARN ABORT RETURN FALSE If none of the selectors is TPU CONTROLC then DECTPU exits from the error handler and looks for a TPU CONTROLC selector in the procedures or program if any in which the current procedure is nested If DECTPU does not find a TPU CONTROLC selector in the containing procedures or program DECTPU places the message associated with TPU CONTROLC in the message buffer Lexical Elements of the DEC Text Processing Utility Language 4 27 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words e Ifthe error is not due
9. 3 24 D Data type checking 5 10 5 11 definition 3 1 keywords ARRAY 3 2to 3 3 BUFFER 3 3to3 4 INTEGER 3 4to 3 5 KEYWORD 3 5to3 7 LEARN 3 7to 3 8 MARK 3 8to 3 10 PATTERN 3 10to 3 17 PROCESS 3 18 PROGRAM 3 18 RANGE 3 19 to 3 20 STRING 3 20 to 3 21 UNSPECIFIED 3 21 to 3 22 WIDGET 3 22 WINDOW 3 22 to 3 26 Data types 1 6 DCL command procedure example A 7 DEBUGS INI buffer 5 18 DEBUG command 5 29 Debugger invoking 5 28 Debugging 5 28 to C 2 ATTACH command C 1 CANCEL BREAKPOINT command C 1 command files 5 29 DEPOSIT command C 1 DISPLAY SOURCE command C 1 EXAMINE command C 1 GO command 5 29 C 1 HELP command C 1 program 5 29 QUIT command C 1 SCROLL command C 1 section files 5 28 SET BREAKPOINT command 5 28 C 1 SET WINDOW command C 2 SHIFT command C 2 SHOW BREAKPOINTS command C 2 source code 5 29 SPAWN command C 2 Index 2 Debugging cont d STEP command 5 30 C 2 to examine contents of local variable 5 30 TPU command C 2 DEBUGON procedure 5 29 DEBUG qualifier 2 12 5 28 DECTPU DECwindows 1 2 journaling methods 2 6 relationship with DECwindows features 1 3 running from subprocess example A 7 used with UIL 1 4 DECwindows DECTPU invoking with DISPLAY 2 12 DEC CRT2 mode B 3 DEC CRT mode B 2 Default editing interface 2 2 Default file naming algorithm buffer change journal 2 8 DEFAULTS buffer 5 27 Deletion buffer 3 4 marker 3 10 range 3 19 wind
10. Eri You can use the RETURN statement in the ON ERROR section of a procedure to specify a return to the calling procedure if an error occurs in the current procedure Example 4 14 uses the RETURN statement in an ON ERROR section Example 4 14 Using RETURN in an ON ERROR Section Attach to the parent process Used when EVE is spawned from DCL and run in a subprocess kept DECTPU The ATTACH command can be used for more flexible process control PROCEDURE eve attach ON ERROR IF ERROR TPUS NOPARENT THEN MESSAGE Not running DECTPU in a subprocess RETURN ENDIF ENDON ERROR ATTACH ENDPROCEDURE 4 9 4 19 ABORT Statement The ABORT statement stops any executing procedures and causes DECTPU to wait for the next keystroke ABORT is commonly used in error handlers For additional information on using ABORT in error handlers see Section 4 9 4 14 Syntax ABORT Example 4 15 shows a simple error handler that contains an ABORT statement Lexical Elements of the DEC Text Processing Utility Language 4 29 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words Example 4 15 Simple Error Handler ON_ERROR MESSAGE Aborting procedure because of error ABORT ENDON_ERROR 4 9 5 Miscellaneous Declarations This section describes the following DECTPU language declarations e EQUIVALENCE LOCAL CONSTANT VARIABLE 4 9 5 1 EQUIVALENCE With the EQUIVALENCE declaration you can c
11. compilation error occurs DECTPU tells you the approximate line number where the error occurred To move to the line at which the error occurred use the POSITION integer built in procedure In EVE you can use the LINE command For example the command LINE 42 moves the editing point and the cursor to line 42 5 14 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 4 Compiling DECTPU Programs To see DECTPU messages while in EVE use the BUFFER MESSAGES command To return to the original buffer or another buffer of your choice use the BUFFER name of buffer command There are two ways to compile a program in DECTPU on the command line of EVE or in a DECTPU buffer 5 4 4 Compiling on the EVE Command Line You can compile a simple DECTPU program by entering it on the EVE command line For example if you use the TPU command and then enter the SHOW SUMMARY statement DECTPU compiles and executes the program associ ated with the SHOW SUMMARY statement 5 4 2 Compiling in a DECTPU Buffer DECTPU programs are usually compiled by entering DECTPU procedures and statements in a buffer and then compiling the buffer If you are using EVE you can enter the SHOW VARIABLES command in a buffer and compile the buffer by using the TPU command and entering the following statement after the prompt TPU Statement COMPILE CURRENT BUFFER The program associated with SHOW VARIABLES is not
12. jtems resource of a list box widget to point to a given array DECwindows does not handle the array successfully unless the list box widget s itemsCount resource contains the number of elements in the array However you do not necessarily know how many elements the array has at a given moment To help you pass arrays DECTPU has a convention for referring to widget resources If you follow the convention DECTPU will handle the resource that stores the number of array elements The following paragraphs discuss the naming convention in more detail DEC Text Processing Utility Program Development 5 11 DEC Text Processing Utility Program Development 5 2 Programming in DECwindows DECTPU Setting Resources When you use the SET WIDGET built in procedure to pass a list to a widget you must specify both the list name and the list count resource in the same array index separated by a line feed ASCII 10 The array element should be the array that is to be passed For example to specify the items resource to the list box widget use code similar to the following line_feed ASCII 10 resource_array items line_feed itemsCount list_array The line feed character ASCII 10 is a delimiter that separates two resource names DECTPU automatically generates two resource entries The first is the array of strings that specifies the data to the list box for the items resource The second is the count of elements in the
13. or the not equal operator lt gt on widgets to determine whether they are equal that is whether they are the same widget instance but you cannot use any other relational or arithmetic operators on them Once you have created a widget instance DECTPU does not delete the widget instance even if there are no variables referencing it To delete a widget use the DELETE built in procedure DECwindows DECTPU provides the same support for DE Cwindows gadgets that it provides for widgets A gadget is a structure similar to a widget but it is not associated with its own unique DECwindows window Gadgets do not require as much memory to implement as widgets do In most cases you can use the same DECwindows DECTPU built ins on gadgets that you use on widgets For more information on widgets or gadgets see the OpenVMS overview documentation 3 14 Window Data Type A window is a portion of the screen that displays as much of the text in a buffer as will fit in the screen area In EVE the screen contains three windows by default a large window for viewing the text in your editing buffer and two one line windows for displaying commands and messages In EVE or ina user written interface you can subdivide the screen to create more windows A variable of the window data type contains a window The CREATE WINDOW CURRENT WINDOW and GET INFO built in procedures return a value of the window data type CREATE WINDOW is the only built in proced
14. the corresponding event does not cause a callback 5 2 4 5 Application Level Callback Action Routines When DECTPU receives a widget callback it identifies and executes the layered application procedure or learn sequence that has been designated as the callback action routine You can designate a procedure or learn sequence as a callback action routine either when the widget is created by using the CREATE_WIDGET built in procedure or at some later time by using the SET WIDGET CALLBACK built in procedure When you specify an application level callback program or learn sequence with CREATE WIDGET or SET WIDGET CALLBACK all widgets in the same X Resource Manager hierarchy have the same callback program or learn sequence Therefore the callback program or learn sequence must have a mechanism for handling all possible callback reasons 5 2 4 6 Callable Interface Level Callback Routines If you are layering an application on DECTPU or on EVE you can specify callable interface level callback routines only if you are specifying a widget s callback resources in a User Interface Language UIL file Callbacks can pass values known as closures Closures are strings or integers whose funcion depends on the application you are writing DECwindows documentation refers to closures as tags For more information about what closures are and how to use them see Section 5 2 5 You use the DECTPU callable interface routine TPU WIDGET INTEGER CALLBACK
15. 2 Press the ESCAPE key on VT 100 series terminals or Ctrl For example Ctrl V ESC EVE EDT ike keypad setting provides a SPECINS key sequence to insert control characters in a buffer Use the SPECINS key to enter a control character as follows 1 Press the GOLD key 2 Enter the ASCII value of the special character that you want to insert in the buffer in this case 27 the escape character Use the keys on the keyboard not the ones on the keypad Press the GOLD key again Press the SPECINS key on the EDT keypad Lexical Elements of the DEC Text Processing Utility Language 4 3 For example GOLD 27 GOLD Specins 4 3 5 DECTPU Symbols Lexical Elements of the DEC Text Processing Utility Language 4 3 Character Sets Certain symbols have special meanings in DECTPU You can use them as statement delimiters operators or other syntactic elements Table 4 4 lists the DECTPU symbols and their functions Table 4 4 DECTPU Symbols Name Symbol DECTPU Function Apostrophe d Delimits a string Assignment operator Assigns a value to a variable At sign Partial pattern assignment operator Left brace Opens an array element index expression Close parenthesis Ends parameter list expression procedure call argument list or array element index Comma Separates parameters Exdamation point Begins comment Dollar sign Indicates a variable constant keyword or procedure name that is reserved to Compaq Ri
16. DCL command level For example if your default device and directory are DISK USER and you specify a nonexistent file NEWFILE DAT your command and EVE s response would be as follows EDIT TPU NOCREATE newfile dat Input file does not exist DISK USER NEWFILE DAT 2 6 4 DEBUG DEBUG debug source filename NODEBUG default The DEBUG qualifier determines whether DECTPU loads compiles and executes a file implementing a DECTPU debugger If DEBUG is specified DECTPU reads compiles and executes the contents of a debugger file before executing the procedure TPUSINIT PROCEDURE and before executing the command file For more information on the DECTPU initialization sequence see Chapter 5 By default DECTPU does not load a debugger If you specify that a debugger is to be loaded but do not supply a file specification DECTPU loads the file SYS SHARE TPU DEBUG TPU For more information on how to use the default DECTPU debugger see Chapter 5 To use a debugger file other than the default use the DEBUG qualifier and specify the device directory and file name of the debugger to be used If you specify only the file name DECTPU searches SYS SHARE for the file You can define the logical name TPU DE BUG to specify a file that contains a debugger program Once you define this logical name using DEBUG without specifying a file calls the file specified by TPU DEBUG 2 6 5 DISPLAY NODISPLAY To choose the DECwindows
17. Development 5 25 DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files e Set formats for individual buffers EVE initialization files contain EVE commands that are executed either when you invoke the editor or when you issue the EVE at sign command To create an EVE initialization file put in the file the EVE commands you want to use to customize the editor Use one command on each line and one line for each command Do not separate the commands with semicolons If a command in an EVE initialization file is incomplete EVE prompts you for more information the same as if you were typing the command during an editing session Comments in EVE initialization files must be on lines separate from commands and must begin with an exclamation point You cannot nest EVE initialization files Do not use the DO command in an EVE initialization file The following sample initialization file sets left and right margins establishes overstrike mode binds the QUIT command to the GOLD Q key sequence and enables an EDT like keypad SET LEFT MARGIN 5 SET RIGHT MARGIN 60 OVERSTRIKE MODE DEFINE KEY gold q QUIT SET KEYPAD EDT 5 6 7 1 Using an EVE Initialization File at Startup You can cause an initialization file to be executed in any of the following ways when you invoke EVE Name the file EVESINIT EVE This is the default file name for EVE initialization files e Specify the name of the initialization file as a
18. Example 4 9 shows how to use the CASE statement in a procedure CASE constant expressions must evaluate at compile time to either a keyword a string constant or an integer constant All constant expressions in the CASE statement must be of the same data type There are two special case constants in DECTPU INRANGE and OUTRANGE INRANGE matches anything that falls within the case range that does not have a case label associated with it OUTRANGE matches anything that falls outside the case range These special case constants are optional FROM and TO dauses of a CASE statement are not required If FROM and TO dauses are not specified INRANGE and OUTRANGE labels refer to data between the minimum and maximum specified labels Example 4 9 shows a sample procedure that uses the CASE statement Example 4 9 Procedure That Uses the CASE Statement PROCEDURE grades answers answers READ LINE Enter number of correct answers 5 INT answers CASE answers FROM 0 TO 10 10 score At 9 score A 8 score B 7 score C 6 9 score f D 0 1 2 3 4 5 score F OUTRANGE score Invalid entry ENDCASE MESSAGE score ENDPROCEDURE This CASE statement compares the value of the constant selector answers to the case labels the numbers O through 10 If the value of answers is any of the numbers from 0 through 10 the statement to the right of that number is executed If t
19. JOURNAL memo tjl memo txt In buffer change journaling to recover the changes made to a specified buffer use the RECOVER BUFFER built in procedure For more information on RECOVER BUFFER see the DEC Text Processing Utility Reference Manual For more information on how to recover from an interrupted EVE editing session see the Extensible Versatile Editor Reference Manual Note Compaq strongly recommends the use of buffer change journaling rather than keystroke journaling 2 6 9 MODIFY MODIFY default NOMODIFY The MODIFY qualifier determines whether the first user buffer in an editing session is modifiable The application layered on DECTPU is responsible for processing MODIFY To determine what form of the MODIFY qualifier was used on the DCL command line use the following calls Xs xs GET INFO COMMAND LINE modify GET INFO COMMAND LINE nomodify The first statement returns 1 if MODIFY was explicitly specified on the command line O otherwise The second statement returns 1 if NOMODIFY was explicitly specified on the command line 0 otherwise If both statements return 0 then the application is expected to determine the default behavior For more information on GET INFO see the DEC Text Processing Utility Reference Manual Getting Started with DECTPU 2 15 Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers If you invoke EVE and do not specify MODIFY NOMODIFY
20. Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words Example 4 8 Recursive Procedure PROCEDURE user_reverse LOCAL temp_string temp_string READ_LINE input gt Read a response IF temp string lt gt Quit if nothing entered but the RETURN key THEN user reverse Call user reverse recursively ELSE RETUR All done go to display lines ENDIF MESSAGE temp string Display lines typed in reverse order in the message window ENDPROCEDURE 4 9 4 7 Local Variables The use of local variables in procedures is optional If you use local variables they hold the values that you assign them only in the procedure in which you dedare them The maximum number of local variables that you can use is 255 Local variables are initialized to O Syntax LOCAL variable name If you declare a local variable in a procedure and in the same procedure use the EXECUTE built in to assign a value to a variable with the same name as the local variable the result of the EXECUTE built in has no effect on the local variable Consider the following code fragment PROCEDURE test LOCAL X EXECUTE X 3 MOVE VERTICAL X ENDPROCEDURE In this fragment when the compiler evaluates the string X 3 the compiler assumes X is a global variable The compiler creates a global variable X if none exists and assigns the value 3 to the variable When the MOVE VERTICAL built in procedur
21. Line Mode Editor Example A 1 Cont Line Mode Editing Top of buffer command ARA POSITION BEGINNING OF CURRENT BUFFER ESSAGE CURRENT LINE Next line command N OVE_HORIZONTAL CURRENT_OFFSET OVE_VERTICAL 1 ESSAGE CURRENT_LINE Insert text command I SPLIT_LINE COPY_TEXT SUBSTR cmd 2 999 ESSAGE CURRENT_LINE List from here to end of file command L ml MARK NONE LOOP MESSAGE CURRENT LINE MOVE VERTICAL 1 EXITIF MARK NONE END OF CURRENT BUFFER ENDLOOP POSITION m1 QUIT 9 E QUIT INRANGE OUTRANGE MESSAGE Unrecognized command enter I L N Q or T ENDCASE ENDLOOP A 2 Translation of Control Characters Example A 2 shows how to display control characters in a meaningful way This is accomplished by translating the buffer to a different visual format and mapping this new form to a window On the VT400 VT300 and VT200 series of terminals control characters are shown as reverse question marks on the VT 100 series of terminals they are shown as rectangles Example A 2 Procedure to Display Control Characters This procedure performs the substitution of meaningful characters for the escape or control characters l PROCEDURE translate_controls char_range LOCAL replace_text If the translation array is not yet set up then do it now The elements that we do not initialize will contain the value TPUK_UNSPECIF
22. Om Note Do not assume that the DECTPU compiler automatically evaluates an expression in left to right order To avoid the need to rewrite code you should write as if this compiler optimization were already implemented If you need the compiler to evaluate an expression in a particular order you should force the compiler to evaluate each operand in order before using the expression To do so use each operand in an assignment statement before using it in an expression For example suppose you want to use ROUTINE 1and ROUTINE 2 in an expression Suppose too that ROUTINE 1 must be evaluated first because it prompts for user input To get this result you could use the following code PARTIAL 1 PARTIAL 2 ROUTINE 1 ROUTINE 2 You could then use a statement in which the order of evaluation was important such as the following IF PARTIAL 1 OR PARTIAL 2 Lexical Elements of the DEC Text Processing Utility Language 4 9 Lexical Elements of the DEC Text Processing Utility Language 4 8 Expressions There are four types of DECTPU expressions e Arithmetic e Relational Pattern e Boolean The following sections discuss each of these expression types 4 8 1 Arithmetic Expressions You can use any of the arithmetic operators with integer data types to form arithmetic expressions DECTPU performs only integer arithmetic The following are examples of valid DECTPU expressions 12 4 adds two inte
23. RT a Declarations and Statements 0 0 0 0 cc cee ee ees Module Declaration esena ee e e ee eee ee Procedure Declaration 0 0 0 0 ccc eee eee ee Procedure Names 1 0 ce ee ee eee as Procedure Parameters 0 0 0 ccc cee n Procedures That Return a Result odes Rem bee Recursive Procedures sasaaa aaa ee ee ees Local Variables Constants ON ERROR Statements 0 cee Assignment Statement llle Repetitive Statement llle Conditional Statement 2 0 0 0 Case Statement Error Handling Procedural Error Handlers 00 0000 cece eee eee ees Case Style Error Ctrl C Handling Handles 3 4 uo ur en tt mt Pec E Rm nee D aa RETURN Statement sers ABORT Statement cert Maro eene a Arla Mak lane E Miscellaneous Declarations se RR EQUIVALENCE LOCAL CONSTANT VARIABLE Lexical Keywords Conditional Compilation lilii Specifying the Radix of Numeric Constants 000005 5 DEC Text Processing Utility Program Development Creating DECTPU Programs ee 5 1 5 1 1 5 1 2 5 1 3 5 2 5 2 1 5 2 2 Simple Programs Complex Programs Program Syntax Programming in DECwindows DECTPU eee Widget Support Input Focus Support 4 5 4 5 4 6 4 7 4 8 4 10 4 10 4 11 4 11 4 12 4 12 4 12 4 12 4 13 4 14 4 15 4 15 4 15 4 18 4 18 4 19 4 19 4
24. THEN statement causes the execution of a statement or group of statements depending on the value of a Boolean expression If the expression is true the statement is executed otherwise program control passes to the statement following the IF THEN statement The optional ELSE dause provides an alternative group of statements for execution The ELSE clause is executed if the test condition specified by IF THEN is false 4 20 Lexical Elements of the DEC Text Processing Utility Language 4 9 4 13 Case Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words The ENDIF statement specifies the end of a conditional statement Syntax IF expression THEN statement 1 statement n ELSE alternatestatement_ I alternate statement n ENDIF You can use any DECTPU language statements except ON ERROR statements in a THEN or ELSE clause For example PROCEDURE set direct MESSAGE Press PF3 or PF4 to indicate direction temp char READ KEY IF temp char KP5 THEN SET REVERSE CURRENT BUFFER ELSE IF temp char KP4 THEN SET FORWARD CURRENT BUFFER ENDIF ENDIF ENDPROCEDURE In this example nested IF THEN ELSE statements test whether a buffer direction should be forward or reverse Caution Do not assume that the DECTPU compiler automatically evaluates all parts of an IF statement To avoid the need to rewrite code you should write as if this compiler optimization were al
25. Text Processing Utility Language 4 8 Expressions e You can mix data types when using the not equal lt gt and equal relational operators You can mix strings and integers when doing string replication Except for these cases DECTPU does not perform implicit type conversions to allow for the mixing of data types within an expression If you mix data types DECTPU issues an error message In the following example the elements J 4 and my string this is my string each evaluate to an integer type odd integers are true even integers are false so that they can be used following the DECTPU IF statement IF J gt 4 AND my string this is my string THEN With the exception of patterns and the relational operators the result of an expression is the same data type as the elements that make up the expression The following example shows a pattern expression that uses a string data type on the right hand side of the expression The LINE BEGIN and REMAIN pattern keywords are used with the string constant the to create a pattern data type that is stored in the variable pat1 patl LINE BEGIN the REMAIN Whenever possible the DECTPU compiler evaluates constant expressions at compile time DECTPU built in procedures that can return a constant value given constant input are evaluated at compile time In the following example the variable fubar has a single string assigned to it fubar ASCII 27
26. and CONSTANT declarations can be intermixed The maximum number of local variables you can declare in a procedure is 255 Local variables are initialized to O 4 30 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words Syntax LOCAL variable name Local variables may also be dedared in unbound code Such variables are accessible only within that unbound code Unbound code can occur in the following places e Module initialization code This occurs after all procedure declarations within a module but before the ENDMODULE statement e Executable code This occurs after all module and procedure declarations in a file but before the end of file The following example shows a complete compilation unit This unit contains a module named mmm that in turn contains a procedure bat and some initialization code mmm_module init a procedure bar defined outside the module and some unbound code at the end of the file In each of these sections of code a local variable X is defined The variable is displayed using the MESSAGE built in procedure ODULE mmm IDENT mmm PROCEDURE bat Declare procedure bat in module mmm LOCAL X X is local to procedure bat X Within procedure bat within module mmm ESSAGE X ENDPROCEDURE End procedure bat LOCAL X X is local to procedure mmm module init X Star
27. and specify the file you want when you invoke EVE 5 26 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files 5 6 7 2 Using an EVE Initialization File During an Editing Session To execute an EVE initialization file during an editing session use the at sign command and specify the file For example the following command executes an initialization file called MYEVE EVE in your current default directory Command MYEVE Commands for buffer settings apply to the current buffer This is effectively the same as typing the commands that the file contains You may want to create initialization files to execute two or more related commands such as resetting both margins 5 6 7 3 How an EVE Initialization File Affects Buffer Settings Commands in an EVE initialization file that set buffer characteristics such as margins and tab stops affect a system buffer named DEFAULTS Buffers created during the editing session have the same settings as DEFAULTS For example if your initialization file contains the command SET RIGHT MARGIN 65 the value 65 is used as the right margin setting for the main buffer and for any buffers you create during the session with GET FILE or BUFFER commands To see the settings for the DEFAULTS buffer use the EVE command SHOW DEFAULTS BUFFER For example if you want to know what the tab settings are for the DEFAULTS buffer type the fol
28. another window over part of it the values for the previous window s visible top visible bottom and visible length are modified The value for visible length of the previous window is different from its original length until the new window is removed from the screen As long as the new window is on the screen and does not have another window mapped over it its original top and bottom are the same as its visible top and bottom 3 14 4 Mapping Windows When you want a window and its associated buffer to be visible on the screen use the MAP built in procedure Mapping a window to the screen has the following effects e The mapped window becomes the current window and the cursor is moved to the editing point in the buffer associated with the window The buffer associated with the window becomes the current buffer The window is marked as visible and mapped e The visible top visible bottom and visible length of the window are calculated and stored Initially these values are the same as the original values that were calculated when the window was created See the last item in the next list Mapping a window to the screen may have the following side effects The newly mapped window may ocdude other windows This happens when the original top or original bottom line of the newly mapped window overlaps the boundaries of existing visible windows Overlapping can cause some windows to be totally occluded or not visible Occluded windo
29. arithmetic 4 10 Boolean 4 11 evaluation by compiler 4 9 pattern 4 11 relational 4 10 types of 4 10 Extensible Versatile E ditor See EVE F Fatal internal error resulting from exceeding virtual address space 2 8 File default name for journaling 2 8 File specifications default file specifications 2 2 Found range selection in EVE 5 14 Free marker 3 8 to 3 10 Function procedures 4 18 G Gadget 3 22 GET INFO built in procedure string constant parameter journaling 2 6 2 14 journal file 2 7 2 14 WIDGET keyword parameter callback parameters 5 10 Global selection support for 5 6 to 5 7 Global variable 4 5 Identifier 4 5 IDENT statement 4 14 9d FDEF lexical keyword 4 33 9d F lexical keyword 4 33 IF statement 4 20 to 4 21 INFO WINDOW variable 5 24 Initialization files default handling 5 18 definition 2 3 during a session 5 27 effects on buffer settings 5 27 EVE 5 25to 5 27 ANITIALIZATION qualifier 2 13 Initializing variables 3 21 Input files 2 1 multiple 2 1 Input focus support for 5 5 INRANGE case constant 4 22 Integer constants 4 6 INTEGER data type 3 4to 3 5 ANTERFACE qualifier 2 14 Interruption of program 5 16 Invoking DECTPU 2 1 from a batch job 2 6 from DCL command procedure 2 3 interactively 2 1 restrictions to consider before 2 8 J J ournal file default name 2 8 getting name of 2 7 2 14 security caution 2 6 J ournaling buffer chan
30. buf DEC Text Processing Utility Data Types 3 3 DEC Text Processing Utility Data Types 3 2 Buffer Data Type In this statement my_buf is the identifier for the variable my_buf The string my buffer is the name associated with the buffer The distinction between the name of the buffer variable and the name of the buffer is useful when you are developing an application layered on DECTPU For example the application can use an internal buffer name such as main_buffer to manipulate a given buffer such as the main buffer in EVE However the application can associate the name of your input file with the buffer making it easier for you to remember which buffer contains the contents of a given file If you want to delete the buffer itself use the DELETE built in procedure with the buffer variable as the parameter More than one buffer variable can represent the same buffer The following statement causes both my_buf and old_buf to point to the same buffer old_buf my_buf A buffer remains in DECTPU s internal list of buffers even when there are no variables pointing to it You can use the GET_INFO built in procedure to retrieve buffers from DECTPUSs internal list Creating a buffer does not cause the information contained in the buffer to become visible on the screen The buffer must be associated with a window that is mapped to the screen for the buffer contents to be visible Editing can take place in a buffer even if the buffer
31. caller can also use optional parameters If the required parameters are not present or the procedure is called with too many parameters more than the sum of the required and optional parameters then DECTPU issues an error If a procedure is called with the required number of parameters but with less than the maximum number of parameters then the remaining parameters up to the maximum automatically become null parameters A null parameter is a modifiable parameter of data type unspecified A null parameter can be assigned a value and will become the value it is assigned but the parameter s value is discarded when the procedure exits Null parameters can also be explicitly passed to a procedure You can do this by omitting a parameter when calling the procedure Example 4 5 shows a more complex procedure that uses optional parameters 4 16 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words Example 4 5 Complex Procedure with Optional Parameters CONSTANT user_warning t user_success user_error user_informational user_fatal Warning severity code Success severity code Error severity code Informational severity code Fatal severity code Bw NF se SOS OSS Output a message with fatal error warning flash PROCEDURE user message the text the severity LOCAL flash it Only flash warning error
32. commands and keypad bindings QUIT Stops execution of the current procedure Uses the ABORT statement to return to the main loop of DECTPU This command is useful when you have located a problem in a procedure and are ready to get out of the procedure SCROLL number of lines Scrolls text in the source display area by the specified number of lines To scroll backward through the code in the display area specify a negative number of lines To scroll forward by one line less than the number of lines in the display window press the Next Screen key or the sequence GOLD Down Arrow To scroll backward in the same way press the Prev Screen key or the sequence GOLD Up Arrow SET BREAKPOINT procedure name Invokes the debugger when the specified procedure is entered DECTPU Debugger Commands C 1 DECTPU Debugger Commands SET WINDOW top length Places the top of the debugger window at the line number specified by the top parameter Extends the window down by the number of lines specified by the length parameter The default length is 7 lines The minimum valid length is 3 lines The SET WINDOW command changes only the size of the source display area The output area and command line always occupy exactly one line SHIFT number of columns Moves the source display window left or right across the source code to display text wider than the screen To move left you press the key sequence GOLD Left Arrow then enter the number of c
33. default DECTPU creates the buffer change journal file name by using the following algorithm 1 Converts all characters in the buffer name that are not alphanumeric a dollar sign underscore or hyphen to underscores 2 Truncates the resulting file name to 39 characters 3 Adds the file type TPU J OURNAL For example a buffer named TEST BAR has a default journal file name of TEST _ BAR TPU J OURNAL DECTPU puts all journal files in the directory defined by the logical name TPU J OURNAL By default this logical is defined as SYS SCRATCH You can reassign this logical name For example if you want journal files written to the current default directory define TPU J OURNAL as 2 5 Avoiding Errors Related to Virtual Address Space DECTPU manipulates data in a process s virtual memory space If the space required by the DECTPU images data structures and files in memory exceeds the virtual address space DECTPU tries to write part of the data to the work file thus freeing up space for other parts of the data that it needs immediately If the work file is full DECTPU attempts to return either a TPU GETMEM or TPU NOCACHE error message Although you may be able to free up some space by deleting unused buffers Compaq recommends that you terminate the DECTPU session if you encounter either of these errors You can then start a new session with fewer or smaller buffers Alternatively you may want to put the work file on a disk that c
34. keywords 4 2 Case Sensitivity of Characters The DECTPU compiler does not distinguish between uppercase and lowercase characters except when they appear as part of a quoted string For example the word EDITOR has the same meaning when written in any of the following ways EDITOR EDitOR editor The following however are quoted strings and therefore represent different values XY Z xyz Lexical Elements of the DEC Text Processing Utility Language 4 1 Lexical Elements of the DEC Text Processing Utility Language 4 3 Character Sets 4 3 Character Sets When you invoke DECTPU you can use one of the following keywords with the CHARACTER_SET qualifier to specify the character set that you want DECTPU to use DEC MCS for the DEC Multinational Character Set e SO LATINI for the ISO Latin1 Character Set e GENERAL for other general character sets e TPUSCHARACTER SET see the DCL help topic for this logical name Each character set is an 8 bit character set with 256 characters Each character in a set is assigned a decimal equivalent number ranging from 0 to 255 Each character set uses an extension of the American Standard Code for Information Interchange ASCII character set for the first 128 characters Table 4 1 shows the categories into which you can group the ASCII characters Table 4 1 Categories of ASCII Character Set Characters Category Meaning 0 31 Nonprinting characters such as tab line feed ca
35. must be separated with semicolons For example PROCEDURE version MESSAGE This is Version 1 020 ENDPROCEDURE This procedure writes the text This is Version 1 020 in the message area 4 9 4 3 Procedure Names A procedure name can be any valid identifier that is not a DECTPU reserved word Compaq suggests that you use a convention when naming your procedures For instance you might prefix procedure names with your initials In this way you can easily distinguish procedures that you write from other procedures such as the DECTPU built in procedures For example if J ohn Smith writes a procedure that creates two windows he might name his procedure js two_ windows This helps ensure that his procedure name is a unique name Most of the sample procedures in this manual have the prefix user with procedure names 4 9 4 4 Procedure Parameters Using parameters with procedures is optional If you use parameters they can be input parameters output parameters or both For example PROCEDURE user input output a b a b 3 ENDPROCEDURE at 5 a In the preceding procedure a is an input parameter It is also an output parameter because it is modified by the procedure input output In the same procedure b is an output parameter Lexical Elements of the DEC Text Processing Utility Language 4 15 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words The scope of procedure parameters is limit
36. of an assignment statement The following statement creates the element stringl in the array my array and assigns the element to the string Topeka my array stringl Topeka In the following example the first statement creates an integer indexed array int array The array has 10 elements the first element starts at index 1 The second statement stores a string in the first integer indexed element of the array The third statement stores a buffer in the eighth element of the array The fourth statement adds an integer indexed element dynamically This new element contains a string 3 2 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 1 Array Data Type int_array CREATE_ARRAY 10 1 int array 1 Store a string in the first element int array 8 CURRENT BUFFER int array 42 This is a dynamically created element If you assign a value to an element that has not yet been created then that element is dynamically created and both the index and the value are stored Subsequent references to that element index return the stored value In most cases if you reference an element that has not yet been created and you do not assign a value to the nonexistent element DECTPU does not create the element DECTPU simply returns the data type unspecified H owever if you reference a nonexistent element by passing the nonexistent element to a procedure DECTPU adds a new element to th
37. or the non DE Cwindows version of DECTPU use the DISPLAY qualifier on the DCL command line when you invoke DECTPU The DISPLAY qualifier is optional By default DECTPU uses DISPLAY CHARACTER_CELL regardless of whether you are running DECTPU on a workstation or a terminal If you specify DISPLAY CHARACTER_CELL DECTPU uses its character cell screen manager which implements the non DE Cwindows version of DECTPU by running in a DECterm terminal emulator or on a physical terminal If you specify DISPLAY DECWINDOWS and if the DECwindows environment is available DECTPU uses the DECwindows screen manager which creates a DECwindows window in which to run DECTPU If you specify DISPLAY DECWINDOWS and the DE Cwindows environment is not available DECTPU uses its character cell screen manager to implement the non DE Cwindows version of DECTPU For more information about the difference between a DECwindows window and a DECTPU window see Chapter 5 2 12 Getting Started with DECTPU Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers The NODISPLAY qualifier causes DECTPU to run without using the screen display and the keyboard functions of a terminal Use NODISPLAY in the following cases e When running DECTPU procedures in a batch job When using DECTPU on an unsupported terminal When you use NODISPLAY all operations continue as usual except that no output occurs The only exception is that informat
38. owner An application cannot prevent DECTPU from attempting to assert ownership of the primary global selection when DECTPU receives the input focus If DECTPU gets the primary selection by grabbing ownership itself DECTPU automatically executes the application s global selection grab routine if one is present If you are writing an application that conforms to the Motif Style Guide and you find that DECTPU has had to grab ownership of the primary selection itself and execute the global select grab routine your application may have a design problem 5 6 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 2 Programming in DECwindows DECTPU 5 2 3 4 Response to Requests for Information About the Global Selection DECTPU provides a threelevel hierarchy for responding to requests from another application for information about the current selection Applications layered on DECTPU may specify a routine that responds to requests for information about global selections either for the entire application or for one or more buffers in the application When DECTPU receives a request for information it checks whether there is a routine for the current buffer that responds to information about global selections If no buffer specific routine is available DECTPU checks for an application wide routine If no application wide routine is available DECTPU can provide information only about the primary selection th
39. qualifier to the EDIT TPU command e Define a logical name EVESINIT to point to your initialization file The first and third methods are appropriate if you intend to use one initialization file most of the time to customize your editing sessions If you name the file EVESINIT EVE and do not specify another EVE initialization file on the command line EVE automatically executes that file when you invoke DECTPU Use the second method to control which initialization file EVE executes to customize the editing session For example if you have an EVESINIT file but want to use another initialization file specify the other file by using the ANITIALIZATION qualifier to EDIT TPU To specify an initialization file called MY_INIT EVE enter the following command string on the command line EDIT TPU INITIALIZATION MY INIT EVE EVE always executes the initialization file specified on the command line if such a file is present If no file is specified on the command line EVE searches for EVESINIT EVE first in the current directory and then in your login area If EVE finds EVESINIT EVE it executes that file If the file is not found the editor checks whether the logical name EVE INIT has been defined If you plan to create several initialization files and to use them equally you may not want to name one of the files EVESINIT For example if you want one initialization file to set narrow margins and another to set wide margins create both files
40. quotation mark some characters and a close quotation mark must have both its opening and closing quotation marks on the same line While a string can be up to 65 535 characters long a line in a DECTPU buffer can only be 32767 characters long If you try to create a line that is longer than 32767 characters DECTPU truncates the inserted text to the amount that fills the line to 32767 characters Many DECTPU built in procedures return a value of the string data type The ASCII built in procedure for example returns a string for the ordinal value that you use as a parameter The following statement returns the string K in the variable my char my char ASCII 75 To replicate a string specify the string to be reproduced then the multiplication operator and then the number of times you want the string to be replicated For example the following DECTPU statement inserts 10 underscores into the current buffer at the editing point COPY TEXT 10 The string to be replicated must be on the left hand side of the operator For example the following DECTPU statement produces an error COPY TEXT 10 To reduce a string specify the string to be modified then the subtraction operator and then the substring to be removed Table 3 2 shows the effects of two string reduction operations Table 3 2 Effects of Two String Reduction Operations DECTPU Statement Result COPY TEXT FILENAME MEM FILE Inserts the str
41. screen after you exit from DECTPU When all of the window widths are the same the physical screen width is changed Example A 3 Procedure to Restore Screen to Original Width PROCEDURE user restore screen LOCAL original screen width temp w original screen width GET INFO SCREEN original width IF original screen width lt gt GET INFO SCREEN width THEN temp w get info windows first LOOP EXITIF temp w 0 SET WIDTH temp w original screen width temp w GET INFO WINDOWS next ENDLOOP REFRESH ENDIF ENDPROCEDURE Define the key combination Ctrl E to do an exit which restores the screen to its original width repaints the screen and then exits DEFINE KEY user restore screen EXIT Ctrl E KEY A 6 Sample DECTPU Procedures Sample DECTPU Procedures A 4 Running DECTPU from an OpenVMS Subprocess A 4 Running DECTPU from an OpenVMS Subprocess Example A 4 shows one way of running DECTPU from a subprocess It also shows how to move to or from the subprocess Example A 4 Procedure to Run DECTPU from a Subprocess DCL command procedure to run DECTPU from subprocess IPut e keptedit in your login com This spawns the editor the first time land attaches to it after that I have defined a key to be attach so it always goes back to the parent tt fSgetdvi sysScommand devnam _ edit_name Edit_ tt priv list f setprv NOWORLD NOG
42. statement and the value of this expression is passed to the calling procedure Syntax RETURN expression The expression is optional if it is missing DECTPU supplies a O Also the RETURN statement itself is optional That is if DECTPU reaches the endprocedure of a procedure before encountering a RETURN statement it will return O Example 4 12 shows a sample procedure in which a value is returned to the calling procedure Example 4 12 Procedure That Returns a Value PROCEDURE user get shift key LOCAL key to shift Keyword for key pressed after shift key SET SHIFT KEY LAST KEY key to shift KEY NAME READ KEY SHIFT KEY RETURN key to shift ROCEDURE 1 kJ rd In addition to using RETURN to pass a value you can use a 1 true or a O false with the RETURN statement to indicate the status of a procedure Example 4 13 shows this usage of the RETURN statement 4 28 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words Example 4 13 Procedure That Returns a Status PROCEDURE user_at_end_of_line This procedure returns a 1 true if user is at the end of a line or a 0 false if the current character is not at the end of a line ON_ERROR Suppress warning message RETURN 1 ENDON_ERROR IF CURRENT_OFFSET LENGTH CURRENT_LINE THE RETURN 1 ELSE RETURN 0 ENDIF DPROCEDURE
43. statements The COMPILE and LOOKUP KEY built in procedures can optionally return a value of the program data type as a result The following example assigns a value of the program data type to the variable x x COMPILE main buffer MAIN_BUFFER must contain only DECTPU declarations executable statements and comments All declarations must come before any executable statements that are not included in the declarations The declarations and statements are compiled and the resulting program is stored in the variable x 3 18 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 10 Range Data Type 3 10 Range Data Type A range contains all the text between and including two markers You can form a range with the CREATE RANGE built in procedure A range is associated with characters within a buffer If the characters within a range move the range moves with them If characters are added or deleted between two markers that delimit a range the size of the range changes If all the characters in a range are deleted the range moves to the nearest character DECTPU does not support ranges of zero length unless the range begins and ends at the end of a buffer All other ranges contain at least one character which could be a space character or a line end if the range is created at the end of a line If you create a range by specifying a free marker as a parameter to the CREATE RANGE built in DECTPU creates
44. that you specify AII files read into the source buffer remain there so that the time DECTPU takes to find a procedure may increase as more files are read into the source buffer You cannot use the TPU command followed by the MESSAGE built in procedure to examine the contents of a local variable while debugging To use the MESSAGE built in to examine a local variable you must write the MESSAGE built in into the procedure you are debugging After the statement that contains MESSAGE is executed you can examine the message buffer to see the results Alternatively you can use the debugger EXAMINE command to examine local variables and the formal parameters of the suspended procedure 5 8 Handling Errors Each DECTPU built in procedure returns one or more status codes telling you what happened when the built in was executed A DECTPU status code can have one of the following severity levels SUCCESS e INFORMATIONAL WARNING ERROR FATAL You can enable or disable the display of informational or success messages with the SET INFORMATIONAL and SET SUCCESS built in procedures See Chapter 4 for a description of how to usethe ON ERROR language statement totrap error and warning messages In addition to messages that are generated by DECTPU a built in procedure may return system messages 5 30 DEC Text Processing Utility Program Development A Sample DECTPU Procedures The following DECTPU procedures are samples of how t
45. to you pressing Ctrl C the error message is written to the message buffer and DECTPU performs the equivalent of the following sequence special_error_symbol 0 LEARN_ABORT RETURN FALSE In a procedure with a case style error handler an ABORT statement produces the same effect as the sequence Ctrl C with one exception an ABORT statement in the TPU CONTROLC clause of a casecstyle error handler does not reinvoke the TPU CONTROLC dause as is the case when Ctrl C is pressed while TPU CONTROLC is executing Instead an ABORT statement causes DECTPU to exit from the error handler and look for a TPU CONTROLC selector in the procedures or program if any in which the current procedure is nested If DECTPU does not find a TPU CONTROLC selector in the containing procedures or program DECTPU places the message associated with TPU CONTROLC in the message buffer 4 9 4 17 Ctrl C Handling The ability to trap a Ctrl C in your DECTPU program is both powerful and dangerous When you press Ctrl C you usually want the application that is running to prompt for a new command The ability to trap the Ctrl C is intended to allow a procedure to clean up and exit gracefully 4 9 4 18 RETURN Statement The RETURN statement causes a return to the procedure that called the current procedure or program The return is to the statement that follows the statement that called the current procedure or program You can specify an expression after the RETURN
46. 19 4 20 4 20 4 20 4 21 4 23 4 24 4 25 4 28 4 28 4 29 4 30 4 30 4 30 4 32 4 32 4 32 4 33 4 34 vi 5 2 3 5 2 3 1 5 2 3 2 5 2 3 3 5 2 3 4 5 2 4 5 2 4 1 5 2 4 2 5 2 4 3 5 2 4 4 5 2 4 5 5 2 4 6 5 2 5 5 2 6 5 2 6 1 5 2 6 2 5 3 1 5 3 1 1 5 3 1 2 5 3 1 3 5 3 1 4 5 4 5 4 1 5 4 2 5 5 5 5 1 5 5 2 5 6 5 6 1 5 6 2 5 6 3 5 6 4 5 6 5 5 6 5 1 5 6 5 2 5 6 5 3 5 6 5 4 5 6 6 5 6 7 5 6 7 1 5 6 7 2 5 6 7 3 5 7 5 7 1 5 7 2 5 7 2 1 5 7 2 2 5 7 2 3 5 7 3 5 8 Global Selection Support 0 000000 ee Difference Between Global Selection and Clipboard Handling of Multiple Global Selections sess Relation of Global Selection to Input Focus Response to Requests for Information About the Global Selection ascen ete ik Bee Geeta Yaa Rd ERG ere Ea Using Callback Si eR ERA a Pelee led a LOE Beare ae E Background on DE Cwindows Callbacks lesen Internally Defined DECTPU Callback Routines and Application Level Callback Action Routines Internally Defined DECTPU Callback Routines with UIL Internally Defined DECTPU Callback Routines with Widgets Not Defined by UIL ils Re ER E ERE Rn Application Level Callback Action Routines Callable Interface Level Callback Routines Using Closures ied vx Re EU REREEERIG ee aly ak Sees UA RUE ee Specifying Values for Widget Resources in DECwindows DE
47. 2 and back All other terminals keep the physical width that is set when you enter the editor For the DECTPU screen manager to behave predictably on GIGI terminals you should report the terminal width as 84 to OpenVMS systems Use the DCL command SET TERMINAL DEVICE VT100 to set the proper terminal width Autorepeat ON OFF and Auxiliary Keypad Enabling To take advantage of the SET AUTO REPEAT built in procedure or to enable the auxiliary keypad for applications mode the terminal must be set to DEC CRT3 DEC CRT2 DEC CRT or VT100 Use the DCL command SET TERMINAL DEVICE characteristic to set the terminal Control Sequence Introducer DECTPU can use one 8 bit control sequence introducer CSI to introduce a terminal control sequence Usually you use the 2 character combination of the ESCAPE key and the left bracket To take advantage of this feature set your terminal to DEC CRT2 mode The Compaq VT300 series and VT220 and VT240 terminals currently support this feature Cursor Positioning If your terminal sets the DEC CRT mode bit DECTPU assumes that when control sequences that position the cursor to row 1 or column 1 are sent to the terminal the 1 can be omitted If your terminal does not behave correctly when it receives these control sequences you must turn off the DEC CRT mode bit Some foreign terminals may not be fully compatible with DECTPU and may exhibit this behavior Edit Mode Terminals that are operating in edit
48. 3 23 getting information 3 25 length 3 23 mapping 3 24 removing 3 25 unmapping 3 25 unsupported terminals 3 26 updating 3 25 values 3 24 width 3 23 WINDOW data type 3 22 to 3 26 X XOR operator 4 8 Index 7
49. 6 10 2 6 11 2 6 12 2 6 13 2 6 14 JJOURNAL MODIFY OUTPUT READ ONLY RECOVER SECTION START POSITION 3 DEC Text Processing Utility Data Types 3 14 3 14 1 3 14 2 3 14 3 3 14 4 3 14 5 3 14 6 3 14 7 3 14 8 Array Data Type Buffer Data Type Integer Data Type Keyword Data Type Learn Data Type Marker Data Type Pattern Data Type Using Pattern Built In Procedures and Keywords Using Keywords to Build Patterns leen Using Pattern Operators slleeeeeee ees t Pattern Concatenation Operator 00 cee eee amp Pattern Linking Operator 0 cece eee ee Pattern Alternation Operator 0 00 eee Partial Pattern Assignment Operator Relational Operators 0 0 ee Compiling and Executing Patterns llle Searching for a Pattern ccc nes Andioring a Patterns wi scien ia Sie beta Reig hee Be ie ee ave BES Process Data Type Program Data Type Range Data Type String Data Type Unspecified Data Type Widget Data Type Window Data Type Defining Window D Creating Windows Displaying Window Mapping Windows Removing Windows Using the Screen M WIMO NSI ONS Skane twee A ee a Se as etu NM AMOS PRREE DL PE ANAS eae kot Dus ciu bare ire qu ou URS a d Getting Information on Windows 0 0000000 ee
50. CL command line DECTPU specifies OUTPUT but does not supply a default file specification In EVE when you use OUTPUT you can name the file created from the main buffer when you exit from DECTPU For example the following command causes DECTPU to read in a file called LETTER RNO and to write the contents of the main buffer to the file NEWLET RNO upon exiting from DECTPU EDIT TPU OUTPUT newlet rno letter rno If you use OUTPUT to specify an output file EVE modifies the buffer even if you do not modify the actual text In this case when you exit from EVE EVE writes the buffer to the output file you specify By default the output file has the same name as the input file and the version number is one higher than the highest existing version of the input file You can spedify a different name for the output file by using the file specification argument for the OUTPUT qualifier In EVE specifying NOOUTPUT causes EVE to suppress creation of an output file for the first buffer of the editing session Using NOOUTPUT does not suppress creation of a journal file 2 16 Getting Started with DECTPU Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers Using NOOUTPUT you can develop an application that lets you control the output of a file For example an application could be coded so that if you specify NOOUTPUT on the DCL command line DECTPU would set the NO_WRITE attribute for the main buffer and suppress crea
51. CTPU DECTPU Data Types for Specifying Resource Values Specifying a List as a Resource Value 0 0 c eee eee Writing Code Compatible with DECwindows EVE 0 Select Ranges in DECwindows EVE 000 cece eee Dynamic Selection 0 0 0c ees Static Selection isse uoce ke ee eee A eee Found Range Selection 0 e eee Relation of EVE Selection to DECwindows Global Selection Compiling DECTPU Programs 0 000 Compiling on the EVE Command Line 0000 Compiling in a DECTPU Buffer 000000000000 Executing DECTPU Programs 0 00 ens Procedure Execution 0 000 ees Process Suspension paneta re a es Using DECTPU Startup Files 0 0 0 es Section FileSe 0 34 pdceve eho E beets tase ee E tet Command Files 5 401 d na uetus Mole ies ue reed pe gies Initialization Files 2 2 eee Sequence in Which DECTPU Processes Startup Files Using Section Files esse Re Bawa a EET LETS Creating and Processing a New Section File Extending an Existing Section File sssusa aaa Sample Section File leen Recommended Conventions for Section Files Using Command Files 0 000 e eee ees Using EVE Initialization Files 0 0 ee Using an EVE Initialization File at Startup Using an EVE Initialization File During an Editing Session How an EVE Ini
52. DECTPU DEC Text Processing Utility Program Development 5 21 DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files Example 5 5 Source Code for Minimal Interface to DECTPU MINI TPU minimal DECTPU interface PROCEDURE tpu init procedure Create a buffer and window for messages message buffer CREATE BUFFER Message Buffer SET NO WRITE message buffer SET SYSTEM message buffer SET EOB TEXT message buffer message window CREATE WINDOW 21 4 OFF MAP message window message buffer Create a buffer and window for SHOW show buffer CREATE BUFFER Show Buffer SET NO WRITE show buffer SET SYSTEM show buffer info window CREATE WINDOW 1 20 ON Create a buffer and window for editing main buffer CREATE BUFFER Main Buffer main window CREATE WINDOW 1 20 ON MAP main window main buffer Create an area on the screen for prompts SET PROMPT AREA 21 1 NONE Put the editing point in the main buffer POSITION main buffer tpu local init ENDPROCEDURE PROCEDURE tpu local init Procedure to allow end users Ito add private extensions ENDPROCEDURE Define the minimal editing keys DEFINE KEY SPLIT LINE RET KEY DEFINE KEY ERASE CHARACTER 1 DEL KEY DEFINE KEY EXECUTE READ LINE DECTPU Statement TAB KEY DEFINE KEY EXIT Ctrl Z KEY Create a section file and then quit IF get inf
53. DECTPU to execute EVE s main callback program the GET INFO WIDGET callback parameters array built in procedure returns the widget activated the reason code the reason the widget is calling back and the closure associated with the particular widget instance EVE s main callback program contains an array that is indexed with values identical to the widget dosure values Each array element contains a pointer to the EVE code to be executed in response to the corresponding widget s callback EVE s callback program uses the closure value to locate the appropriate array index so the correct EVE routine can be executed in response to the callback If your layered application does not use EVE s callback program then its callback program or learn sequence must have a mechanism for determining which widget is calling back and which application code should be executed as a result 5 2 6 Specifying Values for Widget Resources in DECwindows DECTPU This section discusses techniques for specifying values for widget resources 5 2 6 1 DECTPU Data Types for Specifying Resource Values DECTPU supports the following data types with which to specify values for widget resources String e Array of strings e nteger 5 10 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 2 Programming in DECwindows DECTPU DECTPU converts the value you specify into the data type appropriate for the widget resour
54. ECTPU 2 3 Invoking DECTPU from a Batch Job 2 3 Invoking DECTPU from a Batch Job 2 4 Using If you want your edits to be made in batch rather than at the terminal you can use the DCL command SUBMIT to send your job to a batch queue For example if you want to use the file GSR TPU shown in Example 2 4 to make edits in batch mode to a file called MY_FILE TXT enter the following command SUBMIT invisible tpu COM LOG invisible tpu LOG parameter my file txt This job is then entered in the default batch queue for your system The results are sent to the log file that the batch job creates In batch DECTPU EXIT is the same as QUIT Journal Files J ournal files help you to recover your work when the system fails This section discusses the journaling methods you can use with DECTPU DECTPU offers two journaling methods e Keystroke journaling e Buffer change journaling You can use both keystroke and buffer change journaling at the same time except on DECwindows where you can use only buffer change journaling To turn on keystroke journaling the application uses the JOURNAL_OPEN built in The application layered on DECTPU not the DECTPU engine determines what kind of journaling is turned on and under what conditions Table 2 2 shows the journaling behavior established by EVE Table 2 2 Journaling Behavior Established by EVE Effect on Keystroke OpenVMS Qualifier Journaling Effect on Buffer Change Journaling N
55. ECTPU Terminal Support B 1 Using Screen Oriented Editing on Supported Terminals B 1 2 SET TERMINAL Command When you use the SET TERMINAL command to specify characteristics for your terminal make sure to set only those characteristics that are supported by your terminal If you set characteristics that the terminal does not support the screen oriented functions of DECTPU may behave unpredictably For example if you run DECTPU on a VT100 terminal and you set the DEC_CRT2 characteristic that VT100s do not support DECTPU tries to use 8 bit CSI controls This could cause 7m to appear on the screen where the reverse video attribute should be set Most users do not knowingly set characteristics that are not supported by their terminals However if you temporarily move to a different type of terminal your LOGIN COM file may have characteristics set for your usual terminal that do not apply to the current terminal This problem may also occur if before running DECTPU you run a program that modifies your terminal characteristics without your knowledge If you see unexpected video attributes or extraneous characters on the screen exit from DECTPU and check your terminal characteristics with the DCL command SHOW TERMINAL To recover your files use the same terminal characteristics you used to create your file otherwise a journal file inconsistency may occur depending on how your interface is written B 2 Using Line Mode Editing on U
56. ELECT SEARCH SEARCH QUIETLY SELECT RANGE TRANSLATE DEC Text Processing Utility Data Types 3 19 DEC Text Processing Utility Data Types 3 10 Range Data Type The following example assigns a value of the range data type to the variable x x CREATE RANGE markl mark2 UNDERLINE You can specify the video attribute with which DECTPU should display a range The possible attributes are BLINK BOLD REVERSE and UNDERLINE The UNDERLINE keyword in the preceding example specifies that the characters in the range will be underlined when they appear on the screen You cannot give more than one video attribute to a range However to apply multiple video attributes to a given set of characters you can define more than one range that contains those characters and give one video attribute to each range 3 11 String Data Type DECTPU uses the string data type to represent character data A value of the string data type can contain any of the elements of a character set You can select one of the following character sets to use with your string data e DEC MCS DEC Multinational Character Set SO LATIN1 ISO Latin1 Character Set GENERAL Other general character sets DECTPU uses the string data type to represent character data A value of the string data type can contain any of the elements of the character sets mentioned previously To specify a string constant enclose the value in quotation marks In DECTPU you can use eith
57. ENDPROCEDURE ON ERROR MESSAGE Good bye END ON ERROR user hello ENDMODULE 4 14 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words 4 9 4 2 Procedure Declaration The PROCEDURE ENDPROCEDURE declaration delimits a series of DECTPU statements so they can be called as a unit With the PROCEDURE ENDPROCEDURE combination you can declare a procedure with a name so that you can call it from another procedure or from the command line of a DECTPU editing interface Once you have compiled a procedure you can enter the procedure name as a statement in another procedure or enter the procedure name after the TPU Statement prompt on the command line of EVE Syntax PROCEDURE procedure name parameter list T local declarations ON ERROR ENDON_ERROR statement 1 statement 2 statement n ENDPROCEDURE The local dedarations part of a procedure can include any number of LOCAL and CONSTANT declarations The ON ERROR ENDON ERROR block if used must appear after the dedarations and before the DECTPU statements that make up the body of the procedure For more information on error handlers see Section 4 9 4 14 After the ON ERROR ENDON ERROR block you can use any kind of DECTPU language statements in the body of a procedure except another ON ERROR ENDON ERROR block Statements that make up the body of a procedure
58. Guide to the DEC Text Processing Utility Order Number AA PWCBD TE April 2001 This manual introduces the DEC Text Processing Utility DECTPU It is for experienced programmers as well as new users of DECTPU Revision Update Information This manual supersedes the Guide to the DEC Text Processing Utility Version 3 1 Software Version OpenVMS Alpha Version 7 3 OpenVMS VAX Version 7 3 The content of this manual has not changed sinced OpenVMS Version 7 1 Compaq Computer Corporation Houston Texas 2001 Compaq Computer Corporation Compaq VAX VMS and the Compaq logo Registered in U S Patent and Trademark Office OpenVMS is a trademark of Compaq Information Technologies Group L P in the United States and other countries PostScript is a registered trademark of Adobe Systems Incorporated Motif is a registered trademark of the The Open Group All other product names mentioned herein may be the trademarks or registered trademarks of their respective companies Confidential computer software Valid license from Compaq or authorized sublicensor required for possession use or copying Consistent with FAR 12 211 and 12 212 Commercial Computer Software Computer Software Documentation and Technical Data for Commercial Items are licensed to the U S Government under vendor s standard commercial license Compaq shall not be liable for technical or editorial errors or omissions contained herein The information in this documen
59. HOW DEFAULTS BUFFER Display A 1 A 2 A 7 2 4 2 4 2 5 8 10 4 5 4 6 4 11 4 16 4 17 4 18 4 18 4 19 4 22 4 24 4 26 4 28 4 29 4 29 4 30 5 2 5 3 54 5 20 5 22 5 25 5 27 vii Tables viii 2 1 2 2 2 3 8 1 3 2 4 1 4 2 4 3 4 4 4 5 4 6 5 1 Line Mode Editing visco xe m exe RIEGO ER XS A Er Procedure to Display Control CharacterS 0 0c eee Procedure to Restore Screen to Original Width Procedure to Run DECTPU from a Subprocess DCL Command Procedure for SET TERM NOWRAP DECTPU asaBasefor EVE eR RR RR RI IA DECTPU as a Base for User Written Interfaces s Default File Specifications on OpenVMS Systems J ournaling Behavior Established by EVE ssssssss Character Set Values You Can Set with CHARACTER SET Keywords Used for Key Names llllll eee Effects of Two String Reduction Operations Categories of ASCII Character Set Characters ss Categories of DEC Multinational Character Set Characters Categories for ISO Latinl Characters 0 00 eee eee DECEPU Symbols ik EE ER bane Ree E DECETIPU Operators oeste bea os kee de a E Operator Precedence cc eee eee eens Relationship Between DECTPU Data Types and DE Cwindows Argument Data Types isse s uk eae ee ek ee eS Special DECTPU Variables That Requir
60. IDGET INTEGER CALLBACK callback routine 5 8 5 9 Index 6 TPUS WIDGET STRING CALLBACK callback routine 5 8 5 9 TPU X MESSAGE BUFFER variable 5 24 TPU X SHOW BUFFER variable 5 24 TPU X SHOW WINDOW variable 5 24 TPU UNKLEXICAL error message 4 34 TPU command 5 15 TPU debugger 5 28 to C 2 ATTACH command C 1 CANCEL BREAKPOINT command C 1 DEBUGON procedure 5 29 DEPOSIT command C 1 DISPLAY SOURCE command C 1 EXAMINE command C 1 GO command 5 29 C 1 HELP command C 1 invoking 5 28 QUIT command C 1 SCROLL command C 1 SET BREAKPOINT command 5 28 C 1 SET WINDOW command C 2 SHIFT command C 2 SHOW BREAKPOINTS command C 2 SPAWN command C 2 STEP command 5 30 C 2 TPU command C 2 U Unbound code use of local variables in 4 31 UNSPECIFIED data type 3 21 to 3 22 Unsupported terminals 3 26 Updating windows 3 25 Utility routines forming the DECTPU callable interface 5 1 V Value s assigning to widget resources 5 9 Variable buffer 3 4 global 4 5 initializing 3 21 local 4 5 4 19 4 30 VARIABLE declaration 4 32 Variables recommended naming conventions 5 25 Version number 5 2 Video attribute marker 3 8 range 3 20 Virtual address space DECTPU restriction concerning 2 8 W Widget listing of 5 4 WIDGET data type 3 22 Widget resources data types of 5 10 to 5 11 spedfying 5 10 Window creating 3 23 current 3 24 definition 3 22 dimensions
61. IED They are characters that TPU will display meaningfully IF translate_array TPUSK_UNSPECIFIED THEN continued on next page A 2 Sample DECTPU Procedures Sample DECTPU Procedures A 2 Translation of Control Characters Example A 2 Cont Procedure to Display Control Characters translate_array CREATE_ARRAY 32 0 translate array 1 SOH translate array 2 lt STX gt translate array 3 lt ETX gt translate array 4 lt EOT gt translate array 5 ENQ translate array 6 ACKO translate array 7 lt BEL gt translate array 8 lt BS gt translate array 14 lt S0O gt translate array 15 lt SI gt translate array 16 DLE translate array 17 DCl translate array 18 DC2 translate array 19 DC3 translate array 20 DC4 translate array 21 lt NAK gt translate array 22 SYN translate array 23 ETB translate array 24 CAN translate array 25 lt EM gt translate array 26 SUB translate array 27 ESC translate array 28 lt FS gt translate array 29 lt GS gt translate array 30 lt RS gt translate array 31 US ENDIF The range must be a single character long IF LENGTH char range lt gt 1 THEN RETURN 0 ENDIF Find the cha
62. Keystroke In a single journal file keeps track of each keystroke you make regardless of which buffer is in use when you press the key e Buffer change In a separate journal file keeps track of changes made to buffers for each buffer created during the session The application layered on DECTPU is responsible for processing this qualifier To determine whether you specified OURNAL on the DCL command line use the following call in the application x GET INFO COMMAND LINE journal The preceding call returns 1 if OURNAL was specified 0 otherwise To determine whether buffer change journaling is turned on for a buffer usea statement similar to the following status GET INFO buffer name journaling To determine the name of the keystroke journal file specified on the command line use the following call X GET INFO COMMAND LINE journal file For more information on GET INFO see the DEC Text Processing Utility Reference Manual In EVE if you do not specify any form of OURNAL or specify OURNAL but not a journal file buffer change journaling is turned on The buffer change journal file s default file type is TPU J OURNAL If you specify OURNAL filename then EVE also turns on keystroke journaling The keystroke journal file s default file type is TJ L To prevent EVE from creating either a keystroke or buffer change journal file for an editing session use the NOJ OURNAL qualifier For e
63. Manual In EVE using the READ ONLY qualifier is equivalent to using the NOJ OURNAL NOMODIFY and NOOUTPUT qualifiers If you specify READ_ ONLY DECTPU does not maintain a journal file for your editing session and the NO WRITE and NO MODIFY attributes are set for the main buffer When a buffer is set to NO WRITE the contents of the buffer are not written out upon exit regardless of whether the session is terminated with the EXIT built in or the QUIT built in For example if you want to edit a file called MEETING MEM but not write out the contents when exiting or quitting use the following command EDIT TPU READ ONLY meeting mem In response to the NOREAD ONLY qualifier EVE writes out the buffer specified on the command line if the buffer has been modified when an EXIT command is issued This is the default behavior Getting Started with DECTPU 2 17 Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers 2 6 12 RECOVER RECOVER NORECOVER default The RECOVER qualifier determines whether DECTPU reads a keystroke journal file at the start of an editing session to recover edits made during a prior interrupted editing session For example the following command causes DECTPU to recover the edits made in a previous EVE editing session on the file NOTES TXT EDIT TPU RECOVER notes txt To determine whether you specified RECOVER on the DCL command line use the following call x GET INFO C
64. NITIALIZATION qualifier with the EDIT TPU command For more information on the INITIALIZATION qualifier see Section 2 6 6 5 6 4 Sequence in Which DECTPU Processes Startup Files When you invoke DECTPU by default DECTPU reads compiles and executes several files The sequence in which DECTPU performs these tasks is as follows 1 DECTPU loads into memory the specified or default section file unless you specify the NOSECTION qualifier on the command line 2 DECTPU reads the specified or default command file if found into a buffer named LOCAL I NI unless you specify the NOCOMMAND qualifier on the command line 3 If you specify the DEBUG qualifier on the command line DECTPU reads the specified or default debugger file into a buffer named DEBUG INI A debugger file contains DECTPU procedures and statements to help debug DECTPU code For more information on the default DECTPU debugger see Section 5 7 4 Ifthe buffer named DEBUGSINI which contains debugger code is present DECTPU compiles the buffer and executes the resulting program 5 DECTPU calls and executes the procedure named TPUSINIT PROCEDURE if the procedure is present in the section file or is defined in the debug file 6 If the command file is read into the buffer named LOCAL INIS DECTPU compiles that buffer and executes the resulting program 7 DECTPU calls and executes the procedure named TPUSINIT POSTPROCEDURE if the layered application has defined
65. O TEXT MARKER PROCEDURE goto text marker LOCAL text marker pattern text marker range text marker pattern MATCH text marker range SEARCH QUIETLY text marker pattern GET INFO CURRENT BUFFER direction IF text marker range lt gt 0 THEN POSITION text marker range MESSAGE Text marker not found RETURN text marker range ENDPROCEDURE If you name the file that contains this procedure TEXT MARKERS TPU you can invoke DECTPU with EVE and your command file with the following command EDIT TPU COMMAND device directory text markers tpu If you add procedures or statements to the command file TEXT MARKERS TPU place all procedures before any individual statements that are not listed within a procedure for example key definitions to move to the next text marker Remember to name your variables and procedures so they do not conflict with DECTPU reserved words and predefined identifiers Compaq recommends that you prefix your variable and procedure names with three letters your initials for example followed by an underscore 5 6 7 Using EVE Initialization Files An initialization file is a file that contains commands to be executed by an application Any application layered on DECTPU can support initialization files With EVE initialization files you can dothe following Use EVE commands in a startup file to customize editing sessions DEC Text Processing Utility Program
66. OMMAND LINE recover The preceding call returns 1 if RECOVER was specified 0 otherwise For more information on GET INFO see the DEC Text Processing Utility Reference Manual DECTPU uses RECOVER to recover a keystroke journal file only In buffer change journaling to recover the changes made to a specified buffer use the RECOVER BUFFER built in procedure For more information on RECOVER BUFFER see the DEC Text Processing Utility Reference Manual If DECTPU encounters and executes the built in procedure J OURNAL OPEN while running a layered application by default DECTPU opens the journal file for output only If you specify RECOVER when invoking DECTPU with a layered application then when the built in procedure J OURNAL OPEN is executed the keystroke journal file is opened for input and output DECTPU opens the input file to restore whatever commands it contains Then DECTPU continues to journal keystrokes for the rest of the editing session or until a statement that contains the built in J OURNAL CLOSE is executed When you recover an editing session every file used during the session must be in the same state as it was at the start of the session being recovered Each terminal characteristic must also be in the same state as it was at the start of the editing session being recovered If you have changed the width or page length of the terminal you must change the attribute back tothe value it had at the start of the editin
67. OR TEXT is set to the message associated with the error or warning DECTPU places the message in the message buffer then resumes execution at the statement after the statement that generated the error or warning e For other errors and warnings ERROR is set to the keyword that represents the error or warning ERROR LINE is set to the line number of the error and ERROR TEXT is set to the message associated with the error or warning DECTPU places the message in the message buffer then resumes execution at the statement after the statement that generated the error or warning In a procedure the error handler must be placed at the beginning of a procedure after the procedure parameter list the LOCAL or CONSTANT declarations if present and before the body of the procedure In a program the ON ERROR language statements must be placed after all the global dedarations PROCEDURE CONSTANT and VARIABLE and before any executable statements Error statements can contain any DECTPU language statements except other ON ERROR statements There are three DECTPU lexical elements that are useful in an error handler ERROR ERROR LINE and ERROR TEXT ERROR returns a keyword for the error or warning The DEC Text Processing Utility Reference Manual includes information on the possible error and warning keywords that each built in procedure can return ERROR LINE returns the line number at which the error or warning occurs If a procedure was compil
68. PU processes than your account subprocess quota allows e You cannot spawn a subprocess in an account that has the CAPTIVE flag set e Only OpenVMS utilities that can perform I O to a mailbox and that do simple reads and writes for example MAIL can run in a DECTPU process Programs like FMS PHONE or any other program that takes full control of the screen do not work properly in a DECTPU process See the built in procedure SPAWN for information on running these types of programs from DECTPU e You do not see any prompts from the utility you are using For example in MAIL you have to be aware of the sequence of prompts for sending a mail message because you do not see the prompts The following example assigns a value of the process data type to the variable x x CREATE PROCESS main buffer MAIL The first parameter specifies that the output from the process is to be stored in MAIN BUFFER The string MAIL is the first command sent to the subprocess To pass commands to a subprocess use the SEND built in procedure as follows SEND MAIL x To pass the READ command to the Mail utility enter the following DECTPU statement SEND READ x The output from the READ command is stored in the buffer associated with the process x If the buffer associated with a process is deleted the process is deleted as well 3 9 Program Data Type A program is the compiled form of a sequence of DECTPU procedures and executable
69. PU programs To debug DECTPU programs you can do one of the following Write your own debugger in the DECTPU language This is discussed in Section 5 7 1 e Usethe DECTPU debugger provided in TPU DEBUG TPU This is discussed in Section 5 7 2 Regardless of which debugger you use you may find it helpful to enable the display of error line numbers by using SET LINE NUMBER ON and to enable the display of procedures called when an error occurs by using SET TRACEBACK ON 5 7 1 Using Your Own Debugger If you write your own debugger you can invoke it and bypass the default bugger by using the DEBUG qualifier with the EDIT TPU command For example to use a debugger called MY DEBUGGER TPU on a file called MIGHT BE BUGGY TPU type the following EDIT TPU DEBUG MY DEBUGGER TPU MIGHT BE BUGGY TPU 5 7 2 Using the DECTPU Debugger You can invoke the DECTPU debugger to debug one of the following kinds of files Section files e Command files Files that contain DECTPU programs that are not startup programs The following sections contain more information on debugging each kind of file 5 7 2 1 Debugging Section Files To invoke the debugger for a section file specify the following command on your command line EDIT TPU DEBUG Use of your system s debug command causes the DECTPU initialization routine to execute the debugger file before the system runs its initialization procedure The debugger initially creates a window tha
70. Processing Utility Reference M anual To specify the DECTPU data types BUFFER MARKER LEARN and so on To report warning or error status conditions TPU BADMARGINS TPU _ CREATEFAIL TPU NOEOBSTR and so on To pass the names of keys to DECTPU procedures DEC Text Processing Utility Data Types 3 5 DEC Text Processing Utility Data Types 3 4 Keyword Data Type Table 3 1 shows the correspondence between keywords used as DECTPU key names and the keys on the VT400 VT300 VT 200 and VT100 series of keyboards You do not have to define a key or control sequence just because there is a DECTPU keyword for the key or sequence Table 3 1 Keywords Used for Key Names VT400 VT300 VT200 DECTPU Key Name Series Key VT100 Key PF1 PF1 PF1 PF2 PF2 PF2 PF3 PF3 PF3 PF4 PF4 PF4 KPO KP1 KP9 0 1 9 0 1 9 Period Comma Minus E Enter Enter Enter Up Up arrow Up arrow Down Down arrow Down arrow Left Left arrow Left arrow Right Right arrow Right arrow El Find E1 E2 Insert Here E2 E3 Remove E3 E4 Select E4 E5 Prev Screen E5 E6 Next Screen E6 Help Help F15 Do Do F16 F6 F7 F20 F6 F7 F20 NULL KEY Ctrl space Ctrl space TAB KEY Tab Tab RET KEY Return Return DEL KEY lt x Delete LF_KEY Ctrl J Line feed BS KEY Ctrl H Backspace Ctrl A KEY Ctrl A Ctrl A Ctrl B KEY Ctrl B Ctrl B lCtrl A means pressing the Ctrl key simultaneously with the A key A and a produce the same resu
71. RE procedure should perform the following operations e Initialize all global variables to their startup values Create all required work spaces for the editor see the list of special purpose buffers and windows in Table 5 2 You can add other functions to TPUSINIT PROCEDURE but it should perform at least these two operations If your application allows the end user to customize the application by using a command file you may want to make available to the user a procedure called TPUSLOCAL INIT Although this name is not required it is commonly used by DECTPU programmers DEC Text Processing Utility Program Development 5 23 DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files In EVE the code that implements the initialization sequence calls TPUSLOCAL INIT before executing your command or initialization files EVE defines this procedure but leaves it empty The user can use this procedure in a command file to contain DECTPU statements that implement private initializations You can see the code that implements TPU LOCAL_INIT in EVE in SYS EXAMPLES EVE CORE TPU A section file that implements a layered application should assign values to the following special variables in the procedure TPUSINIT PROCEDURE TPU X_MESSAGE BUFFER or MESSAGE BUFFER TPU X_SHOW_BUFFER or SHOW BUFFER e TPU X SHOW WINDOW or INFO WINDOW If you write a section file that extends the EVE section file EVE provides six variabl
72. ROUP pid 0 108 proc f getjpi f pid pid PRCNAM if proc eqs edit name then goto attach if pid ne 0 then goto 10 pawn priv list f setprv priv list write sysSerror Spawning a new Kept Editor define nolog sys input sys command ti fSedit pl now p2 n p3 Wow p4 now po n p6 now p Wow p8 COLLAPSE spawn process edit name nolog edit tpu tl 9 VEU Un Ue XE HUE HUM XU X IU KN ur rite sysSerror Attached to DCL in directory f env DEFAULT w T OS O E H tach riv list f setprv priv_list rite sys error Attaching to Kept Editor efine nolog sys input sys command ttach edit name rite sysSerror Attached to DCL in directory f env DEFAULT exit UU cU cU cU X X X MD ur Sample DECTPU Procedures A 7 B DECTPU Terminal Support This appendix lists the terminals that support screen oriented editing and describes how differences among these terminals affect the way DECTPU performs This appendix also describes how you can run DECTPU on terminals that do not support screen oriented editing Finally this appendix tells you how DECTPU manages wrapping and how you can modify that B 1 Using Screen Oriented Editing on Supported Terminals DECTPU supports screen oriented editing only on terminals that respond to ANSI control functions and that operate in ANSI mode DECTPU screen oriented editing is des
73. TPU statements are identical patl patl atb amp c de amp ee a b amp c ld e In addition to the pattern operators you can use two relational operators equal and not equal lt gt to compare patterns The following sections discuss the pattern operators 3 7 3 1 Pattern Concatenation Operator The concatenation operator tells SEARCH or SEARCH QUIETLY that text matching the right pattern element must immediately follow the text matching the left pattern element in order for the complete pattern to match In other words the concatenation operator specifies a search in which the right pattern element is anchored to the left For example the following pattern matches only if there is a line in the searched text that ends with the string abc patl abc line eng If SEARCH or SEARCH QUIETLY finds such a line the built in returns a range that contains the text abc and the end of the line Compaq recommends that you use the concatenation operator rather than the link operator unless you specifically require the link operator 3 7 8 2 amp Pattern Linking Operator The link operator amp is similar to the concatenation operator Unlike the concatenation operator the link operator does not necessarily cause an anchored search If you define a pattern by specifying any pattern element an ampersand amp and a pattern or keyword variable a search for each subpattern is not an anchored search
74. Terminals That Do Not Support Windows llle 4 Lexical Elements of the DEC Text Processing Utility Language 4 1 4 2 4 3 4 3 1 4 3 2 4 3 3 4 3 4 4 3 5 Overview Case Sensitivity of Cha Character Sets DEC Multinational ACES rai RT E e aa aAa EE a aAA Yan a Character Set DEC MCS 0 ISO Latin1 Character Set ISO LATIN1 lle General Character Sets 0 0 0 0 ee Entering Control Characters 0 00 cece eee ess DECTPU Symbols a ae ea a Da N a a oooNnNoOgoaGAaA Io e deoe ate hoe peto eM N OODOWAONDADARARWWWNNOCAN TAR WP Qu QA qe aba BAY Vege TR HA Car bla ARVs Vea By Uni Qo Re NNN a a AH AH AH AS AS BS SS SS et d m nm Pp Wow N 3 24 3 24 3 25 3 25 3 25 3 26 4 1 4 1 4 2 4 2 4 3 4 3 4 3 4 4 4 9 4 4 9 4 1 4 9 4 2 4 9 4 3 4 9 4 4 4 9 4 5 4 9 4 6 4 9 4 7 4 9 4 8 4 9 4 9 4 9 4 10 4 9 4 11 4 9 4 12 4 9 4 13 4 9 4 14 4 9 4 15 4 9 4 16 4 9 4 17 4 9 4 18 4 9 4 19 4 9 5 4 9 5 1 4 9 5 2 4 9 5 3 4 9 5 4 4 10 4 10 1 4 10 2 Identifiers Variables Constants Operators Expressions Arithmetic Expressions 000 cece Relational Expressions isses Pattern Expressions Boolean Expressions Reserved Words Keywords Built In Procedure Names sseee RR n Predefined Constants s cus cakes Se Gel ae o e CO RU RR RO
75. Text Processing Utility 1 3 Overview of the DEC Text Processing Utility 1 2 Description of DECwindows DECTPU The DECwindows version of DECTPU does not provide access to all of the features of DE Cwindows For example there are no DECTPU built in procedures to handle floating point numbers or to manipulate entities such as lines curves and fonts With DECwindows DECTPU you can create a wide variety of widgets designate callback routines for those widgets fetch and set geometry and text related resources of the widgets and perform other functions related to creating a DECwindows application For example the DECwindows EVE editor is a text processing interface created with DECwindows DECTPU 1 2 2 DECwindows DECTPU and the DECwindows User Interface Language You can use DECTPU programs with DECwindows User Interface Language UIL files just as you would use programs in any other language with UIL files For an example of a DECTPU program and a UIL file designed to work together see the description of the CREATE WIDGET built in in the DEC Text Processing Utility Reference Manual For more information about using UIL files in conjunction with programs written in other languages see the VM S DECwindows Guide to Application Programming 1 3 Description of EVE The Extensible Versatile Editor EVE is the editor provided with DECTPU EVE is easy to learn and to use You can access many of EVE s editing functions by pressing a single key o
76. UIETLY stops searching Usually all pattern elements other than the first pattern element of a pattern are anchored This means that a pattern can match text starting at any point in the searched text but that once it starts matching each pattern element must match the text immediately following the text that matched the previous pattern element To direct DECTPU to stop searching if the characters starting at the editing point do not match the pattern use the ANCHOR keyword as the first pattern element For example the following pattern matches only if the string abc occurs at the editing point patl ANCHOR abc There are two ways to unanchor pattern elements in the midst of a pattern The easiest is to concatenate or link the UNANCHOR keyword before the pattern element you want to unanchor The following pattern unanchors the pattern element xyz patl abc UNANCHOR xyz This means that the pattern pat1 matches any text beginning with the characters abc and ending with the characters xyz It does not matter what or how many characters or line breaks appear between the two sets of characters Since SEARCH or SEARCH_QUIETLY matches the first xyz it finds the text between the two sets of characters by definition does not contain the string xyz The second way to unanchor a pattern element is to use the special properties of the link operator amp While the concatenation operator always anchors the right pattern ele
77. VES_CANTCREADCL 1 ELSE eveSmessage EVE _CANTCREADCL ENDIF SELSE eveSmessage EVES CANTCREADCL SENDIF eveSlearn_abort RETURN FALSE OTHERWISE ENDON ERROR This ON ERROR procedure determines whether a pop up message widget or a simple message is used depending on whether the code is being compiled by a DE Cwindows version of DECTPU Lexical Elements of the DEC Text Processing Utility Language 4 33 Lexical Elements of the DEC Text Processing Utility Language 4 10 Lexical Keywords 4 10 2 Specifying the Radix of Numeric Constants You can specify constants with binary octal hexadecimal and decimal radices To specify a numeric constant in binary precede the number with B The number can consist only of the digits 0 and 1 To specify a numeric constant in octal precede the number with 0 The number can consist only of the digits O through 7 To specify a numeric constant in hexadecimal precede the number with X The number can consist of digits 0 9 and A F There is no radix specifier for decimal Any numeric constant without an explicit radix specifier is assumed to be decimal The radix specifier may be in uppercase or lowercase The following are examples of correct numeric constants Many different ways of saying the same thing l CONSTANT binary_constant b11111 CONSTANT octal_constant 037 CONSTANT decimal_constant 31 CONSTANT hex constant xlf Compile time expressions wo
78. Y qualifier 2 15 Module dedaration syntax 4 14 MODULE statement 4 14 N Names for procedures 4 15 NOJ OURNAL qualifier 2 6 Noninteractive editing 2 4 NOT operator 4 8 Null parameters 4 16 Numeric constant specifying radix of 4 34 O ON_ERROR statement 4 23 to 4 28 location 4 23 ON_ERROR Statement 4 19 Operators 4 7 to 4 8 partial pattern assignment 3 14 pattern alternation 3 14 pattern concatenation 3 13 pattern linking amp 3 13 precedence 4 8 relational 3 15 OR operator 4 8 Output file 2 16 OUTPUT qualifier 2 16 OUTRANGE case constant 4 22 P Parameters for procedures 4 15 to 4 17 Parentheses in expressions 4 8 Parser maximum stack depth of 5 2 Partial pattern assignment 3 14 Pattern alternation 3 14 built in procedures 3 12 compilation 3 16 concatenation 3 13 Pattern cont d execution 3 16 expression 4 11 linking amp 3 13 operators 3 13 searching 3 10 Pattern assignment partial 3 14 PATTERN data type 3 10 to 3 17 Predefined constants names 4 12 Procedural error handler 4 24 to 4 25 Procedure executing 5 16 name 4 15 parameter 4 15 to 4 17 recommended naming conventions 5 25 recommended size for 5 2 recursive 4 18 returning result 3 8 4 18 PROCEDURE statement 4 15 to 4 19 PROCESS data type 3 18 Program add to section file 5 20 calling DECTPU from 5 1 compiling 5 14 to 5 15 c
79. You can think of a marker as a place holder To create a marker use the MARK built in procedure The following example assigns a value of the marker data type to the variable x x MARK NONE After this statement is executed the variable x contains the character position where the editing point was located when the statement was executed The editing point is the point in a buffer at which most editing operations are carried out You can cause a marker to be displayed with varying video attributes BLINK BOLD REVERSE UNDERLINE The NONE keyword in the preceding example specifies that the marker does not have any video attributes When you use the MARK built in DECTPU puts the marker on the buffer s editing point The editing point is not necessarily the same as the window s cursor position A marker can be either free or bound Free markers are useful for establishing place marks in locations that do not contain characters such as locations before the beginning of a line after the end of a line in the white space created by a tab or below the end of a buffer By placing a free marker in such a location you make it possible to establish the editing point at that location without inserting padding space characters that could complicate later operations such as FILL 3 8 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 6 Marker Data Type A marker is bound if there is a character in the positi
80. a DCL command procedure that is used to control this terminal setting before and after a DECTPU session DECTPU Terminal Support B 3 DECTPU Terminal Support B 3 Using Terminal Wrap Example B 1 DCL Command Procedure for SET TERM NOWRAP SET TERM NOWRAP ASSIGN USER SYSSCOMMAND SYSSINPUT EDIT TPU SECTION EDTSECINI SET TERM WRAP B 4 DECTPU Terminal Support C DECTPU Debugger Commands You can use the following commands for debugging once you have set breakpoints compiled code and started execution ATTACH process Suspends the current editing session and transfers control to another active process or subprocess DCL process names are case sensitive CANCEL BREAKPOINT procedure name Cancels a breakpoint set with the SET BREAKPOINT command DEPOSIT variable expression Lets you set the values of global variables local variables and formal parameters DISPLAY SOURCE Clears text from the screen after use of the HELP or SHOW BREAKPOINTS command Causes the source display area to display your code EXAMINE variable Displays the current contents of global and local variables global constants formal parameters of the procedure that has been interrupted and variables local to that procedure Local constants cannot be examined GO Causes the debugger to relinquish control of execution until it is invoked again by a breakpoint by the DEBUG command or by the DEBUGON procedure HELP Lists available debugger
81. a new marker and binds the marker to the text nearest to the free marker position DECTPU uses the new bound marker as the range delimiter This operation does not cause insertion of padding spaces Deleting the markers used to create a range does not affect the range To convert the contents of a range to a string use either the STR or the SUBSTR built in procedure To remove a range use the DELETE built in procedure with the range as a parameter For example the following statement deletes the range rangel DELETE rangel You can also delete a range by removing all variable references to the range To do this set all variables referring to the range to some other value such as O For example the following statement sets the variable rangel to 0 rangel 0 Deleting a range does not remove the characters of the range from the buffer it merely removes the range data structure To remove the characters of a range use the ERASE built in procedure with the range as a parameter For example ERASE my_range removes all the characters in my_range but it does not remove the range structure Using the statement DELETE range variable removes the range data structure but does not affect the characters in the range The following built in procedures as well as the partial pattern assignment operator all return values of the range data type CHANGE CASE CREATE RANGE EDIT GET INFO READ CLIPBOARD READ GLOBAL S
82. ack to the DECwindows application the callback parameters include the closure value assigned to the widget DECwindows allows the application to define the significance and possible values of the closure DECTPU supports closure values of type string and integer Closure values are optional for widgets used by applications layered on DECTPU If you do not specify a dosure value the GET INFO WIDGET callback parameters array built in procedure returns unspecified in the closure array element If you create a widget without using a UIL file the GET INFO WIDGET callback parameters array built in procedure returns the dosure you specified as a parameter to CREATE WIDGET If you create a widget by using a UIL file the GET INFO WIDGET callback parameters array built in procedure returns the dosure value if any defined in the X Resource Manager If none is defined the built in returns unspecified DECTPU leaves it to the layered application to use the closure in any way the application programmer wishes DECTPU passes through to the application any closure value received as part of a callback DECwindows EVE provides an example of how an application can use closure values DECwindows EVE assigns a unique closure value to every widget instance that can be created during an EVE editing session Each closure value corresponds to something that EVE must do in response to the activation of that particular widget When an event causes
83. age No select active If you move the text cursor off the text in the found range selection the selection is canceled 5 3 1 4 Relation of EVE Selection to DECwindows Global Selection If EVE has a dynamic selection or a static selection active that selection is automatically designated as the primary global selection A found range selection is not designated as the primary global selection You can use the routine EVESSELECTION to get the text of the primary global selection when an application other than DECTPU owns the selection To do so the call to EVESSELECTION must be in code bound to a mouse button other than MB1 The value returned is a string that contains the text of the primary global selection 5 4 Compiling DECTPU Programs Before compiling programs in DECTPU you should enable the display of informational messages to help you locate errors EVE automatically enables the display of informational messages for you when you use the EXTEND EVE command For more information on displaying messages see the description of the SET INFORMATIONAL built in procedure in the DEC Text Processing Utility Reference Manual The DECTPU compiler numbers the lines of code it compiles The line numbers begin with 1 For a string all DECTPU statements are considered to be on line 1 For a range line 1 is the first line of the range regardless of where in the buffer the range begins Buffers are numbered starting at the first line When a
84. any type checking on the data type being stored Any data type may be stored in any variable For example X abc This assignment statement stores the string abc in variable X 4 9 4 11 Repetitive Statement The LOOP ENDL OOP statements specify the repetitive execution of a statement or statements until the condition specified by EXITIF is met Syntax LOOP statement 1 statement 2 EXITIF expression statement n ENDLOOP The EXITIF statement is the mechanism for exiting from a loop You can place the EXITIF statement anywhere inside a LOOP ENDLOOP combination You can also usethe EXITIF statement as many times as you like When the EXITIF statement is true it causes a branch to the statement following the ENDLOOP statement Syntax EXITIF expression The expression is optional without it EXITIF always exits from the loop Any DECTPU language statement except an ON ERROR statement can appear inside a LOOP ENDLOOP combination For example LOOP EXITIF CURRENT OFFSET 0 temp string CURRENT CHARACTER EXITIF temp string lt gt AND temp string lt gt ASCII 9 OVE HORIZONTAL 1 temp length temp length 1 ENDLOOP This procedure uses the EXITIF statement twice Each expression following an EXITIF statement defines a condition that causes an exit from the loop The statements in the loop are repeated until one of the EXITIF conditions is met 4 9 4 12 Conditional Statement The IF
85. aragraph or buffer e Usethe EVE command SELECT ALL e Press the MB1 mouse button drag the mouse across text and then release the mouse button DEC Text Processing Utility Program Development 5 13 DEC Text Processing Utility Program Development 5 3 Writing Code Compatible with DECwindows EVE e Use the MB1 mouse button with the Shift key to extend a selection EVE implements a static selection by creating a range upon which you can perform EVE commands such as STORE TEXT or REMOVE However EVE does not use the DECTPU SELECT built in procedure to start this range Thus if you use the SELECT_RANGE built in while a static selection is active DECTPU returns the message No select active If you move the text cursor off the text in the static selection the selection is canceled 5 3 1 3 Found Range Selection When EVE positions to the beginning of a range as the result of the FIND command the WILDCARD FIND command or pressing the Find key EVE creates a found range that contains the text EVE found as a match for your search string If no other selection is active EVE treats the found range as the current selection EVE implements a found range selection by creating a range upon which you can perform EVE commands such as STORE TEXT or REMOVE However EVE does not use the DECTPU SELECT built in procedure to start this range Thus if you use the SELECT_RANGE built in while a found range selection is active DECTPU returns the mess
86. ariables paired with pattern elements that are used in the complete match If a partial pattern assignment variable appears more than once in a pattern in places where it is legal for a partial pattern assignment to occur the last occurrence in the pattern determines what range SEARCH assigns to the variable For example with the search text abcdefg and the following pattern SEARCH or SEARCH QUIETLY returns a range that contains the text abcde and assigns a range that contains the text d to the variable var1 patl a b Q varl c d Q varl e x varl 3 7 3 5 Relational Operators You can use the two relational operators equal and not equal lt gt to compare patterns Two patterns are equal if they are the same pattern as patl and pat2 are in the following example patl pat2 notany abc 2 span 123 patl Two patterns are also equal if they have the same internal representation Patterns have the same internal representation only if they are built in exactly the same way The order of the characters in the arguments to ANY NOTANY SCAN SCANL SPAN and SPANL does not matter when you are comparing patterns returned by any of these built ins Other than this almost any difference in the building of two patterns makes those patterns unequal For example suppose you defined the variable this pat as follows this_pat ANY abc DEC Text Processing Utility Data Types 3 15 DEC T
87. array for the itemsCount resource Getting Resources To get resource values from a widget use the following statement GET_INFO widget WIDGET_INFO array The indices of the array parameter are strings or string constants that name the resources whose values you want The initial values in the array are unimportant The GET_INFO statement directs DECTPU to fetch the specified resource values of the specified widget and put the values in the array For list box widgets or file selection widgets one element of the array receives another array that contains the list manipulated by the widget The indices of this array are of type integer The lowest index has the value 0 and each subsequent index is incremented by 1 The contents of the array elements are of type string When you create the index of the element that receives the widget s list you must observe the same naming convention as for setting resources so that DECTPU can handle both the list itself and the resource value that specifies the length of the list Give the index the following format items lt line feed gt items_count For example if you used GET INFO widget WIDGET INFO array to get resource values from a list box widget you could specify the index for the element storing the widget s list as follows items ASCII 10 itemsCount The element for the widget s list does not actually contain an array until after execution of the GET INFO statem
88. as the callback routine for all callbacks that have an integer closure You use the DECTPU routine TPU WIDGET STRING CALLBACK for all callbacks that have a string closure When a widget is part of an X Resource Manager hierarchy do not indude callback resource names or values in the array you pass to SET WIDGET Instead specify the callback routine in the UIL file When a widget is not part of an X Resource Manager hierarchy specify the names of the callback resources in the array you pass to SET WIDGET and specify 0 as the value of each such callback resource DECTPU automatically substitutes its common callback entry point for the 0 value A widget calls back only for those reasons specified in the widget s argument list If a reason is omitted from the list the corresponding event does not cause a callback DEC Text Processing Utility Program Development 5 9 DEC Text Processing Utility Program Development 5 2 Programming in DECwindows DECTPU 5 2 5 Using Closures With DE Cwindows you can specify a closure value for a widget DECwindows documentation refers to closures as tags DECwindows does not define what a closure value is a closure is simply a value that DE Cwindows understands how to recognize and manipulate so that a DE Cwindows application programmer can use the value if needed in the application For general information about using closures in DECwindows see the OpenVMS documentation overview When a widget calls b
89. ate the section file DECTPU supplies a default directory of SYS SHARE and a default file type of TPUS SECTION OpenVMS systems define the systemwide logical name TPU SECTION as EVE SECTION so the default section file is the file that implements the EVE editor To override the OpenVMS default redefine TPUSSECTION You can specify a different section file The preferred method is to define the logical name TPU SECTION to point to a section file other than the default file You can also supply a full file specification for the SECTION qualifier For example if your device is called DISK USER and your directory is called SMITH the following command causes DECTPU to read a section file called VT100INI TPU SECTION EDIT TPU SECTION diskSuser smith vt100ini If you omit the device and directory in the file specification DECTPU assumes the file is in SYS SHARE The section file must be located on the same node on which you are running DECTPU To determine whether SECTION was specified on the DCL command line use the following call in the application X GET INFO COMMAND LINE section The preceding call returns 1 if SECTION was specified 0 otherwise To fetch the name of the section file specified on the command line use the following call X GET INFO COMMAND LINE section file For more information on GET INFO see the DEC Text Processing Utility Reference M anual You must compile the file used as the value
90. be any integer value that is valid in DECTPU Seethe DEC Text Processing Utility Reference Manual for more information on the integer data type String constants can be one character or a combination of characters delimited by apostrophes or quotation marks See the DEC Text Processing Utility Reference Manual for a complete description of how to quote strings in DECTPU Keywords are reserved words that have spedal meaning to the DECTPU compiler See Chapter 3 for a complete description of keywords With the CONSTANT declaration you can associate a name with a constant expression User defined constants can be locally or globally defined A local constant is a constant dedared within a procedure dedaration The scope of the constant is limited to the procedure in which it is defined A global constant is a constant dedared outside a procedure Once a global constant has been defined it is set for the life of the DECTPU session You can reassign to a constant the same value it was assigned previously but you cannot redefine a constant during a DECTPU session See Section 4 9 5 3 for a complete description of the CONSTANT declaration Example 4 2 shows a global constant dedaration and a procedure that contains a local constant dedaration Example 4 2 Global and Local Constant Declarations Define some global constants CONSTANT user bell BELL user hello Hello user ten 10 Hello world procedure continued on ne
91. bu COPY TEXT source buff Search for any control c is not found SEARCH QUI Ctrl char pattern POSITION BEGINNING O TPUSK UNSPECIFIED CREATE BUFFER translation nslate buffer TPUSK UNSPECIFIED CREATE WINDOW 1 10 ON we are translating r ffer er haracters and translate them If a control character ETLY will return a 0 ANY Ctrl char str F i translate_buffer continued on next page A 4 Sample DECTPU Procedures Sample DECTPU Procedures A 2 Translation of Control Characters Example A 2 Cont Procedure to Display Control Characters LOOP Ctrl char range SEARCH QUIETLY Ctrl char pattern FORWARD EXITIF Ctrl char range 0 POSITION Ctrl char range f If we did not translate the character move past it I IF NOT translate controls Ctrl char range THEN MOVE HORIZONTAL 1 ENDIF ENDLOOP Now display what we have done POSITION BEGINNING OF translate buffer MAP translate window translate buffer ENDPROCEDURE Sample DECTPU Procedures A 5 Sample DECTPU Procedures A 3 Restoring Terminal Width Before Exiting from DECTPU A 3 Restoring Terminal Width Before Exiting from DECTPU Example A 3 compares the current width of the screen with the original width If the current width differs from the original width the procedure restores each window to its original width The screen is refreshed so that information is visible on the
92. ce you are setting Table 5 1 shows the relationship between DECTPU data types for widget resources and DECwindows data types for widget resources Table 5 1 Relationship Between DECTPU Data Types and DECwindows Argument Data Types DECwindows Argument Data Type DECTPU Data Type Array of strings Boolean Callback Compound string Compound string table Dimension Integer Position Short String Unsigned character Array of strings Integer Integer 0 String Array of strings Integer Integer Integer Integer String Integer DECTPU does not support setting values for resources Such as pixmap color map font icon widget and so on whose data types are not listed in this table When you pass an array that specifies values for a widget s resources by using CREATE_WIDGET or SET WIDGET DECTPU verifies that each array index is a string that corresponds to a valid resource name for the specified widget DECTPU also verifies that the data type of the value you specify is valid for the specified resource 5 2 6 2 Specifying a List as a Resource Value List box and file selection widgets manipulate lists For example the file selection widget manipulates a list of files The widget resource that stores such a list is specified to DECTPU by using an array To handle an array that passes a list to a widget DE Cwindows must know how many elements the array contains For example if you set the value of the
93. ce your initializing statements in a procedure named TPUSINIT PROCEDURE Such statements might create buffers create windows associate windows with buffers set up screen attributes initialize variables define how the journal facility works and so on You can put the procedure TPUSINIT PROCEDURE anywhere in the procedure declaration portion of your program DECTPU executes TPUSINIT PROCEDURE before executing the command file if there is one For more information on DECTPU s initialization sequence see Section 5 6 4 Place any statements that implement or handle initialization files in a procedure named TPUSINIT POSTPROCEDURE DECTPU executes this procedure after both the TPUSINIT PROCEDURE and the command file have been executed This enables commands or definitions in the initialization file to modify commands or definitions in the command file EVE defines both TPUSINIT PROCEDURE and TPUSINIT POSTPROCEDURE procedures For more information on how EVE implements initialization files see Section 5 6 7 After you put the desired DECTPU procedures and statements into the program that implements your application end your program with the following statements A statement that contains the SAVE built in procedure SAVE is the mechanism by which you store all currently defined procedures variables and bound keys in binary form e The QUIT built in procedure QUIT ends the DECTPU session For more information on SAVE and QUIT see the
94. ch for p2 by defining p2 as follows p2 ANCHOR b LINE END 3 7 3 8 Pattern Alternation Operator The alternation operator tells SEARCH or SEARCH QUIETLY to match a sequence of characters if those characters match either of the pattern elements separated by the alternation operator The following pattern matches either the string abc or the string xes patl abc xes If the text being searched contains text that matches both alternatives SEARCH or SEARCH QUIETLY matches the earliest occurring match If two matches start at the same character SEARCH or SEARCH QUIETLY matches the left element For example suppose you had the search text abcd and the following pattern definitions pati abc bcd pat2 bcd abc pat3 ba bcd pat4 bcd be Given these definitions and search text a search for the patterns pat1 and pat2 would return a range that contains the text abc A search for the pattern pat3 would return a range that contains the text bc Finally a search for the pattern pat4 would return a range that contains the text bcd 3 7 3 4 Partial Pattern Assignment Operator The partial pattern assignment operator tells SEARCH or SEARCH _ QUIETLY to create a range that contains the text matching the pattern element to the left of the partial pattern assignment operator When the search is completed the variable to the right of the partial pattern assignment operator references
95. current buffer starting at the editing point e If you specify a buffer or range where the search is to take place start at the beginning or end of the buffer or range depending on the direction of the search 2 Check whether the pattern matches text starting at the current search position and extending toward the end of the searched buffer or range If a range is being searched the matched text cannot extend beyond the end of that range If the pattern matches return a range that contains the matching text and stop searching 3 If the previous step fails move the search position one character forward or backward depending upon the direction of the search If this is impossible because the search position is at the end or beginning of the searched buffer or range stop searching If this step succeeds repeat the previous step Note This algorithm changes if you specify a reverse search for a pattern starting with SCAN SPAN SCANL or SPANL For more information see the descriptions of these built in procedures in the DEC Text Processing Utility Reference Manual 3 16 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 7 Pattern Data Type 3 7 6 Anchoring a Pattern Anchoring a pattern forces SEARCH or SEARCH QUIETLY to match the anchored part of the pattern to text starting at the current search position If the anchored part of a pattern fails to match that text SEARCH or SEARCH __ Q
96. customizes your editor for programming in Pascal another command file that customizes your editor for text editing and so on If you have several command files give them names that remind you of their contents If you have one command file that you use most of the time name it TRPUSCOMMAND TPU The command to invoke DECTPU with a command file is EDIT TPU COMMAND filespec 5 24 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files If you name your command file TPUS COMMAND TPU and it is in your default directory DECTPU reads the file by default without your having to use the COMMAND qualifier If you name your file something other than TPUS COMMAND TPU or if you put it in a directory other than your default directory you must use the COMMAND qualifier explicitly and provide a full file specification after the qualifier DECTPU reads a command file compiles it and executes any commands that do not contain syntax errors If there are errors DECTPU writes an error message to the message area The command file can customize or extend the application implemented by the section file with which you invoked DECTPU Example 5 6 is a sample DECTPU command file that defines a procedure that moves the editing point to the beginning of a segment of text delimited by the characters 96 at the beginning and at the end Example 5 6 Command File for GOT
97. d comments to either of the following addresses Internet openvmsdoc compaq com Mail Compaq Computer Corporation OSSG Documentation Group ZK O3 4 U 08 110 Spit Brook Rd Nashua NH 03062 2698 How To Order Additional Documentation Usethe following World Wide Web address to order additional documentation http www openvms compaq com If you need help deciding which documentation best meets your needs call 800 282 6672 Conventions The following conventions are used in this manual 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 PF1x A sequence such as PF 1 x indicates that you must first press and release the key labeled PF 1 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 In the HTML version of this document this convention appears as brackets rather than a box A horizontal ellipsis in examples indicates one of the following possibilities e Additional optional arguments in a statement have been omitted e The preceding item or items can be repeated one or more times e Additional parameters values or other information can be entered A vertical ellipsis indicates the omission of items from a code example or command format the items are omi
98. d function procedures Example 4 6 shows a procedure that returns a true 1 or false 0 value Note All DECTPU procedures return a result If they do not do so explicitly DECTPU returns 0 Example 4 6 Procedure That Returns a Result PROCEDURE user on end of line test if at eol return true or false IF CURRENT OFFSET LENGTH CURRENT LINE we are on eol THEN user on end of line 1 return true ELSE user on end of line 0 return false ENDIF ENDPROCEDURE Another way of assigning a value of 1 or 0 to a procedure is to use the DECTPU RETURN language statement followed by a value See Example 4 13 You can use a procedure that returns a result as a part of a conditional statement to test for certain conditions Example 4 7 shows the procedure in Example 4 6 within another procedure Example 4 7 Procedure Within Another Procedure PROCEDURE user nested procedure IF user on end of line 1 at the eol mark THEN MESSAGE Cursor is at the end of the line ELSE MESSAGE Cursor is not at the end of the line ENDIF ENDPROCEDURE 4 9 4 6 Recursive Procedures Procedures that call themselves are called recursive procedures Example 4 8 shows a procedure named user reverse that displays a list of responses to the READ LINE built in procedure in reverse order Note the call to the procedure user reverse within the procedure body 4 18 Lexical Elements of the DEC Text Processing Utility Language
99. d have finished executing and all input in the type ahead buffer has been processed Upon completion of all the commands the screen manager updates every window to reflect the current state of the part of the buffer that is visible in the window If you want to make the screen reflect changes to the buffer prior to the end of a procedure use the UPDATE built in procedure to force the updating of the window Using UPDATE is recommended with built in procedures such as CURRENT COLUMN that query DECTPU for the current cursor position To ensure that the cursor position returned is the correct location up to the point of the most recently issued command use UPDATE before using CURRENT _ COLUMN or CURRENT ROW 3 14 7 Getting Information on Windows There are two DECTPU built in procedures that return information about windows GET INFO and SHOW WINDOW GET INFO returns information that you can store in a variable You can get information about the visible and original values of windows as well as about other attributes that you have set up for your window environment See GET _ INFO in the DEC Text Processing Utility Reference M anual SHOW WINDOW or SHOW WINDOWS puts information about windows in the SHOW BUFFER If you use an editor that has an INFO WINDOW you can display the SHOW BUFFER information in the INFO WINDOW DEC Text Processing Utility Data Types 3 25 DEC Text Processing Utility Data Types 3 14 Window Data Type 3 14 8 T
100. ded 4 12 C Callable interface 5 1 Callback routines levels of 5 8 Index Callbacks 5 7 to 5 9 handling in EVE 5 10 CASE statement 4 21 to 4 22 Case style error handler 4 25 to 4 28 Character set 4 1 Character cell display 2 12 CHARACTER SET qualifier 2 9 Closures 5 10 Command files 5 24 to 5 25 debugging 5 29 default 5 17 definition 2 2 sample 5 25 Command line OURNAL qualifier 2 6 NOJ OURNAL qualifier 2 6 RECOVER qualifier 2 6 Command parameter See EDIT TPU command COMMAND qualifier 2 4 to 2 5 2 10 to 2 11 5 21 Command qualifiers See EDIT TPU command qualifiers Comment character 1 5 Compilation conditional 4 33 COMPILE built in procedure 5 15 Compiling in a DECTPU buffer 5 15 in EVE 5 15 programs 5 14 to 5 15 to create section file 5 19 Concatenation pattern 3 13 string 4 4 Conditional compilation 4 33 Conditional statements 4 20 to 4 21 Constant specifying radix of 4 34 CONSTANT declaration 4 32 Constants 4 6to 4 7 local 4 19 predefined 4 12 Control character entering 4 3 translation example A 2 Index 1 CREATE qualifier 2 11 CREATE_WIDGET built in procedure using to specify callback routine 5 8 using to specify resource values 5 11 CREATE_WINDOW built in procedure 3 23 Ctrl C 5 16 with case style error handler 4 26 4 27 with procedural error handler 4 24 4 25 Current buffer active editing point 3 4 Current window
101. descriptions of these built ins in the DEC Text Processing Utility Reference Manual For examples of files that use these statements see Example 5 4 and Example 5 5 To compile your program into a section file invoke DECTPU but do not supply as a parameter the name of a file to be edited Use the NOSECTION qualifier to indicate that no existing section file should be loaded Use the COM MAND qualifier to specify the file that contains your program For example to create a section file from a program in a file called my application tpu enter the following at the DCL prompt EDIT TPU NOSECTION COMMAND my application tpu DEC Text Processing Utility Program Development 5 19 DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files This command causes DECTPU to write the binary form of the file MY_ APPLICATION TPU to the file you specified as the parameter to the SAVE statement in your program To use the section file invoke DECTPU specifying your section file For more information on invoking DECTPU see Chapter 2 5 6 5 2 Extending an Existing Section File To extend an existing section file begin by writing a program in the DECTPU language If you are extending the EVE section file put your initializing statements in an initialization procedure called TPU LOCAL_INIT TPUSLOCAL INIT is an empty procedure in the EVE section file When you add your DECTPU statements and procedures to the EVE section file your p
102. e 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 All numbers in text are assumed to be decimal unless otherwise noted Nondecimal radixes binary octal or hexadecimal are explicitly indicated xi 1 Overview of the DEC Text Processing Utility This chapter presents information about the DEC Text Processing Utility DECTPU The chapter includes the following A description of DECTPU A description of DECwindows DECTPU A description of the Extensible Versatile Editor EVE e Information about the DECTPU language e Information about the hardware that DECTPU supports How tolearn more about DECTPU 1 1 Description of DECTPU DECTPU is a high performance programmable text processing utility that indudes the following A high level procedural language A compiler Aninterpreter Text manipulation routines e Integrated display managers for the character cell terminal and DECwindows environments e The Extensible Versatile Editor EVE interface which is written in DECTPU DECTPU is a procedural programming language that enables text processing tasks it is n
103. e a Value from a Layered APDIICALLOM PEEL PL Terminal Behavior That Affects DECTPU s Performance A 1 A 2 A 6 A 7 B 4 4 7 Preface This manual discusses the DEC Text Processing Utility DECTPU Intended Audience This manual is for experienced programmers who know at least one computer language as well as for new users of DECTPU Some features of DECTPU for example the callable interface and the built in procedure FILE_PARSE are for system programmers who understand Compaq OpenVMS operating system concepts Relevant documents about the OpenVMS operating system are listed under Related Documents Document Structure This manual is organized as follows Chapter 1 contains an overview of DECTPU Chapter 2 describes how to invoke DECTPU Chapter 3 provides detailed information on DECTPU data types Chapter 4 discusses the lexical elements of DECTPU These indude the character set identifiers variables constants and reserved words such as DECTPU language statements Chapter 5 describes DECTPU program development Appendix A contains sample procedures written in DECTPU Appendix B describes terminals supported by DECTPU Appendix C lists commands for debugging DECTPU Related Documents For additional information about OpenVMS products and services access the following World Wide Web address http www openvms compaq com Reader s Comments Compaq welcomes your comments on this manual Please sen
104. e array giving the element the index you pass to the procedure DECTPU assigns to this new element the data type unspecified You can delete an element in the array by assigning the data type unspecified to the element For example the following statement deletes the element my array fred k my array fred TPUSK UNSPECIFIED The following code fragment shows how you can find all the indexes in an array the index GET INFO the array FIRST LOOP EXITIF the_index TPUSK_UNSPECIFIED the_index GET_INFO the_array NEXT ENDLOOP Note DECTPU does not guarantee the order in which it will return the array indexes 3 2 Buffer Data Type A buffer is a work space for manipulating text A buffer can be empty or it can contain text records You can have multiple buffers A value of the buffer data type is returned by the CREATE BUFFER CURRENT BUFFER and GET INFO built in procedures CREATE BUFFER is the only built in procedure that creates a new buffer CURRENT BUFFER and GET INFO return pointers to existing buffers The following statement makes the variable my buf a variable of type buffer my buf CREATE BUFFER my buffer When you use a buffer as a parameter for DECTPU built in procedures you must use as the parameter the variable to which you assigned the buffer For example if you want to erase the contents of the buffer created in the preceding statement enter the following ERASE my
105. e file name font line number and text DECTPU responds to all other requests with a message that no information is available DECTPU does not send requests for information about the global selection to other DE Cwindows applications DECTPU applications may use the various built in procedures to do so DECTPU s responses to requests for information about the primary selection are as follows FILE NAME DECTPU responds with the string returned by the GET INFO CURRENT BUFFER file name built in procedure FONT DECTPU responds with the string returned by the GET INFO SYSTEM default font built in procedure LINE NUMBER DECTPU responds with the value of type span containing the record number where the select range starts and the record number where the select range ends TEXT or STRING DECTPU responds with the text of the select range as a string with each line break represented by a line feed Compaq recommends that you use only a DECwindows section file with DECwindows DECTPU However if you do not follow this recommendation DECTPU s automatic grabbing of the primary global selection enables your layered application to interact with other DECwindows applications If an application requests information about the primary global selection while DECTPU owns the selection DECTPU attempts to respond to the request if the application cannot do so If DECTPU responds to the request by sending the text of a buffer or ra
106. e that is placed in the message buffer Finally DECTPU runs the error handler code e For other warnings and errors ERROR is set to a keyword that represents the error or warning ERROR_LINE is set to the line number of the error and ERROR_TEXT is set to the error or warning message associated with the keyword DECTPU places error messages in the message buffer but suppresses the display of warning messages Finally DECTPU runs the error handler code If an error or warning is generated during execution of a procedural error handler DECTPU behaves as follows f you press Ctrl C during the error handler DECTPU puts an error message in the message buffer exits from all currently active procedures in their reverse calling order and returns to the wait for next key loop e For other errors and warnings the appropriate error or warning message is written to the message buffer DECTPU resumes execution at the next statement after the statement that generated the error 4 9 4 16 Case Style Error Handlers Case style error handlers provide a number of advantages over procedural error handlers With case style error handlers you can do the following e Suppress the automatic display of both warning and error status messages e Trap the TPU CONTROLC status Write clearer code Syntax ON ERROR condition_1 statement 1 condition 2 statement 2 condition n statement n ENDON ERROR You can use the OTHERWISE selec
107. e uses the local variable X the local variable has the value 0 and the MOVE VERTICAL built in has no effect Local variables may also be declared in unbound code See Section 4 9 5 2 4 9 4 8 Constants The use of constants in procedures is optional The scope of a constant dedared within a procedure is limited to the procedure in which it is defined See Section 4 9 5 3 for more information on the CONSTANT declaration Syntax CONSTANT constant name compile time constant expression 4 9 4 9 ON ERROR Statements The use of ON ERROR statements in procedures is optional If you use an ON _ ERROR statement you must place it at the top of the procedure just after any LOCAL and CONSTANT declarations The ON ERROR statement specifies the action or actions to be taken if an ERROR or WARNING status is returned See Section 4 9 4 14 for more information on ON ERROR statements Lexical Elements of the DEC Text Processing Utility Language 4 19 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words 4 9 4 10 Assignment Statement The assignment statement assigns a value to a variable In so doing it associates the variable with the appropriate data type Syntax identifier expression The assignment operator is a combination of two characters a colon and an equal sign Do not confuse this operator with the equal sign which is a relational operator that checks for equality DECTPU does not do
108. e whether a marker is bound use the following GET INFO call GET INFO marker variable bound DECTPU keeps track of the location of a free marker by measuring the distance between the marker and the character nearest to the marker If you move the character from which DECTPU measures distance to a free marker the marker moves too DECTPU preserves a uniform distance between the character and the marker If you collapse white space that contains one or more free markers for example if you delete a tab or use the APPEND LINE built in procedure DECTPU preserves the markers and binds them to the nearest character If you use the POSITION built in procedure to establish the editing point at a free marker the marker remains free and the editing point is also said to be free that is the editing point is not bound to a character Some operations cause DECTPU to fill the space between a free marker and the nearest character with padding space characters thereby converting the free marker to a bound marker For example if you type text into the buffer when the editing point is detached DECTPU inserts padding space characters between the nearest character and the editing point Using any of the following built in procedures when the editing point is detached also causes DECTPU to perform padding APPEND LINE COPY TEXT CURRENT CHARACTER CURRENT LINE CURRENT OFFSET ERASE CHARACTER DEC Text Processing Utility Data Types 3 9
109. ection if the selection is a dynamic selection However Compaq recommends that you use EVE SELECTION to get the current selection because this routine returns the current selection regardless of how it was created To see how the EVE SELECTION routine works and what parameters it takes see the code for this routine in SYS EXAMPLES EVE CORE TPU 5 3 1 1 Dynamic Selection When you press the Select key or invoke the SELECT command EVE creates a dynamic selection A dynamic selection expands and contracts as you move the text cursor Moving the text cursor away from the text already selected does not cancel the selection If you use the mouse to start a selection while a dynamic selection is active the dynamic selection is canceled If EVE s current selection is a dynamic selection the routine EVE SELECTION returns the selected range and terminates the selection If for some reason you want to use a statement that returns the current dynamic selection but does not terminate it you can use a statement whose format is similar to the following rl EVESSELECTION TRUE TRUE TRUE TRUE FALSE The last parameter directs EVE SELECTION not to terminate the selection For more information on how to use these parameters see the EVE SELECTION routine in SYS EXAMPLES EVE CORE TPU 5 3 1 2 Static Selection EVE creates a static selection if you do any of the following Click the MB1 mouse button two or more times to select a word line p
110. ed from a buffer or range ERROR LINE returns the line number within the buffer This may be different from the line number within the procedure If the procedure was compiled from a string ERROR LINE returns 1 ERROR TEXT returns the text of the error or warning exactly as DECTPU would display it in the message buffer with all parameters filled in After the execution of an error statement you can choose where to resume execution of a program The options are the following e ABORT This language statement causes an exit back to the DECTPU wait for next key loop Lexical Elements of the DEC Text Processing Utility Language 4 23 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words e RETURN This language statement stops the execution of the procedure in which the error occurred but continues execution of the rest of the program If you do not specify ABORT or RETURN the default is to continue executing the program from the point at which the error occurred DECTPU provides two forms of error handler procedural and case style 4 9 4 15 Procedural Error Handlers If a WARNING status is trapped by an ON ERROR statement the warning message is suppressed However if an ERROR status is trapped the message is displayed With the ON ERROR trap you can do additional error handling after the DECTPU message is displayed Syntax ON ERROR statement 1 statement 2 statement n ENDON ERROR Examp
111. ed to the procedure in which they are defined The maximum number of parameters in a parameter list is 127 A procedure can declare its parameters as required or optional Required parameters and optional parameters are separated by a semicolon Parameters before the semicolon are required parameters those after the semicolon are optional If no semicolon is specified then the parameters are required Syntax PROCEDURE proc name req param I opt param 1 1 ENDPROCEDURE A procedure parameter is a place holder or dummy identifier that is replaced by an actual value in the program that calls the procedure The value that replaces a parameter is called an argument Arguments can be expressions There does not have to be any correlation between the names used for parameters and the values used for arguments All arguments are passed by reference Example 4 4 shows a simple procedure with parameters Example 4 4 Simple Procedure with Parameters This procedure adds two integers The parameters intl and int2 lare replaced by the actual values that you supply The result of the addition is written to the message area PROCEDURE ADD intl int2 MESSAGE STR intl int2 ENDPROCEDURE For example call the procedure ADD and specify the values 5 and 6 as arguments as follows ADD 5 6 The string 11 is written to the message buffer Any caller of a procedure must use all required parameters to call it The
112. editor the next time the file name from the previous session is used Example 2 1 DCL Command Procedure FILENAME COM IF Pl NES THEN last file edited P1 WRITE SYSSOUTPUT ast file edited DEFINE USER SYSSINPUT SYSSCOMMAND EDIT TPU COMMAND DISK USER TPUSCOMMAND TPU last file edited Example 2 2 establishes an environment that specifies tab stop settings for FORTRAN programs Example 2 2 DCL Command Procedure FORTRAN TS COM IF Pl EQS THEN GOTO REGULAR INVOKE last file edited Pl FTN TEST FSFILE ATTRIBUTES last file edited RAT IF FTN TEST NES FTN THEN GOTO REGULAR INVOKE FTN INVOKE DEFINE USER SYSSINPUT SYSSCOMMAND EDIT TPU COMMAND FTNTABS last file edited GOTO TPU DONE REGULAR INVOKE DEFINE USER SYSSINPUT SYSSCOMMAND EDIT TPU last file edited TPU DONE AU cU MM HF MM MM Xr Xr MM od 2 2 2 Creating a Noninteractive Application In some situations you may want to put all of your editing commands in a file and have them read from the file rather than entering the commands interactively You may also want DECTPU to perform the edits without displaying them on the screen You can do this type of editing from a batch job or if you want to see the results of the editing session displayed on your Screen you can do this type of editing from a DCL command procedure Even though the edits are not displayed on your screen as they are being made your terminal is not
113. eference Manual 5 1 1 Simple Programs The following statement is an example of a simple program SHOW SUMMARY The preceding statement entered after the appropriate prompt from your editor causes DECTPU to execute the program associated with the SHOW SUMMARY statement If you use EVE with a user written command file your screen may display text similar to Example 5 1 Example 5 1 SHOW SUMMARY Display DECTPU V3 1 1993 08 17 08 37 Journal file Section file name EVESSECTION Ident V3 1 Date 17 AUG 1993 08 49 Activated from TPUSSECTION Created by DECTPU V3 1 1993 08 17 08 37 Extension SCREEN UPDATER Ident DECTPU V3 1 1993 08 17 08 37 Timer Message working 24 System buffers and 1 User buffer 5 1 2 Complex Programs When writing complex DECTPU programs avoid the following practices Creating large procedures Creating large number of procedures Including a large number of executable statements that are not within procedures These practices if carried to extremes can cause the parser stack to overflow The DECTPU parser currently allows a maximum stack depth of 1000 syntax tree nodes When the parser first encounters a DECTPU statement the parser assigns each token in the statement to a syntax tree node For example the statement a 1 contains three tokens each of which occupies a syntax tree node After the parser parses this statement only the assignment statement remains on the stack of
114. enate strings You can also use the relational operators to compare a string with a string a marker with a marker or a range with a range The precedence of the operators in an expression determines the order in which the operands are evaluated Table 4 6 lists the order of precedence for DECTPU operators Operators of equal precedence are listed on the same line Table 4 6 Operator Precedence Operator Precedence unary unary Highest NOT AND amp OR XOR 5 9S lt lt gt gt Lowest Expressions enclosed in parentheses are evaluated first You must use parentheses for correct evaluation of an expression that combines relational operators You can use parentheses in an expression to force a particular order for combining operands For example Expression Result 9 5 few 16 8 5 2 4 20 4 8 Expressions An expression can be a constant a variable a procedure or a combination of these separated by operators You can use expressions in a DECTPU procedure where an identifier or constant is required Expressions are frequently used within DECTPU conditional language statements The data types of all elements of a DECTPU expression must be the same The following are exceptions to this rule e You can mix keywords strings and pattern variables in expressions used to create patterns 4 8 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC
115. ent When DECTPU encounters the GET INFO statement it parses the indices of the specified array When DECTPU parses the index of the element for the widget s list it fetches both the list itself and the length of the list Using the resource specifying the length DECTPU creates an array of the correct size to hold the widgets list See the DEC Text Processing Utility Reference Manual for sample uses of DECwindows DECTPU built ins 5 12 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 3 Writing Code Compatible with DECwindows EVE 5 3 Writing Code Compatible with DECwindows EVE This section provides information useful for programmers who extend DE Cwindows EVE or layer applications on DECwindows EVE 5 3 1 Select Ranges in DECwindows EVE This section is intended for programmers who are extending EVE or layering an application on EVE There are four possible types of selection e Dynamic selection e Static selection e Found range selection e DECwindows primary or secondary global selection EVE can use only one type of selection at a time The ways in which these selections differ are explained in the following sections EVE has a routine called EVESSELECTION that returns the current selection regardless of whether the selection is dynamic static formed from a found range or the primary global selection You can use the SELECT RANGE built in procedure to get the current sel
116. ents are reserved words that you cannot define Any attempt to redefine these words results in a compilation error 4 9 4 1 Module Declaration With the MODULE ENDMODULE declaration you can group a series of global CONSTANT declarations VARIABLE declarations PROCEDURE declarations and executable statements as one entity After you compile a module the compiler will generate two procedures for you One procedure returns the identification for the module and the other contains all the executable statements for the module The procedure names generated by the compiler are module name MODULE IDENT and modulename MODULE INIT respectively Syntax MODULE module name I DENT string literal declarations ON ERROR ENDON ERROR statement 1 statement n ENDMODULE The dedarations part of a module can include any number of global VARIABLE CONSTANT and PROCEDURE dedarations The ON ERROR ENDON ERROR block if used must appear after the declarations and before the DECTPU statements that make up the body of the module Statements that make up the body of a module must be separated with semicolons For more information on error handlers see Section 4 9 4 14 In the following example the compiler creates two procedures user mod module ident and user mod module init User mod module ident returns the string v1 0 User mod module init calls the routine user hello ODULE user mod IDENT v1 0 PROCEDURE user hello MESSAGE Hello
117. er the quotation mark or the apostrophe as the delimiter for a string The following statements assign a value of the string data type to the variable x X X abcd abcd To specify the quote character itself within a string type the character twice if you are using the same quote character as the delimiter for the string The following statements show how to quote an apostrophe and a quotation mark respectively X X PS The value assigned to x is nans The value assigned Eo Xs t If you use the alternate quote character as the delimiter for the string within which you want to specify a quote character you do not have to type the character twice The following statements show how to quote an apostrophe and a quotation mark respectively when you use the alternate quote character to delimit the string x imm The value assigned to x is 3 Ses PUES The value assigned to x is A null string is a string of length zero You can assign a null string to the variable x in the following way Eum E s To create a string from the contents of a range use the STR or the SUBSTR built in procedure To create a string from the contents of a buffer use the STR built in 3 20 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 11 String Data Type The maximum length for a string is 65 535 characters A restriction of the DECTPU compiler is that a string constant an open
118. erminals That Do Not Support Windows DECTPU supports windows only for ANSI character cell terminals Noncharacter cell terminals do not support windows and are considered unsupported devices If you are using an unsupported device you must use the NODISPLAY qualifier when you invoke DECTPU NODISPLAY informs DECTPU that you do not expect the device from which you are issuing DECTPU commands to support screen oriented editing If one of the previous conditions exists and you do not specify the NODISPLAY qualifier DECTPU exits with an error condition You are using an unsupported device if logical name SY S INPUT points to an unsupported device such as a character cell terminal Appendix B contains more information about DECTPU terminal support Chapter 2 contains more information on the NODISPL AY qualifier 3 26 DEC Text Processing Utility Data Types 4 Lexical Elements of the DEC Text Processing Utility Language 4 1 Overview A DECTPU program is composed of lexical elements A lexical element may be an individual character such as an arithmetic operator or it may be a group of characters such as an identifier The basic unit of a lexical element is a character from either the DEC Multinational Character Set or the SO_LATIN1 Character Set This chapter describes the following DECTPU lexical elements e Character set e Identifiers e Variables e Constants e Operators e Expressions e Reserved words e Lexical
119. es three pairs of synonyms to be used by layered applications Although DECTPU automatically dedares the variables the application must assign a value to one of the synonyms in each pair If you choose to write your own application your application must contain these structures and procedures Table 5 2 shows the names and uses of these variables Table 5 2 Special DECTPU Variables That Require a Value from a Layered Application Synonym Provided for Backward Data Type Recommended Name Compatibility Structure How DECTPU Uses the Variable TPU X MESSAGE MESSAGE BUFFER Buffer DECTPU writes messages in this buffer If the BUFFER MESSAGE BUFFER is associated with a window that is mapped to the screen DECTPU updates the window If the application does not assign a buffer to this variable DECTPU writes messages to the screen TPU X SHOW SHOW BUFFER Buffer DECTPU writes information stored by the SHOW BUFFER built in in this buffer TPU X SHOW INFO WINDOW Window DECTPU displays information stored by the SHOW WINDOW built in in this window If you want to use the SHOW built in procedure in your application you must create these special variables that DECTPU uses for SHOW 5 6 6 Using Command Files A command file is a DECTPU source file that can contain procedures key definitions and other DECTPU executable statements You can have any number of command files in your directory You might want to write one command file that
120. es 1 7 1 5 Terminals Supported by DECTPU 0000 cece eee 1 7 1 6 Learning Path for DECTPU 0 0 cece tee 1 8 2 Getting Started with DECTPU 2 1 Invoking DECTPU on OpenVMS Systems 0 0000 cette 2 1 2 1 1 Default File Specifications llle 2 2 2 1 2 StartupiElles s cote pXe RISO EXROPEPT SER CIR 2 Soe hie MD Kn 2 2 2 2 Invoking DECTPU from a DCL Command Procedure 2 3 2 2 1 Setting Up a Special Editing Environment 2 3 2 2 2 Creating a Noninteractive Application 0000005 2 4 2 3 Invoking DECTPU from aBatchJob iileleeeeeeeen 2 6 2 4 Using ournal Fil s ues x wae acti Ste bath Gh ay wae aa EE 2 6 2 4 1 Keystroke J ournaling llli ee 2 7 2 4 2 Buffer Change J ournaling 00 00 cece eee eee 2 7 2 4 3 Buffer Change J ournal FileNaming Algorithm 2 8 2 5 Avoiding Errors Related to Virtual Address Space 2 8 2 6 Using OpenVMS EDIT TPU Command Qualifiers 04 2 9 2 6 1 CHARACTER SET u uude War qat see d aedes in a aa T 2 9 2 6 2 ICOMMAND xem sk m Rees HR c ELE Ox XL RU E b E A d 2 10 2 6 3 GREAT exu ance dre dea on A Ra ERO deg eee ee 2 11 2 6 4 DEBW Gis reU RERUM hush aaa eae e eee RE E 2 12 2 6 5 DISPLAY i Su edo etr dS EE meg a eke STA 2 12 2 6 6 ANITIALIZATION 2 00 0 a iea a a aE iaae Aad ee 2 13 2 6 7 WUNTIEREAGE iuuit Bde soe Mee du ef Geeta ele ae a a NE 2 14 2 6 8 2 6 9 2
121. executed until you enter the following statement TPU Statement EXECUTE CURRENT BUFFER f you use a buffer a range or a string as the parameter for the EXECUTE built in procedure DECTPU first compiles and then executes the buffer range or string See the description of EXECUTE in the DEC Text Processing Utility Reference Manual The COMPILE built in procedure optionally returns a program data type If you want to use the program that you are compiling later in your session you can assign the program that is returned to a variable The following example shows how to make this assignment new program COMPILE CURRENT BUFFER If no error messages are issued while you compile the current buffer you can then execute the program new program with the following statement EXECUTE new program You can use the COMPILE built in procedure to compile certain parts of a buffer rather than a whole buffer To do so create a range that includes the statements within the buffer that you want compiled and then specify the range as the parameter for COMPILE 5 5 Executing DECTPU Programs You can use programs that are already compiled as parameters for the EXECUTE built in procedure In addition you can use buffers ranges or strings that contain executable DECTPU statements as parameters for the EXECUTE built in procedure DECTPU compiles the contents of the buffer range or string if necessary then DECTPU executes the compiled buf
122. ext Processing Utility Data Types 3 7 Pattern Data Type Given this definition the following patterns match the same text but are not equal patl LINE BEGIN ANY abc pat2 LINE BEGIN this pat 3 7 4 Compiling and Executing Patterns When you execute a DECTPU statement that contains a pattern expression DECTPU builds an internal representation of the pattern DECTPU uses the current contents of any buffers or ranges used as arguments to pattern built ins in the pattern expression to build the internal representation Later changes to those buffers and ranges do not affect the internal representation for the pattern DECTPU also uses the current values of any variables used in the pattern expression Later changes to these variables do not affect the internal representation of the pattern For example suppose you wrote the following code fragment pl abc p2 123 pat pl amp p2 pl xyz SEARCH pat FORWARD Given this code fragment the search matches the string abc123 because the variable pat is evaluated as it is built from p1 and p2 during the assignment statement 3 7 5 Searching for a Pattern The SEARCH and SEARCH_QUIETLY built ins use the following algorithm to find a match for a pattern 1 Put the internal marker that marks the search position at the starting position for the search The starting position is determined as follows e If you do not specify where to search search the
123. f you use EVE They also explain how EVE handles each qualifier that can be processed by a layered application Applications not based on EVE may handle qualifiers differently 2 6 1 CHARACTER SET CHARACTER SET DEC MCS default The CHARACTER SET qualifier determines the character set you want DECTPU to use to display 8 bit characters The choice of character set affects how DECTPU performs the following operations on characters e Converting to lowercase e Converting to uppercase e Inverting case Removing diacritical marks e Converting to uppercase and removing diacritical marks Getting Started with DECTPU 2 9 Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers The choice of character set also affects how your text appears when printed For the text displayed in DECTPU to look the same when printed you must choose the same character set for both DECTPU and the printer There are two ways to specify the character set you want to use Define the TRPU CHARACTER_SET logical name to specify the character set This lets you use that character set for all editing sessions induding when you invoke DECTPU within MAIL or other utilities You can put the definition in your LOGIN COM file For example the following commands define TPUS CHARACTER SET as ISO LATIN1 and then use that character set to invoke DECTPU DEFINE TPUS CHARACTER SET ISO LATINI EDIT TPU e Use CHARACTER SET and specify the c
124. fer range or string DEC Text Processing Utility Program Development 5 15 DEC Text Processing Utility Program Development 5 5 Executing DECTPU Programs After using the TPU command suppose you used the following statement to create a program called new_program TPU Statement new program COMPILE CURRENT BUFFER You could then execute new_program by using the following statement after using the TPU command TPU Statement EXECUTE new_program You could also compile and execute the statements in the current buffer by using the following TPU statement after using the TPU command TPU Statement EXECUTE CURRENT BUFFER You can enter compile and execute small DECTPU programs on the EVE command line The following example shows a small program that you can enter after the TPU Statement prompt TPU Statement SET TIMER ON Executing The preceding command executes the program associated with the SET TIMER built in procedure and causes the string Executing to be displayed at 1 second intervals when a long procedure is executing The string is displayed in the last 15 spaces of the prompt area at 1 second intervals 5 5 1 Procedure Execution If you indude procedure dedarations as part of a program the procedure is compiled and the procedure name is added to the DECTPU list of procedures when you execute the program You invoke the procedure in one of the following Ways e Enter the name of the compiled p
125. fine the logical name TPUS COMMAND to be the file you want DECTPU to use For more information on the COMMAND qualifier see Section 2 6 2 DEC Text Processing Utility Program Development 5 17 DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files 5 6 3 Initialization Files An initialization file contains commands to be executed by an application layered on DECTPU To Specify an initialization file to be executed use the appropriate command syntax as explained in this section DECTPU does not determine the default handling of an initialization file nor does DECTPU directly load or execute the commands in an initialization file The application layered on DECTPU must determine the defaults and must handle the loading and execution of an initialization file For example EVE reads an initialization file if one is present and interprets the initialization commands when it processes the appropriate initialization file Any key definitions in an initialization file override corresponding key definitions saved in a section file and key definitions in a command file Typically you use EVE initialization files to set values that are not usually saved in a section file such as margins tab stops and bound or free cursor For a list of the EVE default values that you might want to modify by using an EVE initialization file see the Extensible Versatile Editor Reference Manual To use an initialization file use the I
126. fined as TPUSSECTION to point to EVESSECTION TPUSSECTION You can modify this logical to use a different default editing interface 2 1 2 Startup Files Command files and section files can create or customize a DECTPU editor or application Initialization files can customize EVE or other layered applications by using EVE or other application specific commands settings and key bindings A command file is a file that contains DECTPU source code A command file has the file type TPU and is used with the DECTPU COMMAND filespec qualifier DECTPU tries to read a command file unless you specify NOCOMMAND The default command file is the file called TPU COMMAND TPU in your current directory if such a file exists You can specify a different file by defining the logical name TPU COMMAND A section file is the compiled form of DECTPU source code It is a binary file that has the default file type TPU SECTION It is used with the qualifier SECTION filespec The default section file is TPUS SECTION TPUSSECTION in the area SYS SHARE The systemwide logical name TPUSSECTION is defined as EVE SECTION This definition causes the EVE editor to be invoked by default when you use the DCL command EDIT TPU You must specify a different section file for example SECTION my section file or NOSECTION if you do not want to use the EVE interface 2 2 Getting Started with DECTPU Getting Started with DECTPU 2 1 Invoking DECTPU on OpenVMS Systems Note
127. for the SECTION qualifier To do so run the source code version of the file through DECTPU and then use the built in procedure SAVE This process converts the file to the proper binary form For more information on creating and using section files see Chapter 5 Getting Started with DECTPU 2 19 Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers If you specify the NOSECTION qualifier DECTPU does not load a section file Unless you use the COMMAND qualifier with NOSECTION DECTPU has no user interface and no keys are defined In this state the only way to exit from DECTPU is to press Ctrl Y Typically you use NOSECTION when you create your own layered DECTPU application without EVE as a base 2 6 14 START POSITION START POSITION line column START POSITION 1 1 default The START POSITION qualifier determines where the application layered on DECTPU positions the cursor 2 20 Getting Started with DECTPU 3 DEC Text Processing Utility Data Types A data type is a group of elements that belong together the elements are all formed in the same way and are treated consistently The data type of a variable determines the operations that can be performed on it The DECTPU data types are represented by the following keywords ARRAY e BUFFER INTEGER KEYWORD LEARN MARKER PATTERN PROCESS PROGRAM RANGE STRING e UNSPECIFIED WIDGET WINDOW You use data types t
128. free while the command procedure is executing Example 2 3 shows a DCL command procedure named INVISIBLE TPU COM which contains a single command line that uses the following qualifiers to invoke DECTPU e NOSECTION This qualifier prevents DECTPU from using a section file All procedures and key definitions must be specified in a command file e COMMAND gsr tpu This qualifier specifies a command file that contains the code to be executed GSR TPU e NODISPLAY This qualifier suppresses screen display 2 4 Getting Started with DECTPU Getting Started with DECTPU 2 2 Invoking DECTPU from a DCL Command Procedure Example 2 3 DCL Command Procedure INVISIBLE_TPU COM This command procedure invokes DECTPU without an editor The file GSR TPU contains the edits to be made Specify the file to which you want the edits made as pl EDIT TPU NOSECTION COMMAND gsr tpu NODISPLAY pl The DECTPU command file GSR TPU which is used as the file specification for the COMMAND qualifier performs a search through the current buffer and replaces a string or a pattern with a string Example 2 4 shows the file GSR TPU GSR TPU does not create or manipulate any windows Example 2 4 DECTPU Command File GSR TPU PROCEDURE global search replace str or pat str2 This procedure performs a search through the current buffer and replaces a string or a pattern with a new string LOCAL src range replacement count Return
129. g session you want to recover Check especially the following values e Device type e Edit mode e 8 bit e Page length Width If the journal file has a different name from the input file you must include both OURNAL and RECOVER with the EDIT TPU command For example if you want to use the keystroke journal file SAVE TJ L to recover the edits you made to a file called LETTER DAT enter the following command on the DCL command line 2 18 Getting Started with DECTPU Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers EDIT TPU RECOVER JOURNAL save TJL letter dat In EVE you can use RECOVER to recover either an editing session from a keystroke journal file or a single buffer from a buffer change journal file If you specify OURNAL filename EVE recovers from the specified keystroke journal file Otherwise EVE recovers from a buffer change journal file that corresponds to the input parameter or the buffer specified on the command line if no input parameter is specified For more information on journaling and recovery in EVE see the Extensible Versatile Editor Reference Manual 2 6 13 SECTION SECTION filespec NOSECTION SECTION TPU SECTION default The SECTION qualifier determines whether DECTPU loads a section file A section file is a startup file that contains key definitions and compiled procedures in binary form The default section file is TPUSSECTION When DECTPU tries to loc
130. ge 2 6 default filename 2 8 enabling buffer change journaling 2 6 2 14 enabling keystroke journaling 2 7 2 14 EVE default behavior 2 6 Index 3 J ournaling cont d layered application control 2 6 using both keystroke and buffer change journaling 2 7 journaling string constant parameter GET_INFO built in 2 6 2 14 j OURNAL qualifier 2 6 2 14 journal file string constant parameter GET_INFO built in 2 7 2 14 J OURNAL_OPEN built in procedure 2 7 2 15 K Key name table 3 6 Keystroke journaling compared to buffer change journaling 2 6 enabling 2 7 2 14 Keyword 4 12 key name 3 6 ocduded 4 12 Keyword constants 4 6 KEYWORD data type 3 5 to 3 7 Keywords lexical 4 32 L LEARN data type 3 7 to 3 8 Lexical element 4 1 Lexical keywords 4 32 to 4 34 LINE command 5 14 Line mode editing B 3 Line mode editor example A 1 List specifying as a resource value 5 11 LOCAL I NI buffer 5 18 LOCAL dedaration 4 30 to 4 32 Local variable 4 5 4 19 Local variables 4 30 Logical names EVESINIT 5 26 TPU COMMAND 2 11 TPUS DEBUG 2 12 TPU SECTION 2 19 Logical operators AND operator 4 8 NOT operator 4 8 OR operator 4 8 XOR operator 4 8 LOOP statement 4 20 Index 4 MARK data type 3 8 to 3 10 Marker deleting 3 10 padding effects 3 9 to 3 10 video attributes 3 8 Memory error resulting from exceeding 2 8 Message buffer 5 15 MESSAGE BUFFER variable 5 24 MODIF
131. gers abc 4 def concatenates two strings The following is not a valid DECTPU expression because it mixes data types abc 12 you cannot mix data types When performing integer division DECTPU truncates the remainder it does not round The following examples show the results of division operations Expression Result 39 10 3 39 10 3 4 8 2 Relational Expressions A relational expression tests the relationship between items of the same data type and returns an integer result If the relationship is true the result is integer 1 if the relationship is false the result is integer 0 Use the following relational operators with any of the DECTPU data types Not equal operator lt gt Equal operator For example the following code fragment tests whether stringl starts with a letter that occurs later in the alphabet than the starting letter of string2 stringl gastropod string2 arachnid IF stringl gt string2 THEN MESSAGE Out of alphabetical order ENDIF Use the following relational operators for comparisons of integers strings or markers e Greater than operator gt e Less than operator lt e Greater than or equal to operator gt e Less than or equal to operator lt 4 10 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 8 Expressions When used with markers these operators test whether
132. ght brace H Closes array element index expression Equal sign Relational operator Greater than sign gt Relational operator Greater than or equal to gt Relational operator sign Slash Integer division operator Asterisk Integer multiplication operator Left bracket Begins case label Less than sign Relational operator Less than or equal to lt Relational operator sign Minus sign Subtraction operator Not equal sign lt gt Relational operator Vertical bar Pattern alternation operator Open parenthesis Begins parameter list expression argument list or array element index Ampersand amp Pattern linkage operator Plus sign String concatenation operator pattern Quotation mark Right bracket Semicolon Underscore concatenation operator integer addition operator Delimits string Ends case label Separates language statements Separates words in identifiers 4 4 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 4 Identifiers 4 4 Identifiers In DECTPU identifiers are used to name programs procedures keywords and variables An identifier is a combination of alphabetic characters digits dollar signs and underscores and it must conform to the following restrictions Anidentifier cannot contain any spaces or symbols except the dollar sign and the underscore Identifiers cannot be more than 132 characters long
133. h to enter DECTPU programs or text A prompt area in which to enter DECTPU commands Because DECTPU does not have any keys defined when invoked without a section file the sample program also contains the following key definitions e Return key e Delete key e Key for exiting from DECTPU e Key for entering DECTPU statements Example 5 5 uses the Tab key By default DECTPU looks for TPUSINIT PROCEDURE so the statements that create the structures for a minimal interface are contained in TPUSINIT PROCEDURE Individual statements that define keys come after any procedures in the file If you entered the text from Example 5 5 into a file named MINI TPU and you want to compile that file into a section file enter the following command EDIT TPU NOSECTION COMMAND MINI TPU In the previous example the NOSECTION qualifier specifies that DECTPU does not read a section file This ensures that none of the procedures or variables from an existing section file are loaded into the internal DECTPU tables The COMMAND qualifier specifies that DECTPU compiles the command file MINI TPU The SAVE built in procedure at the end of the command file specifies that all of the procedures variables and key definitions in the file are to be saved in binary form in SYS LOGIN MINI TPU SECTION The QUIT built in procedure then causes you to leave DECTPU Example 5 5 contains the source code for a command file that you can use for a minimal interface to
134. haracter set on the command line This overrides any definition of the TPUSCHARACTER SET logical name By default DECTPU uses the DEC MCS character set For example the following command specifies the GENERAL character set to invoke DECTPU DECTPU uses the current character set to display 8 bit characters and does not use the default DEC Supplemental Graphics character set EDIT TPU CHARACTER SET general If the character set you specify either with CHARACTER SET or by defining TPUSCHARACTER SET is invalid the editing session is aborted returning you to the DCL level Table 2 3 shows the values you can specify with the CHARACTER SET qualifier or the TPUSCHARACTER SET logical name Table 2 3 Character Set Values You Can Set with CHARACTER SET Value Description DEC MCS This is the default setting that uses the DEC Supplemental Graphics character set containing supplemental and multinational characters such as letters with accents and umlauts ISO LATIN1 This character set contains supplemental and multinational characters that contain LATIN 1 characters such as the non breaking space multiplication and division signs and the trademark sign GENERAL DECTPU does not specify a character set for 8 bit characters 8 bit characters are displayed the same as they were before you started DECTPU 2 6 2 COMMAND COMMAND filespec NOCOMMAND COMMAND TPU COMMAND TPU default The COMMAND qualifier determines whe
135. he CREATE WINDOW built in procedure defines the size and location of a window and specifies whether a status line is to be displayed CREATE WINDOW also adds the window to DECTPUSs internal list of windows available for mapping At creation a window is marked as being not visible and not mapped and the following values for the window are calculated and stored e Original top Screen line number of the top of the window when it was created e Original bottom Screen line number of the bottom of the window when it was created not including the status line Original length Number of lines in the window including the status line Later calls to AD UST WINDOW may change these values DEC Text Processing Utility Data Types 3 23 DEC Text Processing Utility Data Types 3 14 Window Data Type 3 14 3 Displaying Window Values When you use the CREATE_WINDOW built in procedure to create a window DECTPU saves the numbers of the screen lines that delimit the window in original top and original bottom When you map a window to the screen with the MAP built in procedure the window becomes visible on the screen If it is the only window on the screen its visible top and visible bottom values are the same as its original top and original bottom values You can use SHOW WINDOWS to display the original and the visible values or the GET INFO built in procedure to retrieve them However if there is already a window on the screen and you map
136. he value of answers is outside the range of O through 10 the statement to the right of OUTRANGE is executed The value of score is written in the message area after the execution of the CASE statement 4 22 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words 4 9 4 14 Error Handling A block of code starting with ON ERROR and ending with ENDON ERROR defines the actions that are to be taken when a procedure fails to execute successfully Such a block of code is called an error handler An error handler is an optional part of a DECTPU procedure or program An error handler traps WARNING and ERROR status values See SET INFORMATIONAL and SET SUCCESS in the DEC Text Processing Utility Reference Manual for information on handling informational and success status values It is good programming practice to put an error handler in all but the simplest procedures However if you omit the error handler DECTPU s default error handling behavior is as follows e If you press Ctrl C DECTPU places an error message in the message buffer exits from all currently active procedures in their reverse calling order and returns to the wait for next key loop e Ifan error or warning is generated during a CALL USER routine ERROR is set to the keyword that represents the failure status of the routine ERROR LINE is set to the line number of the error and ERR
137. igned to optimize the features available with the Compaq VT400 VT 300 and VT 200 families of terminals and the Compaq VT 100 family of terminals DECTPU does not support screen oriented editing on Compaq VT52 compatible terminals Optimum DECTPU performance is achieved on the VT 300 series VT200 series and VT 100 series terminals Some of the high performance characteristics of DECTPU may not be apparent on the terminals listed in Table B 1 for the reasons stated Table B 1 Terminal Behavior That Affects DECTPU s Performance Terminal Characteristic VT102 Slow autorepeat rate VT240 Slow autorepeat rate Slower scrolling region setup time than the VT220O GI GI One form of scrolling region DECTPU repaints screen rather than use this scrolling mechanism Variable autorepeat rate cursor keys pick up speed when used repeatedly By default your DECTPU session runs with the screen management file TPU CCTSHR EXE To check your terminal setting enter the following command at the command prompt SHOW TERMINAL B 1 1 Terminal Settings on OpenVMS Systems That Affect DECTPU The following settings may affect the behavior of DECTPU depending on the terminal that you use DECTPU Terminal Support B 1 DECTPU Terminal Support B 1 Using Screen Oriented Editing on Supported Terminals 132 Column Mode Only terminals that set the DEC_CRT mode bit and the advanced video mode bit can alter their physical width from 80 columns to 13
138. iler You can redefine DECTPU keywords only in local declarations local constants local variables and parameters in a parameter list If you give a local constant local variable or parameter the same name as that of a keyword the compiler issues a message notifying you that the local declaration or parameter temporarily supersedes the keyword In such a circumstance the keyword is said to be occluded See Chapter 3 and the DEC Text Processing Utility Reference Manual for more information on keywords 4 9 2 Built In Procedure Names The DECTPU language has many built in procedures that perform functions such as screen management key definition text manipulation and program execution You can redefine DECTPU built in procedures only in local declarations local constants local variables and parameters in a parameter list If you give a local constant local variable or parameter the same name as that of a built in procedure the compiler issues a message notifying you that the local dedaration or parameter temporarily supersedes the built in In such a circumstance the built in is said to be ocduded See the DEC Text Processing Utility Reference Manual for a complete description of the DECTPU built in procedures 4 9 3 Predefined Constants The following is a list of predefined global constants that DECTPU sets up You cannot redefine these constants FALSE e TPU K ALT MODIFIED e TPUS K CTRL MODIFIED 4 12 Lexical Elements of
139. ing NAME MEM into the current buffer at the editing point COPY TEXT woolly wool Inserts the string ly into the current buffer at the editing point 3 12 Unspecified Data Type An unspecified value is the initial value of a variable after it has been compiled added to the DECTPU symbol table In the following example the COMPILE built in procedure creates the variable x and initially gives it the data type unspecified unless x has previously been declared as a global variable COMPILE x 1 An assignment statement that creates a variable must be executed before a data type is assigned to the variable In the following example when you use the EXECUTE built in procedure to run the program that is stored in the variable prog the variable x is assigned an integer value prog COMPILE x 1 EXECUTE prog DEC Text Processing Utility Data Types 3 21 DEC Text Processing Utility Data Types 3 12 Unspecified Data Type To give a variable the data type unspecified assign the predefined constant TPUSK UNSPECIFIED to the variable prog TPUSK_UNSPECIFIED 3 13 Widget Data Type The DE Cwindows version of DECTPU provides the widget data type to support DECwindows widgets The non DECwindows version of DECTPU does not support this data type A widget is an interaction mechanism by which users give input to an application or receive messages from an application You can use the equal operator
140. ion usually put into the message buffer will appear on SYS OUTPUT if no message buffer is available The following command causes DECTPU to edit the fileMY BATCH FILE RNO without using terminal functions such as screen display EDIT TPU NODISPLAY my batch file rno 2 6 6 INITIALIZATION ANITIALIZATI ON filespec default NOINITIALIZATION The INITIALIZATION qualifier determines whether the DECTPU based application being run executes a file of initialization commands The application layered on DECTPU is responsible for processing this qualifier To determine whether you specified INITIALIZATION on the DCL command line use the following call in the application X GET INFO COMMAND LINE initialization The preceding call returns 1 if ANITIALIZATION was specified 0 otherwise To fetch the name of the initialization file specified on the command line use the following call X GET INFO COMMAND LINE initialization file For more information on GET INFO see the DEC Text Processing Utility Reference M anual If you do not specify any form of ANITIALIZATION on the DCL command line DECTPU specifies INITIALIZATION but does not supply a default file specification The default file specification for INITIALIZATION is set by the application Compaq recommends that a user written application define the default file specification of an initialization file by using the following format facilitySinit facility For exam
141. is not mapped to a window on the screen The current buffer contains the active editing point The editing point can be different from the cursor position and often each is in a different location When the current buffer is associated with a visible window one that is mapped to the screen the editing point and the cursor position are usually the same At present a line in a buffer can contain up to 32767 characters If you try to create a line that is longer than 32767 characters DECTPU truncates the inserted text and inserts only the amount that fills the line to 32767 characters If you try to read a file that contains lines longer than 32767 characters DECTPU truncates all characters after the 32767 characters You can associate a single buffer with 0 to 255 windows for editing purposes You can have a buffer visible in two windows so that you can look at two separate parts of the same file For example you could display a set of dedarations in one window and code that uses the declarations in another window Edits made to a buffer show up in all windows to which that buffer is mapped and in which the editing point is visible 3 3 Integer Data Type DECTPU uses the integer data type to represent numeric data DECTPU performs only integer arithmetic The type integer consists of the whole number values ranging from 2 147 483 648 to 2 147 483 647 In DECTPU an integer constant is a sequence of decimal digits no commas or decimal poin
142. kes DECTPU quit the editing session PROCEDURE user quit QUIT do DECTPU quit operation ENDPROCEDURE Program 5 This program is a collection of procedures that makes DECTPU accept e ex or exi as the command for a DECTPU exit operation PROCEDURE e EXIT ENDPROC PROCEDU EXIT ENDPROCEDURE R do DECTPU exit operation DURE ud Dn E ex PROCEDU EXIT ENDPROCEDURE E exi 5 2 Programming in DECwindows DECTPU This section provides information about programming with DECTPU in the DECwindows environment 5 2 1 Widget Support With DECwindows DECTPU you can create widgets from within DECTPU programs by using the CREATE WIDGET built in procedure For more information on widgets see the OpenVMS overview documentation With the CREATE WIDGET built in you can create the following widgets in DECTPU Caution box Dialog box File selection L abel List box Main window 5 4 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 2 Programming in DECwindows DECTPU e Menu_bar e Popup attached db Popup dialog box e Popup menu e Pulldown entry e Pulldown menu e Push button e Scroll bar vertical and horizontal e Separator e Simple text e Toggle button 5 2 2 Input Focus Support In DECwindows at most one of the applications on the screen can have the input focus that is only one application can accep
143. le 4 10 shows error statements at the beginning of a procedure These statements return control to the caller if the input on the command line of an interface is not correct Any warning or error status returned by a statement in the body of the procedure causes the error statements to be executed Example 4 10 Procedure That Uses the ON ERROR Statement Gold 7 emulation command line processing l PROCEDURE command_line LOCAL line_read X ON_ERROR ESSAGE Unrecognized command line_read RETURN ENDON_ERROR Get the command s to execute line read READ LINE DECTPU Statement get line from user j compile them IF line read lt gt THEN X COMPILE line read execute IF X lt gt 0 THEN EXECUTE X ENDIF ENDPROCEDURE The effects of a procedural error handler are as follows e f you press Ctrl C DECTPU places an error message in the message buffer exits from all currently active procedures in their reverse calling order and returns to the wait for next key loop 4 24 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words e If an error or warning is generated during a CALL USER routine ERROR is set to a keyword that represents the failure status of the routine ERROR_ LINE is set to the line number of the error and ERROR_TEXT is set to a warning or error messag
144. les type the following at the DCL prompt DIRECTORY SYS EXAMPLES EVES TPU If you cannot find these files on your system see your system manager Chapter 5 describes how to write and process command files and section files 2 2 Invoking DECTPU from a DCL Command Procedure There are two reasons that you might want to invoke DECTPU from a command procedure e To set up a special environment for interactive editing e To create a noninteractive DECTPU based application The following sections explain how to do this 2 2 1 Setting Up a Special Editing Environment You can run DECTPU with a special editing environment by writing a DCL command procedure that first establishes the environment that you want and then invokes DECTPU In such a command procedure you must define SYS INPUT to have the same value as SYS COMMAND because DECTPU signals an error if SYS INPUT is not defined as the terminal To prevent such an error place the following statement in the command procedure setting up the environment DEFINE USER SYS INPUT SYSSCOMMAND Getting Started with DECTPU 2 3 Getting Started with DECTPU 2 2 Invoking DECTPU from a DCL Command Procedure Example 2 1 shows a DCL command procedure that remembers the last file that you were editing and uses it as the input file for DECTPU When you edit a file the file name you specify is saved in the DCL symbol last_file edited If you do not specify a file name when you invoke the
145. lication These routines are referred to as internally defined DECTPU callback routines When a widget calls back to DECTPU DECTPU packages the callback information adds the information to its input queue and returns to the widget DECTPU may not process the callback packet on its input queue until later As a result the information about the widget that DECTPU gets from the callback may not match the information returned by the GET INFO widget variable widget info built in procedure When DECTPU processes the callback packet it uses the CREATE WIDGET built in or the SET WIDGET CALLBACK built in to execute the program or learn sequence that was associated with the widget This program or learn sequence controls what the application does in response to the callback information passed by the DECTPU callback routines An application s callback routines are referred to as application level callback action routines The following sections present information on internally defined DECTPU callback routines and on application level callback action routines 5 2 4 3 Internally Defined DECTPU Callback Routines with UIL DECTPU dedares two internally defined callback routines to the X Resource Manager to handle incoming callbacks and dispatch them to the layered application TPUSWIDGET INTEGER CALLBACK Use this routine as the callback routine for all callbacks that have an integer closure TPUSWIDGET STRING CALLBACK Use this r
146. ling Buffer change journaling creates a separate journal file for each text buffer The application can use the enhanced SET J OURNALING built in to direct DECTPU to establish and maintain a separate journal file for any buffer or buffers created during the session The application programmer or user can also use the SET J OURNALING built in to turn journaling off or on for a given buffer during a session In the buffer s journal file DECTPU keeps track of the following record attributes and any changes made to them Left margin setting e Modifiability or unmodifiability e Display value The journal file also tracks the following e Characters inserted in and deleted from a record including the location where the change took place e Records inserted in and deleted from a buffer including the location where the change took place To determine whether buffer change journaling is turned on use the following statement status GET INFO buffer name journaling For more information on record attributes and display values see the descriptions of the SET RECORD ATTRIBUTE and SET DISPLAY VALUE built in procedures in the DEC Text Processing Utility Reference Manual Buffer change journaling does not keep a record of all keystrokes performed while editing a given buffer Getting Started with DECTPU 2 7 Getting Started with DECTPU 2 4 Using Journal Files 2 4 3 Buffer Change Journal File Naming Algorithm By
147. lity Program Development 5 5 DEC Text Processing Utility Program Development 5 2 Programming in DECwindows DECTPU 5 2 3 Global Selection Support Global selection in DECwindows is a means of preserving information selected by you so your selection or data about your selection can pass between DECwindows applications Each DECwindows application can own one or more global selections 5 2 3 1 Difference Between Global Selection and Clipboard A global selection differs from the clipboard in that the global selection changes dynamically as you change the select range while the contents of the dipboard remain unchanged until you use a command such as EVE s STORE TEXT command that sends new information to the clipboard By default EVE does not use the clipboard 5 2 3 2 Handling of Multiple Global Selections At any particular time a global selection is owned by at most one DECwindows application a global selection can also be unowned A DECwindows application can own more than one global selection at the same time For example an application layered on DECTPU can own both the primary and secondary global selections The DECwindows server determines which application currently owns which global selection Information about a global selection property may be stored in different formats but the format of a particular property must be the same for all DECwindows applications DECTPU directly accepts information that is stored in integer or s
148. ll DECwindows routines such as X Toolkit routines from within a program written in the DECTPU language To use a DECwindows routine in a DECTPU program use one or more of the following techniques e Use a DECTPU built in procedure that calls a DECwindows routine Examples of such DECTPU built in procedures include the following CREATE WIDGET DELETE WIDGET MANAGE WIDGET REALIZE WIDGET SEND CLIENT MESSAGE SET CLIENT MESSAGE SET DRM HIERARCHY SET ICON NAME SET ICON PIXMAP SET MAPPED WHEN MANAGED SET WIDGET SET WIDGET CALL DATA SET WIDGET CALLBACK UNMANAGE WIDGET For more information about how to use the DECwindows built ins in DECTPU see the individual built in descriptions in the DEC Text Processing Utility Reference Manual e Use a compiled language that follows the OpenVMS calling standard to write a function or a program that calls the desired routine You can then invoke DECTPU in one of the following ways Use the built in procedure CALL USER in your DECTPU program when the program is written in a non DECTPU language For more information about using the built in procedure CALL USER see the DEC Text Processing Utility Reference Manual Usethe DECTPU callable interface to invoke DECTPU from the program For more information about using the DECTPU callable interface see the OpenVMS Utility Routines Manual Overview of the DEC
149. lowing command Command SHOW DEFAULTS BUFFER This command causes EVE to show buffer information in a format similar to the format in Example 5 7 using values that apply to your editing session Example 5 7 SHOW DEFAULTS BUFFER Display EVE V3 1 1993 08 17 08 47 Information about buffer SDEFAULTSS Not modified Left margin set to 1 Mode Insert Right margin set to 79 Paragraph indent none WPS word wrap indent none Read only Unmodifiable Direction Forward Max lines no limit Tab stops set every 8 columns Word wrap on To change the characteristics of the DEFAULTS buffer during an editing session use the command BUFFER DEFAULTS to put the defaults buffer in a window This buffer is empty and you cannot add text to it However when you change the settings of the DEFAULTS buffer the changes are saved and used to set the characteristics of any user buffers you create Use commands such as SET RIGHT MARGIN SET LEFT MARGIN SET TABS FORWARD REVERSE INSERT or OVERSTRIKE to change the characteristics of the DEFAULTS buffer The new characteristics are applied to new buffers but not to existing ones To leave the DEFAULTS buffer and put a different buffer in the window use the BUFFER command DEC Text Processing Utility Program Development 5 27 DEC Text Processing Utility Program Development 5 7 Debugging DECTPU Programs 5 7 Debugging DECTPU Programs This section discusses the options you have for debugging DECT
150. lt in procedure UNMAP removes a window from the screen However the window is still in DECTPU s internal list of windows It is available to be remapped to the screen without being re created DELETE removes a window from the screen and also removes it from DECTPUSs list of windows It is then no longer available for future mapping to the screen Unmapping or deleting a window has the following effects e The unmapped window is marked as not visible and not mapped e Another window becomes the current window and the cursor is moved to the last cursor position in that window e f other windows were occluded by the window you removed from the screen text from the occluded windows reappears on the screen The visible top visible bottom and visible length values of the previously ocduded windows are modified according to the lines that are returned to them when the occluding window is unmapped When an occluding window is removed the window or windows it occluded become visible again 3 14 6 Using the Screen Manager The screen manager is the part of DECTPU that controls the display of data on the screen You can manipulate data without having it appear on a terminal screen see Chapter 5 However if you use the DECTPU window capability to make your edits visible the screen manager controls the screen In the main control loop of DECTPU the screen manager is not called to perform its duties until all commands bound to the last key presse
151. lts 3 6 DEC Text Processing Utility Data Types continued on next page DEC Text Processing Utility Data Types 3 4 Keyword Data Type Table 3 1 Cont Keywords Used for Key Names VT400 VT300 VT200 DECTPU Key Name Series Key VT100 Key Ctrl Z KEY Ctrl Z Ctrl Z The OpenVMS terminal driver handles the following keys as special cases Compaq recommends that you avoid defining the following control characters and function key e Ctrl C e Ctrl O e Ctrl Q e Ctrl S e Ctrl T e Ctrl X Ctrl F6 3 5 Learn Data Type A learn sequence is a collection of DECTPU keystrokes for use later The LEARN BEGIN built in procedure starts collecting keystrokes the LEARN END built in procedure stops the collection of keystrokes and returns a value of the learn data type as a result The following example assigns a learn data type to the variable x LEARN BEGIN EXACT X LEARN END All keystrokes that you enter between the LEARN BEGIN and LEARN END built in procedures are stored in the variable x The EXACT keyword specifies that when the learn sequence is replayed the input if any for the built in procedures READ CHAR READ KEY and READ LINE if used in the learn sequence will be the same as the input entered when the learn sequence was created If you specify NO EXACT a replay of a learn sequence containing keys that invoke the built in procedures READ LINE READ KEY or READ CHAR looks for new input For m
152. m 1 to the number of lines on the screen lines in a window are counted from 1 to the number of lines in the window Columns on the screen are counted from 1 to the physical width of the screen columns in a window are counted from 1 to the number of columns in the window The minimum length for a window is one line if you do not indude a status line or horizontal scroll bar two lines if you indude either a status line or a horizontal scroll bar and three lines if you include both a status line and scroll bar The maximum length of a window is the number of lines on your screen For example if your screen is 24 lines long the maximum size for a single window is 24 lines On the same size screen you can have a maximum of 24 visible windows if you do not use status lines or horizontal scroll bars If you usea status line and a horizontal scroll bar for each window the maximum number of visible windows is 8 3 14 2 Creating Windows When you use a device that supports windows see Appendix B for information on terminals that DECTPU supports you or the section file that initializes your application must create and map windows In most instances it is also advisable to map a buffer to the window To map a buffer to a window use the MAP built in procedure If you do not associate a buffer with a window and map the window to the screen the only items displayed on the screen are messages that are written to the screen at the cursor position T
153. ment to the left the link operator does so only if the right pattern element is not a pattern variable If the link operator s right pattern element is a pattern variable the link operator unanchors that pattern element The pattern pat2 defined by the following assignments matches any sequence of text that begins with the letter a and ends with a digit ANY 0123456789 a amp patl patl pat2 Any amount of text can occur between the a and the digit Pat2 matches the same text as the following pattern pat3 a UNANCHOR ANY 0123456789 The link operator unanchors a pattern variable regardless of what the left pattern element is In particular the following two patterns match the same text pat2 pat3 a amp patl a amp ANCHOR amp pati If you are using pattern variables to form patterns and you wish those variables to be anchored you have two choices you can use the concatenation operator or you can use the ANCHOR keyword as the first element of any pattern the pattern variables reference DEC Text Processing Utility Data Types 3 17 DEC Text Processing Utility Data Types 3 8 Process Data Type 3 8 Process Data Type The CREATE_PROCESS built in procedure returns a value of the process data type A DECTPU process runs as a subprocess DECTPU processes have the same restrictions that OpenVMS subprocesses have Following are some of the restrictions e You cannot create more DECT
154. mode allow the editor to take advantage of special edit mode control sequences during deletion and insertion of text for optimization purposes Some current Compaq terminals that support edit mode include the VT 102 the VT220 the VT240 the VT241 and VT300 series terminals 8 Bit Characters ANSI terminals operating in 8 bit mode have the ability to use the supplemental characters and control sequences in the DEC Multinational Character Set The Compaq VT30O series and the VT220 and VT240 terminals currently support 8 bit character mode If you have the 8 bit mode bit set DECTPU designates the DEC Multinational Character Set into G2 and invokes it into GR For more information on how your terminal interacts with the DEC Multinational Character Set refer to the programming manual for your specific terminal Scrolling DECTPU uses scrolling regions only for terminals that have the DEC CRT mode bit set On other terminals DECTPU repaints the window when a scroll would have been used for example when a line is deleted or inserted Video Attributes When you set the video attributes of windows markers or ranges only those attributes supported by your terminal type give predictable results Most ANSI CRTs support reverse video However only terminals that support DEC CRT mode with the advanced video option AVO have the full range of video attributes reverse bold blink underline that DECTPU supports B 2 DECTPU Terminal Support D
155. n procedures 3 7 Pattern Data Type A pattern is a structure that DECTPU uses when it searches for text in a buffer You can think of a pattern as a template that DECTPU compares to the searched text looking for a match between the pattern and the searched text You can use a variable whose data type is the pattern data type when you specify the first parameter to the SEARCH and SEARCH QUIETLY built in procedures 3 10 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 7 Pattern Data Type To create a pattern use DECTPU pattern operators amp to connect any of the following e String constants e String variables e Pattern variables e Calls to pattern built in procedures The following keywords ANCHOR BUFFER BEGIN BUFFER END LINE BEGIN LINE END PAGE BREAK REMAIN UNANCHOR e Parentheses to enclose expressions Patterns can be simple or complex A simple pattern can be composed of sets of strings connected by one of the pattern operators The following example indicates that pat1 matches either the string abc or the string def patl abc def If you connect two strings with the operator the result is a string rather than a pattern For example the following statement gives pat1 the string data type patl abc def The SEARCH and SEARCH_QUIETLY built in procedures accept such a string as a parameter A more complex pattern u
156. n the keypad EVE is also a powerful and efficient editor which makes it attractive to experienced users of text editors You can access more advanced editing functions by entering commands on the EVE command line Many of the special features of DECTPU such as multiple windows are available with EVE commands You can access other DECTPU features by entering DECTPU statements from within EVE EVE has both a character cell and a DECwindows interface To use EVE s DECwindows interface you must be using a bit mapped terminal or workstation Although EVE is a fully functional editor it is designed to make customization easy You can use either DECTPU statements or EVE commands to tailor EVE to your editing style You can write extensions for EVE or you can write a completely separate interface for DECTPU Figure 1 2 shows the interface choices for DECTPU 1 4 Overview of the DEC Text Processing Utility Overview of the DEC Text Processing Utility 1 3 Description of EVE Figure 1 2 DECTPU as a Base for User Written Interfaces User Written Extensions to EVE EVE Editor User Written Application ZK 6544 GE You can implement extensions to EVE with any of the following A DECTPU command file DECTPU source code A DECTPU section file compiled DECTPU code in binary form Aninitialization file commands in a format that EVE can process Because a DECTPU section file is already compiled startup time for you
157. nge DECTPU converts the buffer or range to a string converts line breaks to line feeds and inserts padding blanks before text to fill any unoccupied space between the margins If neither the application nor DECTPU can respond to the request DECTPU informs DECwindows that the requested information is not available DECTPU does not automatically grab the secondary selection Layered applications are responsible for handling this selection 5 2 4 Using Callbacks This section presents background information on the DECwindows concept of callbacks and explains how DECwindows DECTPU implements this concept DEC Text Processing Utility Program Development 5 7 DEC Text Processing Utility Program Development 5 2 Programming in DECwindows DECTPU 5 2 4 1 Background on DECwindows Callbacks A callback is a mechanism used by a DECwindows widget to notify an application that the widget has been modified in some way DECwindows applications have one or more callback routines that define what the application does in response to the callback For more information about the use of callbacks and callback routines in DECwindows programs see the OpenVMS documentation overview 5 2 4 2 Internally Defined DECTPU Callback Routines and Application Level Callback Action Routines DECTPU implements the DE Cwindows concept of callback routines by providing internally defined routines that deliver the information obtained from a widget s callback to a layered app
158. nodes The a and the 1 are subtrees to the assignment syntax tree node The most common cause of stack overflow which is signaled by the status TPU _ STACKOVER is creating one or more large procedures whose statements occupy too many syntax tree nodes To make your program manageable by the parser break the large procedures into smaller ones 5 2 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 1 Creating DECTPU Programs Other possible reasons for a TPU STACKOVER condition are that you have too many statements that are not in procedures or that you have too many small procedures If you have too many small procedures you must either consolidate them or break them into separate files To see an example of a complex DECTPU program examine the source files that implement EVE The EVE source code files are located at SY S EXAMPLES EVE These files contain many procedure declarations and executable statements that specify EVE s screen layout and display These files also contain key definitions that specify which editing operations are performed when you press certain keys on the keyboard You can examine these files to learn the programming techniques that were used to create EVE See Section 5 6 for information on using a command file or section file to create or customize an application layered on DECTPU See the DEC Text Processing Utility Reference Manual for information on using
159. nsupported Terminals If you want to run DECTPU from an unsupported terminal you must inform DECTPU that you do not want to use screen capabilities To invoke DECTPU on an unsupported terminal use the NODISPLAY qualifier after the EDIT TPU command See Chapter 2 for more information on this qualifier While in no display mode DECTPU uses the RTL generic LIB PUT_ OUTPUT routine to display prompts and messages at the current location in SYS OUTPUT By using a combination of the READ LINE and MESSAGE built in procedures you can devise your own line mode editing functions or perform editing tasks from a batch job See the sample line mode editor in Appendix A B 3 Using Terminal Wrap Terminal wrap characteristics perform differently on each operating system If you have enabled an automatic wrap setting on your terminal DECTPU disables this setting in order to manage the screen more efficiently When you exit from DECTPU DECTPU restores all terminal characteristics If the SET TERM NOWRAP command is active DECTPU leaves the hardware wrap off However if the SET TERM WRAP command is active DECTPU assumes that you want hardware wrap on so it turns it on when you exit from DECTPU You can prevent DECTPU from turning on hardware wrap by specifying SET TERM NOWRAP before invoking DECTPU You can enter the command interactively or you can write a DCL command procedure that makes this setting part of your DECTPU environment Example B 1 shows
160. nt procedures To continue with the debugging session use the GO command GO causes DECTPU to compile the contents of the command file Recompiling a procedure does not remove any breakpoints set in that procedure You cannot use the DECTPU debugger on a file that does not contain DECTPU procedures If your command file does not contain any procedures you must find a different method of debugging it 5 7 2 3 Debugging Other DECTPU Source Code To debug a DECTPU program that is not a section file or a command file use the DEBUG qualifier when you invoke DECTPU For example to debug procedures in a file called USER APPLICATION TPU invoke the debugger on the command line as follows EDIT TPU DEBUG USER APPLICATION TPU The debugger creates a window that fills the screen as described in Section 5 7 2 1 5 7 3 Getting Started with the DECTPU Debugger This section describes using the default DECTPU debugger with EVE If you know which parts of the code you want to debug use the SET BREAKPOINT command to set breakpoints If you need to look at the code before setting breakpoints use the GO command as soon as the debugger window appears This places on the screen the code in the file you specified on the command line At this point EVE commands are available so you can manipulate the text To return to the debugger so you can set breakpoints enter the command DEBUG at the EVE command line You can also gain access to the debugger with
161. o interpret the contents of a variable Unlike many programmi ng languages DECTPU permits any variable to have any type of data as a value DECTPU has no declaration statement to restrict the type of data that you can assign to a variable DECTPU variables take on a data type when they are placed on the left hand side of an assignment statement The right hand side of the assignment statement determines the data type of the variable Although you can construct variables freely DECTPU built in procedures require that their parameters be of specific data types Each built in procedure can operate only on certain data types Some built in procedures return a value of a certain data type when they are executed The following sections describe the DECTPU data types DEC Text Processing Utility Data Types 3 1 DEC Text Processing Utility Data Types 3 1 Array Data Type 3 1 Array Data Type An array is a structure for storing and manipulating a group of elements These elements can be of any data type You create arrays with the CREATE_ARRAY built in procedure For example the following statement creates the array new_array new array CREATE ARRAY You can delete arrays with the DELETE built in procedure When you create an array you can optionally direct DECTPU to allocate a specified number of integer indexed array elements DECTPU processes this block of preallocated elements quickly You can direct DECTPU to create such a block of elemen
162. o system operating system ULTRIX THEN save usr user jacki mini tpu section ELSE save sys login mini ENDIF QUIT End of MINI TPU If you created the section file SYS LOGIN MINI TPU SECTION you could use the procedures and definitions in that file as an interface to DECTPU To invoke DECTPU with SYS LOGIN MINI TPU SECTION as the MINI section file use the following command EDIT TPU SECTION SYS LOGIN MINI your text fil You can define the logical name TPU SE CTION to point to your section file By default DECTPU looks for a file that TPUSSECTION points to and reads that file as the default section file 5 22 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files Whenever you want to add new procedures variables learn sequences or key definitions to a section file edit the command file to include the new items and then recompile the command file to produce a section file with the new items For example if you want to add key definitions for the arrow keys you could edit the file MINI TPU and add the following statements after any procedures in the file DEFINE KEY MOVE VERTICAL 1 UP DEFINE KEY MOVE VERTICAL 1 DOWN DEFINE KEY MOVE HORIZONTAL 1 RIGHT DEFINE KEY MOVE HORIZONTAL 1 LEFT Recompile the command file with the following command EDIT TPU NOSECTION COMMAND MINI TPU After you have com
163. o use DECTPU to perform certain tasks These procedures show one way of using DECTPU there may be other more efficient ways to perform the same task Make changes to these procedures to accommodate your style of editing For these procedures to compile and execute correctly you must make sure that there are no conflicts between these sample procedures and your interface This appendix contains the following types of procedures 1 Line mode editor 2 Translation of control characters 3 Restoring terminal width before exiting from DECTPU 4 DCL command procedure to run DECTPU from a subprocess A 1 Line Mode Editor Example A 1 shows a portion of an editing interface that uses line mode rather than screen displays for editing tasks You can use this mode of editing for batch jobs or for running DECTPU on terminals that do not support screen oriented editing Example A 1 Line Mode Editing Portion of a line mode editor for DECTPU input file GET INFO COMMAND LINE file name Set up main main buffer CREATE BUFFER MAIN input file buffer from input POSITION BEGINNING OF main buffer file LOOP Continuously loop until QUIT cmd READ LINE IF cmd THEN cmd char N ELSE cmd char SUBSTR cmd 1 1 CHANGE CASE cmd char UPPER ENDIF CASE cmd char FROM I TO T Only accepting I L N Q T continued on next page Sample DECTPU Procedures A 1 Sample DECTPU Procedures A 1
164. of DECTPU startup files e Section files e Command files e Initialization files 5 6 1 Section Files A section file is the compiled binary form of a file that contains DECTPU source code To direct DECTPU to execute a section file use the appropriate command syntax for your section To execute a section file use the SECTION qualifier with the EDIT TPU command or let DECTPU execute the default section file The default section file is TPUSSECTION When DECTPU tries to locate the section file DECTPU supplies a default directory of SYS SHARE and a default file type of TPU SECTION OpenVMS systems define the system wide logical name TPU SECTION as EVE SECTION so the default section file is the file that implements the EVE editor To override the OpenVMS default redefine TPUSSECTION For more information on the SECTION qualifier see Section 2 6 13 5 6 2 Command Files A command file contains a series of DECTPU procedures followed by a sequence of TPU statements To direct DECTPU to compile and execute a command file use the appropriate command syntax as explained in this section To specify a DECTPU command file use either the JCOMMAND qualifier with the EDIT TPU command or let DECTPU compile and execute the default command file The default command file is TPU COMMAND When DECTPU tries to locate the command file it supplies a default file type of TPU To direct DECTPU to compile and execute a particular command file de
165. olumns to move To move right you press the key sequence GOLD Right Arrow then enter the number of columns to move SHOW BREAKPOINTS List the current breakpoints in the debugger source window To redisplay code in the source window use the DISPLAY SOURCE command SPAWN subprocess Suspends the current editing session and creates a new process STEP Executes one line of DECTPU code then returns control to the debugger If you have several DECTPU statements on one line all statements are executed before control returns to the debugger TPU statement Executes the DECTPU statement you specify You can enter more than one statement by using the TPU command just once C 2 DECTPU Debugger Commands A command 5 27 Abort resulting from exceeding virtual address space 2 8 ABORT statement 4 24 4 29 to 4 30 Active editing point 3 4 Algorithm for naming buffer change journal file 2 8 Alternation pattern 3 14 AND operator 4 8 Arithmetic expression 4 10 ARRAY data type 3 2 to 3 3 Assignment statement 4 20 Base of numeric constant specifying 4 34 Batch job 2 6 Boolean expression 4 11 Bound marker 3 9 to 3 10 Buffer erasing 3 4 journal file 2 6 variables 3 4 Buffer multiple 3 4 Buffer change journaling 2 6 default file naming 2 8 enabling 2 6 2 14 BUFFER command for message buffer 5 15 BUFFER data type 3 3 to 3 4 Buffer names 3 4 Built in procedure name of as reserved word 4 12 occlu
166. omplex 5 2 debugging 5 28 to C 2 DECwindows DECTPU 5 4 executing 5 15 to 5 16 interrupting 5 16 order 5 3 simple 5 2 syntax 5 3 example 5 3 writing 5 1 to 5 12 PROGRAM datatype 3 18 Q Qualifiers See EDIT TPU command qualifiers R Radix of numeric constant specifying 4 34 Range deleting 3 19 erasing 3 19 video attributes 3 20 RANGE datatype 3 19 to 3 20 READ_ONLY qualifier 2 17 RECOVER qualifier 2 6 2 18 Recovery of buffer contents 2 6 Recursive procedure 4 18 Relational expression 4 10 Relational operators 3 15 Removal of window 3 25 Repetitive statements 4 20 Reserved word built in procedures 4 12 keywords 4 12 language elements 4 13 to 4 14 predefined constants 4 12 Resource supported data types for 5 11 Restoring terminal width example A 6 Restrictions for DECTPU virtual address space 2 8 for subprocesses on OpenVMS systems 3 18 RETURN statement 4 24 4 28 to 4 29 S Screen manager 3 25 Search anchoring a pattern 3 17 for pattern 3 10 unanchoring pattern elements 3 17 Section files 2 19 creating 5 19 debugging 5 28 default 5 17 definition 2 2 extending 5 20 processing 5 19 5 20 recommended conventions 5 23 SECTION qualifier 2 19 5 21 Security considerations 2 6 Selection 5 13 dynamic 5 13 found range 5 14 static 5 13 Select range in EVE 5 13 Semicolon as statement separator 1 7 4 4 4 14 4 15 4 16 5 3 Separato
167. on marked by the editing point at the time you create the marker A bound marker is tied to the character on which it is created If you move the character to which a marker is bound the marker moves with the character If you delete the character to which a marker is bound DECTPU binds the marker to the nearest character or to the end of the line if that is closer than any character To force the creation of a bound marker use the MARK built in with any of its parameters except FREE CURSOR This operation creates a bound marker even if the editing point is beyond the end of a line before the beginning of a line in the middle of a tab or beyond the end of a buffer To create a bound marker in a location where there is no character DECTPU fills the space between the marker and the nearest character with padding space characters A marker is usually free if all of the following conditions are true e You used MARK FREE CURSOR to create the marker There was no character in the position marked by the editing point at the time you created the marker e Nothing has happened to cause the marker to become bound The following paragraphs explain each of these conditions in more detail If you use the MARK FREE CURSOR built in procedure and there is a character in the position marked by the editing point the marker is bound even though you specify otherwise Once a marker becomes bound it remains bound throughout its existence To determin
168. onditional Compilation The following lexical keywords control what code is compiled under different conditions e 9gdF e 9gFDEF Y THEN ELSE e ENDIF You use conditional compilation lexical keywords in a manner similar to ordinary IF THEN ELSE ENDIF statements The syntax is as follows 9eIFDEF variable or proc name THEN ELSE ENDIF or 9elF boolean expression THEN ELSE ENDIF If you use the F DEF structure specify variable or proc name as the name of a DECTPU procedure or variable IFDEF is a statement that says if a variable or procedure with this name is defined If the name is defined the compiler compiles the code marked by THEN If the name is not defined the compiler compiles the code marked by ELSE If you use the 9d F structure specify boolean expression as either a numeric constant or a defined global variable whose value is an integer Any odd value is true and any even value is false If the variable or constant contains a value that is odd the compiler compiles the code marked by THEN If the variable or constant contains a value that is even the compiler compiles the code marked by ELSE You do not have to put conditional compilation lexical keywords at the beginning of a line You can nest conditional statements to a depth of 2 32 1 For example ON ERROR TPUS CREATEFAIL IF eve x option decwindows STHEN IF eve x_decwindows_active THEN eveSpopup_message MESSAGE_TEXT E
169. one marker is closer to or farther from the top of the buffer than another marker If markers are in different buffers they will return as false For example the procedure in Example 4 3 uses relational operators to determine which half of the buffer the cursor is located in Example 4 3 Procedure That Uses Relational Operators on Markers PROCEDURE which_half LOCAL number_lines saved mark saved mark MARK FREE CURSOR POSITION BEGINNING OF CURRENT BUFFER number lines GET INFO current buffer record count IF number lines 0 THEN MESSAGE The current buffer is empty ELSE MOVE VERTICAL number lines 2 IF MARK FREE CURSOR saved mark THEN MESSAGE You are at the middle of the buffer ELSE IF MARK FREE CURSOR lt saved mark THEN MESSAGE You are in the second half of the buffer ELSE MESSAGE You are in the first half of the buffer ENDIF ENDIF ENDIF ENDPROCEDURE 4 8 3 Pattern Expressions A pattern expression consists of the pattern operators amp combined with string constants string variables pattern variables pattern procedures pattern keywords or parentheses The following are valid pattern expressions patl LINE BEGIN SPAN 0123456789 ANY abc pat2 LINE END end begin pat3 SCAN NOTANY amp LINE END See Chapter 3 for more information on pattern expressions 4 8 4 Boolean Expressions DECTPU perfo
170. one specified Disabled Enabled OURNAL Disabled Enabled OURNAL filename Enabled Enabled NOJ OURNAL Disabled Disabled However you can use SET J OURNALING to enable buffer change journaling Caution J ournal files contain a record of all information being edited Therefore when editing files that contain secure or confidential data be sure to keep the journal files secure as well You must use the same major version of DECTPU to recover the journal that you used to create it 2 6 Getting Started with DECTPU Getting Started with DECTPU 2 4 Using Journal Files 2 4 1 Keystroke Journaling In keystroke journaling DECTPU keeps track of each keystroke made during a session regardless of which buffer is in use If a system interruption occurs during a session you can reconstruct the work done during the session To determine the name of the keystroke journal file use a statement similar to the following filename GET INFO SYSTEM journal file For more information on using a keystroke journal file for recovery see Section 2 6 8 and the Extensible Versatile Editor Reference M anual Note Compaq strongly recommends the use of buffer change journaling rather than keystroke journaling To reconstruct your work use the OURNAL and RECOVER qualifiers The following example shows system recovery on a file called J ACKI SDML EDIT TPU JACKI SDML JOURNAL RECOVER 2 4 2 Buffer Change Journa
171. onstants See Section 4 9 3 for a list of predefined constants Constants can be either globally or locally defined Global constants are constants declared outside procedure declarations Once a global constant has been defined it is set for the life of the DECTPU session An attempt to redefine a constant will succeed only if the constant value is the same Local constants are constants declared within a procedure You must specify a local CONSTANT declaration after the PROCEDURE statement and before any ON_ERROR statement You can intermix LOCAL statements and CONSTANT statements Syntax CONSTANT constant name compile time constant expression 4 9 5 4 VARIABLE With the VARIABLE declaration you can identify certain variables as global variables Any symbols that are neither declared nor used as the target of an assignment statement before being referenced by DECTPU are assumed to be undefined procedures You must use the VARIABLE declaration outside a procedure declaration Initialize global variables to the data type unspecified Syntax VARIABLE variable name 4 10 Lexical Keywords The next two sections explain the DECTPU lexical keywords and how to use them for the following e Conditional compiling e Specifying the radix of numeric constants 4 32 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 10 Lexical Keywords 4 10 1 C
172. ontains more free space Use one of the following methods to do this e Redefine TPUSWORK to point to the disk with more free space e Invoke DECTPU with the WORK filename qualifier DECTPU may be unable to signal an error when it frees up memory by writing to the work file In this case DECTPU aborts with a fatal internal error You may be able to avoid writing to the work file by increasing the virtual address space available to a process The virtual address space is controlled by the following two factors The SYSGEN parameter VIRTUALPAGECNT The page file quota of the account you are using The VIRTUALPAGECNT parameter controls the number of virtual pages that can be mapped for a process For more information on VIRTUALPAGECNT see the description of this parameter in the OpenVMS documentation on the System Generation Utility SY SGEN The page file quota controls the number of pages in the system paging file that can be allocated to your process For more information on the page file quota see the description of the PGFLQUOTA qualifier in the OpenVMS documentation on the Authorize Utility AUTHORIZE You may need to modify both the VIRTUALPAGECNT parameter and the page file quota to enlarge the virtual address space 2 8 Getting Started with DECTPU Getting Started with DECTPU 2 5 Avoiding Errors Related to Virtual Address Space DECTPU keeps strings in a different virtual pool than it does other memory Once DECTPU sta
173. or fatal messages CASE the severity FROM user warning TO user fatal user warning user error user fatal flash it TRUE user success user informational flash it FALSE OUTRANGE flash it FALSE ENDCASE Output the message flash it if appropriate MESSAGE the text IF flash it THEN SLEEP 0 00 00 00 3 MESSAGE SLEEP 0 00 00 00 3 MESSAGE the text ENDIF ENDPROCEDURE Caution Do not assume that the DECTPU compiler automatically evaluates parameters in the order in which you place them To avoid the need to rewrite code you should write as if this compiler optimization were already implemented If you need the compiler to evaluate parameters in a particular order you should force the compiler to evaluate each parameter in order before calling the procedure To do so use each parameter in an assignment statement before calling the procedure For example suppose you want to call a procedure whose parameter list includes PARAM 1 and PARAM 2 Suppose too that PARAM 1 must be evaluated first To get this result you could use the following code partial 1 param 1 partial 2 param 2 my procedure partial 1 partial 2 Lexical Elements of the DEC Text Processing Utility Language 4 17 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words 4 9 4 5 Procedures That Return a Result Procedures that return a result are calle
174. ore information on replaying a learn sequence see LEARN BEGIN and LEARN END in the DEC Text Processing Utility Reference Manual You can use the LEARN ABORT built in procedure to interrupt the execution of a learn sequence For information on using LEARN ABORT see LEARN_ABORT in the DEC Text Processing Utility Reference Manual DEC Text Processing Utility Data Types 3 7 DEC Text Processing Utility Data Types 3 5 Learn Data Type To enable your user written DECTPU procedures to work successfully with learn sequences you must observe the following coding rules when you write procedures that you or someone else can bind to a key The procedure should return true or false as needed to indicate whether execution of the procedure completed successfully The procedure should invoke the LEARN ABORT built in in case of error These practices help prevent a learn sequence from finishing if the learn sequence calls the user written procedure and the procedure is not executed successfully A procedure that does not explicitly return a value returns 0 by default thus aborting a learn sequence Note Learn sequences do not indude mouse input or characters inserted in a widget Note If while recording a learn sequence a margin action routine is executed such as EVE s word wrap the routine may not be executed during the replay of the sequence 3 6 Marker Data Type A marker is a reference point in a buffer
175. ot an application 1 1 1 DECTPU Features DECTPU aids application and system programmers in developing tools that manipulate text For example programmers can use DECTPU to design an editor for a specific environment DECTPU provides the following special features e Multiple buffers e Multiple windows e Multiple subprocesses e Keystroke and buffer change journaling Text processing in batch mode e Insert or overstrike text entry Overview of the DEC Text Processing Utility 1 1 Overview of the DEC Text Processing Utility 1 1 Description of DECTPU e Free or bound cursor motion Learn sequences e Pattern matching Key definition e Procedural language e Callable interface 1 1 2 DECTPU and User Applications DECTPU is a language that you can use as a base on which to layer text processing applications When you choose an editor or other application to layer on DECTPU that becomes the interface between you and DECTPU You can also create your own interface to access DECTPU Figure 1 1 shows the relationship of DECTPU with EVE as its user interface Figure 1 1 DECTPU as a Base for EVE EVE Editor ZK 6545 GE 1 1 3 DECTPU Environments You can use DECTPU on the OpenVMS VAX and OpenVMS Alpha operating systems You can display text in two environments e Character cell terminals e Bit mapped workstations running the DE Cwindows software 1 2 Description of DECwindows DECTPU DECTPU supports the Compaq DE C
176. our system manager has not overridden this default You can specify multiple input files on the DECTPU command line The files must be separated by commas The maximum number of files you can specify is 10 For the ambiguous file names EVE displays a warning message Getting Started with DECTPU 2 1 Getting Started with DECTPU 2 1 Invoking DECTPU on OpenVMS Systems 2 1 1 Default File Specifications Table 2 1 lists the default TPU and EVE file specifications on OpenVMS systems Table 2 1 Default File Specifications on OpenVMS Systems File OpenVMS File Specification Section SYS SHARE TPU SECTION TPU SECTION Command TPUS COMMAND TPU Init SYS DISK EVE INIT EVE Init SYS LOGIN EVE INIT EVE Debugger SYS SHARE TPU DEBUG TPU Keystroke journal Buffer change journal Buffer change journal Work Motif Resource Application defaults Application defaults SYS DISK TJ L SYS SCRATCH TPU J OURNAL TPU J OURNAL TPU OURNAL SYS SCRATCH TPU WORK SYS LIBRARY UID DECW SYSTEM_DEFAULTS DAT DECW USER DEFAULTS DAT EVE Motif resource SYS SHARE EVE WIDGETS UI D EVE sources SYS EXAMPLES EVE lThese directory and file type defaults are added by the Motif Resource Manager if missing from the file specification 2xxxxxx suffix from mktemp 3 Note that this file is invisible These X resource files are used only by dmtpu and dxtpu OpenVMS system managers should note that the OpenVMS systemwide logical name is de
177. outine as the callback routine for all callbacks that have a string dosure Although DECwindows lets you specify a different callback routine for each reason that a widget can call back DECwindows DECTPU does not support this capability Instead it provides only the two callback routines mentioned Use these callback routines only if you are specifying a widget s callback resources in a User Interface Language UIL file When a widget is part of an X Resource Manager hierarchy do not indude callback resource names or values in the array you pass to SET WIDGET Instead specify one of the two internally defined callback routines in the UIL file 5 8 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 2 Programming in DECwindows DECTPU 5 2 4 4 Internally Defined DECTPU Callback Routines with Widgets Not Defined by UIL Although the SET WIDGET built in procedure lets you specify values for various resources of a widget there are restrictions on specifying values for callback resources of widgets When a widget is not part of an X Resource Manager hierarchy specify the names of the callback resources in the array you pass to SET WIDGET and specify 0 as the value of each such callback resource DECTPU automatically substitutes its common callback entry point for the 0 value A widget calls back only for those reasons specified in the widget s argument list If a reason is omitted from the list
178. ow 3 25 Displaying version number 5 2 DISPLAY qualifier 2 12 See also NODISPLAY Dynamic selection in EVE 5 13 E EDIT TPU command 2 1 qualifiers 2 9 to 2 20 CHARACTER SET 2 9 COMMAND 2 10to 2 11 CREATE 2 11 DEBUG 2 12 5 28 DISPLAY 2 12 NITIALIZATION 2 13 INTERFACE 2 14 J OURNAL 2 14 MODIFY 2 15 OUTPUT 2 16 READ ONLY 2 17 RECOVER 2 18 SECTION 2 19 START_POSITION 2 20 Editing interface See EVE Editing point 3 4 ELSE dause 4 20 ELSE lexical keyword 4 33 96ENDIF lexical keyword 4 33 ENDIF statement 4 20 to 4 21 ENDLOOP statement 4 20 ENDMODULE statement 4 14 ENDON_ERROR statement 4 23 to 4 28 ENDPROCEDURE statement 4 15 to 4 19 Entering control characters 4 3 EQUIVALENCE statement 4 30 Error resulting from exceeding virtual address space 2 8 Error handler case style 4 25 to 4 28 procedural 4 24 to 4 25 Error handling 4 23 to 4 28 5 30 ERROR lexical element 4 23 ERROR LINE lexical element 4 23 ERROR TEXT lexical element 4 23 EVE DEFAULTS buffer 5 27 initialization files 5 25 to 5 27 during a session 5 27 effects on buffer settings 5 27 Initialization files 2 13 message buffer 5 15 output file 2 16 source files 5 3 EVESINIT logical name 5 26 EVE SELECTION procedure using to obtain EVE s current selection 5 13 EVE default settings 5 27 EVE source files 2 3 EXECUTE built in procedure 5 15 EXITIF statement 4 20 Expressions 4 8 to 4 12
179. ple the default initialization file for the EVE editor is EVESINIT EVE In EVE if you do not spedify a device or directory EVE first checks the current directory If the specified or default initialization file is not there EVE checks SY S LOGIN If EVE finds the specified or default initialization file EVE executes the commands in the file For more information on using initialization files with EVE see Chapter 5 and the Extensible Versatile Editor Reference M anual Getting Started with DECTPU 2 13 Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers 2 6 7 INTERFACE The INTERFACE qualifier determines the interface or screen display you want same as DI SPLAY The default is CHARACTER CELL For example to invoke EVE with the DECwindows interface use the following command EDIT TPU INTERFACE DECWINDOWS Then if DECwindows is available DECTPU displays the editing session in a separate window on your workstation screen and enables DECwindows features for example the EVE screen layout includes a menu bar and scroll bars If DECwindows is not available DECTPU works as if on a character cell terminal 2 6 8 JOURNAL j OURNAL input file TJ LT default for EVE NOJ OURNAL default for DECTPU The OURNAL qualifier determines whether DECTPU keeps a journal file of an editing session so you can recover the session if it is unexpectedly interrupted DECTPU offers two forms of journaling e
180. pleted the previous steps you can use the section file you created to invoke DECTPU with the new key definitions included An alternate way of adding these key definitions to your section file is to enter the definitions as text in the current buffer You could then press the Tab key the command prompt key for the minimal interface and enter the following command after the prompt TPU Statement EXECUTE CURRENT BUFFER This causes the new key definitions to be added to your current editing context To add the definitions to the section file so you can use them in future sessions enter the following statement at the Command prompt Command SAVE sys login mini If you want to save the DECTPU source code for the key definitions write out the current buffer or use the EXIT built in procedure to leave the DECTPU session so that the contents of the buffer are written to a file 5 6 5 4 Recommended Conventions for Section Files A section file that implements a layered application should include the following procedures e TPUSINIT PROCEDURE e TPUSLOCAL INIT If your application is to support initialization files the section file that implements the application should also include a procedure called TPU INIT_ POSTPROCEDURE This procedure should contain the DECTPU statements that implement or handle the initialization files For information on EVE s implementation of initialization files see Section 5 6 7 The TPUSINIT PROCEDU
181. procedure in an appropriate context Appendix A contains longer sample procedures that perform useful editing tasks These procedures are merely samples you can adapt them for your own use You must substitute an appropriate value for any item in lowercase in sample procedures and syntax examples For more information on designing your own DECTPU based editor or application rather than using EVE see Chapter 5 1 8 Overview of the DEC Text Processing Utility 2 Getting Started with DECTPU This chapter describes the following e Invoking DECTPU on OpenVMS systems e Invoking DECTPU from a DCL command procedure e Invoking DECTPU from a batch job Using journal files e Avoiding errors related to virtual address space e Using OpenVMS command line qualifiers 2 1 Invoking DECTPU on OpenVMS Systems On OpenVMS systems you can invoke DECTPU through the Digital Command Language DCL The basic DCL command for invoking DECTPU with EVE the default editor is as follows EDIT TPU To invoke DECTPU from DCL type the command EDIT TPU optionally followed by the name of your file EDIT TPU text file lis This command opens TEXT FILE LIS for editing If you are using the EVE editor Compaq suggests that you create a symbol like the following one to simplify invoking EVE EVE EDIT TPU When you invoke DECTPU with the preceding command you are usually placed in EVE the default editor However you should check that y
182. r editor or application is shorter when you use a section file than when you use a command file or an initialization file Section 2 1 2 contains more information on startup files To implement an editor or application that is entirely user written use a section file Chapter 5 contains more information on DECTPU command files section files and initialization files The DEC Text Processing Utility Reference Manual contains information on layering applications on DECTPU 1 4 DECTPU Language You can view the DECTPU language as the most basic component of DECTPU To access the features of DECTPU write a program in the DECTPU language and then use the utility to compile and execute the program A program written in DECTPU can be as simple as a single statement or as complex as the section file that implements EVE The block structured DECTPU language is easy to learn and use DECTPU language features indude a large number of data types relational operators error interception looping and case statements and built in procedures that simplify development or extension of an editor or application Comments are indicated with a single comment character so that you can document your procedures easily There are also capabilities for debugging procedures with user written debugging programs Overview of the DEC Text Processing Utility 1 5 Overview of the DEC Text Processing Utility 1 4 DECTPU Language 1 4 1 Data Types The DECTPU lang
183. r semicolon used as 1 7 4 4 4 14 4 15 4 16 5 3 SET WIDGET built in procedure using to specify resource values 5 11 SET WIDGET CALLBACK built in procedure using to specify callback routine 5 8 SET built in procedure WIDGET 5 9 SHOW KEYWORDS built in procedure 3 5 SHOW DEFAULTS BUFFER command 5 27 Index 5 Showing version number 5 2 SHOW_BUFFER variable 5 24 Source files for EVE 2 3 Startup files 2 2 to 2 3 5 17 to 5 27 command file 2 2 definition 2 2 initialization file 2 2 order of execution 5 18 section file 2 2 START_POSITION qualifier 2 20 Statement separator for 5 3 Static selection 5 13 String concatenating 4 4 String constants 4 6 STRING data type 3 20 to 3 21 Subprocess restrictions on OpenVMS systems 3 18 running DECTPU from A 7 Supported terminals 1 7 Symbols 4 4 Syntax 5 3 T Terminal behavior B 1 DEC CRT2 B 3 restoring width A 6 setting B 1toB 3 AUTO REPEAT B 2 auxiliary keypad B 2 132 columns B 2 control sequence introducer B 2 CSI B 2 cursor B 2 DEC CRT B 2 edit mode B 2 eightbit characters B 2 scrolling B 2 video attributes B 2 support B 1 width restoring A 6 Terminal support 1 7 THEN lexical keyword 4 33 TPUS COMMAND logical name 2 11 5 17 TPUSDEBUG logical name 2 12 TPUSINIT PROCEDURE procedure 5 18 5 23 TPUSLOCAL INIT procedure 5 23 TPUSSECTION logical name 2 19 5 17 5 22 TPUSSTACKOVER status correcting 5 2 TPUS W
184. r a TPU CONTROLC selector in the procedures or program if any in which the current procedure is nested If no TPU _ CONTROLC selector is found in the containing procedures or program DECTPU places the message associated with TPU CONTROLC in the message buffer e Ifan error or warning is generated during a CALL USER routine ERROR is set to a keyword that represents the failure status of the routine ERROR LINE is set to the line number of the error and ERROR TEXT is set to the warning or error message associated with the keyword DECTPU then processes the error handler that trapped the CALL USER error in the same way that DECTPU processes normal case style error handlers For other warnings and errors ERROR is set to a keyword that represents the error or warning ERROR LINE is set to the line number of the error and ERROR TEXT is set tothe error or warning message associated with the keyword The way a case style error handler processes an error or warning depends on how the error handler traps the error There are three possible ways as follows Theerror handler can trap the error by using a selector that matches the error exactly that is using a selector other than OTHERWISE Theerror handler can trap the error by using the OTHERWISE selector The error handler can completely fail to trap the error The following discussion explains how a case style error handler processes an error or warning in each of these circ
185. racter replace text translate array ASCII STR char range If we got back a value of TPUSK UNSPECIFIED TPU will display the character meaningfully IF replace text TPUSK UNSPECIFIED THEN RETURN 0 ENDIF Erase the range and insert the new text ERASE char range COPY TEXT replace text RETURN 1 ENDPROCEDURE continued on next page Sample DECTPU Procedures A 3 Sample DECTPU Procedures A 2 Translation of Control Characters Example A 2 Cont Procedure to Display Control Characters This procedure controls control characters that the outer loop search for the special we want to view PROCEDURE view controls source buffer CONSTANT Ctrl char str ASC ASC ASC ASC ASC ASC ASC ASC OO 4 ODN OO FO MO NO DOP L3 LOCAL Ctrl char pattern Ctrl char range ASCII 1 ASCII 2 ASCII 3 ASCII 5 ASCII 6 ASCII 7 ASCII 9 ASCII 10 ASCII 11 ASCII 13 ASCII 14 ASCII 15 ASCII 17 ASCII 18 ASCII 19 ASCII 21 ASCII 22 ASCII 23 ASCII 25 ASCII 26 ASCII 27 ASCII 29 ASCII 30 ASCII 31 Create the translation buffer and window if necessary IF translate_buffer THEN translate_buffer SET NO WRITE tra ENDIF IF translate window THEN translate window ENDIF Make a copy of the buffer ERASE translate buffer POSITION translate
186. ready implemented If you need the compiler to evaluate all clauses of a conditional statement you should force the compiler to evaluate each clause before using the conditional statement To do so use each clause in an assignment statement before using it in a conditional statement For example suppose you want the compiler to evaluate both CLAUSE 1 and CLAUSE 2ina conditional statement To get this result you could use the following code relation 1 clause 1 relation 2 clause 2 IF relation 1 AND relation 2 THEN ENDIF Statement The CASE statement is a selection control structure that lets you list several alternate actions and choose one of them to be executed at run time In a CASE statement case labels are associated with the possible executable statements or actions to be performed The CASE statement then executes the statement or statements labeled with a value that matches the value of the case selector Lexical Elements of the DEC Text Processing Utility Language 4 21 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words Syntax CASE case selector FROM lower constant expr TO upper constant expr constant expr 1 statement l constant expr 2 statement constant expr n statement INRANGE statement OUTRANGE statement ENDCASE The single brackets are not optional for case constants
187. reate synonyms Equivalences work only when both real name and synonym name are defined at the same time You cannot save a section file that contains real name and then later use that section file to extend code that uses an EQUIVALENCE of the saved name To avoid problems include all EQUIVALENCE declarations in the same compilation unit where real name is defined The equivalences can reside in different compilation units but you must use all of the compilation units when building the section file from scratch If you usea base section file that you extend interactively you cannot make equivalences to procedures or variables defined in the base section file Syntax EQUIVALENCE synonym namel real namel synonym name2 real name2 TM Elements of the EQUIVALENCE Statement real name A user defined global variable or procedure name If real name is undefined DECTPU defines it as an ambiguous name This ambiguous name can become a variable or procedure later synonym name A name to be defined as a synonym for the real name 4 9 5 2 LOCAL With the LOCAL dedaration you can identify certain variables as local variables rather than global variables All variables are considered to be global variables unless you explicitly use the LOCAL dedaration to identify them as local variables The LOCAL dedaration in a procedure is optional It must be specified after the PROCEDURE statement and before any ON ERROR statement LOCAL declarations
188. rk too l CONSTANT negative value xlf CONSTANT strange zero hex constant xlf Invalid constructs for numeric constants return the error level message TPU UNKLEXICAL Unknown lexical element during compilation The following examples are not valid constant bad binary b123 only 0 s and 1 s are legal constant bad hex x10abg g is illegal digit constant not a radix z0123 No such radix 4 34 Lexical Elements of the DEC Text Processing Utility Language 9 DEC Text Processing Utility Program Development Previous chapters have described the lexical elements of the DECTPU language such as data types language statements expressions built in procedures and so on This chapter describes how to combine these elements in DECTPU programs You can use DECTPU programs to perform editing tasks to customize or extend an existing application or to implement your own application layered on DECTPU Before you start writing programs to customize or extend an existing application you should be familiar with the DECTPU source code that creates the editor or application that you want to change For example if you use the Extensible Versatile Editor EVE and you want to change the size of the main window you must know and use the procedure name that EVE uses for that window If you want to change the main window you use the procedure name eve main window Many of the EVE variables and procedure name
189. rms bitwise logical operations on Boolean expressions This means that the logical operation is performed on the individual bits of the operands to produce the individual bits of the result In the following example the value of user variableis set to 3 user variable 3 AND 7 As another example if user var were X7777 30583 then you would use the following statement to set user var to x0077 119 user var user var AND XFF Lexical Elements of the DEC Text Processing Utility Language 4 11 Lexical Elements of the DEC Text Processing Utility Language 4 8 Expressions A true value in DECTPU is any odd integer a false value is any even integer Use the logical operators AND NOT OR XOR to combine one or more expressions DECTPU evaluates Boolean expressions enclosed in parentheses before other elements The following example shows the use of parentheses to ensure that the Boolean expression is evaluated correctly IF X 12 AND y lt gt 40 THEN ENDIF 4 9 Reserved Words Reserved words are words that are defined by DECTPU and that have a special meaning for the compiler DECTPU reserved words can be divided into the following categories Keywords e Built in procedure names e Predefined constants e Declarations and statements The following sections describe the categories of reserved words 4 9 1 Keywords Keywords area DECTPU data type They are reserved words that have special meaning to the comp
190. rocedure after the TPU Statement prompt from EVE e Call the procedure from within a program or another procedure 5 5 2 Process Suspension To suspend a process you can use Ctrl C Pressing Ctrl C causes DECTPU to stop the execution of a user written program You can also stop the execution of the following DECTPU built in procedures with Ctrl C LEARN BEGIN LEARN END execution of a learn sequence READ FILE SEARCH WRITE FILE Caution Because DECTPU does not journal Ctrl C using Ctrl C may affect the accuracy of your keystroke journal file In addition Ctrl C prevents completion of some built in procedures such as ERASE RANGE MOVE _ TEXT and FILL DECTPU behavior after such an interruption is unpredictable Compaq recommends that you exit from the editor after pressing Ctrl C to ensure that you do not lose any work because of an inaccurate keystroke journal file 5 16 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 5 Executing DECTPU Programs Buffer change journaling works properly with Ctrl C Therefore if you are not using keystroke journaling exiting from the editor is not necessary For more information on the effects of pressing Ctrl C see Section 4 9 4 14 and Section 4 9 4 16 5 6 Using DECTPU Startup Files DECTPU startup files are files that DECTPU reads compiles and executes during its initialization sequence There are three types
191. rocedure named TPUSLOCAL INIT supersedes EVE s original empty value of TPUSLOCAL INIT TPUSLOCAL INIT is called at the end of the procedure TPUSINIT PROCEDURE during the initialization sequence For more information on the initialization sequence see Section 5 6 4 If you are extending a non EVE section file you must determine whether that section file has implemented the convention of including a TPUSLOCAL INIT procedure After adding DECTPU procedures and statements that implement your application end your program with the following statements A statement that contains the SAVE built in procedure SAVE is the mechanism by which you store all currently defined procedures variables and bound keys in binary form e The QUIT built in procedure QUIT ends the DECTPU session For more information on SAVE and QUIT see the descriptions of these built ins in the DEC Text Processing Utility Reference Manual Example 5 4 shows the syntax of a program that could be used to create a section file Example 5 4 Sample Program for a Section File PROCEDURE tpu local init ENDPROCEDURE PROCEDURE vtl100 keys ENDPROCEDURE vt100 keys Call the procedure that defines the keys SAVE vtl00ini tpusection QUIT To add your program to an existing section file invoke DECTPU but do not supply as a parameter the name of a file to be edited Use the SECTION qualifier to specify the section file to which you want to add your program Use
192. rriage return and bell 32 Space 33 64 Special characters such as the ampersand amp question mark equal sign and the numbers 0 through 9 65 122 The uppercase and lowercase letters A through Z and a through z 123 126 Special characters such as the left brace and the tilde 127 Delete The following sections discuss the types of character sets supported by DECTPU 4 3 4 DEC Multinational Character Set DEC MCS The DEC Multinational Character Set characters from 128 to 255 are extended control characters and supplemental multinational characters Table 4 2 shows the categories into which you can group the characters Table 4 2 Categories of DEC Multinational Character Set Characters Category Meaning 128 159 Extended control characters 160 Reserved 161 191 Supplemental special graphics characters such as the copyright sign and the degree sign 192 254 The supplemental multinational uppercase and lowercase letters such as the Spanish N and 255 Reserved For a complete list of characters in the DEC Multinational Character Set see the OpenVM S documentation 4 2 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 3 Character Sets 4 3 2 ISO Latini Character Set ISO LATIN1 The ISO Latin1 Character Set characters from 128 to 255 are extended control characters and Latin1 supplemental multinational character
193. rts writing to the work file the size of the string memory pool is fixed DECTPU cannot write strings to the work file so if it needs to allocate more space in the string memory pool it will fail with a fatal internal error If you encounter this problem you can expand the string memory pool during startup by preallocating several large strings The following example shows how to do this PROCEDURE preallocate_strings LOCAL str_len stringl string2 str_len 65535 stringl a str len string2 stringl ENDPROCEDURE 2 6 Using OpenVMS EDIT TPU Command Qualifiers The DCL command EDIT TPU has qualifiers for setting attributes of DECTPU or an application layered on DECTPU The qualifiers fall into the following two categories e Qualifiers handled by DECTPU Qualifiers in this category have their defaults set by DECTPU e Qualifiers handled by the application layered on DECTPU Some qualifiers in this category have their defaults set entirely by DECTPU some have their defaults set entirely by the layered application and some have their defaults set partly by each The following sections present the qualifiers in alphabetical order giving a detailed description of each The examples in the following sections show the qualifiers directly after the EDIT TPU command and before the input file specification You can place the qualifiers anywhere on the command line after EDIT TPU These sections show the defaults that are set i
194. s Table 4 3 shows the groups into which you can categorize characters Table 4 3 Categories for ISO Latin1 Characters 128 159 Extended control characters 160 191 Latinl supplemental graphics characters such as the nonbreaking space and the currency sign 192 255 The Latin1 supplemental uppercase and lowercase letters such as the uppercase and lowercase thorn For a complete list of the ISO Latin1 Character Set see the OpenVMS documentation 4 3 3 General Character Sets If you specify the GENERAL keyword with the CHARACTER SET qualifier or the C option DECTPU is unable to set a character set for 8 bit characters The character set used and how DECTPU displays 8 bit characters are the same as before you started DECTPU For this reason the characters from 128 to 255 in the General Character Sets are not specific to any character set 4 3 4 Entering Control Characters There are two ways to enter control characters in DECTPU e Use the ASCII built in procedure with the decimal value of the control character that you want to enter The following statement causes the escape character to be entered in the current buffer COPY TEXT ASCII 27 e Use the special functions provided by EVE to enter control characters EVE provides a QUOTE command that is bound to Ctrl V to insert control characters in a buffer For example to use the quote command to insert an escape character in a buffer do the following 1 Press Ctrl V
195. s begin with eve The sample procedures and syntax examples in this book use uppercase letters for items that you can enter exactly as shown DECTPU reserved words such as built in procedures keywords and language statements are shown in uppercase Lowercase items in a syntax example or sample procedure indicate that you must provide an appropriate substitute for that item This chapter discusses the following topics e Creating DECTPU programs e Programming in DECwindows DECTPU e Writing code compatible with DECwindows EVE e Compiling DECTPU programs e Executing DECTPU programs e Using DECTPU startup files e Debugging DECTPU programs Handling Errors 5 1 Creating DECTPU Programs When you write a DECTPU program keep the following pointers in mind e You can use EVE or some other editor to enter or change the source code of a program in the DECTPU language e A program can be a single executable statement or a collection of executable statements DEC Text Processing Utility Program Development 5 1 DEC Text Processing Utility Program Development 5 1 Creating DECTPU Programs You can use executable statements either within procedures or outside procedures You must place all procedure declarations before any executable statements that are not in procedures e You can enter DECTPU statements from within EVE by using the EVE command TPU For more information on using this command see the Extensible Versatile Editor R
196. s of DECTPU on a VT52 terminal hardcopy terminal or foreign terminal that does not respond to ANSI control functions you can run DECTPU on these terminals with line mode editing For information on how to implement this style of editing see the description of the NODISPLAY qualifier in Chapter 2 and the sample line mode editor in Appendix A Overview of the DEC Text Processing Utility 1 7 Overview of the DEC Text Processing Utility 1 6 Learning Path for DECTPU 1 6 Learning Path for DECTPU The suggested path for learning to use DECTPU is to first read the documentation describing EVE if you are not familiar with that editor The DECTPU EVE documentation contains both reference and tutorial material for new EVE users It also contains material for more experienced users of text editors and explains how to use DECTPU to extend the EVE interface When you are familiar with EVE you may want to extend or customize it Study the source code to see which procedures variables and key definitions the editor uses Then write DECTPU procedures to implement your extensions Make sure that the DECTPU procedures you write do not conflict with procedures or variables that EVE uses To help you learn about the DECTPU language this manual contains examples of DECTPU procedures and programs Many of the descriptions of the built in procedures in the DEC Text Processing Utility Reference Manual also have a short sample procedure that uses the built in
197. ses pattern built in procedures and existing patterns to form a new pattern The following example indicates that pat2 matches the string abc followed by the longest string that contains any characters from the string 12345 pat2 abc SPAN 12345 Pat2 matches the string abc123 in the text string xyzabc123def Following are additional examples of statements that create complex patterns patl any abc pat2 line begin remain pat3 abc xes pat4 patl 12 pat5 xes varl pat6 abc amp 123 You can assign a pattern to a variable and then use the variable as a parameter for the SEARCH or SEARCH_QUIETLY built in procedure SEARCH or SEARCH_QUIETLY looks for the character sequences specified by the pattern that you use as a parameter If SEARCH or SEARCH QUIETLY finds a match DEC Text Processing Utility Data Types 3 11 DEC Text Processing Utility Data Types 3 7 Pattern Data Type for the pattern the built in returns a range that contains the text that matches the pattern You can assign the range to a variable The following example uses strings and pattern operators to create a pattern that is stored in the variable my_pat The variable is then used with the SEARCH or SEARCH QUIETLY built in procedure in a forward direction If SEARCH or SEARCH QUIETLY finds a match for my pat the range of matching text is stored in the variable match range The POSITION built in procedure cau
198. ses the editing point to move to the beginning of match range my pat abc def Ws eus match range SEARCH my pat FORWARD POSITION match range 3 7 1 Using Pattern Built In Procedures and Keywords The following built in procedures return values of the pattern data type ANY e ARB MATCH e NOTANY e SCAN e SCANL e SPAN e SPANL See the DEC Text Processing Utility Reference Manual for a complete description of these pattern built in procedures 3 7 2 Using Keywords to Build Patterns You can use the following keywords as the first argument to the SEARCH or SEARCH QUIETLY built in procedures You can also use them to form patterns in expressions that use the pattern operators See the DEC Text Processing Utility Reference Manual for a complete description of these keywords e ANCHOR e BUFFER BEGIN e BUFFER END LINE BEGIN LINE END PAGE BREAK REMAIN e UNANCHOR 3 12 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 7 Pattern Data Type 3 7 3 Using Pattern Operators The following are the DECTPU pattern operators e Concatenation operator Link operator amp e Alternation operator e Partial pattern assignment operator The pattern operators are equal in DECTPU s precedence of operators For more information on the precedence of DECTPU operators see Chapter 4 Pattern operators associate from left to right Thus the following two DEC
199. t a command file define a symbol similar to the following EVE EDIT TPU NOCOMMAND Using NOCOMMAND when you do not want to use a command file decreases startup time by eliminating the search for a command file f you specify a command file that does not exist DECTPU terminates the editing session and returns you to the DCL command level For more information on writing and using command files see Chapter 5 2 6 3 CREATE CREATE default NOCREATE The CREATE qualifier controls whether a DECTPU based application creates a new file when the specified input file is not found If you do not specify CREATE or NOCREATE on the command line DECTPU sets the default to CREATE but does not specify a default name for the file to be created The application layered on DECTPU is responsible for handling this qualifier To determine if you specified CREATE on the DCL command line include the following call in the application x GET INFO COMMAND LINE create The preceding call returns 1 if CREATE was specified 0 otherwise For more information on GET INFO see the DEC Text Processing Utility Reference Manual Getting Started with DECTPU 2 11 Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers By default EVE creates a new file if the specified input file does not exist If you use NOCREATE and specify an input file that does not exist EVE aborts the editing session and returns you to the
200. t fills most of the screen The window consists of the following three areas e Source area Displays your code when it has been placed in the debugger source buffer e Output area Displays one line messages or one line results of an EXAMINE command e Debug command line Displays the Debug prompt When DECTPU displays the debug window you can set breakpoints in the section file by using the SET BREAKPOINT command For example if you want to debug a procedure called user fum type the following on the debugger command line Debug SET BREAKPOINT user fum 5 28 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 7 Debugging DECTPU Programs After setting breakpoints use the GO command to switch control of execution from the debugger to DECTPU After you have used this command the screen displays the code you specified 5 7 2 2 Debugging Command Files To invoke the debugger on a command file use the DEBUG COMMAND and NOSECTION qualifiers To debug a command file called MY COMMANDS TPU type the following at the DCL prompt EDIT TPU NOSECTION COMMAND MY COMMANDS TPU DEBUG DECTPU compiles and executes the debugger and places the debug window on the screen before compiling the command file As a result you must set breakpoints in the command file before it has been compiled When you set breakpoints DECTPU notifies you that you have specified breakpoints at nonexiste
201. t is provided as is without warranty of any kind and is subject to change without notice The warranties for Compaq products are set forth in the express limited warranty statements accompanying such products Nothing herein should be construed as constituting an additional warranty ZK 6018 The Compaq OpenVMS documentation set is available on CD ROM This document was prepared using DECdocument Version 3 3 1b Contents Preface oboe add Bea ce ad ERE ERE E A oan La Aen tls bien ix 1 Overview of the DEC Text Processing Utility 1 1 Description of DECTPU 0 0 ccc tes 1 1 1 1 1 DECT PU Features isc chad eee p x XMUE eG Ee Oe oe oe bee es 1 1 1 1 2 DECTPU and User Applications 0 0 0 0 ce eee eee 1 2 1 1 3 DECTPU Environments 0000 c cece ee 1 2 1 2 Description of DECwindows DECTPU 0 00 cece ee 1 2 1 2 1 DECwindows DECTPU and DECwindows Features 1 3 1 2 2 DECwindows DECTPU and the DE Cwindows User Interface Eang age 3 sci Ace aes Ae bc e Gok th DR e An qe hus qe LA d wut Bota 1 4 1 3 Description Of EVE i die stone Sake pated de we o wae ee RP 1 4 1 4 DECTPU E nguage a5 v wee ae rece wee ate EROR P e a se 1 5 1 4 1 Data Types ide AE E Re Ub EV IR ERE ER MR e 1 6 1 4 2 Language Dedarations lille ess 1 6 1 4 3 Language Statements lllllleell elles 1 6 1 4 4 Built In Procedures 0 0 00 nns 1 6 1 4 5 User Written Procedures 00000 ccc te
202. t user input from the keyboard For more information about the input focus see the Motif documentation DECwindows DECTPU automatically grabs the input focus whenever you cause an unmodified MIDOWN event that is an event not modified by Shift Ctrl or other modifying key while the pointer cursor is in either of the following locations e DECTPU main window widget e DECTPU s title bar DE Cwindows assigns input focus to DECTPU only if and when it is possible to do so To make sure that DECwindows can assign input focus your application should use the GET_INFO SCREEN input_focus built in procedure If assignment of input focus to DECTPU is enabled DECTPU can receive input focus in the following circumstances e DECwindows DECTPU grabs input focus The DECwindows session manager assigns input focus to DECTPU e An application layered on DECTPU requests input focus a Motif environment DECTPU supports both implicit and explicit focus policies Compaq recommends that you use only a DECwindows section file with DECwindows DECTPU All versions of EVE shipped with OpenVMS Version 5 1 or higher are compatible with DE Cwindows and are suitable for building DE Cwindows section files as well as DECTPU Version 3 0 or higher However if you do not follow this recommendation DE CTPU s automatic grabbing of the input focus enables your layered application to interact with other DECwindows applications DEC Text Processing Uti
203. the COMMAND qualifier to specify the file that contains your program 5 20 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files For example to add a program called MY CUSTOMIZATIONS TPU to the EVE section file you would enter the following EDIT TPU SECTION EVESSECTION COMMAND my_customizations tpu This command causes DECTPU to load the EVE section file and then read compile and execute the command file you specify A new section file is created The new file includes both the EVE section file and the binary form of your program The section file is written to the file you specified as the parameter to the SAVE statement in your program To use the section file invoke DECTPU specifying your section file For more information on invoking DECTPU see Chapter 2 For more information on extending the EVE section file see the Extensible Versatile Editor Reference Manual 5 6 5 3 Sample Section File If you choose to design an application layered on DECTPU and not layered on EVE you must provide certain basic structures and key definitions to be able to use the DECTPU compiler and interpreter Example 5 5 is a sample of the source code that creates a minimal interface It provides the following basic structures A buffer and a window for DECTPU messages e A buffer and a window for information from the SHOW built in procedure e A buffer and a window in whic
204. the semicolon is not necessary Example 1 1 is a sample procedure that uses the DECTPU language statements PROCEDURE ENDPROCE DURE and the built in procedures POSITION BEGINNING OF and CURRENT BUFFER to move the current character position to the beginning of the current buffer The procedure uses the MESSAGE built in to display a message it uses the GET INFO built in to get the name of the current buffer Example 1 1 Sample User Written Procedure This procedure moves the editing position to the top of the buffer PROCEDURE user top POSITION BEGINNING OF CURRENT BUFFER MESSAGE Now in buffer GET INFO CURRENT BUFFER name ENDPROCEDURE Once you have compiled this procedure you can invoke it with the name user top For information about writing procedures see Chapter 4 and Chapter 5 1 5 Terminals Supported by DECTPU DECTPU runs on all VAX and Alpha computers and supports screen oriented editing on the Compaq VT 400 VT300 VT200 and VT100 series terminals as well as on other video display terminals that respond to ANSI control functions Optimum screen oriented editing performance occurs when you run DECTPU from VT 400 series VT300 series VT220 series and VT 100 series terminals Some video terminal hardware does not have optimum DECTPU performance See Appendix B for a list of hardware characteristics that may adversely affect DECTPUS performance Although you cannot use the screen oriented feature
205. the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words TPU K_HELP_MODIFIED e TPU K_MESSAGE_FACILITY e TPU K_MESSAGE_ID e TPU K MESSAGE SEVERITY e TPUS K MESSAGE TEXT e TPU K SEARCH CASE e TPU K SEARCH DIACRITICAL e TPU K SHIFT MODIFIED e TPUS K UNSPECIFIED TRUE 4 9 4 Declarations and Statements A DECTPU program can consist of a sequence of declarations and statements These dedarations and statements control the action performed in a procedure or a program The following reserved words are the language elements that when combined properly make up the dedarations and statements of DECTPU e Module declaration MODULE IDENT ENDMODULE e Procedure declaration PROCEDURE ENDPROCEDURE e Repetitive statement LOOP EXITIF ENDLOOP e Conditional statement IF THEN ELSE ENDIF e Case statement CASE FROM TO INRANGE OUTRANGE Lexical Elements of the DEC Text Processing Utility Language 4 13 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words ENDCASE e Error statement ON ERROR ENDON ERROR e RETURN statement e ABORT statement Miscellaneous declarations EQUIVALENCE LOCAL CONSTANT VARIABLE GLOBAL UNIVERSAL BEGIN and END are words reserved for future expansion of the DECTPU language The DECTPU declarations and statem
206. the DECTPU procedure called DEBUGON To invoke this procedure from within EVE type the following at the EVE Command prompt Command TPU DEBUGON When you use either DEBUG or DEBUGON the screen displays the debugger window and command line After setting breakpoints use the GO command to return control of execution to DECTPU DEC Text Processing Utility Program Development 5 29 DEC Text Processing Utility Program Development 5 7 Debugging DECTPU Programs To compile all code in the buffer use the EXTEND ALL command or use the COMPILE CURRENT BUFFER statement To execute a procedure after compilation use the TPU command For example if you want to execute the compiled procedure user fum type the following at the EVE Command prompt Command TPU user fum When DECTPU encounters a breakpoint or when you use the STEP command described later DECTPU invokes the debugger program As the debugger assumes control it receives from DECTPU the name of the procedure whose execution has been suspended The debugger searches its source buffer for that procedure When DECTPU encounters the first breakpoint in the session the code you are debugging has not yet been placed in the debugger s source buffer The debugger prompts for the name of the file that contains your code Using your response the debugger places your code in its source buffer The debugger uses your previous response to supply missing fields if any in subsequent file names
207. the EVE BUILD module to layer applications on top of EVE 5 1 3 Program Syntax The rules for writing DECTPU programs are simple You must use a semicolon to separate each executable statement from other statements n a program you must place all procedure declarations before any executable statements that are not part of a procedure declaration For information on DECTPU data types see Chapter 3 For information on DECTPU language elements see Chapter 4 Example 5 2 shows the correct syntax for a DECTPU program Example 5 2 Syntax of a DECTPU Program PROCEDURE ENDPROCEDURE PROCEDURE ENDPROCEDURE PROCEDURE ENDPROCEDURE statement 1 statement 2 statement n A variety of syntactically correct DECTPU programs is shown in Example 5 3 DEC Text Processing Utility Program Development 5 3 DEC Text Processing Utility Program Development 5 1 Creating DECTPU Programs Example 5 3 Sample DECTPU Programs Program 1 This program consists of a single DECTPU built in procedure SHOW KEYWORDS Program 2 This program consists of an assignment statement that gives a value to the variable video_attribute video_attribute UNDERLINE Program 3 This program consists of the DECTPU LOOP statement with a condition for exiting and the DECTPU built in procedure ERASE LINE X 0 LOOP x x 1 EXITIF x gt 100 ERASE LINE ENDLOOP Program 4 This program consists of a single procedure that ma
208. the created range If SEARCH or SEARCH QUIETLY is given the search text abcdefg and the following pattern it returns a range that contains the text abcdefg 3 14 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 7 Pattern Data Type patl abc arb 2 8 varl remain SEARCH or SEARCH QUIETLY also assigns to var1 a range that contains the text de If you assign to a variable a partial pattern that matches a position rather than a character the partial pattern variable is a range that contains the character or line end at the point in the file where the partial pattern was matched For example in any of the following patterns that contain partial pattern assignments the variable partial pattern variable contains the character or line end at the point in the file where the partial pattern was matched e Dpartial pattern variable e ANCHOR QPpartial pattern variable e UNANCHOR Qfartial pattern variable LINE BEGIN Qnpartial pattern variable e BUFFER BEGIN Qfpartial pattern variable f you use one of the preceding patterns when the cursor is free that is in an area that does not contain text such as the area after the end of a line the variable partial pattern variable contains the line end or character nearest to the cursor SEARCH or SEARCH QUIETLY does partial pattern assignment only if the complete pattern matches If the complete pattern matches it makes assignments only to those v
209. ther DECTPU compiles and executes a command file a file of DECTPU procedures and statements at startup time Command files extend or modify a DECTPU based application or create a new application The default file type for DECTPU command files is TPU You cannot use wildcards in the file specification 2 10 Getting Started with DECTPU Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers By default DECTPU tries to read a command file called TPUS COMMAND TPU in your default directory You can use a full file specification after the COMMAND qualifier or define the logical name TPU COMMAND to point to a command file other than the default To determine whether you specified COMMAND on the DCL command line use the following call in the application X GET INFO COMMAND LINE command The preceding call returns 1 if COMMAND was specified 0 otherwise To fetch the name of the command file specified on the command line use the following call x GET INFO COMMAND LINE command file For more information on GET INFO see the DEC Text Processing Utility Reference M anual The following command causes DECTPU to read a command file named SYS LOGIN MY TPUS COMMAND TPU and uses LETTER RNO as the input file for an editing session EDIT TPU COMMAND sys login my tpu command tpu letter rno To prevent DECTPU from processing a command file use the NOCOMMAND qualifier If you usually invoke DECTPU withou
210. this procedure in the section file debug file or command file If a layered application makes use of an initialization file it is the responsibility of the application to define when the initialization file is processed EVE processes initialization files during the TPUSINIT POSTPROCEDURE phase 5 18 DEC Text Processing Utility Program Development DEC Text Processing Utility Program Development 5 6 Using DECTPU Startup Files 5 6 5 Using Section Files A section file is the binary form of a program that implements a DE CTPU based editor or application It is a collection of compiled DECTPU procedure definitions variable definitions and key bindings The advantage of using a binary file is that the source code does not have to be compiled each time you invoke the editor or application so startup performance is improved 5 6 5 1 Creating and Processing a New Section File To create a section file begin by writing a program in the DECTPU language The program must adhere to all the programming conventions discussed throughout this manual For examples of programs used to create a section file see the files in the directory SY S SEXAMPLES This directory contains the sources used to create the EVE section file To see a list of the EVE source files type the following DIR SYSSEXAMPLES EVES TPU f you cannot find these files on your system see your system manager When writing the DECTPU program that implements your application pla
211. tialization File Affects Buffer Settings Debugging DECTPU Programs sse es Using Your Own Debugger lseeeeee een Using the DECTPU Debugger 000 cece ens Debugging Section Files llle Debugging Command Files 000s cece eee Debugging Other DECTPU Source Code 00000 eae Getting Started with the DECTPU Debugger Handling Ettors sei SG ig eS eae PS See ee eee eG TEET OOOO oq ONN anna a Ig d E Eg d PF PE d POL gd PP d looo oQ gt gt I Co Co Q O KO KO CO OO O0 OO O O1 4 C QO C O XO O0 OO O O O1 O1 O1 3 A A CO C C C O QO O CO O CO xo Ge d bo d o d dun lio a lo o Glin d c d lal ae do Genta acne d dl s a e Gate as As Ul As ds soris nhac ls Mos Mec M ar Mods edo Mele e Mord ehe cap aba cli ce rs da dde We L A Sample DECTPU Procedures LineMode Editor Translation of Control Characters Restoring Terminal Width Before Exiting Running DECTPU from an OpenVMS Su B DECTPU Terminal Support B 1 B 1 1 B 1 2 B 2 B 3 from DECTPU bprocesS 0c eee eee Using Screen Oriented Editing on Supported Terminals Terminal Settings on OpenVMS Systems That Affect DECTPU SET TERMINAL Command Using Line Mode Editing on Unsupported Terminals Using Terminal Wrap C DECTPU Debugger Commands
212. ting or ending the module init code MESSAGE X bat MESSAGE X ENDMODULE End module mmm PROCEDURE bar Declare procedure bar LOCAL X X is local to procedure bar X In procedure bar which is outside all modules ESSAGE X ENDPROCEDURE End procedure bar LOCAL Xi X is local to the unbound code X Starting or ending the unbound non init code ESSAGE X mmm module init bat bar ESSAGE X EXIT Lexical Elements of the DEC Text Processing Utility Language 4 31 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words If this code is included in TEMP TPU the following command demonstrates the scope of the various local variables EDIT TPU NOSECTION NOINITIALIZE NODISPLAY COMMAND temp tpu Starting or ending the unbound non init code Starting or ending the module init code Within procedure bat within module mmm Starting or ending the module init code Within procedure bat within module mmm In procedure bar which is outside all modules Starting or ending the unbound non init code 4 9 5 3 CONSTANT With the CONSTANT declaration you can associate a name with certain constant expressions The constant expression must evaluate at compile time to a keyword a string an integer or an unspecified constant value The maximum length of a string constant allowed in a constant declaration is about 4000 characters in length DECTPU sets up some predefined global c
213. tion of an output file for that buffer 2 6 11 READ ONLY READ ONLY NOREAD ONLY default The READ ONLY qualifier determines whether the application layered on DECTPU creates an output file from the contents of the main buffer if the contents are modified The processing of the READ ONLY qualifier is interrelated with the processing of the WRITE qualifier READ ONLY is equivalent to NOWRITE NOREAD ONLY is equivalent to WRITE DECTPU signals an error and returns control to DCL if DECTPU encounters either of the following combinations of qualifiers on the DCL command line e READ ONLY and WRITE e NOREAD ONLY and NO WRITE The application layered on DECTPU is responsible for processing this qualifier To determine whether either the READ ONLY or NOWRITE qualifier was used on the DCL command line use the following call in an application X GET INFO COMMAND LINE read only This statement returns 1 if READ ONLY or NOWRITE was explicitly specified on the command line To determine whether either NOREAD ONLY or WRITE was used on the DCL command line use the following call in an application X GET INFO COMMAND LINE write This statement returns 1 if NOREAD ONLY or WRITE was explicitly specified on the command line If both GET INFO calls return false the application is expected to determine the default behavior For more information on GET INFO see the DEC Text Processing Utility Reference
214. titive statement LOOP EXITIF ENDLOOP e Conditional statement IF THEN ELSE ENDIF e Case statement CASE ENDCASE e Error statement ON ERROR ENDON ERROR See Chapter 4 of this manual for a discussion of DECTPU language statements 1 4 4 Built In Procedures The DECTPU language has many built in procedures that perform functions such as screen management key definition text manipulation and program execution You can use built in procedures to create your own procedures You can also invoke built in procedures from within EVE The DEC Text Processing Utility Reference Manual contains a description of each of the DECTPU built in procedures 1 6 Overview of the DEC Text Processing Utility Overview of the DEC Text Processing Utility 1 4 DECTPU Language 1 4 5 User Written Procedures You can write your own procedures that combine DECTPU language statements and calls to DECTPU built in procedures DECTPU procedures can return values and can be recursive After you write a procedure and compile it you use the procedure name to invoke it When writing a procedure use the following guidelines e Start each procedure with the word PROCEDURE followed by the procedure name of your choice e End each procedure with the word ENDPROCEDURE e Place a semicolon after each statement or built in call if the statement or call is followed by another statement or call f the statement or call is not followed by another statement or call
215. to caller if string not found ON ERROR msg text FAO Completed UL replacement S replacement count MESSAGE msg text RETURN ENDON ERROR replacement count 0 LOOP src range SEARCH str or pat FORWARD Search returns a range if found ERASE src range Remove first string POSITION END OF src range Move to right place COPY TEXT str2 Replace with second string replacement count replacement count 1 ENDLOOP ENDPROCEDURE global search replace Executable statements input file GET INFO COMMAND LINE file name main buffer CREATE BUFFER main input file POSITION BEGINNING OF main buffer global search replace xyz user patl amp LINE BEGIN amp t POSITION BEGINNING OF main buffer global search replace patl T WRITE FILE main buffer newfile dat QUIT To use the DCL command procedure INVISIBLE TPU COM interactively invoke it with the DCL command at sign For example to use INVISIBLE TPU COM interactively on a file called MY FILE TXT type the following at the DCL prompt invisible tpu my file txt You must explicitly write out any modified buffers before leaving the editor with QUIT or EXIT If you use QUIT before writing out such buffers DECTPU quits without saving the modifications If you use EXIT DECTPU asks if it should write the file before exiting Getting Started with DECTPU 2 5 Getting Started with D
216. tor alone in an error handler as a shortcut For example the following two error handlers have the same effect This error handler uses OTHERWISE alone as a shortcut ON ERROR OTHERWISE ENDON ERROR This error handler has the same effect as using OTHERWISE alone ON ERROR OTHERWISE LEARN ABORT RETURN FALSE ENDON ERROR Example 4 11 from the EVE editor shows a procedure with a case style error handler Lexical Elements of the DEC Text Processing Utility Language 4 25 Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words Example 4 11 Procedure with a Case Style Error Handler PROCEDURE eveSlearn_abort ON_ERROR TPUS CONTROLC ESSAGE ERROR TEXT RETURN LEARN ABORT DON ERROR IF LEARN ABORT THE ns eve message EVES LEARNABORT RETURN TRUE ELSE RETURN FALSE ENDIF ENDPROCEDURE If a program or procedure has a case style error handler DECTPU handles errors and warnings as follows e f you press Ctrl C DECTPU determines whether the error handler contains a selector labeled TPU CONTROLC If so DECTPU sets ERROR to TPU _ CONTROLC ERROR LINE to the line that DECTPU was executing when Ctrl C was pressed and ERROR TEXT tothe message associated with TPU _ CONTROLC DECTPU then executes the statements associated with the selector If there is no TPU CONTROLC selector DECTPU exits from the error handler and looks fo
217. tring format DECTPU handles information in other formats by describing the information in an array For more information about this array see the descriptions of the GET_GLOBAL_SELECT and WRITE_GLOBAL_SELECT built in procedures in the DEC Text Processing Utility Reference Manual Global selections are identified in DECTPU either as strings or keywords While DECwindows provides for many global selections applications conforming to the Motif Style Guide are concerned with only two selections the primary and secondary selections DECTPU provides a pair of keywords PRIMARY and SECONDARY to refer to these selections DECTPU also provides built in procedures that enable layered applications to manipulate global selection information You can refer to other global selections by specifying a string instead of the keywords PRIMARY and SECONDARY For example if your application has a global selection whose name is auxiliary usethe string auxiliary to specify the selection Selection names are case sensitive the string auxiliary does not refer to the same global selection as the string AUXILIARY 5 2 3 3 Relation of Global Selection to Input Focus An application that conforms to the Motif Style Guide requests ownership of the primary global selection in its input focus grab procedure Regardless of whether the application conforms when DECTPU gets the input focus it automatically grabs the primary global selection if it is not already the
218. ts are allowed The following example assigns a value of the integer data type to the variable x x 12345 3 4 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 3 Integer Data Type DECTPU also supports binary octal and hexadecimal integers Binary integers are preceded by b or B octal by o or O and hexadecimal by x or 96X Thus all the following statements are acceptable x x KM B10000 020 X130 12345 3 4 Keyword Data Type Keywords are reserved words in DECTPU that have special meaning to the compiler To see a list of all DECTPU keywords use the SHOW KEYWORDS built in You use keywords in the following ways As parameters for DECTPU built in procedures For example the first parameter of the SET built in procedure is always a keyword for instance PAD SCROLLING STATUS LINE As values returned by DECTPU built in procedures such as CURRENT DIRECTION KEY NAME LAST KEY READ KEY and GET INFO For example the call GET INFO window status video has the following keywords as possible return values BLINK BOLD NONE REVERSE SPECIAL GRAPHICS UNDERLINE As pattern directives The following keywords fall into this category ANCHOR BUFFER BEGIN BUFFER END LINE BEGIN LINE END PAGE BREAK REMAIN UNANCHOR These keywords which behave like built in procedures are described in the DEC Text
219. ts only at the time you create the array The following statement creates the array int array directs DECTPU to allocate 10 sequential integer indexed elements to the array and specifies that the lowest index value should be 1 int array CREATE ARRAY 10 1 Regardless of whether you specify a preallocated block of elements you can always add array elements dynamically Dynamically added elements can be of any data type except learn pattern program or unspecified You can mix the data types of indexes in an array In the following code fragment the array mix array is created and the integer 1 is stored in the array element indexed by the marker mark1 mix array CREATE ARRAY markl MARK NONE mix array markl l mix_array Kansas Toto You can index dynamic elements with integers even if this means that the array ends up with more integer indexed elements than you specified when you created the array DECTPU does not process dynamically added integer indexed elements as quickly as it processes preallocated elements To refer to an array element use the name of an existing array variable followed by the array index enclosed in braces 3 or parentheses For example if you create an array and store it in the variable my array the following are valid element names my array 2 my array fred To create an element dynamically for an existing array use the new element as the target
220. tted 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 elements You can choose one none or all of the options Brackets are not optional however in the syntax of a directory name in an OpenVMS file specification or in the syntax of a substring specification in an assignment statement In command format descriptions vertical bars separating items inside brackets indicate that you choose one none or more than one of the options In command format descriptions braces indicate required elements you must choose one of the options listed bold text italic text UPPERCASE TEXT Monospace text numbers This text style represents the introduction of a new term or the name of an argument an attribute or a reason 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 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 th
221. uage has an extensive set of data types You use data types to interpret the meaning of the contents of a variable Unlike many languages the DECTPU language has no declarative statement to enforce which data type must be assigned to a variable A variable in DECTPU assumes a data type when it is used in an assignment statement For example the following statement assigns a string data type to the variable this var this var This can be a string of your choice The following statement assigns a window data type to the variable x The window occupies 15 lines on the screen starting at line 1 and the status line is off not displayed X CREATE WINDOW 1 15 OFF Many of the DECTPU data types for example learn and pattern are different from the data types usually found in programming languages See the DEC Text Processing Reference Manual for the keywords used to specify data types See Chapter 3 of this manual for a discussion of DECTPU data types 1 4 2 Language Declarations DECTPU language dedarations indude the following e Module declaration MODULE IDENT ENDMODULE e Procedure declaration PROCEDURE ENDPROCEDURE e Constant declaration CONSTANT e Global variable declaration VARIABLE Local variable declaration LOCAL See Chapter 4 of this manual for a discussion of DECTPU language declarations 1 4 3 Language Statements DECTPU language statements include the following e Assignment statement e Repe
222. umstances 4 26 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 9 Reserved Words If the error or warning is trapped by a selector other than OTHERWISE DECTPU does not place the error or warning message in the message buffer unless the error handler code instructs it to do so In this case after setting ERROR ERROR LINE and ERROR TEXT DECTPU executes the code associated with the selector If the code does not return to the calling procedure or program DECTPU checks whether one of the selectors associated with the code just executed is TPU CONTROLC or OTHERWISE If so DECTPU performs the equivalent of the following sequence special error symbol 0 LEARN ABORT RETURN FALSE If not the error handler terminates and DECTPU resumes execution at the next statement after the statement that generated the error or warning For more information on the special error symbol in DECTPU see the description of the SET SPECIAL ERROR SYMBOL built in procedure in the DEC Text Processing Utility Reference M anual If the error or warning is trapped by the OTHERWISE selector DECTPU writes the associated error or warning message in the message buffer Next DECTPU executes the code associated with the OTHERWISE selector If the code does not return to the calling procedure or program DECTPU performs the equivalent of the following sequence Special error symbol
223. ure that creates a new window The following example assigns a value of the window data type to the variable x X CREATE WINDOW 1 12 OFF The first parameter specifies that the window starts at screen line number 1 The second parameter specifies that the window is 12 lines in length The OFF keyword specifies that a status line is not to be displayed when the window is mapped to the screen 3 22 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 14 Window Data Type 3 14 1 Defining Window Dimensions Windows are defined in lines and columns In EVE all windows extend the full width of the screen or terminal emulator In DECTPU you can set the window width to be narrower than the width of the screen or terminal emulator The allowable di mensions of a window often depend on whether the window has a status line a horizontal scroll bar or both A status line occupies the last line of a window By default a status line contains information about the buffer and the file associated with the window You can turn a status line on or off with the SET STATUS LINE built in procedure A horizontal scroll bar is a one line widget at the bottom of a window that you can use to shift the window to the right or left controlling what text in the buffer can be seen through the window You can turn a horizontal scroll bar on or off with the SET SCROLL BAR built in procedure Lines on the screen are counted fro
224. windows Motif for OpenVMS user interface The variant of DECTPU that supports window oriented user interfaces is known as DE Cwindows DECTPU The windows referred to as DECwindows are not the same as DECTPU windows For more information about the difference between DECwindows and DECTPU windows see Chapter 5 Because DECTPU is a language not an application DECTPU does not havea window oriented interface However DECTPU does provide built in procedures to interact with the DE Cwindows Motif environment For information on invoking DECTPU on systems running DECwindows Motif see Chapter 2 1 2 Overview of the DEC Text Processing Utility Overview of the DEC Text Processing Utility 1 2 Description of DECwindows DECTPU 1 2 1 DECwindows DECTPU and DECwindows Features The DE Cwindows environment has a number of toolkits and libraries that contain routines for creating and manipulating DE Cwindows interfaces DE Cwindows DECTPU contains a number of built in procedures that provide access to the routines in the DE Cwindows libraries and toolkits With these procedures you can create and manipulate various features of a DE Cwindows interface from within a DECTPU program In most cases you can use DECTPU DECwindows built in procedures without knowing what DE Cwindows routine a given built in procedure calls For a list of the kinds of widgets you can create and manipulate with DECTPU built in procedures see Chapter 5 You cannot directly ca
225. ws are still marked mapped when the window that is covering them is unmapped they may reappear on the screen without being explicitly remapped e If the newly mapped window divides a window into two parts only the top part of the segmented window continues to be updated The lower part of the segmented window is erased at the next window update e The visible top visible bottom and visible length values of a window that is ocduded change from their original values When a newly mapped window becomes the current window the MAP POSITION and ADJUST WINDOW built in procedures cause this to happen the cursor is placed in the current window In addition to the active cursor position in the current window there is a marker that designates a cursor position in all other windows The cursor position in a window other than the current window is the last location of the cursor when it was in the window By maintaining a cursor position in all windows DECTPU lets you edit in multiple locations of a single buffer if that buffer is associated with more than one window 3 24 DEC Text Processing Utility Data Types DEC Text Processing Utility Data Types 3 14 Window Data Type For more information on the cursor position in a window and the POSITION built in procedure see the DEC Text Processing Utility Reference Manual 3 14 5 Removing Windows To remove a window from the screen you can use either the UNMAP built in procedure or the DELETE bui
226. xample the following command causes EVE to turn off buffer change journaling when you edit the input file MEMO TXT 2 14 Getting Started with DECTPU Getting Started with DECTPU 2 6 Using OpenVMS EDIT TPU Command Qualifiers EDIT TPU NOJOURNAL memo txt If you are developing an application layered on DECTPU you can use the built in J OURNAL_OPEN to direct DECTPU to create a keystroke journal file for an editing session Using J OURNAL OPEN causes DECTPU to provide a 500 byte buffer in which to journal keystrokes By default DECTPU writes the contents of the buffer to the journal file when the buffer is full You can use the built in procedure SET J OURNALING to turn on buffer change journaling even if you have used NOJ OURNAL to turn it off initially You can also use SET J OURNALING to adjust the journaling frequency For more information on JOURNAL OPEN and SET J OURNALING see the DEC Text Processing Utility Reference Manual For more information on buffer change journaling see Section 2 4 Once a keystroke journal file is created use the RECOVER qualifier to direct DECTPU to process the commands in the keystroke journal file For example the following command causes DECTPU to recover a previous editing session on an input file named MEMO TXT Because the journal file has a name different from the input file name both OURNAL and RECOVER are used The name of the keystroke journal fileis MEMO TJL EDIT TPU RECOVER
227. xt page 4 6 Lexical Elements of the DEC Text Processing Utility Language Lexical Elements of the DEC Text Processing Utility Language 4 6 Constants Example 4 2 Cont Global and Local Constant Declarations PROCEDURE user_hello_world CONSTANT world world MESSAGE user hello world Display Hello world in message area ENDPROCEDURE 4 7 Operators DECTPU uses symbols and characters as language operators There are five types of operators e Arithmetic String e Relational e Pattern Logical Table 4 5 lists the symbols and language elements that DECTPU uses as operators Table 4 5 DECTPU Operators Type Symbol Description Arithmetic Addition unary plus Subtraction unary minus Multiplication Division String String concatenation String reduction String replication Relational Not equal to Equal to lt Less than lt Less than or equal to gt Greater than gt Greater than or equal to Pattern Pattern alternation Partial pattern assignment continued on next page Lexical Elements of the DEC Text Processing Utility Language 4 7 Lexical Elements of the DEC Text Processing Utility Language 4 7 Operators Table 4 5 Cont DECTPU Operators Type Symbol Description Pattern concatenation amp Pattern linkage Logical AND Boolean AND NOT Boolean NOT OR Boolean OR XOR Boolean exclusive OR You can use the operator to concat
Download Pdf Manuals
Related Search
Related Contents
Bosch 2609255442 One For All SV6620 flat panel wall mount Manual 2.1 - Theimer und Mager Veranstaltungstechnik User's Guide Fujitsu ESPRIMO P400 Copyright © All rights reserved.
Failed to retrieve file