/************************************************************************
* *
* Copyright (c) 1985 by *
* Digital Equipment Corporation, Maynard, MA *
* All rights reserved. *
* *
* The information in this software is subject to change without *
* notice and should not be construed as a commitment by Digital *
* Equipment Corporation. *
* *
* Digital assumes no responsibility for the use or reliability *
* of its software on equipment which is not supplied by Digital. *
* *
* Redistribution and use in source and binary forms are permitted *
* provided that the above copyright notice and this paragraph are *
* duplicated in all such forms and that any documentation, *
* advertising materials, and other materials related to such *
* distribution and use acknowledge that the software was developed *
* by Digital Equipment Corporation. The name of Digital Equipment *
* Corporation may not be used to endorse or promote products derived *
* from this software without specific prior written permission. *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED *
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.*
* Do not take internally. In case of accidental ingestion, contact *
* your physician immediately. *
* *
************************************************************************/
#ifndef _INCL_MNEMOSYNE_H
#include <stdio.h>
#include "mnemconf.h"
/*
$Header: RCS.h.mnemosyn 1.4 91/04/17 18:36:53 gtoal Exp Locker: gtoal $
*/
/* change function calls to macros returning area address
*/
/*
main include file for the mnemosyne memory allocation tracker. this file
provides some pre-processor fakes for malloc(), realloc() and family,
as well as forward declarations for the mnemosyne functions.
Marcus J. Ranum, 1990. (mjr@decuac.dec.com)
*/
/* these disguise mnemosyne calls as calls to malloc and family */
#ifndef NOFAKEMALLOC /* Can call them explicitly if macros cause problems */
/* knowing about __FILE__ is a weaker condition that knowing about stringizing */
#define strdup(s) mnem_strdup(s,__FILE__,__LINE__,__FUNCTION__)
#define malloc(siz) mnem_malloc(siz,__FILE__,__LINE__,__FUNCTION__)
#define calloc(siz,cnt) mnem_calloc(siz,cnt,__FILE__,__LINE__,__FUNCTION__)
#define realloc(ptr,siz) mnem_realloc(ptr,siz,__FILE__,__LINE__,__FUNCTION__, #ptr)
#define free(ptr) mnem_free(ptr,__FILE__,__LINE__,__FUNCTION__, #ptr)
#endif /* NOFAKEMALLOC */
#define mall_t void *
extern mall_t mnem_strdup(char *s, char *lab, int lin, char *caller);
extern mall_t mnem_malloc(unsigned siz, char *lab, int lin, char *caller);
extern mall_t mnem_calloc(unsigned cnt, unsigned siz, char *lab, int lin, char *caller);
extern mall_t mnem_realloc(mall_t ptr, unsigned siz, char *lab, int lin, char *caller, char *varname);
extern void mnem_free(mall_t ptr, char *lab, int lin, char *caller, char *varname);
/* explicit debugging assistance */
extern int mnem_checkptr(mall_t ptr, char *lab, int lin, char *caller, char *varname);
#define CHECKPTR(ptr) mnem_checkptr(ptr, __FILE__, __LINE__,__FUNCTION__, #ptr)
extern void mnem_checkheap(char *lab, int lin, char *caller);
#define CHECKHEAP() mnem_checkheap(__FILE__, __LINE__,__FUNCTION__)
/* some internal functions and oddimentia */
extern int mnem_recording(void);
extern int mnem_setrecording(int val);
extern void mnem_setlog(FILE *fp);
extern int mnem_writestats(void);
#define _INCL_MNEMOSYNE_H
#endif