#include <math.h>
#include "../cl/cl.h"
#include "../cl/globals.h"
#include "../cl/corpus.h"
#include "../cl/attributes.h"
#include "../cl/storage.h"
#include "../cl/bitio.h"
#include "../cl/compression.h"
#define log2 | ( | x | ) | (log(x)/log(2.0)) |
void cleanup | ( | int | error_code | ) |
Cleans up memory prior to an error-prompted exit.
error_code | Value to be returned by the program when it exits. |
References debug_output, and drop_corpus().
Referenced by add_attribute(), compress_reversed_index(), decompress_check_reversed_index(), main(), show_position_values(), and usage().
void compress_reversed_index | ( | Attribute * | attr, | |
char * | output_fn | |||
) |
Compresses the reversed index of a p-attribute.
attr | The attribute to compress the index of. | |
output_fn | Base name for the compressed RDX files to be written (if this is null, filenames will be taken from the attribute). |
References _Attribute::any, BFclose(), BFflush(), BFopen(), BFposition(), CDA_OK, cderrno, cdperror(), cl_id2freq, cl_max_cpos, cl_max_id, cleanup(), ClosePositionStream(), codepos, CompCompRF, CompCompRFX, component_full_name(), CompRevCorpus, CompRevCorpusIdx, compute_ba(), corpus_id, debug, debug_output, ensure_component(), NwriteInt(), OpenPositionStream(), ReadPositionStream(), and write_golomb_code().
Referenced by main().
void decompress_check_reversed_index | ( | Attribute * | attr, | |
char * | output_fn | |||
) |
Checks a compressed reversed index for errors by decompressing it.
This function this assumes that compress_reversed_index() has been called beforehand and made sure that the _uncompressed_ index is used by CL access functions.
attr | The attribute to check the index of. | |
output_fn | Base name for the compressed RDX files to be read (if this is null, filename swill be taken from the attribute). |
References _Attribute::any, BFclose(), BFflush(), BFopen(), CDA_OK, cderrno, cdperror(), cl_id2freq, cl_max_cpos, cl_max_id, cleanup(), ClosePositionStream(), CompCompRF, CompCompRFX, component_full_name(), CompRevCorpus, CompRevCorpusIdx, compute_ba(), corpus_id, debug, debug_output, OpenPositionStream(), read_golomb_code_bf(), and ReadPositionStream().
Referenced by main().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Main function for cwb-compress-rdx.
argc | Number of command-line arguments. | |
argv | Command-line arguments. |
References _Attribute::any, ATT_POS, TCorpus::attributes, central_corpus_directory(), cl_new_corpus, cleanup(), compress_reversed_index(), corpus_id, debug, debug_output, decompress_check_reversed_index(), DEFAULT_ATT_NAME, find_attribute(), progname, registry_directory, and usage().
void usage | ( | char * | msg, | |
int | error_code | |||
) |
Prints a usage message and exits the program.
msg | A message about the error. | |
error_code | Value to be returned by the program when it exits. |
References cleanup(), and progname.
Referenced by main(), and parse_options().
int codepos = 0 |
stores current position in a bit-write-file
Referenced by compress_reversed_index().
Record for the corpus we are working on.
Referenced by attr_drop_attribute(), cqi_find_corpus(), do_cqi_cqp_list_subcorpora(), eval_constraint(), get_attribute_size(), get_id_at_position(), load_corpusnames(), main(), and setup_corpus().
char* corpus_id = NULL |
CWB id of the corpus we are working on.
Referenced by add_attribute(), compress_reversed_index(), compute_code_lengths(), decode_check_huff(), decompress_check_reversed_index(), do_show(), main(), and verify_print_value_list().
int debug = 0 |
debug level
Referenced by compress_reversed_index(), declare_range(), decompress_check_reversed_index(), main(), and parse_options().
FILE* debug_output |
where debug messages are to be sent to (stderr)
Referenced by cleanup(), compress_reversed_index(), decompress_check_reversed_index(), do_MUQuery(), do_StandardQuery(), do_TABQuery(), and main().
char* progname = NULL |
Name of the program.