/* lp_lists.h
 * Neil Moore <neil@cs.uky.edu>
 * 30 Mar 1999
 *
 * Part of liblp.  See COPYRIGHT for copyright information.
 */
#ifndef _LP_LISTS_H_INCLUDED
#define _LP_LISTS_H_INCLUDED

#include <lp.h>


/* list of rules */
struct lp_rlist {
	struct lp_rule *rule;
	struct lp_rlist *next;
};


/* list of atoms or literals */
struct lp_alist {
	struct lp_atom *atom;
	struct lp_alist *next;
	int value; /* 0 = false, 1 = true */
};


/* list of vertices */
struct lp_vlist {
	struct lp_vtx *vertex;
	struct lp_vlist *next;
};


/* add an element to the beginning of a list */
void lp_rl_add(struct lp_rlist **list, struct lp_rule *r);
void lp_al_add(struct lp_alist **list, struct lp_atom *a);
void lp_vl_add(struct lp_vlist **list, struct lp_vtx *v);

/* remove and return an element from the beginning of a list */
struct lp_rule *lp_rl_pop(struct lp_rlist **list);
struct lp_atom *lp_al_pop(struct lp_alist **list);
struct lp_vtx  *lp_vl_pop(struct lp_vlist **list);

/* recursively free a list */
void lp_rl_free(struct lp_rlist *l);
void lp_al_free(struct lp_alist *l);
void lp_vl_free(struct lp_vlist *l);

#endif /* _LP_LISTS_H_INCLUDED */
