Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

defs.h File Reference

System-wide definitions. More...

#include <iostream>
#include <iomanip>
#include "debug.h"

Go to the source code of this file.

Defines

#define DEFAULT_FILE_SUFFIX   ".e"
 The default extension of compressed files.

#define FILE_STAMP   "EX"
 The stamp stored in compressed files. More...

#define B_BITS   32
#define F_BITS   27
#define FRUGAL_BITS   1
#define SEQUENTIAL_ALGORITHM
#define OUTPUT(x)   std::cout << x
 Print a string on the standard output. More...

#define OUTPUTNL(x)   OUTPUT(x << std::endl)
 Print a string and an end of line on the standard output. More...

#define OUTPUTENDLINE   std::cout << std::endl
 Print an end of line on the standard output. More...

#define OUTPUTE(x)   std::cerr << x
 Print a string on the standard error output. More...

#define OUTPUTENL(x)   OUTPUTE(x << std::endl)
 Print a string and an end of line on the standard error output. More...

#define OUTPUTEENDLINE   std::cerr << std::endl
 Print and end of line on the standard error output. More...

#define WRN(x)   std::cerr << "[WARNING] " << x << std::endl
 Report a warning message. More...

#define ERR(x)   std::cerr << "[ERROR] " << x << std::endl
 Report an error message. More...

#define FATAL(x)
 Report a fatal error message. More...

#define PARSERERR(x)   std::cerr << std::endl << "[PARSE ERROR] " << x << std::endl
 Report a parser error. More...

#define AMP_REPLACEMENT   6
 Replacement symbol for ampersands.


Enumerations

enum  UserAction { Compress, Decompress, WellFormed }
 An anum of user-selectable actions. More...


Detailed Description

System-wide definitions.

This file contains definitions of macros and types used throughout the whole system.

Definition in file defs.h.


Define Documentation

#define B_BITS   32
 

Default code bits.

Definition at line 70 of file defs.h.

Referenced by ArithCodec::arithmeticEncode, XmlCodec::decode, XmlCodec::encode, and XmlCodec::initializePushCoder.

#define ERR      std::cerr << "[ERROR] " << x << std::endl
 

Report an error message.

Displays an error message on the standard error output.

Parameters:
x  The text of the error message.

Definition at line 224 of file defs.h.

Referenced by XmlCodec::decode, TextCodec::getMIB, Context::installSymbol, main, and TextCodec::output.

#define F_BITS   27
 

Default freq bits.

Definition at line 77 of file defs.h.

Referenced by ArithCodec::arithmeticEncode, XmlCodec::decode, XmlCodec::encode, XmlCodec::initializePushCoder, Context::purgeContext, and Context::setType.

#define FATAL  
 

Value:

{                                                       \
  PRINT_SOURCE_POSITION;                                \
  std::cerr << "[FATAL ERROR] " << x << std::endl       \
            << "Aborting." << std::endl;                \
  throw ExaltFatalErrorException();                     \
}
Report a fatal error message.

Displays a fatal error message on the standard error output, and throws the ExaltFatalErrorException exception.

Parameters:
x  The text of the fatal error message.

Definition at line 235 of file defs.h.

Referenced by KYGrammar::appendToRootRule, ArithCodec::arithmeticEncode, XmlCodec::decode, ExaltCodec::decode, KYGrammar::eatData, Context::encode, Context::initialize, XmlSimpleModel::manageEvent, XmlAdaptiveModel::manageEvent, XmlParser::parse, Context::purgeContext, XmlAdaptiveModel::receiveData, KYGrammar::reductionRule1, OutputSAXReceptor::reportError, KYGrammar::ruleMatchesInput, and Context::setType.

#define FILE_STAMP   "EX"
 

The stamp stored in compressed files.

Exalt uses this stamp to recognize its native file format.

Definition at line 55 of file defs.h.

Referenced by XmlCodec::decode, XmlCodec::encode, and XmlCodec::initializePushCoder.

#define FRUGAL_BITS   1
 

This option removes redundant bits from the start and end of coding. The standard implementation is wasteful of bits, outputting 1 at the front, and about B (eg: 32) at the tail of the coding sequence which it doesn't need to. This option saves those bits, but runs slightly slower.

Instead of just keeping the difference value, V - L (code value - low value) in the decoder, frugal bits keeps track of the low value and code value separately, so that only the necessary (1 to 3) disambiguating bits need coding/decoding at the end of coding. Although when the decoder discovers this, B_BITS past valid coding output will have been read (possibly past end of file). These bits can be recovered by calling ArithCodec::retrieveExcessInputBits() (for example, if another coding stream was about to start). This saves B - 3 to B - 1 bits (eg: With \aB = 32, saving between 29 and 31 bits). Decoding time is slightly slower, as bitstream window is maintained.

