Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/nml/nmumcb.b16
There are no other files named nmumcb.b16 in the archive.
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.B16.2 2-Jul-82 21:41:12, Edit by PECKHAM
!
! Ident 09.
! Fix parameter order in NMU$NMX_IO routine
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.B16.2 29-Jun-82 09:55:42, Edit by PECKHAM
!
! Ident 08.
! Change SS$EVR routine into more general NMU$NMX_IO routine.
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.B16.6 26-May-82 10:19:07, Edit by PECKHAM
!
! Ident 07.
! Correct SS$GTM and SS$TDF time arithmetic -
! SECONDS_PER_HALFDAY is 16 bits, and therefore is a negative number!
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.B16.5 26-Mar-82 09:03:39, Edit by PECKHAM
!
! Ident 06.
! Use new MCB TIME_BLOCK structure to optimize code.
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.B16.3 23-Mar-82 17:17:14, Edit by PECKHAM
!
! Ident 05.
! Fix SS$GTM to set uptime in TIME_BLOCK if detected.
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.B16.2 19-Feb-82 16:08:01, Edit by PECKHAM
!
! Ident 04.
! Change INTERRUPT_ROUTINE reference to IO_INTERRUPT_ROUTINE in SS$EVR.
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.B16.5 5-Feb-82 18:34:32, Edit by PECKHAM
!
! Ident 03.
! Initialize event blocks in SS$EVR.
! Correct julian half-day calculation in SS$GTM to account for bliss feature
! of evaluating (+-) from right to left!
!
!NET:<DECNET20-V3P1.NMLLIB>NMUMCB.B16 4-Dec-81 16:15:19, Edit by THIGPEN
!
! Ident 02.
! Add timeout arg to NMU$SCHED_WAIT call
!
module NMUMCB ( ! MCB Specific BLISS Routines
ident = 'X00.09'
) =
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: LSG DECnet Network Management
!
! Abstract:
!
! This set of routines offer system specific routines written in
! BLISS-16 for the MCB Environment.
!
! Environment: MCB RSX task level
!
! Author: Scott G. Robinson, Creation Date: 21-Jan-81
!
!--
!<BLF/SYNONYM %UNQUOTE =>
!<BLF/SYNONYM $FIELD=FIELD>
!<BLF/PAGE>
!
! Include files
!
library 'NMULIB';
!
! Table of contents
!
forward routine
SS$GTM : novalue, ! Get TIME_BLOCK with OFFSET from now
SS$STI : novalue, ! Set Timer Interrupt for future
SS$TDF, ! Return Time Differential
SS_MESSAGE : novalue, ! Send message to Console
NMU$NMX_IO; ! Do NMX QIO
!
! Own Variables
!
own
TIME_BUF : BLOCK [8],
TIME : GTIM$ (TIME_BUF);
external routine
NMU$SCHED_MANAGER;
global routine SS$GTM (OFFSET, TIM_BLK) : novalue =
!++
! Functional description:
!
! SS$GTM updates TIM_BLK to reflect the current time + OFFSET (in
! seconds.
!
! Formal parameters:
!
! OFFSET - the number of seconds in the future to set TIM_BLK to
! TIM_BLK - a TIME_BLOCK
!
! Routine value: none
! Side effects:
! None
!--
begin
map
TIM_BLK : ref TIME_BLOCK;
builtin
rot;
local
JULIAN,
SECOND;
!
! Start by getting current TIME.
!
dir$ (TIME);
!
! Fixup year for Algorithm
!
JULIAN = .TIME_BUF [G$TIYR];
if .JULIAN geq 77
then
begin
!
! Calculate Julian Half-Day
!
JULIAN = .JULIAN + 1900;
JULIAN = (3055*(.TIME_BUF [G$TIMO] + 2)/100 -
(.TIME_BUF [G$TIMO] + 10)/13*2) - 91 +
(1 - (.JULIAN - (.JULIAN/4*4 + 3))/4)*
((.TIME_BUF [G$TIMO] + 10)/13 + .TIME_BUF [G$TIDA]) - 1 +
(.JULIAN - 1977)*365 + (.JULIAN - 1977)/4;
end
else
begin
bind
MONTH = uplit (0,31,59,90,120,151,181,212,243,273,304,334) : vector;
!
! Calculate the uptime
!
JULIAN = .JULIAN*365;
JULIAN = .JULIAN + .MONTH [.TIME_BUF [G$TIMO]] + .TIME_BUF [G$TIDA];
end;
!
! Formulate rest of time
!
JULIAN = .JULIAN*2 + (.TIME_BUF [G$TIHR]/12);
SECOND = ((.TIME_BUF [G$TIHR] mod 12)*60 +
.TIME_BUF [G$TIMI])*60 +
.TIME_BUF [G$TISC];
if .OFFSET nequ 0
then
begin
literal
SECONDS_PER_HALFDAY = 12*60*60;
if .OFFSET gequ SECONDS_PER_HALFDAY
then
begin
OFFSET = .OFFSET - SECONDS_PER_HALFDAY;
JULIAN = .JULIAN + 1;
end;
if rot (SECOND = .SECOND + .OFFSET, 1)
then
begin
SECOND = .SECOND - SECONDS_PER_HALFDAY;
JULIAN = .JULIAN + 1;
end
else
if .SECOND gequ SECONDS_PER_HALFDAY
then
begin
SECOND = .SECOND - SECONDS_PER_HALFDAY;
JULIAN = .JULIAN + 1;
end;
end;
!
! Return the updated time block
!
TIM_BLK [TIME_JULIAN] = .JULIAN;
TIM_BLK [TIME_SECOND] = .SECOND;
TIM_BLK [TIME_MILLISECOND] = %o'100000';
!
end; ! End of SS$GTM
!
global routine SS$STI (TIM_BLK, TIMER_ROUTINE) : novalue =
!++
! Functional description:
!
! SS$STI sets a timer interrupt for sometime in the future as
! indicated by TIM_BLK. TIMER_ROUTINE is invoked for the interrupt.
!
!
! Formal parameters:
!
! TIM_BLK - a TIME_BLOCK
! TIMER_ROUTINE - the address of the routine for the AST
!
! Routine value: none
! Side effects:
! None
!--
begin
map
TIM_BLK : ref TIME_BLOCK;
own
MARK_TIME : MRKT$ (, 0, 2, 0);
local
CUR_TIM : TIME_BLOCK;
bind
HOW_MUCH = MARK_TIME [M$KTMG],
AST_ROUTINE = MARK_TIME [M$KTAE];
!
! Get current time
!
SS$GTM (0, CUR_TIM);
!
! Calculate time difference thus determining seconds in future
!
if (SS$TDF (.TIM_BLK, CUR_TIM, HOW_MUCH) leq 0) then HOW_MUCH = 1;
!
! Generate Time Request to Exec
!
AST_ROUTINE = .TIMER_ROUTINE;
dir$ (MARK_TIME);
!
end; ! End of SS$STI
global routine SS$TDF (TIM_BLK_1, TIM_BLK_2, ABTIME) =
!++
! Functional description:
!
! SS$TDF subtracts TIM_BLK_2 from TIM_BLK_1 returning the absolute
! difference in ABTIME and +1,0,-1 to indicate interpretation of
! the result.
!
! Formal parameters:
!
! TIM_BLK_1 - a TIME_BLOCK
! TIM_BLK_2 - a TIME_BLOCK
! ABTIME - where to store the absolute difference
!
! Routine value: +1 if TIM_BLK_1 > TIM_BLK_2
! 0 if TIM_BLK_1 = TIM_BLK_2
! -1 if TIM_BLK_1 < TIM_BLK_2
!
! Side effects:
! None
!--
begin
map
TIM_BLK_1 : ref TIME_BLOCK,
TIM_BLK_2 : ref TIME_BLOCK;
builtin
rot;
literal
SECONDS_PER_HALFDAY = 12*60*60;
local
TEMP_JULIAN,
TEMP_SECOND;
!
! Calculate Differences
!
TEMP_SECOND = .TIM_BLK_1 [TIME_SECOND];
TEMP_JULIAN = .TIM_BLK_1 [TIME_JULIAN];
if rot (TEMP_SECOND = .TEMP_SECOND - .TIM_BLK_2 [TIME_SECOND], 1)
then
begin
TEMP_JULIAN = .TEMP_JULIAN - 1;
TEMP_SECOND = .TEMP_SECOND + SECONDS_PER_HALFDAY;
end;
TEMP_JULIAN = .TEMP_JULIAN - .TIM_BLK_2 [TIME_JULIAN];
!
! Calculate some representation of Absolute Time
!
.ABTIME = .TEMP_SECOND;
if .TEMP_JULIAN eql 1
then
.ABTIME = ..ABTIME + SECONDS_PER_HALFDAY;
!
! Return sign indication
!
if .TEMP_JULIAN lss 0
then
return -1
else
if (.TEMP_SECOND eql 0) and (.TEMP_JULIAN eql 0)
then
return 0
else
return 1
end; ! End of SS$TDF
global routine SS_MESSAGE (MESSAGE) : novalue =
!++
! Functional description:
!
!
! Formal parameters:
!
! SS$MSG issues a message to the controlling terminal. It also
! handles initialization of that terminal.
!
! FORMAL PARAMETERS:
!
! MESSAGE - the pointer to the ASCIZ string to output
!
! IMPLICIT INPUTS:
!
! LUNCO - the console output LUN
!
! IMPLICIT OUTPUTS:
!
! LUNCO - is set to the LUN if not already setup
!
! Routine Value:
!
! None
!
! SIDE EFFECTS:
!
! Message may be issued to the CO: device
!
!--
begin
own
LUNCO;
local
LENGTH;
!
! Find length of string
!
LENGTH = ch$len (.MESSAGE, 255);
!
! Assign the LUN if not already initialized
!
if .LUNCO eql 0
then
begin
LUNCO = NMU$_CONSOLE_LUN;
ALUN$S (.LUNCO, %ascii'TI', 0);
end;
!
! Now Output the string
!
QIOW$S (IO$WLB, .LUNCO, NMU$_CONSOLE_FLAG,,,, <.MESSAGE, .LENGTH, 0>);
end; ! End of SS_MESSAGE
global routine NMU$NMX_IO (FCN_MOD, BUFFER, LENGTH) =
!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS
!
! NONE.
!
! IMPLICIT INPUTS
!
!
! ROUTINE VALUE:
!
! NONE.
!
! SIDE EFFECTS:
!
! None
!
!--
begin
!<BLF/NOFORMAT>
!<BLF/NOERROR>
$field
MCB$IOSB$fields = ! QIO Status Block
set
IOSB$ERROR = [$integer], ! Composite error code:
$overlay(IOSB$ERROR)
IOSB$ERR = [$tiny_integer], ! error code
IOSB$ERR1= [$tiny_integer], ! 0 = I/O error, -1 = directive error
$continue
IOSB$_COUNT= [$integer], ! I/O count (bytes)
IOSB$_EVENT = [$sub_block(EVENT_BLOCK_SIZE)] ! IO Event Block
tes;
!<BLF/ERROR>
!<BLF/FORMAT>
literal
MCB$_IOSB_SIZE = $field_set_size,
MCB$_IOSB_ALLOCATION = $field_set_units;
macro
$IO_STATUS_BLOCK =
BLOCK[MCB$_IOSB_SIZE] FIELD( MCB$IOSB$fields ) %;
local
IO_STATUS_BLOCK : $IO_STATUS_BLOCK;
!
! Interrupt Service Routine for Read of Event Queue
!
routine RLB_AST IO_INTERRUPT_ROUTINE =
begin
map
IO_STATUS_BLOCK : ref $IO_STATUS_BLOCK;
NMU$SCHED_FLAG (IO_STATUS_BLOCK [IOSB$_EVENT]);
PROCESS_WAKE;
end; ! of RLB_AST
!
! Main Read Processing
!
begin ! Initialize I/O status block
local
ADR : ref vector;
ADR = IO_STATUS_BLOCK;
decru INDEX from MCB$_IOSB_SIZE to 1 do
begin
ADR [0] = 0;
ADR = ADR [1]; %(force auto-increment)%
end;
end;
NMU$SCHED_EVENT (IO_STATUS_BLOCK [IOSB$_EVENT], $true);
while $true do
begin
QIO$S (.FCN_MOD, NMU$_NM_DEVICE_LUN,,, IO_STATUS_BLOCK, RLB_AST, <.BUFFER, .LENGTH>);
!
! Wait for data buffer to be received
!
while .IO_STATUS_BLOCK [IOSB$ERROR] eql 0 do
NMU$SCHED_WAIT (IO_STATUS_BLOCK [IOSB$_EVENT],0);
if .IO_STATUS_BLOCK [IOSB$ERR] eql IS$SUC then exitloop;
end;
!
.IO_STATUS_BLOCK [IOSB$_COUNT]
end; ! End of routine NMU$NMX_IO
end ! End of module NMUMCB
eludom
! Local Modes:
! Mode:Bliss
! Comment Start:!
! Comment Column:40
! Comment Rounding:+1
! Auto Save Mode:2
! End: