home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff240.lzh / MemLib / memwatch.h < prev    next >
C/C++ Source or Header  |  1989-08-28  |  3KB  |  67 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  2. * |_o_o|\\ Copyright (c) 1989 The Software Distillery.                    *
  3. * |. o.| ||          All Rights Reserved                                  *
  4. * | .  | ||          Written by Doug Walker                               *
  5. * | o  | ||          The Software Distillery                              *
  6. * |  . |//           235 Trillingham Lane                                 *
  7. * ======             Cary, NC 27513                                       *
  8. *                    BBS:(919)-471-6436                                   *
  9. \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  10.  
  11. #ifdef MWDEBUG
  12.  
  13. #include <libraries/dos.h>  /* For def of BPTR */
  14.  
  15. #ifdef MANX
  16. #define MWARGS(a) /* No support for prototypes */
  17. #else
  18. #define MWARGS(a) a
  19. #endif
  20.  
  21. /* Flags for MWInit */
  22. #define MWF_EXT      0x00000001 /* Want to communicate w/ external func */
  23. #define MWF_NOLOG    0x00000002 /* No debug messages                    */
  24. #define MWF_NOCHECK  0x00000004 /* check mem whenever mem rtns called   */
  25. #define MWF_NOFREE   0x00000008 /* Don't free nonfreed memory           */
  26. #define MWF_NOFTRASH 0x00000010 /* Don't trash memory upon free         */
  27. #define MWF_NOFKEEP  0x00000040 /* Don't keep memory after free         */
  28. #define MWF_NOATRASH 0x00000020 /* Don't trash memory upon alloc        */
  29.  
  30. #define MWF_ACTIVE   0x80000000 /* PRIVATE - MemWatch is active          */
  31. #define MWF_ERROR    0x40000000 /* PRIVATE - Error discovered, terminate */
  32.  
  33. #define AllocMem(size,flags) MWAllocMem(size, flags, __FILE__, __LINE__)
  34. #define FreeMem(mem,size)    MWFreeMem(mem, size, 0)
  35. #define malloc(size)         MWAllocMem(size, 0, __FILE__, __LINE__)
  36. #define calloc(nelt,esize)   malloc((nelt)*(esize))
  37. #define free(mem)            MWFreeMem(mem, -1, 1)
  38.  
  39. /* realloc is not supported yet, but this will at least cause an undef */
  40. /* global when linking                                                 */
  41. #define realloc(mem,size)    MWrealloc(mem,size,__FILE__,__LINE__)
  42.  
  43. /* Flags to tell MWReport how much to report */
  44. #define MWR_NONE 0   /* Don't report anything; just return    */
  45. #define MWR_SUM  1   /* Report current and total usage        */
  46. #define MWR_FULL 2   /* Report on all outstanding allocations */
  47.  
  48. void MWInit      MWARGS((BPTR, LONG));
  49. void MWTerm      MWARGS((void));
  50. void *MWAllocMem MWARGS((long, long, char *, long));
  51. void MWFreeMem   MWARGS((void *, long, long));
  52. void MWCheck     MWARGS((void));
  53. void MWReport    MWARGS((char *, long));
  54. void MWLimit     MWARGS((LONG, LONG));
  55.  
  56. #else
  57.  
  58. /* No memory debugging - make everything go away */
  59.  
  60. #define MWInit(a,b)
  61. #define MWTerm()
  62. #define MWCheck()
  63. #define MWReport()
  64. #define MWLimit(a,b)
  65.  
  66. #endif
  67.