ddc
Classes | Macros | Typedefs | Enumerations | Functions | Variables
utilit.h File Reference
#include "ddcConfig.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <string>
#include <algorithm>
#include <stdexcept>
#include <vector>
#include <typeinfo>
#include "set"
#include "stack"
#include "map"
#include "time.h"
#include <malloc.h>
#include <unistd.h>
#include "../CommonLib/ddcLocale.h"
#include "../CommonLib/ddcVersion.h"
#include "../CommonLib/ddcString.h"
Include dependency graph for utilit.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  troika< T1, T2, T3 >
 
class  CExpc
 generic local exception class moo: derived from stdexcept runtime_error More...
 
class  CFatalExpc
 local exception class, fatal (can be used to force immediate bail-out) More...
 
struct  DDCProcessMemoryStatus
 

Macros

#define WIN32_LEAN_AND_MEAN
 
#define likely(x)   x
 
#define unlikely(x)   x
 
#define _QM(X)   (((QWORD)1)<<X)
 

Typedefs

typedef unsigned char BYTE
 
typedef uint32_t DWORD
 
typedef uint16_t WORD
 
typedef uint64_t QWORD
 
typedef unsigned int UINT
 
typedef vector< string > StringVector
 
typedef set< string > StringSet
 
typedef vector< DWORDDwordVector
 
typedef QWORD file_off_t
 

Enumerations

enum  MorphLanguageEnum {
  morphUnknown = 0, morphRussian = 1, morphEnglish = 2, morphGerman = 3,
  morphGeneric = 4, morphURL =5, morphDigits =6
}
 
enum  RegisterEnum { AnyRegister =0, LowLow =1, UpLow =2, UpUp =3 }
 

Functions

QWORD GetMaxQWORD ()
 
bool FileExists (const char *FName)
 
bool FileExists (const string &FName)
 
bool IsDirectory (const char *DirName)
 
bool IsDirectory (const string &DirName)
 
file_off_t FileSize (const char *filename)
 
file_off_t FileSize (const string &filename)
 
time_t FileMTime (const char *filename)
 
bool FSeek (FILE *fp, file_off_t pos, int origin)
 
file_off_t FTell (FILE *fp)
 
void ErrorMessage (const string &Label, const string &Message)
 
void ErrorMessage (const string &Message)
 
string MakeFName (const string &InpitFileName, const string &Ext)
 
bool MakePath (const char *RossPath, const char *FileName, char *FullPath)
 
string GetPathByFile (string FileName)
 
bool IsBinFile (const char *FileName)
 
bool IsEmptyLine (const char *t)
 
bool IsHtmlFile (const string &FileName)
 
bool IsTableFile (const string &FileName)
 
bool IsJsonFile (const string &FileName)
 
string FileExtension (const string &FileName)
 
string FileDirectory (const string &FileName)
 Returns directory part of FileName, or "." if FileName is a bare filename, like dirname(3) More...
 
string FileBasename (const string &FileName)
 Returns file part of FileName, like basename(3) More...
 
string FileBasename (const string &FileName, const string &FileExtension)
 Returns basename FileName, removing any trailing extension FileExtension. More...
 
string CurrentDirectory (void)
 Wrapper for getcwd(); returns current working directory of current process. More...
 
bool IsAbsolutePath (const string &PathName)
 Returns true iff PathName is an absolute path (simple string heuristics) More...
 
string RelativePathName (const string &RefDir, const string &PathName)
 If PathName is absolute, it is returned; otherwise returns (RefDir + "/" + PathName) More...
 
string RelativeFileName (const string &RefFile, const string &PathName)
 If PathName is absolute, it is returned; otherwise returns (FileDirectory(RefFile) + "/" + PathName) More...
 
void AddFile (const char *MainFile, const char *ToAdd)
 AddFile(): old ugly file-append hack using system("cat...") More...
 
void FileAppend (FILE *src, FILE *dst)
 FileAppend(): newer better replacement for AddFile() More...
 
void FileAppend (const char *srcFile, const char *dstFile)
 
void FileAppend (const string &srcFile, const string &dstFile)
 
void FileAppendPartial (FILE *src, FILE *dst, size_t nBytes)
 FileAppendPartial(): append a substring of src to dst. More...
 
bool RmlMoveFile (const char *oldpath, const char *newpath)
 
bool RmlCopyFile (const char *oldpath, const char *newpath)
 
string CreateTempFileName ()
 
bool MakeDir (const string &DirName)
 
bool MakeDirP (const string &DirName)
 
bool RemoveWithPrint (const string &FileName)
 
size_t GetNumberOfOpenFiles (pid_t pid=0)
 
string GetRegistryString (string RegistryPath)
 
bool CanGetRegistryString (string RegistryPath)
 
bool IsRmlRegistered (string &Error)
 
struct tm RmlGetCurrentTime ()
 
string GetIniFilePath ()
 
string GetRmlVariable ()
 
char * rtrim (char *s)
 
bool IsSuperEqualChar (BYTE ch1, BYTE ch2, MorphLanguageEnum langua)
 
int CompareWithoutRegister (const char *s1, const char *s2, size_t l, MorphLanguageEnum langua)
 
BYTE force_rus_char (BYTE ch)
 
bool force_to_rus (char *dest, const char *sour, size_t len)
 
char * IntToStr (int Value, char *Buffer)
 
string & IntToStr (int Value, string &oBuffer)
 
string & TrimLeft (string &str)
 
string & TrimRight (string &str)
 
string & Trim (string &str)
 
