void clist_append(Clause c, Clist l);This routine appends a Clause to a Clist.
void clist_append_all(Clist l1, Clist l2);Append each member of l2 to l1, then zap l2. Do not refer to l2 after the call.
void clist_check(Clist l);This routine checks the integrity of a Clist. If any errors are found, a message is sent to stdout. This is used for debugging.
BOOL clist_empty(Clist lst);This function checks if a (non-NULL) Clist is empty.
void clist_free(Clist p);This routine frees an empty Clist. If the Clist is not empty, nothing happens.
Clist clist_init(char *name);This routine allocates and returns an empty Clist, which is a doubly-linked list of pointers to clauses. You give it a string (any length, which is copied), representing the name of the list. If don't wish to name the list, send NULL. (You can name the list later with name_clist().)
void clist_insert_after(Clause c, Clist_pos pos);This routine inserts a Clause after a given position in a Clist.
void clist_insert_before(Clause c, Clist_pos pos);This routine inserts a Clause before a given position in a Clist.
int clist_length(Clist l);
int clist_member(Clause c, Clist l);This Boolean routine checks if a Clause is a member of a Clist.
void clist_prepend(Clause c, Clist l);This routine inserts a Clause as the first member of a Clist.
void clist_remove(Clause c, Clist l);This routine removes a clause from a Clist. If the Clause occurs more than once in the Clist, the most recently inserted occurrence is removed. A fatal error occurs if the Clause is not in the Clist.
int clist_remove_all(Clause c);This routine removes a clause from all lists in which it occurs. The number of lists from which it was removed is returned.
void clist_remove_all_clauses(Clist l);This routine removes all clauses from a clist. The clauses are NOT deleted, even if they occur nowhere else.
void clist_zap(Clist l);For each Clause (occurrence) in a Clist, remove it, and if it occurs in no other Clist, call zap_clause() to delete the Clause. Then, free the Clist.
void fprint_clist(FILE *fp, Clist l);This routine prints (to FILE *fp) each clause in a Clist. If the Clist has a non-empty name, say "usable", the string "list(usable).\n" is printed first. The string "end_of_list.\n" is always printed at the end.
void fprint_clist_mem(FILE *fp, BOOL heading);This routine prints (to FILE *fp) memory usage statistics for data types associated with Clist. The Boolean argument heading tells whether to print a heading on the table.
int max_wt_in_clist(Clist l);Scan a Clist, and return the maximum clause weight seen.
void name_clist(Clist p, char *name);This routine names or renames a Clist. The string you supply can be any length and is copied.
void p_clist(Clist l);This routine prints (to stdout) each clause in a Clist. See fprint_clist().
void p_clist_mem();This routine prints (to stdout) memory usage statistics for data types associated with Clist.
typedef struct clist_pos * Clist_pos; typedef struct clist * Clist; struct clist { char *name; Clist_pos first, last; int length; }; struct clist_pos { Clist_pos prev, next; /* previous and next member of Clist */ Clist_pos nocc; /* next member of containment list */ Clist list; /* the head of the list */ Clause c; /* pointer to the clause */ };
An important property of Clists is that each clause knows what Clists it is on. In particular, each clause has a (singly linked) list of containing Clists, constructed from the same nodes as the ordinary Clist (see the definition of struct clist_pos).
These activities are projects of the Mathematics and Computer Science Division of Argonne National Laboratory.