Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/mcb/xportx.req
There are no other files named xportx.req in the archive.
!                    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.

!+
!	XPORTX - XPORT extensions for Comm/Nets
!-

require 'BLI:XPORT';

literal
    xportx_version = 1,				! Version of XPORTX
    bits_byte = $xpo$bits_byte,			! Bits per byte
    bytes_word = %bpval / $xpo$bits_byte;	! Bytes per word

macro
    $addresx =
	%if %bliss (bliss36) %then $align (fullword) %fi
	$address %,

%if %bliss (bliss36)
%then
    $byte_string (length) =				! byte string for bliss36
	$align (unit)
	$xpo$field ( (((length)+3)/4) * %bpval, 0, 1 ) %,
%else
    $byte_string (length) =				! character string for bliss16 and bliss32
	$string (length) %,
%fi

    byt$ptr (addr, pos) =				! make 9-bit (or) 8-bit byte pointer
	ch$ptr (addr, pos, $xpo$bits_byte) %,

    byt$allocation (num) =
	ch$allocation (num, $xpo$bits_byte) %;



%if %bliss (bliss36)

%then	! (BLISS36)

    macro
	byt$tiny_string (num_addr, dest_ptr_addr) =
	    begin
	    local N;
	    N = .(num_addr);
	    ch$wchar_a (.N<0,8>, dest_ptr_addr)
	    end %,

	byt$short_string (num_addr, dest_ptr_addr) =
	    begin
	    local N;
	    N = .(num_addr);
	    ch$wchar_a (.N<0,8>, dest_ptr_addr);
	    ch$wchar_a (.N<8,8>, dest_ptr_addr)
	    end %,

	byt$long_string (num_addr, dest_ptr_addr) =
	    begin
	    local N;
	    N = .(num_addr);
	    ch$wchar_a (.N<0,8>, dest_ptr_addr);
	    ch$wchar_a (.N<8,8>, dest_ptr_addr);
	    ch$wchar_a (.N<16,8>, dest_ptr_addr);
	    ch$wchar_a (.N<24,8>, dest_ptr_addr)
	    end %,

	byt$number_string (num_addr, num_length, dest_ptr_addr) =
	    begin
	    local N;
	    N = .(num_addr);
	    incr I from 0 to num_length - 1 do
		ch$wchar_a (.N<.I^3,8>, dst_ptr_addr);
	    end %,

	byt$string_tiny (src_ptr_addr, num_addr) =
	    num_addr = ch$rchar_a (src_ptr_addr) %,

	byt$string_short (src_ptr_addr, num_addr) =
	    num_addr = ch$rchar_a (src_ptr_addr)
		+ (ch$rchar_a (src_ptr_addr))^+8 %,

	byt$string_long (src_ptr_addr, num_addr) =
	    num_addr = ch$rchar_a (src_ptr_addr)
		+ (ch$rchar_a (src_ptr_addr))^+8
		+ (ch$rchar_a (src_ptr_addr))^+16
		+ (ch$rchar_a (src_ptr_addr))^+24 %,

	byt$string_number (src_ptr_addr, num_length, num_addr) =
	    begin
	    num_addr = 0;
	    incr I from 0 to num_length-1 do
	    num_addr = .(num_addr) + (ch$rchar_a (src_ptr_addr)) ^+(.I * 8)
	    end %;


%else	! (BLISS16 or BLISS32)
    macro
	byt$tiny_string (num_addr, dest_ptr_addr) =
	    ch$wchar_a (.(num_addr), dest_ptr_addr) %,

	byt$short_string (num_addr, dest_ptr_addr) =
	    begin
	    builtin swab;
	    local NUM;
	    NUM = .(num_addr);
	    ch$wchar_a (.NUM, dest_ptr_addr);
	    swab (NUM);
	    ch$wchar_a (.NUM, dest_ptr_addr)
	    end %,

	byt$long_string (num_addr, dest_ptr_addr) =
	    begin
	    byt$short_string ((num_addr), (dest_ptr_addr));
	    byt$short_string ((num_addr)+2, (dest_ptr_addr))
	    end %,

	byt$number_string (num_addr, num_length, dest_ptr_addr) =
	    dest_ptr_addr = ch$move (num_length, ch$ptr (num_addr,,8), .(dest_ptr_addr)) %,

	byt$string_tiny (src_ptr_addr, num_addr) =
	    num_addr = ch$rchar_a (src_ptr_addr) %,

	byt$string_short (src_ptr_addr, num_addr) =
	    begin
	    (num_addr)<0,8> = ch$rchar_a (src_ptr_addr);
	    ((num_addr)+1)<0,8> = ch$rchar_a (src_ptr_addr)
	    end %,

	byt$string_long (src_ptr_addr, num_addr) =
	    begin
	    byt$string_short (src_ptr_addr, num_addr);
	    byt$string_short (src_ptr_addr, (num_addr)+2)
	    end %,

	byt$string_number (src_ptr_addr, num_length, num_addr) =
	    begin
	    ch$move (num_length, .(src_ptr_addr), num_addr);
	    src_ptr_addr = ch$plus (.src_ptr_addr, num_length)
	    end %;
%fi