HP OpenVMS Systems Documentation

Content starts here

Guide to the DEC Text Processing Utility


Previous Contents Index

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);

To give a variable the data type unspecified, assign the predefined constant TPU$K_UNSPECIFIED to the variable:


prog := TPU$K_UNSPECIFIED;

3.13 Widget Data Type

The DECwindows 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 (=) or the not-equal operator (<>) 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 DECwindows 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 in a 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 procedure 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.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 dimensions 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 from 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 include a status line or horizontal scroll bar, two lines if you include 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 use a 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.

The 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 DECTPU's 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:

  • Original_top---Screen line number of the top of the window when it was created.
  • 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 ADJUST_WINDOW may change these values.

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 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:

  • 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.
  • 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 occlude 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 windows are still marked mapped; when the window that is covering them is unmapped, they may reappear on the screen without being explicitly remapped.
  • 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.
  • The visible_top, visible_bottom, and visible_length values of a window that is occluded 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.

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 built-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 DECTPU's list of windows. It is then no longer available for future mapping to the screen.

Unmapping or deleting a window has the following effects:

  • The unmapped window is marked as not visible and not mapped.
  • Another window becomes the current window and the cursor is moved to the last cursor position in that window.
  • If 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 occluded 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 pressed 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 Manual.

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.

3.14.8 Terminals 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 SYS$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 /NODISPLAY qualifier.


Chapter 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 ISO_LATIN1 Character Set.

This chapter describes the following DECTPU lexical elements:

  • Character set
  • Identifiers
  • Variables
  • Constants
  • Operators
  • Expressions
  • Reserved words
  • Lexical 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:

"XYZ"
"xyz"

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)
  • ISO_LATIN1 (for the ISO Latin1 Character Set)
  • GENERAL (for other general character sets)
  • TPU$CHARACTER_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, carriage return, and bell
32 Space
33--64 Special characters such as the ampersand (&), 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.1 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 Ñ and ñ
255 Reserved

For a complete list of characters in the DEC Multinational Character Set, see the OpenVMS documentation.

4.3.2 ISO Latin1 Character Set (ISO_LATIN1)

The ISO Latin1 Character Set characters from 128 to 255 are extended control characters and Latin1 supplemental multinational characters. 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 Latin1 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:

  • 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));
    
  • 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.
      2. Press the ESCAPE key (on VT100-series terminals) or Ctrl/[.

      For example:


      Ctrl/V ESC
      
    • EVE's EDT-like 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.)
      3. Press the GOLD key again.
      4. Press the SPECINS key on the EDT keypad.

      For example:


      GOLD 27 GOLD Specins
      

4.3.5 DECTPU Symbols

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 ' 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
Exclamation point ! Begins comment
Dollar sign $ Indicates a variable, constant, keyword, or procedure name that is reserved to Compaq
Right brace } Closes array element index expression
Equal sign = Relational operator
Greater than sign > Relational operator
Greater than or equal to sign >= Relational operator
Slash / Integer division operator
Asterisk * Integer multiplication operator
Left bracket [ Begins case label
Less than sign < Relational operator
Less than or equal to sign <= Relational operator
Minus sign -- Subtraction operator
Not equal sign <> Relational operator
Vertical bar | Pattern alternation operator
Open parenthesis ( Begins parameter list, expression, argument list, or array element index
Ampersand & Pattern linkage operator
Plus sign + String concatenation operator, pattern concatenation operator, integer addition operator
Quotation mark " Delimits string
Right bracket ] Ends case label
Semicolon ; Separates language statements
Underscore _ Separates words in identifiers


Previous Next Contents Index