1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-19 14:50:07 +03:00

unicode: Make Unicode functions private

This commit is contained in:
Nick Wellnhofer 2025-03-04 16:00:08 +01:00
parent 3d37ff84c3
commit 03a8d5f93d
11 changed files with 431 additions and 1963 deletions

View File

@ -32,6 +32,7 @@ ignored_files = {
"timsort.h": "Internal header only for xpath.c 2.9.0",
"nanoftp.h": "empty",
"SAX.h": "empty",
"xmlunicode.h": "empty",
}
ignored_words = {

File diff suppressed because it is too large Load Diff

View File

@ -2,365 +2,14 @@
* Summary: Unicode character APIs
* Description: API for the Unicode character APIs
*
* This file is automatically generated from the
* UCS description files of the Unicode Character Database
* http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html
* using the genUnicode.py Python script.
*
* Generation date: Tue Apr 30 17:30:38 2024
* Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt
* Author: Daniel Veillard
* Deprecated, don't use.
*/
#ifndef __XML_UNICODE_H__
#define __XML_UNICODE_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_UNICODE_ENABLED
#ifdef __cplusplus
extern "C" {
#ifdef __GNUC__
#warning "libxml/xmlunicode.h is deprecated"
#endif
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsAegeanNumbers (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsAlphabeticPresentationForms (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsArabic (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsArabicPresentationFormsA (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsArabicPresentationFormsB (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsArmenian (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsArrows (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsBasicLatin (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsBengali (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsBlockElements (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsBopomofo (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsBopomofoExtended (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsBoxDrawing (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsBraillePatterns (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsBuhid (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsByzantineMusicalSymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCJKCompatibility (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCJKCompatibilityForms (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographs (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographsSupplement (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCJKRadicalsSupplement (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCJKSymbolsandPunctuation (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographs (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionA (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionB (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCherokee (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarks (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarksforSymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCombiningHalfMarks (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCombiningMarksforSymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsControlPictures (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCurrencySymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCypriotSyllabary (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCyrillic (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCyrillicSupplement (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsDeseret (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsDevanagari (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsDingbats (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsEnclosedAlphanumerics (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsEnclosedCJKLettersandMonths (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsEthiopic (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsGeneralPunctuation (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsGeometricShapes (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsGeorgian (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsGothic (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsGreek (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsGreekExtended (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsGreekandCoptic (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsGujarati (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsGurmukhi (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsHalfwidthandFullwidthForms (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsHangulCompatibilityJamo (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsHangulJamo (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsHangulSyllables (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsHanunoo (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsHebrew (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsHighPrivateUseSurrogates (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsHighSurrogates (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsHiragana (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsIPAExtensions (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsIdeographicDescriptionCharacters (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsKanbun (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsKangxiRadicals (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsKannada (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsKatakana (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsKatakanaPhoneticExtensions (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsKhmer (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsKhmerSymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLao (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLatin1Supplement (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLatinExtendedA (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLatinExtendedB (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLatinExtendedAdditional (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLetterlikeSymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLimbu (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLinearBIdeograms (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLinearBSyllabary (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsLowSurrogates (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMalayalam (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMathematicalAlphanumericSymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMathematicalOperators (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsA (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsB (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMiscellaneousSymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMiscellaneousSymbolsandArrows (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMiscellaneousTechnical (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMongolian (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMusicalSymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsMyanmar (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsNumberForms (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsOgham (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsOldItalic (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsOpticalCharacterRecognition (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsOriya (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsOsmanya (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsPhoneticExtensions (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsPrivateUse (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsPrivateUseArea (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsRunic (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsShavian (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSinhala (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSmallFormVariants (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSpacingModifierLetters (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSpecials (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSuperscriptsandSubscripts (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSupplementalArrowsA (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSupplementalArrowsB (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSupplementalMathematicalOperators (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaA (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaB (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsSyriac (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsTagalog (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsTagbanwa (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsTags (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsTaiLe (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsTaiXuanJingSymbols (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsTamil (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsTelugu (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsThaana (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsThai (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsTibetan (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsUgaritic (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsVariationSelectors (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsVariationSelectorsSupplement (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsYiRadicals (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsYiSyllables (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsYijingHexagramSymbols (int code);
XMLPUBFUN int xmlUCSIsBlock (int code, const char *block);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatC (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatCc (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatCf (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatCo (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatCs (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatL (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatLl (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatLm (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatLo (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatLt (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatLu (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatM (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatMc (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatMe (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatMn (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatN (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatNd (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatNl (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatNo (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatP (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatPc (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatPd (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatPe (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatPf (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatPi (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatPo (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatPs (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatS (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatSc (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatSk (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatSm (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatSo (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatZ (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatZl (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatZp (int code);
XML_DEPRECATED
XMLPUBFUN int xmlUCSIsCatZs (int code);
XMLPUBFUN int xmlUCSIsCat (int code, const char *cat);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_UNICODE_ENABLED */
#endif /* __XML_UNICODE_H__ */

View File

@ -243,11 +243,9 @@
/**
* LIBXML_UNICODE_ENABLED:
*
* Whether the Unicode related interfaces are compiled in
* Removed in 2.14
*/
#if @WITH_REGEXPS@
#define LIBXML_UNICODE_ENABLED
#endif
#undef LIBXML_UNICODE_ENABLED
/**
* LIBXML_REGEXP_ENABLED:

View File

@ -16,6 +16,7 @@ EXTRA_DIST = \
string.h \
threads.h \
tree.h \
unicode.h \
xinclude.h \
xpath.h \
xzlib.h

44
include/private/unicode.h Normal file
View File

@ -0,0 +1,44 @@
#ifndef XML_UNICODE_H_PRIVATE__
#define XML_UNICODE_H_PRIVATE__
XML_HIDDEN int xmlUCSIsBlock (int code, const char *block);
XML_HIDDEN int xmlUCSIsCat (int code, const char *cat);
XML_HIDDEN int xmlUCSIsCatC (int code);
XML_HIDDEN int xmlUCSIsCatCc (int code);
XML_HIDDEN int xmlUCSIsCatCf (int code);
XML_HIDDEN int xmlUCSIsCatCo (int code);
XML_HIDDEN int xmlUCSIsCatCs (int code);
XML_HIDDEN int xmlUCSIsCatL (int code);
XML_HIDDEN int xmlUCSIsCatLl (int code);
XML_HIDDEN int xmlUCSIsCatLm (int code);
XML_HIDDEN int xmlUCSIsCatLo (int code);
XML_HIDDEN int xmlUCSIsCatLt (int code);
XML_HIDDEN int xmlUCSIsCatLu (int code);
XML_HIDDEN int xmlUCSIsCatM (int code);
XML_HIDDEN int xmlUCSIsCatMc (int code);
XML_HIDDEN int xmlUCSIsCatMe (int code);
XML_HIDDEN int xmlUCSIsCatMn (int code);
XML_HIDDEN int xmlUCSIsCatN (int code);
XML_HIDDEN int xmlUCSIsCatNd (int code);
XML_HIDDEN int xmlUCSIsCatNl (int code);
XML_HIDDEN int xmlUCSIsCatNo (int code);
XML_HIDDEN int xmlUCSIsCatP (int code);
XML_HIDDEN int xmlUCSIsCatPc (int code);
XML_HIDDEN int xmlUCSIsCatPd (int code);
XML_HIDDEN int xmlUCSIsCatPe (int code);
XML_HIDDEN int xmlUCSIsCatPf (int code);
XML_HIDDEN int xmlUCSIsCatPi (int code);
XML_HIDDEN int xmlUCSIsCatPo (int code);
XML_HIDDEN int xmlUCSIsCatPs (int code);
XML_HIDDEN int xmlUCSIsCatS (int code);
XML_HIDDEN int xmlUCSIsCatSc (int code);
XML_HIDDEN int xmlUCSIsCatSk (int code);
XML_HIDDEN int xmlUCSIsCatSm (int code);
XML_HIDDEN int xmlUCSIsCatSo (int code);
XML_HIDDEN int xmlUCSIsCatZ (int code);
XML_HIDDEN int xmlUCSIsCatZl (int code);
XML_HIDDEN int xmlUCSIsCatZp (int code);
XML_HIDDEN int xmlUCSIsCatZs (int code);
#endif /* XML_UNICODE_H_PRIVATE__ */

View File

@ -631,11 +631,7 @@ xmlHasFeature(xmlFeature feature)
return(0);
#endif
case XML_WITH_UNICODE:
#ifdef LIBXML_UNICODE_ENABLED
return(1);
#else
return(0);
#endif
case XML_WITH_REGEXP:
#ifdef LIBXML_REGEXP_ENABLED
return(1);

View File

@ -13,7 +13,6 @@
#include <libxml/HTMLtree.h>
#include <libxml/xinclude.h>
#include <libxml/xpointer.h>
#include <libxml/xmlunicode.h>
#include <libxml/xmlregexp.h>
#include <libxml/xmlautomata.h>
#include <libxml/xmlreader.h>

View File

@ -191,12 +191,6 @@ ckeys = sorted(Categories.keys())
#
# Generate the resulting files
#
try:
header = open("include/libxml/xmlunicode.h", "w")
except:
print("Failed to open include/libxml/xmlunicode.h")
sys.exit(1)
try:
output = open("xmlunicode.c", "w")
except:
@ -205,34 +199,6 @@ except:
date = time.asctime(time.localtime(time.time()))
header.write(
"""/*
* Summary: Unicode character APIs
* Description: API for the Unicode character APIs
*
* This file is automatically generated from the
* UCS description files of the Unicode Character Database
* %s
* using the genUnicode.py Python script.
*
* Generation date: %s
* Sources: %s
* Author: Daniel Veillard
*/
#ifndef __XML_UNICODE_H__
#define __XML_UNICODE_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_UNICODE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
""" % (webpage, date, sources));
output.write(
"""/*
* xmlunicode.c: this module implements the Unicode character APIs
@ -250,13 +216,14 @@ output.write(
#define IN_LIBXML
#include "libxml.h"
#ifdef LIBXML_UNICODE_ENABLED
#ifdef LIBXML_REGEXP_ENABLED
#include <string.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlunicode.h>
#include <libxml/chvalid.h>
#include "private/unicode.h"
typedef int (xmlIntFunc)(int); /* just to keep one's mind untwisted */
typedef struct {
@ -272,29 +239,8 @@ typedef struct {
static xmlIntFunc *xmlUnicodeLookup(const xmlUnicodeNameTable *tptr, const char *tname);
static const xmlUnicodeRange xmlUnicodeBlocks[] = {
""" % (webpage, date, sources));
flag = 0
for block in bkeys:
name = block.replace('-', '')
if flag:
output.write(',\n')
else:
flag = 1
output.write(' {"%s", xmlUCSIs%s}' % (block, name))
output.write('};\n\n')
output.write('static const xmlUnicodeRange xmlUnicodeCats[] = {\n')
flag = 0;
for name in ckeys:
if flag:
output.write(',\n')
else:
flag = 1
output.write(' {"%s", xmlUCSIsCat%s}' % (name, name))
output.write('};\n\n')
#
# For any categories with more than minTableSize ranges we generate
# a range table suitable for xmlCharInRange
@ -335,10 +281,7 @@ for name in ckeys:
output.write(
"""static const xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s};
static const xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s};
/**
"""/**
* xmlUnicodeLookup:
* @tptr: pointer to the name table
* @name: name to be found
@ -359,7 +302,8 @@ static xmlIntFunc
sptr = tptr->table;
while (low <= high) {
mid = (low + high) / 2;
if ((cmp=strcmp(tname, sptr[mid].rangename)) == 0)
cmp = strcmp(tname, sptr[mid].rangename);
if (cmp == 0)
return (sptr[mid].func);
if (cmp < 0)
high = mid - 1;
@ -369,16 +313,15 @@ static xmlIntFunc
return (NULL);
}
""" % (len(BlockNames), len(Categories)) )
""")
for block in bkeys:
name = block.replace('-', '')
header.write("XML_DEPRECATED\nXMLPUBFUN int xmlUCSIs%s\t(int code);\n" % name)
output.write("/**\n * xmlUCSIs%s:\n * @code: UCS code point\n" % (name))
output.write(" *\n * Check whether the character is part of %s UCS Block\n"%
(block))
output.write(" *\n * Returns 1 if true 0 otherwise\n */\n");
output.write("int\nxmlUCSIs%s(int code) {\n return(" % name)
output.write("static int\nxmlUCSIs%s(int code) {\n return(" % name)
flag = 0
for (start, end) in BlockNames[block]:
if flag:
@ -388,32 +331,8 @@ for block in bkeys:
output.write("((code >= %s) && (code <= %s))" % (start, end))
output.write(");\n}\n\n")
header.write("\nXMLPUBFUN int xmlUCSIsBlock\t(int code, const char *block);\n\n")
output.write(
"""/**
* xmlUCSIsBlock:
* @code: UCS code point
* @block: UCS block name
*
* Check whether the character is part of the UCS Block
*
* Returns 1 if true, 0 if false and -1 on unknown block
*/
int
xmlUCSIsBlock(int code, const char *block) {
xmlIntFunc *func;
func = xmlUnicodeLookup(&xmlUnicodeBlockTbl, block);
if (func == NULL)
return (-1);
return (func(code));
}
""")
for name in ckeys:
ranges = Categories[name]
header.write("XML_DEPRECATED\nXMLPUBFUN int xmlUCSIsCat%s\t(int code);\n" % name)
output.write("/**\n * xmlUCSIsCat%s:\n * @code: UCS code point\n" % (name))
output.write(" *\n * Check whether the character is part of %s UCS Category\n"%
(name))
@ -438,9 +357,54 @@ for name in ckeys:
hex(begin), hex(end)))
output.write(");\n}\n\n")
header.write("\nXMLPUBFUN int xmlUCSIsCat\t(int code, const char *cat);\n")
output.write(
"""/**
"""static const xmlUnicodeRange xmlUnicodeBlocks[] = {""")
flag = 0
for block in bkeys:
name = block.replace('-', '')
if flag:
output.write(',\n')
else:
flag = 1
output.write(' {"%s", xmlUCSIs%s}' % (block, name))
output.write('};\n\n')
output.write('static const xmlUnicodeRange xmlUnicodeCats[] = {\n')
flag = 0;
for name in ckeys:
if flag:
output.write(',\n')
else:
flag = 1
output.write(' {"%s", xmlUCSIsCat%s}' % (name, name))
output.write(
"""};
static const xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s};
static const xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s};
/**
* xmlUCSIsBlock:
* @code: UCS code point
* @block: UCS block name
*
* Check whether the character is part of the UCS Block
*
* Returns 1 if true, 0 if false and -1 on unknown block
*/
int
xmlUCSIsBlock(int code, const char *block) {
xmlIntFunc *func;
func = xmlUnicodeLookup(&xmlUnicodeBlockTbl, block);
if (func == NULL)
return (-1);
return (func(code));
}
/**
* xmlUCSIsCat:
* @code: UCS code point
* @cat: UCS Category name
@ -459,18 +423,7 @@ xmlUCSIsCat(int code, const char *cat) {
return (func(code));
}
#endif /* LIBXML_UNICODE_ENABLED */
""")
#endif /* LIBXML_REGEXP_ENABLED */
""" % (len(BlockNames), len(Categories)))
header.write("""
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_UNICODE_ENABLED */
#endif /* __XML_UNICODE_H__ */
""");
header.close()
output.close()

View File

@ -27,11 +27,11 @@
#include <libxml/parserInternals.h>
#include <libxml/xmlregexp.h>
#include <libxml/xmlautomata.h>
#include <libxml/xmlunicode.h>
#include "private/error.h"
#include "private/memory.h"
#include "private/regexp.h"
#include "private/unicode.h"
#ifndef SIZE_MAX
#define SIZE_MAX ((size_t) -1)

File diff suppressed because it is too large Load Diff