80-Bus News

  

September-October 1983, Volume 2, Issue 5











Page 49 of 67











PROGRAM explain; VAR errnum : INTEGER; PROCEDURE getnum; {This routine extracts the number that followed the “explain” command from the CP/M default buffer. It is easily confused by silly input, although this will not do any harm, you just get told that there is no such error number. That’ll teach yout} VAR bytes, tens, units : CHAR; BEGIN tens := CHR(48); units := CHR(48); bytes := PEEK(128,CHAR); IF bytes = CHR(2) THEN unite := PEEK(130,CHAR); IF bytes = CHR(3) THEN BEGIN tens := PEEK(130,CHAR); units := PREK(131,CHAR) END; ot := ((ORD(tens)-48)*10)+0RD( units) 48 Y {Main program follows. It consists entirely of a call to the routine "getnum" followed by a monstrous CASE statement that prints out the appropriate error message. | BEGIN getnum; CASE errnum OF WRITELN(’Number too large.’); WRITELN(’Semi-colon expected.’); WRITELN(’Undeclared identifier.’); WRITELN( ‘Identifier expected.’ ); WRITELN(’Use "=", not ":=", in a conatant declaration.’); WRITELN(’"="" expected.’ ); WRITELN(’This identifier cannot begin a statement.’); WRITELN(’":=" expected.’); WRITELN(’")" expected.’); WRITELN(‘Wrong type.’); WRITELN(’"." expected.’); WRITELN(’Factor expected.’); WRITELN(’Constant expected.’); WRITELN(’This identifier is not a constant.’); WRITELN(’ “THEN” expected.’); WRITBLN(’"DO" expected.’); WRITELN(’’ "TO" or “DOWNTO” expected.’); WRITELN(’"(" expected.’); WRITELN( ‘Cannot write this type of expression.’); WRITELN(’"OF" expected.’); WRITELN(’"," expected.’); WRITELN(’":" expected.’); WRITELN(’ "PROGRAM" expected.’); BEGIN WRITELN(’Variable expected since parameter is a variable’); WRITELN(’ parameter.’) END; WRITELN(’"BEGIN" expected.’); WRITELN(’Variable expected in call to READ.’); WRITELN( ‘Cannot compare expressions of this type.’); WRITELN(’Should be either type INTEGER or type REAL.’ )5 WRITELN(’Cannot read this type of variable." ); WRITELN(’This identifier is not a type. ‘); WRITELN(’Exponent expected in real number.’)

eee ce ne ce oe ne

we ee oe 08 te oe —- -

ee Oe oe ae oe te ce te oe 08 oe _

ee

o _ mn

* ’

WRITELN(’Scalar expression (not numeric) expected.’);

WRITELN(’Null strings not allowed (use CHR(O)).’);

were expected.’);

WRITELN(’" |" expected.’);

WRITELN(’Array index type must be scalar.’);

WRITELN(’".." expected.’);

WRITELN(’"]" or "," expected in array declaration.’);

WRITELN(*Lowerbound greater than upperbound.’);

WRITELN(’Set too large (more than 256 possible elements).’);

WRITELN(’Function result must be type identifier.’);

WRITELN(’"," or "]" expected in set.’);

WRITELN(’".." or "," or "|" expected in set.’);

WRITELN(’Type of parameter must be a type identifier.’);

BEGIN WRITELN(’Null set cannot be the first factor in a non-’); WRITELN(’assignment statement.’) END;

WRITELN(’Scalar (including real) expected.’);

WRITELN(’Scalar (not including real) expected.’);

WRITELN(’Sets incompatible.’ );

WRITELN(’"<" and ">" cannot be used to compare sets.’);

BEGIN WRITELN(’" FORWARD", "LABEL", “CONST”, "VAR", "TYPE", or’) WRITELN(’ "BEGIN" expected.’) END;

WRITELN (‘Hexadecimal digit expected.’);

WRITELN(’Cannot POKE sets.’);

WRITELN(’Array too large (>64K).’);

WRITELN(’"END" or ";" expected in RECORD definition.’);

WRITELN(’Field identifier expected.’);

WRITELN(’Variable expected after "WITH".’);

WRITELN(’Variable in "WITH" must be of RECORD type.’);

BEGIN WRITELN(’Field identifier has not had associated “WITH"’); WRITELN(‘statement.’) END;

se ne 80 on Se 4 Oe on 06 ne 08 ne Oe oe

te oe ee ce oe

49

a eee ey

{Purists should not look at the next four messages, or they will be il1.}

59 60 61 62 63 64 65

66 67

68 69

70 Th

T2 13

ELSE END.

WRITELN(’Unsigned integer expected after "LABEL".’);

WRITELN(’Unsigned integer expected after "GOTO".’);

WRITELN(’This label is at the wrong level.’);

WRITELN(‘Undeclared label.’);

WRITELN(’Cannot assign or POKE files.’);

WRITELN(’Can only use equality tests for pointers.’);

BEGIN WRITELN(’The parameter of this procedure/function should’); WRITELN(’be of a FILE type.’) END;

WRITELN(’File buffer too large (>=256 records i.e. 32K)."’);

BEGIN WRITELN(’The only write parameter for integers with two’); WRITELN(’":"’’s is “erm:H".’) END;

WRITELN(’Strings may not contain end of line characters.’);

BEGIN WRITELN(’The parameter of NEW, MARK or RELEASE should be’); WRITELN(’a variable of pointer type.’) END;

WRITELN(’The parameter of ADDR should be a variable.’);

BEGIN WRITELN(’Al1] files must be FILEs of CHAR or subrange’); WRITELN(’thereof.’) BND;

BEGIN WRITELN(’Files may only be used as global variables or‘); WRITELN(’variable parameters.’) END;

: BEGIN WRITELN(’"RESET" and "REWRITE" may not be used on INPUT’);

WRITELN(’or OUTPUT.’) END WRITELN(’There is no such error number.’)

ee en ee oe we ee oe

oe ee

oe oe

oe oe

o


This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 49 of 67