Trailing-Edge
-
PDP-10 Archives
-
tops20-v7-ft-dist1-clock
-
7-sources/defkey.bli
There are 11 other files named defkey.bli in the archive. Click here to see a list.
%TITLE 'DEFKEY - define a key'
MODULE DEFKEY ( ! Define a key
IDENT = '1-006' ! File: DEFKEY.BLI Edit: GB1006
) =
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:
!
! Define a key
!
! ENVIRONMENT: Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: 6-AUG-1979
!
! MODIFIED BY:
!
! 1-001 - Original. DJS 18-FEB-1981. This module was created by
! extracting routine EDT$$DEFK from module EDTCTR.
! 1-002 - Regularize headers. JBS 04-Mar-1981
! 1-003 - Implement virtual memory deallocation. TMV 6-Aug-81
! 1-004 - Return an error code to distinguish the types of errors. JBS 18-May-1982
! 1-005 - New implementation of defined keys. JBS 13-Aug-1982
! 1-006 - Change CPY_MEM to CH$MOVE. GB 3-Mar-1983
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$DEFK;
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
LIBRARY 'EDTSRC:KEYPADDEF';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$DEFK - define a key'
GLOBAL ROUTINE EDT$$DEFK ( ! Define a key
KEY, ! Key number to define
STRING, ! Pointer to new definition
LEN ! Length of that definition
) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Define a key. It is entered in the table of defined keys
! so that EDT$$FIND_KEY can find it.
!
! FORMAL PARAMETERS:
!
! KEY Key number to define
!
! STRING Pointer to new definition string
!
! LEN Length of that definition
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! TRN_TBL
!
! ROUTINE VALUE:
!
! 1 = key defined
! any even number - an error code to be printed using EDT$$OUT_MSG.
!
! SIDE EFFECTS:
!
! Allocates dynamic memory for the key definition
!
!--
BEGIN
EXTERNAL ROUTINE
EDT$$TST_BADK, ! Test for an undefinable key
EDT$$CAN_KDEF, ! Cancel an existing key definition, if any
EDT$$ALO_HEAP; ! Allocate heap storage
EXTERNAL
TRN_TBL : VECTOR; ! The keypad translation table
MESSAGES ((KEYNOTDEF, INSMEM));
LOCAL
KEY_PTR : REF BLOCK [ ] FIELD (KEY_DEF_FIELD),
STATUS;
IF EDT$$TST_BADK (.KEY) THEN RETURN (EDT$_KEYNOTDEF);
!+
! Cancel any existing definition of the key.
!-
STATUS = EDT$$CAN_KDEF (.KEY);
IF ( NOT .STATUS) THEN RETURN (.STATUS);
!+
! Allocate storage to hold the key definition.
!-
IF ( NOT EDT$$ALO_HEAP (%REF (.LEN + KEY_DEF_OVERHEAD * BYTES_PER_WORD),
KEY_PTR)) THEN RETURN (EDT$_INSMEM);
KEY_PTR [KEY_DEF_NEXT] = .TRN_TBL [.KEY MOD K_KPAD_HASHSIZ];
KEY_PTR [KEY_DEF_KEY] = .KEY;
KEY_PTR [KEY_DEF_LEN] = .LEN;
TRN_TBL [.KEY MOD K_KPAD_HASHSIZ] = .KEY_PTR;
CH$MOVE (.LEN, .STRING, CH$PTR (KEY_PTR [KEY_DEF_TEXT],, BYTE_SIZE));
RETURN (1);
END;
END
ELUDOM