#ifndef __JALLOC_H__
#define __JALLOC_H__

typedef struct
{
	long	size;	
	long	used;
	int		block_size;
	long	blocks;
	long	first_free_block_idx; // The index in the bit map
	void	*heap;
	unsigned char	*bit_map;
} heapT;

heapT	*new_heap (long size, int block_size);
void	jree (void *p);
long	mem_used (void);
void	*jalloc (size_t size);
void	set_arena (heapT *h);
int 	test_jalloc (void* (*alloc)(size_t), void (*ree)(void *));

void    *jemset (void *dest, int c, size_t n);
void	*jemcpy (void *dest, const void *src, size_t n);
size_t	jstrlen (const char *);
char	*jstrdup (const char *);
int 	jstrcmp (const char *s1, const char *s2);
char    *jstrchr (char *s, int c);

int     save_heap (heapT *h, char *name);
heapT	*load_heap (char *name);

#endif

