d_lib.mod 328 B

12345678910111213141516
  1. IMPLEMENTATION MODULE DLib;
  2. VAR total : INTEGER;
  3. PROCEDURE Add(n : INTEGER);
  4. BEGIN
  5. total := total + n;
  6. counter := counter + n
  7. END Add;
  8. PROCEDURE Get() : INTEGER;
  9. BEGIN
  10. RETURN total + counter + step
  11. END Get;
  12. BEGIN
  13. (* preset proves the init body runs: zeroed globals would read 0 *)
  14. total := 0;
  15. counter := 2
  16. END DLib.