314 lines
9.5 KiB
C++
314 lines
9.5 KiB
C++
|
******************************************************************************
|
||
|
*
|
||
|
* Include file for uniVerse MOTIF like menu drivers
|
||
|
*
|
||
|
* Module %M% Version %I% Date %H%
|
||
|
*
|
||
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
||
|
* This is unpublished proprietary source code of Ardent Software Inc.
|
||
|
* The copyright notice above does not evidence any actual or intended
|
||
|
* publication of such source code.
|
||
|
*
|
||
|
*******************************************************************************
|
||
|
*
|
||
|
* Maintenence log - insert most recent change descriptions at top
|
||
|
*
|
||
|
* Date.... GTAR# WHO Description........................................
|
||
|
* 10/14/98 23801 SAP Change copyrights.
|
||
|
* 07/09/91 8502 DTM Changed CNT.OF.ALPHA to 10 for <F4> key
|
||
|
* 05/09/91 8302 DTM Fixed common to initialize routines, due to it being
|
||
|
* named common
|
||
|
* 05/08/91 7673 DTM Changed common to named common
|
||
|
* 03/12/91 7673 DTM More final changes
|
||
|
* 02/07/91 7673 DTM Final changes for FCS
|
||
|
* 09/19/90 7393 DPB Added yet more common variables
|
||
|
* 09/06/90 7421 DPB Added DEFFUN for UVREADMSG
|
||
|
* 09/05/90 7393 DPB Changed CNT.OF.ALPHA to have RETURN as SEL.ACTION
|
||
|
* 09/05/90 7367 DPB Added More common variables
|
||
|
* 08/31/90 7393 DPB Added the defs for the up,down,left,right tee chars
|
||
|
* 08/18/90 7367 DPB added common variables for HELP.PRINT.B
|
||
|
* 08/15/90 7367 DPB Moved drawing character definitions to MTF.INCL.H
|
||
|
* 08/13/90 7367 DPB Added new constants for Next,Prev page.
|
||
|
* 06/28/90 7236 JWT New MOTIF like new capability
|
||
|
*
|
||
|
*******************************************************************************
|
||
|
|
||
|
* DEFFUN for UVREADMSG
|
||
|
DEFFUN UVREADMSG(num, args) CALLING '*UVREADMSG'
|
||
|
|
||
|
* Token input codes returned by MTF.INPUT.B function
|
||
|
|
||
|
EQU UNKNOWN TO -1
|
||
|
EQU SEL.ACTION TO 1
|
||
|
EQU F.10 TO 2
|
||
|
EQU RIGHT.ARROW TO 3
|
||
|
EQU LEFT.ARROW TO 4
|
||
|
EQU DOWN.ARROW TO 5
|
||
|
EQU UP.ARROW TO 6
|
||
|
EQU F.1 TO 7
|
||
|
EQU ESCAPE TO 8
|
||
|
EQU MNEMONIC TO 9
|
||
|
EQU PREV.PAGE TO 10
|
||
|
EQU NEXT.PAGE TO 11
|
||
|
EQU F.4 TO 12
|
||
|
|
||
|
* Standard True = 1, False = 0 definitions: DPB 8/13/90
|
||
|
EQU TRUE TO 1
|
||
|
EQU FALSE TO 0
|
||
|
|
||
|
* Other standard defines... DTM 2/5/91
|
||
|
EQU NULL TO ""
|
||
|
EQU SPACE TO " "
|
||
|
EQU PRMPT TO ": "
|
||
|
EQU SEC.PRMPT TO "? "
|
||
|
|
||
|
* Menu orientation values, menubar is horizontal, all others are vertical
|
||
|
|
||
|
EQU HORIZONTAL TO 1
|
||
|
EQU VERTICAL TO 0
|
||
|
|
||
|
* Internal parameters
|
||
|
*
|
||
|
* CNT.OF.ALPHA is size of the recognized alphabet set that the
|
||
|
* MTF.INPUT.B function accepts
|
||
|
*
|
||
|
* STACK.LIMIT is the maximum depth of the menu stack
|
||
|
|
||
|
EQU CNT.OF.ALPHA TO 10
|
||
|
EQU STACK.LIMIT TO 10
|
||
|
|
||
|
* Common data structures
|
||
|
*
|
||
|
* inited - flag set by MTF.MENU.B driver to indicate that environment is
|
||
|
* properly initialized
|
||
|
*
|
||
|
* terminfo$ - structure containing all the terminfo characteristic of the
|
||
|
* users terminal. The characteristics used by the menu driver
|
||
|
* include COLUMNS, LINES, MOVE.CURSOR.TO.ADDRESS, LINEDRAW.BEGIN,
|
||
|
* LINEDRAW.END, LINEDRAW.CHARACTER, LINEDRAW.UPPER.LEFT.CORNER,
|
||
|
* LINEDRAW.LOWER.LEFT.CORNER, LINEDRAW.UPPER.RIGHT.CORNER,
|
||
|
* LINEDRAW.LOWER.RIGHT.CORNER, LINEDRAW.CENTER.VERTICAL,
|
||
|
* LINEDRAW.CENTER.HORIZONTAL, KEY.MOVE.CURSOR.RIGHT,
|
||
|
* KEY.MOVE.CURSOR.LEFT, KEY.MOVE.CURSOR.UP, KEY.MOVE.CURSOR.DOWN,
|
||
|
* KEY.FUNCTION.1, KEY.FUNCTION.10, AT.NEGATIVE.1, AT.NEGATIVE.13,
|
||
|
* AT.NEGATIVE.14, AT.NEGATIVE.15, AT.NEGATIVE.16
|
||
|
*
|
||
|
* tty$ - structure containing tty state on entry to menu driver.
|
||
|
*
|
||
|
* menu.tty$ - tty state set by menu driver. This is the same as tty$, but
|
||
|
* we make sure that ECHO OFF and CRMODE -ICRNL are set.
|
||
|
*
|
||
|
* stk.top - top of menu stack pointer
|
||
|
*
|
||
|
* stk.orient - menu stack, menu orientation
|
||
|
*
|
||
|
* stk.title - menu stack, menu title
|
||
|
*
|
||
|
* stk.items - menu stack, menu item captions
|
||
|
*
|
||
|
* stk.x.orig - menu stack, menu x (horizontal) anchor point
|
||
|
*
|
||
|
* stk.y.orig - menu stack, menu y (vertical) anchor point
|
||
|
*
|
||
|
* stk.width - menu stack, menu width if vertical; dynamic array of x
|
||
|
* start and end points for each caption if horizontal
|
||
|
*
|
||
|
* stk.cursor - menu stack, menu cursor location
|
||
|
*
|
||
|
* stk.choices - menu stack, menu number of captions on menu
|
||
|
*
|
||
|
* saved.prompt - prompt character at entry to menu driver
|
||
|
*
|
||
|
* alphastrings - the character sequences that correspond to the element
|
||
|
* of the recognized input alphabet. This array is sorted by
|
||
|
* length of string from longest to shortest. The length of the
|
||
|
* longest member is stored in element zero.
|
||
|
*
|
||
|
* alphacodes - the menu alphabet character value that is associated with
|
||
|
* the matched string from alphastrings. These values are returned
|
||
|
* by the MTF.INPUT.B function when a character string from the
|
||
|
* stream matches a string in the alphastrings array
|
||
|
*
|
||
|
* left.over - the saved input buffer used by MTF.INPUT.B function to hold
|
||
|
* input characters not yet processed
|
||
|
*
|
||
|
* lu.corner - the character sequence to use when printing the left upper
|
||
|
* corner of a menu box. Since we want all the corners to look
|
||
|
* similar, if any corner cannot be printed as a graphic character
|
||
|
* then all corners are set to the character '+'
|
||
|
*
|
||
|
* ll.corner - character sequence to print left lower corner of menu box
|
||
|
*
|
||
|
* ru.corner - character sequence to print right upper corner of menu box
|
||
|
*
|
||
|
* rl.corner - character sequence to print right lower corner of menu box
|
||
|
*
|
||
|
* h.line - character sequence to print horizontal line segment, if
|
||
|
* graphic character is not available, '-' is used
|
||
|
*
|
||
|
* v.line - character sequence to print vertical line segment, if
|
||
|
* graphic character is not available, '|' is used
|
||
|
*
|
||
|
* l.tee - character sequence to print a tee on the left side of the
|
||
|
* screen.
|
||
|
*
|
||
|
* r.tee - character sequence to print a tee on the right side of the
|
||
|
* screen.
|
||
|
*
|
||
|
* up.tee - character sequence to print a tee on the top of the screen.
|
||
|
*
|
||
|
* down.tee - character sequence to print a tee on the bottom of the
|
||
|
* screen.
|
||
|
*
|
||
|
* iv.begin - character sequence to start inverse video mode. Usually the
|
||
|
* same as @(-13), but set to '[' when @(-13) or @(-14) is null.
|
||
|
*
|
||
|
* iv.end - character sequence to stop inverse video mode. Usually the
|
||
|
* same as @(-14), but set to ']' when @(-13) or @(-14) is null.
|
||
|
*
|
||
|
* help.init - variable which specifies weather or not the help area has
|
||
|
* been initialized within the MOTIF style admin utils.
|
||
|
*
|
||
|
* help.pos -
|
||
|
*
|
||
|
* help.lock -
|
||
|
*
|
||
|
* MO.INITIALIZED -
|
||
|
*
|
||
|
* MO.KEYS -
|
||
|
*
|
||
|
* MO.TERM.TYPE -
|
||
|
*
|
||
|
* etc.file - This is the file variable for the /etc file when it has
|
||
|
* been opened.
|
||
|
*
|
||
|
* etc.open - This flag controls weather or not the /etc file is open.
|
||
|
* 1 = open, NOT(1) = not open.
|
||
|
*
|
||
|
|
||
|
common /motif.common/ inited, terminfo$, tty$, voc.file,
|
||
|
stk.top, stk.orient(STACK.LIMIT), stk.title(STACK.LIMIT),
|
||
|
stk.items(STACK.LIMIT), stk.x.orig(STACK.LIMIT),
|
||
|
stk.y.orig(STACK.LIMIT), stk.width(STACK.LIMIT),
|
||
|
stk.cursor(STACK.LIMIT), stk.choices(STACK.LIMIT), saved.prompt,
|
||
|
alphastrings(CNT.OF.ALPHA), alphacodes(CNT.OF.ALPHA), left.over,
|
||
|
lu.corner, ll.corner, ru.corner, rl.corner, h.line, v.line, l.tee,
|
||
|
r.tee, up.tee, down.tee, iv.begin, iv.end, help.init, help.pos,
|
||
|
help.lock, MO.INITIALIZED, MO.KEYS, MO.TERM.TYPE, etc.file, etc.open,
|
||
|
only.once, pass.args, group.array, group.count, passwd.array,
|
||
|
passwd.count, uv.acct.open, uv.acct,CL
|
||
|
|
||
|
* This statement allows all subroutines to access the TERMINFO equates
|
||
|
* without actually calling the TERMINFO function.
|
||
|
|
||
|
if inited = 0 then
|
||
|
$include UNIVERSE.INCLUDE TERMINFO
|
||
|
|
||
|
CL = STR(" ",77)
|
||
|
help.init=0
|
||
|
help.pos=17
|
||
|
help.lock=0
|
||
|
left.over=""
|
||
|
MO.INITIALIZED=0
|
||
|
only.once=0
|
||
|
pass.args=0
|
||
|
group.array=0
|
||
|
group.count=0
|
||
|
passwd.array=0
|
||
|
passwd.count=0
|
||
|
uv.acct.open=0
|
||
|
uv.acct=0
|
||
|
iv.begin = @(-13)
|
||
|
iv.end = @(-14)
|
||
|
if iv.begin = '' or iv.end = '' then
|
||
|
iv.begin = '['
|
||
|
iv.end = ']'
|
||
|
end
|
||
|
|
||
|
acs=''
|
||
|
acb=''
|
||
|
ace=''
|
||
|
acs = LINEDRAW.CHARACTER
|
||
|
acb = LINEDRAW.BEGIN
|
||
|
ace = LINEDRAW.END
|
||
|
lu.corner = LINEDRAW.UPPER.LEFT.CORNER
|
||
|
ll.corner = LINEDRAW.LOWER.LEFT.CORNER
|
||
|
ru.corner = LINEDRAW.UPPER.RIGHT.CORNER
|
||
|
rl.corner = LINEDRAW.LOWER.RIGHT.CORNER
|
||
|
h.line = LINEDRAW.CENTER.HORIZONTAL
|
||
|
v.line = LINEDRAW.CENTER.VERTICAL
|
||
|
up.tee = LINEDRAW.UPPER.TEE
|
||
|
down.tee = LINEDRAW.LOWER.TEE
|
||
|
l.tee = LINEDRAW.LEFT.TEE
|
||
|
r.tee = LINEDRAW.RIGHT.TEE
|
||
|
|
||
|
if lu.corner = '' or ru.corner = '' or rl.corner = '' or ll.corner = ''
|
||
|
then
|
||
|
lu.corner = "+"
|
||
|
ru.corner = "+"
|
||
|
rl.corner = "+"
|
||
|
ll.corner = "+"
|
||
|
end
|
||
|
if v.line = '' then v.line = "|"
|
||
|
if h.line = '' then h.line="-"
|
||
|
if up.tee = '' or down.tee = '' or h.line = '-'
|
||
|
then
|
||
|
up.tee = "+"
|
||
|
down.tee = "+"
|
||
|
end
|
||
|
if r.tee = '' or l.tee = ''
|
||
|
then
|
||
|
r.tee = "+"
|
||
|
l.tee = "+"
|
||
|
end
|
||
|
if ace # '' and acb # ''
|
||
|
then
|
||
|
if lu.corner = '+'
|
||
|
then
|
||
|
lu.corner = lu.corner:acb
|
||
|
ll.corner = ll.corner:acb
|
||
|
ru.corner = ace:ru.corner
|
||
|
rl.corner = ace:rl.corner
|
||
|
end
|
||
|
else
|
||
|
lu.corner = acb:lu.corner
|
||
|
ll.corner = acb:ll.corner
|
||
|
ru.corner = ru.corner:ace
|
||
|
rl.corner = rl.corner:ace
|
||
|
end
|
||
|
if acs # '' then v.line = acs:v.line
|
||
|
else if v.line # '|' then v.line = acb:v.line:ace
|
||
|
if r.tee # '+' and l.tee # '+'
|
||
|
then
|
||
|
l.tee = acb:l.tee
|
||
|
r.tee = r.tee:ace
|
||
|
end
|
||
|
else
|
||
|
l.tee = l.tee:acb
|
||
|
r.tee = ace:r.tee
|
||
|
end
|
||
|
if up.tee = '+' or down.tee = '+'
|
||
|
then
|
||
|
up.tee = ace:up.tee:acb
|
||
|
down.tee = ace:down.tee:acb
|
||
|
end
|
||
|
end
|
||
|
else
|
||
|
lu.corner = acs:lu.corner
|
||
|
ll.corner = acs:ll.corner
|
||
|
ru.corner = acs:ru.corner
|
||
|
rl.corner = acs:rl.corner
|
||
|
v.line = acs:v.line
|
||
|
r.tee = acs:r.tee
|
||
|
l.tee = acs:l.tee
|
||
|
up.tee = acs:up.tee
|
||
|
down.tee = acs:down.tee
|
||
|
end
|
||
|
h.line = acs:h.line
|
||
|
|
||
|
|
||
|
inited = 1
|
||
|
end
|
||
|
|
||
|
$include UNIVERSE.INCLUDE TTY
|