w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Engine.cpp File Reference
#include "Engine.h"
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include "zlib.h"
#include "NormalizationData.c"
Include dependency graph for Engine.cpp:

Go to the source code of this file.

Macros

#define SBase   0xAC00
 
#define LBase   0x1100
 
#define VBase   0x1161
 
#define TBase   0x11A7
 
#define LCount   19
 
#define VCount   21
 
#define TCount   28
 
#define NCount   (VCount * TCount)
 
#define SCount   (LCount * NCount)
 
#define RETURN(x)   do { _rval = (x); goto _return_label; } while (0)
 
#define matchYes   1
 
#define matchNo   0
 
#define CHECK_AVAIL(x)
 
#define CHECK_AVAIL(x)
 
#define DATA(x)   (x < savedCount ? savedBytes[x] : data[x - savedCount])
 
#define RETURN(returnStatus)   rval = returnStatus; goto RETURN_LABEL
 

Functions

UInt8 READ (UInt8 p)
 
UInt16 READ (UInt16 p)
 
UInt32 READ (UInt32 p)
 
template<class T >
static Tbinary_search (T *array, UInt32 count, UInt32 value)
 
static bool getNamePtrFromTable (Byte *table, UInt16 nameID, Byte *&outNamePtr, UInt32 &outNameLen)
 
TECkit_Status WINAPI TECkit_CreateConverter (Byte *mapping, UInt32 mappingSize, Byte mapForward, UInt16 inputForm, UInt16 outputForm, TECkit_Converter *converter)
 
TECkit_Status WINAPI TECkit_DisposeConverter (TECkit_Converter converter)
 
TECkit_Status WINAPI TECkit_GetConverterName (TECkit_Converter converter, UInt16 nameID, Byte *nameBuffer, UInt32 bufferSize, UInt32 *nameLength)
 
TECkit_Status WINAPI TECkit_GetConverterFlags (TECkit_Converter converter, UInt32 *sourceFlags, UInt32 *targetFlags)
 
TECkit_Status WINAPI TECkit_ResetConverter (TECkit_Converter converter)
 
TECkit_Status WINAPI TECkit_ConvertBufferOpt (TECkit_Converter converter, Byte *inBuffer, UInt32 inLength, UInt32 *inUsed, Byte *outBuffer, UInt32 outLength, UInt32 *outUsed, UInt32 inOptions, UInt32 *lookaheadCount)
 
TECkit_Status WINAPI TECkit_ConvertBuffer (TECkit_Converter converter, Byte *inBuffer, UInt32 inLength, UInt32 *inUsed, Byte *outBuffer, UInt32 outLength, UInt32 *outUsed, Byte inputIsComplete)
 
TECkit_Status WINAPI TECkit_FlushOpt (TECkit_Converter converter, Byte *outBuffer, UInt32 outLength, UInt32 *outUsed, UInt32 inOptions, UInt32 *lookaheadCount)
 
TECkit_Status WINAPI TECkit_Flush (TECkit_Converter converter, Byte *outBuffer, UInt32 outLength, UInt32 *outUsed)
 
TECkit_Status WINAPI TECkit_GetMappingFlags (Byte *mapping, UInt32 mappingSize, UInt32 *lhsFlags, UInt32 *rhsFlags)
 
TECkit_Status WINAPI TECkit_GetMappingName (Byte *mapping, UInt32 mappingSize, UInt16 nameID, Byte *nameBuffer, UInt32 bufferSize, UInt32 *nameLength)
 
UInt32 WINAPI TECkit_GetVersion ()
 

Variables

static UInt32 offsetsFromUTF8 [6]
 
static UInt8 bytesFromUTF8 [256]
 
static UInt8 firstByteMark [7]
 
int halfShift = 10
 
UInt32 halfBase = 0x0010000UL
 
UInt32 halfMask = 0x3FFUL
 
UInt32 kSurrogateHighStart = 0xD800UL
 
UInt32 kSurrogateHighEnd = 0xDBFFUL
 
UInt32 kSurrogateLowStart = 0xDC00UL
 
UInt32 byteMask = 0x000000BFUL
 
UInt32 byteMark = 0x00000080UL
 

Macro Definition Documentation

◆ CHECK_AVAIL [1/2]

