Context algorithm
Semi-predictive context algorithm implementation
 All Data Structures Files Functions Variables Typedefs Macros Pages
main.c File Reference
#include <assert.h>
#include <math.h>
#include "types.h"
#include "spacedef.h"
#include "mapfile.h"
#include "reverse.h"
#include "wotd.h"
#include "fsmTree.h"
#include "suffixTree.h"
#include "decoderTree.h"
#include "encoder.h"
#include "decoder.h"
#include "debug.h"
#include "alpha.h"
#include "text.h"
#include "reset.h"
#include "arithmetic/coder.h"
#include "arithmetic/bitio.h"

Go to the source code of this file.

Macros

#define UKKONEN   1
 Ukkonen linear suffix tree contruction algorithm. More...
 
#define KURTZ   2
 Kurtz suffix tree contruction algorithm. More...
 
#define MAGIC   0x3276
 Magic number to detect valid ctx files. More...
 

Functions

static void writeByte (int byte, FILE *file)
 Writes a byte to the output file using the arithmetic encoder. More...
 
static int readByte (FILE *file)
 Reads a byte using the arithmetic decoder. More...
 
static void writeAlphabet (FILE *file)
 Writes the alphabet to the output file. More...
 
static void readAlphabet (FILE *file)
 Reads the alphabet from the input file. More...
 
static void zip (char *filename, char *compressed, BOOL algorithm, int parts, BOOL see)
 Compresses the input text and writes the compressed data to a file. More...
 
static void unzip (char *filename, char *output, BOOL see)
 Decompresses the data in an input file and writes it in a new file. More...
 
static void printUsage (char *progname)
 Prints program usage instructions in the standard error output. More...
 
int main (int argc, char *argv[])
 Parses input parameters and calls the appropriate function. More...
 

Macro Definition Documentation

#define KURTZ   2

Kurtz suffix tree contruction algorithm.

Definition at line 46 of file main.c.

#define MAGIC   0x3276

Magic number to detect valid ctx files.

Definition at line 49 of file main.c.

#define UKKONEN   1

Ukkonen linear suffix tree contruction algorithm.

Definition at line 43 of file main.c.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Parses input parameters and calls the appropriate function.

Parameters
[in]argcnumber of input parameters.
[in]argvinput parameters.
Returns
program return code.

Definition at line 422 of file main.c.

static void printUsage ( char *  progname)
static

Prints program usage instructions in the standard error output.

Parameters
[in]prognamename of the program as invoked by the user.

Definition at line 401 of file main.c.

static void readAlphabet ( FILE *  file)
static

Reads the alphabet from the input file.

Parameters
[in]fileinput file.

Definition at line 131 of file main.c.

static int readByte ( FILE *  file)
static

Reads a byte using the arithmetic decoder.

Parameters
[in]filethe input file
Returns
the readed byte

Definition at line 71 of file main.c.

static void unzip ( char *  filename,
char *  output,
BOOL  see 
)
static

Decompresses the data in an input file and writes it in a new file.

Parameters
[in]filenamename and path of the input file.
[in]outputname and path of the output file.
[in]seeif see will be used.

Definition at line 323 of file main.c.

static void writeAlphabet ( FILE *  file)
static

Writes the alphabet to the output file.

Parameters
[in]filethe output file.

Definition at line 88 of file main.c.

static void writeByte ( int  byte,
FILE *  file 
)
static

Writes a byte to the output file using the arithmetic encoder.

Parameters
[in]bytethe data to write
[in]filethe output file

Definition at line 56 of file main.c.

static void zip ( char *  filename,
char *  compressed,
BOOL  algorithm,
int  parts,
BOOL  see 
)
static

Compresses the input text and writes the compressed data to a file.

Parameters
[in]filenamename and path of the file to compress.
[in]compressedname and path of the compressed output file.
[in]algorithmthe algorithm that will be used to build the suffix tree (Ukkonnen or Kurtz).
[in]seeif see will be used.

Definition at line 194 of file main.c.