Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/nml/nmlprm.bli
There are 2 other files named nmlprm.bli in the archive. Click here to see a list.
! RATS:<BANKS.MCB.NCPNML>NMLPRM.BLI.2  4-Dec-84 12:50:10, Edit by BANKS
!
! Ident 26.
!  EXTRACT_PARAMETERS is trying to store a four byte quantity using a
!  normal assigment statement, which loses on 16 bits.  Add some conditional
!  assembly so that it will do the right thing.
!
! NET:<PECKHAM.DEVELOPMENT>NMLPRM.BLI.3 10-Dec-82 23:23:25, Edit by PECKHAM
!
! Ident 25.
! Solve bug of mis-interpreting event entity -1 => autotriggering.
! Also responds to upward compatability problem with Phase IV nodes.
!
!  Change $$NML_CODE_ENTRY to create plit instead of uplit of code text ptrs.
!  Fix NML$CODED_TEXT to range check supplied code using this plit count.
!
! NET:<PECKHAM.DEVELOPMENT>NMLPRM.BLI.2  4-Jun-82 16:26:23, Edit by PECKHAM
!
! Ident 24.
! Add NML$READ_ONLY routine for recognizing read-only parameters.
!
! NET:<VOBA.NML.DEVELOPMENT>NMLPRM.BLI.6 25-Mar-82 17:41:13, Edit by VOBA
!
! Ident 23.
! Fix EXTRACT_PARAMETER_DATA routine to parse CM2 type data correctly, i.e.
! return the pointer to the data segment of 4 bytes and the length is 4.
!
! NET:<VOBA.NML.DEVELOPMENT>NMLPRM.BLI.2 16-Mar-82 08:23:07, Edit by VOBA
!
! Ident 22.
! Fix typo bug in EXTRACT_PARAMETER_DATA routine.
!
! <VOBA.NML.DEVELOPMENT>NMLPRM.BLI.2 15-Mar-82 17:04:46, Edit by VOBA
!
! Ident 21.
! Fix EXTRACT_PARAMETER_DATA to recognize KNOWN qualifiers in NICE message
! format.
!
! NET:<VOBA.NML.DEVELOPMENT>NMLPRM.BLI.3  1-Mar-82 14:45:44, Edit by VOBA
!
! Ident 20.
! Assign HI a distinct value different from HI.
!
! NET:<PECKHAM.DEVELOPMENT>NMLPRM.BLI.3 26-Feb-82 10:32:29, Edit by PECKHAM
!
! Ident 19.
! Move the table expansion macros back from NMARCH.
!
! NET:<VOBA.NML.DEVELOPMENT>NMLPRM.BLI.8 22-Feb-82 10:29:33, Edit by VOBA
!
! Ident 18.
! Move macro definitions of NICE parameter tables to NMARCH.REQ so that
! they can be referenced by other modules of NML. The static table storage
! definition is still maintained by NMLPRM module.
!
! NET:<VOBA.NML.DEVELOPMENT>NMLPRM.BLI.30 17-Feb-82 15:04:11, Edit by VOBA
!
! Ident 17.
! Reconstruct Parameter Data Block structure so that each entry will take 2
! words both in the TOPS and MCB. Instead of having the addresses of the
! parsing routines in the each entry, a data format fode is stored and later
! examined by a single parsing routine in each major module. Also added 2 new
! fields for the MODULE parameters - QUALIFIED and QUALIFIER - to the data
! structure.
! Changed the orders of the parameters supplied to the macros defining the NICE
! parameters so that they resemble the order described in the architecture spec
! tables.
!
! Combined all 3 separate tables for MODULE entity into one. Changes of MODULE
! X25-ACCESS parameter numbers are made to the new table. Final decision for
! modifying the architecture spec to reflect this change is being solicitted.
!
! Changed local routine GET_PEB_ADDRESS to be global routine NL_PLU (alias
! NML$PARAMETER_LOOKUP) so it can be referenced from other modules.
!
! Modified the code which is used to extract data from NICE message. Changed
! from specific algorithm extracting the data based on the entity type to a
! generic algorithm extracting data based on each parameter's data format
! regardless of parameter number and/or entity type. Added local routine
! EXTRACT_PARAMETER_DATA for this function.
!
! NET:<PECKHAM.DEVELOPMENT>NMLPRM.BLI.2  7-Feb-82 15:39:02, Edit by PECKHAM
!
! Ident 16.
! Fix parameter numbers in $NML$LINE_CODES missed by #14.
!
! NET:<GUNN.DEVELOPMENT>NMLPRM.BLI.2 22-Jan-82 09:48:59, Edit by GUNN
!
! Ident 15.
! Update copyright date to 1982.
! Set info type for HOST parameter 141 (WO) so SHOW command
! will display it.
!
! NET:<GUNN.DEVELOPMENT>NMLPRM.BLI.7  5-Jan-82 17:35:29, Edit by GUNN
!
! Ident 14.
! Add data type for NODE parameter #101 (MANAGEMENT VERSION) to PVB
! table.
!
! Update parameter tables to reflect Version 3.0.0 of Network
! Management Architecture Specification.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.4  4-Jun-81 08:45:25, Edit by GUNN
!
! Ident 13.
! Change LINE and CIRCUIT state parameters to be owned by NML.
! Put X25 and coded parameter text tables under conditional.
! Remove external reference to NMU$MEMORY_MANAGER and NMU$TEXT_MANAGER.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.9 13-May-81 09:18:39, Edit by GUNN
!
! Ident 12.
! Change text for parameter #110 to SERVICE CIRCUIT.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.7 12-May-81 13:44:48, Edit by VOBA
!
! Ident 11.
! Add data definitions for X.25 Modules (Access, Protocol, and Server).
! 
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.6 11-May-81 10:46:42, Edit by GUNN
!
! Ident 10.
! Change text for coded NODE parameter values to agree with keywords
! coded in NCP3TB.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.4  7-May-81 15:19:50, Edit by GUNN
!
! Fix logic in NML$EXECUTOR_ONLY.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.3  7-May-81 13:45:42, Edit by GUNN
!
! Fix definition of PDB structure, had invalid use of $SUB_BLOCK.
! Make SETTABILITY, APPLICABILITY, and INFO_TYPE fields part of PDB
! structure. 
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.17 16-Apr-81 15:55:38, Edit by GUNN
!
! Add tables and routines to support conversion of coded parameter
! values to text.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.5 10-Apr-81 10:33:37, Edit by GUNN
!
! Fix case of the missing dot "." on reference to PTR_ADR in the
! D_field-type routines.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.4  9-Apr-81 18:11:53, Edit by GUNN
!
! Change D_8BYTE routine to return a pointer to the Hexadecimal string.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.3  3-Apr-81 14:07:44, Edit by GUNN
!
! Change D_NODEID to return pointer rather than value.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.15 29-Mar-81 22:13:35, Edit by GUNN
!
! Update IDENT edit number.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.12 12-Mar-81 10:37:14, Edit by GUNN
!
! Add code to extract parameter data and return length.
!
! NET:<DECNET20-V3P1.NML>NMLPRM.BLI.86  5-Mar-81 12:25:56, Edit by GUNN
!
! Make compilation of NML$PARAMETER_TEXT routine be dependent on system
! type. Only required by NCP.
!
%title 'NMLPRM -- Table Lookup Entity Parameters'
module NMLPRM	(
                 ident = 'X03.26'
                 ) =
