Thanks for any help.
Code: Select all
MODULE Pbox12B;
IMPORT TextModels, TextViews, Views, TextControllers, PboxMappers;
PROCEDURE PrintLine (x: REAL; IN f: PboxMappers.Formatter);
VAR
i, n: INTEGER;
BEGIN
ASSERT(x >= 0.0, 20);
f.WriteReal(x, 8, 1);
f.WriteString(" | ");
n := SHORT(ENTIER(x + 0.5));
FOR i := 1 TO n DO
f.WriteChar("*")
END;
f.WriteLn
END PrintLine;
PROCEDURE PrintHistogram*;
VAR
cn: TextControllers.Controller;
sc: PboxMappers.Scanner;
dataValue: REAL;
md: TextModels.Model;
vw: TextViews.View;
fm: PboxMappers.Formatter;
BEGIN
cn := TextControllers.Focus();
IF cn # NIL THEN
md := TextModels.dir.New();
fm.ConnectTo(md);
sc.ConnectTo(cn.text);
sc.ScanReal(dataValue);
WHILE ~sc.eot DO
PrintLine(dataValue, fm);
(* ra1 *)
sc.ScanReal(dataValue)
END;
vw := TextViews.dir.New(md);
Views.OpenView(vw)
END
END PrintHistogram;
END Pbox12B.