Another 1 bit is saved by observing that with the initial range of [0, 0.5) which is used, the first bit of each coding sequence is zero. This bit need not be transmitted. This can be implemented efficiently in the decoder, but slows the encoder which checks each time a bit is output whether it is the first bit of a coding sequence. The encoder would not need to be slowed by this if coding always began at the start of a byte, but we are allowing for consecutive coding sequences (ArithCodec::startEncode(); ... ArithCodec::finishEncode(); pairs) in the same bitstream. The status of this option is not stored in the compressed data. Thus it is up to the user to ensure that the FRUGAL_BITS option is the same when decompressing as when compressing.

See also:
ArithCodec::retrieveExcessInputBits(), ArithCodec::startEncode(), ArithCodec::finishEncode()

Definition at line 94 of file defs.h.

#define OUTPUT      std::cout << x
 

Print a string on the standard output.

Outputs a string on the standard output.

Parameters:
x  String.

Definition at line 149 of file defs.h.

Referenced by XmlParser::characterData, XmlParser::comment, XmlParser::defaultHandler, XmlParser::endCDATASection, XmlParser::endElement, XmlParser::entityDecl, XmlParser::notationDecl, XmlParser::processingInstruction, KYGrammar::reconstructRule, XmlParser::startCDATASection, XmlParser::startDoctypeDecl, XmlParser::startElement, XmlParser::unknownEncoding, and XmlParser::xmlDecl.

#define OUTPUTE      std::cerr << x
 

Print a string on the standard error output.

Outputs a string on the standard error output.

Parameters:
x  String.

Definition at line 180 of file defs.h.

Referenced by KYGrammar::print, KYGrammar::printDigrams, ElementModeler::printNode, and KYGrammar::~KYGrammar.

#define OUTPUTEENDLINE   std::cerr << std::endl
 

Print and end of line on the standard error output.

Outputs an end of line on the standard output.

Parameters:
x  String.

Definition at line 202 of file defs.h.

Referenced by main, KYGrammar::print, ElementModeler::print, KYGrammar::printDigrams, ElementModeler::printNode, KYGrammar::~KYGrammar, XmlAdaptiveModel::~XmlAdaptiveModel, and XmlSimpleModel::~XmlSimpleModel.

#define OUTPUTENDLINE   std::cout << std::endl
 

Print an end of line on the standard output.

Outputs an end of line on the standard output.

Definition at line 169 of file defs.h.

Referenced by main, and usage.

#define OUTPUTENL      OUTPUTE(x << std::endl)
 

Print a string and an end of line on the standard error output.

Outputs a string and an end of line on the standard error output.

Parameters:
x  String.

Definition at line 191 of file defs.h.

Referenced by main, KYGrammar::print, ElementModeler::print, KYGrammar::printDigrams, KYGrammar::~KYGrammar, XmlAdaptiveModel::~XmlAdaptiveModel, XmlParser::~XmlParser, and XmlSimpleModel::~XmlSimpleModel.

#define OUTPUTNL      OUTPUT(x << std::endl)
 

Print a string and an end of line on the standard output.

Outputs a string and an end of line on the standard output.

Parameters:
x  String.

Definition at line 160 of file defs.h.

Referenced by XmlParser::endDoctypeDecl, main, and usage.

#define PARSERERR      std::cerr << std::endl << "[PARSE ERROR] " << x << std::endl
 

Report a parser error.

Displays a parser error message on the standard error output.

Parameters:
x  The text of the parser error.

Definition at line 252 of file defs.h.

Referenced by XmlParser::reportError.

#define SEQUENTIAL_ALGORITHM
 

Use sequential algorithm for encoding grammars. (There is no other algorithm implemented yet.)

Definition at line 101 of file defs.h.

#define WRN      std::cerr << "[WARNING] " << x << std::endl
 

Report a warning message.

Displays a warning message on the standard error output.

Parameters:
x  The text of the warning.

Definition at line 213 of file defs.h.

Referenced by KYGrammar::createRootRule, XmlParser::exposeEvent, XmlSimpleModel::manageEvent, and XmlAdaptiveModel::manageEvent.


Enumeration Type Documentation

enum UserAction
 

An anum of user-selectable actions.

Values of this enum are used in the main program to indicate what the user wishes to do.

Enumeration values:
Compress  Compress the data.

Exalt will compress the specified input data. This is a default action.

Decompress  Decompress the data.

Exalt will decompress the specified input data.

WellFormed  Check XML data well-formedness.

Exalt will check if the input XML data is well-formed.

Definition at line 112 of file defs.h.

Referenced by main.


Generated on Wed Feb 5 10:43:03 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002