#define CHECK_AVAIL (   x)
Value:
if (dataPtr + (x) > dataLen) { \
if (inputComplete) \
return kInvalidChar; \
else { \
_savePendingBytes(); \
return kNeedMoreInput; \
} \
}
UInt32 kInvalidChar
Definition: Compiler.cpp:41
const UInt32 kNeedMoreInput
Definition: Engine.h:25
float x
Definition: cordic.py:15

◆ CHECK_AVAIL [2/2]

#define CHECK_AVAIL (   x)
Value:
if (dataPtr + (x) > savedCount + dataLen) { \
if (inputComplete) \
return kInvalidChar; \
else { \
_savePendingBytes(); \
return kNeedMoreInput; \
} \
}

◆ DATA

#define DATA (   x)    (x < savedCount ? savedBytes[x] : data[x - savedCount])

◆ LBase

#define LBase   0x1100

Definition at line 138 of file Engine.cpp.

◆ LCount

#define LCount   19

Definition at line 141 of file Engine.cpp.

◆ matchNo

#define matchNo   0

Definition at line 633 of file Engine.cpp.

◆ matchYes

#define matchYes   1

Definition at line 632 of file Engine.cpp.

◆ NCount

#define NCount   (VCount * TCount)

Definition at line 144 of file Engine.cpp.

◆ RETURN [1/2]

#define RETURN (   returnStatus)    rval = returnStatus; goto RETURN_LABEL

Definition at line 630 of file Engine.cpp.

◆ RETURN [2/2]

#define RETURN (   x)    do { _rval = (x); goto _return_label; } while (0)

Definition at line 630 of file Engine.cpp.

◆ SBase

#define SBase   0xAC00

Definition at line 137 of file Engine.cpp.

◆ SCount

#define SCount   (LCount * NCount)

Definition at line 145 of file Engine.cpp.

◆ TBase

#define TBase   0x11A7

Definition at line 140 of file Engine.cpp.

◆ TCount

#define TCount   28

Definition at line 143 of file Engine.cpp.

◆ VBase

#define VBase   0x1161

Definition at line 139 of file Engine.cpp.

◆ VCount

#define VCount   21

Definition at line 142 of file Engine.cpp.

Function Documentation

◆ binary_search()

template<class T >
static T* binary_search ( T array,
UInt32  count,
UInt32  value 
)
static

Definition at line 564 of file Engine.cpp.

References count, i, READ(), and T.

Referenced by Pass::classMatch().

◆ getNamePtrFromTable()

static bool getNamePtrFromTable ( Byte table,
UInt16  nameID,
Byte *&  outNamePtr,
UInt32 outNameLen 
)
static

Definition at line 1701 of file Engine.cpp.

References i, n, FileHeader::numNames, READ(), and table.

Referenced by Converter::GetNamePtr(), and TECkit_GetMappingName().

◆ READ() [1/3]

UInt16 READ ( UInt16  p)
inline

Definition at line 80 of file Engine.cpp.

References p.

◆ READ() [2/3]

UInt32 READ ( UInt32  p)
inline

Definition at line 90 of file Engine.cpp.

References p.

◆ READ() [3/3]

◆ TECkit_ConvertBuffer()

TECkit_Status WINAPI TECkit_ConvertBuffer ( TECkit_Converter  converter,
Byte inBuffer,
UInt32  inLength,
UInt32 inUsed,
Byte outBuffer,
UInt32  outLength,
UInt32 outUsed,
Byte  inputIsComplete 
)

◆ TECkit_ConvertBufferOpt()

TECkit_Status WINAPI TECkit_ConvertBufferOpt ( TECkit_Converter  converter,
Byte inBuffer,
UInt32  inLength,
UInt32 inUsed,
Byte outBuffer,
UInt32  outLength,
UInt32 outUsed,
UInt32  inOptions,
UInt32 lookaheadCount 
)

◆ TECkit_CreateConverter()

TECkit_Status WINAPI TECkit_CreateConverter ( Byte mapping,
UInt32  mappingSize,
Byte  mapForward,
UInt16  inputForm,
UInt16  outputForm,
TECkit_Converter converter 
)

Definition at line 1925 of file Engine.cpp.

