cwb-compress-rdx.c File Reference

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

Defines

Functions

Variables


Define Documentation

#define log2 (  )     (log(x)/log(2.0))

Function Documentation

void cleanup ( int  error_code  ) 

Cleans up memory prior to an error-prompted exit.

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

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

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

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

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


Variable Documentation

int codepos = 0

stores current position in a bit-write-file

Referenced by compress_reversed_index().

char* corpus_id = NULL
int debug = 0
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.


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