begin

!                    COPYRIGHT (c) 1980, 1981, 1982, 1985
!                    DIGITAL EQUIPMENT CORPORATION
!                        Maynard, Massachusetts
!
!     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:	DECnet-10/20 V3.0 Network Management Layer (NML)
!
! ABSTRACT:
!
!	Provides the table lookup function for Network Management 
!       entity parameters.
!
! ENVIRONMENT:	TOPS-10/20 & MCB/RSX11 User mode under NML
!
! AUTHOR: Dale C. Gunn , CREATION DATE:  5-Jan-81
!
! MODIFIED BY:
!
!	, : VERSION
! 01	-
!--
!
! INCLUDE FILES:
!

library 'NMLLIB';                       ! All required definitions

!
! TABLE OF CONTENTS
!

forward routine
	NML$VALID_PARAMETER,            ! Determine if a parameter is valid
        NML$CLEARABLE,
        NML$READ_ONLY,
        %if not $MCB %then              ! Text not included or required in MCB
        NML$PARAMETER_TEXT,
        NML$CODED_TEXT,
        %fi
        NML$SUMMARY,                    ! Check for inclusion info types
        NML$STATUS,
        NML$CHARACTERISTIC,
        NML$EXECUTOR_ONLY,              ! Check for applicability
        NML$VDB_PARAMETER,              ! Determine if parameter belongs to NML
        NML$GET_PDB_DATA_TYPE,          ! Return data type byte
        NML$PARAMETER_DATA,             ! Return data for parameter
        NML$PARAMETER_LOOKUP,           ! Find entry in data vector
        EXTRACT_PARAMETER_DATA,         ! Extract parameter data field
        SEARCH_PARAMETER_TABLE; 
%sbttl 'TOPS-10/20 Parameter Data Block Entry Format'

! 35                                                                     0
! +-----------------------------------------------------------------------+
! | PDB_NAME                                                              |
! +-----------------------------------------------------------------------+
!
! 35                26                17                 8               0
! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-----------------+-----------------+
! | | | | | | | | | | | | | | | | | | |  PDB_DATA_TYPE  | PDB_DATA_FORMAT |
! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-----------------+-----------------+
!      | | | | | | |   | | | | | | | |
!      | | | | | | |   | | | | | | | +- PDB_NML_PARAMETER
!      | | | | | | |   | | | | | | +--- PDB_READ_ONLY
!      | | | | | | |   | | | | | +----- PDB_WRITE_ONLY
!      | | | | | | |   | | | | |
!      | | | | | | |   | | | | +------- PDB_QUALIFIED     \
!      | | | | | | |   | | | +--------- PDB_EXECUTOR_ONLY  \  PDB_
!      | | | | | | |   | | +----------- PDB_ADJACENT_ONLY   ) APPLICABILITY_
!      | | | | | | |   | +------------- PDB_REMOTE_ONLY    /  FIELD
!      | | | | | | |   +--------------- PDB_SINK_ONLY     /
!      | | | | | | |
!      | | | | | | +------------------- PDB_CHARACTERISTIC
!      | | | | | +--------------------- PDB_STATUS
!      | | | | +----------------------- PDB_SUMMARY
!      | | | +------------------------- PDB_EVENTS
!      | | +--------------------------- PDB_QUALIFIER
!      | |
!      | +----------------------------- PDB_CLEARABLE
!      +------------------------------- PDB_UPPER_CASE
%sbttl 'MCB Parameter Data Block Entry Format'

! 15               7             0
! +---------------+---------------+
! | PDB_DATA_TYPE |PDB_DATA_FORMAT|
! +---------------+---------------+
!
! 15               7             0
! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! | | | | | | | | | | | | | | | | |
! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!    | | | | | | | | | | | | | | |
!    | | | | | | | | | | | | | | +- PDB_NML_PARAMETER
!    | | | | | | | | | | | | | +--- PDB_READ_ONLY
!    | | | | | | | | | | | | +----- PDB_WRITE_ONLY
!    | | | | | | | | | | | |
!    | | | | | | | | | | | +------- PDB_QUALIFIED     \
!    | | | | | | | | | | +--------- PDB_EXECUTOR_ONLY  \  PDB_
!    | | | | | | | | | +----------- PDB_ADJACENT_ONLY   ) APPLICABILITY_
!    | | | | | | | | +------------- PDB_REMOTE_ONLY    /  FIELD
!    | | | | | | | +--------------- PDB_SINK_ONLY     /
!    | | | | | | |
!    | | | | | | +----------------- PDB_CHARACTERISTIC
!    | | | | | +------------------- PDB_STATUS
!    | | | | +--------------------- PDB_SUMMARY
!    | | | +----------------------- PDB_EVENTS
!    | | +------------------------- PDB_QUALIFIER
!    | |
!    | +--------------------------- PDB_CLEARABLE
!    +----------------------------- PDB_UPPER_CASE
%sbttl 'PDB - Parameter Data Block Structure Definition'

$show (all);                            ! Start XPORT displays

$field PVL_DATA_BLOCK =
    set
%if not $MCB %then                      ! No NCP on MCB, eliminate string text
    PDB_NAME = [$pointer],              ! Pointer to parameter name text
%fi

    PDB_DATA_FORMAT = [$byte],          ! Data format code
    PDB_DATA_TYPE = [$byte],            ! Data type byte

        $align (byte)                   ! Restrictions
    PDB_NML_PARAMETER = [$bit],         ! ON if NML owns this parameter
    PDB_SETTABILITY = [$bits(2)],
    PDB_APPLICABILITY = [$bits(5)],

        $align (byte)                   ! Information type applicability
    PDB_CHARACTERISTIC = [$bit],
    PDB_STATUS = [$bit],
    PDB_SUMMARY = [$bit],
    PDB_EVENTS = [$bit],
    PDB_QUALIFIER = [$bit],

    PDB_CLEARABLE = [$bit],             ! Clearable by user
    PDB_UPPER_CASE = [$bit],            ! Parameter data upper case conversion

!   Overlaying definitions

        $overlay (PDB_SETTABILITY)      ! Settability restrictions
    PDB_READ_ONLY = [$bit],
    PDB_WRITE_ONLY = [$bit],
        $continue

        $overlay (PDB_APPLICABILITY)    ! Applicability restrictions
    PDB_QUALIFIED = [$bit],
    PDB_EXECUTOR_ONLY = [$bit],
    PDB_OTHER_NODES = [$bits(3)],
        $continue

        $overlay (PDB_OTHER_NODES)
    PDB_ADJACENT_ONLY = [$bit],
    PDB_REMOTE_ONLY = [$bit],
    PDB_SINK_ONLY = [$bit]
        $continue
    tes;

literal
       PVL_DATA_BLOCK_SIZE = $field_set_size;

$show (none);                           ! Terminate XPORT displays
%sbttl 'Data Structure Expansion Macros'

! $NML$xxxxxxxxxx
!
!	Macros to expand lists of parameter definitions and issue preset
!       attribute parameters to initialize the parameter lookup block vector
!       structure. This structure is used to determine the validity and
!       information about any of the NML defined parameters for each entity.
!
!       The parameter entry list is a sequence of entries, one for each
!       parameter to be defined, enclosed in parentheses and seperated by
!       commas, e.g.
!
!	(entry #1), (entry #2), (entry #3), ..., (entry #n)
!
!	and each entry is itself a list of items which describe the
!       parameter. The parameters which specify each entry have
!       the following format
!
!               (Parameter number,
!                Literal name,
!                Format for data extraction,
!                Layer that exclusively owns this parameter,
!                Data type,
!                Information type,
!                Applicability restriction,
!                Settability restriction)
!
!
!       **** CAUTION ****
!       The following macros set fields within the PVL_DATA_BLOCK structure
!       by means of arithmetic bit shift expressions. The shift expressions
!       must match exactly the structure positions of the fields generated
!       when the PVL_DATA_BLOCK fields are defined.

macro
     $NML$PVL_DATA_BLOCK =
         block [PVL_DATA_BLOCK_SIZE]
         field (PVL_DATA_BLOCK) %;

macro                                   ! Block data field preset macro
     $NML$PV_LOOKUP [ENTRY_LIST] =
         $$NML_PV_LOOKUP_ENTRY (%count, %remove(ENTRY_LIST)) %;

macro                                   ! Block data count macro
     $NML$PV_LOOKUP_COUNT (ENTRY_LIST) =
         %length %;

macro
     $$$NML_SET_EXPAND [RESTRICTION_LIST] =
         $$$NML_SET (RESTRICTION_LIST) %;

macro
     $$$NML_SET (RESTRICTION) =
         %if %null (RESTRICTION)
         %then %bliss36(0) %bliss16(0)
         %else %if %identical('RO',%string(RESTRICTION)) ! READ ONLY
               %then 1 ^ %bliss36(19) %bliss16(1)
               %else %if %identical('WO',%string(RESTRICTION)) ! WRITE ONLY
                     %then 1 ^ %bliss36(20) %bliss16(2)
                     %fi
               %fi
               %if %identical('C',%string(RESTRICTION)) ! CLEARABLE
               %then 1 ^ %bliss36(32) %bliss16(13)
               %fi
         %fi %;

macro
     $$$NML_APPLICABILITY_EXPAND [RESTRICTION_LIST] =
         $$$NML_APPLICABILITY (RESTRICTION_LIST) %;

macro
     $$$NML_APPLICABILITY (RESTRICTION) =
         %if %null(RESTRICTION)
         %then %bliss36(0) %bliss16(0)
         %else %if %identical('Q',%string(RESTRICTION)) ! QUALIFIED
               %then 1 ^ %bliss36(21) %bliss16(3)
               %fi

               %if %identical('E',%string(RESTRICTION)) ! EXECUTOR ONLY
               %then 1 ^ %bliss36(22) %bliss16(4)
               %fi

               %if %identical('A',%string(RESTRICTION)) ! ADJACENT ONLY
               %then 1 ^ %bliss36(23) %bliss16(5)
               %fi

               %if %identical('R',%string(RESTRICTION)) ! REMOTE ONLY
               %then 1 ^ %bliss36(24) %bliss16(6)
               %fi

               %if %identical('S',%string(RESTRICTION)) ! SINK ONLY
               %then 1 ^ %bliss36(25) %bliss16(7)
               %fi
         %fi %;

macro
     $$$NML_INFORMATION_EXPAND [TYPE_LIST] =
         $$$NML_INFORMATION (TYPE_LIST) %;

macro
     $$$NML_INFORMATION (TYPE) =
         %if %null(TYPE)
         %then %bliss36(0) %bliss16(0)
         %else %if %identical('C',%string(TYPE)) ! CHARACTERISTIC
               %then 1 ^ %bliss36(27) %bliss16(8)
               %fi

               %if %identical('S',%string(TYPE)) ! STATUS
               %then 1 ^ %bliss36(28) %bliss16(9)
               %fi

               %if %identical('*',%string(TYPE)) ! SUMMARY
               %then 1 ^ %bliss36(29) %bliss16(10)
               %fi

               %if %identical('EV',%string(TYPE)) ! EVENTS
               %then 1 ^ %bliss36(30) %bliss16(11)
               %fi

               %if %identical('Q',%string(TYPE)) ! QUALIFIER
               %then 1 ^ %bliss36(31) %bliss16(12)
               %fi
         %fi %;

macro
     $$NML_ENTRY_PARSING (NAME, FORM, LAYER, TYPE, INFO, APPR, SETR, UCASE) =
         %if not $MCB                   ! Lexical name of parameter
         %then CH$ASCIC (%string(NAME)),
         %fi

         %if not %null(FORM)            ! Data format
         %then FORM
         %else %bliss36(0) %bliss16(0)
         %fi

         %if not %null(TYPE)            ! Data type
         %then or TYPE ^ %bliss36(9) %bliss16(8)
         %fi

         %bliss16(,0)                   ! MCB break for word boundary

         %if %identical('NML',%string(LAYER)) ! Network Management Layer
         %then or 1 ^ %bliss36(18) %bliss16(0)
         %fi

         %if not %null(INFO)            ! Information type
         %then or $$$NML_INFORMATION_EXPAND (%remove(INFO))
         %fi

         %if not %null(APPR)            ! Applicability restriction
         %then or $$$NML_APPLICABILITY_EXPAND (%remove(APPR))
         %fi

         %if not %null(SETR)            ! Settability restriction
         %then or $$$NML_SET_EXPAND (%remove(SETR))
         %fi

         %if not %null(UCASE)           ! Parameter data upper case conversion
         %then %if %identical('U',%string(UCASE))
               %then or 1 ^ %bliss36(33) %bliss16(14)
               %fi
         %fi %;

macro
     $$NML_PV_LOOKUP_ENTRY (CNT, PARAMETER) =
         [CNT,PE_NUMBER] = PARAMETER,
         [CNT,PE_ADDRESS] = uplit ($$NML_ENTRY_PARSING (%remaining)) %;

!
! Macros to expand coded parameter text tables.
!

macro
     $NML$PC_LOOKUP [ENTRY_LIST] =
         $$NML_CODE_ENTRY (%count, %remove(ENTRY_LIST)) %;

macro
     $$NML_CODE_ENTRY (CNT, PARAMETER, TABLE) =
         [CNT,PE_NUMBER] = PARAMETER,
         [CNT,PE_ADDRESS] = plit ($$NML_EXPAND_CODES (%remove(TABLE))) %;

macro
     $$NML_EXPAND_CODES [TABLE] =
         CH$ASCIC (TABLE) %;
%sbttl 'Table Storage Definition'

!
! The macros which are used to define these tables are defined in NMARCH.REQ.
!

own
   NODE_PARAMETER_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$NODE_PARAMETERS))
       preset ($NML$PV_LOOKUP($NML$NODE_PARAMETERS)); 

