uniread.cpp revision 57c7423f76775f902dbaa34cededb2df1947f5d8
45e9809aff7304721fddb95654901b32195c9c7avboxsync * innotek Portable Runtime - Unicode Specification Reader.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (C) 2006-2007 innotek GmbH
45e9809aff7304721fddb95654901b32195c9c7avboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
45e9809aff7304721fddb95654901b32195c9c7avboxsync * available from http://www.virtualbox.org. This file is free software;
45e9809aff7304721fddb95654901b32195c9c7avboxsync * you can redistribute it and/or modify it under the terms of the GNU
45e9809aff7304721fddb95654901b32195c9c7avboxsync * General Public License as published by the Free Software Foundation,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
45e9809aff7304721fddb95654901b32195c9c7avboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
45e9809aff7304721fddb95654901b32195c9c7avboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*******************************************************************************
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Header Files *
45e9809aff7304721fddb95654901b32195c9c7avboxsync*******************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Strip a line.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @returns pointer to first non-blank char.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param pszLine The line string to strip.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Checks if the line is blank or a comment line and should be skipped.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param pszLine The line to consider.
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic bool IsCommentOrBlankLine(const char *pszLine)
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (*pszLine == ' ' || *pszLine == '\t' || *pszLine == '\n' || *pszLine == '\r')
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Get the first field in the string.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @returns Pointer to the next field.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param ppsz Where to store the pointer to the next field.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param pszLine The line string. (could also be *ppsz from a FirstNext call)
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* strip */
pszLine++;
return pszLine;
if (*psz)
return Default;
pszEnd++;
return ~(RTUNICP)0;
return ~(RTUNICP)0;
if (!*pszStr)
if (psz)
return psz;
struct CPINFO
const char *pszName;
const char *pszGeneralCategory;
const char *pszCanonicalCombiningClass;
const char *pszBidiClass;
const char *pszDecompositionType;
const char *pszDecompositionMapping;
const char *pszNumericType;
const char *pszNumericValue;
const char *pszBidiMirrored;
const char *pszUnicode1Name;
const char *pszISOComment;
static void NullEntry(unsigned i)
* Read the UnicodeData.txt file.
if (!pFile)
RTUNICP i = 0;
char *pszCurField;
while (i < CodePoint)
NullEntry(i++);
if (i != CodePoint)
NullEntry(i++);
else if (!strcmp(pszProperty, "Other_Default_Ignorable_Code_Point")) pCPInfo->fOtherDefaultIgnorableCodePoint = 1;
else if (!strcmp(pszProperty, "Default_Ignorable_Code_Point")) pCPInfo->fDefaultIgnorableCodePoint = 1;
if (!pFile)
char *pszCurField;
if (!*pszProperty)
return psz;
if (!*pszFlags)
static unsigned g_offStream2 = 0;
static void Stream2Init(void)
g_offStream2 = 0;
static int Stream2Flush(void)
return cch;
* Print the unidata.cpp file header and include list.
" * available from http://www.virtualbox.org. This file is free software;\n"
argv0);
int PrintFlags(void)
Stream2Init();
RTUNICP i = 0;
unsigned iNonNull = i;
iNonNull++;
if (iStart >= 0)
i = iNonNull;
if (iStart < 0)
iStart = i;
return Stream2Flush();
static int PrintUpper(void)
Stream2Init();
RTUNICP i = 0;
unsigned iSameCase = i;
iSameCase++;
if (iStart >= 0)
i = iSameCase;
if (iStart < 0)
iStart = i;
printf(" 0x%02x, /* U+%06x: %s*/\n", g_aCPInfo[i].SimpleUpperCaseMapping, g_aCPInfo[i].CodePoint, g_aCPInfo[i].pszName);
return Stream2Flush();
static int PrintLower(void)
Stream2Init();
RTUNICP i = 0;
unsigned iSameCase = i;
iSameCase++;
if (iStart >= 0)
i = iSameCase;
if (iStart < 0)
iStart = i;
printf(" 0x%02x, /* U+%06x: %s*/\n", g_aCPInfo[i].SimpleLowerCaseMapping, g_aCPInfo[i].CodePoint, g_aCPInfo[i].pszName);
return Stream2Flush();
int iFile = 0;
switch (iFile++)
if (rc)
return rc;
if (rc)
return rc;
if (rc)
return rc;
if (rc)
return rc;
if (rc)
return rc;
if (rc)
return rc;
if (rc)
return rc;
return rc;