Google
 

Trailing-Edge - PDP-10 Archives - msv11ck - 10,7/mail/mx/mxufil.req
There are 7 other files named mxufil.req in the archive. Click here to see a list.
literal
       FILE_KEEP = 0,
       FILE_ABORT = 1,
       FILE_DELETE = 2,
       FILE_ACCESS_READ_ONLY = 1,       ! File is read only
       FILE_ACCESS_WRITE_ONLY = 2,      ! File is write only
       FILE_ACCESS_APPEND_ONLY = 3;	! File is APPEND only.

!
! File system interface (MXUFIL)
!

macro
     MX$FILE_INITIALIZE = UF_INI %,
     MX$FILE_DELETE = UF_DEL %,            !***
     MX$FILE_SET_WRITER = UF_SWR %,
     MX$FILE_SIZE = UF_SIZE %,      !***
     MX$FILE_EXISTS = UF_XST %,
     MX$FILE_COPY = UF_CPY %,
     MX$FILE_WRITTEN_DATE = UF_DAT %,      !***
     MX$FILE_RENAME = UF_REN %,            !***
     MX$FILE_OPEN = UF_OPEN %,
     MX$FILE_READ = UF_READ %,
     MX$FILE_WRITE = UF_WRITE %,
!    MX$FILE_SKIP = UF_SKIP %,
     MX$FILE_SEEK = UF_SEEK %,
     %if %SWITCHES(TOPS10)
     %then
        MX$FILE_BUILD_BUFFERS = UF_BLD %,
        MX$FILE_KILL_BUFFERS = UF_KIL %,
        MX$FILE_STRUCTURE = UF_STR %,
     %fi
     MX$FILE_CLOSE = UF_CLOSE %,

     MX$FILE_ROUTINES =
         MX$FILE_DELETE,
         MX$FILE_SET_WRITER,
         MX$FILE_SIZE,
         MX$FILE_EXISTS,
         MX$FILE_COPY,
         MX$FILE_WRITTEN_DATE,
         MX$FILE_RENAME,
         MX$FILE_OPEN,                 ! Open file
         MX$FILE_READ,                 ! Read record from file
         MX$FILE_WRITE,		! Write record to file
!        MX$FILE_SKIP,                 ! Skip over bytes in a file
         MX$FILE_SEEK,                 ! Seek to specified byte in file
	 MX$FILE_SIZE,
         %if %SWITCHES(TOPS10)
         %then
             MX$FILE_BUILD_BUFFERS,	! Allocate I/O buffer ring
             MX$FILE_KILL_BUFFERS: novalue,	! Deallocate I/O buffer ring
             MX$FILE_STRUCTURE,         !Return Sixbit structure name
         %fi
         MX$FILE_CLOSE                 ! Close file
     %;
!
! Macros:
!

!	$P (mask) - Calculate bit position of a literal mask
!
!		where mask is a literal or symbol which defines a
!               field as a series of contiguous bits
!
!		returns pos, which may be used in a context such
!               as, ADDRESS<pos,siz>, or FIELD_NAME = [ADDR,pos,siz,sgn]
!

MACRO $p (mask) =
      %NBITSU (mask  AND  - mask) - 1 % ;


!	$S (mask) - Calculate size in bits of a literal mask
!
!		where mask is a literal or symbol which defines a
!               field as a series of contiguous bits
!
!		returns siz, which may be used in a context such
!               as, ADDRESS<pos,siz>, or FIELD_NAME = [ADDR,pos,siz,sgn]
!

MACRO $s (mask) =
      %NBITSU (mask) - %NBITSU (mask  AND  - mask) + 1 % ;


!	$P$S (mask) - Calculate bit position and size of a literal mask
!
!		where mask is a literal or symbol which defines a
!               field as a series of contiguous bits
!
!		returns "pos , siz", which may be used in a context such
!               as, ADDRESS<pos,siz>, or FIELD_NAME = [ADDR,pos,siz,sgn]
!
!		E.g, XCB_1 = [2,$P$S(XCB_MASK),0]

MACRO $p$s (mask) =
      $p (mask) , $s (mask) % ;

! The following macro is already defined on Tops-10 in TENDEF.
%if not %SWITCHES(TOPS10) %then
macro
     FLD (VAL, MASK) =
         ((VAL) ^ (%nbitsu(MASK  and  - MASK) - 1)) %;
%fi