%if not $MCB %then
own
   NODE_CODE_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$NODE_CODES))
       preset ($NML$PC_LOOKUP($NML$NODE_CODES)); %fi

own
   LINE_PARAMETER_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$LINE_PARAMETERS))
       preset ($NML$PV_LOOKUP($NML$LINE_PARAMETERS)); 

%if not $MCB %then
own
   LINE_CODE_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$LINE_CODES))
       preset ($NML$PC_LOOKUP($NML$LINE_CODES)); %fi

own
   LOGGING_PARAMETER_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$LOGGING_PARAMETERS))
       preset ($NML$PV_LOOKUP($NML$LOGGING_PARAMETERS)); 

%if not $MCB %then
own
   LOGGING_CODE_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$LOGGING_CODES))
       preset ($NML$PC_LOOKUP($NML$LOGGING_CODES)); %fi

own
   CIRCUIT_PARAMETER_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$CIRCUIT_PARAMETERS))
       preset ($NML$PV_LOOKUP($NML$CIRCUIT_PARAMETERS)); 

%if not $MCB %then
own
   CIRCUIT_CODE_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$CIRCUIT_CODES))
       preset ($NML$PC_LOOKUP($NML$CIRCUIT_CODES)); %fi

own
   MODULE_PARAMETER_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$MODULE_PARAMETERS))
       preset ($NML$PV_LOOKUP($NML$MODULE_PARAMETERS));

%if not $MCB %then
own
   MODULE_CODE_TABLE:
       $NML$PVB_ENTRY_VECTOR ($NML$PV_LOOKUP_COUNT($NML$MODULE_CODES))
       preset ($NML$PC_LOOKUP($NML$MODULE_CODES)); %fi
%sbttl '' %if not $MCB %then
%global_routine ('NML$PARAMETER_TEXT', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Returns a character string pointer to the name of a
!       parameter known by NML.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	Character string pointer to counted ASCII name text, if known;
!       0, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK; 

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER)) eql 0
    then return $FALSE; 

    !
    ! Get address of PVL_DATA_BLOCK from lookup table 
    !

    PDB = .ENTRY[PE_ADDRESS];

    !
    ! Return pointer to an I-field name string.
    !

    return ch$plus(.PDB[PDB_NAME],-1);
    end;				! End of NML$PARAMETER_TEXT
%global_routine ('NML$CODED_TEXT', ENTITY_TYPE, PARAMETER, CODE) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Returns a character string pointer to the name of a
!       coded parameter value known by NML.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!	CODE        - The value of the parameter code.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	Character string pointer to counted ASCII name text, if known;
!       0, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         CTB: ref vector[1],            ! Address of coded text table
         ADDRESS,
         COUNT,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK; 

    !
    ! Get address of table entry for this parameter.
    !

    case .ENTITY_TYPE from NODE_E to MODULE_ of
        set
        [NODE_E]:
            begin
            ADDRESS = NODE_CODE_TABLE; 
            COUNT = $NML$PV_LOOKUP_COUNT ($NML$NODE_CODES); 
            end;

        [LINE_]:
            begin
            ADDRESS = LINE_CODE_TABLE; 
            COUNT = $NML$PV_LOOKUP_COUNT ($NML$LINE_CODES); 
            end;

        [LOGGING_]:
            begin
            ADDRESS = LOGGING_CODE_TABLE; 
            COUNT = $NML$PV_LOOKUP_COUNT ($NML$LOGGING_CODES); 
            end;

        [CIRCUIT_]:
            begin
            ADDRESS = CIRCUIT_CODE_TABLE; 
            COUNT = $NML$PV_LOOKUP_COUNT ($NML$CIRCUIT_CODES); 
            end;

        [MODULE_]:
            begin
            ADDRESS = MODULE_CODE_TABLE;
            COUNT = $NML$PV_LOOKUP_COUNT ($NML$MODULE_CODES);
            end;

        [inrange,
         outrange]:
            return 0; 
        tes;

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = SEARCH_PARAMETER_TABLE (.PARAMETER, .ADDRESS, .COUNT)) eql 0
    then return $FALSE;

    !
    ! Get address of coded text table from lookup table 
    !

    CTB = .ENTRY[PE_ADDRESS]; 

    !
    ! If beyond the code range, we cannot interpret.
    !

    if (.CODE geq .CTB[-1]) then return $false;

    !
    ! Return pointer to an I-field name string.
    !

    return ch$plus(.CTB[.CODE],-1);
    end;				! End of NML$CODED_TEXT
