[Oberon] A pseudo-problem?

Vasile Rotaru vrotaru at seznam.cz
Thu Nov 13 00:22:50 CET 2003


"Daniel Keller" <keller at creacare.com> wrote:


> Please do only use PC.Compile and report Bugs.
> 

 I don't know how but I cannot reproduct the reported behaviour. Too
bad, for my reputation...  Still, PC.Compile fail on this module


MODULE OFACalc; (** ObjectFull Abstract Calculator  **)

CONST
  plus  = 0;
  minus = 1;
  times = 2;
  div   = 3;
  equals  = 4;
  nop = 5;
  
  digits  = 10;
  ops   = 5;  (* array bounds *)

TYPE

  Component = OBJECT
  VAR 
    calc  : Calculator; (* 'up' reference *)
  END Component;
    
  Button  = OBJECT(Component)
  VAR 
    
    PROCEDURE Activate;
    BEGIN
    END Activate;
  END Button; 

  DigitBtn  = OBJECT(Button)
  VAR
    val : LONGINT;  (* 0 <= val <= 9 *)
    
    PROCEDURE Activate;
    BEGIN calc.DigitPressed(val);
    END Activate;
  END DigitBtn;

  OpBtn = OBJECT(Button)
  VAR
    op  : LONGINT;  (* plus <= op <= equals *)
    
    PROCEDURE Activate;
    BEGIN calc.OpPressed(op);
    END Activate;
  END OpBtn;
  
  Value = OBJECT(Component)
  VAR 
    repr  : ARRAY 32 OF CHAR;
    op  : LONGINT;
    val : LONGREAL;
    
    PROCEDURE UpdateVal (digit: LONGINT);
    BEGIN
    END UpdateVal;
    
    PROCEDURE SetOp (op0: LONGINT);
    BEGIN
    END SetOp;
    
    PROCEDURE Eval (num: LONGREAL; op: LONGINT);
    BEGIN
    END Eval;
  END Value;
  
  (* Auxiliary types, used for grouping related objects *)
  Buttons = RECORD
    digits  : ARRAY digits OF DigitBtn;
    ops : ARRAY ops OF OpBtn;
  END;
  
  Values  = RECORD
    res, last : Value;
  END;
  
  Calculator  = OBJECT
  VAR 
    values  : Values;
    buttons : Buttons;
    
    PROCEDURE DigitPressed (digit: LONGINT);
    BEGIN
      values.last.UpdateVal(digit);
    END DigitPressed;
    
    PROCEDURE OpPressed (op: LONGINT);
    BEGIN
      values.res.Eval(values.last.val, values.last.op);
      values.last.SetOp(op);
    END OpPressed;
    
  END Calculator;
  
END OFACalc.

   The problem still seems to be in the Buttons RECORD. Commenting out
the buttons field in the Calculator object helps. On the other side
changing the names of constants doesn't. A most irritating behaviour.
And the compilation fails with the same criptic (I insist on it)
message: "Compiling OFACalc (9/9) not done". For a change on a more
elaborate version of the same example it fails with (10/10) message.
Does it mean a progress???

  Regards, Vasile






More information about the Oberon mailing list