#include "parse_actions.h"
#include <stdlib.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdarg.h>
#include <unistd.h>
#include "../cl/globals.h"
#include "../cl/special-chars.h"
#include "../cl/attributes.h"
#include "../cl/macros.h"
#include "cqp.h"
#include "options.h"
#include "ranges.h"
#include "symtab.h"
#include "treemacros.h"
#include "tree.h"
#include "eval.h"
#include "corpmanag.h"
#include "regex2dfa.h"
#include "builtins.h"
#include "groups.h"
#include "targets.h"
#include "attlist.h"
#include "concordance.h"
#include "output.h"
#include "print-modes.h"
#include "variables.h"
CorpusList* ActivateCorpus | ( | CorpusList * | cl | ) |
References Activation, cqpmessage(), CurEnv, Error, generate_code, inhibit_activation, last_cyc, Message, next_environment(), and evalenv::query_corpus.
References cl_malloc(), generate_code, e_tree::max_dist, e_tree::min_dist, e_tree::next, node, e_tree::patindex, ctxtsp::size, ctxtsp::size2, e_tree::tab_el, tabular, and e_tree::type.
void addHistoryLine | ( | void | ) |
References cqp_history_file, cqpmessage(), Error, OpenFile(), QueryBuffer, reading_cqprc, silent, and write_history_file.
void after_CorpusCommand | ( | CorpusList * | cl | ) |
References Activation, auto_save, autoshow, catalog_corpus(), False, GlobalPrintMode, last_cyc, LastExpression, NoExpression, Query, QueryBuffer, QueryBufferOverflow, save_subcorpus(), cl::saved, set_current_corpus(), SetOperation, silent, cl::size, SUB, subquery, and cl::type.
CorpusList* after_CorpusSetExpr | ( | CorpusList * | cl | ) |
References cqpmessage(), CurEnv, Error, generate_code, last_cyc, next_environment(), evalenv::query_corpus, and SetOperation.
CorpusList* after_Query | ( | CorpusList * | cl | ) |
References cl_free, cl_strdup(), generate_code, last_cyc, cl::name, Query, cl::query_corpus, cl::query_text, QueryBuffer, QueryBufferOverflow, QueryBufferP, and within_gc.
Constrainttree bool_and | ( | Constrainttree | left, | |
Constrainttree | right | |||
) |
References b_and, bnode, cnode, c_tree::constnode, free_booltree(), generate_code, c_tree::left, NEW_BNODE, c_tree::node, c_tree::op_id, c_tree::right, c_tree::type, and c_tree::val.
Constrainttree bool_implies | ( | Constrainttree | left, | |
Constrainttree | right | |||
) |
References b_implies, bnode, bool_not(), cnode, c_tree::constnode, free_booltree(), generate_code, c_tree::left, NEW_BNODE, c_tree::node, c_tree::op_id, c_tree::right, try_optimization(), c_tree::type, and c_tree::val.
Constrainttree bool_not | ( | Constrainttree | left | ) |
References b_not, bnode, cnode, c_tree::constnode, free_booltree(), generate_code, id_list, c_tree::idlist, c_tree::left, c_tree::negated, NEW_BNODE, c_tree::node, c_tree::op_id, c_tree::right, c_tree::type, and c_tree::val.
Referenced by bool_implies().
Constrainttree bool_or | ( | Constrainttree | left, | |
Constrainttree | right | |||
) |
References b_or, bnode, cnode, c_tree::constnode, free_booltree(), generate_code, c_tree::left, NEW_BNODE, c_tree::node, c_tree::op_id, c_tree::right, try_optimization(), c_tree::type, and c_tree::val.
void debug_output | ( | void | ) |
References eep, show_compdfa, show_environment(), show_evaltree, show_gconstraints, and show_patlist.
void do_AddSubVariables | ( | char * | var1Name, | |
int | add, | |||
char * | var2Name | |||
) |
References cl_free, cqpmessage(), Error, FindVariable(), GetVariableStrings(), VariableAddItem(), and VariableSubtractItem().
int do_AnchorPoint | ( | FieldType | field, | |
int | is_closing | |||
) |
void do_attribute_show | ( | char * | name, | |
int | status | |||
) |
References _context_description_block::alignedCorpora, ATT_STRUC, _context_description_block::attributes, CD, cl::corpus, cqpmessage(), current_corpus, DEFAULT_ATT_NAME, Error, find_attribute(), FindInAL(), generate_code, _attlist::list, _attrbuf::next, _context_description_block::print_cpos, show_targets, _attrbuf::status, and _context_description_block::strucAttributes.
void do_cat | ( | CorpusList * | cl, | |
struct Redir * | r, | |||
int | first, | |||
int | last | |||
) |
References catalog_corpus(), cqpmessage(), GlobalPrintMode, Message, and cl::name.
void do_cut | ( | CorpusList * | cl, | |
int | first, | |||
int | last | |||
) |
References cqpmessage(), Error, generate_code, cl::range, RangeSetop(), RReduce, cl::size, SUB, touch_corpus(), cl::type, and Warning.
void do_delete_lines | ( | CorpusList * | cl, | |
FieldType | f, | |||
int | mode | |||
) |
References cqpmessage(), create_bitfield(), delete_intervals(), destroy_bitfield(), Error, generate_code, KeywordField, cl::keywords, MatchEndField, MatchField, NoField, set_bit(), cl::size, SUB, TargetField, cl::targets, cl::type, and Warning.
void do_delete_lines_num | ( | CorpusList * | cl, | |
int | start, | |||
int | end | |||
) |
References cqpmessage(), create_bitfield(), delete_intervals(), destroy_bitfield(), Error, generate_code, nr_bits_set(), SELECTED_LINES, set_bit(), cl::size, SUB, and cl::type.
void do_Description | ( | Context * | context, | |
int | nr, | |||
char * | name | |||
) |
References ATT_STRUC, ctxtsp::attrib, cqpmessage(), Environment, Error, find_attribute(), generate_code, ctxtsp::size, structure, ctxtsp::type, and word.
void do_dump | ( | CorpusList * | cl, | |
int | first, | |||
int | last, | |||
struct Redir * | rd | |||
) |
References ascii, close_stream(), cqpmessage(), Error, cl::keywords, open_stream(), cl::range, cl::size, cl::sortidx, Redir::stream, and cl::targets.
void do_exec | ( | char * | fname | ) |
References cqp_parse_file(), cqpmessage(), Error, generate_code, Message, and OpenFile().
Constrainttree do_flagged_re_variable | ( | char * | varname, | |
int | flags | |||
) |
References cl_free, cl_malloc(), cqpmessage(), do_flagged_string(), Error, FindVariable(), generate_code, GetVariableStrings(), IGNORE_REGEX, and Warning.
Constrainttree do_flagged_string | ( | char * | s, | |
int | flags | |||
) |
References c_tree::canon, cl_new_regex(), cl_string_latex2iso(), cqpmessage(), c_tree::ctype, Error, generate_code, IGNORE_REGEX, latin1, c_tree::leaf, NEW_BNODE, NORMAL, c_tree::pat_type, REGEXP, c_tree::rx, string_leaf, and c_tree::type.
Referenced by do_flagged_re_variable(), do_mval_string(), and do_StringConstraint().
void do_group | ( | CorpusList * | cl, | |
FieldType | target, | |||
int | target_offset, | |||
char * | t_att, | |||
FieldType | source, | |||
int | source_offset, | |||
char * | s_att, | |||
int | cut, | |||
int | expand, | |||
struct Redir * | redir | |||
) |
References compute_grouping(), do_start_timer(), do_timing(), free_group(), and print_group().
void do_group2 | ( | CorpusList * | cl, | |
FieldType | target, | |||
int | target_offset, | |||
char * | t_att, | |||
int | cut, | |||
int | expand, | |||
struct Redir * | r | |||
) |
References compute_grouping(), do_start_timer(), do_timing(), free_group(), NoField, and print_group().
Constrainttree do_IDReference | ( | char * | id_name, | |
int | auto_delete | |||
) |
References ATT_POS, ATT_STRUC, c_tree::attr, cl_free, cl::corpus, cqpmessage(), CurEnv, c_tree::delete, Error, find_attribute(), _label_entry::flags, generate_code, LAB_SPECIAL, LAB_USED, c_tree::label, labellookup(), evalenv::labels, NEW_BNODE, c_tree::pa_ref, pa_ref, c_tree::sa_ref, sa_ref, c_tree::type, Warning, and within_gc.
void do_info | ( | CorpusList * | cl | ) |
References corpus_info().
Constrainttree do_LabelReference | ( | char * | label_name, | |
int | auto_delete | |||
) |
References ATT_POS, ATT_STRUC, c_tree::attr, cl_free, cl::corpus, cqpmessage(), CurEnv, c_tree::delete, Error, find_attribute(), _label_entry::flags, generate_code, LAB_SPECIAL, LAB_USED, c_tree::label, labellookup(), evalenv::labels, NEW_BNODE, c_tree::pa_ref, pa_ref, c_tree::sa_ref, sa_ref, structure_has_values(), c_tree::type, and Warning.
CorpusList* do_MUQuery | ( | Evaltree | evalt, | |
int | keep_flag, | |||
int | cut_value | |||
) |
References cqp_run_mu_query(), cqpmessage(), CurEnv, current_corpus, debug_output, do_start_timer(), Environment, evalenv::evaltree, generate_code, leaf, meet_union, Message, parseonly, evalenv::query_corpus, SUB, cl::type, e_tree::type, and Warning.
Constrainttree do_mval_string | ( | char * | s, | |
int | op, | |||
int | flags | |||
) |
References cl_malloc(), cqpmessage(), do_flagged_string(), Error, generate_code, IGNORE_REGEX, mval_string_conversion(), OP_CONTAINS, OP_MATCHES, and OP_NOT_MASK.
int do_NamedWfPattern | ( | int | is_target, | |
char * | label, | |||
int | pat_idx | |||
) |
void do_OptDistance | ( | Context * | context, | |
int | l_bound, | |||
int | u_bound | |||
) |
References ctxtsp::attrib, cqpmessage(), repeat_inf, ctxtsp::size, ctxtsp::size2, ctxtsp::type, Warning, and word.
void do_PrintAllVariables | ( | ) |
References printSingleVariableValue(), variables_iterator_new(), and variables_iterator_next().
void do_printVariableSize | ( | char * | varName | ) |
void do_PrintVariableValue | ( | char * | varName | ) |
References cqpmessage(), Error, FindVariable(), and printSingleVariableValue().
void do_reduce | ( | CorpusList * | cl, | |
int | number, | |||
int | percent | |||
) |
References cl_runif(), cqpmessage(), create_bitfield(), delete_intervals(), destroy_bitfield(), Error, generate_code, set_bit(), cl::size, SUB, cl::type, UNSELECTED_LINES, and Warning.
Constrainttree do_RelExExpr | ( | Constrainttree | left | ) |
References bnode, cmp_ex, generate_code, c_tree::left, NEW_BNODE, c_tree::node, c_tree::op_id, c_tree::right, try_optimization(), and c_tree::type.
Constrainttree do_RelExpr | ( | Constrainttree | left, | |
enum b_ops | op, | |||
Constrainttree | right | |||
) |
References c_tree::attr, bnode, cqpmessage(), c_tree::delete, Error, free_booltree(), generate_code, id_list, c_tree::idlist, c_tree::label, c_tree::left, NEW_BNODE, c_tree::node, c_tree::op_id, OptimizeStringConstraint(), c_tree::pa_ref, pa_ref, c_tree::right, string_leaf, try_optimization(), c_tree::type, var_ref, c_tree::varName, c_tree::varref, and Varref2IDList().
void do_save | ( | CorpusList * | cl, | |
struct Redir * | r | |||
) |
References cqpmessage(), DEFAULT_LOCAL_PATH_ENV_VAR, LOCAL_CORP_PATH, Message, Redir::name, cl::name, save_subcorpus(), and Warning.
void do_SearchPattern | ( | Evaltree | expr, | |
Constrainttree | constraint | |||
) |
void do_set_complex_target | ( | CorpusList * | cl, | |
FieldType | field_to_set, | |||
SearchStrategy | strategy, | |||
Constrainttree | boolt, | |||
enum ctxtdir | direction, | |||
int | number, | |||
char * | id, | |||
FieldType | field, | |||
int | inclusive | |||
) |
References evaluate_target(), free_booltree(), and generate_code.
void do_set_target | ( | CorpusList * | cl, | |
FieldType | goal, | |||
FieldType | source | |||
) |
References NoField, and set_target().
CorpusList* do_setop | ( | RangeSetOp | op, | |
CorpusList * | c1, | |||
CorpusList * | c2 | |||
) |
References cl::corpus, cqpmessage(), make_temp_corpus(), Message, cl::mother_name, cl::name, RangeSetop(), and Warning.
void do_SetVariableValue | ( | char * | varName, | |
char | operator, | |||
char * | varValues | |||
) |
References cl_string_latex2iso(), cqpmessage(), Error, FindVariable(), NewVariable(), SetVariableValue(), and Warning.
Constrainttree do_SimpleVariableReference | ( | char * | varName | ) |
References ATT_POS, cmp_eq, cl::corpus, cqpmessage(), def_unbr_attr, DEFAULT_ATT_NAME, Error, find_attribute(), generate_code, cl::name, set_string_option_value(), and Varref2IDList().
void do_size | ( | CorpusList * | cl, | |
FieldType | field | |||
) |
References KeywordField, cl::keywords, NoField, cl::size, TargetField, and cl::targets.
void do_sleep | ( | int | duration | ) |
Puts the program to sleep.
A wrapper round the standard sleep() function.
duration | How many seconds to sleep for. |
CorpusList* do_StandardQuery | ( | int | cut_value, | |
int | keep_flag | |||
) |
References cl_free, cqp_run_query(), cqpmessage(), create_bitfield(), current_corpus, debug_output, delete_intervals(), destroy_bitfield(), do_start_timer(), Environment, Error, generate_code, longest_match, matching_strategy, Message, parseonly, evalenv::query_corpus, RangeSetop(), RLeftMaximalMatches, RMaximalMatches, RMinimalMatches, searchstr, set_bit(), shortest_match, cl::size, standard_match, SUB, traditional, cl::type, UNSELECTED_LINES, and Warning.
void do_start_timer | ( | void | ) |
Starts the timer running.
References timer_start_time, and timing.
Referenced by do_group(), do_group2(), do_MUQuery(), do_StandardQuery(), and do_TABQuery().
Constrainttree do_StringConstraint | ( | char * | s, | |
int | flags | |||
) |
References ATT_POS, c_tree::attr, cmp_eq, cnode, cl::corpus, cqpmessage(), def_unbr_attr, DEFAULT_ATT_NAME, c_tree::delete, do_flagged_string(), Error, find_attribute(), generate_code, c_tree::label, left, cl::name, NEW_BNODE, OptimizeStringConstraint(), c_tree::pa_ref, pa_ref, right, set_string_option_value(), and c_tree::type.
void do_StructuralContext | ( | Context * | context, | |
char * | name | |||
) |
References ATT_STRUC, ctxtsp::attrib, cl::corpus, cqpmessage(), Error, find_attribute(), generate_code, TCorpus::id, ctxtsp::size, ctxtsp::size2, structure, ctxtsp::type, and word.
CorpusList* do_subset | ( | FieldType | field, | |
Constrainttree | boolt | |||
) |
References evaluate_subset(), free_booltree(), generate_code, progress_bar, and progress_bar_clear_line().
CorpusList* do_TABQuery | ( | Evaltree | patterns | ) |
References cqp_run_tab_query(), CurEnv, debug_output, do_start_timer(), Environment, evalenv::evaltree, generate_code, parseonly, evalenv::query_corpus, tabular, and e_tree::type.
void do_timing | ( | char * | msg | ) |
Shows the period since the timer started running.
msg | A message to print along with the reading from the timer. |
References cqpmessage(), Info, timer_start_time, and timing.
Referenced by do_group(), do_group2(), and in_UnnamedCorpusCommand().
int do_undump | ( | char * | corpname, | |
int | extension_fields, | |||
int | sort_ranges, | |||
struct InputRedir * | rd | |||
) |
References assign_temp_to_sub(), cl_free, cl_malloc(), close_input_stream(), cqpmessage(), current_corpus, drop_temp_corpora(), Error, findcorpus(), InputRedir::is_pipe, is_qualified(), line, make_temp_corpus(), MAX_LINE_LENGTH, cl::mother_name, cl::mother_size, new, open_input_stream(), RangeSort(), split_subcorpus_name(), InputRedir::stream, SYSTEM, cl::type, valid_subcorpus_name(), and Warning.
References cl_malloc(), e_tree::cooc, cooc_union, generate_code, e_tree::left, e_tree::lw, meet_union, e_tree::op_id, e_tree::right, e_tree::rw, and e_tree::type.
int do_WordformPattern | ( | Constrainttree | boolt, | |
int | lookahead | |||
) |
References cnode, c_tree::constnode, cqpmessage(), CurEnv, Error, False, generate_code, MatchAll, evalenv::MaxPatIndex, MAXPATTERNS, Pattern, evalenv::patternlist, c_tree::type, and c_tree::val.
int do_XMLTag | ( | char * | s_name, | |
int | is_closing, | |||
int | op, | |||
char * | regex, | |||
int | flags | |||
) |
References ATT_STRUC, cl_free, cl_malloc(), cl_new_attribute, cl_new_regex(), cl_strdup(), cl_string_latex2iso(), cl_struc_values, cl::corpus, cqpmessage(), CurEnv, Error, findlabel(), _label_entry::flags, generate_code, IGNORE_REGEX, LAB_DEFINED, LAB_RDAT, LAB_USED, labellookup(), evalenv::labels, latin1, evalenv::MaxPatIndex, MAXPATTERNS, Message, mval_string_conversion(), cl::name, OP_CONTAINS, OP_EQUAL, OP_MATCHES, OP_NOT, OP_NOT_MASK, evalenv::patternlist, strict_regions, and Tag.
void expand_dataspace | ( | CorpusList * | cl | ) |
References calculate_leftboundary(), calculate_rightboundary(), cqpmessage(), ctxtsp::direction, False, left, leftright, cl::needs_update, cl::range, RangeSetop(), right, RUniq, cl::saved, cl::size, ctxtsp::size, SYSTEM, True, cl::type, and Warning.
Referenced by in_UnnamedCorpusCommand().
Constrainttree FunctionCall | ( | char * | f_name, | |
ActualParamList * | apl | |||
) |
CorpusList* in_CorpusCommand | ( | char * | id, | |
CorpusList * | cl | |||
) |
References Assignment, cqpmessage(), current_corpus, duplicate_corpus(), is_qualified(), last_cyc, SYSTEM, True, cl::type, and Warning.
CorpusList* in_UnnamedCorpusCommand | ( | CorpusList * | cl | ) |
References cl_malloc(), generate_code, e_tree::max_dist, e_tree::min_dist, e_tree::next, node, e_tree::patindex, e_tree::tab_el, tabular, and e_tree::type.
char * mval_string_conversion | ( | char * | s | ) |
References cl_malloc(), cqpmessage(), Error, and generate_code.
Referenced by do_mval_string(), and do_XMLTag().
Constrainttree OptimizeStringConstraint | ( | Constrainttree | left, | |
enum b_ops | op, | |||
Constrainttree | right | |||
) |
References _Attribute::any, c_tree::attr, bnode, c_tree::canon, catch_unknown_ids, CDA_OK, cderrno, cdperror_string(), CID, cl_free, cl_idlist2freq, cl_malloc(), cl_max_cpos, cmp_eq, cmp_neq, cnode, collect_matching_ids(), c_tree::constnode, cqpmessage(), c_tree::ctype, c_tree::delete, Error, generate_code, get_id_of_string(), get_id_range(), id_list, c_tree::idlist, c_tree::items, c_tree::label, c_tree::leaf, c_tree::left, MAKE_IDLIST_BOUND, c_tree::negated, NEW_BNODE, c_tree::node, NORMAL, c_tree::nr_items, c_tree::op_id, c_tree::pa_ref, c_tree::pat_type, range, REGEXP, c_tree::right, c_tree::type, and c_tree::val.
Referenced by do_RelExpr(), and do_StringConstraint().
void prepare_AlignmentConstraints | ( | char * | id | ) |
void prepare_do_subset | ( | CorpusList * | cl, | |
FieldType | field | |||
) |
void prepare_input | ( | void | ) |
References free_environments(), generate_code, last_cyc, LastExpression, NoExpression, regex_string_pos, and searchstr.
void prepare_parse | ( | void | ) |
References cqpmessage(), generate_code, and Warning.
void prepare_Query | ( | ) |
void printSingleVariableValue | ( | Variable | v, | |
int | max_items | |||
) |
Prints the setting of a single Variable as an indented list.
References end_indented_list(), _variable_item::free, _variable_buf::items, _variable_buf::my_name, _variable_buf::nr_items, print_indented_list_item(), start_indented_list(), and _variable_item::sval.
Referenced by do_PrintAllVariables(), and do_PrintVariableValue().
void push_regchr | ( | char | c | ) |
References cqpmessage(), regex_string, regex_string_pos, and Warning.
void RaiseError | ( | void | ) |
References generate_code, and resetQueryBuffer().
References generate_code, NEW_EVALNODE, re_disj, and repeat_none.
References generate_code, NEW_EVALNODE, re_od_concat, and repeat_none.
void resetQueryBuffer | ( | void | ) |
References QueryBuffer, QueryBufferOverflow, and QueryBufferP.
Referenced by RaiseError().
Constrainttree Varref2IDList | ( | Attribute * | attr, | |
enum b_ops | op, | |||
char * | varName | |||
) |
References c_tree::attr, cmp_eq, cnode, c_tree::constnode, cl::corpus, cqpmessage(), c_tree::delete, Error, FindVariable(), generate_code, GetVariableItems(), id_list, c_tree::idlist, c_tree::items, c_tree::label, c_tree::negated, NEW_BNODE, node, c_tree::nr_items, c_tree::type, and c_tree::val.
Referenced by do_RelExpr(), and do_SimpleVariableReference().
int catch_unknown_ids = 0 |
Referenced by OptimizeStringConstraint().
Referenced by findcorpus().
int generate_code |
Referenced by ActivateCorpus(), add_tabular_pattern(), after_CorpusSetExpr(), after_Query(), bool_and(), bool_implies(), bool_not(), bool_or(), do_AnchorPoint(), do_attribute_show(), do_cut(), do_delete_lines(), do_delete_lines_num(), do_Description(), do_exec(), do_flagged_re_variable(), do_flagged_string(), do_IDReference(), do_LabelReference(), do_MeetStatement(), do_MUQuery(), do_mval_string(), do_NamedWfPattern(), do_reduce(), do_RelExExpr(), do_RelExpr(), do_SearchPattern(), do_set_complex_target(), do_SimpleVariableReference(), do_StandardQuery(), do_StringConstraint(), do_StructuralContext(), do_subset(), do_TABQuery(), do_UnionStatement(), do_WordformPattern(), do_XMLTag(), FunctionCall(), in_UnnamedCorpusCommand(), make_first_tabular_pattern(), mval_string_conversion(), OptimizeStringConstraint(), prepare_AlignmentConstraints(), prepare_do_subset(), prepare_input(), prepare_parse(), prepare_Query(), RaiseError(), reg_disj(), reg_seq(), and Varref2IDList().
CorpusList* old_query_corpus = NULL |
CorpusList* query_corpus = NULL |
Referenced by simulate().
char regex_string[1024] |
Referenced by push_regchr().
int regex_string_pos |
Referenced by prepare_input(), and push_regchr().
int sslen |
Referenced by do_SearchPattern().
struct timeval timer_start_time |
local variable for timing functions
Referenced by do_start_timer(), and do_timing().
int within_gc |
Referenced by after_Query(), do_IDReference(), and prepare_Query().
FILE* yyin |