tree.c File Reference

#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"

Functions


Function Documentation

char* evaltree2searchstr ( Evaltree  etptr,
int *  length 
)

Converts an evaluation tree to a string.

This is done by traversing the tree in infix order.

Parameters:
etptr The evaluation tree to convert.
length Size of the returned string is placed here.
Returns:
The resulting string.

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  ) 
void free_evaltree ( Evaltree etptr  ) 

Deletes an evaluation tree with the depth-first method.

Parameters:
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.

Parameters:
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 
)
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.

Parameters:
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??}.

Parameters:
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.)

Parameters:
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.)

Parameters:
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  ) 

Generated on Sun Feb 28 18:08:04 2010 for CWB by  doxygen 1.6.1