SCR.FORMAT
screen partitions. Inputs: *none*
OutpuUss *none*
MS.CLBAR
Function: Clears the logical Main Screen {ie. Screen 1) Inputs: *none*
Outputs: *none*
HS_CUR_ON (MS_CUR_POS: INTEGER; MS_TOP_LINE: INTEGER)
Function: Turns on the cursor (Cursor 1) in the Main Screen by reverse videoing the line number.
Inputs: MS_CUR_POS — The Main Screen CURsor position is an integer value from 0 to 19 which specifies (from the top of the screen) the row of the Main Screen on which Cursor 1 is to lie.
MS_TOP_LINB — The Main Screen TOP LINE is an integer value specifying the actual line number of the line displayed on the top line of the Main Screen. Using the two above inputs, the actual line number of Cursor 1 can easily be calculated as (MS_TOP_IiINB + HS_CUR_POS) .
Outputs: *none*
MS„CUR_OFF (MS_CUR_POSi INTEGER; MS_TOP_LINEi INTEGER)
Function: Turns off the cursor (Cursor 1) in the Main Screen by rewriting the actual line number in normal font. Inputs: *as above*
Outputs: *none*
MS_WRITE ( LINE_NUMBER: INTEGER; MS_LINE_POS: INTEGER? VAR STRING_ONE: STRING (81) OF CHAR; VAR STRING,TWO: STRING (81) OF CHAR, VAR STRING_THREE: STRING (81) OF CHAR) Function: Will write out a line of text (represented by the three
strings) at a specified row in Screen 1. A long text line will be truncated to fit on a single physical screen line, so that no overwrapping is allowed. Inputs: LINB„NUMBER — - An integer variable giving the actual
line number to be displayed.
MS_LINE_POS — An integer variable (0 to 19) specifying the row number where the line is to be displayed in Screen 1, STRING_ONE — A text string which represents the
Page 18
first part of the line to be written. This string is displayed in highlighted font. (It is normally reserved for the first key word.)
STRING,TWO -- A text string which represents the second part of the line to be written. This string is displayed in normal font. (It is normally reserved for the user-entered text.)
STRING_THREB — A text string which represents the third part of the line to be written. This string is displayed in highlighted font. (It is normally reserved for the second key word.)
Outputs: *none*
Function: Clears the logical Window Screen (ie. Screen 2). Inputs: *none*
Output:^ *none*
WS_ASET_CP (COL: INTEGER)
Function: Sets the cursor position to the absolute column specified in the Window Screen.
Inputs: COL — An integer variable (1 to 80) used to specify the column which the cursor is to be moved to. If the number specified is beyond the given range, the cursor will wrap around the screen. Outputs: *none*
WS_RV_WRITB ( START,COL: INTEGER;
VAR TBXT_STRING: STRING (80) OF CHAR) Function: Writes the text string in reverse video font in the
Window Screen starting at the specified starting column. This function is used mainly for highlighting fields in the Data Definition Insert mode.
Inputs: START,COL — An integer parameter used to specify the position in the Window Screen from which the text must be written.
TEXT,STRING — The text string which must be written Outputs: *none*
WS„HI_WRITE ( START,COL: INTEGER;
VAR TEXT-STRING: STRING (80) OF CHAR) Function: Writes the text string in highlighted font in the
Window Screen starting at the specified starting column. This function is used mainly for highlighting fields in the Data Definition Insert mode.
Page 18 Outputs: flPSlSiSZS. Function: Inputs: Outputs: Function: Inputs: Outputs: Function: Inputs: Outputs: Function:
first part of the line to be written. This string is displayed in highlighted font. (It is normally reserved for the first key word,)
STRim_TNO — A text string which represents the second part of the line to be written. This string is displayed in normal font. (It is normally reserved for the user-entered text.)
STRING_THREE — A text string which represents the third part of the line to be written. This string is displayed in highlighted font. (It is normally reserved for the second key word.)
WS_CLBAR
Clears the logical Window Screen (ie. Screen 2). *none*
WS_ASET_CP (COL: INTEGER)
Sets the cursor position to the absolute column specified in the Window Screen.
COL — An integer variable (1 to 80) used to specify the column which the cursor is to be moved to. If the number specified is beyond the given range, the cursor will wrap around the screen. *none*
_RV_WRITB ( £TART_COL: INTEGER;
VAR TEXT_STRING: STRING (80) OF CHAR) Writes the text string in reverse video font in the Window Screen starting at the specified starting column. This function is used mainly for highlighting fields in the Data Definition Insert mode.
START.COL — An integer parameter used to specify the position in the Window Screen from which the text must be written.
TEXT.STRING — The text string which must be written *none*
LHI-WRITE ( START.COL: INTEGER;
VAR TEXT.STRING: STRING (80) OF CHAR) Writes the text string in highlighted font in the Window Screen starting at the specified starting column. This function is used mainly for highlighting fields in the Data Definition Insert mode.
Page 19
Inputs: *same as above* Outputs: *none*
WS_LO_WRITE ( START COL: INTEGER;
VAR TEXT^STRING: STRING (80) OP CHAR) Function: Writes the text string in normal font in the Window
Screen starting at the specified starting column. This function is used mainly for distinguishing fields in the Data Definition Insert mode.
Inputs: *same as above* Outputs: *none*
Function: Clears the logical Prompt Screen (ie. Screen 3). Inputs: *none*
Outputs: *none*
PS_WRITE (MESSAGE: STRING (81) OF CHAR)
Function: Writes a message to the Prompt Screen in highlighted Inputs: MESSAGE — The message which is to be written ir the
prompt Screen. Outputs: *none*
FS_CLEAR
Function: Clears the logical Function or Key Definition Screen (Screen 4),
Inputs: *none* Outputs: *nnne*
FS_WRITE (KEY_STRING: STRING (61) OF CHAR; FLAG_ARRAY: ARRAY [I..10] OF BOOLEAN) Function: Writes out the 10 function key options in the Function
Screen. Only the function keys which correspond to a TRUE flag value (ie. a valid function key) will be displayed as dictated by the key string. Valid function key options will be written in reverse video font at the field position in Screen 4 corresponding to their number.
Inputs: KEY_STRING — This is the text line containing the 10 function key definitions which are to be selectively displayed in Screen 4. FLAG_ARRAY — The boolean array indicating the valid
Page 20
function keys which will be highlighted in reverse video in Screen 4. There are 10 flags available; one for each function key. A true flag will indicate a valid function key.
3.1.3 Resource structure
The Terminal Resource is not a memory-based resource as no common data structure is needed. Each operator is built as a procedure, and is essentially independent of external data structures. For IBM-PC implementation, a common terminal display function (DOSXQQ) is made generally available for use by the screen management primitive operators. Gluba. constants include the following;
ROWS_PER_PAGE = 25 — The number of lines in the physical screen MS_SI%E = 20 — The number of lines in the Main Screen WINDOW_ROW = 22 — The Window Screen row number PROMPT-ROW - 24 — The Prompt Screen row number FUNCTION_ROW = 25 — The Function Screen row number MESSAGE.COLUMN = 1 — The message column number
Besides the constants above, an input and an output text file is also specified. These two files (INP and OUP) are used exclusively for all types of inputs and outputs which are not directed to an external file.
It can be noted, when looking at the available operators, that a few distinct categories exist. They are so divided for easy reference to the designer. The screen management and cursor control primitives are the backbone routines on which the other operators depend. It is thus true to say that only these few routines will need to be changed if the package is transported to another VDU type system.
3.2 Definition Table
3.2.1 Resource function
This resource was constructed for the main purpose of making system operation as flexible as possible. Instead of hard-coding system features into the cyntax-directed PDL generator, a means of making the system as programmable as possible was sought. Working with the idea that each new function key definition screen represents a new system state, a definition or state table solution emerged.
The Definition Table consists of system data for each function key of each state present in the package. The data held for each function key includes two Prompt Codes, two Next States and a Key Code. The Prompt Code corresponds to a prompt which will be displayed after the depression of that key. The Next State determines the state to which control will be passed after that
key is depressed. The Key Code is a code given to that particular function key as defined in the present state. This code may be used by the program for intelligent checking.
The two Prompt Codes and Next States are used, one, for normal operation, and the other in case of the system trapping a user- entered error. Thus, two possible branches are provided for any function key in any state. Error detection is done external to this resource, and the appropriate branch is then chosen. The system will therefore access this resource to find its next state. This makes the entire package programmable from the Definition Table.
The Definition Table is one of the system tables which is loaded from file on entering the syntax-directed editor. The file used for this purpose is "DT.SYS". This facility for loading the system files from disk makes the package easy to modify without the need for recompilation or linking. Speed is greatly enhanced by loading the table into memory. The detailed Definition Table can be found in Appendix C.
3.2.2 The operators
There are three operators for this resource. The initialization operator is used only when the table is to be loaded from diskfile. As there exist no operators for modifying the contents of the Definition Table, the loading operation is performed only once: on entering the PDL editor.
There are two read operations: A and B Reads. The A Read operator is used initially to obtain the function definition line. The user is then presented with the appropriate state. When a decision is made using a valid function key, then the B Read operator is used to obtain the subsequent Prompt Code and Next
DT.INIT (VAR NO_OF_STATESt INTEGER)
Function: Initializes the Definition Table by loading the data from diskfile. This operation is used on editor entry to load the data into dynamic memory.
Inputs: *none*
Outputs: NO_OF_STATES — An integer value indicating the number of states available in the table.
DT..A-READ ( THIS.STATE: INTEGER; NO_OF_STATES: INTEGER;
VAR KEY_DEF_STRINGi STRING (80) OF CHAR; VAR KBY.FLAG ARRAY: ARRAY 11..10] OF BOOLEAN; VAR STATUS: INTEGER)
Function: Reads the key definition line and its associated key flag array from the Definition Table using a given state. The status flag is set unsuccessful when the input state does not exist.
Inputs: NO_OF_STATES — This number is usually taken directly from the output of the DT_INIT routine
and represents the number of states available in the Definition Table. THIS,STATE — The integer input state which is used
to look up the key definition line. The range is between 1 and NCLOF_STAT£S. Outputs: KEY_DEF_STRING — A line of text containing the
definition of the 10 function keys for the particular state chosen. KEY_FLAG_ARRAY — A boolean array of 10 (one for each
function key) to determine which keys are valid. A TRUE flag will indicate a valid function key.
STATUS — An integer variable which is set unsuccessful if the input state is not available in the table and successful otherwise.
DT B READ ( THIS_STATE: INTEGER; THIS.KEY: INTEGER? VAR NEXT.Sl: INTEGER; VAR NEXT_S2s INTEGER; VAR KEY.CODE: INTEGER? VAR PR0M_C1: INTEGER? VAR PROH_C2; INTEGER)
Function: This operator is used to obtain the two Next States, the two Prompt Codes and a Key Code associated with any valid function key, when it is depressed.
THIS_STATE ■
Outputs: NEXT_S1 -
The state in which the user was when function key was depressed.
— The number of the function key (1 to 20) which was depressed
The Next State number if no error has occurred.
NEXT_S2 — The Next State number if an error has occurred.
KEY_CODE — A Key Code integer number assigned to each function key for the purpose of program segment identification. This key code may be used in the calling program for further calculations.
PROm_C1 — The code of the prompt to after the function key has been and if no error has occurred. PR0fi.C2 — The code of the prompt to
after the function key has been and if an error has occurred.
displayed depressed, displayed depressed,
3.2.3 Resource structure
There are two global constants which are worthy of note, and these are:
MAX_STATES = 20 — The maximum number of states for which space has been allocated in the Terminal Resource. MAX_KEYS = 10 — The number of function keys per state.
Page 23
The memory based data structure is given below in p d l. Types;
FX_KEY_ RECORD == Record:
KEY FLAG : Boolean KEY,CODE : Integer PROMPT_Cl z Integer PROflPT_C2 : Integer MEXT.Sl : Integer NBXT_S2 : Integer End Record:
FX_KBY_.ARRAY = Array [1. .MAX.KEYS] o f FX_KEY_RBCORD STATE.RECORD = Record:
PX_KBY : FX_KEY_ARRAY
KEY_DEF_LN : String (80) of Character End Record:
KEY_DEPN_TABLE = Array [1..MAX^STATBS] of STATE.RECOPD Variables:
KBY_DEFN_TABLE: Single:
Permanent: DEFN_ARRAY
Thus, the key definition line of, say State 5, can be pointed to in Pascal as shown below:
DEFN ARRAY [5j. KEY_DBF_LN
while the key code of the third function key in State 5 is referred to as:
DEFM.ARRAY [3j. FX_KEY [3]. KEY_CODE
The data structure is available to all the operators of the resource. It can be seen that this table requires a large section of memory space. The Definition Table is loaded from the file "DT.SYS", and this file must be in the format shown belotv?
DD Constr Ins Ln 50 1 3 3 60 8 8 8 70 10 10 .10 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4000 0 0 9 0 0 0 0 D 0
Page 24
definition line: each of the 10 fields is 8 characters wide; the first two of which are reserved for the function key number (inserted by the FS„WRITE routine) thus leaving six characters to define the function key. The next 10 lines define the data associated with the 10 function keys. The data defined is as follows: Key Code; Prompt Code 1; Prompt Code 2? Next State 1; Next State 2. A key code of zero implies an invalid function key. The Definition Table, like all resources, is built as a module which is separately compilable. A test program is thus available to test the three operators, in this test program, extensive testing for erroneous inputs is performed, so that the designer can experiment with all input combinations to determine the resource's behavior before it is included in the program. An extra function is also available in the test program which displays the logical structure of the Definition Table and its related data in a convenient form. The test program format used by the designer can be found in Appendix A.
3.3 Key Code Table
3.3.1 Resource function
This resource represents the system's list of "reserved words". The Key Code Table consists of a list of key words or phrases which can be identified by a unique key code. Each key word also has an indentation and edit flag associated with it. The indentation number, where applicable, will be an indication of the relative indentation which must be added to the present indentation to obtain the final prettyprinted key word. The boolean edit flag determines whether the line on which that particular key word appears will be editable or not.
All words which will appear in Screen 1 in highlighted font (data description and construct key words) can be found in this table. All placeholders will also be found here because these words are also system-generated. Null text key words are other types of elements needed in this table. These key words consist of no key words at all, but only an indentation value. They represent a relative indentation which must be assigned to a user-entered, editable text line. This means that even a line of text which has been entirely user-entered contains a key word which will determine its extra indentation which is to be added to its associated indentation level value.
The key codes are chosen carefully in all cases to ensure that enough room is allowed for the purposes of system expansion. The integer value of the key code is used in the program for intelligent decision taking. The key code determines whether the associated key word is placed in the pre-Data Description segment (a negative key code); the Data Description segment (0 to 40); or in the Algorithm segment ( >40).
The existence of a Key Code Table makes the syntax-directed PDL generator package flexible, as new key words and placeholders can easily be added, and old key words erased or modified if required. Full relative indentation control is also offered via this resource. This table too is loaded on initialization from
diskfile so that system key words and indentation can be modified without the necessity for re-compilation. Details of the KCT.SYS file are given in Appendix C.
3.3.2 The operators
This resource does not have an operator facility for modifying table contents, as it is assumed that any text editor can be used to access an^ modify the data file KCT.SYS, For this reason, the initialization operator should only be used once, and this on entering the PDL editor. Only a single operator, besides the initialization operator, is required to read the contents of the Key Code Table given a key code as input.
KCT_INIT (VAR KCT.SIZB: INTEGER)
Functions Used to load the file KCT.SYS into the memory-based Key Code Table.
Inputs: *none*
Outputs: KCT_SIZE — The number of key code entries loaded into the Key Code Table.
KCT_READ { THIS_KEY_CODE: INTEGER;
VAR THIS_KEY_WORD: STRING (30) OF CHAR; VAR THIS INDEN: INTEGER;
VAR THIS_EDIT_FLAG; BOOLEAN; KCT_SIZE: INTEGER; VAR STATUS: INTEGER)
Function: Reads the key word, relative indentation, and edit flag from the Key Code Table given an input key code. The status flag is returned unsuccessful only if the input key cannot be found.
Inputs: THIS_KBY_C0DE — The input..key code which will be searched for in the table. When a match is found, its associated characteristics will be output. KCT_SIZB — This' integer variable is usually taken
directly from the output of the initialization operator.
Outputs: THIS_KEY_W0RD — The key word corresponding to the key code. Its maximun length is 30 characters.
THIS.INDEN — The relative indentation correspon ding to the key code.
THIS_EDIT_FLAG — The boolean flag used to determine