%fi                                     ! End of $MCB conditional compilation
%global_routine ('NML$SUMMARY', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Determines whether a parameter is to be included in the
!       response to a request for summary type information.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	TRUE, if the parameter is included in a summary display;
!       FALSE, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK; 

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER)) eql 0
    then return $FALSE; 

    !
    ! Get address of PVL_DATA_BLOCK from lookup table 
    !

    PDB = .ENTRY[PE_ADDRESS]; 

    !
    ! If summary flag is on return true.
    !

    return (.PDB[PDB_SUMMARY]);
    end;				! End of NML$SUMMARY
%global_routine ('NML$STATUS', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Determines whether a parameter is to be included in the
!       response to a request for status type information.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	TRUE, if the parameter is included in a status display;
!       FALSE, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK; 

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER)) eql 0
    then return $FALSE; 

    !
    ! Get address of PVL_DATA_BLOCK from lookup table 
    !

    PDB = .ENTRY[PE_ADDRESS]; 

    !
    ! If status flag is on return true.
    !

    return (.PDB[PDB_STATUS]);
    end;				! End of NML$STATUS
%global_routine ('NML$CHARACTERISTIC', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Determines whether a parameter is to be included in the
!       response to a request for characteristic type information.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	TRUE, if the parameter is included in a characteristics display;
!       FALSE, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK; 

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER)) eql 0
    then return $FALSE; 

    !
    ! Get address of PVL_DATA_BLOCK from lookup table 
    !

    PDB = .ENTRY[PE_ADDRESS]; 

    !
    ! If characteristics flag is on return true.
    !

    return (.PDB[PDB_CHARACTERISTIC]);
    end;				! End of NML$CHARACTERISTIC
%global_routine ('NML$EXECUTOR_ONLY', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Determines whether a given NODE parameter applies to the
!       executor node.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	TRUE, if this parameter applies to the executor node;
!       FALSE, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK; 

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER)) eql 0
    then return $FALSE; 

    !
    ! Get address of PVL_DATA_BLOCK from lookup table 
    !

    PDB = .ENTRY[PE_ADDRESS]; 

    !
    ! Check if any applicability restrictions apply, if so
    ! then check if applicable to executor.
    !

    return (.PDB[PDB_EXECUTOR_ONLY] and (.PDB[PDB_OTHER_NODES] eql 0));
    end;				! End of NML$EXECUTOR_ONLY
%global_routine ('NML$VALID_PARAMETER', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Determines whether a parameter is valid according to the
!       DNA Network Management Architecture Specification.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	TRUE, if this is a valid parameter;
!       FALSE, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    return (NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER) neq 0);
    end;				! End of NML$VALID_PARAMETER
%global_routine ('NML$CLEARABLE', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Determines whether a given parameter could be cleared by the user.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	TRUE, if this parameter applies to the executor node;
!       FALSE, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK; 

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER)) eql 0
    then return $FALSE; 

    !
    ! Get address of PVL_DATA_BLOCK from lookup table 
    !

    PDB = .ENTRY[PE_ADDRESS]; 

    return (.PDB[PDB_CLEARABLE]);
    end;				! End of NML$CLEARABLE
%global_routine ('NML$READ_ONLY', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Determines whether a given parameter is read-only.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	TRUE, if this parameter is read-only;
!       FALSE, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK; 

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER)) eql 0
    then return $FALSE; 

    !
    ! Get address of PVL_DATA_BLOCK from lookup table 
    !

    PDB = .ENTRY[PE_ADDRESS]; 

    return (.PDB[PDB_READ_ONLY]);
    end;				! End of NML$CLEARABLE
%global_routine ('NML$VDB_PARAMETER', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Determines if a given parameter is maintained as part of the NML
!       volatile or permanent data base. 
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	TRUE, if parameter may be written to NML data base;
!       FALSE, otherwise.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK;

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER)) eql 0
    then return $FALSE;

    PDB = .ENTRY[PE_ADDRESS];

    return (.PDB[PDB_NML_PARAMETER]);
    end;				! End of NML$VDB_PARAMETER
%global_routine ('NML$GET_PDB_DATA_TYPE', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Returns the data type byte, for parameters maintained by NML
!       in its volatile or permanent data base, from the parameter
!       definition tables.
!
!       NOTE: The caller is responsible for ensuring that the
!       parameter number passed as argument to this routine be
!       a valid parameter for which NML is responsible for maintaining.
!       This is done by first calling NML$VDB_PARAMETER.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	The data type byte for the specified parameter, as defined in
!       the Network Management Architecture specification.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK;

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .PARAMETER)) eql 0
    then return $FALSE;

    PDB = .ENTRY[PE_ADDRESS];

    return (.PDB[PDB_DATA_TYPE]);
    end;				! End of NML$GET_PDB_DATA_TYPE