bool LoadFileToString (string FileName, string &Result, bool clobber=true)
 
bool SaveStringToFile (const string &Str, const string &FileName)
 
void KOI8ToWin (string &s)
 
void WinToKOI8 (string &s)
 
bool StartsWith (const string &body, const string &prefix)
 
string timestampLocal (time_t timeval)
 moo: timestamp stuff More...
 
string timestampUTC (time_t timeval)
 
vector< string > stringSplit (const char *s, const char *delims)
 moo: convenience wrapper for string-to-vector tokenization using StringTokenizer More...
 
void stringSplitE (const string &s, const string &delims, vector< string > &tokens)
 
vector< string > stringSplitE (const string &s, const string &delims)
 moo: stringSplitE() variant returning token-vector More...
 
uint32_t date2int (signed int y, unsigned int m=1, unsigned int d=1)
 moo: date-to-int encoding (v2.2.4: use signed years) More...
 
void int2date (uint32_t i, signed int *y, unsigned int *m=NULL, unsigned int *d=NULL)
 moo: int-to-date decoding (v2.2.4: use signed years) More...
 
string int2hex (int32_t i)
 moo: int-to-hexidecimal string encoding; encoding preserves sort order (for subcorpus->server communications) More...
 
int32_t hex2int (const string &s)
 moo: int-to-hexidecimal string deccoding; ; encoding preserves sort order More...
 
void ddc_thread_init (const char *log_label=NULL)
 register a thread-local log prefix (unix only) More...
 
const char * ddc_log_label (void)
 get thread-local log prefix, or empty string if none registered More...
 
const char * ddc_set_log_label (const char *log_label)
 set thread-local log prefix; returns old label (if any) More...
 
int GetPredictionPartOfSpeech (const string &PartOfSpeech, MorphLanguageEnum langua)
 
bool GetLanguageByString (string s, MorphLanguageEnum &Result)
 
string GetStringByLanguage (MorphLanguageEnum Langua)
 
uint32_t log2u32 (uint32_t v)
 
template<class VecT >
size_t VectorStride (const VecT &v)
 
void TrimHeap ()
 
template<class ContainerT >
void ClearContainer (ContainerT &C)
 
template<class T >
void ClearVector (vector< T > &V)
 
void ClearString (string &S)
 
int isbracket (BYTE x)
 
size_t dual_bracket (BYTE x)
 
bool is_pseudo_graph (BYTE x)
 
bool is_spc_fill (BYTE x)
 
bool is_english_upper (BYTE x)
 
bool is_english_lower (BYTE x)
 
bool is_german_upper (BYTE x)
 
bool is_german_lower (BYTE x)
 
bool is_russian_upper (BYTE x)
 
bool is_russian_lower (BYTE x)
 
bool is_upper_consonant (BYTE x, MorphLanguageEnum Langua)
 
bool is_lower_vowel (BYTE x, MorphLanguageEnum Langua)
 
bool is_upper_vowel (BYTE x, MorphLanguageEnum Langua)
 
bool is_english_alpha (BYTE x)
 
bool is_russian_alpha (BYTE x)
 
bool is_german_alpha (BYTE x)
 
bool is_alpha (BYTE x)
 
bool is_alpha (BYTE x, MorphLanguageEnum langua)
 
bool is_lower_alpha (BYTE x, MorphLanguageEnum langua)
 
bool is_upper_alpha (BYTE x, MorphLanguageEnum langua)
 
bool isnspace (BYTE x)
 
BYTE etoupper (BYTE ch)
 
BYTE etolower (BYTE ch)
 
BYTE rtoupper (BYTE ch)
 
BYTE rtolower (BYTE ch)
 
BYTE gtoupper (BYTE ch)
 
BYTE gtolower (BYTE ch)
 
BYTE ReverseChar (BYTE ch, MorphLanguageEnum langua)
 
string & EngMakeUpper (string &word)
 
string & EngMakeLower (string &word)
 
string & EngRusMakeLower (string &word)
 
char * RmlMakeUpper (char *word, MorphLanguageEnum langua)
 
string & RmlMakeUpper (string &word, MorphLanguageEnum langua)
 
string & RmlMakeLower (string &word, MorphLanguageEnum langua)
 
string & EngRusMakeUpper (string &word)
 
char * EngRusMakeUpper (char *word)
 
bool IsRussian (const char *word)
 
bool CheckLanguage (const char *word, MorphLanguageEnum langua)
 
void ConvertJO2Je (string &src)
 
void ConvertJO2Je (char *src, size_t Length)
 
string ConvertASCIIToHtmlSymbols (const string &txt)
 
template<class T , class Pred , class Conv >
T & RegisterConverter (T &word, size_t Len, Pred P, Conv C)
 
template<class T >
T & GerEngRusMakeUpperTemplate (T &word, MorphLanguageEnum Langua, size_t Len)
 

Variables

const unsigned int _MAX_PATH = 512
 
const BYTE cHyphenChar = (BYTE) '-'
 
const BYTE cParagraph = (BYTE) 21
 
const BYTE cCompanyChar = (BYTE) 176
 
const BYTE cIonChar = (BYTE) 183
 
const BYTE cNumberChar = (BYTE) 0xB9
 
const BYTE cPiChar = (BYTE) 182
 
const BYTE cEllipseChar = (BYTE) 133
 
const BYTE UnknownPartOfSpeech = 0xff
 
const BYTE Auml = 196
 
const BYTE auml = 228
 
const BYTE Uuml = 220
 
