Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/nml/filmcb.b16
There are no other files named filmcb.b16 in the archive.
! 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.
!
! - Close the network connection if OPEN_FILE's call to FAL_ACCESS
! fails.
! A11 - Add response buffer and length as parameters to NETWORK_OPEN.
! A10 - Add REQUIRE of FALACC.BLI module.
! A09 - Add code to set BUFFER [BD_VALID], FILE [FD_LENGTH], and
! FILE [FD_FILE_POSITION] after calling FAL_ACCESS in
! WRITE_FILE routine.
! D08 - Remove %DEBUG calls, not used in MCB.
! A07 - Remove FAL_ACCESS routine and move it to module FALACC.
!
!
! This is the MCB System Specific portion of the NMUFIL utility module.
!
%routine ('ALLOC_BUFFER', FILE : ref FILE_DATA_BLOCK) =
!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS
!
! NONE.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
!
! NONE.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
bind
FIRST_BUFFER = (FILE [FD_CURRENT_BUFFER]) : ref BUFFER_DATA_BLOCK;
local
BUFFER : ref BUFFER_DATA_BLOCK;
BUFFER = NMU$MEMORY_GET (BUFFER_DATA_BLOCK_ALLOCATION);
BUFFER [BD_VALID] = $FALSE;
selectone .FILE [FD_LOCAL] of
set
[$TRUE] : ! Local file access
begin
return $FALSE
end;
[$FALSE] : ! Remote file access
begin
if (BUFFER [BD_ADDRESS] = NMU$MEMORY_GET (REMOTE_BUFFER_ALLOCATION)) eql 0
then
begin
return $FALSE
end;
BUFFER [BD_ALLOCATION] = REMOTE_BUFFER_ALLOCATION;
BUFFER [BD_LENGTH] = REMOTE_BUFFER_LENGTH;
end;
tes;
!
! Link buffer into buffer ring
!
if .FIRST_BUFFER eql 0
then
begin
FIRST_BUFFER = .BUFFER;
BUFFER [BD_NEXT] = .BUFFER;
end
else
begin
BUFFER [BD_NEXT] = .FIRST_BUFFER [BD_NEXT];
FIRST_BUFFER [BD_NEXT] = .BUFFER;
end;
return $TRUE
end; !End of ALLOC_BUFFER
%routine ('DEALLOC_BUFFER', FILE : ref FILE_DATA_BLOCK) =
!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS
!
! NONE.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
!
! NONE.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
bind
BUFFER_RING = (FILE [FD_CURRENT_BUFFER]) : ref BUFFER_DATA_BLOCK ;
local
BUFFER : ref BUFFER_DATA_BLOCK ;
BUFFER = .BUFFER_RING;
selectone .FILE [FD_LOCAL] of
set
[$TRUE] : ! Local file access
begin
return $FALSE
end;
[$FALSE] : ! Remote file access
begin
NMU$MEMORY_RELEASE (.BUFFER [BD_ADDRESS], .BUFFER [BD_ALLOCATION]);
end;
tes;
BUFFER [BD_ADDRESS] = 0;
BUFFER [BD_LENGTH] = 0;
BUFFER [BD_ALLOCATION] = 0;
if .BUFFER [BD_NEXT] eql .BUFFER
then BUFFER_RING = 0
else BUFFER_RING = .BUFFER [BD_NEXT];
NMU$MEMORY_RELEASE (.BUFFER, BUFFER_DATA_BLOCK_ALLOCATION);
return $TRUE
end; !End of DEALLOC_BUFFER
%routine ('OPEN_FILE', FILE : ref FILE_DATA_BLOCK, FN : ref FILE_NAME_BLOCK) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Performs system specific functions to allow access to a
! file. Sets various fields within the FILE_BLOCK. A NICE
! response message is written if the open fails.
!
! FORMAL PARAMETERS
!
! FILE - Address of a file data block.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
!
! $TRUE, if file is successfully opened;
! $FALSE, otherwise.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
selectone .FILE [FD_LOCAL] of
set
[1] : ! Local file access
begin
return $FALSE
end;
[0] : ! Remote file access
begin
local
CONN_BLK : CONNECT_BLOCK,
NODE_BFR : vector [NODE_ID_BUFFER_SIZE],
NODE_PTR,
LENGTH,
TEMP; ! A convenient temporary
!
! Open a logical link to FAL at the remote node.
!
CONN_BLK [CB_OBJECT] = FAL_OBJECT;
CONN_BLK [CB_DESCRIPTOR_LENGTH] = 0;
CONN_BLK [CB_TASK_LENGTH] = 0;
!
! Attempt to map node name to node address
!
NODE_PTR = ch$ptr (NODE_BFR,,8);
PUTB (0,NODE_PTR);
PUTB (0,NODE_PTR);
PUTB (.FN [FN_HOST_LENGTH],NODE_PTR);
ch$move (.FN [FN_HOST_LENGTH], .FN [FN_HOST_POINTER], .NODE_PTR) ;
LENGTH = NODE_ID_BUFFER_LENGTH ; ! Get buffer length
%( N.B. - This needs to have NMULIB include NMXINT.REQ
$NML$MAP_NODE_ID (LENGTH, ! Map node number to name
.NODE_PTR) ;)%
CONN_BLK [CB_HOST] = ch$ptr (NODE_BFR,,8);
CONN_BLK [CB_HOST_LENGTH] = .LENGTH;
CONN_BLK [CB_USERID_LENGTH] = .FN [FN_USER_LENGTH];
CONN_BLK [CB_USERID] = .FN [FN_USER_POINTER];
CONN_BLK [CB_ACCOUNT_LENGTH] = .FN [FN_ACCOUNT_LENGTH];
CONN_BLK [CB_ACCOUNT] = .FN [FN_ACCOUNT_POINTER];
CONN_BLK [CB_PASSWORD_LENGTH] = .FN [FN_PASSWORD_LENGTH];
CONN_BLK [CB_PASSWORD] = .FN [FN_PASSWORD_POINTER];
CONN_BLK [CB_DATA_LENGTH] = 0;
if (FILE [FD_JFN] = NMU$NETWORK_OPEN (SOURCE_LINK, CONN_BLK,
ch$ptr(.FILE[FD_RESPONSE],,8), %ref(120), NICE$_LCF)) lss 0
then begin
$RESPONSE_X (.FILE [FD_RESPONSE], NICE$_FOE, .FILE [FD_TYPE],
'Could not connect to remote FAL', 209);
return $FALSE
end;
!
! Open file on remote HOST.
!
if not FAL_ACCESS (.FILE, DAP_OPEN,
.FN [FN_NAME_POINTER],
.FN [FN_NAME_LENGTH])
then
begin
!
! Since we're telling the caller that the open was unsuccessful,
! it stands to reason that he'll assume that there isn't any
! active connection. We should close what we got.
CLOSE_FILE (.FILE);
return $FALSE;
end;
end;
tes;
$TRUE
end; !End of OPEN_FILE
%routine ('READ_FILE', FILE : ref FILE_DATA_BLOCK) =
!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS
!
! NONE.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
!
! NONE.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
bind
BUFFER = (FILE [FD_CURRENT_BUFFER]) : ref BUFFER_DATA_BLOCK,
BYTE_SIZE = %if $MCB %then 8 %else .FILE [FD_BYTE_SIZE] %fi ;
local
FILE_PAGE,
BUFFER_PAGE,
FLAG_COUNT;
!
! Handle case of seek being done. If the data in the buffer is valid
! and the file current position falls within the range of this buffer
! then all that needs to be done is to update the remaining count,
! and buffer current position.
!
if .FILE [FD_SEEK_DONE]
then
begin
FILE [FD_SEEK_DONE] = $FALSE;
if (%CMP32 (FILE [FD_CURRENT_POSITION] , geq , BUFFER [BD_FILE_POSITION]))
and
(%CMP32 (FILE [FD_CURRENT_POSITION] , leq , BUFFER [BD_MAX_POSITION]))
then
begin
local
TEMP,
TEMP32 : THIRTY_TWO_BIT;
%MOV32 (FILE [FD_CURRENT_POSITION] , TEMP32);
%SUB32 (BUFFER [BD_FILE_POSITION] , TEMP32);
%MOVF32 (TEMP32 , BUFFER [BD_CURRENT_POSITION]);
%( BUFFER [BD_CURRENT_POSITION] = .FILE [FD_CURRENT_POSITION] -
.BUFFER [BD_FILE_POSITION];)%
BUFFER [BD_REMAINING_COUNT] = .BUFFER [BD_DATA_COUNT] -
.BUFFER [BD_CURRENT_POSITION];
BUFFER [BD_POINTER] = ch$ptr (.BUFFER [BD_ADDRESS],
(.BUFFER [BD_CURRENT_POSITION] +
.BUFFER [BD_BIAS]),
BYTE_SIZE);
return $TRUE
end;
end;
selectone .FILE [FD_LOCAL] of
set
[$TRUE] : ! Local file access
begin
return $FALSE
end;
[$FALSE] : ! Remote file access
begin
local
TEMP32 : THIRTY_TWO_BIT;
do
begin
%MOV32 (FILE [FD_FILE_POSITION] , BUFFER [BD_FILE_POSITION]);
if not FAL_ACCESS (.FILE, DAP_GET, .BUFFER [BD_LENGTH],
ch$ptr (.BUFFER [BD_ADDRESS],,8))
then
begin
return $FALSE;
end;
%MOV32 (BUFFER [BD_FILE_POSITION] , FILE [FD_FILE_POSITION]);
%ADDI32 (.BUFFER [BD_DATA_COUNT] , FILE [FD_FILE_POSITION]);
%MOV32 (BUFFER [BD_FILE_POSITION] , BUFFER [BD_MAX_POSITION]);
%ADDI32 (.BUFFER [BD_DATA_COUNT] , BUFFER [BD_MAX_POSITION]);
%( BUFFER [BD_MAX_POSITION] = .BUFFER [BD_FILE_POSITION] +
.BUFFER [BD_DATA_COUNT];
)%
end
until (%CMP32 (FILE [FD_CURRENT_POSITION] , geq , BUFFER [BD_FILE_POSITION])
and
%CMP32 (FILE [FD_CURRENT_POSITION] , lss , BUFFER [BD_MAX_POSITION]));
%MOV32 (FILE [FD_CURRENT_POSITION] , TEMP32);
%SUB32 (BUFFER [BD_FILE_POSITION] , TEMP32);
%MOVF32 (TEMP32 , BUFFER [BD_CURRENT_POSITION]);
%( BUFFER [BD_CURRENT_POSITION] = .FILE [FD_CURRENT_POSITION] -
.BUFFER [BD_FILE_POSITION];)%
BUFFER [BD_REMAINING_COUNT] = .BUFFER [BD_DATA_COUNT] -
.BUFFER [BD_CURRENT_POSITION];
BUFFER [BD_POINTER] = ch$ptr (.BUFFER [BD_ADDRESS],
(.BUFFER [BD_CURRENT_POSITION] +
.BUFFER [BD_BIAS]),
BYTE_SIZE);
end;
tes;
!
! Buffer now has valid data.
! File is now positioned by amount of data read.
!
BUFFER [BD_VALID] = $TRUE;
return $TRUE
end; !End of READ_FILE
%routine ('WRITE_FILE', FILE : ref FILE_DATA_BLOCK) =
!++
! Functional description
!
! This routine writes a buffer (the current one) to the specified
! location in the file. The whole page is written to the file.
!
! Note: This routine does not handle multi-buffering!!
! This routine does not handle non-contiguous writes!!
!
! Formal parameters
!
! .FILE Address of file data block
!
! Implicit inputs:
!
! File level
!
! FD_LOCAL flag to indicate local or remote file system
! FD_FORMAT value indicating type of file being written
! FD_JFN TOPS20 JFN of output file
! FD_BYTE_SIZE number of bits per byte in buffer
! FD_RESPONSE pointer to response buffer (on errors only)
! FD_TYPE DECnet NM file type (on errors only)
!
! Buffer level
!
! BD_FILE_POSITION where to start writting data in file
! BD_ADDRESS address of buffer page containing data
! BD_DATA_COUNT number of bytes in buffer to be written
!
! Implicit outputs:
!
! File level
!
! FD_PAGE_COUNT number of pages that have been written to file
! FD_LENGTH number of bytes that have been written to file
! FD_FILE_POSITION byte position of page after written page
!
! Buffer level
!
! BD_VALID set to false to indicate buffer data block no
! longer describes a valid buffer
!
! Routine value
!
! $true if the write succeeds
! $false if the write fails, response pointer in the file data
! block is used to illuminate the error.
!
!--
begin
bind
BUFFER = (FILE [FD_CURRENT_BUFFER]) : ref BUFFER_DATA_BLOCK;
local
FILE_PAGE,
BUFFER_PAGE,
FLAG_COUNT;
if .FILE [FD_LOCAL]
then
return $FALSE
else
begin
local
RTN_COD;
RTN_COD = FAL_ACCESS (.FILE, DAP_PUT, .BUFFER [BD_LENGTH],
ch$ptr (.BUFFER [BD_ADDRESS],,8));
BUFFER [BD_VALID] = $FALSE;
%ADDI32 (.BUFFER [BD_DATA_COUNT] , FILE [FD_LENGTH]);
%MOV32 (BUFFER [BD_FILE_POSITION] , FILE [FD_FILE_POSITION]);
%ADDI32 (.BUFFER [BD_DATA_COUNT] , FILE [FD_FILE_POSITION]);
%(
FILE [FD_FILE_POSITION] = .BUFFER [BD_FILE_POSITION] +
.BUFFER [BD_DATA_COUNT];)%
return .RTN_COD;
end;
end; !End of WRITE_FILE
%routine ('CLOSE_FILE', FILE : ref FILE_DATA_BLOCK) =
!++
! Functional description:
!
!
! Formal parameters:
!
! .FILE Address of file data block
!
! Implicit inputs:
!
!
! Routine value:
!
! $true close succeeded
! $false close failed
!
! Note: Even if this routine fails, the file is no longer open
! for access. Close failure means that any changes written
! to a file may not be saved.
!
!--
begin
if .FILE [FD_LOCAL]
then
return $FALSE
else
begin
!
! Close file with FAL. Don't care if it fails.
!
FAL_ACCESS (.FILE,DAP_CLOSE,0,0);
!
! Close the logical link to FAL.
!
NMU$NETWORK_CLOSE (.FILE [FD_JFN], 0, 0);
end;
return $TRUE
end; !End of CLOSE_FILE
require 'FALACC'; ! Include common FAL access routine
! Local Modes:
! Mode:BLISS
! Auto Save Mode:2
! Comment Column:40
! Comment Rounding:+1
! End: