Google
 

Trailing-Edge - PDP-10 Archives - bb-h138f-bm - 7-sources/chmhlpkpd.bli
There are 11 other files named chmhlpkpd.bli in the archive. Click here to see a list.
 %TITLE 'CHMHLPKPD - keypad help'
MODULE CHMHLPKPD (				! Keypad help
		IDENT = '3-005'			! File: CHMHLPKPD.BLI Edit: CJG3005
		) =
BEGIN
!COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1981, 1988.  ALL RIGHTS RESERVED.
!
!THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED ONLY
!IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE INCLUSION OF 
!THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY OTHER COPIES THEREOF MAY 
!NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.  NO TITLE
!TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
!
!THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND 
!SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
!
!DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS 
!SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.
!
!
!++
! FACILITY:	EDT -- The DEC Standard Editor
!
! ABSTRACT:
!
!	This module handles keypad mode help.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: Unknown
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 04-Feb-1981.  This module was created by
!	extracting the routine EDT$$KPAD_HLP  from the module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 02-Mar-1981
! 1-003	- Use new message codes.  JBS 04-Aug-1981
! 1-004	- Add return values.  JBS 02-Oct-1981
! 1-005 - Revise the mapping of keys into help text. SMB 19-Nov-1981
! 1-006 - Add a message for no help on nondefinable key. SMB 20-Nov-1981
! 1-007	- Bypass EDT$$CHM_HLP by calling EDT$$OUT_HLP directly.  JBS 03-Jun-1982
! 1-008 - Send a shift in on exit from this module.  SMB 29-Jul-1982
! 1-009	- New implementation of defined keys.  JBS 13-Aug-1982
! 1-010	- Don't add K_GOLD_BASE to the key, just look it up.  JBS 16-Aug-1982
! 1-011	- Allow for 8-bit keyboards, and fix a bug in lower case conversion.  JBS 17-Aug-1982
! 1-012	- Add SS3, for 8-bit keyboards.  JBS 20-Aug-1982
! 1-013 - Send out the shift-in sequence dependant on terminal. STS 27-Aug-1982
! 1-014	- Change the call to erase the screen.  JBS 23-Oct-1982
! 1-015	- Make sure the cursor is positioned properly before erasing the screen.  JBS 01-Nov-1982
! 1-016	- On return, rebuild the screen data base.  JBS 01-Nov-1982
! 1-017	- Add conditional for VT220 support.  JBS 11-Feb-1983
! 1-018 - Take out unecessary calls to EDT$$OUT_FMTBUF.  SMB 23-Feb-1983
! 3-001 - Change CPY_MEM to CH$MOVE.  GB 3-Mar-1983
! 3-002 - EDT$$OUT_HELP requires a byte pointer. CJG 25-Mar-1983
! 3-003 - Add updates from V3 source kit. (almost a rewrite!)  GB 27-Apr-1983
! 3-004 - Add more calls to EDT$$OUT_FMTBUF. CJG 14-Jun-1983
! 3-005 - Remove VT220 conditional to speed up code. CJG 25-Nov-1983
!--

%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$KPAD_HLP;				! Keypad mode help processor

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

LIBRARY 'EDTSRC:KEYPADDEF';

LIBRARY 'EDTSRC:TRANSLATE';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!

BIND
    SHIFT_IN_100 = UPLIT (%STRING (
	%CHAR (ASC_K_SI), 			! Shift in
	%CHAR (ASC_K_ESC), '[m')),		! Video attributes off
    SHIFT_IN_52 = UPLIT (%STRING (
    	%CHAR (ASC_K_SI),			! shift in
    	%CHAR (ASC_K_ESC),'G'));

LITERAL
    SI_LEN_52 = 3,
    SI_LEN_100 = 4;

!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$KPAD_HLP  - keypad help'

GLOBAL ROUTINE EDT$$KPAD_HLP 			! Keypad help
    =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine handles help while in keypad mode.  The help processor
!	is first called to put up the keypad diagram.  Then we go into a loop
!	accepting characters and, if they are definable keys, we give the help
!	message for the key.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	TI_TYP
!
! IMPLICIT OUTPUTS:
!
!	SCR_CHGD
!	CS_LNO
!	SCR_REBUILD
!
! ROUTINE VALUE:
!
!	1 = ok, 0 = end of journal file
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$FMT_LIT,				! Format a literal
	EDT$$FMT_CRLF,				! Format a CRLF
	EDT$$OUT_FMTBUF,			! Dump the format buffer
	EDT$$OUT_HLP,				! Get help
	EDT$$TRN_KPADK,				! Translate an escape sequence
	EDT$$SC_POSABS : NOVALUE,		! Position the cursor
	EDT$$SC_ERAALL,				! Erase to end of screen
	EDT$$MSG_TOSTR,				! Get message text
	EDT$$TI_INPCH,				! Get a character of input
	EDT$$TST_BADK;				! Test for an undefinable key

    EXTERNAL
	TI_TYP,					! Terminal type.
	SCR_CHGD,				! 1 = screen update must rebuild the screen
	CHAR_INFO : BLOCKVECTOR [256, 1],	! Information about characters
	CS_LNO,					! Line number to erase from
	SCR_REBUILD;				! 1 = rebuild the screen data base

    MESSAGES ((TORETKEY, FORHLPANO, TOEXITHLP, KEYNOTDEF));

    LOCAL
	CURSOR_SAVED,
	HELP_STRING : BLOCK [CH$ALLOCATION (16, BYTE_SIZE)],
	CH,
	C;

