/*
 * げんさんmalloc仕様
 */

#ifndef __SYS_GMALLOC_H_
#define __SYS_GMALLOC_H_

#include <ultratypes.h>         /* size_t */

#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#if 0
}
#endif

typedef enum SYS_GALC_RSV_e { /* gmalloc状態 */
    SYS_GALC_RSV_NONE = 0,
    SYS_GALC_RSV_REQUEST = 1,   /* メモリ要求 */
    SYS_GALC_RSV_RESERVE = 2,   /* メモリ予約 */
    SYS_GALC_RSV_READY   = 3,   /* メモリ用意完了 */
    SYS_GALC_RSV_ALLOCED = 4,   /* メモリ確保 */
    SYS_GALC_RSV_MAX
} SYS_GALC_RSV_e;

extern void sys_gmalloc_init(void); /* 初期化？ */
extern void sys_gmalloc_cleanup(void); /* 後始末？ */
extern void *sys_gmalloc_malloc_wait(size_t siz); /* 時間待ちをするmalloc */
extern void *sys_gmalloc_malloc_nowait(size_t siz); /* 時間待ちをしないmalloc */
extern void sys_gmalloc_free(void *ptr); /* 領域解放 */

/* 内部用グローバル変数 */
extern SYS_GALC_RSV_e sys_galloc_reserved; /* gmalloc状態 */
extern void *sys_galloc_reserved_ptr;      /* !NULL:予約フレームバッファ */

#define ESC_REVERSE		"\033[44;33m" /* 青地に黄色文字 */
#define ESC_NORMAL_LF		"\033[m\n" /* 元の色＆改行 */

#if 0
{
#endif
#ifdef _LANGUAGE_C_PLUS_PLUS
} /* extern "C" */
#endif

#endif /* __SYS_GMALLOC_H_ */
