home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-30 | 927 b | 54 lines | [TEXT/PJMM] |
- unit MyAssertions;
-
- interface
-
- {$IFC undefined THINK_Pascal}
- uses
- Types;
- {$ENDC}
-
- procedure Assert (b: boolean);
- procedure AssertValidPtr (p: univ ptr);
- procedure AssertValidPtrNil (p: univ ptr);
- procedure AssertValidHandle (h: univ handle);
- procedure AssertValidHandleNil (h: univ handle);
-
- implementation
-
- {$IFC undefined THINK_Pascal}
- uses
- Memory;
- {$ENDC}
-
- procedure Assert (b: boolean);
- begin
- if not b then begin
- DebugStr('Assert Failed;sc;hc');
- end;
- end;
-
- procedure AssertValidPtr (p: univ ptr);
- begin
- Assert((p <> nil) & (not odd(ord(p))));
- end;
-
- procedure AssertValidPtrNil (p: univ ptr);
- begin
- if p <> nil then
- AssertValidPtr(p);
- end;
-
- procedure AssertValidHandle (h: univ handle);
- begin
- AssertValidPtr(h);
- AssertValidPtr(h^);
- Assert(RecoverHandle(h^) = h);
- end;
-
- procedure AssertValidHandleNil (h: univ handle);
- begin
- if h <> nil then
- AssertValidHandle(h);
- end;
-
- end.