const BYTE uuml = 252
 
const BYTE Ouml = 214
 
const BYTE ouml = 246
 
const BYTE szlig = 223
 
const BYTE Nu = 181
 
const BYTE agrave = 224
 
const BYTE egrave = 232
 
const BYTE eacute = 233
 
const BYTE LowerJO_cp1251 = 184
 
const BYTE UpperJO_cp1251 = 168
 
const BYTE LowerE_cp1251 = 229
 
const BYTE UpperE_cp1251 = 197
 
const BYTE Apostrophe = 39
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

◆ likely

#define likely (   x)    x

◆ unlikely

#define unlikely (   x)    x

◆ _QM

#define _QM (   X)    (((QWORD)1)<<X)

Typedef Documentation

◆ BYTE

typedef unsigned char BYTE

◆ DWORD

typedef uint32_t DWORD

◆ WORD

typedef uint16_t WORD

◆ QWORD

typedef uint64_t QWORD

◆ UINT

typedef unsigned int UINT

◆ StringVector

typedef vector<string> StringVector

◆ StringSet

typedef set<string> StringSet

◆ DwordVector

typedef vector<DWORD> DwordVector

◆ file_off_t

typedef QWORD file_off_t

Enumeration Type Documentation

◆ MorphLanguageEnum

Enumerator
morphUnknown 
morphRussian 
morphEnglish 
morphGerman 
morphGeneric 
morphURL 
morphDigits 

◆ RegisterEnum

Enumerator
AnyRegister 
LowLow 
UpLow 
UpUp 

Function Documentation

◆ GetMaxQWORD()

QWORD GetMaxQWORD ( )
inline

Referenced by GetParadigmByGroups().

Here is the caller graph for this function:

◆ FileExists() [1/2]

bool FileExists ( const char *  FName)

◆ FileExists() [2/2]

bool FileExists ( const string &  FName)
inline

References FileExists(), and IsDirectory().

Here is the call graph for this function:

◆ IsDirectory() [1/2]

bool IsDirectory ( const char *  DirName)

Referenced by FileExists(), IsDirectory(), and MakeDirP().

Here is the caller graph for this function:

◆ IsDirectory() [2/2]

bool IsDirectory ( const string &  DirName)
inline

References FileSize(), and IsDirectory().

Here is the call graph for this function:

◆ FileSize() [1/2]

file_off_t FileSize ( const char *  filename)

References FSeek(), and FTell().

Referenced by FileSize(), CIndexSetForQueryingStage::GetOccurrsFileSize(), IsDirectory(), CShortStringHolder::ReadShortStringHolder(), ReadVector(), CConcXml::SplitBibliography(), and CConcXml::UnionBibliographies().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FileSize() [2/2]

file_off_t FileSize ( const string &  filename)
inline

◆ FileMTime()

time_t FileMTime ( const char *  filename)

Referenced by FileSize(), and CConcordance::UpdateTimestamp().

Here is the caller graph for this function:

◆ FSeek()

bool FSeek ( FILE *  fp,
file_off_t  pos,
int  origin 
)

◆ FTell()

file_off_t FTell ( FILE *  fp)

Referenced by FileSize(), and CItemIndexForLoading::ReadFromTemporalFile().

Here is the caller graph for this function:

◆ ErrorMessage() [1/2]

void ErrorMessage ( const string &  Label,
const string &  Message 
)

◆ ErrorMessage() [2/2]

void ErrorMessage ( const string &  Message)

References ErrorMessage().

Here is the call graph for this function:

◆ MakeFName()

string MakeFName ( const string &  InpitFileName,
const string &  Ext 
)

◆ MakePath()

bool MakePath ( const char *  RossPath,
const char *  FileName,
char *  FullPath 
)

References FileExists().

Referenced by FileSize(), TRoss::FullLoad(), TRoss::LoadOnlyConstants(), and TRoss::ReadUnitComments().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPathByFile()

string GetPathByFile ( string  FileName)

Referenced by ConcIndexatorInvoker::BuildIndex(), FileSize(), MorphoWizard::get_predict_src_file_path(), and GetFullPathByName().

Here is the caller graph for this function:

◆ IsBinFile()

bool IsBinFile ( const char *  FileName)

Referenced by TRoss::BuildCorteges(), TRoss::BuildUnits(), FileSize(), and TRoss::ReadUnitComments().

Here is the caller graph for this function:

◆ IsEmptyLine()

bool IsEmptyLine ( const char *  t)

Referenced by FileSize(), and TRoss::ReadFromStrWithOneSignatura().

Here is the caller graph for this function:

◆ IsHtmlFile()

bool IsHtmlFile ( const string &  FileName)

References EngMakeLower(), and FileExtension().

Referenced by FileSize(), and CIndexDocument::NormalizeDocumentBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsTableFile()

bool IsTableFile ( const string &  FileName)

References EngMakeLower(), and FileExtension().

Referenced by FileSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsJsonFile()

bool IsJsonFile ( const string &  FileName)

References EngMakeLower(), and FileExtension().

Referenced by FileSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FileExtension()

string FileExtension ( const string &  FileName)

Referenced by FileSize(), IsHtmlFile(), IsJsonFile(), and IsTableFile().

Here is the caller graph for this function:

◆ FileDirectory()

string FileDirectory ( const string &  FileName)

Returns directory part of FileName, or "." if FileName is a bare filename, like dirname(3)

Referenced by FileSize(), MakeDirP(), RelativeFileName(), and CConcIndexator::SplitProject().

Here is the caller graph for this function:

