(**********************************************************************) (* S T A N D A R D P R E F I X *) (**********************************************************************) CONST LINELENGTH = 132; TYPE LINE = ARRAY [1..LINELENGTH] OF CHAR; CONST IDLENGTH = 16; TYPE IDENTIFIER = ARRAY [1..IDLENGTH] OF CHAR; TYPE TEXT = FILE OF CHAR; text = TEXT; CONST MAXSTR = 10; {Length of Alfa strings } TYPE ALFA = ARRAY [1..MAXSTR] OF CHAR; alfa = ALFA; TYPE PROGRESULT = (TERMINATED, OVERFLOW, POINTERERROR, RANGEERROR, VARIANTERROR, HEAPLIMIT, STACKLIMIT, ABORTED); TYPE ARGTAG = (NILTYPE, BOOLTYPE, INTTYPE, IDTYPE); TYPE ARGTYPE = RECORD CASE TAG: ARGTAG OF NILTYPE, BOOLTYPE: (BOOL: BOOLEAN); INTTYPE: (INT: INTEGER); IDTYPE: (ID: IDENTIFIER) END; CONST MAXARG = 5; TYPE ARGLIST = ARRAY [1..MAXARG] OF ARGTYPE; PROCEDURE MARK(VAR TOP: INTEGER); PROCEDURE RELEASE(TOP: INTEGER); PROCEDURE RUN(ID: IDENTIFIER; VAR PARAM: ARGLIST; VAR LINE: INTEGER; VAR RESULT: PROGRESULT); PROCEDURE SYSTEM_DRIVE(VAR C: CHAR); PROCEDURE WORK_DRIVE(VAR C: CHAR); PROCEDURE ABORT; "TERMINATE PROGRAM IMMEDIATELY" (* PROCEDURES USED TO MANIPULATE ABSOLUTE MEMORY LOCATIONS. *) FUNCTION PEEK(LOC: INTEGER): INTEGER; (* READ BYTE *) FUNCTION PEEKW(LOC: INTEGER): INTEGER; (* READ WORD *) PROCEDURE POKE(LOC, VAL: INTEGER); (* WRITE BYTE *) PROCEDURE POKEW(LOC, VAL: INTEGER); (* WRITE WORD *) FUNCTION ODD(X: INTEGER): BOOLEAN; FUNCTION ROUND(X: REAL): INTEGER; (*********************************************************************) (* FILE I/O DEFINITIONS *) (*********************************************************************) PROCEDURE __GET(VAR F: TEXT); PROCEDURE __PUT(VAR F: TEXT); PROCEDURE __RDX(VAR C: CHAR); PROCEDURE __WRX(C: CHAR); FUNCTION EOLN(VAR F: UNIV TEXT): BOOLEAN; FUNCTION EOF(VAR F: UNIV TEXT): BOOLEAN; PROCEDURE __RLN; PROCEDURE __WLN; PROCEDURE __RWF(VAR F: TEXT; DUMMY1, DUMMY2: INTEGER); PROCEDURE __RWFS(VAR F: TEXT); { SHORT FORM OF RWF } PROCEDURE __EIO; PROCEDURE __RDI(VAR I: INTEGER; WIDTH, DIGITS: INTEGER); PROCEDURE __RDC(VAR C: CHAR; WIDTH, DIGITS: INTEGER); PROCEDURE __RDR(VAR R: REAL; WIDTH, DIGITS: INTEGER); PROCEDURE __WRI(I: INTEGER; WIDTH, DUMMY: INTEGER); PROCEDURE __WRC(C: CHAR; WIDTH, DUMMY: INTEGER); PROCEDURE __WRS(S: LINE; WIDTH, DUMMY: INTEGER); PROCEDURE __WRR(R: REAL; WIDTH, DIGITS: INTEGER); PROCEDURE _FRESET(SIZE: INTEGER; NAME: LINE); PROCEDURE _FREWRITE(SIZE: INTEGER; NAME: LINE); PROCEDURE _SRESET; PROCEDURE _SREWRITE; PROCEDURE BUFFER(VAR F: TEXT); (* TURN BUFFERING ON *) PROCEDURE UNBUFFER(VAR F: TEXT); (* TURN BUFFERING OFF *) PROCEDURE PAGE(VAR F: TEXT); (* OUTPUT FORM FEED *) PROCEDURE SETBIN(VAR F: TEXT); {Set binary file mode} (***********************************************************) (* STANDARD FUNCTIONS (TRIG, ETC) *) (***********************************************************) FUNCTION SIN(X: REAL): REAL; FUNCTION COS(X: REAL): REAL; FUNCTION ARCTAN(X: REAL): REAL; FUNCTION EXP(X: REAL): REAL; FUNCTION LN(X: REAL): REAL; FUNCTION SQRT(X: REAL): REAL; FUNCTION RND(X: REAL): REAL; PROGRAM P(VAR INPUT, OUTPUT: TEXT; VAR PARAM: ARGLIST);