Google
 

Trailing-Edge - PDP-10 Archives - BB-H138E-BM - 6-1-sources/tstkeydef.bli
There are 10 other files named tstkeydef.bli in the archive. Click here to see a list.
 %TITLE 'TSTKEYDEF - test a key''s definition'
MODULE TSTKEYDEF (				! Test a key's definition
		IDENT = '1-003'			! File: TSTKEYDEF.BLI Edit: JBS1003
		) =
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:
!
!	Test 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	- Make the string match be case insensitive.  JBS 10-Nov-1982
! 1-003	- Add a parameter for partial matching.  JBS 14-Dec-1982
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$TST_KEYDEF;				! Test 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$$TST_KEYDEF - test a key''s definition'

GLOBAL ROUTINE EDT$$TST_KEYDEF (		! Test a key's definition
    KEY, 					! Key number
    TEXT_PTR, 					! Address of text to match
    TEXT_LEN, 					! Length of text to match
    PARTIAL					! 1 = Partial matching
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	See if the definition of a key matches a specified string.  This is used
!	to check for GOLD, RESET, ADV and BACK.  It is also used to check for
!	the definition of DEL, to optimize DEL handling.
!
! FORMAL PARAMETERS:
!
!  KEY			The number of the key whose definition is to be tested
!
!  TEXT_PTR		Pointer to the text to test against
!
!  TEXT_LEN		Number of bytes in that text
!
!  PARTIAL		1 = Only the first part of the key definition must match
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	1 = key definition matches the string
!	0 = key is undefined or its definition does not match the string
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$STR_CMP,				! Match two strings of equal length
	EDT$$FIND_KEY;				! Find the definition of a key

    LOCAL
	KEY_PTR : REF BLOCK FIELD (KEY_DEF_FIELD);

    IF ( NOT EDT$$FIND_KEY (.KEY, KEY_PTR)) THEN RETURN (0);

    IF .PARTIAL
    THEN
	BEGIN

	IF (.TEXT_LEN GTR .KEY_PTR [KEY_DEF_LEN]) THEN RETURN (0)

	END
    ELSE
	BEGIN

	IF (.TEXT_LEN NEQ .KEY_PTR [KEY_DEF_LEN]) THEN RETURN (0);

	END;

    IF EDT$$STR_CMP (CH$PTR (.TEXT_PTR,, BYTE_SIZE),
		     CH$PTR (KEY_PTR [KEY_DEF_TEXT],, BYTE_SIZE),
		     .TEXT_LEN, 3) THEN RETURN (1);

    RETURN (0);
    END;					! of routine EDT$$TST_KEYDEF

!<BLF/PAGE>
END						! of module EDT$TSTKEYDEF

ELUDOM