/*
 * $Id: malloc.h,v 1.1 2003/02/07 18:15:44 wheeler Exp $
 * $Log: malloc.h,v $
 * Revision 1.1  2003/02/07 18:15:44  wheeler
 * Fox's version of libultra and friends.
 *
 * Revision 1.8  1997/03/05  05:04:58  hayakawa
 * gccのワーニングに対応
 *
 * Revision 1.7  1997/02/07  10:27:34  hayakawa
 * Ｃ＋＋対応リンケージ
 *
 * Revision 1.6  1996/12/18  02:38:12  hayakawa
 * DisplayArena,CheckArena,MallocInit追加
 *
 * Revision 1.5  1996/12/18  02:03:35  hayakawa
 * realloc追加
 * realloc,freeのDEBUGバージョンの追加
 *
 * Revision 1.4  1996/11/01  09:22:57  hayakawa
 * 不要な #include を削除
 *
 * Revision 1.3  1996/10/25  14:03:30  hayakawa
 * __osで始まる関数をmallocから__osMallocに移した
 *
 * Revision 1.2  1996/10/24  00:46:53  hayakawa
 * malloc のデバッグインターフェース修正
 * ヘッダ追加
 *
 */

#ifndef __MALLOC_H_
#define __MALLOC_H_

#ifdef __cplusplus
extern "C" {
#endif
    
/*
 * size_t 型
 */
#if !defined(_SIZE_T) && !defined(_SIZE_T_)
#define _SIZE_T
#if (_MIPS_SZLONG == 32)
typedef unsigned int 	size_t;
#endif
#if (_MIPS_SZLONG == 64)
typedef unsigned long 	size_t;
#endif
#endif

#ifdef LIB_FOR_YOSHI

#ifdef __cplusplus
extern "C" {
#endif
//#include "/project/YOSHI/SRC/Malloc.h"
#include "/home/hayakawa/prj/PR/YOSHI/SRC/Malloc.h"
#ifdef __cplusplus
}
#endif

#define malloc Malloc
#define realloc Realloc
#define free Free
void *calloc(size_t nelem, size_t elsize);

#else  /* LIB_FOR_YOSHI */

void *malloc(size_t size);
void *realloc(void *ptr, size_t size);
void free(void *ptr);
void *calloc(size_t nelem, size_t elsize);
void MallocInit(void *base, size_t len);
#if DEBUG
#define malloc(size) malloc_DEBUG(size, __FILE__, __LINE__)
#define realloc(ptr, size) realloc_DEBUG(ptr, size, __FILE__, __LINE__)
#define free(ptr) free_DEBUG(ptr, __FILE__, __LINE__)
void *malloc_DEBUG(size_t size, const char *file, int line);
void *realloc_DEBUG(void *ptr, size_t size, const char *file, int line);
void free_DEBUG(void *ptr, const char *file, int line);
void DisplayArena(void);
int  CheckArena(void);
#endif

#endif /* LIB_FOR_YOSHI */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* __MALLOC_H_ */