MACRO			!Find the length of ASCIZ string...
    ch$length(ptr) =
	CH$DIFF( CH$FIND_CH( max_line_length, ptr, 0 ), ptr) %;

MACRO
     transfer_bytes(cnt, src, dst) =
              BEGIN
              dst = CH$MOVE(cnt, .src, .dst);
              src = CH$PLUS(.src, cnt);
              buffer [bd_remaining_count] = .buffer [bd_remaining_count] - cnt;
              file [fd_current_position] = .file [fd_current_position] + cnt;
     %IF %SWITCHES(TOPS20) %THEN
              buffer [bd_current_position] = .buffer [bd_current_position] +
                                              cnt;
     %FI
              END %;

%IF %SWITCHES(TOPS20) %THEN
MACRO
     file_sys_spec_fields =
         fd_jfn = [$INTEGER],           ! JFN of file
         fd_name = [$STRING (max_file_name_length + 1)], ! Buffer for file name
         fd_page_count = [$INTEGER]     ! Number of pages in file
         %;
%FI

%IF %SWITCHES(TOPS10) %THEN
MACRO
    file_sys_spec_fields =
	fd_channel = [$INTEGER],	! I/O channel for this file
	fd_lock_channel = [$INTEGER],	! I/O channel that we enqued on
	fd_filop_function = [$INTEGER],	! Filop Function to use for I/O
	fd_current_block = [$INTEGER],	! The current block number
	fd_block_count = [$INTEGER],	! Number of blocks in file
	fd_filop_block = [$sub_block($fofsp+1)],
        fd_lookup_block = [$sub_block(4)],
	fd_path_block = [$sub_block($ptmax)],
        fd_spec_block = [$sub_block(8)]
%;
%FI

MACRO
     file_data_block = BLOCK [file_data_block_size]
                       FIELD (file_data_fields) %;

MACRO
     buffer_data_block = BLOCK [buffer_data_block_size]
                         FIELD (buffer_data_fields) %;

MACRO
     file_name_block = BLOCK [file_name_fields_size]
                       FIELD (file_name_fields) %;

!
! Equated symbols:
!


LITERAL
       remote_buffer_length = 512,
       remote_buffer_allocation = CH$ALLOCATION (remote_buffer_length,8) * %UPVAL;

!
! Operating System Interface Definitions
!

%IF %SWITCHES(TOPS20) %THEN

LITERAL
       page_size = 512,
       bytes_per_page = 5 * page_size;

%FI

LITERAL
       max_line_length = 255;

!
! FILE DATA BLOCK Structure Field Names
!

$FIELD
      file_data_fields =
          SET
          file_sys_spec_fields,             ! system specific fields
          fd_access = [$TINY_INTEGER],      ! Accessing method
          fd_byte_size = [$TINY_INTEGER],   ! Byte size as per format
          fd_error = [$INTEGER],            ! Error code
          fd_current_position = [$INTEGER], ! Current byte offset as set by
                                            ! READ, SEEK, SKIP, or WRITE
          fd_file_position = [$INTEGER],    ! Position of next read from file
          fd_length = [$INTEGER],           ! Size of file in bytes
          fd_current_buffer = [$ADDRESS],   ! Address of current BD block
          fd_append_in_progress = [$BIT],   ! Seek to EOF done for APPEND
          fd_abort = [$BIT],                ! Do not save file on close
	  fd_delete = [$BIT],                ! Delete file on close
	  fd_light_new_mail_bit = [$BIT]    ! Light "new mail" bit on TOPS-10
          TES;

LITERAL
       file_data_block_size = $FIELD_SET_SIZE,
       file_data_block_allocation = $FIELD_SET_UNITS;

!
! BUFFER DATA BLOCK Structure Field Names
!

%IF %SWITCHES(TOPS20) %THEN
$FIELD
      buffer_data_fields =
          SET
          bd_next = [$ADDRESS],             ! Address of next BD in ring
          bd_address = [$ADDRESS],          ! Buffer base address
          bd_length = [$INTEGER],           ! Buffer length in bytes
          bd_allocation = [$INTEGER],       ! Buffer size in allocation units
          bd_file_position = [$INTEGER],    ! Buffer position in file
          bd_max_position = [$INTEGER],     ! End of buffer position in file
          bd_bias = [$INTEGER],             ! Buffer bias to start of data
          bd_current_position = [$INTEGER], ! Current position in buffer
          bd_pointer = [$POINTER],          ! Current pointer to buffer
          bd_data_count = [$INTEGER],       ! Bytes read/written in buffer
          bd_remaining_count = [$INTEGER],  ! Bytes yet to be read from
                                            ! or written to buffer
          bd_valid = [$BIT],                ! Buffer has valid data
          bd_end_of_file = [$BIT]           ! End of file flag
          TES;


