/*
 * $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
 */

#ident	"$Header: allocate.h 1.1 89/10/25 $"


/*
 *  Allocate permanent storage.  This function is like malloc(), 
 *  except that the allocated storage can never be freed.
 *
 *  This function tries to reduce the number of times we call sbrk() by
 *  allocating a large piece of memory, and then doling out portions of the
 *  large piece until it is completely consumed.  Another large piece is
 *  then allocated when the first piece is consumed, and so on.
 *
 *  Since the allocated storage is never to be freed, we also skip all of
 *  the book-keeping work that malloc() does to support the later deallo-
 *  cation of memory.
 */
extern char *
perm_alloc(
	/* unsigned req_size;	-- request size in bytes */
);

/*
 *  Allocate a permanent string.
 *  The string can never be freed.
 */
extern char *
perm_str(
	/* char *str;		-- string to be permanently allocated */
);

/*
 *  Allocate a permanent list structure to contain the text: 'text' and
 *  add it to the head of the permanent list defined by 'list_headp.'
 *  The list element added to the head of the list cannot ever be freed.
 */
extern void
perm_to_head(
	/* struct list_head *list_headp;	-- list head */
	/* char *text;				-- text */
);

/*
 *  Allocate a permanent list structure to contain the text: 'text' and
 *  add it to the tail of the permanent list defined by 'list_headp.'
 *  The list element added to the tail of the list cannot ever be freed.
 */
extern void
perm_to_tail(
	/* struct list_head *list_headp;	-- list head */
	/* char *text;				-- text */
);

/*
 *  Allocate a reuseable list structure to contain the text: 'text' and
 *  add it to the tail of the reuseable list defined by 'list_headp.'
 *  The list element added to the tail of the list cannot ever be freed,
 *  except by using: free_list().
 */
extern void
reuseable_to_tail(
	/* struct list_head *list_headp;	-- list head */
	/* char *text;				-- text */
);

/*
 *  Free a linked list of list structures that were allocated
 *  via: reuseable_list().
 */
extern void
free_list(
	/* struct list *listp;			-- first element in list */
);

/*
 *  Allocate an expr structure.
 *  The expr element allocated cannot ever be freed,
 *  except by using: free_expr().
 */
extern struct expr *
new_expr();

/*
 *  Free an expression tree whose elements were allocated
 *  via: new_expr().
 */
extern void
free_expr(
	/* struct expr *exprp;			-- top element of expr tree */
);

/*
 *  Allocate an exprlist structure.
 *  The exprlist element allocated cannot ever be freed,
 *  except by using: free_exprlist().
 */
extern void
new_exprlist(
	/* struct exprlist **liststartp;	-- ptr to expression list */
	/* struct expr *expr;			-- expression to add to list */
);

/*
 *  Free a list of expressions whose elements were allocated
 *  via new_expr() and new_exprlist().
 */
extern void
free_exprlist(
	/* struct exprlist *exprlistp;		-- first expr in list */
);

/*
 *  Show list structure statistics.
 */
extern void
show_liststats();

/*
 *  Show expression structure statistics.
 */
extern void
show_exprstats();

/*
 *  Show exprlist structure statistics.
 */
extern void
show_exprliststats();
