#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "../cl/macros.h"
#include "../cl/attributes.h"
#include "cqp.h"
#include "eval.h"
#include "treemacros.h"
#include "tree.h"
#include "options.h"
#include "symtab.h"
#include "builtins.h"
#include "matchlist.h"
char* evaltree2searchstr | ( | Evaltree | etptr, | |
int * | length | |||
) |
Converts an evaluation tree to a string.
This is done by traversing the tree in infix order.
etptr | The evaluation tree to convert. | |
length | Size of the returned string is placed here. |
References cl_free, cl_malloc(), cl_strdup(), evaltree2searchstr(), leaf, e_tree::leaf, e_tree::left, left, e_tree::max, e_tree::min, node, e_tree::node, e_tree::op_id, e_tree::patindex, re_disj, re_od_concat, re_oi_concat, re_repeat, repeat_inf, repeat_none, e_tree::right, right, and e_tree::type.
Referenced by do_SearchPattern(), and evaltree2searchstr().
void free_booltree | ( | Constrainttree | ctptr | ) |
Deletes a boolean evaluation tree (recursive with depth-first).
ctptr | The Constrainttree to delete. |
References c_tree::args, c_tree::attr, bnode, CID, cl_delete_regex(), cl_free, cnode, c_tree::ctype, free_booltree(), c_tree::func, func, id_list, c_tree::idlist, int_leaf, c_tree::items, c_tree::label, c_tree::leaf, c_tree::left, _ActualParamList::next, c_tree::node, NORMAL, c_tree::nr_items, pa_ref, _ActualParamList::param, c_tree::pat_type, REGEXP, c_tree::right, c_tree::rx, sa_ref, sbound, string_leaf, c_tree::type, var_ref, c_tree::varName, and c_tree::varref.
Referenced by bool_and(), bool_implies(), bool_not(), bool_or(), do_RelExpr(), do_set_complex_target(), do_subset(), free_booltree(), free_environment(), and try_optimization().
void free_evaltree | ( | Evaltree * | etptr | ) |
Deletes an evaluation tree with the depth-first method.
etptr | The evaluation tree to delete. |
References DELETE_NODE, free_evaltree(), leaf, meet_union, node, re_disj, re_od_concat, re_oi_concat, re_repeat, and tabular.
Referenced by free_environment(), and free_evaltree().
void init_booltree | ( | Constrainttree * | ctptr | ) |
Initialises a boolean evaluation tree.
At the moment, this involved simply setting the Constrainttree to NULL.
ctptr | Pointer to the constrainttree to initialise. Note the Constrainttree type is itself a pointer, so this is underlyingly a pointer-to-pointer. |
void print_booltree | ( | Constrainttree | ctptr, | |
int | indent | |||
) |
References _Attribute::any, c_tree::args, c_tree::attr, b_and, b_implies, b_not, b_or, bnode, builtin_function, CID, cmp_eq, cmp_ex, cmp_get, cmp_gt, cmp_let, cmp_lt, cmp_neq, cnode, c_tree::constnode, c_tree::ctype, c_tree::dynattr, float_leaf, c_tree::func, func, id_list, c_tree::idlist, int_leaf, c_tree::items, c_tree::label, c_tree::leaf, c_tree::left, _builtinf::name, _label_entry::name, c_tree::negated, _ActualParamList::next, c_tree::node, NORMAL, c_tree::nr_items, c_tree::op_id, c_tree::pa_ref, pa_ref, _ActualParamList::param, c_tree::pat_type, c_tree::predef, print_booltree(), REGEXP, c_tree::right, sa_ref, sbound, string_leaf, tree_debug, c_tree::type, c_tree::val, var_ref, c_tree::varName, and c_tree::varref.
Referenced by print_booltree(), print_pattern(), and show_environment().
void print_evaltree | ( | int | envidx, | |
Evaltree | etptr, | |||
int | indent | |||
) |
Pretty-prints an evaluation tree.
This function traverses the evaluation tree in infix order and prints it appropriately indented.
envidx | Index into the Environment global array. | |
etptr | The evaluation tree to print. | |
indent | The indent level to start printing at. |
References _Attribute::any, e_tree::cooc, cooc_meet, cooc_union, Environment, e_tree::leaf, leaf, e_tree::left, e_tree::lw, e_tree::max, e_tree::max_dist, evalenv::MaxPatIndex, meet_union, e_tree::min, e_tree::min_dist, e_tree::next, e_tree::node, node, e_tree::op_id, e_tree::patindex, print_evaltree(), print_pattern(), print_rep_factor(), re_disj, re_od_concat, re_oi_concat, re_repeat, repeat_none, e_tree::right, e_tree::rw, e_tree::struc, e_tree::tab_el, tabular, and e_tree::type.
Referenced by do_SearchPattern(), print_evaltree(), and show_environment().
void print_pattern | ( | int | envidx, | |
int | index, | |||
int | indent | |||
) |
Pretty-prints {what??}.
envidx | Index into the Environment global array. | |
index | Index into the patternlist element of that element of environment. | |
indent | The indent level to start printing at. |
References Environment, IGNORE_CASE, IGNORE_DIAC, IGNORE_REGEX, MatchAll, Pattern, evalenv::patternlist, print_booltree(), and Tag.
Referenced by print_evaltree(), and show_patternlist().
void print_rep_factor | ( | int | i | ) |
Translates the symbolic value for the repetition arguments.
(The translated value is printed as a string to STDOUT.)
i | The repetition argument symbol to translate. |
References repeat_inf, and repeat_none.
Referenced by print_evaltree().
void show_patternlist | ( | int | eidx | ) |
Shows the contents of the patternlist.
(Prints to STDOUT.)
eidx | Index into the global Environment array, identifying the element whose patternlist is to be printed. |
References Environment, evalenv::MaxPatIndex, and print_pattern().
Referenced by show_environment().
Constraint* try_optimization | ( | Constraint * | tree | ) |
References c_tree::attr, b_or, bnode, CID, cl_malloc(), cmp_eq, cmp_neq, cnode, c_tree::constnode, c_tree::ctype, free_booltree(), free_matchlist(), id_list, c_tree::idlist, init_matchlist(), c_tree::items, c_tree::label, c_tree::leaf, c_tree::left, left, c_tree::negated, NEW_BNODE, c_tree::node, NORMAL, c_tree::nr_items, c_tree::op_id, c_tree::pa_ref, pa_ref, c_tree::pat_type, c_tree::right, right, Setop(), _Matchlist::start, string_leaf, _Matchlist::tabsize, c_tree::type, Union, and c_tree::val.
Referenced by bool_implies(), bool_or(), do_RelExExpr(), and do_RelExpr().