#ifndef MEM_INCLUDE
#define MEM_INCLUDE
#include "except.h"
extern Except_T Mem_failed;
extern void * Mem_alloc(long nbytes,const char * file,int line); // not initionlized !
extern void * Mem_calloc(long count,long nbytes,const char *file,int line ); //has ! These differences are similar to malloc calloc
extern void Mem_free(void *ptr,const char * file,int line );
extern void * Mem_resize(void *ptr,long nbytes,const char *file,int line );
/* when an except occurs,if log !=NULL,the interface will log it instead of putting out an exception */
extern void Mem_init(FILE *log);
//extern void Mem_log(FILE *log);
#define ALLOC(nbytes) Mem_alloc((nbytes),__FILE__,__LINE__ )
#define CALLOC(nbytes) Mem_calloc( (nbytes),__FILE,__LINE__)
#define NEW(p) ( (p)=ALLOC((long)sizeof(*p)) )
#define NEW0(p) ((p)=CALLOC((long)sizeof(*p)))
#define FREE(p) ((void)(Mem_free((p),__FILE__,__LINE__),(p)=0))
#define RESIZE(ptr,nbytes) ((ptr)=Mem_resize((ptr),nbytes,__FILE____LINE__))
#endif
#define MEM_INCLUDE
#include "except.h"
extern Except_T Mem_failed;
extern void * Mem_alloc(long nbytes,const char * file,int line); // not initionlized !
extern void * Mem_calloc(long count,long nbytes,const char *file,int line ); //has ! These differences are similar to malloc calloc
extern void Mem_free(void *ptr,const char * file,int line );
extern void * Mem_resize(void *ptr,long nbytes,const char *file,int line );
/* when an except occurs,if log !=NULL,the interface will log it instead of putting out an exception */
extern void Mem_init(FILE *log);
//extern void Mem_log(FILE *log);
#define ALLOC(nbytes) Mem_alloc((nbytes),__FILE__,__LINE__ )
#define CALLOC(nbytes) Mem_calloc( (nbytes),__FILE,__LINE__)
#define NEW(p) ( (p)=ALLOC((long)sizeof(*p)) )
#define NEW0(p) ((p)=CALLOC((long)sizeof(*p)))
#define FREE(p) ((void)(Mem_free((p),__FILE__,__LINE__),(p)=0))
#define RESIZE(ptr,nbytes) ((ptr)=Mem_resize((ptr),nbytes,__FILE____LINE__))
#endif