Oberon Community Platform Forum

Development => Oberon & Active Oberon => Topic started by: dukester on August 17, 2010, 05:34:39 PM



Title: OP2 => err 22 ")" missing
Post by: dukester on August 17, 2010, 05:34:39 PM
the code is from A2 Trace.Mod:

Code:
(** AUTHOR "fn"; PURPOSE "Low-level trace output based on KernelLog"; *)

MODULE Trace;

IMPORT SYSTEM;

TYPE
CharProc*= PROCEDURE (c:CHAR);
VAR
Char*: CharProc;
Color*: PROCEDURE (c: SHORTINT);

(** Send the specified characters to the trace output (cf. Streams.Sender). *)
PROCEDURE Send* (CONST buf: ARRAY OF CHAR; ofs, len: LONGINT; propagate: BOOLEAN; VAR res: LONGINT);
                ^
                |_________   err 22  ")" missing

 ???


Title: Re: OP2 => err 22 ")" missing
Post by: cfbsoftware on August 18, 2010, 12:58:36 AM
Code:
PROCEDURE Send* (CONST buf: ARRAY OF CHAR; ofs, len: LONGINT; propagate: BOOLEAN; VAR res: LONGINT);

The CONST modifier which indicates that a parameter is 'read-only' is a language feature that is not part of Oberon or Oberon-2. It is part of the Oberon-07 language specification and presumably is implemented as an extension in the compiler that this code was originally written for. Replace 'CONST buf' with 'VAR buf' for best performance or just 'buf' if you want to be sure it will not be modified by Send.


Title: Re: OP2 => err 22 ")" missing
Post by: dukester on August 18, 2010, 02:44:31 PM
Excellent! Thank you...

Is it fair to assume that the Oberon and Oberon-2 compilers "default" to err 22 if no other error message is apropos?


Title: Re: OP2 => err 22 ")" missing
Post by: cfbsoftware on August 19, 2010, 02:04:50 AM
Excellent! Thank you...

Is it fair to assume that the Oberon and Oberon-2 compilers "default" to err 22 if no other error message is apropos?

No - that is not fair ;)

What happened here is that the compiler detected the CONST keyword earlier than expected. It would have been valid if your code had been, for example:

PROCEDURE Send*(); CONST x = 1;

So in this case the best guess it could come up with is that you forgot the ')'.


Title: Re: OP2 => err 22 ")" missing
Post by: dukester on August 19, 2010, 06:01:35 AM
Thanks for clearing that up.