References cnv, e, kStatus_Exception, kStatus_NoError, mapping, and status.

Referenced by apply_normalization(), load_mapping_file(), and main().

◆ TECkit_DisposeConverter()

TECkit_Status WINAPI TECkit_DisposeConverter ( TECkit_Converter  converter)

Definition at line 1955 of file Engine.cpp.

References cnv, kStatus_InvalidConverter, kStatus_NoError, status, and Converter::Validate().

Referenced by main().

◆ TECkit_Flush()

TECkit_Status WINAPI TECkit_Flush ( TECkit_Converter  converter,
Byte outBuffer,
UInt32  outLength,
UInt32 outUsed 
)

Definition at line 2083 of file Engine.cpp.

References kOptionsUnmapped_UseReplacementCharSilently, and TECkit_FlushOpt().

◆ TECkit_FlushOpt()

TECkit_Status WINAPI TECkit_FlushOpt ( TECkit_Converter  converter,
Byte outBuffer,
UInt32  outLength,
UInt32 outUsed,
UInt32  inOptions,
UInt32 lookaheadCount 
)

◆ TECkit_GetConverterFlags()

TECkit_Status WINAPI TECkit_GetConverterFlags ( TECkit_Converter  converter,
UInt32 sourceFlags,
UInt32 targetFlags 
)

Definition at line 1995 of file Engine.cpp.

References cnv, kStatus_InvalidConverter, kStatus_NoError, status, and Converter::Validate().

◆ TECkit_GetConverterName()

TECkit_Status WINAPI TECkit_GetConverterName ( TECkit_Converter  converter,
UInt16  nameID,
Byte nameBuffer,
UInt32  bufferSize,
UInt32 nameLength 
)

◆ TECkit_GetMappingFlags()

◆ TECkit_GetMappingName()

◆ TECkit_GetVersion()

UInt32 WINAPI TECkit_GetVersion ( )

Definition at line 2190 of file Engine.cpp.

References kCurrentTECkitVersion.

Referenced by main().

◆ TECkit_ResetConverter()

TECkit_Status WINAPI TECkit_ResetConverter ( TECkit_Converter  converter)

Definition at line 2011 of file Engine.cpp.

References cnv, kStatus_InvalidConverter, kStatus_NoError, status, and Converter::Validate().

Variable Documentation

◆ byteMark

UInt32 byteMark = 0x00000080UL

Definition at line 1475 of file Engine.cpp.

Referenced by Converter::ConvertBufferOpt().

◆ byteMask

UInt32 byteMask = 0x000000BFUL

Definition at line 1474 of file Engine.cpp.

Referenced by Converter::ConvertBufferOpt().

◆ bytesFromUTF8

UInt8 bytesFromUTF8[256]
static
Initial value:
= {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
}

Definition at line 1452 of file Engine.cpp.

Referenced by Converter::_getCharFn(), and Converter::_getCharWithSavedBytes().

◆ firstByteMark

UInt8 firstByteMark[7]
static
Initial value:
= {
0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
}

Definition at line 1464 of file Engine.cpp.

Referenced by Converter::ConvertBufferOpt().

◆ halfBase

UInt32 halfBase = 0x0010000UL

◆ halfMask

UInt32 halfMask = 0x3FFUL

Definition at line 1470 of file Engine.cpp.

Referenced by Converter::ConvertBufferOpt().

◆ halfShift

int halfShift = 10

◆ kSurrogateHighEnd

UInt32 kSurrogateHighEnd = 0xDBFFUL

Definition at line 1472 of file Engine.cpp.

Referenced by Converter::_getCharFn(), and Converter::_getCharWithSavedBytes().

◆ kSurrogateHighStart

UInt32 kSurrogateHighStart = 0xD800UL

◆ kSurrogateLowStart

UInt32 kSurrogateLowStart = 0xDC00UL

◆ offsetsFromUTF8

UInt32 offsetsFromUTF8[6]
static
Initial value:
= {
0x00000000UL,
0x00003080UL,
0x000E2080UL,
0x03C82080UL,
0xFA082080UL,
0x82082080UL
}

Definition at line 1442 of file Engine.cpp.

Referenced by Converter::_getCharFn(), and Converter::_getCharWithSavedBytes().