SYSTEM.DEF 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. (* ========================================================= *)
  2. (* Preliminary library module for Gardens Point Modula *)
  3. (* ========================================================= *)
  4. (* !SYSTEM! *) DEFINITION MODULE $SYSTEM$;
  5. (* This is a system module; it is known to the compiler and *)
  6. (* activated by import. It is pre-loaded, and thus has no *)
  7. (* symbol file. Some of the following declarations are sym- *)
  8. (* bolic only and use generic forms which cannot be compiled *)
  9. (* The system types have special semantics in most cases. *)
  10. TYPE SAL = "smallest addressable unit";
  11. BIN = [0 .. 31]; (* BITSET = SET OF BIN *)
  12. WORD = "natural word size";
  13. BYTE = SAL;
  14. ADDRESS = POINTER TO SAL;
  15. PROCEDURE ADR (VAR v : AnyType) : ADDRESS;
  16. (* returns storage address of the parameter *)
  17. PROCEDURE INCADR(a : ADDRESS; i : CARDINAL) : ADDRESS;
  18. (* returns the address a "incremented" by i *)
  19. PROCEDURE DECADR(a : ADDRESS; d : CARDINAL) : ADDRESS;
  20. (* returns the address a "decremented" by i *)
  21. PROCEDURE DIFADR(a, b : ADDRESS) : INTEGER;
  22. (* returns the difference (a - b) in bytes *)
  23. PROCEDURE TSIZE (AnyType; optional tags) : CARDINAL;
  24. (* returns storage size of t, ignoring tags *)
  25. PROCEDURE CAST (AnyType1; x : AnyType2) : AnyType1;
  26. (* returns x cast to type AnyType1, if poss *)
  27. (* ! there are some hardware restrictions ! *)
  28. PROCEDURE SHIFT (VAR b : BITSET, n : INTEGER);
  29. PROCEDURE ROTATE(VAR b : BITSET; n : INTEGER);
  30. (* the direction of shifts and rotates is *)
  31. (* such that
  32. b := BITSET{0};
  33. SHIFT(b,1);
  34. leaves b = BITSET{1}, rotate is same *)
  35. PROCEDURE CALL(callBody : AnyProcType;
  36. ... args for body if needed ...
  37. onError : Exceptions.RecoveryProc);
  38. (* semantics are as for Exceptions.Call, except *)
  39. (* that parameters may be passed to the callBody *)
  40. END SYSTEM.