◆ FileBasename() [1/2]

string FileBasename ( const string &  FileName)

Returns file part of FileName, like basename(3)

Referenced by FileBasename(), FileSize(), and CDDCLeafServer::handle__info().

Here is the caller graph for this function:

◆ FileBasename() [2/2]

string FileBasename ( const string &  FileName,
const string &  FileExtension 
)

Returns basename FileName, removing any trailing extension FileExtension.

References FileBasename().

Here is the call graph for this function:

◆ CurrentDirectory()

string CurrentDirectory ( void  )

Wrapper for getcwd(); returns current working directory of current process.

Referenced by do_start(), and FileSize().

Here is the caller graph for this function:

◆ IsAbsolutePath()

bool IsAbsolutePath ( const string &  PathName)

Returns true iff PathName is an absolute path (simple string heuristics)

Referenced by FileSize(), and RelativePathName().

Here is the caller graph for this function:

◆ RelativePathName()

string RelativePathName ( const string &  RefDir,
const string &  PathName 
)

If PathName is absolute, it is returned; otherwise returns (RefDir + "/" + PathName)

References IsAbsolutePath().

Referenced by FileSize(), and RelativeFileName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RelativeFileName()

string RelativeFileName ( const string &  RefFile,
const string &  PathName 
)

If PathName is absolute, it is returned; otherwise returns (FileDirectory(RefFile) + "/" + PathName)

References FileDirectory(), and RelativePathName().

Referenced by FileSize(), CDDCLeafServer::handle__info(), CConcordance::LoadOptionsFromString(), CSourceFileHolder::ReadSourceFileList(), and CDDCServerOptions::Set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddFile()

void AddFile ( const char *  MainFile,
const char *  ToAdd 
)

AddFile(): old ugly file-append hack using system("cat...")

References _MAX_PATH.

Referenced by FileSize().

Here is the caller graph for this function:

◆ FileAppend() [1/3]

void FileAppend ( FILE *  src,
FILE *  dst 
)

FileAppend(): newer better replacement for AddFile()

References DDC_STATIC_BUFLEN.

Referenced by FileAppend(), FileSize(), and CConcXml::UnionBibliographies().

Here is the caller graph for this function:

◆ FileAppend() [2/3]

void FileAppend ( const char *  srcFile,
const char *  dstFile 
)

References FileAppend(), and Format().

Here is the call graph for this function:

◆ FileAppend() [3/3]

void FileAppend ( const string &  srcFile,
const string &  dstFile 
)

References FileAppend().

Here is the call graph for this function:

◆ FileAppendPartial()

void FileAppendPartial ( FILE *  src,
FILE *  dst,
size_t  nBytes 
)

FileAppendPartial(): append a substring of src to dst.

References DDC_STATIC_BUFLEN, and Format().

Referenced by FileSize(), and CConcXml::SplitBibliography().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RmlMoveFile()

bool RmlMoveFile ( const char *  oldpath,
const char *  newpath 
)

References RmlCopyFile().

Referenced by CIndexSetForLoadingStage::AddMemoryLoadIndexToMainLoadIndex(), and FileSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RmlCopyFile()

bool RmlCopyFile ( const char *  oldpath,
const char *  newpath 
)

Referenced by FileSize(), and RmlMoveFile().

Here is the caller graph for this function:

◆ CreateTempFileName()

string CreateTempFileName ( )

References _MAX_PATH.

Referenced by FileSize().

Here is the caller graph for this function:

◆ MakeDir()

bool MakeDir ( const string &  DirName)

Referenced by FileSize(), MakeDirP(), and mkdirhier().

Here is the caller graph for this function:

◆ MakeDirP()

bool MakeDirP ( const string &  DirName)

References FileDirectory(), Format(), IsDirectory(), MakeDir(), and MakeDirP().

Referenced by FileSize(), MakeDirP(), and CConcIndexator::SplitProject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveWithPrint()

bool RemoveWithPrint ( const string &  FileName)

References FileExists().

Referenced by CIndexSetForLoadingStage::DeleteTempFiles(), and FileSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNumberOfOpenFiles()

size_t GetNumberOfOpenFiles ( pid_t  pid = 0)

return the number of open files for pid (linux only).

  • pid=0 maps to PID of current process)

Referenced by DDCProcessMemoryStatus::fetch(), CDDCLeafServer::handle__status(), and CDDCBranchServer::handle__status().

Here is the caller graph for this function:

◆ GetRegistryString()

string GetRegistryString ( string  RegistryPath)

◆ CanGetRegistryString()

bool CanGetRegistryString ( string  RegistryPath)

References GetRegistryString().

Referenced by DDCProcessMemoryStatus::fetch(), and GetThesaurusPath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsRmlRegistered()

bool IsRmlRegistered ( string &  Error)

References FileExists(), GetIniFilePath(), CExpc::m_strCause, and RML_REGISTRY_FILENAME.

Referenced by DDCProcessMemoryStatus::fetch(), LoadDDCServer(), LoadLocalCorpora(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RmlGetCurrentTime()

struct tm RmlGetCurrentTime ( )

References DDCTimeUnix::CalendarTime(), and DDCTimeUnix::Now().

Referenced by TUnitComment::TUnitComment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetIniFilePath()

string GetIniFilePath ( )

References GetRmlVariable().

Referenced by DDCProcessMemoryStatus::fetch(), GetRegistryString(), IsRmlRegistered(), LoadDDCServer(), LoadLocalCorpora(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRmlVariable()

string GetRmlVariable ( )

References Trim().

Referenced by BuildRMLPath(), DDCProcessMemoryStatus::fetch(), GetIniFilePath(), GetRegistryString(), and CLemmatizer::LoadDictionariesRegistry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rtrim()

char* rtrim ( char *  s)

◆ IsSuperEqualChar()

bool IsSuperEqualChar ( BYTE  ch1,
BYTE  ch2,
MorphLanguageEnum  langua 
)

References is_english_upper(), is_russian_upper(), ReverseChar(), and rtolower().

Referenced by DDCProcessMemoryStatus::fetch(), CGraphmatFile::FindKeySequence(), and StrSpacingCompare().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CompareWithoutRegister()

int CompareWithoutRegister ( const char *  s1,
const char *  s2,
size_t  l,
MorphLanguageEnum  langua 
)

References ReverseChar().

Referenced by DDCProcessMemoryStatus::fetch(), and CGraphanDicts::FindInIdents().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ force_rus_char()

BYTE force_rus_char ( BYTE  ch)

Referenced by DDCProcessMemoryStatus::fetch(), and force_to_rus().

Here is the caller graph for this function:

◆ force_to_rus()

bool force_to_rus ( char *  dest,
const char *  sour,
size_t  len 
)

References force_rus_char(), and is_russian_alpha().

Referenced by DDCProcessMemoryStatus::fetch(), and CGraphmatFile::InitNonContextDescriptors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IntToStr() [1/2]

char* IntToStr ( int  Value,
char *  Buffer 
)

Referenced by DDCProcessMemoryStatus::fetch(), and CGraphmatFile::GetGraphematicalLine().

Here is the caller graph for this function:

◆ IntToStr() [2/2]

string& IntToStr ( int  Value,
string &  oBuffer 
)

◆ TrimLeft()

string& TrimLeft ( string &  str)

Referenced by DDCProcessMemoryStatus::fetch(), and Trim().

Here is the caller graph for this function:

◆ TrimRight()

string& TrimRight ( string &  str)

Referenced by DDCProcessMemoryStatus::fetch(), CSocketAddr::ParseAddrPort(), and Trim().

Here is the caller graph for this function:

◆ Trim()

string& Trim ( string &  str)

References TrimLeft(), and TrimRight().

Referenced by CBiblIndex::AddBiblExpander(), AddMessage(), MorphoWizard::AddPrefixSet(), BuildHtmlHitStrWithHighlighting(), MorphoWizard::check_common_grammems(), MorphoWizard::check_prefixes(), CQueryTokenNode::CreateFileList(), CRunQueryData::CRunQueryData(), DeleteEmptyLines(), DDCProcessMemoryStatus::fetch(), MorphoWizard::find_wordforms(), CHitBorders::GetBorderIndicesString(), GetCWBFormattedStringRecursive(), CDDCBranchServer::GetHitContexts(), CDDCBranchServer::GetHitStringsFromOneCorpus(), CStringIndexator::GetIndicesString(), GetInterfacePOS(), GetLogLevel(), GetRmlVariable(), GetStringInnerFromTheFile(), GetTextFromXMLRecursive(), GetValue(), CDictionary::ImportFromText(), CConcIndexator::IndexOneTableTextArea(), CTabFormatIndexator::IndexTabFormat(), CRunQueryData::Init(), CMorphDict::Load(), CConcordance::LoadCorpusFiles(), LoadHosts(), CConcordance::LoadMaskedFiles(), newTermExpander(), NormalizeOborotStr(), ddcStringEnum< OffT_ >::openCompat(), ddcCorpusList< OffT_ >::openCompat(), CTabFormatIndexator::ProcessMetaField(), ReadAbbrevationsFromOneFile(), TRoss::ReadConfig(), ReadFlexiaModels(), CDumpParadigm::ReadFromFile(), CBibliography::ReadFromString(), CHost::ReadFromString(), CHighlightTags::ReadFromString(), CFlexiaModel::ReadFromString(), CGraphanDicts::ReadIdents(), CConcXml::ReadMorphXmlFileIntoGraTable(), MorphoWizard::ReadOnePrefixSet(), CLemmatizer::ReadOptions(), CDwdsThesaurus::ReadPathFromString(), CDDCBranchServer::ReadSelectedHosts(), CSourceFileHolder::ReadSourceFileList(), ReadTabFormatDocumentName(), ReadXmlField(), CFreeBiblStringIndex::RegisterBiblStringItemId(), CHitBorders::RegisterBorderIndices(), CBiblIndex::RegisterFreeBiblAttributes(), CStringIndexator::RegisterIndexAliases(), CStringIndexator::RegisterStringIndices(), CBiblIndex::RegisterTextAreas(), TxLang::setLanguage(), and MorphoWizard::slf_to_mrd().

Here is the call graph for this function:

◆ LoadFileToString()

bool LoadFileToString ( string  FileName,
string &  Result,
bool  clobber = true 
)

◆ SaveStringToFile()

bool SaveStringToFile ( const string &  Str,
const string &  FileName 
)

References WriteVector().

Referenced by DDCProcessMemoryStatus::fetch(), and CConcIndexator::SplitProject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ KOI8ToWin()

void KOI8ToWin ( string &  s)

References ktw().

Referenced by DDCProcessMemoryStatus::fetch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WinToKOI8()

void WinToKOI8 ( string &  s)

References wtk().

Referenced by DDCProcessMemoryStatus::fetch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StartsWith()

bool StartsWith ( const string &  body,
const string &  prefix 
)

◆ timestampLocal()

string timestampLocal ( time_t  timeval)

moo: timestamp stuff

Referenced by DDCProcessMemoryStatus::fetch().

Here is the caller graph for this function:

◆ timestampUTC()

string timestampUTC ( time_t  timeval)

◆ stringSplit()

vector<string> stringSplit ( const char *  s,
const char *  delims 
)

◆ stringSplitE() [1/2]

void stringSplitE ( const string &  s,
const string &  delims,
vector< string > &  tokens 
)

moo: split a string using std::string() methods only, allowing empty tokens

  • appends token-strings to argument tokens
  • tokens is not implicitly cleared

Referenced by CQKeys::Compile(), do_start(), DDCProcessMemoryStatus::fetch(), CDDCServerOptions::LoadString(), and stringSplitE().

Here is the caller graph for this function:

◆ stringSplitE() [2/2]

vector<string> stringSplitE ( const string &  s,
const string &  delims 
)

moo: stringSplitE() variant returning token-vector

References stringSplitE().

Here is the call graph for this function:

◆ date2int()

uint32_t date2int ( signed int  y,
unsigned int  m = 1,
unsigned int  d = 1 
)

moo: date-to-int encoding (v2.2.4: use signed years)

Referenced by CBibliography::ConvertDateToInt(), and DDCProcessMemoryStatus::fetch().

Here is the caller graph for this function:

◆ int2date()

void int2date ( uint32_t  i,
signed int *  y,
unsigned int *  m = NULL,
unsigned int *  d = NULL 
)

moo: int-to-date decoding (v2.2.4: use signed years)

Referenced by CQCountKeyExprDate::Evaluate(), CQCountKeyExprDateSlice::Evaluate(), and DDCProcessMemoryStatus::fetch().

Here is the caller graph for this function:

◆ int2hex()

string int2hex ( int32_t  i)

moo: int-to-hexidecimal string encoding; encoding preserves sort order (for subcorpus->server communications)

Referenced by DDCProcessMemoryStatus::fetch(), CConcSession::GetHitIds(), and CConcSession::GetSortKeyHint().

Here is the caller graph for this function:

◆ hex2int()

int32_t hex2int ( const string &  s)

moo: int-to-hexidecimal string deccoding; ; encoding preserves sort order

Referenced by DDCProcessMemoryStatus::fetch(), CFreeBiblIndex::GetIntegerLowerBound(), and CConcSession::SortKeyLB().

Here is the caller graph for this function:

◆ ddc_thread_init()

void ddc_thread_init ( const char *  log_label = NULL)

register a thread-local log prefix (unix only)

References ddc_loglabel_key, ddc_thread_data_alloc(), and ddc_thread_data_once.

Referenced by do_start(), DDCProcessMemoryStatus::fetch(), ListenerThread(), main(), and CDDCServerThread::run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ddc_log_label()

const char* ddc_log_label ( void  )

get thread-local log prefix, or empty string if none registered

References ddc_loglabel_key.

Referenced by ddc_set_log_label(), ddcLog(), and DDCProcessMemoryStatus::fetch().

Here is the caller graph for this function:

◆ ddc_set_log_label()

const char* ddc_set_log_label ( const char *  log_label)

set thread-local log prefix; returns old label (if any)

References ddc_log_label(), and ddc_loglabel_key.

Referenced by DDCProcessMemoryStatus::fetch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPredictionPartOfSpeech()

int GetPredictionPartOfSpeech ( const string &  PartOfSpeech,
MorphLanguageEnum  langua 
)

◆ GetLanguageByString()

bool GetLanguageByString ( string  s,
MorphLanguageEnum Result 
)

References EngRusMakeUpper(), morphEnglish, morphGeneric, morphGerman, morphRussian, and morphURL.

Referenced by MorphoWizard::load_wizard(), CConcordance::LoadOptionsFromString(), and TxLang::setLanguage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStringByLanguage()

string GetStringByLanguage ( MorphLanguageEnum  Langua)

◆ log2u32()

uint32_t log2u32 ( uint32_t  v)
inline

◆ VectorStride()

template<class VecT >
size_t VectorStride ( const VecT &  v)
inline

get average size of gap between elements of v[]

Parameters
vvector of numeric types castable to (size_t), sorted in ascending order, implicit start=0 (e.g. ddcBreakVector)
Returns
average size of gap between elements of v[], always >= 1

Referenced by CQueryNode::ConvertOccurrencesToHits(), and CConcSession::InitFileReferences().

Here is the caller graph for this function:

◆ TrimHeap()

void TrimHeap ( )
inline

Referenced by CConcSessionContext::CacheClear().

Here is the caller graph for this function:

◆ ClearContainer()

template<class ContainerT >
void ClearContainer ( ContainerT &  C)

◆ ClearVector()

template<class T >
void ClearVector ( vector< T > &  V)
inline

◆ ClearString()

void ClearString ( string &  S)
inline

◆ isbracket()

int isbracket ( BYTE  x)

References close_brackets, and open_brackets.

Referenced by ClearString(), CGraphmatFile::InitNonContextDescriptors(), and CGraLine::ReadWord().

Here is the caller graph for this function:

◆ dual_bracket()

size_t dual_bracket ( BYTE  x)

References all_brackets, and open_brackets.

Referenced by ClearString(), and CGraphmatFile::DealSentBreaker().

Here is the caller graph for this function:

◆ is_pseudo_graph()

bool is_pseudo_graph ( BYTE  x)

Referenced by ClearString(), and CGraLine::ReadWord().

Here is the caller graph for this function:

◆ is_spc_fill()

bool is_spc_fill ( BYTE  x)

Referenced by ClearString(), CGraLine::ReadWord(), and StrSpacingCompare().

Here is the caller graph for this function:

◆ is_english_upper()

bool is_english_upper ( BYTE  x)

References ASCII, and EngUpper.

Referenced by ClearString(), EngMakeLower(), gtolower(), is_english_alpha(), is_upper_alpha(), CUnitHolder::is_uppercase(), IsSuperEqualChar(), and ReverseChar().

Here is the caller graph for this function:

◆ is_english_lower()

bool is_english_lower ( BYTE  x)

◆ is_german_upper()

bool is_german_upper ( BYTE  x)

References ASCII, and GerUpper.

Referenced by is_german_alpha(), is_upper_alpha(), CUnitHolder::is_uppercase(), and RmlMakeLower().

Here is the caller graph for this function:

◆ is_german_lower()

bool is_german_lower ( BYTE  x)

References ASCII, and GerLower.

Referenced by GerEngRusMakeUpperTemplate(), is_german_alpha(), is_lower_alpha(), and CUnitHolder::is_lowercase().

Here is the caller graph for this function:

◆ is_russian_upper()

bool is_russian_upper ( BYTE  x)

◆ is_russian_lower()

bool is_russian_lower ( BYTE  x)

◆ is_upper_consonant()

bool is_upper_consonant ( BYTE  x,
MorphLanguageEnum  Langua 
)

References is_upper_alpha(), and is_upper_vowel().

Referenced by CLemmatizer::CheckAbbreviation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_lower_vowel()

bool is_lower_vowel ( BYTE  x,
MorphLanguageEnum  Langua 
)

References is_english_lower_vowel(), is_german_lower_vowel(), is_russian_lower_vowel(), morphEnglish, morphGerman, and morphRussian.

Referenced by MorphoWizard::slf_to_mrd(), and TransferReverseVowelNoToCharNo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_upper_vowel()

bool is_upper_vowel ( BYTE  x,
MorphLanguageEnum  Langua 
)

References is_english_upper_vowel(), is_german_upper_vowel(), is_russian_upper_vowel(), morphEnglish, morphGerman, and morphRussian.

Referenced by is_upper_consonant(), and TransferReverseVowelNoToCharNo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_english_alpha()

bool is_english_alpha ( BYTE  x)

References is_english_lower(), and is_english_upper().

Referenced by CheckLanguage(), CGraphmatFile::DealExtensionsAndLocalFileNames(), is_alpha(), is_generic_alpha(), and CUnitHolder::is_latin_alpha().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_russian_alpha()

bool is_russian_alpha ( BYTE  x)

◆ is_german_alpha()

bool is_german_alpha ( BYTE  x)

References is_german_lower(), and is_german_upper().

Referenced by CheckLanguage(), is_alpha(), and CUnitHolder::is_latin_alpha().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_alpha() [1/2]

bool is_alpha ( BYTE  x)

References is_german_alpha(), and is_russian_alpha().

Referenced by InitAlphabet(), CGraLine::LengthUntilDelimiters(), NormalizeOborotStr(), and RmlPcreMakeTables().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_alpha() [2/2]

bool is_alpha ( BYTE  x,
MorphLanguageEnum  langua 
)

◆ is_lower_alpha()

bool is_lower_alpha ( BYTE  x,
MorphLanguageEnum  langua 
)

◆ is_upper_alpha()

bool is_upper_alpha ( BYTE  x,
MorphLanguageEnum  langua 
)

◆ isnspace()

bool isnspace ( BYTE  x)

Referenced by CGraLine::ReadWord().

Here is the caller graph for this function:

◆ etoupper()

BYTE etoupper ( BYTE  ch)

◆ etolower()

BYTE etolower ( BYTE  ch)

References Azirkun, azirkun, Ccedille, ccedille, Eakut, eakut, Egravis, egravis, Ezirkun, ezirkun, Ntilda, ntilda, Ouml, ouml, Ozirkun, ozirkun, Uzirkun, and uzirkun.

Referenced by EngMakeLower(), EngRusMakeLower(), gtolower(), and ReverseChar().

Here is the caller graph for this function:

◆ rtoupper()

BYTE rtoupper ( BYTE  ch)

References Apostrophe, is_russian_lower(), LowerJO_cp1251, and UpperJO_cp1251.

Referenced by EngRusMakeUpper(), GerEngRusMakeUpperTemplate(), and ReverseChar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rtolower()

BYTE rtolower ( BYTE  ch)

References Apostrophe, is_russian_upper(), LowerJO_cp1251, and UpperJO_cp1251.

Referenced by EngRusMakeLower(), IsSuperEqualChar(), and ReverseChar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gtoupper()

BYTE gtoupper ( BYTE  ch)

References Auml, auml, etoupper(), is_english_lower(), Ouml, ouml, Uuml, and uuml.

Referenced by GerEngRusMakeUpperTemplate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gtolower()

BYTE gtolower ( BYTE  ch)

References Auml, auml, etolower(), is_english_upper(), Ouml, ouml, Uuml, and uuml.

Referenced by RmlMakeLower().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReverseChar()

BYTE ReverseChar ( BYTE  ch,
MorphLanguageEnum  langua 
)

◆ EngMakeUpper()

string& EngMakeUpper ( string &  word)

References etoupper(), is_english_lower(), and RegisterConverter().

Referenced by CQCount::countOptionsToString(), CConcSession::GetResultFormatByString(), CQFSort::toString(), CQFBiblSort::toString(), CQFContextSort::toString(), and CQFPrune::toString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EngMakeLower()

string& EngMakeLower ( string &  word)

References etolower(), is_english_upper(), and RegisterConverter().

Referenced by CBiblIndex::AddBiblExpander(), GetLogLevel(), IsHtmlFile(), IsJsonFile(), IsTableFile(), newTermExpander(), and CDDCServerOptions::Set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EngRusMakeLower()

string& EngRusMakeLower ( string &  word)

References etolower(), is_russian_upper(), and rtolower().

Referenced by RmlMakeLower().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RmlMakeUpper() [1/2]

char* RmlMakeUpper ( char *  word,
MorphLanguageEnum  langua 
)

◆ RmlMakeUpper() [2/2]

string& RmlMakeUpper ( string &  word,
MorphLanguageEnum  langua 
)

References GerEngRusMakeUpperTemplate(), morphGeneric, and stoupper().

Here is the call graph for this function:

◆ RmlMakeLower()

string& RmlMakeLower ( string &  word,
MorphLanguageEnum  langua 
)

◆ EngRusMakeUpper() [1/2]

string& EngRusMakeUpper ( string &  word)

References etoupper(), is_russian_lower(), and rtoupper().

Referenced by GetLanguageByString(), and CGraphanDicts::ReadExtensions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EngRusMakeUpper() [2/2]

char* EngRusMakeUpper ( char *  word)

References etoupper(), is_english_lower(), is_russian_lower(), and rtoupper().

Here is the call graph for this function:

◆ IsRussian()

bool IsRussian ( const char *  word)

References CheckLanguage(), and morphRussian.

Referenced by TRoss::ReadFromStrWithOneSignatura().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckLanguage()

bool CheckLanguage ( const char *  word,
MorphLanguageEnum  langua 
)

References CheckLanguage().

Here is the call graph for this function:

◆ ConvertJO2Je() [1/2]

void ConvertJO2Je ( string &  src)

References ConvertJO2JeTemplate().

Here is the call graph for this function:

◆ ConvertJO2Je() [2/2]

void ConvertJO2Je ( char *  src,
size_t  Length 
)

References ConvertJO2JeTemplate().

Referenced by CLemmatizerRussian::FilterSrc(), CGraphmatFile::GraphmatMain(), and MorphoWizard::prepare_for_RML().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConvertASCIIToHtmlSymbols()

string ConvertASCIIToHtmlSymbols ( const string &  txt)

Referenced by BuildHtmlHitStrWithHighlighting(), GenerateCountString(), and CConcSession::ShowBibliographyForTable().

Here is the caller graph for this function:

◆ RegisterConverter()

template<class T , class Pred , class Conv >
T& RegisterConverter ( T &  word,
size_t  Len,
Pred  P,
Conv  C 
)

Referenced by EngMakeLower(), EngMakeUpper(), GerEngRusMakeUpperTemplate(), and RmlMakeLower().

Here is the caller graph for this function:

◆ GerEngRusMakeUpperTemplate()

template<class T >
T& GerEngRusMakeUpperTemplate ( T &  word,
MorphLanguageEnum  Langua,
size_t  Len 
)

References etoupper(), gtoupper(), is_english_lower(), is_german_lower(), is_russian_lower(), morphGerman, RegisterConverter(), and rtoupper().

Referenced by CUnitHolder::BuildUnitBufferUpper(), and RmlMakeUpper().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _MAX_PATH

const unsigned int _MAX_PATH = 512

◆ cHyphenChar

const BYTE cHyphenChar = (BYTE) '-'

◆ cParagraph

const BYTE cParagraph = (BYTE) 21

Referenced by CGraLine::ReadWord().

◆ cCompanyChar

const BYTE cCompanyChar = (BYTE) 176

Referenced by CGraLine::ReadWord().

◆ cIonChar

const BYTE cIonChar = (BYTE) 183

Referenced by CGraLine::ReadWord().

◆ cNumberChar

const BYTE cNumberChar = (BYTE) 0xB9

Referenced by CGraLine::ReadWord().

◆ cPiChar

const BYTE cPiChar = (BYTE) 182

Referenced by CGraLine::ReadWord().

◆ cEllipseChar

const BYTE cEllipseChar = (BYTE) 133

◆ UnknownPartOfSpeech

const BYTE UnknownPartOfSpeech = 0xff

◆ Auml

const BYTE Auml = 196

◆ auml

const BYTE auml = 228

◆ Uuml

const BYTE Uuml = 220

◆ uuml

const BYTE uuml = 252

◆ Ouml

const BYTE Ouml = 214

◆ ouml

const BYTE ouml = 246

◆ szlig

const BYTE szlig = 223

◆ Nu

const BYTE Nu = 181

◆ agrave

const BYTE agrave = 224

◆ egrave

const BYTE egrave = 232

◆ eacute

const BYTE eacute = 233

◆ LowerJO_cp1251

const BYTE LowerJO_cp1251 = 184

◆ UpperJO_cp1251

const BYTE UpperJO_cp1251 = 168

◆ LowerE_cp1251

const BYTE LowerE_cp1251 = 229

Referenced by ConvertJO2JeTemplate().

◆ UpperE_cp1251

const BYTE UpperE_cp1251 = 197

Referenced by ConvertJO2JeTemplate().

◆ Apostrophe

const BYTE Apostrophe = 39