%global_routine ('NML$PARAMETER_DATA', ENTITY_TYPE, NUMBER, NICE, DATA) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Extracts the data value portion of a parameter from a NICE
!       request message.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!	NUMBER      - The parameter type number for this parameter.
!	NICE        - The address of a pointer into the NICE message. The
!                     pointer is updated to point to the next available
!                     byte after the current parameter.
!	DATA        - The address of a variable to contain the parameter 
!                     data. May be either value or pointer. In some special
!                     cases, this is the address of a vector, where each
!                     element of the vector will contain either a value or
!                     a pointer to an image field for a multiple parameter.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	The length of the parameter data field in the NICE message.
!
! SIDE EFFECTS:
!
!	The NICE message pointer is updated to point to the next available
!       byte after the parameter. The address passed in PRM_DAT is set to
!       the value of the parameter data, if a binary value, or a pointer
!       the data is an image field.
!
!--

    begin

    local
         PDB: ref $NML$PVL_DATA_BLOCK,
         ENTRY: ref $NML$PVB_ENTRY_BLOCK;

    !
    ! Get address of table entry for this parameter.
    ! Return false if cannot find it.
    !

    if (ENTRY = NML$PARAMETER_LOOKUP (.ENTITY_TYPE, .NUMBER)) eql 0
    then return $FALSE;

    PDB = .ENTRY[PE_ADDRESS];

    !
    ! Get the data format value,
    ! if exists, parse and extract the data;
    ! otherwise, it probably is a special case
    !

    if .PDB[PDB_DATA_FORMAT] neq 0
    then return EXTRACT_PARAMETER_DATA (.PDB, .NICE, .DATA)
    else begin
         ! Handle special cases... or return zero
         ! (LOGGING) SINK NODE
         ! (LOGGING) EVENTS
         return $FALSE;
         end;
    end;				! End of NML$PARAMETER_DATA
%routine ('EXTRACT_PARAMETER_DATA', PDB, NICE, DATA) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Extracts data from the NICE message as specified by the format.
!
! FORMAL PARAMETERS
!
!       NICE         - The address of a character sequence pointer into
!                      the data portion of the parameter. The pointer is
!                      updated to point to the next available byte after
!                      the current parameter.
!
!       If the FORMAT is
!
!       C-1     DATA - The address of the location to contain the extracted
!       DU-1,2,4       data value, of 1 to 4 bytes
!
!
!       CM-2    DATA - The address of the location to contain the pointer
!                      to the data field, which includes 2 2-byte fields.
!
!
!       CM-N    DATA - The address of the location to contain the pointer
!                      to the data field, which includes the count byte and
!                      either an I-6 image field of the node name or a two
!                      bytes binary value of the node address.
!
!
!       CM-O    DATA - The address of the location to contain the pointer
!                      to the data field, which includes the count byte and
!                      either an I-6 image field of the object name or a
!                      single byte binary value of the object number.
!
!
!       AI, HI  DATA - The address of the location to contain the pointer
!                      to the data field, which includes the count byte and
!                      the I-n image field of the ASCII string, where n is
!                      the value of the count byte.
!
!
!       HX-8    DATA - The address of the location to contain the pointer
!                      to the data field of 8 data bytes.
!
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	The length of the parameter data.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    map
       PDB: ref $NML$PVL_DATA_BLOCK;

    selectone .PDB[PDB_DATA_FORMAT] of
        set
        [DU1] :                         ! (C1) 1 byte field
            begin
            .DATA = GETB (.NICE);       ! Get the byte value and update pointer
            return 1;                   ! We know it's a single byte
            end;

        [DU2] :                         ! 2 byte field
            begin
            .DATA = GETW (.NICE);       ! Get the word value and update pointer
            return 2;                   ! We know it's 2 bytes
            end;

        [DU4] :                         ! (O4) 4 byte field
            begin
            %if $MCB
            %then GET32 (.NICE, .DATA); ! Get four bytes and update pointer
            %else .DATA = GETN (.NICE,4); ! Get four bytes and update pointer
            %fi
            return 4;                   ! We know it's 4 bytes
            end;

        [CM2] :                         ! Coded 2 2-byte field
            begin
            .DATA = ..NICE;             ! Get pointer to data bytes
            .NICE = ch$plus (..NICE,4); ! Update pointer
            return 4;                   ! We know it's 4 bytes
            end;

        [CMN,                           ! Coded node field
         CMO] :                         ! Coded object field
            begin
            local LEN : $SIGNED_BYTE_VALUE;

            LEN = ch$rchar (..NICE);    ! Get format byte
            .DATA = ..NICE;             ! Always return pointer to id

            if .LEN[VALUE] eql 0        ! Node address or Object number
            then LEN = (if .PDB[PDB_DATA_FORMAT] eql CMN then 3 else 2)
            else begin                  ! Node name or Object name
                 if .LEN[VALUE] gtr 0
                 then LEN = .LEN + 1    ! Account for I byte
                 else LEN = 1;          ! Class of nodes or objects
                 end;                   !  but is illegal, return format byte

            .NICE = ch$plus (..NICE,.LEN); ! Point to next parameter
            return .LEN;
            end;

        [AI,                            ! ASCII image field
         HI] :                          ! Hexadecimal image field
            begin
            local LEN;

            LEN = ch$rchar (..NICE) + 1; ! Get length of I-field
            .DATA = ..NICE;             ! Data is pointer to image field
            .NICE = ch$plus (..NICE,.LEN);
            return .LEN;                ! Length of count byte plus image data
            end;

        [HX8] :                         ! Hex 8 byte field
            begin
            .DATA = ..NICE;             ! Pointer is the data
            .NICE = ch$plus (..NICE,8); ! Update pointer to next parameter
            return 8;                   ! We know it's 8 bytes
            end;

        [otherwise] :                   ! Unrecognized parameter format
            return $NICE$ERR_UPT;
        tes;

    end;                                ! End of EXTRACT