!+
! Get the right terminal type.
!-

    IF (.TI_TYP EQL TERM_VT100)
    THEN
	CH$MOVE (15, CH$PTR (UPLIT (%STRING ('KEYPAD VT100   '))),
	    CH$PTR (HELP_STRING,, BYTE_SIZE))
    ELSE
	CH$MOVE (15, CH$PTR (UPLIT (%STRING ('KEYPAD VT52    '))),
	    CH$PTR (HELP_STRING,, BYTE_SIZE));

!+
! Erase the whole screen.
!-
    CURSOR_SAVED = .CS_LNO;
    CS_LNO = 0;
    SCR_CHGD = 1;
    EDT$$SC_POSABS (0, 0);
    EDT$$SC_ERAALL ();
    EDT$$OUT_FMTBUF ();

!+
! Call help to get the keypad diagram.
!-

    EDT$$OUT_HLP (CH$PTR (HELP_STRING,, BYTE_SIZE), 12, 0);

!+
! Loop, displaying help on keypad keys.
!-

    WHILE 1 DO
	BEGIN

!+
! Send a precautionary shift-in plus turn video attributes off
! (mostly in case the person issues a CTRL-O).
!-

	IF (.TI_TYP EQL TERM_VT100)	!
	THEN
	    EDT$$FMT_LIT (CH$PTR (SHIFT_IN_100), SI_LEN_100)
	ELSE
	    EDT$$FMT_LIT (CH$PTR (SHIFT_IN_52), SI_LEN_52);

!+
! Get next character.
!-

	IF (EDT$$TI_INPCH (C) EQL 0) THEN RETURN (0);

!+
! Convert lower case to upper.
!-

	IF .CHAR_INFO [.C, CI_LC] THEN C = .C - 32;

!+
! Erase the screen.
!-
	CS_LNO = 0;
	SCR_CHGD = 1;
	EDT$$SC_POSABS (0, 0);
	EDT$$SC_ERAALL ();
!+
! When we return to change mode we must rebuild the screen and the screen data base.
!-
	SCR_CHGD = 1;
	SCR_REBUILD = 1;
	CS_LNO = .CURSOR_SAVED;
!+
! If the character is a space, exit the loop
! and return to the original editing position.
!-

	IF (.C EQL ASC_K_SP) THEN EXITLOOP;

!+
! If the character is an escape, CSI or SS3, translate the escape or control sequence.
!-

	IF .CHAR_INFO [.C, CI_ESC] THEN EDT$$TRN_KPADK (C);

!+
! If the character is a carriage return, re-display the keypad diagram.
!-

	IF (.C EQL ASC_K_CR)
	THEN
	    BEGIN
	    EDT$$OUT_FMTBUF ();
	    EDT$$OUT_HLP (CH$PTR (HELP_STRING,, BYTE_SIZE), 12, 0);
	    END
	ELSE
	    BEGIN
!+
! Give a different message if the key is not definable.
!-

	    IF (EDT$$TST_BADK (.C) AND EDT$$TST_BADK (.C + K_GOLD_BASE))
	    THEN
		BEGIN
!+
! If key not defineable, then display message, but continue looping
!-
		EDT$$MSG_TOSTR (EDT$_KEYNOTDEF);
		EDT$$FMT_CRLF ();
		END
	    ELSE
		BEGIN
!+
! Get the key number so we can create the topic (key number is 3 digits: 000-499)
!-
		CH$WCHAR (.C/100 + %C'0', CH$PTR (HELP_STRING, 13, BYTE_SIZE));
		CH = (.C MOD 100);
		CH$WCHAR (.CH/10 + %C'0', CH$PTR (HELP_STRING, 14, BYTE_SIZE));
		CH$WCHAR (.CH MOD 10 + %C'0', CH$PTR (HELP_STRING, 15, BYTE_SIZE));
!+
! Get the help text for the key.  The GOLD meaning of the key is included.
!-
		EDT$$OUT_FMTBUF ();
		EDT$$OUT_HLP (CH$PTR (HELP_STRING,, BYTE_SIZE), 16, 0);
		END;

!+
! Output the help instructions.
!-
	    EDT$$FMT_CRLF ();
	    EDT$$MSG_TOSTR (EDT$_TORETKEY);
	    EDT$$FMT_CRLF ();
	    EDT$$MSG_TOSTR (EDT$_TOEXITHLP);
	    EDT$$FMT_CRLF ();
	    EDT$$MSG_TOSTR (EDT$_FORHLPANO);
	    EDT$$OUT_FMTBUF ();
	    END;

	END;

!+
! Again be sure we have the none video terminal attributes in case
! this module terminates abnormally.
!-

    IF (.TI_TYP EQL TERM_VT100)		!
    THEN
	EDT$$FMT_LIT (CH$PTR (SHIFT_IN_100), SI_LEN_100)
    ELSE
	EDT$$FMT_LIT (CH$PTR (SHIFT_IN_52), SI_LEN_52);

    EDT$$OUT_FMTBUF ();
    RETURN (1);
    END;					! of routine EDT$$KPAD_HLP

!<BLF/PAGE>


END
ELUDOM