#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include "../cl/globals.h"
#include "../cl/corpus.h"
#include "../cl/attributes.h"
#include "../cl/cdaccess.h"
#include "../cl/macros.h"
#include "../cl/special-chars.h"
#include "corpmanag.h"
#include "eval.h"
#include "ranges.h"
#include "output.h"
#include "matchlist.h"
#include "options.h"
#define SORT_DEBUG 0 |
Referenced by i2compare(), and SortExternally().
#define spaceship | ( | A, | |||
B | ) | ((A) > (B)) ? 1 : ((A) < (B)) ? -1 : 0 |
Referenced by random_compare().
#define USE_SORT_CACHE |
Referenced by SortSubcorpus().
int _RS_compare_ranges | ( | const void * | pa, | |
const void * | pb | |||
) |
Referenced by RangeSort().
int calculate_leftboundary | ( | CorpusList * | cl, | |
int | cpos, | |||
Context | spc | |||
) |
References calculate_ranges(), left, and right.
Referenced by expand_dataspace(), and findcorpus().
Boolean calculate_ranges | ( | CorpusList * | cl, | |
int | cpos, | |||
Context | spc, | |||
int * | left, | |||
int * | right | |||
) |
References ctxtsp::attrib, False, get_bounds_of_nth_struc(), get_nr_of_strucs(), get_num_of_struc(), get_struc_attribute(), MAX, MIN, cl::mother_size, ctxtsp::size, structure, True, ctxtsp::type, and word.
Referenced by calculate_leftboundary(), calculate_rightboundary(), and evaluate_target().
int calculate_rightboundary | ( | CorpusList * | cl, | |
int | cpos, | |||
Context | spc | |||
) |
References calculate_ranges(), left, and right.
Referenced by expand_dataspace(), findcorpus(), and simulate().
Boolean copy_intervals | ( | CorpusList * | cp, | |
Bitfield | intervals, | |||
int | mode, | |||
char * | subcorpname | |||
) |
References auto_save, cqpmessage(), delete_intervals(), dropcorpus(), duplicate_corpus(), BFBuf::elements, Error, False, findcorpus(), cl::mother_name, cl::name, RangeSetop(), RUnion, save_subcorpus(), cl::saved, SELECTED_LINES, cl::size, SUB, SYSTEM, toggle_bit(), cl::type, UNDEF, and UNSELECTED_LINES.
Boolean delete_interval | ( | CorpusList * | cp, | |
int | nr | |||
) |
References cl_free, False, cl::range, RangeSetop(), RReduce, cl::size, cl::sortidx, SUB, and cl::type.
Boolean delete_intervals | ( | CorpusList * | cp, | |
Bitfield | intervals, | |||
int | mode | |||
) |
References ALL_LINES, auto_save, cl_free, BFBuf::elements, False, get_bit(), cl::keywords, cl::range, RangeSetop(), RReduce, save_subcorpus(), SELECTED_LINES, cl::size, cl::sortidx, SUB, cl::targets, TEMP, touch_corpus(), True, cl::type, and UNSELECTED_LINES.
Referenced by copy_intervals(), do_delete_lines(), do_delete_lines_num(), do_reduce(), and do_StandardQuery().
void FreeSortClause | ( | SortClause | sc | ) |
References _sort_clause::attribute_name, and cl_free.
static int group2compare | ( | const void * | vidx1, | |
const void * | vidx2 | |||
) | [static] |
References current_sortidx, EvaluationIsRunning, group_first, group_size, i2compare(), s1, and s2.
Referenced by SortSubcorpus().
static int i2compare | ( | const void * | vidx1, | |
const void * | vidx2 | |||
) | [static] |
References break_ties, cl_cpos2id, cl_id2str, EvaluationIsRunning, MIN, s1, s2, SORT_DEBUG, sort_id_cache, srt_ascending, srt_end, srt_maptable, srt_reverse, srt_start, and srt_strcmp().
Referenced by group2compare(), and SortSubcorpus().
static int random_compare | ( | const void * | vidx1, | |
const void * | vidx2 | |||
) | [static] |
References random_sort_keys, cl::range, and spaceship.
Referenced by SortSubcorpusRandomize().
int RangeSetop | ( | CorpusList * | corpus1, | |
RangeSetOp | operation, | |||
CorpusList * | corpus2, | |||
Bitfield | restrictor | |||
) |
References cl_free, cl_malloc(), cl_realloc(), get_bit(), cl::keywords, cl::range, RangeSetop(), RDiff, RIntersection, RLeftMaximalMatches, RMaximalMatches, RMinimalMatches, RNonOverlapping, RReduce, rs_cp_range(), RUnion, RUniq, cl::size, cl::sortidx, cl::targets, and touch_corpus().
Referenced by copy_intervals(), delete_interval(), delete_intervals(), do_cut(), do_setop(), do_StandardQuery(), evaluate_subset(), expand_dataspace(), findcorpus(), prepare_Query(), RangeSetop(), and set_corpus_matchlists().
void RangeSort | ( | CorpusList * | c, | |
int | mk_sortidx | |||
) |
References _RS_compare_ranges(), cl_free, cl_malloc(), cqpmessage(), Error, cl::keywords, cl::name, cl::range, cl::size, cl::sortidx, SUB, cl::targets, TEMP, cl::type, and Warning.
Referenced by do_undump(), evaluate_target(), and set_target().
void rs_cp_range | ( | Range * | rng, | |
int * | target, | |||
int * | keyword, | |||
int | ins, | |||
CorpusList * | corpus, | |||
int | j | |||
) |
References cl::keywords, cl::range, and cl::targets.
Referenced by RangeSetop().
int SortExternally | ( | void | ) |
References cl_cpos2str, cl_free, cl_malloc(), cqpmessage(), Error, ExternalSortingCommand, KeywordField, cl::keywords, line, MatchEndField, MatchField, OpenTemporaryFile(), cl::range, cl::size, SORT_DEBUG, cl::sortidx, srt_anchor1, srt_anchor2, srt_ascending, srt_maptable, srt_offset1, srt_offset2, srt_reverse, TargetField, cl::targets, text_size, and Warning.
Referenced by SortSubcorpus().
int SortSubcorpus | ( | CorpusList * | cl, | |
SortClause | sc, | |||
int | count_mode, | |||
struct Redir * | redir | |||
) |
References access_corpus(), _sort_clause::anchor1, _sort_clause::anchor2, ATT_POS, _sort_clause::attribute_name, break_ties, TCorpus::charset, cl_cpos2id, cl_cpos2str, cl_free, cl_malloc(), cl_max_cpos, cl_strdup(), cl_string_canonical(), cl_string_maptable(), close_stream(), cl::corpus, cqp, cqpmessage(), current_sortidx, DEFAULT_ATT_NAME, Error, EvaluationIsRunning, find_attribute(), _sort_clause::flags, group2compare(), group_first, group_size, i2compare(), Info, insecure, install_signal_handler(), KeywordField, cl::keywords, latin1, MatchEndField, MatchField, cl::name, NoField, _sort_clause::offset1, _sort_clause::offset2, open_stream(), pretty_print, cl::range, cl::size, _sort_clause::sort_ascending, sort_id_cache, _sort_clause::sort_reverse, SortExternally(), cl::sortidx, srt_anchor1, srt_anchor2, srt_ascending, srt_end, srt_maptable, srt_offset1, srt_offset2, srt_reverse, srt_start, Redir::stream, TargetField, cl::targets, text_size, touch_corpus(), USE_SORT_CACHE, UseExternalSorting, Warning, and which_app.
int SortSubcorpusRandomize | ( | CorpusList * | cl, | |
int | seed | |||
) |
static int srt_strcmp | ( | unsigned char * | s1, | |
unsigned char * | s2, | |||
unsigned char * | maptable, | |||
int | reverse | |||
) | [static] |
References MIN.
Referenced by i2compare().
int break_ties [static] |
Referenced by i2compare(), and SortSubcorpus().
int* current_sortidx [static] |
Referenced by group2compare(), and SortSubcorpus().
int* group_first [static] |
Referenced by group2compare(), and SortSubcorpus().
int* group_size [static] |
Referenced by group2compare(), and SortSubcorpus().
unsigned int* random_sort_keys [static] |
Referenced by random_compare(), and SortSubcorpusRandomize().
int* sort_id_cache = NULL [static] |
Referenced by i2compare(), and SortSubcorpus().
FieldType srt_anchor1 [static] |
Referenced by SortExternally(), and SortSubcorpus().
FieldType srt_anchor2 [static] |
Referenced by SortExternally(), and SortSubcorpus().
int srt_ascending [static] |
Referenced by i2compare(), SortExternally(), and SortSubcorpus().
Attribute* srt_attribute [static] |
CorpusList* srt_cl [static] |
int * srt_end [static] |
Referenced by i2compare(), and SortSubcorpus().
unsigned char* srt_maptable [static] |
Referenced by i2compare(), SortExternally(), and SortSubcorpus().
int srt_offset1 [static] |
Referenced by SortExternally(), and SortSubcorpus().
int srt_offset2 [static] |
Referenced by SortExternally(), and SortSubcorpus().
int srt_reverse [static] |
Referenced by i2compare(), SortExternally(), and SortSubcorpus().
int* srt_start [static] |
Referenced by i2compare(), and SortSubcorpus().
int text_size [static] |
Referenced by compose_kwic_line(), SortExternally(), and SortSubcorpus().