%global_routine ('NML$PARAMETER_LOOKUP', ENTITY_TYPE, PARAMETER) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Searches the appropriate parameter table based on entity type
!       number and returns the address of the PEB entry.
!
! FORMAL PARAMETERS
!
!	ENTITY_TYPE - The entity type number to which the parameter applies.
!       PARAMETER   - The parameter type number.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	Address of the PEB for this parameter or
!       0 if none.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    local
         ADDRESS,
         COUNT; 

case .ENTITY_TYPE from NODE_E to MODULE_ of
    set
    [NODE_E]:
        begin
        ADDRESS = NODE_PARAMETER_TABLE; 
        COUNT = $NML$PV_LOOKUP_COUNT ($NML$NODE_PARAMETERS); 
        end;

    [LINE_]:
        begin
        ADDRESS = LINE_PARAMETER_TABLE; 
        COUNT = $NML$PV_LOOKUP_COUNT ($NML$LINE_PARAMETERS); 
        end;

    [LOGGING_]:
        begin
        ADDRESS = LOGGING_PARAMETER_TABLE; 
        COUNT = $NML$PV_LOOKUP_COUNT ($NML$LOGGING_PARAMETERS); 
        end;

    [CIRCUIT_]:
        begin
        ADDRESS = CIRCUIT_PARAMETER_TABLE; 
        COUNT = $NML$PV_LOOKUP_COUNT ($NML$CIRCUIT_PARAMETERS); 
        end;

    [MODULE_]:
        begin
        ADDRESS = MODULE_PARAMETER_TABLE;
        COUNT = $NML$PV_LOOKUP_COUNT ($NML$MODULE_PARAMETERS);
        end;

    [inrange,
     outrange]:
        return 0; 
    tes;

    return SEARCH_PARAMETER_TABLE (.PARAMETER, .ADDRESS, .COUNT);
    end;				! End of NML$PARAMETER_LOOKUP
%routine ('SEARCH_PARAMETER_TABLE', PARAMETER, ADDRESS, COUNT) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Performs a binary search on a parameter table.
!
! FORMAL PARAMETERS
!
!	PARAMETER  - The value of the parameter number to be searched for.
!       ADDRESS    - The address of a parameter table.
!       COUNT      - Number of entries in table.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin

    map                                 ! Map parameter vector as one element
       ADDRESS: ref $NML$PVB_ENTRY_VECTOR (1); 

    local
         LEFT,                          ! Left boundary
         RIGHT,                         ! Right boundary
         INDEX,                         ! Index for search
         CODE;                          ! Return code

    CODE = 0;                           ! Set up for failure
    LEFT = 0;                           ! Initialize left (lower) bound
    RIGHT = .COUNT + 1;                 ! Initialize right (upper) bound

    while (INDEX = (.LEFT+.RIGHT)/2; .INDEX neq .LEFT)
    do begin                            ! Set center of bounds and test failure
       local I;                         ! Index for parameter table

       I = .INDEX - 1;                  ! Adjust table index for zero base

       if .PARAMETER eql .ADDRESS[.I,PE_NUMBER]
       then begin                       ! Entry found
            CODE = ADDRESS[.I,0,0,0,0]; 
            exitloop; 
            end
       else begin
            if .PARAMETER lss .ADDRESS[.I,PE_NUMBER]
            then RIGHT = .INDEX         ! Entry is in lower bound
            else begin
                 if .PARAMETER gtr .ADDRESS[.I,PE_NUMBER]
                 then LEFT = .INDEX     ! Entry is in upper bound
                 else return 0; 
                 end;
            end;
       end;

    return .CODE;
    end;				! End of SEARCH_PARAMETER_TABLE
end                                   ! End of Module NMLPRM
eludom
! Local Modes:
! Mode:BLISS
! Auto Save Mode:2
! Comment Column:40
! Comment Rounding:+1
! End: