CWB
Defines | Functions | Variables

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 (   x)    (log(x)/log(2.0))

Function Documentation

void compress_reversed_index ( Attribute attr,
char *  output_fn 
)

Compresses the reversed index of a p-attribute.

Parameters:
attrThe attribute to compress the index of.
output_fnBase 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, cl_delete_stream(), cl_errno, cl_error(), cl_id2freq(), cl_max_cpos(), CL_MAX_FILENAME_LENGTH, cl_max_id(), cl_new_stream(), cl_read_stream(), codepos, CompCompRF, CompCompRFX, component_full_name(), compressrdx_cleanup(), CompRevCorpus, CompRevCorpusIdx, compute_ba(), corpus_id, debug, debug_output, ensure_component(), NwriteInt(), and write_golomb_code().

Referenced by main().

void compressrdx_cleanup ( int  error_code)

Cleans up memory prior to an error-prompted exit.

Parameters:
error_codeValue to be returned by the program when it exits.

References cl_delete_corpus(), and debug_output.

Referenced by compress_reversed_index(), compressrdx_usage(), decompress_check_reversed_index(), and main().

void compressrdx_usage ( char *  msg,
int  error_code 
)

Prints a usage message and exits the program.

Parameters:
msgA message about the error.
error_codeValue to be returned by the program when it exits.

References compressrdx_cleanup(), progname, and VERSION.

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:
attrThe attribute to check the index of.
output_fnBase 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, cl_delete_stream(), cl_errno, cl_error(), cl_id2freq(), cl_max_cpos(), CL_MAX_FILENAME_LENGTH, cl_max_id(), cl_new_stream(), cl_read_stream(), CompCompRF, CompCompRFX, component_full_name(), compressrdx_cleanup(), CompRevCorpus, CompRevCorpusIdx, compute_ba(), corpus_id, debug, debug_output, and read_golomb_code_bf().

Referenced by main().

int main ( int  argc,
char **  argv 
)

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
char* progname = NULL

Name of the program.