%ELSE
$FIELD
      buffer_data_fields =
	SET
	bd_address		= [$INTEGER],	!$bfadr
	bd_pointer		= [$INTEGER],	!$bfptr
	bd_remaining_count	= [$INTEGER],	!$bfcnt
	bd_valid		= [$BIT],
	bd_end_of_file		= [$BIT]
	TES;
%FI

LITERAL
       buffer_data_block_size = $FIELD_SET_SIZE,
       buffer_data_block_allocation = $FIELD_SET_UNITS;

!
! File name block fields
!

$FIELD
      file_name_fields =
      SET
      fn_length = [$INTEGER],           ! Length of file specification string
      fn_pointer = [$POINTER]           ! Pointer file spec string
      TES;

LITERAL
       file_name_fields_size = $FIELD_SET_SIZE,
       file_name_fields_allocation = $FIELD_SET_UNITS;

%IF %SWITCHES(TOPS10) %THEN
!
! This macro computes the width of a bit mask
!

    MACRO
	wid (mask) = %NBITSU(mask) - (%NBITSU((mask) AND - (mask)) - 1) %,
	pos (mask) = (%NBITSU((mask) AND - (mask)) - 1) %,
	pw (mask) = pos(mask),wid(mask),0 %,
	wrd = 0,36,0 %,
	left_half = 18,18,0 %,
	left_half_s = 18,18,1 %,
	right_half = 0,18,0 %;

    FIELD
	filop_block_fields =
	SET
	filop_channel = [$fofnc, pw(fo$chn)],
	filop_function = [$fofnc, pw(fo$fnc)],
	filop_flags = [$fofnc, wrd],
	filop_open_flags = [$foios, wrd],
	filop_device = [$fodev, wrd],
	filop_output_buffer_header = [$fobrh, left_half],
	filop_input_buffer_header = [$fobrh, right_half],
	filop_buffer_headers = [$fobrh, wrd],
	filop_output_buffer_number = [$fonbf, left_half],
	filop_input_buffer_number = [$fonbf, right_half],
	filop_rename_pointer = [$foleb, left_half],
	filop_lookup_pointer = [$foleb, right_half],
	filop_enter_pointer = [$foleb, right_half],
	filop_ppn = [$foppn, wrd],
	filop_path_length = [$fopat, left_half],
	filop_path_pointer = [$fopat, right_half],
        filop_spec_length = [$fofsp, left_half],
        filop_spec_block = [$fofsp, right_half]
	TES;

    FIELD
	lookup_block_fields =
	SET
	lookup_name = [0, wrd],
	lookup_ext = [1, left_half],
        lookup_ppn = [3,wrd],
	lookup_length = [3, left_half_s],
	lookup_path = [3, right_half]
	TES;

    FIELD
        extended_lookup_block_fields =
        SET
        exlookup_zero = [$rbcnt,left_half],
        exlookup_count = [$rbcnt,right_half],
        exlookup_ppn = [$rbppn,wrd],
        exlookup_path = [$rbppn,wrd],
        exlookup_name = [$rbnam,wrd],
        exlookup_ext = [$rbext,left_half],
        exlookup_create_udt = [$rbtim,wrd]
        TES;

    FIELD
	path_block_fields =
	SET
	path_project = [$ptppn, left_half],
	path_programmer = [$ptppn, right_half],
	path_sfd = [$ptsfd, 0, 0, 0]
	TES;

    FIELD
        spec_block_fields =
        SET
        spec_device = [$fofdv, wrd]
        TES;

MACRO set_in_your_behalf(filop_block,lookup_block) =
BEGIN
  LOCAL tmp;
	IF .lookup_block[0,left_half] NEQ 0 THEN
	  tmp = .lookup_block[3,wrd]
	ELSE
	  tmp = .lookup_block[$rbppn,wrd];	!get possible PPN
	IF .tmp<left_half> EQL 0 THEN
	  tmp = .(.tmp + $ptppn);		!from path block maybe
	IF (filop_block[filop_ppn] = .tmp) NEQ 0 THEN
	  filop_block[filop_flags] = .filop_block[filop_flags] OR fo$prv;
END %;
%FI