typedef struct BLOCK {
	int size,biggest,totfree; char *base;
	struct PIECE *start,*upto; struct BLOCK *next;} Block;
typedef struct PIECE {
	char *data; int magic; int size; int isfree; int islocked; 
	struct PIECE *next,*last; struct BLOCK *block;} Piece;

char **p_malloc(int sz);
void p_free(char **p);
char *p_status(void);

void p_show(void);
void p_unsplit(Piece *p, char *text);
Block *p_init(int sz);
int p_try1(Block *b, Piece **p, int sz);
int p_got(Block *b, Piece *p, int sz);
Piece *p_new(int sz, void *data, Block *b, Piece *last, Piece *next);
Piece *p_split(Piece *p, int sz);
int p_compress1(Block *b);
int p_compress2(Block *b);
void p_lock(char **x);
void p_unlock(char **x);
char *p_show_blockn(int n);
