Google
 

Trailing-Edge - PDP-10 Archives - BB-FB51A-RM - sna-ai/sources/xportx.r36
There are no other files named xportx.r36 in the archive.
!+
!	XPORTX - XPORT extensions for Comm/Nets
!-

require 'XPORT';

literal
    BITS_BYTE = $xpo$bits_byte,         ! Bits per byte
    BYTES_WORD = %bpval / $xpo$bits_byte; ! Bytes per word

%if %bliss (bliss36)
%then
macro
    $BYTE_STRING (LENGTH) =             ! byte string for bliss-36
	$align (unit)
	$xpo$field ((((LENGTH)+3)/4) * %bpval, 0, 1) %;
%else
macro
    $BYTE_STRING (LENGTH) =             ! character string for bliss-16 and 32
	$string (length) %;
%fi

macro
    BYT$PTR (ADDRESS, POSITION) =       ! make 9-bit (or) 8-bit byte pointer
	ch$ptr (ADDRESS, POSITION, $xpo$bits_byte) %;

macro
    BYT$ALLOCATION (NUMBER) =
	ch$allocation (NUMBER, $xpo$bits_byte) %;


%if %bliss (bliss36)
%then                                   ! (BLISS36)
macro
    BYT$TINY_STRING (NUMBER_ADDRESS, DESTINATION_PTR_ADDRESS) =
        begin
        local N;

        N = .(NUMBER_ADDRESS);
        ch$wchar_a (.N<0,8>, DESTINATION_PTR_ADDRESS);
        end %,

    BYT$SHORT_STRING (NUMBER_ADDRESS, DESTINATION_PTR_ADDRESS) =
        begin
        local N;

        N = .(NUMBER_ADDRESS);
        ch$wchar_a (.N<0,8>, DESTINATION_PTR_ADDRESS);
        ch$wchar_a (.N<8,8>, DESTINATION_PTR_ADDRESS);
        end %,

    BYT$LONG_STRING (NUMBER_ADDRESS, DESTINATION_PTR_ADDRESS) =
        begin
        local N;

        N = .(NUMBER_ADDRESS);
        ch$wchar_a (.N<0,8>, DESTINATION_PTR_ADDRESS);
        ch$wchar_a (.N<8,8>, DESTINATION_PTR_ADDRESS);
        ch$wchar_a (.N<16,8>, DESTINATION_PTR_ADDRESS);
        ch$wchar_a (.N<24,8>, DESTINATION_PTR_ADDRESS);
        end %,

    BYT$NUMBER_STRING (NUMBER_ADDRESS, LENGTH, DESTINATION_PTR_ADDRESS) =
        begin
        local N;

        N = .(NUMBER_ADDRESS);
        incr I from 0 to LENGTH - 1
        do ch$wchar_a (.N<.I^3,8>, DESTINATION_PTR_ADDRESS);
        end %,

    BYT$STRING_TINY (SOURCE_PTR_ADDRESS, NUMBER_ADDRESS) =
        NUMBER_ADDRESS = ch$rchar_a (SOURCE_PTR_ADDRESS) %,

    BYT$STRING_SHORT (SOURCE_PTR_ADDRESS, NUMBER_ADDRESS) =
        NUMBER_ADDRESS = ch$rchar_a (SOURCE_PTR_ADDRESS) +
                         (ch$rchar_a (SOURCE_PTR_ADDRESS)) ^ +8 %,

    BYT$STRING_LONG (SOURCE_PTR_ADDRESS, NUMBER_ADDRESS) =
        NUMBER_ADDRESS = ch$rchar_a (SOURCE_PTR_ADDRESS) +
                         (ch$rchar_a (SOURCE_PTR_ADDRESS)) ^ +8 +
                         (ch$rchar_a (SOURCE_PTR_ADDRESS)) ^ +16 +
                         (ch$rchar_a (SOURCE_PTR_ADDRESS)) ^ +24 %,

    BYT$STRING_NUMBER (SOURCE_PTR_ADDRESS, LENGTH, NUMBER_ADDRESS) =
        begin
        NUMBER_ADDRESS = 0;
        incr I from 0 to LENGTH - 1
        do NUMBER_ADDRESS = .(NUMBER_ADDRESS) +
                            (ch$rchar_a (SOURCE_PTR_ADDRESS)) ^ +(.I*8);
        end %;


%else                                   ! (BLISS16 or BLISS32)

macro
    BYT$TINY_STRING (NUMBER_ADDRESS, DESTINATION_PTR_ADDRESS) =
        ch$wchar_a (.(NUMBER_ADDRESS), DESTINATION_PTR_ADDRESS) %,

    BYT$SHORT_STRING (NUMBER_ADDRESS, DESTINATION_PTR_ADDRESS) =
        DESTINATION_PTR_ADDRESS = ch$move (2,
                                           ch$ptr (NUMBER_ADDRESS,,8),
                                           .(DESTINATION_PTR_ADDRESS)) %,

    BYT$LONG_STRING (NUMBER_ADDRESS, DESTINATION_PTR_ADDRESS) =
        DESTINATION_PTR_ADDRESS = ch$move (4,
                                           ch$ptr (NUMBER_ADDRESS,,8),
                                           .(DESTINATION_PTR_ADDRESS)) %,

    BYT$NUMBER_STRING (NUMBER_ADDRESS, LENGTH, DESTINATION_PTR_ADDRESS) =
        DESTINATION_PTR_ADDRESS = ch$move (LENGTH,
                                           ch$ptr (NUMBER_ADDRESS,,8),
                                           .(DESTINATION_PTR_ADDRESS)) %,

    BYT$STRING_TINY (SOURCE_PTR_ADDRESS, NUMBER_ADDRESS) =
        NUMBER_ADDRESS = ch$rchar_a (SOURCE_PTR_ADDRESS) %,

    BYT$STRING_SHORT (SOURCE_PTR_ADDRESS, NUMBER_ADDRESS) =
        begin
        ch$move (2, .(SOURCE_PTR_ADDRESS), ch$ptr (NUMBER_ADDRESS,,8));
        SOURCE_PTR_ADDRESS = ch$plus (.SOURCE_PTR_ADDRESS, 2);
        end %,

    BYT$STRING_LONG (SOURCE_PTR_ADDRESS, NUMBER_ADDRESS) =
        begin
        ch$move (4, .(SOURCE_PTR_ADDRESS), ch$ptr (NUMBER_ADDRESS,,8));
        SOURCE_PTR_ADDRESS = ch$plus (.SOURCE_PTR_ADDRESS, 4);
        end %,

    BYT$STRING_NUMBER (SOURCE_PTR_ADDRESS, LENGTH, NUMBER_ADDRESS) =
        begin
        ch$move (LENGTH, .(SOURCE_PTR_ADDRESS), NUMBER_ADDRESS);
        SOURCE_PTR_ADDRESS = ch$plus (.SOURCE_PTR_ADDRESS, LENGTH);
        end %;
%fi
! Local Modes:
! Mode:BLISS
! Auto Save Mode:2
! Comment Column:40
! Comment Rounding:+1
! End: