UNSAFE MODULE; IMPORT JunoValue, JunoRT; TYPE Byte = JunoRT.ByteCode; RefShort = UNTRACED REF ARRAY [0..ShortSize-1] OF Byte; RefUShort = UNTRACED REF ARRAY [0..UShortSize-1] OF Byte; RefULong = UNTRACED REF ARRAY [0..ULongSize-1] OF Byte; RefReal = UNTRACED REF ARRAY [0..RealSize-1] OF Byte; PROCEDURE JunoMarshal ReadShort (VAR a: BytePtr): Short = VAR res: Short; ra: RefShort := ADR(res); BEGIN FOR i := 0 TO ShortSize - 1 DO ra^[i] := a^; INC(a, ADRSIZE(a^)) END; RETURN res END ReadShort; PROCEDUREWriteShort (VAR a: BytePtr; sh: Short) = VAR ri: RefShort := ADR(sh); BEGIN FOR i := 0 TO ShortSize - 1 DO a^ := ri^[i]; INC(a, ADRSIZE(a^)) END END WriteShort; PROCEDUREReadUShort (VAR a: BytePtr): UShort = VAR res: UShort; ra: RefUShort := ADR(res); BEGIN FOR i := 0 TO UShortSize - 1 DO ra^[i] := a^; INC(a, ADRSIZE(a^)) END; RETURN res END ReadUShort; PROCEDUREWriteUShort (VAR a: BytePtr; us: UShort) = VAR ri: RefUShort := ADR(us); BEGIN FOR i := 0 TO UShortSize - 1 DO a^ := ri^[i]; INC(a, ADRSIZE(a^)) END END WriteUShort; PROCEDUREReadULong (VAR a: BytePtr): ULong = VAR res: ULong; ra: RefULong := ADR(res); BEGIN FOR i := 0 TO ULongSize - 1 DO ra^[i] := a^; INC(a, ADRSIZE(a^)) END; RETURN res END ReadULong; PROCEDUREWriteULong (VAR a: BytePtr; ul: ULong) = VAR ri: RefULong := ADR(ul); BEGIN FOR i := 0 TO ULongSize - 1 DO a^ := ri^[i]; INC(a, ADRSIZE(a^)) END END WriteULong; PROCEDUREReadReal (VAR a: BytePtr): JunoValue.Real = VAR res: JunoValue.Real; ra: RefReal := ADR(res); BEGIN FOR i := 0 TO RealSize - 1 DO ra^[i] := a^; INC(a, ADRSIZE(a^)) END; RETURN res END ReadReal; PROCEDUREWriteReal (VAR a: BytePtr; r: JunoValue.Real) = VAR rr: RefReal := ADR(r); BEGIN FOR i := 0 TO RealSize - 1 DO a^ := rr^[i]; INC(a, ADRSIZE(a^)) END END WriteReal; BEGIN END JunoMarshal.