DIRECTORY Ascii USING [NUL], Inline USING [LowHalf, DBITAND, DBITOR, DBITXOR, DBITNOT, DBITSHIFT]; CRunTimeDefs: DEFINITIONS IMPORTS Inline = { -- INTERFACE CONSTANTS -- NUL: INTEGER = Ascii.NUL-0C; -- INTERFACE PROCEDURES -- -- First we define all the value-producing assignments -- which produce a value but also (as a side effect) -- assign a value to a variable PostInc: PROCEDURE [x: LONG POINTER TO LONG UNSPECIFIED, amount: INTEGER] RETURNS [LONG UNSPECIFIED] = INLINE { temp: LONG UNSPECIFIED ← x↑; x↑ ← x↑ + LONG[amount]; RETURN [temp] }; PostIncPtr: PROCEDURE [x: LONG POINTER TO LONG POINTER, amount: INTEGER] RETURNS [LONG POINTER] = INLINE { temp: LONG POINTER ← x↑; x↑ ← x↑ + LONG[amount]; RETURN [temp] }; PostDec: PROCEDURE [x: LONG POINTER TO LONG UNSPECIFIED, amount: INTEGER] RETURNS [LONG UNSPECIFIED] = INLINE { temp: LONG UNSPECIFIED ← x↑; x↑ ← x↑ - LONG[amount]; RETURN [temp] }; PostDecPtr: PROCEDURE [x: LONG POINTER TO LONG POINTER, amount: INTEGER] RETURNS [LONG POINTER] = INLINE { temp: LONG POINTER ← x↑; x↑ ← x↑ - LONG[amount]; RETURN [temp] }; PlusAssign: PROCEDURE [x: LONG POINTER TO LONG UNSPECIFIED, y: LONG INTEGER] RETURNS [LONG UNSPECIFIED] = INLINE { RETURN [x↑ ← x↑ + y]; }; PlusAssignPtr: PROCEDURE [x: LONG POINTER TO LONG POINTER, y: LONG INTEGER] RETURNS [LONG POINTER] = INLINE { RETURN [x↑ ← x↑ + y]; }; MinusAssign: PROCEDURE [x: LONG POINTER TO LONG UNSPECIFIED, y: LONG INTEGER] RETURNS [LONG UNSPECIFIED] = INLINE { RETURN [x↑ ← x↑ - y]; }; MinusAssignPtr: PROCEDURE [x: LONG POINTER TO LONG POINTER, y: LONG INTEGER] RETURNS [LONG POINTER] = INLINE { RETURN [x↑ ← x↑ - y]; }; MultiplyAssign: PROCEDURE [x: LONG POINTER TO LONG INTEGER, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [x↑ ← x↑ * y]; }; DivideAssign: PROCEDURE [x: LONG POINTER TO LONG INTEGER, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [x↑ ← x↑ / y]; }; ModulusAssign: PROCEDURE [x: LONG POINTER TO LONG INTEGER, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [x↑ ← x↑ MOD y]; }; ShiftLeftAssign: PROCEDURE [x: LONG POINTER TO LONG INTEGER, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [x↑ ← ShiftLeft[x↑, y]]; }; ShiftRightAssign: PROCEDURE [x: LONG POINTER TO LONG INTEGER, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [x↑ ← ShiftRight[x↑, y]]; }; BitAndAssign: PROCEDURE [x: LONG POINTER TO LONG INTEGER, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [x↑ ← BitAnd[x↑, y]]; }; BitOrAssign: PROCEDURE [x: LONG POINTER TO LONG INTEGER, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [x↑ ← BitOr[x↑, y]]; }; BitXorAssign: PROCEDURE [x: LONG POINTER TO LONG INTEGER, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [x↑ ← BitXor[x↑, y]]; }; -- Now we define the support procedures that are not directly -- implemented in Mesa and so must be implemented by inline -- procedures which call other inline procedures provided -- in the Mesa/Tajo environment. BitAnd: PROCEDURE [x, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [Inline.DBITAND[x, y]] }; BitOr: PROCEDURE [x, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [Inline.DBITOR[x, y]] }; BitXor: PROCEDURE [x, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [Inline.DBITXOR[x, y]] }; BitNot: PROCEDURE [x: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [Inline.DBITNOT[x]] }; ShiftLeft: PROCEDURE [x, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [Inline.DBITSHIFT[x, Inline.LowHalf[y]]] }; ShiftRight: PROCEDURE [x, y: LONG INTEGER] RETURNS [LONG INTEGER] = INLINE { RETURN [Inline.DBITSHIFT[x, -Inline.LowHalf[y]]] }; StringToArray: PROCEDURE [s: LONG STRING] RETURNS [LONG POINTER TO INTEGER]; }.