g_twice.def 510 B

123456789101112
  1. GENERIC DEFINITION MODULE GTwice (T : TYPE);
  2. (* One generic instantiated twice with different scalar families. The
  3. forward pointer base (NodeRec declared after Node) used to make the
  4. second instance resolve the first instance's record. *)
  5. TYPE
  6. Node = POINTER TO NodeRec;
  7. NodeRec = RECORD val : T; next : Node END;
  8. Stack = RECORD top : Node; depth : INTEGER END;
  9. PROCEDURE Init (VAR s : Stack);
  10. PROCEDURE Push (VAR s : Stack; v : T);
  11. PROCEDURE Pop (VAR s : Stack; VAR v : T) : BOOLEAN;
  12. END GTwice.