2 * Copyright (c) 2000-2001
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 extern bool flag_occurs_check;
42 extern region term_sort_region;
43 extern term_hash term_sort_hash;
45 struct gen_term /* extends gen_e */
54 typedef struct gen_term *gen_term;
56 /* return TRUE if v occurs in e, fals otherwise */
57 typedef bool (* occurs_check_fn_ptr) (term_var v, gen_e e);
59 stamp term_get_stamp(gen_e e);
61 gen_e term_fresh(const char *name);
62 gen_e term_fresh_large(const char *name);
63 gen_e term_fresh_small(const char *name);
64 gen_e term_zero(void);
66 gen_e term_constant(const char *name);
68 bool term_is_zero(gen_e e);
69 bool term_is_one(gen_e e);
70 bool term_is_var(gen_e e);
71 bool term_is_constant(gen_e e);
73 char *term_get_constant_name(gen_e e);
74 gen_e term_get_ecr(gen_e e);
76 void term_unify(con_match_fn_ptr con_match, occurs_check_fn_ptr occurs,
78 void term_cunify(con_match_fn_ptr con_match, occurs_check_fn_ptr occurs,
81 void term_print_stats(FILE *f);
82 void term_print_constraint_graph(FILE *f);
85 void term_reset(void);
87 extern struct term_stats term_stats;
98 #endif /* TERM_SORT_H */