Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/nml/ncpctr.bli
There are 2 other files named ncpctr.bli in the archive. Click here to see a list.
!NET:<PECKHAM.DEVELOPMENT>NCPCTR.BLI.2 26-Feb-82 09:33:17, Edit by PECKHAM
!
! Ident 03.
! Move counter definitions to NMARCH.
!
!NET:<DECNET20-V3P1.BASELEVEL-2.SOURCES>NCPCTR.BLI.5 9-Oct-81 08:21:08, Edit by PECKHAM
!
! Ident 02.
! Correct typos in $NML$CIRCUIT_COUNTERS and $NML$LINE_COUNTERS.
!
module NCPCTR (
ident = 'X03.03'
) =
begin
!
! COPYRIGHT (c) 1980, 1981, 1982
! 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 Control Program (NCP)
!
! ABSTRACT:
!
! Provides lookup and translation of NM counter type numbers
! to text strings.
!
! ENVIRONMENT: TOPS-10/20 User mode under NML
!
! AUTHOR: Dale C. Gunn , CREATION DATE: 22-Jul-81
!
! MODIFIED BY:
!
! VERSION Modifier, Date
! Explanation
!
! 3.01 L. Webber, 30-Sep-81
! Redo table gen macros, code routines to access them.
!
!--
!
! INCLUDE FILES:
!
library 'NCPLIB'; ! All required definitions
!
! TABLE OF CONTENTS
!
forward routine
NCP$COUNTER_TEXT,
GET_CEB_ADDRESS,
SEARCH_COUNTER_TABLE;
!
! MACROS:
!
! $NML$CV_LOOKUP (parameter-entry-list) -
!
! Macro to expand a list of counter definitions and issue
! preset attribute parameters to initialize the counter
! lookup block vector structure. This structure is used to
! determine the validity and information about any of the
! NML defined counters for each entity.
! 'parameter_entry_list' is a sequence of doublet entries, each
! being enclosed in parenthesis, e.g.,
!
! (counter_definition) , (bit_map_definition_list) , ...
!
! where 'counter_definition' is
! (counter_number , 'counter_text' , counter_length)
!
! and 'bit_map_definition_list' is
!
! ((bit_position , 'bit_map_text') , ...)
!
! The 'bit_map_definition_list' may be null.
!
macro
$NML$CV_LOOKUP [ENTRY_LIST,ENTRY_BITS] =
$$NML_LOOKUP_ENTRY (%count,%remove(ENTRY_LIST),ENTRY_BITS)
% ;
macro
$$NML_LOOKUP_ENTRY (CNT,CTR,STR,WID,BDF) =
[CNT,CE_NUMBER] = CTR,
[CNT,CE_ADDRESS] = uplit (CH$ASCIZ (%remove(STR)),
%if not %null(WID) %then
WID
%else 0 %fi,
%if not %null(BDF)
%then
MAX($$MAX_BIT(%remove(BDF))),
plit ($$COUNTER_LIST(%remove(BDF)))
%else
-1,
0
%fi )
% ;
macro
$$COUNTER_LIST [ENTRY_LIST] =
$$BIT_TEXT (%remove(ENTRY_LIST)) %;
macro
$$BIT_TEXT (BIT_POSITION,TEXT) =
BIT_POSITION, ch$asciz(text) %;
macro
$$MAX_BIT [entry] =
$$MAX_BITX(%remove(entry)) %;
macro
$$MAX_BITX (position,text) =
position %;
macro
$NML$CV_LOOKUP_COUNT (ENTRY_LIST) =
%length % ;
macro ! Not referenced...
$NML$CVL_DATA_BLOCK =
block [CVL_DATA_BLOCK_SIZE]
field (CVL_DATA_BLOCK)
% ;
macro
$NML$CVB_ENTRY_VECTOR (N) =
blockvector [N,CVB_ENTRY_SIZE]
field (CVB_ENTRY) % ;
macro
$NML$CVB_ENTRY_BLOCK =
block [CVB_ENTRY_SIZE]
field (CVB_ENTRY) % ;
!
! EQUATED SYMBOLS:
!
$field CVL_DATA_BLOCK =
set
%if not $MCB ! No NCP on MCB, eliminate string text
%then
CDB_NAME = [$pointer], ! Pointer to counter name text
%fi
CDB_WIDTH = [$tiny_integer]
tes;
literal
CVL_DATA_BLOCK_SIZE = $field_set_size ;
!
! Structure definition for an entry in the vector block for
! the counter lookup table (CVB).
!
$field CVB_ENTRY =
set
CE_NUMBER = [$integer], ! Counter number
CE_ADDRESS = [$address] ! Address of data for this counter
tes;
literal
CVB_ENTRY_SIZE = $field_set_size;
!
! Structure definition for an entry in the counter lookup table (CEB)
!
$field CEB_ENTRY =
set
CB_TEXT = [$pointer], ! Pointer to counter text
CB_WIDTH = [$integer], ! Bit width of counter
CB_HIBIT = [$integer], ! Bit number of most significant bit
! with text, or -1 if none (lowest-
! order bit is bit 0)
CB_BEB = [$address] ! Address of BEB entry for bit map,
tes; ! or 0 if none
literal
CEB_ENTRY_SIZE = $field_set_size;
!
! Structure definition for an entry in the bit map lookup table (BEB)
!
$field BEB_ENTRY =
set
BB_BIT = [$integer], ! Bit position
BB_TEXT = [$pointer] ! Pointer to text for bit
tes;
literal
BEB_ENTRY_SIZE = $field_set_size;
!
! OWN STORAGE:
!
literal NODE_COUNTER_LENGTH = $NML$CV_LOOKUP_COUNT($NML$NODE_COUNTERS);
own
NODE_COUNTER_TABLE:
$NML$CVB_ENTRY_VECTOR (NODE_COUNTER_LENGTH)
preset ($NML$CV_LOOKUP($NML$NODE_COUNTERS));
literal LINE_COUNTER_LENGTH = $NML$CV_LOOKUP_COUNT($NML$LINE_COUNTERS);
own
LINE_COUNTER_TABLE:
$NML$CVB_ENTRY_VECTOR (LINE_COUNTER_LENGTH)
preset ($NML$CV_LOOKUP($NML$LINE_COUNTERS));
literal CIRCUIT_COUNTER_LENGTH = $NML$CV_LOOKUP_COUNT($NML$CIRCUIT_COUNTERS);
own
CIRCUIT_COUNTER_TABLE:
$NML$CVB_ENTRY_VECTOR (CIRCUIT_COUNTER_LENGTH)
preset ($NML$CV_LOOKUP($NML$CIRCUIT_COUNTERS));
literal MODULE_COUNTER_LENGTH = $NML$CV_LOOKUP_COUNT($NML$MODULE_COUNTERS);
own
MODULE_COUNTER_TABLE:
$NML$CVB_ENTRY_VECTOR (MODULE_COUNTER_LENGTH)
preset ($NML$CV_LOOKUP($NML$MODULE_COUNTERS));
!
! EQUATED SYMBOLS:
!
%module_name ('NCPCTR');
!
! OWN STORAGE:
!
!
! EXTERNAL REFERENCES:
!
external
%debug_data_base;
%global_routine ('NCP$COUNTER_TEXT', ENTITY_TYPE, COUNTER_NO) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Called to get the text describing a counter.
!
! FORMAL PARAMETERS
!
! ENTITY_TYPE One of the following entity codes:
!
! NODE_E NODE
! LINE_ LINE
! LOGGING_ LOGGING (no counters)
! CIRCUIT_ CIRCUIT
! MODULE_ MODULE
!
! COUNTER_NO Number of counter to get the text for
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
!
! Pointer to an ASCIZ text string, or 0 if no text.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
local CEB: ref block field(CEB_ENTRY);
if (CEB=GET_CEB_ADDRESS(.ENTITY_TYPE,.COUNTER_NO)) eql 0 then 0
else .CEB[CB_TEXT]
end; !End of NCP$COUNTER_TEXT
%global_routine ('NCP$BIT_TEXT', ENTITY_TYPE, COUNTER_NO, BIT_NO) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Called to get the text describing a bit in a counter's bit map.
!
! FORMAL PARAMETERS
!
! ENTITY_TYPE One of the following entity codes:
!
! NODE_E NODE
! LINE_ LINE
! LOGGING_ LOGGING (no counters)
! CIRCUIT_ CIRCUIT
! MODULE_ MODULE
!
! COUNTER_NO Number of counter to get the text for.
!
! BIT_NO Bit number (low-order = 0) of bit to get the text for.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
!
! Pointer to an ASCIZ text string, or 0 if no text.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
local CEB: ref block field(CEB_ENTRY);
local BEB: ref blockvector [1,BEB_ENTRY_SIZE] field(BEB_ENTRY);
local MAX_BIT,MAX_ENTRY;
if (CEB=GET_CEB_ADDRESS(.ENTITY_TYPE,.COUNTER_NO)) eql 0 then 0
else begin
BEB = .CEB[CB_BEB]; ! Address bit map table
MAX_BIT = .CEB[CB_HIBIT]; ! and high bit number
if .BIT_NO gtru .MAX_BIT then 0 ! Bit out of range - retn null pointer
else begin
local RET;
MAX_ENTRY = ! Pick up PLIT
(.vector[.BEB,-1])/BEB_ENTRY_SIZE; ! count field
RET =
(incr I from 0 to .MAX_ENTRY-1 do ! Scan through the
(if .BEB[.I,BB_BIT] eql .BIT_NO ! BEB table for
then exitloop(.BEB[.I,BB_TEXT]))); ! a matching bit number
if .RET eql -1 then 0
else .RET
end
end
end; !End of NCP$COUNTER_TEXT
%routine ('GET_CEB_ADDRESS', ENTITY_TYPE, COUNTER_NO) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Given an entity type and a counter number, returns the address of
! the CEB (counter table entry) for the counter.
!
! FORMAL PARAMETERS
!
! ENTITY_TYPE One of the entity types given in NCP$COUNTER_TEXT.
!
! COUNTER_NO Counter number
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
!
! Address of the CEB entry for the counter, or 0 if the counter
! was not found.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
local CVB: ref $NML$CVB_ENTRY_VECTOR (1000);
local CVB_LEN;
selectone .ENTITY_TYPE of
set
[NODE_E]: begin
CVB = NODE_COUNTER_TABLE;
CVB_LEN = NODE_COUNTER_LENGTH
end;
[LINE_]: begin
CVB = LINE_COUNTER_TABLE;
CVB_LEN = LINE_COUNTER_LENGTH
end;
[CIRCUIT_]: begin
CVB = CIRCUIT_COUNTER_TABLE;
CVB_LEN = CIRCUIT_COUNTER_LENGTH
end;
[MODULE_]: begin
CVB = MODULE_COUNTER_TABLE;
CVB_LEN = MODULE_COUNTER_LENGTH
end;
[otherwise]: CVB = 0;
tes;
if .CVB eql 0 then 0
else SEARCH_COUNTER_TABLE(.COUNTER_NO,.CVB,.CVB_LEN)
end; !End of GET_CEB_ADDRESS
%routine ('SEARCH_COUNTER_TABLE', COUNTER_NO, TABLE_ADDRESS, N) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Performs a binary search on a counter table.
!
! FORMAL PARAMETERS
!
! COUNTER_NO The counter number to be searched for.
!
! TABLE_ADDRESS The address of the CVB to be searched.
!
! N The number of entries in the table.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
!
! The CEB address for the specified counter, or 0 if the counter is
! not found.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
map ! Map parameter vector as one element
TABLE_ADDRESS: ref $NML$CVB_ENTRY_VECTOR (1);
local
L, ! Left boundary
R, ! Right boundary
J, ! Index for search
RTN_COD, ! Return code
TEMP;
RTN_COD = 0; ! Set up for failure
L = 0; ! Initialize left (lower) bound
R = .N + 1; ! Initialize right (upper) bound
while (J = (.L + .R)/2; .J neq .L) ! Set center of bounds and test failure
do begin
local
INDEX; ! Index for parameter table
INDEX = .J - 1; ! Adjust table index for zero base
if .COUNTER_NO eql .TABLE_ADDRESS[.INDEX,CE_NUMBER]
then begin ! Entry found
RTN_COD = .TABLE_ADDRESS[.INDEX,CE_ADDRESS];
exitloop;
end
else if .COUNTER_NO lss .TABLE_ADDRESS[.INDEX,CE_NUMBER]
then begin ! Entry is in lower bound
R = .J;
end
else if .COUNTER_NO gtr .TABLE_ADDRESS[.INDEX,CE_NUMBER]
then begin ! Entry is in upper bound
L = .J;
end
else return 0;
end;
.RTN_COD
end; !End of SEARCH_COUNTER_TABLE
end !End of Module NCPCTR
eludom
! Local Modes:
! Mode:Fundamental
! Auto Save Mode:2
! Comment Column:40
! Comment Rounding:+1
! End: