Out.Mod 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: WORD);
  25. BEGIN
  26. Commands.GetContext().out.Int(i,n);
  27. END Int;
  28. PROCEDURE Hex*(i: HUGEINT; n = -16: WORD);
  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: WORD);
  37. BEGIN
  38. Commands.GetContext().out.FloatFix(x,n,f,d);
  39. END Float;
  40. PROCEDURE Update*;
  41. BEGIN
  42. Commands.GetContext().out.Update();
  43. END Update;
  44. END Out.
  45. System.Free Out ~
  46. Out.Hello