Google
 

Trailing-Edge - PDP-10 Archives - BB-R775E-BM - sources/edt/findkey.bli
There are 10 other files named findkey.bli in the archive. Click here to see a list.
 %TITLE 'FINDKEY - find a key''s definition'
MODULE FINDKEY (				! Find a key's definition
		IDENT = '3-001'			! File: FINDKEY.BLI Edit: CJG 3001
		) =
BEGIN
!
!			  COPYRIGHT (c) 1981, 1985 BY
!	      DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
!		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 WHICH IS NOT SUPPLIED BY DIGITAL.
!

!++
! FACILITY:	EDT -- The DEC Standard Editor
!
! ABSTRACT:
!
!	Find a key's definition.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: John Sauter, CREATION DATE: August 13, 1982
!
! MODIFIED BY:
!
! 1-001	- Original.  JBS 13-Aug-1982
! 1-002	- Don't store into the argument list.  JBS 10-Nov-1982
! 3-001 - Modify ASSERT macro to include error code. CJG 30-Jan-1984
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FIND_KEY;				! Find a key's definition

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

LIBRARY 'EDTSRC:KEYPADDEF';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FIND_KEY - find a key''s definition'

GLOBAL ROUTINE EDT$$FIND_KEY (			! Find a key's definition
    KEY, 					! Key number
    KEY_PTR					! Pointer to key definition
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Find the definition of a key in the key definition table.  Return that
!	definition or an indication that the key is not defined.
!
! FORMAL PARAMETERS:
!
!  KEY			The number of the key whose definition is to be found
!
!  KEY_PTR		Pointer to the key's definition
!
! IMPLICIT INPUTS:
!
!	TRN_TBL
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	1 = key found, KEY_PTR points to its definition
!	0 = no definition for this key
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    MAP
	KEY_PTR : REF BLOCK [ ] FIELD (KEY_DEF_FIELD);

    EXTERNAL
	TRN_TBL : VECTOR [K_KPAD_HASHSIZ];	! Table of pointers to key definitions

    LOCAL
	L_KEY,
	L_KEY_PTR : REF BLOCK [ ] FIELD (KEY_DEF_FIELD),
	KEY_FOUND;

    L_KEY = .KEY;
    ASSERT (1, (.L_KEY LSS K_KEY_MAX) AND (.L_KEY GEQ 0));
    L_KEY_PTR = TRN_TBL [.L_KEY MOD K_KPAD_HASHSIZ];
    KEY_FOUND = 0;

    WHILE ( NOT .KEY_FOUND) DO
	BEGIN
	L_KEY_PTR = .L_KEY_PTR [KEY_DEF_NEXT];

	IF (.L_KEY_PTR EQLA 0) THEN RETURN (0);

	IF (.L_KEY_PTR [KEY_DEF_KEY] EQL .L_KEY) THEN KEY_FOUND = 1;

	ASSERT (1, (.L_KEY MOD K_KPAD_HASHSIZ) EQL (.L_KEY_PTR [KEY_DEF_KEY] MOD K_KPAD_HASHSIZ));
	END;

    .KEY_PTR = .L_KEY_PTR;
    RETURN (1);
    END;					! of routine EDT$$FIND_KEY
END						! of module EDT$FINDKEY

ELUDOM