Out.Mod 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. MODULE Out; (** AUTHOR "FOF"; PURPOSE "Simple console output, for educational purposes"; *)
  2. (* threadsafe as far as commands don't share the same context *)
  3. IMPORT Commands, Streams;
  4. PROCEDURE GetWriter*(): Streams.Writer;
  5. BEGIN
  6. RETURN Commands.GetContext().out;
  7. END GetWriter;
  8. PROCEDURE String*(CONST s: ARRAY OF CHAR);
  9. BEGIN
  10. Commands.GetContext().out.String(s);
  11. END String;
  12. PROCEDURE Char*(c: CHAR);
  13. BEGIN
  14. Commands.GetContext().out.Char(c);
  15. END Char;
  16. PROCEDURE Ln*();
  17. BEGIN
  18. Commands.GetContext().out.Ln();
  19. END Ln;
  20. PROCEDURE Set*(s: SET);
  21. BEGIN
  22. Commands.GetContext().out.Set(s);
  23. END Set;
  24. PROCEDURE Int*(i: HUGEINT; n = 1: LONGINT);
  25. BEGIN
  26. Commands.GetContext().out.Int(i,n);
  27. END Int;
  28. PROCEDURE Hex*(i: HUGEINT; n = -16: LONGINT);
  29. BEGIN
  30. Commands.GetContext().out.Hex(i,n);
  31. END Hex;
  32. PROCEDURE Address*(a: ADDRESS);
  33. BEGIN
  34. Commands.GetContext().out.Address(a);
  35. END Address;
  36. PROCEDURE Float*(x: LONGREAL; n = 4, f= 3, d=0: LONGINT);
  37. BEGIN
  38. Commands.GetContext().out.FloatFix(x,n,f,d);
  39. END Float;
  40. END Out.
  41. SystemTools.Free Out ~
  42. Out.Hello