/*

    Interface definitions for bget.c, the memory management package.

*/
#ifndef _BGET_H_
#define _BGET_H_


#ifndef _
#ifdef PROTOTYPES
#define  _(x)  x		      /* If compiler knows prototypes */
#else
#define  _(x)  ()                     /* It it doesn't */
#endif /* PROTOTYPES */
#endif



/**
 * Some customization for Saturn:
 *  Added a buffer `tag' field, wich is used to differency the various memory
 *   tags that are present in Saturn hardware, like HRAM, LRAM, VDP1 RAM, cart RAM, etc.
 *   Hence, you can "select" the memory tag you want when allocating RAM.
 *
 *  Removed the prototypes of the functions that were not adapted for the customization.
 *   As the source code itself is still here, feel free to modify it to your needs.
**/

/* 
 * The buffer pool's `tag' information is used as a bit field.
 * Hence, multiple tags can be set to a buffer pool.
 */
typedef unsigned short buftag;
#define BGET_TAG_COUNT (sizeof(buftag) * 8)
#define BGET_ANY_TAG ( (1 << BGET_TAG_COUNT) - 1 )





typedef long bufsize;

void	bpool	    _((void *buffer, bufsize len, buftag tag));
void   *bget	    _((bufsize size, buftag tag));
//void   *bgetz	    _((bufsize size));
//void   *bgetr	    _((void *buffer, bufsize newsize));
void	brel	    _((void *buf));
//void	bectl	    _((int (*compact)(bufsize sizereq, int sequence),
//		       void *(*acquire)(bufsize size),
//		       void (*release)(void *buf), bufsize pool_incr));
void	bstats	    _((bufsize *curalloc, bufsize *totfree, bufsize *maxfree,
		       long *nget, long *nrel));
//void	bstatse     _((bufsize *pool_incr, long *npool, long *npget,
//		       long *nprel, long *ndget, long *ndrel));
//void	bufdump     _((void *buf));
//void	bpoold	    _((void *pool, int dumpalloc, int dumpfree));
//int	bpoolv	    _((void *pool));
#undef bufsize



#endif // _BGET_H_
