mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-06-28 23:33:03 +08:00
Compare commits
232 Commits
v9.4.0.129
...
feature/li
| Author | SHA1 | Date | |
|---|---|---|---|
| 42aa73520b | |||
| ad6094b18c | |||
| c0cad5429e | |||
| e353ff1b96 | |||
| 5f6075ca33 | |||
| 55e5f973b0 | |||
| 78ed5b3d74 | |||
| ba0e0f7449 | |||
| ba992cc401 | |||
| fba14fcf7b | |||
| a2c24b8dc0 | |||
| 073f100fe0 | |||
| e30a6acc87 | |||
| a1fe8752fa | |||
| 30f21fc3c7 | |||
| b2c2a0ec6c | |||
| 77ef943473 | |||
| be921d6be7 | |||
| 67733c1733 | |||
| bd92a3550f | |||
| 812c59beaa | |||
| c5b798b8a9 | |||
| 6a6c85b6bd | |||
| 0e40482b9f | |||
| 742dfb54b8 | |||
| 52b21fbaed | |||
| aef42511ad | |||
| 692eb8c878 | |||
| 7f16ac66f0 | |||
| a94d46ee06 | |||
| 2dd929dc95 | |||
| 1cfce0fe84 | |||
| 1fc363c189 | |||
| 3a0c438b9c | |||
| f2bf914e72 | |||
| 62a25fa847 | |||
| 7ac9645010 | |||
| 4250382f87 | |||
| 4eca22efde | |||
| 9db2d2f328 | |||
| a868451b5d | |||
| cb217be2a2 | |||
| 6ccf19e036 | |||
| 2582927c72 | |||
| 3fe3382c1e | |||
| b139dec538 | |||
| 0b12c5b521 | |||
| 4c0c47a3cf | |||
| 234f867837 | |||
| 6366306f9c | |||
| 75f97349ca | |||
| 9ef4de7010 | |||
| 5bf72dcfb6 | |||
| f6decd4754 | |||
| f4a0f3f01a | |||
| 50816132e9 | |||
| 8e596451a9 | |||
| 8364bc02a6 | |||
| 815b6623a3 | |||
| 051f1d2c94 | |||
| c2000257aa | |||
| c5b2f3d1f2 | |||
| 72f7aaa6c2 | |||
| 13b19cc13f | |||
| 9720bd18a4 | |||
| a46e0d0a67 | |||
| 9ddd969b01 | |||
| 828eee5ed5 | |||
| a95d8712d3 | |||
| 3f76fca0f7 | |||
| 1c9ce65ba9 | |||
| 09b1d56a9a | |||
| bc59e34153 | |||
| 9679c6e7f8 | |||
| 2ffc0a7844 | |||
| c7e7fd4aa1 | |||
| 1846056b74 | |||
| 378841d655 | |||
| facd131d7b | |||
| f39716a5da | |||
| d1fada2542 | |||
| 16929b3a54 | |||
| a2f52951b2 | |||
| f3d34b1363 | |||
| 07e563afe8 | |||
| 75b3665ad5 | |||
| bdbad87830 | |||
| 290e4a0884 | |||
| 0242c5885b | |||
| 1c13c80197 | |||
| ddd991601c | |||
| 57c26eb998 | |||
| 2c35b5f422 | |||
| ab76f46fd4 | |||
| 2dd2f3bcc6 | |||
| 5f005b4501 | |||
| 0830ed031e | |||
| e63d62bb04 | |||
| 90029fb2f3 | |||
| d4e1b31e10 | |||
| 1580494bdb | |||
| f4fc487ce3 | |||
| a5bfa94770 | |||
| 85a615cc9a | |||
| 91701ed58d | |||
| 279349323f | |||
| 1dae175272 | |||
| 7c6f9f2ad6 | |||
| efc9bab6ed | |||
| 73b32984e2 | |||
| f269db67bb | |||
| 685b2bb9e0 | |||
| 55fe2e968f | |||
| d90c3aa3ac | |||
| e3e247e835 | |||
| 87c3f9beff | |||
| 9b196ada1f | |||
| cd58508d0f | |||
| d41aef7ec6 | |||
| bdc22190bd | |||
| 9989510d60 | |||
| 2f1a76fba6 | |||
| 0693bdc115 | |||
| ffb528636f | |||
| abc4619924 | |||
| fe36b3e1e6 | |||
| e72a4f8e8c | |||
| 0b2babbefc | |||
| 32da1a4901 | |||
| 15f423dbb9 | |||
| b5c29e49e2 | |||
| 9a4f929510 | |||
| 206ee9c976 | |||
| 7a8669d7f8 | |||
| ea28ff69a9 | |||
| 88626378a7 | |||
| 261cf72685 | |||
| 219bf06855 | |||
| 23e736051f | |||
| 8870516a8a | |||
| dbe56878b1 | |||
| 1f9ee8628e | |||
| 84aa409b1e | |||
| 6df60b9b4e | |||
| 52096d1b0b | |||
| 8fa5f8944e | |||
| 27dc6403d7 | |||
| ecaef0fbed | |||
| 2addc5a3d8 | |||
| 4e1afe5c55 | |||
| 9ae5855ed0 | |||
| 8d4e216852 | |||
| 866bf08da3 | |||
| 9e1bb2cd22 | |||
| bb97d00ae7 | |||
| 66eaed4f18 | |||
| 4739b9f9dd | |||
| e8f1691348 | |||
| 0b42267c43 | |||
| 6f1bfc3064 | |||
| f57f573ac4 | |||
| 0579b93796 | |||
| 2074785963 | |||
| ed697edba2 | |||
| 686c72a1c8 | |||
| 41124d3301 | |||
| 95d6c6c927 | |||
| 9ae76b07a1 | |||
| 0d7e535114 | |||
| e0af1357e5 | |||
| d4f80ea036 | |||
| 8e90fbac69 | |||
| 322fda0e07 | |||
| b0d70ff38a | |||
| 2a409336a3 | |||
| 4cdc416e0b | |||
| 7046f1d465 | |||
| 61f25af847 | |||
| 9304d10674 | |||
| 278dffc7c7 | |||
| bd7aa2df96 | |||
| 3d4dc3116e | |||
| f2fdcf4efd | |||
| ae7dbf291f | |||
| e83dbf57af | |||
| 3aa729d65b | |||
| cb0176ecca | |||
| b75afead99 | |||
| 290a134cdb | |||
| 6d9a2e0d09 | |||
| 32c4964cca | |||
| c2dd7b5108 | |||
| 11000aa465 | |||
| 6630a882ed | |||
| e20143fa2e | |||
| e40603df61 | |||
| 6d0db29975 | |||
| a43af51577 | |||
| cf0f2be204 | |||
| 44e3e77631 | |||
| e4df8df318 | |||
| eca98f612c | |||
| e429ff685f | |||
| 03334267c9 | |||
| 417c3a55ec | |||
| 90eb06ac20 | |||
| 031c1c91e6 | |||
| 8a8e17562b | |||
| 9f36c04d33 | |||
| 7dffc8245a | |||
| 869774bcc1 | |||
| 27103958fe | |||
| 95c9c95a2e | |||
| 1753007900 | |||
| f43230dcaf | |||
| bb7d2ce8ee | |||
| ed8a47cbb7 | |||
| 3b2721e2da | |||
| 19c66750a8 | |||
| 4b61f6e62a | |||
| 72b57be353 | |||
| ef295fc115 | |||
| a62528e90e | |||
| 644ec4e651 | |||
| 6ca34d9c69 | |||
| 473f6aef1e | |||
| 85027065e6 | |||
| f66c646c2c | |||
| a40e246d7d | |||
| 66d36b64b0 | |||
| 954f3c91bb | |||
| 18d36179bd |
1
.gitignore
vendored
1
.gitignore
vendored
@ -46,5 +46,6 @@ DesktopEditor/fontengine/js/common/freetype-2.10.4
|
||||
|
||||
.qtc_clangd
|
||||
Common/3dParty/openssl/openssl/
|
||||
Common/3dParty/libxml/libxml2/
|
||||
|
||||
msvc_make.bat
|
||||
|
||||
@ -525,6 +525,7 @@ namespace NSCSS
|
||||
m_mDefaultStyleData[L"ul"] = new CElement(L"ul", {{L"margin-top", L"100tw"},
|
||||
{L"margin-bottom", L"100tw"}});
|
||||
m_mDefaultStyleData[L"textarea"] = new CElement(L"textarea", {{L"border", L"1px solid black"}});
|
||||
m_mDefaultStyleData[L"th"] = new CElement(L"b", {{L"font-weight", L"bold"}});
|
||||
}
|
||||
|
||||
CCssCalculator_Private::CCssCalculator_Private()
|
||||
|
||||
@ -118,6 +118,11 @@ namespace NSCSS
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool LessSignificantThen(const CValueBase& oValue) const
|
||||
{
|
||||
return oValue.m_unLevel >= m_unLevel && (!m_bImportant || oValue.m_bImportant) && !oValue.Empty();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
#include "CDocumentStyle.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_set>
|
||||
#include <wchar.h>
|
||||
#include <math.h>
|
||||
|
||||
@ -10,14 +10,14 @@ base_directory = os.getcwd()
|
||||
|
||||
if not base.is_dir("gumbo-parser"):
|
||||
base.cmd("git", ["clone", "https://github.com/google/gumbo-parser.git"])
|
||||
base.cmd_in_dir("gumbo-parser", "git", ["checkout", "aa91b27b02c0c80c482e24348a457ed7c3c088e0"])
|
||||
base.cmd_in_dir("gumbo-parser", "git", ["checkout", "aa91b27b02c0c80c482e24348a457ed7c3c088e0", "--quiet"])
|
||||
|
||||
# fix gumbo
|
||||
base.replaceInFile(base_directory + "/gumbo-parser/src/tag.c", "isspace(*c)", "isspace((unsigned char)*c)")
|
||||
|
||||
if not base.is_dir("katana-parser"):
|
||||
base.cmd("git", ["clone", "https://github.com/jasenhuang/katana-parser.git"])
|
||||
base.cmd_in_dir("katana-parser", "git", ["checkout", "be6df458d4540eee375c513958dcb862a391cdd1"])
|
||||
base.cmd_in_dir("katana-parser", "git", ["checkout", "be6df458d4540eee375c513958dcb862a391cdd1", "--quiet"])
|
||||
|
||||
# fix katana
|
||||
base.replaceInFileUtf8(base_directory + "/katana-parser/src/tokenizer.c", "static inline bool katana_is_html_space(char c);", "static inline bool2 katana_is_html_space(char c);")
|
||||
|
||||
327
Common/3dParty/libxml/configure_libxml2.py
Normal file
327
Common/3dParty/libxml/configure_libxml2.py
Normal file
@ -0,0 +1,327 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.append('../../../../build_tools/scripts')
|
||||
import base
|
||||
|
||||
# suppresses status output when set via --quiet/-q; errors are still shown
|
||||
QUIET = False
|
||||
|
||||
def log(msg):
|
||||
if not QUIET:
|
||||
print(msg)
|
||||
return
|
||||
|
||||
def log_info(msg):
|
||||
if not QUIET:
|
||||
base.print_info(msg)
|
||||
return
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Per-target defaults (mirror LIBXML2_WITH_* options from CMakeLists.txt
|
||||
# and the platform branches inside configure.ac)
|
||||
# ---------------------------------------------------------------------------
|
||||
COMMON_FEATURES = {
|
||||
"WITH_C14N": 0,
|
||||
"WITH_CATALOG": 0,
|
||||
"WITH_DEBUG": 0,
|
||||
"WITH_HTML": 1,
|
||||
"WITH_HTTP": 0,
|
||||
"WITH_ICONV": 0,
|
||||
"WITH_ICU": 0,
|
||||
"WITH_ISO8859X": 0,
|
||||
"WITH_MODULES": 0,
|
||||
"WITH_OUTPUT": 1,
|
||||
"WITH_PATTERN": 0,
|
||||
"WITH_PUSH": 1,
|
||||
"WITH_READER": 1,
|
||||
"WITH_REGEXPS": 0,
|
||||
"WITH_RELAXNG": 0,
|
||||
"WITH_SAX1": 1,
|
||||
"WITH_SCHEMAS": 0,
|
||||
"WITH_SCHEMATRON": 0,
|
||||
"WITH_THREADS": 0,
|
||||
"WITH_THREAD_ALLOC": 0,
|
||||
"WITH_VALID": 0,
|
||||
"WITH_WRITER": 0,
|
||||
"WITH_XINCLUDE": 0,
|
||||
"WITH_XPATH": 0,
|
||||
"WITH_XPTR": 1,
|
||||
"WITH_ZLIB": 0
|
||||
}
|
||||
|
||||
TARGETS = {
|
||||
"windows": {
|
||||
"WITH_WINPATH": 1,
|
||||
"HAVE_DECL_GETENTROPY": 0,
|
||||
"HAVE_DECL_GLOB": 0,
|
||||
"HAVE_DECL_MMAP": 0,
|
||||
"HAVE_FUNC_ATTRIBUTE_DESTRUCTOR": 0,
|
||||
"HAVE_DLOPEN": 0,
|
||||
"HAVE_SHLLOAD": 0,
|
||||
"HAVE_LIBHISTORY": 0,
|
||||
"HAVE_LIBREADLINE": 0,
|
||||
"HAVE_STDINT_H": 1,
|
||||
"XML_SYSCONFDIR": "/etc",
|
||||
"MODULE_EXTENSION": ".dll",
|
||||
"XML_THREAD_LOCAL": "__declspec(thread)"
|
||||
},
|
||||
"linux": {
|
||||
"WITH_WINPATH": 0,
|
||||
"HAVE_DECL_GETENTROPY": 0,
|
||||
"HAVE_DECL_GLOB": 1,
|
||||
"HAVE_DECL_MMAP": 1,
|
||||
"HAVE_FUNC_ATTRIBUTE_DESTRUCTOR": 1,
|
||||
"HAVE_DLOPEN": 1,
|
||||
"HAVE_SHLLOAD": 0,
|
||||
"HAVE_LIBHISTORY": 0,
|
||||
"HAVE_LIBREADLINE": 0,
|
||||
"HAVE_STDINT_H": 1,
|
||||
"XML_SYSCONFDIR": "/etc",
|
||||
"MODULE_EXTENSION": ".so",
|
||||
"XML_THREAD_LOCAL": "__thread"
|
||||
},
|
||||
"mac": {
|
||||
"WITH_WINPATH": 0,
|
||||
"HAVE_DECL_GETENTROPY": 0,
|
||||
"HAVE_DECL_GLOB": 1,
|
||||
"HAVE_DECL_MMAP": 1,
|
||||
"HAVE_FUNC_ATTRIBUTE_DESTRUCTOR": 1,
|
||||
"HAVE_DLOPEN": 1,
|
||||
"HAVE_SHLLOAD": 0,
|
||||
"HAVE_LIBHISTORY": 0,
|
||||
"HAVE_LIBREADLINE": 0,
|
||||
"HAVE_STDINT_H": 1,
|
||||
"XML_SYSCONFDIR": "/etc",
|
||||
"MODULE_EXTENSION": ".dylib",
|
||||
"XML_THREAD_LOCAL": "__thread"
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Helpers
|
||||
# ---------------------------------------------------------------------------
|
||||
def build_defaults(target):
|
||||
if target not in TARGETS:
|
||||
base.print_error("unknown target: " + target)
|
||||
sys.exit(1)
|
||||
cfg = {}
|
||||
for k in COMMON_FEATURES:
|
||||
cfg[k] = COMMON_FEATURES[k]
|
||||
for k in TARGETS[target]:
|
||||
cfg[k] = TARGETS[target][k]
|
||||
return cfg
|
||||
|
||||
def derive(cfg):
|
||||
parts = cfg["VERSION"].split(".")
|
||||
major = int(parts[0])
|
||||
minor = int(parts[1])
|
||||
micro = int(parts[2])
|
||||
cfg["LIBXML_MAJOR_VERSION"] = major
|
||||
cfg["LIBXML_MINOR_VERSION"] = minor
|
||||
cfg["LIBXML_MICRO_VERSION"] = micro
|
||||
cfg["LIBXML_VERSION_NUMBER"] = major * 10000 + minor * 100 + micro
|
||||
if "LIBXML_VERSION_EXTRA" not in cfg:
|
||||
cfg["LIBXML_VERSION_EXTRA"] = ""
|
||||
return
|
||||
|
||||
def subst_atvars(text, cfg):
|
||||
for key in cfg:
|
||||
text = text.replace("@" + key + "@", str(cfg[key]))
|
||||
# warn about leftover placeholders (helps catch typos in xmlversion.h.in)
|
||||
i = text.find("@")
|
||||
while i != -1:
|
||||
j = text.find("@", i + 1)
|
||||
if j == -1:
|
||||
break
|
||||
token = text[i + 1:j]
|
||||
is_name = (len(token) > 0)
|
||||
for ch in token:
|
||||
if not (ch.isalnum() or ch == "_"):
|
||||
is_name = False
|
||||
break
|
||||
if is_name:
|
||||
base.print_error("undefined template variable: @" + token + "@")
|
||||
i = text.find("@", j + 1)
|
||||
return text
|
||||
|
||||
def process_cmakedefine_line(line, cfg):
|
||||
stripped = line.lstrip()
|
||||
if not stripped.startswith("#"):
|
||||
return None
|
||||
indent = line[:len(line) - len(stripped)]
|
||||
body = stripped[1:].lstrip() # skip '#' and any whitespace after it
|
||||
|
||||
if body.startswith("cmakedefine01"):
|
||||
rest = body[len("cmakedefine01"):].strip()
|
||||
if rest == "":
|
||||
return None
|
||||
name = rest.split()[0]
|
||||
value = 1 if int(cfg.get(name, 0)) else 0
|
||||
return indent + "#define " + name + " " + str(value)
|
||||
|
||||
if body.startswith("cmakedefine"):
|
||||
rest = body[len("cmakedefine"):]
|
||||
if rest == "" or not rest[0].isspace():
|
||||
return None
|
||||
rest = rest.lstrip()
|
||||
sp = -1
|
||||
for k in range(len(rest)):
|
||||
if rest[k].isspace():
|
||||
sp = k
|
||||
break
|
||||
if sp == -1:
|
||||
name = rest
|
||||
tail = ""
|
||||
else:
|
||||
name = rest[:sp]
|
||||
tail = rest[sp:]
|
||||
if cfg.get(name):
|
||||
return indent + "#define " + name + subst_atvars(tail, cfg)
|
||||
return indent + "/* #undef " + name + " */"
|
||||
|
||||
return None
|
||||
|
||||
def process_template(text, cfg, cmake_style):
|
||||
out_lines = []
|
||||
for line in text.splitlines():
|
||||
if cmake_style:
|
||||
replaced = process_cmakedefine_line(line, cfg)
|
||||
if replaced is not None:
|
||||
out_lines.append(replaced)
|
||||
continue
|
||||
out_lines.append(subst_atvars(line, cfg))
|
||||
return "\n".join(out_lines) + "\n"
|
||||
|
||||
def configure_file(src, dst, cfg, cmake_style):
|
||||
if not base.is_file(src):
|
||||
base.print_error("template not found: " + src)
|
||||
sys.exit(1)
|
||||
text = base.readFile(src)
|
||||
dst_dir = os.path.dirname(base.get_path(dst))
|
||||
if dst_dir != "":
|
||||
base.create_dir(dst_dir)
|
||||
base.writeFile(dst, process_template(text, cfg, cmake_style))
|
||||
log(" wrote " + dst)
|
||||
return
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# CLI
|
||||
# ---------------------------------------------------------------------------
|
||||
def print_help():
|
||||
print("Usage: python configure_libxml2.py [options]")
|
||||
print("")
|
||||
print("Generates config.h and include/libxml/xmlversion.h from the")
|
||||
print("libxml2 *.in templates, mirroring the logic of configure.ac /")
|
||||
print("CMakeLists.txt without invoking autoconf or cmake.")
|
||||
print("")
|
||||
print("Paths:")
|
||||
print(" --source DIR libxml2 source root (default: cwd)")
|
||||
print(" --config-h PATH explicit path for config.h")
|
||||
print(" (default: <script-dir>/config.h)")
|
||||
print(" --xmlversion-h PATH explicit path for xmlversion.h")
|
||||
print(" (default: <script-dir>/xmlversion.h)")
|
||||
print("")
|
||||
print("Build options:")
|
||||
print(" --target NAME windows | linux | mac (default: host)")
|
||||
print(" --with-FEATURE 0|1 toggle any LIBXML2_WITH_* feature")
|
||||
print(" e.g. --with-zlib 1 --with-iconv 1")
|
||||
print(" --have-NAME 0|1 set any HAVE_* probe value")
|
||||
print(" e.g. --have-dlopen 1")
|
||||
print(" --xml-sysconfdir DIR override XML_SYSCONFDIR")
|
||||
print(" --xml-thread-local S override TLS specifier")
|
||||
print(" --module-extension S override dynamic-module suffix")
|
||||
print(" --version-extra S set LIBXML_VERSION_EXTRA")
|
||||
print("")
|
||||
print(" -q, --quiet suppress status output (errors still shown)")
|
||||
print(" -h, --help show this message")
|
||||
return
|
||||
|
||||
def parse_args(argv):
|
||||
args = {}
|
||||
i = 1
|
||||
while i < len(argv):
|
||||
arg = argv[i]
|
||||
if arg == "-h" or arg == "--help":
|
||||
args["help"] = "1"
|
||||
i += 1
|
||||
continue
|
||||
if arg == "-q" or arg == "--quiet":
|
||||
args["quiet"] = "1"
|
||||
i += 1
|
||||
continue
|
||||
if not arg.startswith("--"):
|
||||
base.print_error("unexpected positional argument: " + arg)
|
||||
sys.exit(1)
|
||||
key = arg[2:]
|
||||
if i + 1 >= len(argv):
|
||||
base.print_error("missing value for --" + key)
|
||||
sys.exit(1)
|
||||
args[key] = argv[i + 1]
|
||||
i += 2
|
||||
return args
|
||||
|
||||
def apply_overrides(cfg, args):
|
||||
reserved = ("source", "target", "config-h", "xmlversion-h",
|
||||
"version-extra", "help", "quiet")
|
||||
for key in args:
|
||||
if key in reserved:
|
||||
continue
|
||||
cfg_key = key.upper().replace("-", "_")
|
||||
value = args[key]
|
||||
if cfg_key not in cfg:
|
||||
base.print_error("unknown option: --" + key + " "
|
||||
"(maps to " + cfg_key + ")")
|
||||
sys.exit(1)
|
||||
# keep type stable: numeric keys stay numeric
|
||||
if isinstance(cfg[cfg_key], int):
|
||||
try:
|
||||
cfg[cfg_key] = int(value)
|
||||
except ValueError:
|
||||
base.print_error("--" + key + " expects 0 or 1, got: " + value)
|
||||
sys.exit(1)
|
||||
else:
|
||||
cfg[cfg_key] = value
|
||||
return
|
||||
|
||||
def main(argv):
|
||||
global QUIET
|
||||
args = parse_args(argv)
|
||||
if "help" in args:
|
||||
print_help()
|
||||
return 0
|
||||
QUIET = ("quiet" in args)
|
||||
|
||||
source = args.get("source", os.getcwd())
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
target = args.get("target", base.host_platform())
|
||||
|
||||
cfg = build_defaults(target)
|
||||
|
||||
version_file = source + "/VERSION"
|
||||
if not base.is_file(version_file):
|
||||
base.print_error("VERSION file not found in: " + source)
|
||||
return 1
|
||||
cfg["VERSION"] = base.readFile(version_file).strip()
|
||||
|
||||
apply_overrides(cfg, args)
|
||||
if "version-extra" in args:
|
||||
cfg["LIBXML_VERSION_EXTRA"] = args["version-extra"]
|
||||
|
||||
derive(cfg)
|
||||
|
||||
config_h_out = args.get("config-h", script_dir + "/config.h")
|
||||
xmlversion_h_out = args.get("xmlversion-h", script_dir + "/xmlversion.h")
|
||||
|
||||
log_info("libxml2 " + cfg["VERSION"] + " target=" + target)
|
||||
log(" source = " + source)
|
||||
|
||||
configure_file(source + "/config.h.cmake.in",
|
||||
config_h_out, cfg, True)
|
||||
configure_file(source + "/include/libxml/xmlversion.h.in",
|
||||
xmlversion_h_out, cfg, False)
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
26
Common/3dParty/libxml/fetch.py
Normal file
26
Common/3dParty/libxml/fetch.py
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../../../../build_tools/scripts')
|
||||
import base
|
||||
import configure_libxml2
|
||||
|
||||
if not base.is_dir("libxml2"):
|
||||
base.cmd("git", ["clone", "https://github.com/GNOME/libxml2.git"])
|
||||
base.cmd_in_dir("libxml2", "git", ["checkout", "39b66eb2089f491eacf8e22a7965a235f7f5735e", "--quiet"])
|
||||
|
||||
configure_libxml2.main(["", "--source", "./libxml2",
|
||||
"--config-h", "../../../DesktopEditor/xml/build/qt/config.h",
|
||||
"--xmlversion-h", "./libxml2/include/libxml/xmlversion.h",
|
||||
"--quiet"])
|
||||
|
||||
#fix parserInternals.h
|
||||
base.replaceInFileUtf8("libxml2/include/libxml/parserInternals.h", "#define XML_MAX_TEXT_LENGTH 10000000", "#define XML_MAX_TEXT_LENGTH 15000000")
|
||||
base.replaceInFileUtf8("libxml2/include/libxml/parserInternals.h", "#define XML_MAX_DICTIONARY_LIMIT 10000000", "#define XML_MAX_DICTIONARY_LIMIT 15000000")
|
||||
base.replaceInFileUtf8("libxml2/include/libxml/parserInternals.h", "#define XML_MAX_LOOKUP_LIMIT 10000000", "#define XML_MAX_LOOKUP_LIMIT 15000000")
|
||||
|
||||
#Logging has been removed
|
||||
target = "void\nxmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {\n va_list args;\n\n if (xmlGenericErrorContext == NULL)\n xmlGenericErrorContext = (void *) stderr;\n\n va_start(args, msg);\n vfprintf((FILE *)xmlGenericErrorContext, msg, args);\n va_end(args);\n}"
|
||||
replacement = "#ifndef XML_ERROR_DISABLE_MODE\n" + target + "\n#else\nvoid\nxmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {\n // NONE\n}\n#endif"
|
||||
base.replaceInFile("libxml2/error.c", target, replacement)
|
||||
|
||||
@ -48,7 +48,7 @@ TARGET = allthemesgen
|
||||
|
||||
DEFINES += KERNEL_USE_DYNAMIC_LIBRARY
|
||||
DEFINES += GRAPHICS_USE_DYNAMIC_LIBRARY
|
||||
ADD_DEPENDENCY(graphics, kernel, kernel_network, UnicodeConverter, doctrenderer, PdfFile, XpsFile, DjVuFile, DocxRenderer)
|
||||
ADD_DEPENDENCY(graphics, kernel, kernel_network, UnicodeConverter, doctrenderer, PdfFile, XpsFile, DjVuFile, OFDFile, DocxRenderer)
|
||||
|
||||
core_windows {
|
||||
DEFINES -= UNICODE
|
||||
|
||||
@ -415,6 +415,34 @@ bool CxImageBMP::DibReadBitmapInfo(CxFile* fh, BITMAPINFOHEADER *pdib)
|
||||
|
||||
bihtoh(pdib);
|
||||
|
||||
if (pdib->biSize < sizeof(BITMAPCOREHEADER))
|
||||
return false;
|
||||
|
||||
if (pdib->biBitCount != 0 && pdib->biBitCount != 1 &&
|
||||
pdib->biBitCount != 4 && pdib->biBitCount != 8 &&
|
||||
pdib->biBitCount != 16 && pdib->biBitCount != 24 &&
|
||||
pdib->biBitCount != 32)
|
||||
return false;
|
||||
|
||||
unsigned long long stride = ((unsigned long long)pdib->biWidth * pdib->biBitCount + 31) / 32 * 4;
|
||||
unsigned long long height = std::llabs((long long)pdib->biHeight);
|
||||
unsigned long long expected = stride * height;
|
||||
|
||||
unsigned long long num_colors = 0;
|
||||
if (pdib->biBitCount > 0 && pdib->biBitCount <= 8) {
|
||||
num_colors = (pdib->biClrUsed != 0)
|
||||
? pdib->biClrUsed
|
||||
: (1ULL << pdib->biBitCount);
|
||||
} else if (pdib->biClrUsed > 0) {
|
||||
num_colors = pdib->biClrUsed;
|
||||
}
|
||||
unsigned long long palette_size = num_colors * 4;
|
||||
|
||||
unsigned long long masks_size = (pdib->biCompression == BI_BITFIELDS) ? 12ULL : 0ULL;
|
||||
unsigned long long fileSize = fh->Size();
|
||||
if ((unsigned long long)pdib->biSize + palette_size + masks_size + expected > fileSize)
|
||||
return false;
|
||||
|
||||
switch (pdib->biSize) // what type of bitmap info is this?
|
||||
{
|
||||
case sizeof(BITMAPINFOHEADER):
|
||||
|
||||
@ -58,7 +58,7 @@ core_windows {
|
||||
DESTDIR = $$CORE_BUILDS_BINARY_PATH
|
||||
################################################
|
||||
|
||||
ADD_DEPENDENCY(graphics, kernel, kernel_network, UnicodeConverter, doctrenderer, PdfFile, XpsFile, DjVuFile, DocxRenderer)
|
||||
ADD_DEPENDENCY(graphics, kernel, kernel_network, UnicodeConverter, doctrenderer, PdfFile, XpsFile, DjVuFile, OFDFile, DocxRenderer)
|
||||
|
||||
core_linux {
|
||||
LIBS += -ldl
|
||||
|
||||
@ -149,7 +149,7 @@ DEFINES += BUIDLER_OPEN_BASE64_ENABLED
|
||||
CONFIG += drawingfile_support
|
||||
drawingfile_support {
|
||||
DEFINES += WASM_SERIALIZER_USE_ALLOCATOR
|
||||
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, DocxRenderer)
|
||||
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, OFDFile, DocxRenderer)
|
||||
|
||||
HEADERS += \
|
||||
$$PWD_CUR/drawingfile.h \
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
#include "../graphics/pro/js/wasm/src/serialize.h"
|
||||
#include "../graphics/pro/js/wasm/src/HTMLRendererText.h"
|
||||
#include "../../DocxRenderer/DocxRenderer.h"
|
||||
#include "../../OFDFile/OFDFile.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
#define CHECKER_FILE_BUFFER_LEN 4096
|
||||
|
||||
@ -106,6 +108,9 @@ public:
|
||||
case odftXPS:
|
||||
m_nType = 2;
|
||||
break;
|
||||
case odftOFD:
|
||||
m_nType = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -168,6 +173,16 @@ public:
|
||||
else
|
||||
m_nType = 2;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_pFile = new COFDFile(m_pApplicationFonts);
|
||||
if (!m_pFile->LoadFromFile(sFile, L"", sPassword, sPassword))
|
||||
{
|
||||
RELEASEOBJECT(m_pFile);
|
||||
}
|
||||
else
|
||||
m_nType = 3;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -218,6 +233,16 @@ public:
|
||||
else
|
||||
m_nType = 2;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_pFile = new COFDFile(m_pApplicationFonts);
|
||||
if (!m_pFile->LoadFromMemory(data, size, L"", sPassword, sPassword))
|
||||
{
|
||||
RELEASEOBJECT(m_pFile);
|
||||
}
|
||||
else
|
||||
m_nType = 3;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -291,6 +316,11 @@ public:
|
||||
return bRes;
|
||||
}
|
||||
|
||||
void SetPainter(IOfficeDrawingFilePainter* pPainter)
|
||||
{
|
||||
if (m_pFile)
|
||||
m_pFile->SetPainter(pPainter);
|
||||
}
|
||||
BYTE* GetPixmap(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor)
|
||||
{
|
||||
if (!m_pFile)
|
||||
@ -637,7 +667,7 @@ private:
|
||||
double dPageDpiX, dPageDpiY;
|
||||
double dWidth, dHeight;
|
||||
m_pFile->GetPageInfo(nPageIndex, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY);
|
||||
if (m_nType == 2)
|
||||
if (m_nType == 2 || m_nType == 3)
|
||||
{
|
||||
dWidth = dWidth / 25.4 * 96.0;
|
||||
dHeight = dHeight / 25.4 * 96.0;
|
||||
@ -675,6 +705,7 @@ private:
|
||||
// 0 - PDF
|
||||
// 1 - DJVU
|
||||
// 2 - XPS
|
||||
// 3 - OFD
|
||||
LONG nSize = size < CHECKER_FILE_BUFFER_LEN ? size : CHECKER_FILE_BUFFER_LEN;
|
||||
char* pData = (char*)data;
|
||||
for (int i = 0; i < nSize - 5; ++i)
|
||||
@ -686,6 +717,25 @@ private:
|
||||
if ( (8 <= size) && (0x41 == data[0] && 0x54 == data[1] && 0x26 == data[2] && 0x54 == data[3] &&
|
||||
0x46 == data[4] && 0x4f == data[5] && 0x52 == data[6] && 0x4d == data[7]))
|
||||
return 1;
|
||||
COfficeUtils OfficeUtils(NULL);
|
||||
if (OfficeUtils.IsArchive(data, size) == S_FALSE)
|
||||
return -1;
|
||||
|
||||
ULONG nBufferSize = 0;
|
||||
BYTE *pBuffer = NULL;
|
||||
|
||||
int nFileType = -1;
|
||||
HRESULT hresult = OfficeUtils.LoadFileFromArchive(data, size, L"OFD.xml", &pBuffer, nBufferSize);
|
||||
if (hresult == S_OK && pBuffer != NULL)
|
||||
{
|
||||
if (19 <= nBufferSize && NULL != strstr((char *)pBuffer, "ofd:OFD"))
|
||||
nFileType = 3;
|
||||
|
||||
delete[] pBuffer;
|
||||
pBuffer = NULL;
|
||||
|
||||
return nFileType;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
@ -189,6 +189,7 @@ namespace Aggplus
|
||||
{
|
||||
m_bIsClip = false;
|
||||
m_bIsClip2 = false;
|
||||
m_bIsEmpty = false;
|
||||
}
|
||||
CClipMulti::~CClipMulti()
|
||||
{
|
||||
@ -211,6 +212,7 @@ namespace Aggplus
|
||||
m_rasterizer.clip_box(0, 0, width, height);
|
||||
m_bIsClip = false;
|
||||
m_bIsClip2 = false;
|
||||
m_bIsEmpty = false;
|
||||
}
|
||||
|
||||
void CClipMulti::GenerateClip(CGraphicsPath* pPath, CMatrix* pMatrix)
|
||||
@ -247,15 +249,21 @@ namespace Aggplus
|
||||
if (!m_bIsClip)
|
||||
return GenerateClip2(bEvenOdd);
|
||||
|
||||
pRasterizer->filling_rule(bEvenOdd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
scanline_type sl1;
|
||||
scanline_type sl2;
|
||||
scanline_type sl;
|
||||
|
||||
if (!pRasterizer->rewind_scanlines())
|
||||
{
|
||||
if (op == agg::sbool_and)
|
||||
SetEmpty();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_bIsClip2)
|
||||
{
|
||||
// need to blend with rasterizer
|
||||
pRasterizer->filling_rule(bEvenOdd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
scanline_type sl1;
|
||||
scanline_type sl2;
|
||||
scanline_type sl;
|
||||
|
||||
agg::sbool_combine_shapes_aa(op, m_rasterizer, *pRasterizer, sl1, sl2, sl, m_storage1);
|
||||
|
||||
m_lCurStorage = 1;
|
||||
@ -263,15 +271,8 @@ namespace Aggplus
|
||||
else
|
||||
{
|
||||
// need to blend with storage
|
||||
|
||||
pRasterizer->filling_rule(op ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
scanline_type sl1;
|
||||
scanline_type sl2;
|
||||
scanline_type sl;
|
||||
|
||||
agg::sbool_combine_shapes_aa(op, *pRasterizer, (m_lCurStorage == 1) ? m_storage1 : m_storage2, sl1, sl2, sl,
|
||||
(m_lCurStorage == 1) ? m_storage2 : m_storage1);
|
||||
agg::sbool_combine_shapes_aa(op, (m_lCurStorage == 1) ? m_storage1 : m_storage2, *pRasterizer, sl1, sl2, sl,
|
||||
(m_lCurStorage == 1) ? m_storage2 : m_storage1);
|
||||
|
||||
if (1 == m_lCurStorage)
|
||||
{
|
||||
@ -295,6 +296,10 @@ namespace Aggplus
|
||||
{
|
||||
return m_bIsClip2;
|
||||
}
|
||||
bool CClipMulti::IsEmpty()
|
||||
{
|
||||
return m_bIsEmpty;
|
||||
}
|
||||
|
||||
void CClipMulti::Reset()
|
||||
{
|
||||
@ -305,5 +310,13 @@ namespace Aggplus
|
||||
|
||||
m_bIsClip = false;
|
||||
m_bIsClip2 = false;
|
||||
m_bIsEmpty = false;
|
||||
}
|
||||
void CClipMulti::SetEmpty()
|
||||
{
|
||||
m_bIsEmpty = true;
|
||||
m_bIsClip2 = true;
|
||||
m_lCurStorage = 1;
|
||||
//m_storage1.prepare();
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,6 +154,7 @@ public:
|
||||
|
||||
bool m_bIsClip;
|
||||
bool m_bIsClip2;
|
||||
bool m_bIsEmpty;
|
||||
|
||||
LONG m_lWidth;
|
||||
LONG m_lHeight;
|
||||
@ -172,8 +173,10 @@ public:
|
||||
|
||||
bool IsClip();
|
||||
bool IsClip2();
|
||||
bool IsEmpty();
|
||||
|
||||
void Reset();
|
||||
void SetEmpty();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -1353,7 +1353,7 @@ namespace Aggplus
|
||||
{
|
||||
agg::render_scanlines(ras, sl, ren);
|
||||
}
|
||||
else
|
||||
else if (!m_oClip.IsEmpty())
|
||||
{
|
||||
if (!m_oClip.IsClip2())
|
||||
{
|
||||
@ -2191,14 +2191,11 @@ namespace Aggplus
|
||||
|
||||
for (LONG i = 0; i < lCount2; ++i)
|
||||
{
|
||||
if (0 == i)
|
||||
{
|
||||
poly2_dash.add_dash((params[i * 2]) * dKoef, params[i * 2 + 1] * dKoef);
|
||||
}
|
||||
else
|
||||
{
|
||||
poly2_dash.add_dash(params[i * 2] * dKoef, params[i * 2 + 1] * dKoef);
|
||||
}
|
||||
double dashLen = params[i * 2] * dKoef;
|
||||
double gapLen = params[i * 2 + 1] * dKoef;
|
||||
if (m_bIs0PenWidthAs1px && fabs(dashLen) < 0.0001 && LineCap == agg::round_cap)
|
||||
dashLen = 0.0001;
|
||||
poly2_dash.add_dash(dashLen, gapLen);
|
||||
}
|
||||
if (1 == (lCount % 2))
|
||||
{
|
||||
|
||||
@ -308,6 +308,10 @@ public:
|
||||
LONG c = (NULL == codepoints) ? 32 : codepoints[0];
|
||||
return CommandDrawTextExCHAR(c, (LONG)gid, x, y, w, h);
|
||||
}
|
||||
virtual HRESULT CommandDrawType3CHAR(const std::wstring& wsUnicodeText, const double& x, const double& y, const double& w, const double& h, const double& ascent, const double& descent, const double& unitsPerEm)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-------- Command markers ---------------------------------------------------------------
|
||||
virtual HRESULT BeginCommand(const DWORD& lType) = 0;
|
||||
|
||||
@ -154,20 +154,22 @@ CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annot
|
||||
m_oBorder.nType = 0;
|
||||
m_oBorder.dWidth = 0.0;
|
||||
|
||||
m_pMarkupPr = NULL;
|
||||
m_pTextPr = NULL;
|
||||
m_pInkPr = NULL;
|
||||
m_pLinePr = NULL;
|
||||
m_pTextMarkupPr = NULL;
|
||||
m_pSquareCirclePr = NULL;
|
||||
m_pPolygonLinePr = NULL;
|
||||
m_pPopupPr = NULL;
|
||||
m_pFreeTextPr = NULL;
|
||||
m_pCaretPr = NULL;
|
||||
m_pStampPr = NULL;
|
||||
m_pRedactPr = NULL;
|
||||
m_pLinkPr = NULL;
|
||||
m_pWidgetPr = NULL;
|
||||
m_pMarkupPr = NULL;
|
||||
m_pTextPr = NULL;
|
||||
m_pInkPr = NULL;
|
||||
m_pLinePr = NULL;
|
||||
m_pTextMarkupPr = NULL;
|
||||
m_pSquareCirclePr = NULL;
|
||||
m_pPolygonLinePr = NULL;
|
||||
m_pPopupPr = NULL;
|
||||
m_pFreeTextPr = NULL;
|
||||
m_pCaretPr = NULL;
|
||||
m_pStampPr = NULL;
|
||||
m_pRedactPr = NULL;
|
||||
m_pLinkPr = NULL;
|
||||
m_pFileAttachmentPr = NULL;
|
||||
m_pScreenPr = NULL;
|
||||
m_pWidgetPr = NULL;
|
||||
}
|
||||
CAnnotFieldInfo::~CAnnotFieldInfo()
|
||||
{
|
||||
@ -184,6 +186,8 @@ CAnnotFieldInfo::~CAnnotFieldInfo()
|
||||
RELEASEOBJECT(m_pStampPr);
|
||||
RELEASEOBJECT(m_pRedactPr);
|
||||
RELEASEOBJECT(m_pLinkPr);
|
||||
RELEASEOBJECT(m_pFileAttachmentPr);
|
||||
RELEASEOBJECT(m_pScreenPr);
|
||||
RELEASEOBJECT(m_pWidgetPr);
|
||||
}
|
||||
|
||||
@ -277,6 +281,18 @@ void CAnnotFieldInfo::SetType(int nType)
|
||||
m_pPopupPr = new CAnnotFieldInfo::CPopupAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::FileAttachment:
|
||||
{
|
||||
RELEASEOBJECT(m_pFileAttachmentPr);
|
||||
m_pFileAttachmentPr = new CAnnotFieldInfo::CFileAttachmentAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::Screen:
|
||||
{
|
||||
RELEASEOBJECT(m_pScreenPr);
|
||||
m_pScreenPr = new CAnnotFieldInfo::CScreenAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::Redact:
|
||||
{
|
||||
CreateMarkup();
|
||||
@ -406,21 +422,31 @@ bool CAnnotFieldInfo::IsLink() const
|
||||
{
|
||||
return (m_nType == 1);
|
||||
}
|
||||
bool CAnnotFieldInfo::IsFileAttachment() const
|
||||
{
|
||||
return (m_nType == 16);
|
||||
}
|
||||
bool CAnnotFieldInfo::IsScreen() const
|
||||
{
|
||||
return (m_nType == 20);
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CMarkupAnnotPr* CAnnotFieldInfo::GetMarkupAnnotPr() { return m_pMarkupPr; }
|
||||
CAnnotFieldInfo::CTextAnnotPr* CAnnotFieldInfo::GetTextAnnotPr() { return m_pTextPr; }
|
||||
CAnnotFieldInfo::CInkAnnotPr* CAnnotFieldInfo::GetInkAnnotPr() { return m_pInkPr; }
|
||||
CAnnotFieldInfo::CLineAnnotPr* CAnnotFieldInfo::GetLineAnnotPr() { return m_pLinePr; }
|
||||
CAnnotFieldInfo::CTextMarkupAnnotPr* CAnnotFieldInfo::GetTextMarkupAnnotPr() { return m_pTextMarkupPr; }
|
||||
CAnnotFieldInfo::CSquareCircleAnnotPr* CAnnotFieldInfo::GetSquareCircleAnnotPr() { return m_pSquareCirclePr; }
|
||||
CAnnotFieldInfo::CPolygonLineAnnotPr* CAnnotFieldInfo::GetPolygonLineAnnotPr() { return m_pPolygonLinePr; }
|
||||
CAnnotFieldInfo::CPopupAnnotPr* CAnnotFieldInfo::GetPopupAnnotPr() { return m_pPopupPr; }
|
||||
CAnnotFieldInfo::CFreeTextAnnotPr* CAnnotFieldInfo::GetFreeTextAnnotPr() { return m_pFreeTextPr; }
|
||||
CAnnotFieldInfo::CCaretAnnotPr* CAnnotFieldInfo::GetCaretAnnotPr() { return m_pCaretPr; }
|
||||
CAnnotFieldInfo::CStampAnnotPr* CAnnotFieldInfo::GetStampAnnotPr() { return m_pStampPr; }
|
||||
CAnnotFieldInfo::CRedactAnnotPr* CAnnotFieldInfo::GetRedactAnnotPr() { return m_pRedactPr; }
|
||||
CAnnotFieldInfo::CLinkAnnotPr* CAnnotFieldInfo::GetLinkAnnotPr() { return m_pLinkPr; }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr* CAnnotFieldInfo::GetWidgetAnnotPr() { return m_pWidgetPr; }
|
||||
CAnnotFieldInfo::CMarkupAnnotPr* CAnnotFieldInfo::GetMarkupAnnotPr() { return m_pMarkupPr; }
|
||||
CAnnotFieldInfo::CTextAnnotPr* CAnnotFieldInfo::GetTextAnnotPr() { return m_pTextPr; }
|
||||
CAnnotFieldInfo::CInkAnnotPr* CAnnotFieldInfo::GetInkAnnotPr() { return m_pInkPr; }
|
||||
CAnnotFieldInfo::CLineAnnotPr* CAnnotFieldInfo::GetLineAnnotPr() { return m_pLinePr; }
|
||||
CAnnotFieldInfo::CTextMarkupAnnotPr* CAnnotFieldInfo::GetTextMarkupAnnotPr() { return m_pTextMarkupPr; }
|
||||
CAnnotFieldInfo::CSquareCircleAnnotPr* CAnnotFieldInfo::GetSquareCircleAnnotPr() { return m_pSquareCirclePr; }
|
||||
CAnnotFieldInfo::CPolygonLineAnnotPr* CAnnotFieldInfo::GetPolygonLineAnnotPr() { return m_pPolygonLinePr; }
|
||||
CAnnotFieldInfo::CPopupAnnotPr* CAnnotFieldInfo::GetPopupAnnotPr() { return m_pPopupPr; }
|
||||
CAnnotFieldInfo::CFreeTextAnnotPr* CAnnotFieldInfo::GetFreeTextAnnotPr() { return m_pFreeTextPr; }
|
||||
CAnnotFieldInfo::CCaretAnnotPr* CAnnotFieldInfo::GetCaretAnnotPr() { return m_pCaretPr; }
|
||||
CAnnotFieldInfo::CStampAnnotPr* CAnnotFieldInfo::GetStampAnnotPr() { return m_pStampPr; }
|
||||
CAnnotFieldInfo::CRedactAnnotPr* CAnnotFieldInfo::GetRedactAnnotPr() { return m_pRedactPr; }
|
||||
CAnnotFieldInfo::CLinkAnnotPr* CAnnotFieldInfo::GetLinkAnnotPr() { return m_pLinkPr; }
|
||||
CAnnotFieldInfo::CFileAttachmentAnnotPr* CAnnotFieldInfo::GetFileAttachmentAnnotPr() { return m_pFileAttachmentPr; }
|
||||
CAnnotFieldInfo::CScreenAnnotPr* CAnnotFieldInfo::GetScreenAnnotPr() { return m_pScreenPr; }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr* CAnnotFieldInfo::GetWidgetAnnotPr() { return m_pWidgetPr; }
|
||||
|
||||
bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
{
|
||||
@ -509,6 +535,8 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
m_pStampPr->Read(pReader, nFlags);
|
||||
else if (IsRedact())
|
||||
m_pRedactPr->Read(pReader, nFlags);
|
||||
else if (IsFileAttachment())
|
||||
m_pFileAttachmentPr->Read(pReader, nFlags);
|
||||
}
|
||||
else if (IsPopup())
|
||||
m_pPopupPr->Read(pReader);
|
||||
@ -516,6 +544,8 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
m_pWidgetPr->Read(pReader, nType);
|
||||
else if (IsLink())
|
||||
m_pLinkPr->Read(pReader);
|
||||
else if (IsScreen())
|
||||
m_pScreenPr->Read(pReader);
|
||||
|
||||
return m_nType != -1;
|
||||
}
|
||||
@ -837,6 +867,7 @@ CAnnotFieldInfo::CLinkAnnotPr::~CLinkAnnotPr()
|
||||
}
|
||||
BYTE CAnnotFieldInfo::CLinkAnnotPr::GetH() const { return m_nH; }
|
||||
int CAnnotFieldInfo::CLinkAnnotPr::GetFlags() const { return m_nFlags; }
|
||||
void CAnnotFieldInfo::CLinkAnnotPr::GetRD(double& dRD1, double& dRD2, double& dRD3, double& dRD4) { dRD1 = m_dRD[0]; dRD2 = m_dRD[1]; dRD3 = m_dRD[2]; dRD4 = m_dRD[3]; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CLinkAnnotPr::GetQuadPoints() { return m_arrQuadPoints; }
|
||||
CAnnotFieldInfo::CActionFieldPr* CAnnotFieldInfo::CLinkAnnotPr::GetA() { return m_pAction; }
|
||||
CAnnotFieldInfo::CActionFieldPr* CAnnotFieldInfo::CLinkAnnotPr::GetPA() { return m_pPA; }
|
||||
@ -862,6 +893,126 @@ void CAnnotFieldInfo::CLinkAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader*
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
}
|
||||
if (m_nFlags & (1 << 4))
|
||||
{
|
||||
m_dRD[0] = pReader->ReadDouble();
|
||||
m_dRD[1] = pReader->ReadDouble();
|
||||
m_dRD[2] = pReader->ReadDouble();
|
||||
m_dRD[3] = pReader->ReadDouble();
|
||||
}
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CFileAttachmentAnnotPr::CFileAttachmentAnnotPr()
|
||||
{
|
||||
|
||||
}
|
||||
CAnnotFieldInfo::CFileAttachmentAnnotPr::~CFileAttachmentAnnotPr()
|
||||
{
|
||||
|
||||
}
|
||||
int CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileFlag() const { return m_nFileFlag; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetName() { return m_wsName; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFS() { return m_wsFS; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetF() { return m_wsF; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetUF() { return m_wsUF; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetDOS() { return m_wsDOS; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetMac() { return m_wsMac; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetUnix() { return m_wsUnix; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetDesc() { return m_wsDesc; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileF() { return m_wsFileF; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileUF() { return m_wsFileUF; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileDOS() { return m_wsFileDOS; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileMac() { return m_wsFileMac; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileUnix() { return m_wsFileUnix; }
|
||||
const std::pair<std::wstring, std::wstring>& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetID() { return m_wsID; }
|
||||
void CAnnotFieldInfo::CFileAttachmentAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, int nFlags)
|
||||
{
|
||||
if (nFlags & (1 << 15))
|
||||
m_wsName = pReader->ReadString();
|
||||
if (nFlags & (1 << 16))
|
||||
m_wsFS = pReader->ReadString();
|
||||
if (nFlags & (1 << 17))
|
||||
m_wsF = pReader->ReadString();
|
||||
if (nFlags & (1 << 18))
|
||||
m_wsUF = pReader->ReadString();
|
||||
if (nFlags & (1 << 19))
|
||||
m_wsDOS = pReader->ReadString();
|
||||
if (nFlags & (1 << 20))
|
||||
m_wsMac = pReader->ReadString();
|
||||
if (nFlags & (1 << 21))
|
||||
m_wsUnix = pReader->ReadString();
|
||||
if (nFlags & (1 << 22))
|
||||
{
|
||||
m_wsID.first = pReader->ReadString();
|
||||
m_wsID.second = pReader->ReadString();
|
||||
}
|
||||
if (nFlags & (1 << 24))
|
||||
{
|
||||
m_nFileFlag = pReader->ReadInt();
|
||||
if (m_nFileFlag & (1 << 0))
|
||||
m_wsFileF = pReader->ReadString();
|
||||
if (m_nFileFlag & (1 << 1))
|
||||
m_wsFileUF = pReader->ReadString();
|
||||
if (m_nFileFlag & (1 << 2))
|
||||
m_wsFileDOS = pReader->ReadString();
|
||||
if (m_nFileFlag & (1 << 3))
|
||||
m_wsFileMac = pReader->ReadString();
|
||||
if (m_nFileFlag & (1 << 4))
|
||||
m_wsFileUnix = pReader->ReadString();
|
||||
}
|
||||
if (nFlags & (1 << 26))
|
||||
m_wsDesc = pReader->ReadString();
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CScreenAnnotPr::CScreenAnnotPr()
|
||||
{
|
||||
|
||||
}
|
||||
CAnnotFieldInfo::CScreenAnnotPr::~CScreenAnnotPr()
|
||||
{
|
||||
|
||||
}
|
||||
int CAnnotFieldInfo::CScreenAnnotPr::GetR() const { return m_nR; }
|
||||
int CAnnotFieldInfo::CScreenAnnotPr::GetFlags() const { return m_nFlags; }
|
||||
const std::wstring& CAnnotFieldInfo::CScreenAnnotPr::GetT() { return m_wsT; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CScreenAnnotPr::GetBC() { return m_arrBC; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CScreenAnnotPr::GetBG() { return m_arrBG; }
|
||||
const std::vector<CAnnotFieldInfo::CActionFieldPr*>& CAnnotFieldInfo::CScreenAnnotPr::GetActions() { return m_arrAction; }
|
||||
void CAnnotFieldInfo::CScreenAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader)
|
||||
{
|
||||
m_nFlags = pReader->ReadInt();
|
||||
if (m_nFlags & (1 << 0))
|
||||
m_wsT = pReader->ReadString();
|
||||
if (m_nFlags & (1 << 1))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrBC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrBC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
if (m_nFlags & (1 << 2))
|
||||
m_nR = pReader->ReadInt();
|
||||
if (m_nFlags & (1 << 3))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrBG.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrBG.push_back(pReader->ReadDouble());
|
||||
}
|
||||
if (m_nFlags & (1 << 4))
|
||||
{
|
||||
int nAction = pReader->ReadInt();
|
||||
for (int i = 0; i < nAction; ++i)
|
||||
{
|
||||
std::wstring wsType = pReader->ReadString();
|
||||
CAnnotFieldInfo::CActionFieldPr* pA = ReadAction(pReader);
|
||||
if (pA)
|
||||
{
|
||||
pA->wsType = wsType;
|
||||
m_arrAction.push_back(pA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CAnnotFieldInfo::CPopupAnnotPr::IsOpen() const { return m_bOpen; }
|
||||
|
||||
@ -62,6 +62,7 @@ public:
|
||||
Ink = 14,
|
||||
Popup = 15,
|
||||
FileAttachment = 16,
|
||||
Screen = 20,
|
||||
Redact = 25,
|
||||
Widget = 26,
|
||||
WidgetPushButton = 27,
|
||||
@ -493,6 +494,7 @@ public:
|
||||
|
||||
BYTE GetH() const;
|
||||
int GetFlags() const;
|
||||
void GetRD(double& dRD1, double& dRD2, double& dRD3, double& dRD4);
|
||||
const std::vector<double>& GetQuadPoints();
|
||||
CActionFieldPr* GetA();
|
||||
CActionFieldPr* GetPA();
|
||||
@ -502,11 +504,78 @@ public:
|
||||
private:
|
||||
BYTE m_nH;
|
||||
int m_nFlags;
|
||||
double m_dRD[4]{};
|
||||
std::vector<double> m_arrQuadPoints;
|
||||
CActionFieldPr* m_pAction;
|
||||
CActionFieldPr* m_pPA;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CFileAttachmentAnnotPr
|
||||
{
|
||||
public:
|
||||
CFileAttachmentAnnotPr();
|
||||
~CFileAttachmentAnnotPr();
|
||||
|
||||
int GetFileFlag() const;
|
||||
const std::wstring& GetName();
|
||||
const std::wstring& GetFS();
|
||||
const std::wstring& GetF();
|
||||
const std::wstring& GetUF();
|
||||
const std::wstring& GetDOS();
|
||||
const std::wstring& GetMac();
|
||||
const std::wstring& GetUnix();
|
||||
const std::wstring& GetDesc();
|
||||
const std::wstring& GetFileF();
|
||||
const std::wstring& GetFileUF();
|
||||
const std::wstring& GetFileDOS();
|
||||
const std::wstring& GetFileMac();
|
||||
const std::wstring& GetFileUnix();
|
||||
const std::pair<std::wstring, std::wstring>& GetID();
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, int nFlags);
|
||||
|
||||
private:
|
||||
int m_nFileFlag;
|
||||
std::wstring m_wsName;
|
||||
std::wstring m_wsFS;
|
||||
std::wstring m_wsF;
|
||||
std::wstring m_wsUF;
|
||||
std::wstring m_wsDOS;
|
||||
std::wstring m_wsMac;
|
||||
std::wstring m_wsUnix;
|
||||
std::wstring m_wsDesc;
|
||||
std::wstring m_wsFileF;
|
||||
std::wstring m_wsFileUF;
|
||||
std::wstring m_wsFileDOS;
|
||||
std::wstring m_wsFileMac;
|
||||
std::wstring m_wsFileUnix;
|
||||
std::pair<std::wstring, std::wstring> m_wsID;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CScreenAnnotPr
|
||||
{
|
||||
public:
|
||||
CScreenAnnotPr();
|
||||
~CScreenAnnotPr();
|
||||
|
||||
int GetR() const;
|
||||
int GetFlags() const;
|
||||
const std::wstring& GetT();
|
||||
const std::vector<double>& GetBC();
|
||||
const std::vector<double>& GetBG();
|
||||
const std::vector<CActionFieldPr*>& GetActions();
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader);
|
||||
|
||||
private:
|
||||
int m_nR;
|
||||
int m_nFlags;
|
||||
std::wstring m_wsT;
|
||||
std::vector<double> m_arrBC;
|
||||
std::vector<double> m_arrBG;
|
||||
std::vector<CActionFieldPr*> m_arrAction;
|
||||
};
|
||||
|
||||
CAnnotFieldInfo();
|
||||
virtual ~CAnnotFieldInfo();
|
||||
|
||||
@ -548,21 +617,25 @@ public:
|
||||
bool IsStamp() const;
|
||||
bool IsRedact() const;
|
||||
bool IsLink() const;
|
||||
bool IsFileAttachment() const;
|
||||
bool IsScreen() const;
|
||||
|
||||
CMarkupAnnotPr* GetMarkupAnnotPr();
|
||||
CTextAnnotPr* GetTextAnnotPr();
|
||||
CInkAnnotPr* GetInkAnnotPr();
|
||||
CLineAnnotPr* GetLineAnnotPr();
|
||||
CTextMarkupAnnotPr* GetTextMarkupAnnotPr();
|
||||
CSquareCircleAnnotPr* GetSquareCircleAnnotPr();
|
||||
CPolygonLineAnnotPr* GetPolygonLineAnnotPr();
|
||||
CPopupAnnotPr* GetPopupAnnotPr();
|
||||
CFreeTextAnnotPr* GetFreeTextAnnotPr();
|
||||
CCaretAnnotPr* GetCaretAnnotPr();
|
||||
CStampAnnotPr* GetStampAnnotPr();
|
||||
CRedactAnnotPr* GetRedactAnnotPr();
|
||||
CLinkAnnotPr* GetLinkAnnotPr();
|
||||
CWidgetAnnotPr* GetWidgetAnnotPr();
|
||||
CMarkupAnnotPr* GetMarkupAnnotPr();
|
||||
CTextAnnotPr* GetTextAnnotPr();
|
||||
CInkAnnotPr* GetInkAnnotPr();
|
||||
CLineAnnotPr* GetLineAnnotPr();
|
||||
CTextMarkupAnnotPr* GetTextMarkupAnnotPr();
|
||||
CSquareCircleAnnotPr* GetSquareCircleAnnotPr();
|
||||
CPolygonLineAnnotPr* GetPolygonLineAnnotPr();
|
||||
CPopupAnnotPr* GetPopupAnnotPr();
|
||||
CFreeTextAnnotPr* GetFreeTextAnnotPr();
|
||||
CCaretAnnotPr* GetCaretAnnotPr();
|
||||
CStampAnnotPr* GetStampAnnotPr();
|
||||
CRedactAnnotPr* GetRedactAnnotPr();
|
||||
CLinkAnnotPr* GetLinkAnnotPr();
|
||||
CFileAttachmentAnnotPr* GetFileAttachmentAnnotPr();
|
||||
CScreenAnnotPr* GetScreenAnnotPr();
|
||||
CWidgetAnnotPr* GetWidgetAnnotPr();
|
||||
|
||||
bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector);
|
||||
|
||||
@ -595,20 +668,22 @@ private:
|
||||
LONG m_nRenderLen;
|
||||
BYTE* m_pRender;
|
||||
|
||||
CMarkupAnnotPr* m_pMarkupPr;
|
||||
CTextAnnotPr* m_pTextPr;
|
||||
CInkAnnotPr* m_pInkPr;
|
||||
CLineAnnotPr* m_pLinePr;
|
||||
CTextMarkupAnnotPr* m_pTextMarkupPr;
|
||||
CSquareCircleAnnotPr* m_pSquareCirclePr;
|
||||
CPolygonLineAnnotPr* m_pPolygonLinePr;
|
||||
CPopupAnnotPr* m_pPopupPr;
|
||||
CFreeTextAnnotPr* m_pFreeTextPr;
|
||||
CCaretAnnotPr* m_pCaretPr;
|
||||
CStampAnnotPr* m_pStampPr;
|
||||
CRedactAnnotPr* m_pRedactPr;
|
||||
CLinkAnnotPr* m_pLinkPr;
|
||||
CWidgetAnnotPr* m_pWidgetPr;
|
||||
CMarkupAnnotPr* m_pMarkupPr;
|
||||
CTextAnnotPr* m_pTextPr;
|
||||
CInkAnnotPr* m_pInkPr;
|
||||
CLineAnnotPr* m_pLinePr;
|
||||
CTextMarkupAnnotPr* m_pTextMarkupPr;
|
||||
CSquareCircleAnnotPr* m_pSquareCirclePr;
|
||||
CPolygonLineAnnotPr* m_pPolygonLinePr;
|
||||
CPopupAnnotPr* m_pPopupPr;
|
||||
CFreeTextAnnotPr* m_pFreeTextPr;
|
||||
CCaretAnnotPr* m_pCaretPr;
|
||||
CStampAnnotPr* m_pStampPr;
|
||||
CRedactAnnotPr* m_pRedactPr;
|
||||
CLinkAnnotPr* m_pLinkPr;
|
||||
CFileAttachmentAnnotPr* m_pFileAttachmentPr;
|
||||
CScreenAnnotPr* m_pScreenPr;
|
||||
CWidgetAnnotPr* m_pWidgetPr;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CAnnotFieldDelete : public IAdvancedCommand
|
||||
|
||||
@ -49,10 +49,10 @@
|
||||
|
||||
struct TBBox
|
||||
{
|
||||
float fMinX;
|
||||
float fMaxX;
|
||||
float fMinY;
|
||||
float fMaxY;
|
||||
float fMinX = 0;
|
||||
float fMaxX = 0;
|
||||
float fMinY = 0;
|
||||
float fMaxY = 0;
|
||||
};
|
||||
|
||||
struct TBBoxAdvance
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#include "HTMLRendererText.h"
|
||||
#include "Text.h"
|
||||
|
||||
@ -357,6 +358,17 @@ namespace NSHtmlRenderer
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CHTMLRendererText::CommandDrawType3CHAR(const std::wstring& wsUnicodeText, const double& x, const double& y, const double& w, const double& h, const double& ascent, const double& descent, const double& unitsPerEm)
|
||||
{
|
||||
m_pInternal->m_oSmartText.m_oFontManager.SetType3Metrics(ascent, descent, unitsPerEm, w);
|
||||
|
||||
m_pInternal->GetUnicodes(wsUnicodeText);
|
||||
m_pInternal->WriteText(m_pInternal->m_pTempUnicodes, NULL, m_pInternal->m_nTempUnicodesLen, x, y);
|
||||
|
||||
m_pInternal->m_oSmartText.m_oFontManager.ClearType3();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-------- Command markers ---------------------------------------------------------------
|
||||
HRESULT CHTMLRendererText::BeginCommand(const DWORD& lType) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::EndCommand(const DWORD& lType) { return S_OK; }
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#ifndef _ASC_HTMLRENDERER3_TEXT_H_
|
||||
#define _ASC_HTMLRENDERER3_TEXT_H_
|
||||
|
||||
@ -144,6 +145,8 @@ namespace NSHtmlRenderer
|
||||
virtual HRESULT CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h);
|
||||
virtual HRESULT CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h);
|
||||
|
||||
virtual HRESULT CommandDrawType3CHAR(const std::wstring& wsUnicodeText, const double& x, const double& y, const double& w, const double& h, const double& ascent, const double& descent, const double& unitsPerEm);
|
||||
|
||||
//-------- Command markers ---------------------------------------------------------------
|
||||
virtual HRESULT BeginCommand(const DWORD& lType);
|
||||
virtual HRESULT EndCommand(const DWORD& lType);
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#ifndef _ASC_HTMLRENDERER_TEXT_H_
|
||||
#define _ASC_HTMLRENDERER_TEXT_H_
|
||||
|
||||
@ -45,9 +46,9 @@ namespace NSHtmlRenderer
|
||||
{
|
||||
struct CHFontInfo
|
||||
{
|
||||
int m_lAscent;
|
||||
int m_lDescent;
|
||||
int m_lUnitsPerEm;
|
||||
double m_lAscent;
|
||||
double m_lDescent;
|
||||
double m_lUnitsPerEm;
|
||||
|
||||
CHFontInfo() : m_lAscent(0), m_lDescent(0), m_lUnitsPerEm(0) {}
|
||||
CHFontInfo(const CHFontInfo& oSrc) : m_lAscent(oSrc.m_lAscent), m_lDescent(oSrc.m_lDescent), m_lUnitsPerEm(oSrc.m_lUnitsPerEm) {}
|
||||
@ -68,13 +69,29 @@ namespace NSHtmlRenderer
|
||||
NSStructures::CFont* m_pFont;
|
||||
CHFontInfo m_oCurrentInfo;
|
||||
|
||||
bool m_bIsType3;
|
||||
double m_dType3GlyphWidth;
|
||||
|
||||
public:
|
||||
CFontManagerWrapper() : m_pManager(NULL) {}
|
||||
CFontManagerWrapper() : m_pManager(NULL), m_bIsType3(false), m_dType3GlyphWidth(0) {}
|
||||
virtual ~CFontManagerWrapper()
|
||||
{
|
||||
RELEASEOBJECT(m_pManager);
|
||||
}
|
||||
|
||||
void SetType3Metrics(double dAscent, double dDescent, double dUnitsPerEm, double dGlyphWidth)
|
||||
{
|
||||
m_bIsType3 = true;
|
||||
m_dType3GlyphWidth = dGlyphWidth;
|
||||
m_oCurrentInfo.m_lAscent = dAscent;
|
||||
m_oCurrentInfo.m_lDescent = dDescent;
|
||||
m_oCurrentInfo.m_lUnitsPerEm = dUnitsPerEm > 0 ? dUnitsPerEm : 1000;
|
||||
}
|
||||
void ClearType3()
|
||||
{
|
||||
m_bIsType3 = false;
|
||||
}
|
||||
|
||||
void Init(NSFonts::IApplicationFonts* pApplicationFonts, int nCacheSize = 0)
|
||||
{
|
||||
RELEASEOBJECT(m_pManager);
|
||||
@ -98,15 +115,25 @@ namespace NSHtmlRenderer
|
||||
else
|
||||
LoadFontByFile(m_pFont->Path, m_pFont->Size);
|
||||
}
|
||||
double MeasureString(const unsigned int* symbols, const int& count, double x, double y)
|
||||
TBBox MeasureString(const unsigned int* symbols, const int& count, double x, double y)
|
||||
{
|
||||
if (m_bIsType3)
|
||||
{
|
||||
TBBox oBox;
|
||||
double dUnitsPerEm = m_oCurrentInfo.m_lUnitsPerEm > 0 ? m_oCurrentInfo.m_lUnitsPerEm : 1000;
|
||||
double dFontSizePt = m_pFont ? m_pFont->Size : 10.0;
|
||||
oBox.fMinX = (float)x;
|
||||
oBox.fMinY = (float)(-(m_oCurrentInfo.m_lAscent / dUnitsPerEm) * dFontSizePt);
|
||||
oBox.fMaxX = (float)(x + m_dType3GlyphWidth);
|
||||
oBox.fMaxY = (float)( (m_oCurrentInfo.m_lDescent / dUnitsPerEm) * dFontSizePt);
|
||||
return oBox;
|
||||
}
|
||||
|
||||
if (!m_pManager)
|
||||
return 0;
|
||||
return TBBox();
|
||||
|
||||
m_pManager->LoadString1(symbols, count, (float)x, (float)y);
|
||||
TBBox _box = m_pManager->MeasureString2();
|
||||
|
||||
return abs((_box.fMaxX - _box.fMinX) * 25.4 / 72.0);
|
||||
return m_pManager->MeasureString2();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -358,7 +385,7 @@ namespace NSHtmlRenderer
|
||||
}
|
||||
|
||||
// done, baseline is set. now just continue the line
|
||||
if (bIsDumpFont)
|
||||
if (bIsDumpFont && !m_oFontManager.m_bIsType3)
|
||||
m_oFontManager.LoadCurrentFont();
|
||||
|
||||
double dKoef = m_oFontManager.m_pFont->Size * 25.4 / (72 * m_oFontManager.m_oCurrentInfo.m_lUnitsPerEm);
|
||||
@ -386,7 +413,14 @@ namespace NSHtmlRenderer
|
||||
double dPrevW = dOffsetX;
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
double dW = m_oFontManager.MeasureString((const unsigned int*)(input + i), 1, 0, 0);
|
||||
TBBox bBox = m_oFontManager.MeasureString((const unsigned int*)(input + i), 1, 0, 0);
|
||||
double dW = std::abs((bBox.fMaxX - bBox.fMinX) * 25.4 / 72.0);
|
||||
double dMeasureAscent = std::abs(bBox.fMinY * 25.4 / 72.0);
|
||||
double dMeasureDescent = std::abs(bBox.fMaxY * 25.4 / 72.0);
|
||||
if (m_oLine.m_dAscent < dMeasureAscent)
|
||||
m_oLine.m_dAscent = dMeasureAscent;
|
||||
if (m_oLine.m_dDescent < dMeasureDescent)
|
||||
m_oLine.m_dDescent = dMeasureDescent;
|
||||
|
||||
NSWasm::CHChar* pChar = m_oLine.AddTail();
|
||||
pChar->unicode = pUnicodes[i];
|
||||
|
||||
@ -1,3 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#ifndef _WASM_SERIALIZE_H
|
||||
#define _WASM_SERIALIZE_H
|
||||
|
||||
|
||||
@ -144,3 +144,5 @@ void IOfficeDrawingFile::ConvertToRaster(int nPageIndex, const std::wstring& pat
|
||||
pFrame->SaveFile(path, nImageType);
|
||||
RELEASEOBJECT(pFrame);
|
||||
}
|
||||
|
||||
void IOfficeDrawingFile::SetPainter(IOfficeDrawingFilePainter* pPainter) {}
|
||||
|
||||
@ -59,6 +59,26 @@ struct COfficeDrawingPageParams
|
||||
}
|
||||
};
|
||||
|
||||
class IOfficeDrawingFilePainter
|
||||
{
|
||||
public:
|
||||
enum class State
|
||||
{
|
||||
Paused,
|
||||
Stopped,
|
||||
Runned
|
||||
};
|
||||
|
||||
enum class Status
|
||||
{
|
||||
Ok,
|
||||
Cancel
|
||||
};
|
||||
|
||||
virtual State GetState() = 0;
|
||||
virtual void OnPaint(const Status&) = 0;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL IOfficeDrawingFile
|
||||
{
|
||||
public:
|
||||
@ -106,6 +126,9 @@ public:
|
||||
virtual std::wstring GetInfo() = 0;
|
||||
virtual unsigned char* GetStructure() = 0;
|
||||
virtual unsigned char* GetLinks(int nPageIndex) = 0;
|
||||
|
||||
// DrawingFile control
|
||||
virtual void SetPainter(IOfficeDrawingFilePainter* pPainter);
|
||||
};
|
||||
|
||||
#endif // _OFFICE_DRAWING_FILE_H
|
||||
|
||||
@ -1,174 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
#ifndef __LIBXML_WIN32_CONFIG__
|
||||
#define __LIBXML_WIN32_CONFIG__
|
||||
|
||||
#define HAVE_CTYPE_H
|
||||
#define HAVE_STDARG_H
|
||||
#define HAVE_MALLOC_H
|
||||
#define HAVE_ERRNO_H
|
||||
#define HAVE_STDINT_H
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
#undef HAVE_ERRNO_H
|
||||
#include <windows.h>
|
||||
#include "wincecompat.h"
|
||||
#else
|
||||
#define HAVE_SYS_STAT_H
|
||||
#define HAVE__STAT
|
||||
#define HAVE_STAT
|
||||
#define HAVE_STDLIB_H
|
||||
#define HAVE_TIME_H
|
||||
#define HAVE_FCNTL_H
|
||||
//#include <io.h>
|
||||
//#include <direct.h>
|
||||
#endif
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifndef ICONV_CONST
|
||||
#define ICONV_CONST const
|
||||
#endif
|
||||
|
||||
//#ifdef NEED_SOCKETS
|
||||
//#include <wsockcompat.h>
|
||||
//#endif
|
||||
|
||||
/*
|
||||
* Windows platforms may define except
|
||||
*/
|
||||
#undef except
|
||||
|
||||
#define HAVE_ISINF
|
||||
#define HAVE_ISNAN
|
||||
#include <math.h>
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
/* MS C-runtime has functions which can be used in order to determine if
|
||||
a given floating-point variable contains NaN, (+-)INF. These are
|
||||
preferred, because floating-point technology is considered propriatary
|
||||
by MS and we can assume that their functions know more about their
|
||||
oddities than we do. */
|
||||
#include <float.h>
|
||||
/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
|
||||
function. */
|
||||
#ifndef isinf
|
||||
#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
|
||||
: ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
|
||||
#endif
|
||||
/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
|
||||
#ifndef isnan
|
||||
#define isnan(d) (_isnan(d))
|
||||
#endif
|
||||
#else /* _MSC_VER */
|
||||
#ifdef WIN32
|
||||
#ifndef isinf
|
||||
int isinf (double d) {
|
||||
int expon = 0;
|
||||
double val = frexp (d, &expon);
|
||||
if (expon == 1025) {
|
||||
if (val == 0.5) {
|
||||
return 1;
|
||||
} else if (val == -0.5) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef isnan
|
||||
int isnan (double d) {
|
||||
int expon = 0;
|
||||
double val = frexp (d, &expon);
|
||||
if (expon == 1025) {
|
||||
if (val == 0.5) {
|
||||
return 0;
|
||||
} else if (val == -0.5) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define mkdir(p,m) _mkdir(p)
|
||||
#if _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#if _MSC_VER < 1500
|
||||
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
|
||||
#endif
|
||||
#elif defined(__MINGW32__)
|
||||
#define mkdir(p,m) _mkdir(p)
|
||||
#endif
|
||||
|
||||
/* Threading API to use should be specified here for compatibility reasons.
|
||||
This is however best specified on the compiler's command-line. */
|
||||
#if defined(LIBXML_THREAD_ENABLED)
|
||||
#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) && !defined(_WIN32_WCE)
|
||||
#define HAVE_WIN32_THREADS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LIBXML_READER_ENABLED
|
||||
#define LIBXML_READER_ENABLED
|
||||
#endif
|
||||
|
||||
#ifndef LIBXML_PUSH_ENABLED
|
||||
#define LIBXML_PUSH_ENABLED
|
||||
#endif
|
||||
|
||||
#ifndef LIBXML_HTML_ENABLED
|
||||
#define LIBXML_HTML_ENABLED
|
||||
#endif
|
||||
|
||||
/* Some third-party libraries far from our control assume the following
|
||||
is defined, which it is not if we don't include windows.h. */
|
||||
#if !defined(FALSE)
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#if !defined(TRUE)
|
||||
#define TRUE (!(FALSE))
|
||||
#endif
|
||||
|
||||
#endif /* __LIBXML_WIN32_CONFIG__ */
|
||||
@ -48,9 +48,11 @@ DEFINES += \
|
||||
LIBXML_STATIC
|
||||
}
|
||||
|
||||
LIBXML2_ROOT_DIR = $$PWD/../../../../Common/3dParty/libxml/libxml2
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../../libxml2/include \
|
||||
$$PWD/../../libxml2/include/libxml \
|
||||
$$LIBXML2_ROOT_DIR/include \
|
||||
$$LIBXML2_ROOT_DIR/include/libxml \
|
||||
$$PWD
|
||||
|
||||
core_release {
|
||||
@ -62,50 +64,47 @@ core_release {
|
||||
|
||||
core_debug {
|
||||
SOURCES += \
|
||||
$$PWD/../../libxml2/buf.c \
|
||||
$$PWD/../../libxml2/c14n.c \
|
||||
$$PWD/../../libxml2/catalog.c \
|
||||
$$PWD/../../libxml2/chvalid.c \
|
||||
$$PWD/../../libxml2/debugXML.c \
|
||||
$$PWD/../../libxml2/dict.c \
|
||||
$$PWD/../../libxml2/DOCBparser.c \
|
||||
$$PWD/../../libxml2/encoding.c \
|
||||
$$PWD/../../libxml2/entities.c \
|
||||
$$PWD/../../libxml2/error.c \
|
||||
$$PWD/../../libxml2/globals.c \
|
||||
$$PWD/../../libxml2/hash.c \
|
||||
$$PWD/../../libxml2/HTMLparser.c \
|
||||
$$PWD/../../libxml2/HTMLtree.c \
|
||||
$$PWD/../../libxml2/legacy.c \
|
||||
$$PWD/../../libxml2/list.c \
|
||||
$$PWD/../../libxml2/nanoftp.c \
|
||||
$$PWD/../../libxml2/nanohttp.c \
|
||||
$$PWD/../../libxml2/parserInternals.c \
|
||||
$$PWD/../../libxml2/pattern.c \
|
||||
$$PWD/../../libxml2/relaxng.c \
|
||||
$$PWD/../../libxml2/SAX.c \
|
||||
$$PWD/../../libxml2/SAX2.c \
|
||||
$$PWD/../../libxml2/schematron.c \
|
||||
$$PWD/../../libxml2/threads.c \
|
||||
$$PWD/../../libxml2/tree.c \
|
||||
$$PWD/../../libxml2/uri.c \
|
||||
$$PWD/../../libxml2/xinclude.c \
|
||||
$$PWD/../../libxml2/xlink.c \
|
||||
$$PWD/../../libxml2/xmlIO.c \
|
||||
$$PWD/../../libxml2/xmlmemory.c \
|
||||
$$PWD/../../libxml2/xmlmodule.c \
|
||||
$$PWD/../../libxml2/xmlreader.c \
|
||||
$$PWD/../../libxml2/xmlregexp.c \
|
||||
$$PWD/../../libxml2/xmlsave.c \
|
||||
$$PWD/../../libxml2/xmlschemas.c \
|
||||
$$PWD/../../libxml2/xmlschemastypes.c \
|
||||
$$PWD/../../libxml2/xmlstring.c \
|
||||
$$PWD/../../libxml2/xmlunicode.c \
|
||||
$$PWD/../../libxml2/xmlwriter.c \
|
||||
$$PWD/../../libxml2/xpath.c \
|
||||
$$PWD/../../libxml2/xpointer.c \
|
||||
$$PWD/../../libxml2/valid.c \
|
||||
$$PWD/../../libxml2/parser.c
|
||||
$$LIBXML2_ROOT_DIR/buf.c \
|
||||
$$LIBXML2_ROOT_DIR/c14n.c \
|
||||
$$LIBXML2_ROOT_DIR/catalog.c \
|
||||
$$LIBXML2_ROOT_DIR/chvalid.c \
|
||||
$$LIBXML2_ROOT_DIR/debugXML.c \
|
||||
$$LIBXML2_ROOT_DIR/dict.c \
|
||||
$$LIBXML2_ROOT_DIR/encoding.c \
|
||||
$$LIBXML2_ROOT_DIR/entities.c \
|
||||
$$LIBXML2_ROOT_DIR/error.c \
|
||||
$$LIBXML2_ROOT_DIR/globals.c \
|
||||
$$LIBXML2_ROOT_DIR/hash.c \
|
||||
$$LIBXML2_ROOT_DIR/HTMLparser.c \
|
||||
$$LIBXML2_ROOT_DIR/HTMLtree.c \
|
||||
$$LIBXML2_ROOT_DIR/list.c \
|
||||
$$LIBXML2_ROOT_DIR/nanohttp.c \
|
||||
$$LIBXML2_ROOT_DIR/parserInternals.c \
|
||||
$$LIBXML2_ROOT_DIR/pattern.c \
|
||||
$$LIBXML2_ROOT_DIR/relaxng.c \
|
||||
$$LIBXML2_ROOT_DIR/SAX2.c \
|
||||
$$LIBXML2_ROOT_DIR/schematron.c \
|
||||
$$LIBXML2_ROOT_DIR/shell.c \
|
||||
$$LIBXML2_ROOT_DIR/threads.c \
|
||||
$$LIBXML2_ROOT_DIR/tree.c \
|
||||
$$LIBXML2_ROOT_DIR/uri.c \
|
||||
$$LIBXML2_ROOT_DIR/xinclude.c \
|
||||
$$LIBXML2_ROOT_DIR/xlink.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlIO.c \
|
||||
$$LIBXML2_ROOT_DIR/xmllint.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlmemory.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlmodule.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlreader.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlregexp.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlsave.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlschemas.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlschemastypes.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlstring.c \
|
||||
$$LIBXML2_ROOT_DIR/xmlwriter.c \
|
||||
$$LIBXML2_ROOT_DIR/xpath.c \
|
||||
$$LIBXML2_ROOT_DIR/xpointer.c \
|
||||
$$LIBXML2_ROOT_DIR/valid.c \
|
||||
$$LIBXML2_ROOT_DIR/parser.c
|
||||
}
|
||||
|
||||
!core_only_libxml {
|
||||
@ -121,3 +120,7 @@ HEADERS += \
|
||||
$$PWD/../../include/xmlutils.h \
|
||||
$$PWD/../../include/xmlwriter.h
|
||||
}
|
||||
|
||||
core_windows {
|
||||
LIBS += -lbcrypt
|
||||
}
|
||||
|
||||
@ -1,44 +1,39 @@
|
||||
#include "../../libxml2/buf.c"
|
||||
#include "../../libxml2/c14n.c"
|
||||
#include "../../libxml2/catalog.c"
|
||||
#include "../../libxml2/chvalid.c"
|
||||
#include "../../libxml2/debugXML.c"
|
||||
#include "../../libxml2/dict.c"
|
||||
#include "../../libxml2/DOCBparser.c"
|
||||
#include "../../libxml2/encoding.c"
|
||||
#include "../../libxml2/entities.c"
|
||||
#include "../../libxml2/error.c"
|
||||
#include "../../libxml2/globals.c"
|
||||
#include "../../libxml2/hash.c"
|
||||
#include "../../libxml2/HTMLparser.c"
|
||||
#include "../../libxml2/HTMLtree.c"
|
||||
#include "../../libxml2/legacy.c"
|
||||
#include "../../libxml2/list.c"
|
||||
#include "../../libxml2/nanoftp.c"
|
||||
#include "../../libxml2/nanohttp.c"
|
||||
//#include "../../libxml2/parser.c"
|
||||
#include "../../libxml2/parserInternals.c"
|
||||
#include "../../libxml2/pattern.c"
|
||||
#include "../../libxml2/relaxng.c"
|
||||
#include "../../libxml2/SAX.c"
|
||||
#include "../../libxml2/SAX2.c"
|
||||
#include "../../libxml2/schematron.c"
|
||||
#include "../../libxml2/threads.c"
|
||||
#include "../../libxml2/tree.c"
|
||||
#include "../../libxml2/uri.c"
|
||||
//#include "../../libxml2/valid.c"
|
||||
#include "../../libxml2/xinclude.c"
|
||||
#include "../../libxml2/xlink.c"
|
||||
#include "../../libxml2/xmlIO.c"
|
||||
#include "../../libxml2/xmlmemory.c"
|
||||
#include "../../libxml2/xmlmodule.c"
|
||||
#include "../../libxml2/xmlreader.c"
|
||||
#include "../../libxml2/xmlregexp.c"
|
||||
#include "../../libxml2/xmlsave.c"
|
||||
#include "../../libxml2/xmlschemas.c"
|
||||
#include "../../libxml2/xmlschemastypes.c"
|
||||
#include "../../libxml2/xmlstring.c"
|
||||
#include "../../libxml2/xmlunicode.c"
|
||||
#include "../../libxml2/xmlwriter.c"
|
||||
#include "../../libxml2/xpath.c"
|
||||
#include "../../libxml2/xpointer.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/buf.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/c14n.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/catalog.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/chvalid.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/debugXML.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/dict.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/encoding.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/entities.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/error.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/globals.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/hash.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/HTMLparser.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/HTMLtree.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/list.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/nanohttp.c"
|
||||
//#include "../../../../Common/3dParty/libxml/libxml2/parser.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/parserInternals.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/pattern.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/relaxng.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/SAX2.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/schematron.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/threads.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/tree.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/uri.c"
|
||||
//#include "../../../../Common/3dParty/libxml/libxml2/valid.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xinclude.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xlink.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlIO.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlmemory.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlmodule.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlreader.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlregexp.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlsave.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlschemas.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlschemastypes.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlstring.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xmlwriter.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xpath.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/xpointer.c"
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#include "../../libxml2/valid.c"
|
||||
#include "../../libxml2/parser.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/valid.c"
|
||||
#include "../../../../Common/3dParty/libxml/libxml2/parser.c"
|
||||
|
||||
@ -119,8 +119,8 @@ namespace XmlUtils
|
||||
void GetTextWithHHHH(bool bPreserve, wchar_t*& sBuffer, long& nSize, long& nLen);
|
||||
std::wstring GetTextWithHHHH(bool bPreserve);
|
||||
|
||||
std::wstring GetOuterXml();
|
||||
std::wstring GetInnerXml();
|
||||
std::wstring GetOuterXml(bool bEncodingXml = true);
|
||||
std::wstring GetInnerXml(bool bEncodingXml = true);
|
||||
|
||||
int GetAttributesCount();
|
||||
bool MoveToFirstAttribute();
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
Daniel Veillard <daniel@veillard.com>
|
||||
Bjorn Reese <breese@users.sourceforge.net>
|
||||
William Brack <wbrack@mmm.com.hk>
|
||||
Igor Zlatkovic <igor@zlatkovic.com> for the Windows port
|
||||
Aleksey Sanin <aleksey@aleksey.com>
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,23 +0,0 @@
|
||||
Except where otherwise noted in the source code (e.g. the files hash.c,
|
||||
list.c and the trio files, which are covered by a similar licence but
|
||||
with different Copyright notices) all the files are:
|
||||
|
||||
Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is fur-
|
||||
nished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@ -1,305 +0,0 @@
|
||||
/*
|
||||
* DOCBparser.c : an attempt to parse SGML Docbook documents
|
||||
*
|
||||
* This is deprecated !!!
|
||||
* Code removed with release 2.6.0 it was broken.
|
||||
* The doc are expect to be migrated to XML DocBook
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* daniel@veillard.com
|
||||
*/
|
||||
|
||||
#define IN_LIBXML
|
||||
#include "libxml.h"
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/DOCBparser.h>
|
||||
|
||||
/**
|
||||
* docbEncodeEntities:
|
||||
* @out: a pointer to an array of bytes to store the result
|
||||
* @outlen: the length of @out
|
||||
* @in: a pointer to an array of UTF-8 chars
|
||||
* @inlen: the length of @in
|
||||
* @quoteChar: the quote character to escape (' or ") or zero.
|
||||
*
|
||||
* Take a block of UTF-8 chars in and try to convert it to an ASCII
|
||||
* plus SGML entities block of chars out.
|
||||
*
|
||||
* Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
|
||||
* The value of @inlen after return is the number of octets consumed
|
||||
* as the return value is positive, else unpredictable.
|
||||
* The value of @outlen after return is the number of octets consumed.
|
||||
*/
|
||||
int
|
||||
docbEncodeEntities(unsigned char *out ATTRIBUTE_UNUSED,
|
||||
int *outlen ATTRIBUTE_UNUSED,
|
||||
const unsigned char *in ATTRIBUTE_UNUSED,
|
||||
int *inlen ATTRIBUTE_UNUSED,
|
||||
int quoteChar ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbEncodeEntities() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* docbParseDocument:
|
||||
* @ctxt: an SGML parser context
|
||||
*
|
||||
* parse an SGML document (and build a tree if using the standard SAX
|
||||
* interface).
|
||||
*
|
||||
* Returns 0, -1 in case of error. the parser context is augmented
|
||||
* as a result of the parsing.
|
||||
*/
|
||||
|
||||
int
|
||||
docbParseDocument(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseDocument() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
return (xmlParseDocument(ctxt));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbFreeParserCtxt:
|
||||
* @ctxt: an SGML parser context
|
||||
*
|
||||
* Free all the memory used by a parser context. However the parsed
|
||||
* document in ctxt->myDoc is not freed.
|
||||
*/
|
||||
|
||||
void
|
||||
docbFreeParserCtxt(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbFreeParserCtxt() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
}
|
||||
|
||||
/**
|
||||
* docbParseChunk:
|
||||
* @ctxt: an XML parser context
|
||||
* @chunk: an char array
|
||||
* @size: the size in byte of the chunk
|
||||
* @terminate: last chunk indicator
|
||||
*
|
||||
* Parse a Chunk of memory
|
||||
*
|
||||
* Returns zero if no error, the xmlParserErrors otherwise.
|
||||
*/
|
||||
int
|
||||
docbParseChunk(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||
const char *chunk ATTRIBUTE_UNUSED,
|
||||
int size ATTRIBUTE_UNUSED,
|
||||
int terminate ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseChunk() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlParseChunk(ctxt, chunk, size, terminate));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbCreatePushParserCtxt:
|
||||
* @sax: a SAX handler
|
||||
* @user_data: The user data returned on SAX callbacks
|
||||
* @chunk: a pointer to an array of chars
|
||||
* @size: number of chars in the array
|
||||
* @filename: an optional file name or URI
|
||||
* @enc: an optional encoding
|
||||
*
|
||||
* Create a parser context for using the DocBook SGML parser in push mode
|
||||
* To allow content encoding detection, @size should be >= 4
|
||||
* The value of @filename is used for fetching external entities
|
||||
* and error/warning reports.
|
||||
*
|
||||
* Returns the new parser context or NULL
|
||||
*/
|
||||
docbParserCtxtPtr
|
||||
docbCreatePushParserCtxt(docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
|
||||
void *user_data ATTRIBUTE_UNUSED,
|
||||
const char *chunk ATTRIBUTE_UNUSED,
|
||||
int size ATTRIBUTE_UNUSED,
|
||||
const char *filename ATTRIBUTE_UNUSED,
|
||||
xmlCharEncoding enc ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseChunk() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return(xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbSAXParseDoc:
|
||||
* @cur: a pointer to an array of xmlChar
|
||||
* @encoding: a free form C string describing the SGML document encoding, or NULL
|
||||
* @sax: the SAX handler block
|
||||
* @userData: if using SAX, this pointer will be provided on callbacks.
|
||||
*
|
||||
* parse an SGML in-memory document and build a tree.
|
||||
* It use the given SAX function block to handle the parsing callback.
|
||||
* If sax is NULL, fallback to the default DOM tree building routines.
|
||||
*
|
||||
* Returns the resulting document tree
|
||||
*/
|
||||
|
||||
docbDocPtr
|
||||
docbSAXParseDoc(xmlChar * cur ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED,
|
||||
docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
|
||||
void *userData ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseChunk() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlSAXParseMemoryWithData(sax, (const char *)cur,
|
||||
xmlStrlen((const xmlChar *) cur), 0, userData));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbParseDoc:
|
||||
* @cur: a pointer to an array of xmlChar
|
||||
* @encoding: a free form C string describing the SGML document encoding, or NULL
|
||||
*
|
||||
* parse an SGML in-memory document and build a tree.
|
||||
*
|
||||
* Returns the resulting document tree
|
||||
*/
|
||||
|
||||
docbDocPtr
|
||||
docbParseDoc(xmlChar * cur ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseChunk() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlParseDoc(cur));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* docbCreateFileParserCtxt:
|
||||
* @filename: the filename
|
||||
* @encoding: the SGML document encoding, or NULL
|
||||
*
|
||||
* Create a parser context for a file content.
|
||||
* Automatic support for ZLIB/Compress compressed document is provided
|
||||
* by default if found at compile-time.
|
||||
*
|
||||
* Returns the new parser context or NULL
|
||||
*/
|
||||
docbParserCtxtPtr
|
||||
docbCreateFileParserCtxt(const char *filename ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbCreateFileParserCtxt() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlCreateFileParserCtxt(filename));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbSAXParseFile:
|
||||
* @filename: the filename
|
||||
* @encoding: a free form C string describing the SGML document encoding, or NULL
|
||||
* @sax: the SAX handler block
|
||||
* @userData: if using SAX, this pointer will be provided on callbacks.
|
||||
*
|
||||
* parse an SGML file and build a tree. Automatic support for ZLIB/Compress
|
||||
* compressed document is provided by default if found at compile-time.
|
||||
* It use the given SAX function block to handle the parsing callback.
|
||||
* If sax is NULL, fallback to the default DOM tree building routines.
|
||||
*
|
||||
* Returns the resulting document tree
|
||||
*/
|
||||
|
||||
docbDocPtr
|
||||
docbSAXParseFile(const char *filename ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED,
|
||||
docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
|
||||
void *userData ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbSAXParseFile() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlSAXParseFileWithData(sax, filename, 0, userData));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbParseFile:
|
||||
* @filename: the filename
|
||||
* @encoding: a free form C string describing document encoding, or NULL
|
||||
*
|
||||
* parse a Docbook SGML file and build a tree. Automatic support for
|
||||
* ZLIB/Compress compressed document is provided by default if found
|
||||
* at compile-time.
|
||||
*
|
||||
* Returns the resulting document tree
|
||||
*/
|
||||
|
||||
docbDocPtr
|
||||
docbParseFile(const char *filename ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseFile() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlParseFile(filename));
|
||||
}
|
||||
#define bottom_DOCBparser
|
||||
#include "elfgcchack.h"
|
||||
#endif /* LIBXML_DOCB_ENABLED */
|
||||
@ -1,37 +0,0 @@
|
||||
NOTE:
|
||||
- the head of this module is package libxml-2 . There is incompatibilities
|
||||
with the old libxml-1 headers. I posted on gnome-hackers a recipe to
|
||||
change your code to compile with both, check it out ! Also read
|
||||
http://xmlsoft.org/upgrade.html
|
||||
- in the meantime the old 1.x code has been tagged with LIB_XML_1_BRANCH
|
||||
extract this version and drop me a mail if you want me to take care of
|
||||
the update of your module to libxml-2 <daniel@veillard.com>
|
||||
- the 1.x branch has a separate commit policy, please check the HACKING
|
||||
file for this branch
|
||||
|
||||
Rules for commits on the gnome-xml module
|
||||
=========================================
|
||||
|
||||
BEFORE READING FURTHER: DO NOT COMMIT DIRECTLY !
|
||||
|
||||
In the exceptional case where a serious breakage in this module
|
||||
prevents other core projects from making progress, then feel free
|
||||
to patch first and send mail afterward as long as the changes are limited.
|
||||
Please keep in mind that a large part of my user base is on Windows, so
|
||||
be careful with potential portability problems there.
|
||||
|
||||
Otherwise, send me (veillard@redhat.com) a mail and if it's a bug
|
||||
issue, register it at bugzilla.gnome.org (module libxml). I check both
|
||||
my mail and the bug database on a regular basis. If you don't get an
|
||||
answer within a week (which is highly unprobable) then commit your changes.
|
||||
This simply mean that I'm on holliday or on the road.
|
||||
|
||||
thanks in advance for following the rule,
|
||||
|
||||
Daniel
|
||||
|
||||
P.S.: Bjorn Reese, William Brack, Thomas Broyer, Igor Zlatkovic and
|
||||
Aleksey Sanin get an exception for the send before commit rule
|
||||
as well as John Fleck for the doc maintenance Send them mail if
|
||||
I don't answer to request in a timely fashion
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,61 +0,0 @@
|
||||
Extracted from the documentation:
|
||||
http://xmlsoft.org/FAQ.html#Compilatio
|
||||
|
||||
See also the generic INSTALL file for configure options
|
||||
|
||||
Compilation
|
||||
|
||||
1.What is the process to compile libxml ?
|
||||
|
||||
As most UNIX libraries libxml follows the "standard":
|
||||
|
||||
gunzip -c xxx.tar.gz | tar xvf -
|
||||
|
||||
cd libxml-xxxx
|
||||
|
||||
./configure --help
|
||||
|
||||
to see the options, then the compilation/installation proper
|
||||
|
||||
./configure [possible options]
|
||||
|
||||
make
|
||||
|
||||
make install
|
||||
|
||||
At that point you may have to rerun ldconfig or similar utility to
|
||||
update your list of installed shared libs.
|
||||
|
||||
At this point you can check that the library is properly functionning
|
||||
by running
|
||||
|
||||
make tests
|
||||
|
||||
2.What other libraries are needed to compile/install libxml ?
|
||||
|
||||
Libxml does not requires any other library, the normal C ANSI API
|
||||
should be sufficient (please report any violation to this rule you
|
||||
may find).
|
||||
|
||||
However if found at configuration time libxml will detect and use
|
||||
the following libs:
|
||||
|
||||
libz: a highly portable and available widely compression library
|
||||
http://www.info-zip.org/pub/infozip/zlib/
|
||||
iconv: a powerful character encoding conversion library. It's
|
||||
included by default on recent glibc libraries, so it doesn't
|
||||
need to be installed specifically on linux. It seems it's
|
||||
now part of the official UNIX specification. Here is one
|
||||
implementation of the library which source can be found here.
|
||||
http://clisp.cons.org/~haible/packages-libiconv.html
|
||||
ftp://ftp.ilog.fr/pub/Users/haible/gnu/
|
||||
|
||||
3.make tests may fail on some platforms
|
||||
|
||||
Sometime the regression tests results don't completely match the
|
||||
value produced by the parser, and the makefile uses diff to print
|
||||
the delta. On some platforms the diff return breaks the compilation
|
||||
process, if the diff is small this is probably not a serious problem
|
||||
|
||||
Daniel
|
||||
veillard@redhat.com
|
||||
@ -1,9 +0,0 @@
|
||||
See first http://xmlsoft.org/bugs.html and use the list please.
|
||||
|
||||
Daniel Veillard
|
||||
E-mail: veillard@redhat.com
|
||||
Userid: veillard
|
||||
|
||||
Co-maintainer: William Brack <wbrack@mmm.com.hk>
|
||||
Windows port: Igor Zlatkovic <igor@zlatkovic.com>
|
||||
Rob Richards <rrichards@ctindustries.net>
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
||||
#
|
||||
# You may have to ajust to call the right compiler, or other oprions
|
||||
# for compiling and linking
|
||||
#
|
||||
|
||||
CFLAGS=`xml2-config --cflags`
|
||||
LIBS=`xml2-config --libs`
|
||||
THREADLIB= -lpthread
|
||||
EXEEXT=
|
||||
|
||||
all: runtest$(EXEEXT) runsuite$(EXEEXT) testapi$(EXEEXT) testchar$(EXEEXT)
|
||||
|
||||
clean:
|
||||
$(RM) runtest$(EXEEXT) runsuite$(EXEEXT) testapi$(EXEEXT)
|
||||
|
||||
check: do_runtest do_testchar do_testapi do_runsuite
|
||||
|
||||
runtest$(EXEEXT): runtest.c
|
||||
$(CC) -o runtest$(EXEEXT) $(CFLAGS) runtest.c $(LIBS) $(THREADLIB)
|
||||
|
||||
do_runtest: runtest$(EXEEXT)
|
||||
./runtest
|
||||
|
||||
runsuite$(EXEEXT): runsuite.c
|
||||
$(CC) -o runsuite$(EXEEXT) $(CFLAGS) runsuite.c $(LIBS)
|
||||
|
||||
do_runsuite: runsuite$(EXEEXT)
|
||||
./runsuite
|
||||
|
||||
testapi$(EXEEXT): testapi.c
|
||||
$(CC) -o testapi$(EXEEXT) $(CFLAGS) testapi.c $(LIBS)
|
||||
|
||||
do_testapi: testapi$(EXEEXT)
|
||||
./testapi
|
||||
|
||||
testchar$(EXEEXT): testchar.c
|
||||
$(CC) -o testchar$(EXEEXT) $(CFLAGS) testchar.c $(LIBS)
|
||||
|
||||
do_testchar: testchar$(EXEEXT)
|
||||
./testchar
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
# This is a makefile for win32 systems (VC 5.0).
|
||||
# Christopher Blizzard
|
||||
# http://odin.appliedtheory.com/
|
||||
|
||||
CC = cl
|
||||
CFLAGS = /c /GB /Gi /nologo /I. /DWIN32 /MT /Zi
|
||||
|
||||
LD = link
|
||||
LDFLAGS = /DEBUG /NODEFAULTLIB:libc
|
||||
|
||||
AR = lib
|
||||
|
||||
all: xml.lib
|
||||
|
||||
test: tester.exe
|
||||
|
||||
SHARED_OBJS = entities.obj parser.obj tree.obj SAX.obj
|
||||
|
||||
xml.lib: $(SHARED_OBJS)
|
||||
$(AR) /out:xml.lib $(SHARED_OBJS)
|
||||
|
||||
tester.obj: $(SHARED_OBJS)
|
||||
$(CC) $(CFLAGS) tester.c /out:tester.obj
|
||||
|
||||
tester.exe: tester.obj xml.lib
|
||||
$(LD) $(LDFLAGS) /out:tester.exe tester.obj xml.lib
|
||||
|
||||
clean:
|
||||
-del /f $(SHARED_OBJS) tester.obj
|
||||
-del /f tester.exe
|
||||
-del /f xml.lib
|
||||
-del /f *.pdb
|
||||
-del /f *.idb
|
||||
-del /f *.ilk
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,39 +0,0 @@
|
||||
|
||||
XML toolkit from the GNOME project
|
||||
|
||||
Full documentation is available on-line at
|
||||
http://xmlsoft.org/
|
||||
|
||||
This code is released under the MIT Licence see the Copyright file.
|
||||
|
||||
To build on an Unixised setup:
|
||||
./configure ; make ; make install
|
||||
To build on Windows:
|
||||
see instructions on win32/Readme.txt
|
||||
|
||||
To assert build quality:
|
||||
on an Unixised setup:
|
||||
run make tests
|
||||
otherwise:
|
||||
There is 3 standalone tools runtest.c runsuite.c testapi.c, which
|
||||
should compile as part of the build or as any application would.
|
||||
Launch them from this directory to get results, runtest checks
|
||||
the proper functionning of libxml2 main APIs while testapi does
|
||||
a full coverage check. Report failures to the list.
|
||||
|
||||
To report bugs, follow the instructions at:
|
||||
http://xmlsoft.org/bugs.html
|
||||
|
||||
A mailing-list xml@gnome.org is available, to subscribe:
|
||||
http://mail.gnome.org/mailman/listinfo/xml
|
||||
|
||||
The list archive is at:
|
||||
http://mail.gnome.org/archives/xml/
|
||||
|
||||
All technical answers asked privately will be automatically answered on
|
||||
the list and archived for public access unless privacy is explicitly
|
||||
required and justified.
|
||||
|
||||
Daniel Veillard
|
||||
|
||||
$Id$
|
||||
@ -1,5 +0,0 @@
|
||||
Please read the HACKING file for instructions
|
||||
|
||||
Daniel
|
||||
|
||||
$Id$
|
||||
@ -1,39 +0,0 @@
|
||||
README.tests
|
||||
|
||||
Instructions for standalone test regressions of libxml2
|
||||
|
||||
libxml2-tests-$version.tar.gz contains 3 standalone C programs as well
|
||||
as a large amount of tests and results coming from libxml2 itself and
|
||||
from W3C, NIST, Sun Microsystems, Microsoft and James Clark. Each C
|
||||
program has a different testing purpose:
|
||||
|
||||
runtest.c : runs libxml2 basic internal regression tests
|
||||
runsuite.c: runs libxml2 against external regression tests
|
||||
testapi.c : exercises the library public entry points
|
||||
testchar.c: exercise the check of character ranges and UTF-8 validation
|
||||
|
||||
The command:
|
||||
|
||||
make check
|
||||
or
|
||||
make -f Makefile.tests check
|
||||
|
||||
should be sufficient on an Unix system to build and exercise the tests
|
||||
for the version of the library installed on the system. Note however
|
||||
that there isn't backward compatibility provided so if the installed
|
||||
version is older than the testsuite one, failing to compile or run the tests
|
||||
is likely. In any event this won't work with an installed libxml2 older
|
||||
than 2.6.20.
|
||||
|
||||
Building on other platforms should be a matter of compiling the C files
|
||||
like any other program using libxml2, running the test should be done
|
||||
simply by launching the resulting executables.
|
||||
|
||||
Also note the availability of a "make valgrind" target which will run the
|
||||
above tests under valgrind to check for memory errors (but this relies
|
||||
on the availability of the valgrind command and take far more time to
|
||||
complete).
|
||||
|
||||
Daniel Veillard
|
||||
Mon May 7 2012
|
||||
|
||||
@ -1,180 +0,0 @@
|
||||
/*
|
||||
* SAX.c : Old SAX v1 handlers to build a tree.
|
||||
* Deprecated except for compatibility
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* Daniel Veillard <daniel@veillard.com>
|
||||
*/
|
||||
|
||||
|
||||
#define IN_LIBXML
|
||||
#include "libxml.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/entities.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/SAX.h>
|
||||
#include <libxml/uri.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
#include <libxml/globals.h>
|
||||
#include <libxml/SAX2.h>
|
||||
|
||||
#ifdef LIBXML_LEGACY_ENABLED
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
/**
|
||||
* initxmlDefaultSAXHandler:
|
||||
* @hdlr: the SAX handler
|
||||
* @warning: flag if non-zero sets the handler warning procedure
|
||||
*
|
||||
* Initialize the default XML SAX version 1 handler
|
||||
* DEPRECATED: use xmlSAX2InitDefaultSAXHandler() for the new SAX2 blocks
|
||||
*/
|
||||
void
|
||||
initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning)
|
||||
{
|
||||
|
||||
if(hdlr->initialized == 1)
|
||||
return;
|
||||
|
||||
hdlr->internalSubset = xmlSAX2InternalSubset;
|
||||
hdlr->externalSubset = xmlSAX2ExternalSubset;
|
||||
hdlr->isStandalone = xmlSAX2IsStandalone;
|
||||
hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
|
||||
hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
|
||||
hdlr->resolveEntity = xmlSAX2ResolveEntity;
|
||||
hdlr->getEntity = xmlSAX2GetEntity;
|
||||
hdlr->getParameterEntity = xmlSAX2GetParameterEntity;
|
||||
hdlr->entityDecl = xmlSAX2EntityDecl;
|
||||
hdlr->attributeDecl = xmlSAX2AttributeDecl;
|
||||
hdlr->elementDecl = xmlSAX2ElementDecl;
|
||||
hdlr->notationDecl = xmlSAX2NotationDecl;
|
||||
hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl;
|
||||
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
|
||||
hdlr->startDocument = xmlSAX2StartDocument;
|
||||
hdlr->endDocument = xmlSAX2EndDocument;
|
||||
hdlr->startElement = xmlSAX2StartElement;
|
||||
hdlr->endElement = xmlSAX2EndElement;
|
||||
hdlr->reference = xmlSAX2Reference;
|
||||
hdlr->characters = xmlSAX2Characters;
|
||||
hdlr->cdataBlock = xmlSAX2CDataBlock;
|
||||
hdlr->ignorableWhitespace = xmlSAX2Characters;
|
||||
hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
|
||||
if (warning == 0)
|
||||
hdlr->warning = NULL;
|
||||
else
|
||||
hdlr->warning = xmlParserWarning;
|
||||
hdlr->error = xmlParserError;
|
||||
hdlr->fatalError = xmlParserError;
|
||||
|
||||
hdlr->initialized = 1;
|
||||
}
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
/**
|
||||
* inithtmlDefaultSAXHandler:
|
||||
* @hdlr: the SAX handler
|
||||
*
|
||||
* Initialize the default HTML SAX version 1 handler
|
||||
* DEPRECATED: use xmlSAX2InitHtmlDefaultSAXHandler() for the new SAX2 blocks
|
||||
*/
|
||||
void
|
||||
inithtmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
|
||||
{
|
||||
if(hdlr->initialized == 1)
|
||||
return;
|
||||
|
||||
hdlr->internalSubset = xmlSAX2InternalSubset;
|
||||
hdlr->externalSubset = NULL;
|
||||
hdlr->isStandalone = NULL;
|
||||
hdlr->hasInternalSubset = NULL;
|
||||
hdlr->hasExternalSubset = NULL;
|
||||
hdlr->resolveEntity = NULL;
|
||||
hdlr->getEntity = xmlSAX2GetEntity;
|
||||
hdlr->getParameterEntity = NULL;
|
||||
hdlr->entityDecl = NULL;
|
||||
hdlr->attributeDecl = NULL;
|
||||
hdlr->elementDecl = NULL;
|
||||
hdlr->notationDecl = NULL;
|
||||
hdlr->unparsedEntityDecl = NULL;
|
||||
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
|
||||
hdlr->startDocument = xmlSAX2StartDocument;
|
||||
hdlr->endDocument = xmlSAX2EndDocument;
|
||||
hdlr->startElement = xmlSAX2StartElement;
|
||||
hdlr->endElement = xmlSAX2EndElement;
|
||||
hdlr->reference = NULL;
|
||||
hdlr->characters = xmlSAX2Characters;
|
||||
hdlr->cdataBlock = xmlSAX2CDataBlock;
|
||||
hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
|
||||
hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
|
||||
hdlr->comment = xmlSAX2Comment;
|
||||
hdlr->warning = xmlParserWarning;
|
||||
hdlr->error = xmlParserError;
|
||||
hdlr->fatalError = xmlParserError;
|
||||
|
||||
hdlr->initialized = 1;
|
||||
}
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
/**
|
||||
* initdocbDefaultSAXHandler:
|
||||
* @hdlr: the SAX handler
|
||||
*
|
||||
* Initialize the default DocBook SAX version 1 handler
|
||||
* DEPRECATED: use xmlSAX2InitDocbDefaultSAXHandler() for the new SAX2 blocks
|
||||
*/
|
||||
void
|
||||
initdocbDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
|
||||
{
|
||||
if(hdlr->initialized == 1)
|
||||
return;
|
||||
|
||||
hdlr->internalSubset = xmlSAX2InternalSubset;
|
||||
hdlr->externalSubset = NULL;
|
||||
hdlr->isStandalone = xmlSAX2IsStandalone;
|
||||
hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
|
||||
hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
|
||||
hdlr->resolveEntity = xmlSAX2ResolveEntity;
|
||||
hdlr->getEntity = xmlSAX2GetEntity;
|
||||
hdlr->getParameterEntity = NULL;
|
||||
hdlr->entityDecl = xmlSAX2EntityDecl;
|
||||
hdlr->attributeDecl = NULL;
|
||||
hdlr->elementDecl = NULL;
|
||||
hdlr->notationDecl = NULL;
|
||||
hdlr->unparsedEntityDecl = NULL;
|
||||
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
|
||||
hdlr->startDocument = xmlSAX2StartDocument;
|
||||
hdlr->endDocument = xmlSAX2EndDocument;
|
||||
hdlr->startElement = xmlSAX2StartElement;
|
||||
hdlr->endElement = xmlSAX2EndElement;
|
||||
hdlr->reference = xmlSAX2Reference;
|
||||
hdlr->characters = xmlSAX2Characters;
|
||||
hdlr->cdataBlock = NULL;
|
||||
hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
|
||||
hdlr->processingInstruction = NULL;
|
||||
hdlr->comment = xmlSAX2Comment;
|
||||
hdlr->warning = xmlParserWarning;
|
||||
hdlr->error = xmlParserError;
|
||||
hdlr->fatalError = xmlParserError;
|
||||
|
||||
hdlr->initialized = 1;
|
||||
}
|
||||
|
||||
#endif /* LIBXML_DOCB_ENABLED */
|
||||
|
||||
#endif /* LIBXML_SAX1_ENABLED */
|
||||
|
||||
#define bottom_SAX
|
||||
#include "elfgcchack.h"
|
||||
#endif /* LIBXML_LEGACY_ENABLED */
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,278 +0,0 @@
|
||||
124907 HTML parse buffer problem when parsing larse in-memory docs
|
||||
124110 DTD validation && wrong namespace
|
||||
123564 xmllint --html --format
|
||||
|
||||
TODO for the XML parser and stuff:
|
||||
==================================
|
||||
|
||||
$Id$
|
||||
|
||||
this tend to be outdated :-\ ...
|
||||
|
||||
DOCS:
|
||||
=====
|
||||
|
||||
- use case of using XInclude to load for example a description.
|
||||
order document + product base -(XSLT)-> quote with XIncludes
|
||||
|
|
||||
HTML output with description of parts <---(XSLT)--
|
||||
|
||||
TODO:
|
||||
=====
|
||||
- XInclude at the SAX level (libSRVG)
|
||||
- fix the C code prototype to bring back doc/libxml-undocumented.txt
|
||||
to a reasonable level
|
||||
- Computation of base when HTTP redirect occurs, might affect HTTP
|
||||
interfaces.
|
||||
- Computation of base in XInclude. Relativization of URIs.
|
||||
- listing all attributes in a node.
|
||||
- Better checking of external parsed entities TAG 1234
|
||||
- Go through erratas and do the cleanup.
|
||||
http://www.w3.org/XML/xml-19980210-errata ... started ...
|
||||
- jamesh suggestion: SAX like functions to save a document ie. call a
|
||||
function to open a new element with given attributes, write character
|
||||
data, close last element, etc
|
||||
+ inversted SAX, initial patch in April 2002 archives.
|
||||
- htmlParseDoc has parameter encoding which is not used.
|
||||
Function htmlCreateDocParserCtxt ignore it.
|
||||
- fix realloc() usage.
|
||||
- Stricten the UTF8 conformance (Martin Duerst):
|
||||
http://www.w3.org/2001/06/utf-8-test/.
|
||||
The bad files are in http://www.w3.org/2001/06/utf-8-wrong/.
|
||||
- xml:id normalized value
|
||||
|
||||
TODO:
|
||||
=====
|
||||
|
||||
- move all string manipulation functions (xmlStrdup, xmlStrlen, etc.) to
|
||||
global.c. Bjorn noted that the following files depends on parser.o solely
|
||||
because of these string functions: entities.o, global.o, hash.o, tree.o,
|
||||
xmlIO.o, and xpath.o.
|
||||
|
||||
- Optimization of tag strings allocation ?
|
||||
|
||||
- maintain coherency of namespace when doing cut'n paste operations
|
||||
=> the functions are coded, but need testing
|
||||
|
||||
- function to rebuild the ID table
|
||||
- functions to rebuild the DTD hash tables (after DTD changes).
|
||||
|
||||
|
||||
EXTENSIONS:
|
||||
===========
|
||||
|
||||
- Tools to produce man pages from the SGML docs.
|
||||
|
||||
- Add Xpointer recognition/API
|
||||
|
||||
- Add Xlink recognition/API
|
||||
=> started adding an xlink.[ch] with a unified API for XML and HTML.
|
||||
it's crap :-(
|
||||
|
||||
- Implement XSchemas
|
||||
=> Really need to be done <grin/>
|
||||
- datatype are complete, but structure support is very limited.
|
||||
|
||||
- extend the shell with:
|
||||
- edit
|
||||
- load/save
|
||||
- mv (yum, yum, but it's harder because directories are ordered in
|
||||
our case, mvup and mvdown would be required)
|
||||
|
||||
|
||||
Done:
|
||||
=====
|
||||
|
||||
- Add HTML validation using the XHTML DTD
|
||||
- problem: do we want to keep and maintain the code for handling
|
||||
DTD/System ID cache directly in libxml ?
|
||||
=> not really done that way, but there are new APIs to check elements
|
||||
or attributes. Otherwise XHTML validation directly ...
|
||||
|
||||
- XML Schemas datatypes except Base64 and BinHex
|
||||
|
||||
- Relax NG validation
|
||||
|
||||
- XmlTextReader streaming API + validation
|
||||
|
||||
- Add a DTD cache prefilled with xhtml DTDs and entities and a program to
|
||||
manage them -> like the /usr/bin/install-catalog from SGML
|
||||
right place seems $datadir/xmldtds
|
||||
Maybe this is better left to user apps
|
||||
=> use a catalog instead , and xhtml1-dtd package
|
||||
|
||||
- Add output to XHTML
|
||||
=> XML serializer automatically recognize the DTd and apply the specific
|
||||
rules.
|
||||
|
||||
- Fix output of <tst val="x
y"/>
|
||||
|
||||
- compliance to XML-Namespace checking, see section 6 of
|
||||
http://www.w3.org/TR/REC-xml-names/
|
||||
|
||||
- Correct standalone checking/emitting (hard)
|
||||
2.9 Standalone Document Declaration
|
||||
|
||||
- Implement OASIS XML Catalog support
|
||||
http://www.oasis-open.org/committees/entity/
|
||||
|
||||
- Get OASIS testsuite to a more friendly result, check all the results
|
||||
once stable. the check-xml-test-suite.py script does this
|
||||
|
||||
- Implement XSLT
|
||||
=> libxslt
|
||||
|
||||
- Finish XPath
|
||||
=> attributes addressing troubles
|
||||
=> defaulted attributes handling
|
||||
=> namespace axis ?
|
||||
done as XSLT got debugged
|
||||
|
||||
- bug reported by Michael Meallin on validation problems
|
||||
=> Actually means I need to add support (and warn) for non-deterministic
|
||||
content model.
|
||||
- Handle undefined namespaces in entity contents better ... at least
|
||||
issue a warning
|
||||
- DOM needs
|
||||
int xmlPruneProp(xmlNodePtr node, xmlAtttrPtr attr);
|
||||
=> done it's actually xmlRemoveProp xmlUnsetProp xmlUnsetNsProp
|
||||
|
||||
- HTML: handling of Script and style data elements, need special code in
|
||||
the parser and saving functions (handling of < > " ' ...):
|
||||
http://www.w3.org/TR/html4/types.html#type-script
|
||||
Attributes are no problems since entities are accepted.
|
||||
- DOM needs
|
||||
xmlAttrPtr xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value)
|
||||
- problem when parsing hrefs with & with the HTML parser (IRC ac)
|
||||
- If the internal encoding is not UTF8 saving to a given encoding doesn't
|
||||
work => fix to force UTF8 encoding ...
|
||||
done, added documentation too
|
||||
- Add an ASCII I/O encoder (asciiToUTF8 and UTF8Toascii)
|
||||
- Issue warning when using non-absolute namespaces URI.
|
||||
- the html parser should add <head> and <body> if they don't exist
|
||||
started, not finished.
|
||||
Done, the automatic closing is added and 3 testcases were inserted
|
||||
- Command to force the parser to stop parsing and ignore the rest of the file.
|
||||
xmlStopParser() should allow this, mostly untested
|
||||
- support for HTML empty attributes like <hr noshade>
|
||||
- plugged iconv() in for support of a large set of encodings.
|
||||
- xmlSwitchToEncoding() rewrite done
|
||||
- URI checkings (no fragments) rfc2396.txt
|
||||
- Added a clean mechanism for overload or added input methods:
|
||||
xmlRegisterInputCallbacks()
|
||||
- dynamically adapt the alloc entry point to use g_alloc()/g_free()
|
||||
if the programmer wants it:
|
||||
- use xmlMemSetup() to reset the routines used.
|
||||
- Check attribute normalization especially xmlGetProp()
|
||||
- Validity checking problems for NOTATIONS attributes
|
||||
- Validity checking problems for ENTITY ENTITIES attributes
|
||||
- Parsing of a well balanced chunk xmlParseBalancedChunkMemory()
|
||||
- URI module: validation, base, etc ... see uri.[ch]
|
||||
- turn tester into a generic program xmllint installed with libxml
|
||||
- extend validity checks to go through entities content instead of
|
||||
just labelling them PCDATA
|
||||
- Save Dtds using the children list instead of dumping the tables,
|
||||
order is preserved as well as comments and PIs
|
||||
- Wrote a notice of changes requires to go from 1.x to 2.x
|
||||
- make sure that all SAX callbacks are disabled if a WF error is detected
|
||||
- checking/handling of newline normalization
|
||||
http://localhost/www.xml.com/axml/target.html#sec-line-ends
|
||||
- correct checking of '&' '%' on entities content.
|
||||
- checking of PE/Nesting on entities declaration
|
||||
- checking/handling of xml:space
|
||||
- checking done.
|
||||
- handling done, not well tested
|
||||
- Language identification code, productions [33] to [38]
|
||||
=> done, the check has been added and report WFness errors
|
||||
- Conditional sections in DTDs [61] to [65]
|
||||
=> should this crap be really implemented ???
|
||||
=> Yep OASIS testsuite uses them
|
||||
- Allow parsed entities defined in the internal subset to override
|
||||
the ones defined in the external subset (DtD customization).
|
||||
=> This mean that the entity content should be computed only at
|
||||
use time, i.e. keep the orig string only at parse time and expand
|
||||
only when referenced from the external subset :-(
|
||||
Needed for complete use of most DTD from Eve Maler
|
||||
- Add regression tests for all WFC errors
|
||||
=> did some in test/WFC
|
||||
=> added OASIS testsuite routines
|
||||
http://xmlsoft.org/conf/result.html
|
||||
|
||||
- I18N: http://wap.trondheim.com/vaer/index.phtml is not XML and accepted
|
||||
by the XML parser, UTF-8 should be checked when there is no "encoding"
|
||||
declared !
|
||||
- Support for UTF-8 and UTF-16 encoding
|
||||
=> added some convertion routines provided by Martin Durst
|
||||
patched them, got fixes from @@@
|
||||
I plan to keep everything internally as UTF-8 (or ISO-Latin-X)
|
||||
this is slightly more costly but more compact, and recent processors
|
||||
efficiency is cache related. The key for good performances is keeping
|
||||
the data set small, so will I.
|
||||
=> the new progressive reading routines call the detection code
|
||||
is enabled, tested the ISO->UTF-8 stuff
|
||||
- External entities loading:
|
||||
- allow override by client code
|
||||
- make sure it is alled for all external entities referenced
|
||||
Done, client code should use xmlSetExternalEntityLoader() to set
|
||||
the default loading routine. It will be called each time an external
|
||||
entity entity resolution is triggered.
|
||||
- maintain ID coherency when removing/changing attributes
|
||||
The function used to deallocate attributes now check for it being an
|
||||
ID and removes it from the table.
|
||||
- push mode parsing i.e. non-blocking state based parser
|
||||
done, both for XML and HTML parsers. Use xmlCreatePushParserCtxt()
|
||||
and xmlParseChunk() and html counterparts.
|
||||
The tester program now has a --push option to select that parser
|
||||
front-end. Douplicated tests to use both and check results are similar.
|
||||
|
||||
- Most of XPath, still see some troubles and occasionnal memleaks.
|
||||
- an XML shell, allowing to traverse/manipulate an XML document with
|
||||
a shell like interface, and using XPath for the anming syntax
|
||||
- use of readline and history added when available
|
||||
- the shell interface has been cleanly separated and moved to debugXML.c
|
||||
- HTML parser, should be fairly stable now
|
||||
- API to search the lang of an attribute
|
||||
- Collect IDs at parsing and maintain a table.
|
||||
PBM: maintain the table coherency
|
||||
PBM: how to detect ID types in absence of DtD !
|
||||
- Use it for XPath ID support
|
||||
- Add validity checking
|
||||
Should be finished now !
|
||||
- Add regression tests with entity substitutions
|
||||
|
||||
- External Parsed entities, either XML or external Subset [78] and [79]
|
||||
parsing the xmllang DtD now works, so it should be sufficient for
|
||||
most cases !
|
||||
|
||||
- progressive reading. The entity support is a first step toward
|
||||
asbtraction of an input stream. A large part of the context is still
|
||||
located on the stack, moving to a state machine and putting everyting
|
||||
in the parsing context should provide an adequate solution.
|
||||
=> Rather than progressive parsing, give more power to the SAX-like
|
||||
interface. Currently the DOM-like representation is built but
|
||||
=> it should be possible to define that only as a set of SAX callbacks
|
||||
and remove the tree creation from the parser code.
|
||||
DONE
|
||||
|
||||
- DOM support, instead of using a proprietary in memory
|
||||
format for the document representation, the parser should
|
||||
call a DOM API to actually build the resulting document.
|
||||
Then the parser becomes independent of the in-memory
|
||||
representation of the document. Even better using RPC's
|
||||
the parser can actually build the document in another
|
||||
program.
|
||||
=> Work started, now the internal representation is by default
|
||||
very near a direct DOM implementation. The DOM glue is implemented
|
||||
as a separate module. See the GNOME gdome module.
|
||||
|
||||
- C++ support : John Ehresman <jehresma@dsg.harvard.edu>
|
||||
- Updated code to follow more recent specs, added compatibility flag
|
||||
- Better error handling, use a dedicated, overridable error
|
||||
handling function.
|
||||
- Support for CDATA.
|
||||
- Keep track of line numbers for better error reporting.
|
||||
- Support for PI (SAX one).
|
||||
- Support for Comments (bad, should be in ASAP, they are parsed
|
||||
but not stored), should be configurable.
|
||||
- Improve the support of entities on save (+SAX).
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
- implement counted transitions at the automata level
|
||||
|
||||
- Unicode:
|
||||
+ upgrade to 3.2
|
||||
+ improve the python script to generate better test
|
||||
expressions to check the list of ranges.
|
||||
|
||||
- Implement the interface at the SAX level
|
||||
|
||||
- Implement the missing parts in the Structure part
|
||||
+ all content model
|
||||
+ enumerations
|
||||
+ countless others c.f. the TODO scattered in the code
|
||||
|
||||
- Complete the Built-In datatype collections and Facets implementations
|
||||
|
||||
- Regression tests based on
|
||||
+ the primer:
|
||||
http://www.w3.org/TR/xmlschema-0/
|
||||
+ the Schemas Test Collection:
|
||||
http://www.w3.org/2001/05/xmlschema-test-collection/
|
||||
+ archives of the schemas-dev list
|
||||
|
||||
- Integrity constraints:
|
||||
+ what's that ? How need to read about it
|
||||
|
||||
- "formal" checking, i.e. go through the full Structure spec and
|
||||
bind code and associated parts of the Schemas spec
|
||||
|
||||
- go though the erratas
|
||||
http://www.w3.org/2001/05/xmlschema-errata
|
||||
@ -1,86 +0,0 @@
|
||||
libxml2 on VxWorks 6.4+
|
||||
|
||||
Here are my instructions for building on VxWorks.... I am very ashamed of
|
||||
how I did this because it is a complete hack, but it works great, so I
|
||||
can't complain too much.
|
||||
|
||||
General Information
|
||||
|
||||
1. The only way to build for VxWorks is to cross compile from a windows or
|
||||
linux system. We use a RedHat 5.1 workstation system as our build
|
||||
environment.
|
||||
|
||||
2. VxWorks 6.X has two main types of executable, DKMs (dynamic kernel
|
||||
modules), and RTPs (real-time processes). Kernel modules are the bread
|
||||
and butter of VxWorks, but they look nothing like processes/threads in
|
||||
normal UNIX/Windows systems. RTPs are more like processes that have
|
||||
memory protection, threads, etc. VxWorks 6.X also introduces some level
|
||||
of POSIX conformance to their environment. The POSIX conformance was the
|
||||
key for us to be able to port libxml2. We support accessing libxml2 from
|
||||
both DKMs and RTPs.
|
||||
|
||||
3. There are 2 compilers for VxWorks, the WindRiver compiler, and a port
|
||||
of the GNU toolchain, we have only tested and built with the GNU
|
||||
toolchain.
|
||||
|
||||
How To Build
|
||||
|
||||
1. Run the configure on your native linux system (this is the cheesy
|
||||
hack). Since the VxWorks GNU toolchain is very close in version to the
|
||||
one in red hat, it generates a good config.h file. We configured libxml2
|
||||
with the following to keep the size down, (but we have done basic testing
|
||||
with everything compiled in).
|
||||
|
||||
./configure --with-minimum --with-reader --with-writer --with-regexps
|
||||
--with-threads --with-thread-alloc
|
||||
|
||||
2. Rename the libxml2 folder to "src". This step is required for our
|
||||
replacement makefile to work.
|
||||
|
||||
3. Run the replacement makefile. I wrote a new makefile that sets all the
|
||||
proper vxworks defines and uses the correct compilers. The two defines on
|
||||
the make command line are to tell it which VxWorks Target (SH3.2 little
|
||||
endian), and the executable type. We have tested this code on PENTIUM2gnu
|
||||
and SH32gnule.
|
||||
|
||||
This makefile creates a shared library that runs on VxWorks: (libxml2.so)
|
||||
make -f Makefile.vxworks clean all VXCPU=SH32gnule VXTYPE=RTP
|
||||
|
||||
This makefile creates a kernel module that runs on VxWorks: (xml2.out)
|
||||
make -f Makefile.vxworks clean all VXCPU=SH32gnule VXTYPE=DKM
|
||||
|
||||
Important Notes
|
||||
|
||||
1. There are several ways that this process could be improved, but at the
|
||||
end of the day, we make products, not port libraries, so we did a meets
|
||||
minimum for our needs.
|
||||
|
||||
2. VxWorks is the devil, give me embedded linux every day.
|
||||
|
||||
3. No matter what I tried, I couldn't get the configure to pick up the
|
||||
VxWorks toolchain, and in my investigation, it has something to do with
|
||||
automake/autoconf, not any individual package. VxWorks doesn't play by
|
||||
the normal rules for building toolchains.
|
||||
|
||||
4. The PIC flag in VxWorks (especially for SH processors) is very
|
||||
important, and very troublesome. On linux, you can liberally use the PIC
|
||||
flag when compiling and the compiler/linker will ignore it as needed, on
|
||||
VxWorks if must always be on for shared libraries, and always be off for
|
||||
static libraries and executables.
|
||||
|
||||
5. If anyone wants to work on a better way to do the build of libxml2 for
|
||||
VxWorks, I'm happy to help as much as I can, but I'm not looking to
|
||||
support it myself.
|
||||
|
||||
Attached Files
|
||||
|
||||
1. To use my Makefile for vxworks, you should enter the vxworks
|
||||
environment (/opt/windriver/wrenv.linux -p vxworks-6.4 for me).
|
||||
2. Run: build.sh libxml2-2.6.32 SH32gnule RTP (where you have
|
||||
libxml2-2.6.32.tar.gz and the Makefile in the same directory as the script
|
||||
file).
|
||||
|
||||
Thanks,
|
||||
|
||||
Jim Wert Jr.
|
||||
JWert@ILSTechnology.com
|
||||
@ -1,85 +0,0 @@
|
||||
LIBXML2=$1
|
||||
TARGETCPU=$2
|
||||
TARGETTYPE=$3
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
TARGETCPU=SIMPENTIUMgnu
|
||||
fi
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
TARGETTYPE=RTP
|
||||
fi
|
||||
|
||||
echo "LIBXML2 Version: ${LIBXML2}"
|
||||
echo "LIBXML2 Target CPU: ${TARGETCPU}"
|
||||
echo "LIBXML2 Target Type: ${TARGETTYPE}"
|
||||
|
||||
rm -fR src
|
||||
tar xvzf ${LIBXML2}.tar.gz
|
||||
mv ${LIBXML2} src
|
||||
cd src
|
||||
|
||||
./configure --with-minimum --with-reader --with-writer --with-regexps --with-threads --with-thread-alloc
|
||||
|
||||
find . -name '*.in' -exec rm -fR {} +
|
||||
find . -name '*.am' -exec rm -fR {} +
|
||||
rm -fR *.m4
|
||||
rm -fR *.pc
|
||||
rm -fR *.pl
|
||||
rm -fR *.py
|
||||
rm -fR *.spec
|
||||
rm -fR .deps
|
||||
rm -fR AUTHORS
|
||||
rm -fR bakefile
|
||||
rm -fR ChangeLog
|
||||
rm -fR config.guess
|
||||
rm -fR config.log
|
||||
rm -fR config.status
|
||||
rm -fR config.stub
|
||||
rm -fR config.sub
|
||||
rm -fR configure
|
||||
rm -fR COPYING
|
||||
rm -fR Copyright
|
||||
rm -fR depcomp
|
||||
rm -fR doc
|
||||
rm -fR example
|
||||
rm -fR INSTALL
|
||||
rm -fR install-sh
|
||||
rm -fR libxml.3
|
||||
rm -fR ltmain.sh
|
||||
rm -fR Makefile
|
||||
rm -fR Makefile.tests
|
||||
rm -fR macos
|
||||
rm -fR mkinstalldirs
|
||||
rm -fR missing
|
||||
rm -fR nanoftp.c
|
||||
rm -fR nanohttp.c
|
||||
rm -fR NEWS
|
||||
rm -fR python
|
||||
rm -fR README
|
||||
rm -fR README.tests
|
||||
rm -fR regressions.xml
|
||||
rm -fR result
|
||||
rm -fR runsuite.c
|
||||
rm -fR runtest.c
|
||||
rm -fR test
|
||||
rm -fR test*.c
|
||||
rm -fR TODO*
|
||||
rm -fR trio*
|
||||
rm -fR vms
|
||||
rm -fR win32
|
||||
rm -fR xml2*
|
||||
rm -fR xmllint.c
|
||||
rm -fR xstc
|
||||
|
||||
cd ..
|
||||
|
||||
make clean all VXCPU=${TARGETCPU} VXTYPE=${TARGETTYPE}
|
||||
|
||||
if [ "${TARGETTYPE}" = "RTP" ]; then
|
||||
cp libxml2.so ../../lib/.
|
||||
else
|
||||
cp xml2.out ../../bin/.
|
||||
fi
|
||||
|
||||
cp -R src/include/libxml ../../include/.
|
||||
@ -1,28 +0,0 @@
|
||||
dnl Like AC_TRY_EVAL but also errors out if the compiler generates
|
||||
dnl _any_ output. Some compilers might issue warnings which we want
|
||||
dnl to catch.
|
||||
AC_DEFUN([AC_TRY_EVAL2],
|
||||
[{ (eval echo configure:__oline__: \"[$]$1\") 1>&AS_MESSAGE_LOG_FD; dnl
|
||||
(eval [$]$1) 2>&AS_MESSAGE_LOG_FD; _out=`eval [$]$1 2>&1` && test "x$_out" = x; }])
|
||||
|
||||
dnl Like AC_TRY_COMPILE but calls AC_TRY_EVAL2 instead of AC_TRY_EVAL
|
||||
AC_DEFUN([AC_TRY_COMPILE2],
|
||||
[cat > conftest.$ac_ext <<EOF
|
||||
[#]line __oline__ "configure"
|
||||
#include "confdefs.h"
|
||||
[$1]
|
||||
int main(void) {
|
||||
[$2]
|
||||
; return 0; }
|
||||
EOF
|
||||
if AC_TRY_EVAL2(ac_compile); then
|
||||
ifelse([$3], , :, [rm -rf conftest*
|
||||
$3])
|
||||
else
|
||||
echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
|
||||
cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
|
||||
ifelse([$4], , , [ rm -rf conftest*
|
||||
$4
|
||||
])dnl
|
||||
fi
|
||||
rm -f conftest*])
|
||||
@ -1,81 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
THEDIR=`pwd`
|
||||
cd $srcdir
|
||||
DIE=0
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile libxml."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or see http://www.gnu.org/software/autoconf"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(libtoolize --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have libtool installed to compile libxml."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or see http://www.gnu.org/software/libtool"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
DIE=1
|
||||
echo "You must have automake installed to compile libxml."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or see http://www.gnu.org/software/automake"
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test -f entities.c || {
|
||||
echo "You must run this script in the top-level libxml directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
EXTRA_ARGS=
|
||||
if test "x$1" = "x--system"; then
|
||||
shift
|
||||
prefix=/usr
|
||||
libdir=$prefix/lib
|
||||
sysconfdir=/etc
|
||||
localstatedir=/var
|
||||
if [ -d /usr/lib64 ]; then
|
||||
libdir=$prefix/lib64
|
||||
fi
|
||||
EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
|
||||
echo "Running ./configure with $EXTRA_ARGS $@"
|
||||
else
|
||||
if test -z "$NOCONFIGURE" && test -z "$*"; then
|
||||
echo "I am going to run ./configure with no arguments - if you wish "
|
||||
echo "to pass any to it, please specify them on the $0 command line."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d $srcdir/m4 ]; then
|
||||
mkdir $srcdir/m4
|
||||
fi
|
||||
|
||||
# Replaced by autoreconf below
|
||||
autoreconf -if -Wall
|
||||
|
||||
cd $THEDIR
|
||||
|
||||
if test x$OBJ_DIR != x; then
|
||||
mkdir -p "$OBJ_DIR"
|
||||
cd "$OBJ_DIR"
|
||||
fi
|
||||
|
||||
if test -z "$NOCONFIGURE"; then
|
||||
$srcdir/configure $EXTRA_ARGS "$@"
|
||||
echo
|
||||
echo "Now type 'make' to compile libxml2."
|
||||
fi
|
||||
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!-- $Id$ -->
|
||||
|
||||
<bakefile-gen>
|
||||
|
||||
<disable-formats>gnu,dmars,cbx_unix,cbuilderx</disable-formats>
|
||||
<input>libxml2.bkl</input>
|
||||
|
||||
<!-- List of output formats to generate: -->
|
||||
<add-formats>
|
||||
borland,dmars,mingw,msvc,msvc6prj,watcom,cbuilderx,cbx_unix,gnu
|
||||
</add-formats>
|
||||
|
||||
|
||||
</bakefile-gen>
|
||||
@ -1,92 +0,0 @@
|
||||
|
||||
LIBXML2 build system for Win32 README
|
||||
-------------------------------------
|
||||
|
||||
In this folder are stored all the files required to compile LIBXML2 with win32 compilers.
|
||||
Bakefile (http://bakefile.sourceforge.net) is used as makefile generator.
|
||||
|
||||
Supported makefiles:
|
||||
- makefile.vc for Microsoft NMAKE
|
||||
- makefile.bcc for Borland MAKE
|
||||
- makefile.wat for OpenWatcom MAKE
|
||||
- makefile.gcc for MinGW MINGW32-MAKE
|
||||
- all DSP & DSW for Microsoft VisualC++ 6.0 (can be used also with VS.NET AFAIK)
|
||||
|
||||
This readme is organized as:
|
||||
1.0 HOWTO compile LIBXML2 using makefiles <-- for users who want to build the library using *command-line*
|
||||
1.1 HOWTO compile LIBXML2 using an IDE <-- for users who want to build the library using an *IDE*
|
||||
1.2 HOWTO regenerate makefiles for LIBXML2 <-- for libxml2 mantainers/developers/advanced users
|
||||
|
||||
If you just want to compile the library (and the test programs) you should definitely avoid the
|
||||
section 1.1 and focus on the 1.0.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1.0 HOWTO compile LIBXML2 using makefiles
|
||||
-----------------------------------------
|
||||
|
||||
Choose your preferred compiler among those actually supported (see above) and then run
|
||||
|
||||
mycompilermake -fmakefile.makefileext [options]
|
||||
|
||||
for a full list of the available options you should open with a notepad (or something like that)
|
||||
the makefile you want to use; at the beginning you should see a section which starts as:
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# These are configurable options:
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
here you can find all the options actually used by that makefile.
|
||||
They can be customized when running the makefile writing something like:
|
||||
|
||||
nmake -fmakefile.vc BUILD=release
|
||||
mingw32-make -fmakefile.gcc BUILD=debug ICONV_DIR=c:\myiconv
|
||||
|
||||
or they can be permanently changed modifying the makefile.
|
||||
That's all: for any problem/compile-error/suggestion, write to
|
||||
frm@users.sourceforge.net with the word "libxml2" in the subject.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1.1 HOWTO compile LIBXML2 using an IDE
|
||||
--------------------------------------
|
||||
|
||||
Actually only the Microsoft VisualC++ 6.0 project files are generated.
|
||||
In future other Integrated Development Environments (IDEs) will be supported as well.
|
||||
|
||||
With MSVC++ 6.0, you should open the DSW file and then set as the active project the
|
||||
"libxml2" project, if you want to build the library or one of the test projects if you
|
||||
want to run them.
|
||||
Using the command "Build->Set Active Configuration" you can choose one of the predefined
|
||||
configuration.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1.2 HOWTO regenerate makefiles for LIBXML2
|
||||
------------------------------------------
|
||||
|
||||
Be sure to have installed Bakefile (http://bakefile.sourceforge.net).
|
||||
Just run the "bakefile_gen" command inside the folder containing the "libxml2.bkl" file.
|
||||
NOTE: if you want to remove all the makefiles, you can use the "bakefile_gen -c" command.
|
||||
|
||||
The template files used to generate all makefiles are only two:
|
||||
- libxml2.bkl (the main one)
|
||||
- Bakefiles.bkgen
|
||||
All the other files can be dinamically regenerated.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
If you have problems with the compilation of LIBXML2 under windows (using one of the supported compiler)
|
||||
please write to:
|
||||
|
||||
Francesco Montorsi <frm@users.sourceforge.net>
|
||||
|
||||
@ -1,749 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<!-- Author: Francesco Montorsi <frm@users.sourceforge.net> -->
|
||||
<!-- Date: 30/8/2004 -->
|
||||
<!-- Last revision: 26/1/2005 -->
|
||||
|
||||
|
||||
<!-- LIBXML2 BAKEFILE -->
|
||||
<!-- -->
|
||||
<!-- The bakefile used to build the library and the test -->
|
||||
<!-- programs. The makefiles output is put: -->
|
||||
<!-- -->
|
||||
<!-- - in the ..\LIB folder -->
|
||||
<!-- - in the ..\BIN folder -->
|
||||
<!-- -->
|
||||
|
||||
<makefile>
|
||||
|
||||
<using module="datafiles"/>
|
||||
<requires version="0.1.5"/>
|
||||
|
||||
|
||||
<!-- This is a bakefile, that is, a generic template used to -->
|
||||
<!-- generate makefiles ALL supported compilers. -->
|
||||
<!-- To use this project file you need Bakefile installed. -->
|
||||
<!-- With the command "bakefile_gen" you can regen all the -->
|
||||
<!-- makefiles and project files. -->
|
||||
<!-- See http://bakefile.sourceforge.net for more info. -->
|
||||
|
||||
|
||||
<!--
|
||||
This file is divided in:
|
||||
- generic options
|
||||
- generic variables
|
||||
- libxml2 options
|
||||
- libxml2 variables
|
||||
- about config.h creation
|
||||
- templates
|
||||
- libxml2 library target
|
||||
- libxml2 test program targets
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- GENERIC OPTIONS -->
|
||||
<!-- -->
|
||||
|
||||
|
||||
<!-- This is a standard option that determines -->
|
||||
<!-- whether the user wants to build this library as -->
|
||||
<!-- a dll or as a static library. -->
|
||||
<option name="SHARED">
|
||||
<values>0,1</values>
|
||||
<values-description>,DLL</values-description>
|
||||
<default-value>0</default-value>
|
||||
<description>If set to zero a STATIC libxml library will be built</description>
|
||||
</option>
|
||||
|
||||
<!-- Configuration for building the bakefile with -->
|
||||
<!-- unicode strings or not (unicode or ansi). -->
|
||||
<option name="UNICODE">
|
||||
<values>0,1</values>
|
||||
<values-description>,Unicode</values-description>
|
||||
<default-value>0</default-value>
|
||||
<description>Compile Unicode build?</description>
|
||||
</option>
|
||||
|
||||
|
||||
<!-- There are several options that deal with build -->
|
||||
<!-- types. First, there's this one, BUILD. -->
|
||||
<!-- -->
|
||||
<!-- BUILD determines whether or not we want to build -->
|
||||
<!-- in release or debug mode. Note that in practice -->
|
||||
<!-- this means modifying the optimize tag, which by -->
|
||||
<!-- default is set to off. In this case debug means -->
|
||||
<!-- off (no optimizations), and release means speed -->
|
||||
<!-- (fast with inlining). There is also a size option -->
|
||||
<!-- that is not addressed in this example bakefile. -->
|
||||
<option name="BUILD">
|
||||
<values>debug,release</values>
|
||||
<values-description>Debug,Release</values-description>
|
||||
<default-value>release</default-value>
|
||||
<description>
|
||||
Type of compiled binaries
|
||||
</description>
|
||||
</option>
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- GENERIC VARIABLES -->
|
||||
<!-- -->
|
||||
|
||||
<!-- Set the ISDLL variable, so that we can use it -->
|
||||
<!-- inside an if statement later on (options not -->
|
||||
<!-- allowed in if statements). -->
|
||||
<set var="ISDLL" cond="SHARED=='1'">1</set>
|
||||
<set var="ISDLL" cond="SHARED=='0'">0</set>
|
||||
|
||||
<!-- The unicode define we want. By default bakefile -->
|
||||
<!-- makes variables an empty string, so if unicode -->
|
||||
<!-- is not defined $(UNICODE_DEFINE) would expand -->
|
||||
<!-- to nothing (literally). -->
|
||||
<set var="UNICODE_DEFINE">
|
||||
<if cond="FORMAT!='autoconf' and UNICODE=='1'">_UNICODE</if>
|
||||
</set>
|
||||
|
||||
<!-- The debug define we need with win32 compilers -->
|
||||
<!-- (on Linux, the wx-config program is used). -->
|
||||
<set var="DEBUG_DEFINE">
|
||||
<if cond="FORMAT!='autoconf' and BUILD=='debug'">
|
||||
__WXDEBUG__
|
||||
</if>
|
||||
</set>
|
||||
|
||||
<!-- Value we will use later on for the debug-info -->
|
||||
<!-- tag inside our templates. -->
|
||||
<set var="DEBUGINFO">
|
||||
<if cond="BUILD=='debug'">on</if>
|
||||
<if cond="BUILD=='release'">off</if>
|
||||
</set>
|
||||
|
||||
<!-- Value we will use later on for the debug-runtime -->
|
||||
<!-- tag inside our templates. -->
|
||||
<set var="DEBUGRUNTIME">
|
||||
<if cond="BUILD=='debug'">on</if>
|
||||
<if cond="BUILD=='release'">off</if>
|
||||
</set>
|
||||
|
||||
<!-- Value for optimize tag. -->
|
||||
<set var="OPTIMIZEFLAG">
|
||||
<if cond="BUILD=='debug'">off</if>
|
||||
<if cond="BUILD=='release'">speed</if>
|
||||
</set>
|
||||
|
||||
<!-- Level of warnings. Here we max it out in debug -->
|
||||
<!-- mode, and turn them off in release mode. -->
|
||||
<set var="WARNINGS">
|
||||
<if cond="BUILD=='debug'">max</if>
|
||||
<if cond="BUILD=='release'">no</if>
|
||||
</set>
|
||||
|
||||
<!-- Set MYCPPFLAGS as empty; maybe it will be filled later... -->
|
||||
<set var="MYCPPFLAGS"></set>
|
||||
<if cond="FORMAT=='mingw' or FORMAT=='autoconf'">
|
||||
|
||||
<!-- With GCC, settings warnings to MAX would force -->
|
||||
<!-- Bakefile to call GCC with "-W -Wall" which generates -->
|
||||
<!-- a *lot* of warnings about wxWidgets headers... -->
|
||||
<!-- this is why "-W -Wall" is here replaced by "-Wall". -->
|
||||
<set var="WARNINGS">default</set>
|
||||
<set var="MYCPPFLAGS">-Wall</set>
|
||||
</if>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- LIBXML2 OPTIONS -->
|
||||
<!-- -->
|
||||
<!-- Note #1: not all of them are used by win32 makefiles -->
|
||||
<!-- -->
|
||||
<!-- Note #2: since all combinations of non-path options are -->
|
||||
<!-- translated into different 'configurations' by -->
|
||||
<!-- Bakefile when using the MSVC6PRJ output, we must -->
|
||||
<!-- avoid to create a 10 MB libxml2.dsp file forcing -->
|
||||
<!-- some options to their default values... this -->
|
||||
<!-- behaviour can be overridden by the -->
|
||||
<!-- FULL_OPTIONS_SUPPORT -->
|
||||
<!-- variable defined below... -->
|
||||
|
||||
<set var="FULL_OPTIONS_SUPPORT">
|
||||
<if cond="FORMAT=='msvc6prj'">0</if>
|
||||
<if cond="FORMAT!='msvc6prj'">1</if>
|
||||
</set>
|
||||
|
||||
<option name="ICONV_DIR" category="path">
|
||||
<default-value>c:\iconv</default-value>
|
||||
<description>The iconv library main folder</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_TRIO">
|
||||
<values>0,1</values>
|
||||
<default-value>0</default-value>
|
||||
<description>Enable TRIO string manipulator</description>
|
||||
</option>
|
||||
|
||||
<!-- see the note #2 -->
|
||||
<if cond="FULL_OPTIONS_SUPPORT=='0'">
|
||||
<set var="WITH_THREADS">native</set>
|
||||
</if>
|
||||
<if cond="FULL_OPTIONS_SUPPORT=='1'">
|
||||
<option name="WITH_THREADS">
|
||||
<values>no,ctls,native,posix</values>
|
||||
<default-value>native</default-value>
|
||||
<description>Enable thread safety</description>
|
||||
</option>
|
||||
</if>
|
||||
|
||||
<option name="WITH_FTP">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable FTP client</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_HTTP">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable HTTP client</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_C14N">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable C14N support</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_CATALOG">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable catalog support</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_DOCB">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable DocBook support</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_XPATH">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable XPath support</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_XPTR">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable XPointer support</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_XINCLUDE">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable XInclude support</description>
|
||||
</option>
|
||||
|
||||
<!-- see the note #2 -->
|
||||
<if cond="FULL_OPTIONS_SUPPORT=='0'">
|
||||
<set var="WITH_ICONV">1</set>
|
||||
</if>
|
||||
<if cond="FULL_OPTIONS_SUPPORT=='1'">
|
||||
<option name="WITH_ICONV">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable iconv support</description>
|
||||
</option>
|
||||
</if>
|
||||
|
||||
<option name="WITH_ISO8859X">
|
||||
<values>0,1</values>
|
||||
<default-value>0</default-value>
|
||||
<description>Enable iso8859x support</description>
|
||||
</option>
|
||||
|
||||
<!-- see the note #2 -->
|
||||
<if cond="FULL_OPTIONS_SUPPORT=='0'">
|
||||
<set var="WITH_ZLIB">0</set>
|
||||
</if>
|
||||
<if cond="FULL_OPTIONS_SUPPORT=='1'">
|
||||
<option name="WITH_ZLIB">
|
||||
<values>0,1</values>
|
||||
<default-value>0</default-value>
|
||||
<description>Enable ZLIB support</description>
|
||||
</option>
|
||||
</if>
|
||||
|
||||
<option name="WITH_REGEXPS">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable regular expressions</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_TREE">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable tree api</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_READER">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable xmlReader api</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_WRITER">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable xmlWriter api</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_WALKER">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable xmlDocWalker api</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_PATTERN">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable xmlPattern api</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_PUSH">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable push api</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_VALID">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable DTD validation support</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_SAX1">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable SAX1 api</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_SCHEMAS">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable XML Schema support</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_LEGACY">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable deprecated APIs</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_OUTPUT">
|
||||
<values>0,1</values>
|
||||
<default-value>1</default-value>
|
||||
<description>Enable serialization support</description>
|
||||
</option>
|
||||
|
||||
<option name="WITH_PYTHON">
|
||||
<values>0,1</values>
|
||||
<default-value>0</default-value>
|
||||
<description>Build Python bindings</description>
|
||||
</option>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- LIBXML2 VARIABLES -->
|
||||
<!-- -->
|
||||
|
||||
<!-- Put all the objects files generated by -->
|
||||
<!-- the compilation in a subfolder of BUILD -->
|
||||
<set var="BUILDDIR">$(FORMAT)</set>
|
||||
|
||||
<!-- This variable is set to 1 when the current output writer supports -->
|
||||
<!-- the __DEFINE_ARG variable. Otherwise it's set to zero. -->
|
||||
<set var="HAS_DEFINE_ARG">
|
||||
<if cond="FORMAT!='msvc6prj'">1</if>
|
||||
<if cond="FORMAT=='msvc6prj'">0</if>
|
||||
</set>
|
||||
|
||||
<!-- The root directory of libxml2 -->
|
||||
<set var="XMLBASEDIR">..</set>
|
||||
|
||||
<!-- The directory where libxml2' tests will be put -->
|
||||
<set var="XMLTESTDIR">$(XMLBASEDIR)$(DIRSEP)bin</set>
|
||||
|
||||
<set var="LIBXML_MAJOR_VERSION">2</set>
|
||||
<set var="LIBXML_MINOR_VERSION">6</set>
|
||||
<set var="LIBXML_MICRO_VERSION">16</set>
|
||||
|
||||
<!-- some defines related to threads -->
|
||||
<set var="THREADS_DEF">
|
||||
<if cond="HAS_DEFINE_ARG=='1' and WITH_THREADS=='native'">
|
||||
$(__DEFINE_ARG)_REENTRANT $(__DEFINE_ARG)HAVE_WIN32_THREADS
|
||||
</if>
|
||||
<if cond="HAS_DEFINE_ARG=='1' and WITH_THREADS=='ctls'">
|
||||
$(__DEFINE_ARG)_REENTRANT $(__DEFINE_ARG)HAVE_WIN32_THREADS $(__DEFINE_ARG)HAVE_COMPILER_TLS
|
||||
</if>
|
||||
<if cond="HAS_DEFINE_ARG=='1' and WITH_THREADS=='posix'">
|
||||
$(__DEFINE_ARG)_REENTRANT $(__DEFINE_ARG)HAVE_PTHREAD_H
|
||||
</if>
|
||||
</set>
|
||||
<if cond="FORMAT=='borland'">
|
||||
<set var="THREADS_DEF">
|
||||
<if cond="WITH_THREADS=='native'">$(THREADS_DEF) $(__DEFINE_ARG)__MT__</if>
|
||||
<if cond="WITH_THREADS=='ctls'">$(THREADS_DEF) $(__DEFINE_ARG)__MT__</if>
|
||||
<if cond="WITH_THREADS=='posix'">$(THREADS_DEF) $(__DEFINE_ARG)__MT__</if>
|
||||
</set>
|
||||
</if>
|
||||
|
||||
|
||||
<!-- some other conditional defines -->
|
||||
<set var="ZLIB_DEF"><if cond="WITH_ZLIB=='1'">HAVE_ZLIB_H</if></set>
|
||||
<set var="DEBUG_DEF"><if cond="BUILD=='debug'">_DEBUG</if></set>
|
||||
<set var="DEBUG_DEF"><if cond="BUILD=='release'">NDEBUG</if></set>
|
||||
|
||||
<!-- this is very very important when compiling with MINGW: without this line,
|
||||
the test programs (and all the programs built with libxml2 which use xmlFree)
|
||||
won't build because of "undefined references to __xmlFree" -->
|
||||
<set var="STATIC_DEF"><if cond="SHARED=='0'">LIBXML_STATIC</if></set>
|
||||
|
||||
<!-- some conditional libraries dependencies -->
|
||||
<set var="ICONV_LIB"><if cond="WITH_ICONV=='1'">iconv</if></set>
|
||||
<set var="WSOCK32_LIB"><if cond="WITH_THREADS=='native'">wsock32</if></set>
|
||||
<set var="ZLIB_LIB"><if cond="WITH_ZLIB=='1'">zdll</if></set>
|
||||
<set var="POSIX_LIB"><if cond="WITH_THREADS=='posix'">pthreadVC</if></set>
|
||||
|
||||
<set var="XMLINCLUDEDIR">$(XMLBASEDIR)$(DIRSEP)include$(DIRSEP)libxml$(DIRSEP)</set>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- ABOUT CONFIG.H HEADER CREATION -->
|
||||
<!-- -->
|
||||
|
||||
<set var="CONFIG_SRCNAME">win32config.h</set>
|
||||
<set var="CONFIG_DSTNAME">config.h</set>
|
||||
|
||||
<if cond="FORMAT!='msvc6prj' and FORMAT!='autoconf' and FORMAT!='gnu'">
|
||||
<copy-file-to-file id="setup">
|
||||
<!-- On win32 we need to manually copy a default config.h file -->
|
||||
<!-- from the include/mc/msw folder to include/mc -->
|
||||
<src>../include/$(CONFIG_SRCNAME)</src>
|
||||
<dst>../$(CONFIG_DSTNAME)</dst>
|
||||
<dependency-of>all</dependency-of>
|
||||
|
||||
<!-- With autoconf, we will use the configure script to translate -->
|
||||
<!-- include/mc/config.h.in to include/mc/config.h and thus we do -->
|
||||
<!-- not need to do anything here... -->
|
||||
</copy-file-to-file>
|
||||
</if>
|
||||
|
||||
<if cond="FORMAT!='msvc6prj'">
|
||||
|
||||
<mkdir id="setuplibdir"><dir>$(XMLBASEDIR)$(DIRSEP)lib</dir></mkdir>
|
||||
<mkdir id="setupbindir"><dir>$(XMLBASEDIR)$(DIRSEP)bin</dir></mkdir>
|
||||
|
||||
<!-- Creates all output folders -->
|
||||
<phony id="setupdirs">
|
||||
<dependency-of>all</dependency-of>
|
||||
<depends>setuplibdir</depends>
|
||||
<depends>setupbindir</depends>
|
||||
</phony>
|
||||
</if>
|
||||
|
||||
<!-- This defines a tag which includes headers on MSVC -->
|
||||
<!-- Note that $(value) is stuck in there by bakefile, -->
|
||||
<!-- and is the value between the beginning and end tag. -->
|
||||
<define-tag name="headers" rules="dll,lib,exe">
|
||||
<if cond="FORMAT=='msvc6prj'">
|
||||
<msvc-project-files>
|
||||
$(value)
|
||||
</msvc-project-files>
|
||||
</if>
|
||||
</define-tag>
|
||||
|
||||
<!-- Creates the following custom build rule for MSVC6PRJ file:
|
||||
copies ..\include\win32config.h into ..\config.h
|
||||
NOTE: this tag must be used before the <sources> tag if you want that the configuration
|
||||
file will be created before any other source file is compiled... -->
|
||||
<define-tag name="msvc-copy-setup-h" rules="dll,lib,action">
|
||||
<if cond="FORMAT=='msvc6prj'">
|
||||
<headers>$(XMLBASEDIR)\include\$(CONFIG_SRCNAME)</headers>
|
||||
<set var="__subdir">$(value)</set>
|
||||
<set var="_custom_build_files" append="1">$(XMLBASEDIR)\include\$(CONFIG_SRCNAME)</set>
|
||||
<set var="_custom_build____include_win32config_h">
|
||||
Creating the configuration file ..\$(CONFIG_DSTNAME) from ..\include\$(CONFIG_SRCNAME)
|
||||
InputPath=..\include\$(CONFIG_SRCNAME)
|
||||
|
||||
"..\$(CONFIG_DSTNAME)" : $(DOLLAR)(SOURCE) "$(DOLLAR)(INTDIR)" "$(DOLLAR)(OUTDIR)"
|
||||
$(TAB)copy "$(DOLLAR)(InputPath)" ..\$(CONFIG_DSTNAME)
|
||||
</set>
|
||||
</if>
|
||||
</define-tag>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- TEMPLATES -->
|
||||
<!-- -->
|
||||
|
||||
<!-- The basic template: used by all the targets -->
|
||||
<template id="base">
|
||||
<if cond="FORMAT=='mingw'">
|
||||
<define>HAVE_W32API_H</define>
|
||||
<ldflags>-mthreads</ldflags>
|
||||
</if>
|
||||
|
||||
<cxxflags>$(MYCPPFLAGS)</cxxflags>
|
||||
<warnings>$(WARNINGS)</warnings>
|
||||
<define>$(UNICODE_DEFINE)</define>
|
||||
<optimize>$(OPTIMIZEFLAG)</optimize>
|
||||
<debug-info>$(DEBUGINFO)</debug-info>
|
||||
<debug-runtime-libs>$(DEBUGRUNTIME)</debug-runtime-libs>
|
||||
</template>
|
||||
|
||||
<!-- The template used both by the library and by the test programs -->
|
||||
<template id="xml2" template="base">
|
||||
|
||||
<!-- -I & -L equivalents -->
|
||||
<include>$(XMLBASEDIR)$(DIRSEP)include</include>
|
||||
<include>$(ICONV_DIR)$(DIRSEP)include</include>
|
||||
<lib-path>$(ICONV_DIR)$(DIRSEP)lib</lib-path>
|
||||
|
||||
<!-- some conditional define flags -->
|
||||
<cflags>$(THREADS_DEF)</cflags>
|
||||
<define>$(ZLIB_DEF)</define>
|
||||
<define>$(DEBUG_DEF)</define>
|
||||
<define>$(STATIC_DEF)</define>
|
||||
|
||||
<if cond="HAS_DEFINE_ARG=='0'">
|
||||
|
||||
<!-- we are probably using an IDE output: defaults to WITH_THREADS=='native' -->
|
||||
<define>_REENTRANT</define>
|
||||
<define>HAVE_WIN32_THREADS</define>
|
||||
</if>
|
||||
|
||||
|
||||
<!-- these must always be defined on win32 -->
|
||||
<define>WIN32</define>
|
||||
<define>_WINDOWS</define>
|
||||
<define>_MBCS</define>
|
||||
|
||||
<if cond="FORMAT=='borland'">
|
||||
<define>_NO_VCL</define>
|
||||
<define>EILSEQ=2</define>
|
||||
</if>
|
||||
</template>
|
||||
|
||||
<!-- The template used by libxml2 test programs -->
|
||||
<template id="xml2test" template="xml2">
|
||||
<dirname>$(XMLTESTDIR)</dirname>
|
||||
<app-type>console</app-type>
|
||||
|
||||
<library>libxml2</library>
|
||||
|
||||
<sys-lib>$(ICONV_LIB)</sys-lib>
|
||||
<sys-lib>$(WSOCK32_LIB)</sys-lib>
|
||||
<sys-lib>$(ZLIB_LIB)</sys-lib>
|
||||
<sys-lib>$(POSIX_LIB)</sys-lib>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- LIBXML2 LIBRARY TARGET -->
|
||||
<!-- -->
|
||||
|
||||
<lib id="libxml2" template="xml2">
|
||||
|
||||
<!-- this is useful only when using MSVC6PRJ -->
|
||||
<if cond="FORMAT=='msvc6prj'">
|
||||
<msvc-copy-setup-h/>
|
||||
<msvc-file-group>Config headers:*config.h</msvc-file-group>
|
||||
</if>
|
||||
<if cond="FORMAT!='msvc6prj'">
|
||||
<depends>setup</depends>
|
||||
<depends>setuplibdir</depends>
|
||||
</if>
|
||||
|
||||
<!-- output folder -->
|
||||
<dirname>$(XMLBASEDIR)$(DIRSEP)lib</dirname>
|
||||
|
||||
<!-- The output name must be "libxml2.lib" with all compilers.
|
||||
Since mingw format autoadds the "lib" prefix to the library
|
||||
name, we must intercept that case to avoid to get "liblibxml2.a" -->
|
||||
<if cond="FORMAT!='mingw'">
|
||||
<libname>libxml2</libname>
|
||||
</if>
|
||||
<if cond="FORMAT=='mingw'">
|
||||
<libname>xml2</libname>
|
||||
</if>
|
||||
|
||||
<!-- the list of source files to compile -->
|
||||
<sources>
|
||||
$(XMLBASEDIR)$(DIRSEP)c14n.c
|
||||
$(XMLBASEDIR)$(DIRSEP)catalog.c
|
||||
$(XMLBASEDIR)$(DIRSEP)chvalid.c
|
||||
$(XMLBASEDIR)$(DIRSEP)debugXML.c
|
||||
$(XMLBASEDIR)$(DIRSEP)dict.c
|
||||
$(XMLBASEDIR)$(DIRSEP)DOCBparser.c
|
||||
$(XMLBASEDIR)$(DIRSEP)encoding.c
|
||||
$(XMLBASEDIR)$(DIRSEP)entities.c
|
||||
$(XMLBASEDIR)$(DIRSEP)error.c
|
||||
$(XMLBASEDIR)$(DIRSEP)globals.c
|
||||
$(XMLBASEDIR)$(DIRSEP)hash.c
|
||||
$(XMLBASEDIR)$(DIRSEP)HTMLparser.c
|
||||
$(XMLBASEDIR)$(DIRSEP)HTMLtree.c
|
||||
$(XMLBASEDIR)$(DIRSEP)legacy.c
|
||||
$(XMLBASEDIR)$(DIRSEP)list.c
|
||||
$(XMLBASEDIR)$(DIRSEP)nanoftp.c
|
||||
$(XMLBASEDIR)$(DIRSEP)nanohttp.c
|
||||
$(XMLBASEDIR)$(DIRSEP)parser.c
|
||||
$(XMLBASEDIR)$(DIRSEP)parserInternals.c
|
||||
$(XMLBASEDIR)$(DIRSEP)pattern.c
|
||||
$(XMLBASEDIR)$(DIRSEP)relaxng.c
|
||||
$(XMLBASEDIR)$(DIRSEP)SAX2.c
|
||||
$(XMLBASEDIR)$(DIRSEP)SAX.c
|
||||
$(XMLBASEDIR)$(DIRSEP)threads.c
|
||||
$(XMLBASEDIR)$(DIRSEP)tree.c
|
||||
$(XMLBASEDIR)$(DIRSEP)uri.c
|
||||
$(XMLBASEDIR)$(DIRSEP)valid.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xinclude.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xlink.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlIO.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlmemory.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlreader.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlregexp.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlsave.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlschemas.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlschemastypes.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlunicode.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlwriter.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xpath.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xpointer.c
|
||||
$(XMLBASEDIR)$(DIRSEP)xmlstring.c
|
||||
</sources>
|
||||
|
||||
<!-- the list of header files (for IDE projects) -->
|
||||
<headers>
|
||||
$(XMLINCLUDEDIR)c14n.h
|
||||
$(XMLINCLUDEDIR)catalog.h
|
||||
$(XMLINCLUDEDIR)chvalid.h
|
||||
$(XMLINCLUDEDIR)debugXML.h
|
||||
$(XMLINCLUDEDIR)dict.h
|
||||
$(XMLINCLUDEDIR)DOCBparser.h
|
||||
$(XMLINCLUDEDIR)encoding.h
|
||||
$(XMLINCLUDEDIR)entities.h
|
||||
$(XMLINCLUDEDIR)globals.h
|
||||
$(XMLINCLUDEDIR)hash.h
|
||||
$(XMLINCLUDEDIR)HTMLparser.h
|
||||
$(XMLINCLUDEDIR)HTMLtree.h
|
||||
$(XMLINCLUDEDIR)list.h
|
||||
$(XMLINCLUDEDIR)nanoftp.h
|
||||
$(XMLINCLUDEDIR)nanohttp.h
|
||||
$(XMLINCLUDEDIR)parser.h
|
||||
$(XMLINCLUDEDIR)parserInternals.h
|
||||
$(XMLINCLUDEDIR)pattern.h
|
||||
$(XMLINCLUDEDIR)relaxng.h
|
||||
$(XMLINCLUDEDIR)SAX.h
|
||||
$(XMLINCLUDEDIR)SAX2.h
|
||||
$(XMLINCLUDEDIR)schemasInternals.h
|
||||
$(XMLINCLUDEDIR)threads.h
|
||||
$(XMLINCLUDEDIR)tree.h
|
||||
$(XMLINCLUDEDIR)uri.h
|
||||
$(XMLINCLUDEDIR)valid.h
|
||||
$(XMLINCLUDEDIR)xinclude.h
|
||||
$(XMLINCLUDEDIR)xlink.h
|
||||
$(XMLINCLUDEDIR)xmlautomata.h
|
||||
$(XMLINCLUDEDIR)xmlerror.h
|
||||
$(XMLINCLUDEDIR)xmlexports.h
|
||||
$(XMLINCLUDEDIR)xmlIO.h
|
||||
$(XMLINCLUDEDIR)xmlmemory.h
|
||||
$(XMLINCLUDEDIR)xmlmodule.h
|
||||
$(XMLINCLUDEDIR)xmlreader.h
|
||||
$(XMLINCLUDEDIR)xmlregexp.h
|
||||
$(XMLINCLUDEDIR)xmlsave.h
|
||||
$(XMLINCLUDEDIR)xmlschemas.h
|
||||
$(XMLINCLUDEDIR)xmlschemastypes.h
|
||||
$(XMLINCLUDEDIR)xmlstring.h
|
||||
$(XMLINCLUDEDIR)xmlunicode.h
|
||||
$(XMLINCLUDEDIR)xmlversion.h
|
||||
$(XMLINCLUDEDIR)xmlwriter.h
|
||||
$(XMLINCLUDEDIR)xpath.h
|
||||
$(XMLINCLUDEDIR)xpathInternals.h
|
||||
$(XMLINCLUDEDIR)xpointer.h
|
||||
</headers>
|
||||
|
||||
<!-- these ones are not inside the include/libxml folder -->
|
||||
<headers>
|
||||
$(XMLBASEDIR)$(DIRSEP)libxml.h
|
||||
$(XMLBASEDIR)$(DIRSEP)triodef.h
|
||||
$(XMLBASEDIR)$(DIRSEP)trionan.h
|
||||
$(XMLBASEDIR)$(DIRSEP)include$(DIRSEP)wsockcompat.h
|
||||
</headers>
|
||||
</lib>
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- LIBXML2 test programs -->
|
||||
<!-- -->
|
||||
|
||||
<set var="BUILD_ALL_TESTS">
|
||||
|
||||
<!-- when using full options support with MSVC6PRJ we should
|
||||
avoid to create all the DSP files required for the test
|
||||
programs: they would take a _lot_ of space !! -->
|
||||
<if cond="FORMAT=='msvc6prj' and FULL_OPTIONS_SUPPORT=='1'">0</if>
|
||||
|
||||
<!-- when creating a makefile or using MSVC6PRJ with limited
|
||||
options support, then we can build all the tests safely -->
|
||||
<if cond="FORMAT!='msvc6prj' or FULL_OPTIONS_SUPPORT=='0'">1</if>
|
||||
|
||||
</set>
|
||||
|
||||
<if cond="BUILD_ALL_TESTS=='1'">
|
||||
|
||||
<exe id="testAutomata" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testAutomata.c</sources></exe>
|
||||
<exe id="testC14N" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testC14N.c</sources></exe>
|
||||
<exe id="testHTML" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testHTML.c</sources></exe>
|
||||
<exe id="testReader" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testReader.c</sources></exe>
|
||||
<exe id="testRegexp" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testRegexp.c</sources></exe>
|
||||
<exe id="testRelax" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testRelax.c</sources></exe>
|
||||
<exe id="testSax" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testSax.c</sources></exe>
|
||||
<exe id="testSchemas" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testSchemas.c</sources></exe>
|
||||
<exe id="testURI" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testURI.c</sources></exe>
|
||||
<exe id="testXPath" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testXPath.c</sources></exe>
|
||||
<exe id="xmllint" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)xmllint.c</sources></exe>
|
||||
|
||||
<if cond="FORMAT=='autoconf'">
|
||||
<exe id="testdso" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testdso.c</sources></exe>
|
||||
</if>
|
||||
|
||||
<!-- FIXME:
|
||||
<exe id="testModule" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testModule.c</sources></exe>
|
||||
|
||||
<if cond="WITH_THREADS=='posix'">
|
||||
<exe id="testThreads" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testThreads.c</sources></exe>
|
||||
</if>
|
||||
<if cond="WITH_THREADS=='ctls' or WITH_THREADS=='native'">
|
||||
<exe id="testThreadsWin32" template="xml2test"><sources>$(XMLBASEDIR)$(DIRSEP)testThreadsWin32.c</sources></exe>
|
||||
</if>
|
||||
-->
|
||||
</if>
|
||||
|
||||
</makefile>
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Summary: Internal Interfaces for memory buffers in libxml2
|
||||
* Description: this module describes most of the new xmlBuf buffer
|
||||
* entry points, those are private routines, with a
|
||||
* few exceptions exported in tree.h. This was added
|
||||
* in 2.9.0.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_BUF_H__
|
||||
#define __XML_BUF_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
xmlBufPtr xmlBufCreate(void);
|
||||
xmlBufPtr xmlBufCreateSize(size_t size);
|
||||
xmlBufPtr xmlBufCreateStatic(void *mem, size_t size);
|
||||
|
||||
int xmlBufSetAllocationScheme(xmlBufPtr buf,
|
||||
xmlBufferAllocationScheme scheme);
|
||||
int xmlBufGetAllocationScheme(xmlBufPtr buf);
|
||||
|
||||
void xmlBufFree(xmlBufPtr buf);
|
||||
void xmlBufEmpty(xmlBufPtr buf);
|
||||
|
||||
/* size_t xmlBufShrink(xmlBufPtr buf, size_t len); */
|
||||
int xmlBufGrow(xmlBufPtr buf, int len);
|
||||
int xmlBufInflate(xmlBufPtr buf, size_t len);
|
||||
int xmlBufResize(xmlBufPtr buf, size_t len);
|
||||
|
||||
int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
|
||||
int xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len);
|
||||
int xmlBufCat(xmlBufPtr buf, const xmlChar *str);
|
||||
int xmlBufCCat(xmlBufPtr buf, const char *str);
|
||||
int xmlBufWriteCHAR(xmlBufPtr buf, const xmlChar *string);
|
||||
int xmlBufWriteChar(xmlBufPtr buf, const char *string);
|
||||
int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
|
||||
|
||||
size_t xmlBufAvail(const xmlBufPtr buf);
|
||||
size_t xmlBufLength(const xmlBufPtr buf);
|
||||
/* size_t xmlBufUse(const xmlBufPtr buf); */
|
||||
int xmlBufIsEmpty(const xmlBufPtr buf);
|
||||
int xmlBufAddLen(xmlBufPtr buf, size_t len);
|
||||
int xmlBufErase(xmlBufPtr buf, size_t len);
|
||||
|
||||
/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
|
||||
/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
|
||||
|
||||
xmlChar * xmlBufDetach(xmlBufPtr buf);
|
||||
|
||||
size_t xmlBufDump(FILE *file, xmlBufPtr buf);
|
||||
|
||||
xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer);
|
||||
xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf);
|
||||
int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
|
||||
|
||||
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
|
||||
size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
|
||||
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
|
||||
size_t base, size_t cur);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_BUF_H__ */
|
||||
|
||||
@ -1,122 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
###
|
||||
#
|
||||
# build_glob.py : Build the global_functions.h and global_functions.c
|
||||
# files which are required to implement the user
|
||||
# interface to global variables now that thread specific
|
||||
# data (TSD) is used to emulate global state.
|
||||
#
|
||||
# See Copyright for the status of this software.
|
||||
# Gary.Pennington@sun.com
|
||||
###
|
||||
import os, string
|
||||
|
||||
class globvar:
|
||||
def __init__(self, type, name):
|
||||
self.type=type
|
||||
self.name=name
|
||||
|
||||
def striplinesep(line):
|
||||
while line and line[-1] in ('\r','\n'):
|
||||
line = line[:-1]
|
||||
return line
|
||||
|
||||
def writeline(file, line=None):
|
||||
if line:
|
||||
file.write(line)
|
||||
file.write("\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
globals={}
|
||||
global_data=open("global.data").readlines()
|
||||
global_code=open("globals.c").readlines()
|
||||
global_hdr=open("include/libxml/globals.h").readlines()
|
||||
global_functions_hdr=open("include/libxml/globals.h", "w+")
|
||||
global_functions_impl=open("globals.c", "w+")
|
||||
|
||||
#
|
||||
# Rebuild the beginning of the file up to the
|
||||
# Automatically generated string
|
||||
#
|
||||
for line in global_hdr:
|
||||
line = striplinesep(line)
|
||||
if line == " * Automatically generated by build_glob.py.":
|
||||
break
|
||||
writeline(global_functions_hdr, line)
|
||||
|
||||
writeline(global_functions_hdr, " * Automatically generated by build_glob.py.")
|
||||
writeline(global_functions_hdr, " * Do not modify the previous line.")
|
||||
writeline(global_functions_hdr, " */")
|
||||
writeline(global_functions_hdr)
|
||||
|
||||
for line in global_code:
|
||||
line = striplinesep(line)
|
||||
if line == " * Automatically generated by build_glob.py.":
|
||||
break
|
||||
writeline(global_functions_impl, line)
|
||||
|
||||
writeline(global_functions_impl, " * Automatically generated by build_glob.py.")
|
||||
writeline(global_functions_impl, " * Do not modify the previous line.")
|
||||
writeline(global_functions_impl, " */")
|
||||
writeline(global_functions_impl)
|
||||
|
||||
# Now process the data and write it to the appropriate output file
|
||||
for line in global_data:
|
||||
if line[0]=='#':
|
||||
continue
|
||||
line = striplinesep(line)
|
||||
fields = string.split(line, ",")
|
||||
# Update the header file
|
||||
writeline(global_functions_hdr)
|
||||
global_functions_hdr.write("extern "+fields[0]+" *")
|
||||
if fields[2]:
|
||||
global_functions_hdr.write("(*")
|
||||
global_functions_hdr.write("__"+fields[1]+"(void)")
|
||||
if fields[2]:
|
||||
global_functions_hdr.write(")"+fields[2])
|
||||
writeline(global_functions_hdr,";")
|
||||
writeline(global_functions_hdr, "#ifdef LIBXML_THREAD_ENABLED")
|
||||
writeline(global_functions_hdr,"#define "+fields[1]+" \\")
|
||||
writeline(global_functions_hdr,"(*(__"+fields[1]+"()))")
|
||||
writeline(global_functions_hdr,"#else")
|
||||
if fields[2]:
|
||||
writeline(global_functions_hdr,"LIBXML_DLL_IMPORT extern "+fields[0]+" "+fields[1]+fields[2]+";")
|
||||
else:
|
||||
writeline(global_functions_hdr,"LIBXML_DLL_IMPORT extern "+fields[0]+" "+fields[1]+";")
|
||||
writeline(global_functions_hdr,"#endif")
|
||||
# set/get for per-thread global defaults
|
||||
if fields[3]:
|
||||
writeline(global_functions_hdr,fields[0]+" "+fields[1][:3]+"ThrDef"+fields[1][3:]+"("+fields[0]+" v);")
|
||||
# Update the implementation file
|
||||
writeline(global_functions_impl)
|
||||
# writeline(global_functions_impl, "extern "+fields[0]+" "+fields[1]+";")
|
||||
writeline(global_functions_impl, "#undef\t"+fields[1])
|
||||
writeline(global_functions_impl, fields[0]+" *")
|
||||
if fields[2]:
|
||||
global_functions_impl.write("(*")
|
||||
global_functions_impl.write("__"+fields[1]+"(void)")
|
||||
if fields[2]:
|
||||
writeline(global_functions_impl, ")[]")
|
||||
writeline(global_functions_impl, " {")
|
||||
writeline(global_functions_impl, " if (IS_MAIN_THREAD)")
|
||||
writeline(global_functions_impl, "\treturn (&"+fields[1]+");")
|
||||
writeline(global_functions_impl, " else")
|
||||
writeline(global_functions_impl, "\treturn (&xmlGetGlobalState()->"+fields[1]+");")
|
||||
writeline(global_functions_impl, "}")
|
||||
# set/get for per-thread global defaults
|
||||
if fields[3]:
|
||||
writeline(global_functions_impl,fields[0]+" "+fields[1][:3]+"ThrDef"+fields[1][3:]+"("+fields[0]+" v) {")
|
||||
writeline(global_functions_impl," "+fields[0]+" ret;");
|
||||
writeline(global_functions_impl," xmlMutexLock(xmlThrDefMutex);")
|
||||
writeline(global_functions_impl," ret = "+fields[1][:3]+fields[1][3:]+"ThrDef;")
|
||||
writeline(global_functions_impl," "+fields[1][:3]+fields[1][3:]+"ThrDef = v;")
|
||||
writeline(global_functions_impl," xmlMutexUnlock(xmlThrDefMutex);")
|
||||
writeline(global_functions_impl," return ret;")
|
||||
writeline(global_functions_impl,"}")
|
||||
# Terminate the header file with appropriate boilerplate
|
||||
writeline(global_functions_hdr)
|
||||
writeline(global_functions_hdr, "#ifdef __cplusplus")
|
||||
writeline(global_functions_hdr, "}")
|
||||
writeline(global_functions_hdr, "#endif")
|
||||
writeline(global_functions_hdr)
|
||||
writeline(global_functions_hdr, "#endif /* __XML_GLOBALS_H */")
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,394 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
import string
|
||||
import StringIO
|
||||
sys.path.insert(0, "python")
|
||||
import libxml2
|
||||
|
||||
# Memory debug specific
|
||||
libxml2.debugMemory(1)
|
||||
debug = 0
|
||||
verbose = 0
|
||||
quiet = 1
|
||||
|
||||
#
|
||||
# the testsuite description
|
||||
#
|
||||
CONF=os.path.join(os.path.dirname(__file__), "test/relaxng/OASIS/spectest.xml")
|
||||
LOG="check-relaxng-test-suite.log"
|
||||
RES="relaxng-test-results.xml"
|
||||
|
||||
log = open(LOG, "w")
|
||||
nb_schemas_tests = 0
|
||||
nb_schemas_success = 0
|
||||
nb_schemas_failed = 0
|
||||
nb_instances_tests = 0
|
||||
nb_instances_success = 0
|
||||
nb_instances_failed = 0
|
||||
|
||||
libxml2.lineNumbersDefault(1)
|
||||
#
|
||||
# Error and warnng callbacks
|
||||
#
|
||||
def callback(ctx, str):
|
||||
global log
|
||||
log.write("%s%s" % (ctx, str))
|
||||
|
||||
libxml2.registerErrorHandler(callback, "")
|
||||
|
||||
#
|
||||
# Resolver callback
|
||||
#
|
||||
resources = {}
|
||||
def resolver(URL, ID, ctxt):
|
||||
global resources
|
||||
|
||||
if string.find(URL, '#') != -1:
|
||||
URL = URL[0:string.find(URL, '#')]
|
||||
if resources.has_key(URL):
|
||||
return(StringIO.StringIO(resources[URL]))
|
||||
log.write("Resolver failure: asked %s\n" % (URL))
|
||||
log.write("resources: %s\n" % (resources))
|
||||
return None
|
||||
|
||||
#
|
||||
# Load the previous results
|
||||
#
|
||||
#results = {}
|
||||
#previous = {}
|
||||
#
|
||||
#try:
|
||||
# res = libxml2.parseFile(RES)
|
||||
#except:
|
||||
# log.write("Could not parse %s" % (RES))
|
||||
|
||||
#
|
||||
# handle a valid instance
|
||||
#
|
||||
def handle_valid(node, schema):
|
||||
global log
|
||||
global nb_instances_success
|
||||
global nb_instances_failed
|
||||
|
||||
instance = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
instance = instance + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
doc = libxml2.parseDoc(instance)
|
||||
except:
|
||||
doc = None
|
||||
|
||||
if doc == None:
|
||||
log.write("\nFailed to parse correct instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
return
|
||||
|
||||
try:
|
||||
ctxt = schema.relaxNGNewValidCtxt()
|
||||
ret = doc.relaxNGValidateDoc(ctxt)
|
||||
except:
|
||||
ret = -1
|
||||
if ret != 0:
|
||||
log.write("\nFailed to validate correct instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
else:
|
||||
nb_instances_success = nb_instances_success + 1
|
||||
doc.freeDoc()
|
||||
|
||||
#
|
||||
# handle an invalid instance
|
||||
#
|
||||
def handle_invalid(node, schema):
|
||||
global log
|
||||
global nb_instances_success
|
||||
global nb_instances_failed
|
||||
|
||||
instance = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
instance = instance + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
doc = libxml2.parseDoc(instance)
|
||||
except:
|
||||
doc = None
|
||||
|
||||
if doc == None:
|
||||
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
return
|
||||
|
||||
try:
|
||||
ctxt = schema.relaxNGNewValidCtxt()
|
||||
ret = doc.relaxNGValidateDoc(ctxt)
|
||||
except:
|
||||
ret = -1
|
||||
if ret == 0:
|
||||
log.write("\nFailed to detect validation problem in instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
else:
|
||||
nb_instances_success = nb_instances_success + 1
|
||||
doc.freeDoc()
|
||||
|
||||
#
|
||||
# handle an incorrect test
|
||||
#
|
||||
def handle_correct(node):
|
||||
global log
|
||||
global nb_schemas_success
|
||||
global nb_schemas_failed
|
||||
|
||||
schema = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
schema = schema + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
|
||||
rngs = rngp.relaxNGParse()
|
||||
except:
|
||||
rngs = None
|
||||
if rngs == None:
|
||||
log.write("\nFailed to compile correct schema:\n-----\n")
|
||||
log.write(schema)
|
||||
log.write("\n-----\n")
|
||||
nb_schemas_failed = nb_schemas_failed + 1
|
||||
else:
|
||||
nb_schemas_success = nb_schemas_success + 1
|
||||
return rngs
|
||||
|
||||
def handle_incorrect(node):
|
||||
global log
|
||||
global nb_schemas_success
|
||||
global nb_schemas_failed
|
||||
|
||||
schema = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
schema = schema + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
|
||||
rngs = rngp.relaxNGParse()
|
||||
except:
|
||||
rngs = None
|
||||
if rngs != None:
|
||||
log.write("\nFailed to detect schema error in:\n-----\n")
|
||||
log.write(schema)
|
||||
log.write("\n-----\n")
|
||||
nb_schemas_failed = nb_schemas_failed + 1
|
||||
else:
|
||||
# log.write("\nSuccess detecting schema error in:\n-----\n")
|
||||
# log.write(schema)
|
||||
# log.write("\n-----\n")
|
||||
nb_schemas_success = nb_schemas_success + 1
|
||||
return None
|
||||
|
||||
#
|
||||
# resource handling: keep a dictionary of URL->string mappings
|
||||
#
|
||||
def handle_resource(node, dir):
|
||||
global resources
|
||||
|
||||
try:
|
||||
name = node.prop('name')
|
||||
except:
|
||||
name = None
|
||||
|
||||
if name == None or name == '':
|
||||
log.write("resource has no name")
|
||||
return;
|
||||
|
||||
if dir != None:
|
||||
# name = libxml2.buildURI(name, dir)
|
||||
name = dir + '/' + name
|
||||
|
||||
res = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
res = res + child.serialize()
|
||||
child = child.next
|
||||
resources[name] = res
|
||||
|
||||
#
|
||||
# dir handling: pseudo directory resources
|
||||
#
|
||||
def handle_dir(node, dir):
|
||||
try:
|
||||
name = node.prop('name')
|
||||
except:
|
||||
name = None
|
||||
|
||||
if name == None or name == '':
|
||||
log.write("resource has no name")
|
||||
return;
|
||||
|
||||
if dir != None:
|
||||
# name = libxml2.buildURI(name, dir)
|
||||
name = dir + '/' + name
|
||||
|
||||
dirs = node.xpathEval('dir')
|
||||
for dir in dirs:
|
||||
handle_dir(dir, name)
|
||||
res = node.xpathEval('resource')
|
||||
for r in res:
|
||||
handle_resource(r, name)
|
||||
|
||||
#
|
||||
# handle a testCase element
|
||||
#
|
||||
def handle_testCase(node):
|
||||
global nb_schemas_tests
|
||||
global nb_instances_tests
|
||||
global resources
|
||||
|
||||
sections = node.xpathEval('string(section)')
|
||||
log.write("\n ======== test %d line %d section %s ==========\n" % (
|
||||
|
||||
nb_schemas_tests, node.lineNo(), sections))
|
||||
resources = {}
|
||||
if debug:
|
||||
print "test %d line %d" % (nb_schemas_tests, node.lineNo())
|
||||
|
||||
dirs = node.xpathEval('dir')
|
||||
for dir in dirs:
|
||||
handle_dir(dir, None)
|
||||
res = node.xpathEval('resource')
|
||||
for r in res:
|
||||
handle_resource(r, None)
|
||||
|
||||
tsts = node.xpathEval('incorrect')
|
||||
if tsts != []:
|
||||
if len(tsts) != 1:
|
||||
print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
|
||||
schema = handle_incorrect(tsts[0])
|
||||
else:
|
||||
tsts = node.xpathEval('correct')
|
||||
if tsts != []:
|
||||
if len(tsts) != 1:
|
||||
print "warning test line %d has more than one <correct> example"% (node.lineNo())
|
||||
schema = handle_correct(tsts[0])
|
||||
else:
|
||||
print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
|
||||
|
||||
nb_schemas_tests = nb_schemas_tests + 1;
|
||||
|
||||
valids = node.xpathEval('valid')
|
||||
invalids = node.xpathEval('invalid')
|
||||
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
|
||||
if schema != None:
|
||||
for valid in valids:
|
||||
handle_valid(valid, schema)
|
||||
for invalid in invalids:
|
||||
handle_invalid(invalid, schema)
|
||||
|
||||
|
||||
#
|
||||
# handle a testSuite element
|
||||
#
|
||||
def handle_testSuite(node, level = 0):
|
||||
global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
|
||||
global nb_instances_tests, nb_instances_success, nb_instances_failed
|
||||
global quiet
|
||||
if level >= 1:
|
||||
old_schemas_tests = nb_schemas_tests
|
||||
old_schemas_success = nb_schemas_success
|
||||
old_schemas_failed = nb_schemas_failed
|
||||
old_instances_tests = nb_instances_tests
|
||||
old_instances_success = nb_instances_success
|
||||
old_instances_failed = nb_instances_failed
|
||||
|
||||
docs = node.xpathEval('documentation')
|
||||
authors = node.xpathEval('author')
|
||||
if docs != []:
|
||||
msg = ""
|
||||
for doc in docs:
|
||||
msg = msg + doc.content + " "
|
||||
if authors != []:
|
||||
msg = msg + "written by "
|
||||
for author in authors:
|
||||
msg = msg + author.content + " "
|
||||
if quiet == 0:
|
||||
print msg
|
||||
sections = node.xpathEval('section')
|
||||
if sections != [] and level <= 0:
|
||||
msg = ""
|
||||
for section in sections:
|
||||
msg = msg + section.content + " "
|
||||
if quiet == 0:
|
||||
print "Tests for section %s" % (msg)
|
||||
for test in node.xpathEval('testCase'):
|
||||
handle_testCase(test)
|
||||
for test in node.xpathEval('testSuite'):
|
||||
handle_testSuite(test, level + 1)
|
||||
|
||||
|
||||
if verbose and level >= 1 and sections != []:
|
||||
msg = ""
|
||||
for section in sections:
|
||||
msg = msg + section.content + " "
|
||||
print "Result of tests for section %s" % (msg)
|
||||
if nb_schemas_tests != old_schemas_tests:
|
||||
print "found %d test schemas: %d success %d failures" % (
|
||||
nb_schemas_tests - old_schemas_tests,
|
||||
nb_schemas_success - old_schemas_success,
|
||||
nb_schemas_failed - old_schemas_failed)
|
||||
if nb_instances_tests != old_instances_tests:
|
||||
print "found %d test instances: %d success %d failures" % (
|
||||
nb_instances_tests - old_instances_tests,
|
||||
nb_instances_success - old_instances_success,
|
||||
nb_instances_failed - old_instances_failed)
|
||||
#
|
||||
# Parse the conf file
|
||||
#
|
||||
libxml2.substituteEntitiesDefault(1);
|
||||
testsuite = libxml2.parseFile(CONF)
|
||||
libxml2.setEntityLoader(resolver)
|
||||
root = testsuite.getRootElement()
|
||||
if root.name != 'testSuite':
|
||||
print "%s doesn't start with a testSuite element, aborting" % (CONF)
|
||||
sys.exit(1)
|
||||
if quiet == 0:
|
||||
print "Running Relax NG testsuite"
|
||||
handle_testSuite(root)
|
||||
|
||||
if quiet == 0:
|
||||
print "\nTOTAL:\n"
|
||||
if quiet == 0 or nb_schemas_failed != 0:
|
||||
print "found %d test schemas: %d success %d failures" % (
|
||||
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
|
||||
if quiet == 0 or nb_instances_failed != 0:
|
||||
print "found %d test instances: %d success %d failures" % (
|
||||
nb_instances_tests, nb_instances_success, nb_instances_failed)
|
||||
|
||||
testsuite.freeDoc()
|
||||
|
||||
# Memory debug specific
|
||||
libxml2.relaxNGCleanupTypes()
|
||||
libxml2.cleanupParser()
|
||||
if libxml2.debugMemory(1) == 0:
|
||||
if quiet == 0:
|
||||
print "OK"
|
||||
else:
|
||||
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
||||
libxml2.dumpMemory()
|
||||
@ -1,418 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
import string
|
||||
import StringIO
|
||||
sys.path.insert(0, "python")
|
||||
import libxml2
|
||||
|
||||
# Memory debug specific
|
||||
libxml2.debugMemory(1)
|
||||
debug = 0
|
||||
quiet = 1
|
||||
|
||||
#
|
||||
# the testsuite description
|
||||
#
|
||||
CONF=os.path.join(os.path.dirname(__file__), "test/relaxng/testsuite.xml")
|
||||
LOG="check-relaxng-test-suite2.log"
|
||||
|
||||
log = open(LOG, "w")
|
||||
nb_schemas_tests = 0
|
||||
nb_schemas_success = 0
|
||||
nb_schemas_failed = 0
|
||||
nb_instances_tests = 0
|
||||
nb_instances_success = 0
|
||||
nb_instances_failed = 0
|
||||
|
||||
libxml2.lineNumbersDefault(1)
|
||||
#
|
||||
# Resolver callback
|
||||
#
|
||||
resources = {}
|
||||
def resolver(URL, ID, ctxt):
|
||||
global resources
|
||||
|
||||
if resources.has_key(URL):
|
||||
return(StringIO.StringIO(resources[URL]))
|
||||
log.write("Resolver failure: asked %s\n" % (URL))
|
||||
log.write("resources: %s\n" % (resources))
|
||||
return None
|
||||
|
||||
#
|
||||
# Load the previous results
|
||||
#
|
||||
#results = {}
|
||||
#previous = {}
|
||||
#
|
||||
#try:
|
||||
# res = libxml2.parseFile(RES)
|
||||
#except:
|
||||
# log.write("Could not parse %s" % (RES))
|
||||
|
||||
#
|
||||
# handle a valid instance
|
||||
#
|
||||
def handle_valid(node, schema):
|
||||
global log
|
||||
global nb_instances_success
|
||||
global nb_instances_failed
|
||||
|
||||
instance = node.prop("dtd")
|
||||
if instance == None:
|
||||
instance = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
instance = instance + child.serialize()
|
||||
child = child.next
|
||||
|
||||
# mem = libxml2.debugMemory(1);
|
||||
try:
|
||||
doc = libxml2.parseDoc(instance)
|
||||
except:
|
||||
doc = None
|
||||
|
||||
if doc == None:
|
||||
log.write("\nFailed to parse correct instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
return
|
||||
|
||||
if debug:
|
||||
print "instance line %d" % (node.lineNo())
|
||||
|
||||
try:
|
||||
ctxt = schema.relaxNGNewValidCtxt()
|
||||
ret = doc.relaxNGValidateDoc(ctxt)
|
||||
del ctxt
|
||||
except:
|
||||
ret = -1
|
||||
|
||||
doc.freeDoc()
|
||||
# if mem != libxml2.debugMemory(1):
|
||||
# print "validating instance %d line %d leaks" % (
|
||||
# nb_instances_tests, node.lineNo())
|
||||
|
||||
if ret != 0:
|
||||
log.write("\nFailed to validate correct instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
else:
|
||||
nb_instances_success = nb_instances_success + 1
|
||||
|
||||
#
|
||||
# handle an invalid instance
|
||||
#
|
||||
def handle_invalid(node, schema):
|
||||
global log
|
||||
global nb_instances_success
|
||||
global nb_instances_failed
|
||||
|
||||
instance = node.prop("dtd")
|
||||
if instance == None:
|
||||
instance = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
instance = instance + child.serialize()
|
||||
child = child.next
|
||||
|
||||
# mem = libxml2.debugMemory(1);
|
||||
|
||||
try:
|
||||
doc = libxml2.parseDoc(instance)
|
||||
except:
|
||||
doc = None
|
||||
|
||||
if doc == None:
|
||||
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
return
|
||||
|
||||
if debug:
|
||||
print "instance line %d" % (node.lineNo())
|
||||
|
||||
try:
|
||||
ctxt = schema.relaxNGNewValidCtxt()
|
||||
ret = doc.relaxNGValidateDoc(ctxt)
|
||||
del ctxt
|
||||
|
||||
except:
|
||||
ret = -1
|
||||
|
||||
doc.freeDoc()
|
||||
# mem2 = libxml2.debugMemory(1)
|
||||
# if mem != mem2:
|
||||
# print "validating instance %d line %d leaks %d bytes" % (
|
||||
# nb_instances_tests, node.lineNo(), mem2 - mem)
|
||||
|
||||
if ret == 0:
|
||||
log.write("\nFailed to detect validation problem in instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
else:
|
||||
nb_instances_success = nb_instances_success + 1
|
||||
|
||||
#
|
||||
# handle an incorrect test
|
||||
#
|
||||
def handle_correct(node):
|
||||
global log
|
||||
global nb_schemas_success
|
||||
global nb_schemas_failed
|
||||
|
||||
schema = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
schema = schema + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
|
||||
rngs = rngp.relaxNGParse()
|
||||
except:
|
||||
rngs = None
|
||||
if rngs == None:
|
||||
log.write("\nFailed to compile correct schema:\n-----\n")
|
||||
log.write(schema)
|
||||
log.write("\n-----\n")
|
||||
nb_schemas_failed = nb_schemas_failed + 1
|
||||
else:
|
||||
nb_schemas_success = nb_schemas_success + 1
|
||||
return rngs
|
||||
|
||||
def handle_incorrect(node):
|
||||
global log
|
||||
global nb_schemas_success
|
||||
global nb_schemas_failed
|
||||
|
||||
schema = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
schema = schema + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
|
||||
rngs = rngp.relaxNGParse()
|
||||
except:
|
||||
rngs = None
|
||||
if rngs != None:
|
||||
log.write("\nFailed to detect schema error in:\n-----\n")
|
||||
log.write(schema)
|
||||
log.write("\n-----\n")
|
||||
nb_schemas_failed = nb_schemas_failed + 1
|
||||
else:
|
||||
# log.write("\nSuccess detecting schema error in:\n-----\n")
|
||||
# log.write(schema)
|
||||
# log.write("\n-----\n")
|
||||
nb_schemas_success = nb_schemas_success + 1
|
||||
return None
|
||||
|
||||
#
|
||||
# resource handling: keep a dictionary of URL->string mappings
|
||||
#
|
||||
def handle_resource(node, dir):
|
||||
global resources
|
||||
|
||||
try:
|
||||
name = node.prop('name')
|
||||
except:
|
||||
name = None
|
||||
|
||||
if name == None or name == '':
|
||||
log.write("resource has no name")
|
||||
return;
|
||||
|
||||
if dir != None:
|
||||
# name = libxml2.buildURI(name, dir)
|
||||
name = dir + '/' + name
|
||||
|
||||
res = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
res = res + child.serialize()
|
||||
child = child.next
|
||||
resources[name] = res
|
||||
|
||||
#
|
||||
# dir handling: pseudo directory resources
|
||||
#
|
||||
def handle_dir(node, dir):
|
||||
try:
|
||||
name = node.prop('name')
|
||||
except:
|
||||
name = None
|
||||
|
||||
if name == None or name == '':
|
||||
log.write("resource has no name")
|
||||
return;
|
||||
|
||||
if dir != None:
|
||||
# name = libxml2.buildURI(name, dir)
|
||||
name = dir + '/' + name
|
||||
|
||||
dirs = node.xpathEval('dir')
|
||||
for dir in dirs:
|
||||
handle_dir(dir, name)
|
||||
res = node.xpathEval('resource')
|
||||
for r in res:
|
||||
handle_resource(r, name)
|
||||
|
||||
#
|
||||
# handle a testCase element
|
||||
#
|
||||
def handle_testCase(node):
|
||||
global nb_schemas_tests
|
||||
global nb_instances_tests
|
||||
global resources
|
||||
|
||||
sections = node.xpathEval('string(section)')
|
||||
log.write("\n ======== test %d line %d section %s ==========\n" % (
|
||||
|
||||
nb_schemas_tests, node.lineNo(), sections))
|
||||
resources = {}
|
||||
if debug:
|
||||
print "test %d line %d" % (nb_schemas_tests, node.lineNo())
|
||||
|
||||
dirs = node.xpathEval('dir')
|
||||
for dir in dirs:
|
||||
handle_dir(dir, None)
|
||||
res = node.xpathEval('resource')
|
||||
for r in res:
|
||||
handle_resource(r, None)
|
||||
|
||||
tsts = node.xpathEval('incorrect')
|
||||
if tsts != []:
|
||||
if len(tsts) != 1:
|
||||
print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
|
||||
schema = handle_incorrect(tsts[0])
|
||||
else:
|
||||
tsts = node.xpathEval('correct')
|
||||
if tsts != []:
|
||||
if len(tsts) != 1:
|
||||
print "warning test line %d has more than one <correct> example"% (node.lineNo())
|
||||
schema = handle_correct(tsts[0])
|
||||
else:
|
||||
print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
|
||||
|
||||
nb_schemas_tests = nb_schemas_tests + 1;
|
||||
|
||||
valids = node.xpathEval('valid')
|
||||
invalids = node.xpathEval('invalid')
|
||||
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
|
||||
if schema != None:
|
||||
for valid in valids:
|
||||
handle_valid(valid, schema)
|
||||
for invalid in invalids:
|
||||
handle_invalid(invalid, schema)
|
||||
|
||||
|
||||
#
|
||||
# handle a testSuite element
|
||||
#
|
||||
def handle_testSuite(node, level = 0):
|
||||
global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
|
||||
global nb_instances_tests, nb_instances_success, nb_instances_failed
|
||||
if level >= 1:
|
||||
old_schemas_tests = nb_schemas_tests
|
||||
old_schemas_success = nb_schemas_success
|
||||
old_schemas_failed = nb_schemas_failed
|
||||
old_instances_tests = nb_instances_tests
|
||||
old_instances_success = nb_instances_success
|
||||
old_instances_failed = nb_instances_failed
|
||||
|
||||
docs = node.xpathEval('documentation')
|
||||
authors = node.xpathEval('author')
|
||||
if docs != []:
|
||||
msg = ""
|
||||
for doc in docs:
|
||||
msg = msg + doc.content + " "
|
||||
if authors != []:
|
||||
msg = msg + "written by "
|
||||
for author in authors:
|
||||
msg = msg + author.content + " "
|
||||
if quiet == 0:
|
||||
print msg
|
||||
sections = node.xpathEval('section')
|
||||
if sections != [] and level <= 0:
|
||||
msg = ""
|
||||
for section in sections:
|
||||
msg = msg + section.content + " "
|
||||
if quiet == 0:
|
||||
print "Tests for section %s" % (msg)
|
||||
for test in node.xpathEval('testCase'):
|
||||
handle_testCase(test)
|
||||
for test in node.xpathEval('testSuite'):
|
||||
handle_testSuite(test, level + 1)
|
||||
|
||||
|
||||
if level >= 1 and sections != []:
|
||||
msg = ""
|
||||
for section in sections:
|
||||
msg = msg + section.content + " "
|
||||
print "Result of tests for section %s" % (msg)
|
||||
if nb_schemas_tests != old_schemas_tests:
|
||||
print "found %d test schemas: %d success %d failures" % (
|
||||
nb_schemas_tests - old_schemas_tests,
|
||||
nb_schemas_success - old_schemas_success,
|
||||
nb_schemas_failed - old_schemas_failed)
|
||||
if nb_instances_tests != old_instances_tests:
|
||||
print "found %d test instances: %d success %d failures" % (
|
||||
nb_instances_tests - old_instances_tests,
|
||||
nb_instances_success - old_instances_success,
|
||||
nb_instances_failed - old_instances_failed)
|
||||
#
|
||||
# Parse the conf file
|
||||
#
|
||||
libxml2.substituteEntitiesDefault(1);
|
||||
testsuite = libxml2.parseFile(CONF)
|
||||
|
||||
#
|
||||
# Error and warnng callbacks
|
||||
#
|
||||
def callback(ctx, str):
|
||||
global log
|
||||
log.write("%s%s" % (ctx, str))
|
||||
|
||||
libxml2.registerErrorHandler(callback, "")
|
||||
|
||||
libxml2.setEntityLoader(resolver)
|
||||
root = testsuite.getRootElement()
|
||||
if root.name != 'testSuite':
|
||||
print "%s doesn't start with a testSuite element, aborting" % (CONF)
|
||||
sys.exit(1)
|
||||
if quiet == 0:
|
||||
print "Running Relax NG testsuite"
|
||||
handle_testSuite(root)
|
||||
|
||||
if quiet == 0:
|
||||
print "\nTOTAL:\n"
|
||||
if quiet == 0 or nb_schemas_failed != 0:
|
||||
print "found %d test schemas: %d success %d failures" % (
|
||||
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
|
||||
if quiet == 0 or nb_instances_failed != 0:
|
||||
print "found %d test instances: %d success %d failures" % (
|
||||
nb_instances_tests, nb_instances_success, nb_instances_failed)
|
||||
|
||||
|
||||
testsuite.freeDoc()
|
||||
|
||||
# Memory debug specific
|
||||
libxml2.relaxNGCleanupTypes()
|
||||
libxml2.cleanupParser()
|
||||
if libxml2.debugMemory(1) == 0:
|
||||
if quiet == 0:
|
||||
print "OK"
|
||||
else:
|
||||
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
||||
libxml2.dumpMemory()
|
||||
@ -1,221 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
import string
|
||||
sys.path.insert(0, "python")
|
||||
import libxml2
|
||||
|
||||
#
|
||||
# the testsuite description
|
||||
#
|
||||
DIR="xinclude-test-suite"
|
||||
CONF="testdescr.xml"
|
||||
LOG="check-xinclude-test-suite.log"
|
||||
|
||||
log = open(LOG, "w")
|
||||
|
||||
os.chdir(DIR)
|
||||
|
||||
test_nr = 0
|
||||
test_succeed = 0
|
||||
test_failed = 0
|
||||
test_error = 0
|
||||
#
|
||||
# Error and warning handlers
|
||||
#
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
|
||||
def errorHandler(ctx, str):
|
||||
global error_nr
|
||||
global error_msg
|
||||
|
||||
if string.find(str, "error:") >= 0:
|
||||
error_nr = error_nr + 1
|
||||
if len(error_msg) < 300:
|
||||
if len(error_msg) == 0 or error_msg[-1] == '\n':
|
||||
error_msg = error_msg + " >>" + str
|
||||
else:
|
||||
error_msg = error_msg + str
|
||||
|
||||
libxml2.registerErrorHandler(errorHandler, None)
|
||||
|
||||
def testXInclude(filename, id):
|
||||
global error_nr
|
||||
global error_msg
|
||||
global log
|
||||
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
|
||||
print "testXInclude(%s, %s)" % (filename, id)
|
||||
return 1
|
||||
|
||||
def runTest(test, basedir):
|
||||
global test_nr
|
||||
global test_failed
|
||||
global test_error
|
||||
global test_succeed
|
||||
global error_msg
|
||||
global log
|
||||
|
||||
fatal_error = 0
|
||||
uri = test.prop('href')
|
||||
id = test.prop('id')
|
||||
type = test.prop('type')
|
||||
if uri == None:
|
||||
print "Test without ID:", uri
|
||||
return -1
|
||||
if id == None:
|
||||
print "Test without URI:", id
|
||||
return -1
|
||||
if type == None:
|
||||
print "Test without URI:", id
|
||||
return -1
|
||||
if basedir != None:
|
||||
URI = basedir + "/" + uri
|
||||
else:
|
||||
URI = uri
|
||||
if os.access(URI, os.R_OK) == 0:
|
||||
print "Test %s missing: base %s uri %s" % (URI, basedir, uri)
|
||||
return -1
|
||||
|
||||
expected = None
|
||||
outputfile = None
|
||||
diff = None
|
||||
if type != 'error':
|
||||
output = test.xpathEval('string(output)')
|
||||
if output == 'No output file.':
|
||||
output = None
|
||||
if output == '':
|
||||
output = None
|
||||
if output != None:
|
||||
if basedir != None:
|
||||
output = basedir + "/" + output
|
||||
if os.access(output, os.R_OK) == 0:
|
||||
print "Result for %s missing: %s" % (id, output)
|
||||
output = None
|
||||
else:
|
||||
try:
|
||||
f = open(output)
|
||||
expected = f.read()
|
||||
outputfile = output
|
||||
except:
|
||||
print "Result for %s unreadable: %s" % (id, output)
|
||||
|
||||
try:
|
||||
# print "testing %s" % (URI)
|
||||
doc = libxml2.parseFile(URI)
|
||||
except:
|
||||
doc = None
|
||||
if doc != None:
|
||||
res = doc.xincludeProcess()
|
||||
if res >= 0 and expected != None:
|
||||
result = doc.serialize()
|
||||
if result != expected:
|
||||
print "Result for %s differs" % (id)
|
||||
open("xinclude.res", "w").write(result)
|
||||
diff = os.popen("diff %s xinclude.res" % outputfile).read()
|
||||
|
||||
doc.freeDoc()
|
||||
else:
|
||||
print "Failed to parse %s" % (URI)
|
||||
res = -1
|
||||
|
||||
|
||||
|
||||
test_nr = test_nr + 1
|
||||
if type == 'success':
|
||||
if res > 0:
|
||||
test_succeed = test_succeed + 1
|
||||
elif res == 0:
|
||||
test_failed = test_failed + 1
|
||||
print "Test %s: no substitution done ???" % (id)
|
||||
elif res < 0:
|
||||
test_error = test_error + 1
|
||||
print "Test %s: failed valid XInclude processing" % (id)
|
||||
elif type == 'error':
|
||||
if res > 0:
|
||||
test_error = test_error + 1
|
||||
print "Test %s: failed to detect invalid XInclude processing" % (id)
|
||||
elif res == 0:
|
||||
test_failed = test_failed + 1
|
||||
print "Test %s: Invalid but no substitution done" % (id)
|
||||
elif res < 0:
|
||||
test_succeed = test_succeed + 1
|
||||
elif type == 'optional':
|
||||
if res > 0:
|
||||
test_succeed = test_succeed + 1
|
||||
else:
|
||||
print "Test %s: failed optional test" % (id)
|
||||
|
||||
# Log the ontext
|
||||
if res != 1:
|
||||
log.write("Test ID %s\n" % (id))
|
||||
log.write(" File: %s\n" % (URI))
|
||||
content = string.strip(test.content)
|
||||
while content[-1] == '\n':
|
||||
content = content[0:-1]
|
||||
log.write(" %s:%s\n\n" % (type, content))
|
||||
if error_msg != '':
|
||||
log.write(" ----\n%s ----\n" % (error_msg))
|
||||
error_msg = ''
|
||||
log.write("\n")
|
||||
if diff != None:
|
||||
log.write("diff from test %s:\n" %(id))
|
||||
log.write(" -----------\n%s\n -----------\n" % (diff));
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def runTestCases(case):
|
||||
creator = case.prop('creator')
|
||||
if creator != None:
|
||||
print "=>", creator
|
||||
base = case.getBase(None)
|
||||
basedir = case.prop('basedir')
|
||||
if basedir != None:
|
||||
base = libxml2.buildURI(basedir, base)
|
||||
test = case.children
|
||||
while test != None:
|
||||
if test.name == 'testcase':
|
||||
runTest(test, base)
|
||||
if test.name == 'testcases':
|
||||
runTestCases(test)
|
||||
test = test.next
|
||||
|
||||
conf = libxml2.parseFile(CONF)
|
||||
if conf == None:
|
||||
print "Unable to load %s" % CONF
|
||||
sys.exit(1)
|
||||
|
||||
testsuite = conf.getRootElement()
|
||||
if testsuite.name != 'testsuite':
|
||||
print "Expecting TESTSUITE root element: aborting"
|
||||
sys.exit(1)
|
||||
|
||||
profile = testsuite.prop('PROFILE')
|
||||
if profile != None:
|
||||
print profile
|
||||
|
||||
start = time.time()
|
||||
|
||||
case = testsuite.children
|
||||
while case != None:
|
||||
if case.name == 'testcases':
|
||||
old_test_nr = test_nr
|
||||
old_test_succeed = test_succeed
|
||||
old_test_failed = test_failed
|
||||
old_test_error = test_error
|
||||
runTestCases(case)
|
||||
print " Ran %d tests: %d suceeded, %d failed and %d generated an error" % (
|
||||
test_nr - old_test_nr, test_succeed - old_test_succeed,
|
||||
test_failed - old_test_failed, test_error - old_test_error)
|
||||
case = case.next
|
||||
|
||||
conf.freeDoc()
|
||||
log.close()
|
||||
|
||||
print "Ran %d tests: %d suceeded, %d failed and %d generated an error in %.2f s." % (
|
||||
test_nr, test_succeed, test_failed, test_error, time.time() - start)
|
||||
@ -1,409 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
import string
|
||||
sys.path.insert(0, "python")
|
||||
import libxml2
|
||||
|
||||
test_nr = 0
|
||||
test_succeed = 0
|
||||
test_failed = 0
|
||||
test_error = 0
|
||||
|
||||
#
|
||||
# the testsuite description
|
||||
#
|
||||
CONF="xml-test-suite/xmlconf/xmlconf.xml"
|
||||
LOG="check-xml-test-suite.log"
|
||||
|
||||
log = open(LOG, "w")
|
||||
|
||||
#
|
||||
# Error and warning handlers
|
||||
#
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
def errorHandler(ctx, str):
|
||||
global error_nr
|
||||
global error_msg
|
||||
|
||||
error_nr = error_nr + 1
|
||||
if len(error_msg) < 300:
|
||||
if len(error_msg) == 0 or error_msg[-1] == '\n':
|
||||
error_msg = error_msg + " >>" + str
|
||||
else:
|
||||
error_msg = error_msg + str
|
||||
|
||||
libxml2.registerErrorHandler(errorHandler, None)
|
||||
|
||||
#warning_nr = 0
|
||||
#warning = ''
|
||||
#def warningHandler(ctx, str):
|
||||
# global warning_nr
|
||||
# global warning
|
||||
#
|
||||
# warning_nr = warning_nr + 1
|
||||
# warning = warning + str
|
||||
#
|
||||
#libxml2.registerWarningHandler(warningHandler, None)
|
||||
|
||||
#
|
||||
# Used to load the XML testsuite description
|
||||
#
|
||||
def loadNoentDoc(filename):
|
||||
ctxt = libxml2.createFileParserCtxt(filename)
|
||||
if ctxt == None:
|
||||
return None
|
||||
ctxt.replaceEntities(1)
|
||||
ctxt.parseDocument()
|
||||
try:
|
||||
doc = ctxt.doc()
|
||||
except:
|
||||
doc = None
|
||||
if ctxt.wellFormed() != 1:
|
||||
doc.freeDoc()
|
||||
return None
|
||||
return doc
|
||||
|
||||
#
|
||||
# The conformance testing routines
|
||||
#
|
||||
|
||||
def testNotWf(filename, id):
|
||||
global error_nr
|
||||
global error_msg
|
||||
global log
|
||||
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
|
||||
ctxt = libxml2.createFileParserCtxt(filename)
|
||||
if ctxt == None:
|
||||
return -1
|
||||
ret = ctxt.parseDocument()
|
||||
|
||||
try:
|
||||
doc = ctxt.doc()
|
||||
except:
|
||||
doc = None
|
||||
if doc != None:
|
||||
doc.freeDoc()
|
||||
if ret == 0 or ctxt.wellFormed() != 0:
|
||||
print "%s: error: Well Formedness error not detected" % (id)
|
||||
log.write("%s: error: Well Formedness error not detected\n" % (id))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
def testNotWfEnt(filename, id):
|
||||
global error_nr
|
||||
global error_msg
|
||||
global log
|
||||
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
|
||||
ctxt = libxml2.createFileParserCtxt(filename)
|
||||
if ctxt == None:
|
||||
return -1
|
||||
ctxt.replaceEntities(1)
|
||||
ret = ctxt.parseDocument()
|
||||
|
||||
try:
|
||||
doc = ctxt.doc()
|
||||
except:
|
||||
doc = None
|
||||
if doc != None:
|
||||
doc.freeDoc()
|
||||
if ret == 0 or ctxt.wellFormed() != 0:
|
||||
print "%s: error: Well Formedness error not detected" % (id)
|
||||
log.write("%s: error: Well Formedness error not detected\n" % (id))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
def testNotWfEntDtd(filename, id):
|
||||
global error_nr
|
||||
global error_msg
|
||||
global log
|
||||
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
|
||||
ctxt = libxml2.createFileParserCtxt(filename)
|
||||
if ctxt == None:
|
||||
return -1
|
||||
ctxt.replaceEntities(1)
|
||||
ctxt.loadSubset(1)
|
||||
ret = ctxt.parseDocument()
|
||||
|
||||
try:
|
||||
doc = ctxt.doc()
|
||||
except:
|
||||
doc = None
|
||||
if doc != None:
|
||||
doc.freeDoc()
|
||||
if ret == 0 or ctxt.wellFormed() != 0:
|
||||
print "%s: error: Well Formedness error not detected" % (id)
|
||||
log.write("%s: error: Well Formedness error not detected\n" % (id))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
def testWfEntDtd(filename, id):
|
||||
global error_nr
|
||||
global error_msg
|
||||
global log
|
||||
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
|
||||
ctxt = libxml2.createFileParserCtxt(filename)
|
||||
if ctxt == None:
|
||||
return -1
|
||||
ctxt.replaceEntities(1)
|
||||
ctxt.loadSubset(1)
|
||||
ret = ctxt.parseDocument()
|
||||
|
||||
try:
|
||||
doc = ctxt.doc()
|
||||
except:
|
||||
doc = None
|
||||
if doc == None or ret != 0 or ctxt.wellFormed() == 0:
|
||||
print "%s: error: wrongly failed to parse the document" % (id)
|
||||
log.write("%s: error: wrongly failed to parse the document\n" % (id))
|
||||
if doc != None:
|
||||
doc.freeDoc()
|
||||
return 0
|
||||
if error_nr != 0:
|
||||
print "%s: warning: WF document generated an error msg" % (id)
|
||||
log.write("%s: error: WF document generated an error msg\n" % (id))
|
||||
doc.freeDoc()
|
||||
return 2
|
||||
doc.freeDoc()
|
||||
return 1
|
||||
|
||||
def testError(filename, id):
|
||||
global error_nr
|
||||
global error_msg
|
||||
global log
|
||||
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
|
||||
ctxt = libxml2.createFileParserCtxt(filename)
|
||||
if ctxt == None:
|
||||
return -1
|
||||
ctxt.replaceEntities(1)
|
||||
ctxt.loadSubset(1)
|
||||
ret = ctxt.parseDocument()
|
||||
|
||||
try:
|
||||
doc = ctxt.doc()
|
||||
except:
|
||||
doc = None
|
||||
if doc != None:
|
||||
doc.freeDoc()
|
||||
if ctxt.wellFormed() == 0:
|
||||
print "%s: warning: failed to parse the document but accepted" % (id)
|
||||
log.write("%s: warning: failed to parse the document but accepte\n" % (id))
|
||||
return 2
|
||||
if error_nr != 0:
|
||||
print "%s: warning: WF document generated an error msg" % (id)
|
||||
log.write("%s: error: WF document generated an error msg\n" % (id))
|
||||
return 2
|
||||
return 1
|
||||
|
||||
def testInvalid(filename, id):
|
||||
global error_nr
|
||||
global error_msg
|
||||
global log
|
||||
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
|
||||
ctxt = libxml2.createFileParserCtxt(filename)
|
||||
if ctxt == None:
|
||||
return -1
|
||||
ctxt.validate(1)
|
||||
ret = ctxt.parseDocument()
|
||||
|
||||
try:
|
||||
doc = ctxt.doc()
|
||||
except:
|
||||
doc = None
|
||||
valid = ctxt.isValid()
|
||||
if doc == None:
|
||||
print "%s: error: wrongly failed to parse the document" % (id)
|
||||
log.write("%s: error: wrongly failed to parse the document\n" % (id))
|
||||
return 0
|
||||
if valid == 1:
|
||||
print "%s: error: Validity error not detected" % (id)
|
||||
log.write("%s: error: Validity error not detected\n" % (id))
|
||||
doc.freeDoc()
|
||||
return 0
|
||||
if error_nr == 0:
|
||||
print "%s: warning: Validity error not reported" % (id)
|
||||
log.write("%s: warning: Validity error not reported\n" % (id))
|
||||
doc.freeDoc()
|
||||
return 2
|
||||
|
||||
doc.freeDoc()
|
||||
return 1
|
||||
|
||||
def testValid(filename, id):
|
||||
global error_nr
|
||||
global error_msg
|
||||
|
||||
error_nr = 0
|
||||
error_msg = ''
|
||||
|
||||
ctxt = libxml2.createFileParserCtxt(filename)
|
||||
if ctxt == None:
|
||||
return -1
|
||||
ctxt.validate(1)
|
||||
ctxt.parseDocument()
|
||||
|
||||
try:
|
||||
doc = ctxt.doc()
|
||||
except:
|
||||
doc = None
|
||||
valid = ctxt.isValid()
|
||||
if doc == None:
|
||||
print "%s: error: wrongly failed to parse the document" % (id)
|
||||
log.write("%s: error: wrongly failed to parse the document\n" % (id))
|
||||
return 0
|
||||
if valid != 1:
|
||||
print "%s: error: Validity check failed" % (id)
|
||||
log.write("%s: error: Validity check failed\n" % (id))
|
||||
doc.freeDoc()
|
||||
return 0
|
||||
if error_nr != 0 or valid != 1:
|
||||
print "%s: warning: valid document reported an error" % (id)
|
||||
log.write("%s: warning: valid document reported an error\n" % (id))
|
||||
doc.freeDoc()
|
||||
return 2
|
||||
doc.freeDoc()
|
||||
return 1
|
||||
|
||||
def runTest(test):
|
||||
global test_nr
|
||||
global test_succeed
|
||||
global test_failed
|
||||
global error_msg
|
||||
global log
|
||||
|
||||
uri = test.prop('URI')
|
||||
id = test.prop('ID')
|
||||
if uri == None:
|
||||
print "Test without ID:", uri
|
||||
return -1
|
||||
if id == None:
|
||||
print "Test without URI:", id
|
||||
return -1
|
||||
base = test.getBase(None)
|
||||
URI = libxml2.buildURI(uri, base)
|
||||
if os.access(URI, os.R_OK) == 0:
|
||||
print "Test %s missing: base %s uri %s" % (URI, base, uri)
|
||||
return -1
|
||||
type = test.prop('TYPE')
|
||||
if type == None:
|
||||
print "Test %s missing TYPE" % (id)
|
||||
return -1
|
||||
|
||||
extra = None
|
||||
if type == "invalid":
|
||||
res = testInvalid(URI, id)
|
||||
elif type == "valid":
|
||||
res = testValid(URI, id)
|
||||
elif type == "not-wf":
|
||||
extra = test.prop('ENTITIES')
|
||||
# print URI
|
||||
#if extra == None:
|
||||
# res = testNotWfEntDtd(URI, id)
|
||||
#elif extra == 'none':
|
||||
# res = testNotWf(URI, id)
|
||||
#elif extra == 'general':
|
||||
# res = testNotWfEnt(URI, id)
|
||||
#elif extra == 'both' or extra == 'parameter':
|
||||
res = testNotWfEntDtd(URI, id)
|
||||
#else:
|
||||
# print "Unknow value %s for an ENTITIES test value" % (extra)
|
||||
# return -1
|
||||
elif type == "error":
|
||||
res = testError(URI, id)
|
||||
else:
|
||||
# TODO skipped for now
|
||||
return -1
|
||||
|
||||
test_nr = test_nr + 1
|
||||
if res > 0:
|
||||
test_succeed = test_succeed + 1
|
||||
elif res == 0:
|
||||
test_failed = test_failed + 1
|
||||
elif res < 0:
|
||||
test_error = test_error + 1
|
||||
|
||||
# Log the ontext
|
||||
if res != 1:
|
||||
log.write(" File: %s\n" % (URI))
|
||||
content = string.strip(test.content)
|
||||
while content[-1] == '\n':
|
||||
content = content[0:-1]
|
||||
if extra != None:
|
||||
log.write(" %s:%s:%s\n" % (type, extra, content))
|
||||
else:
|
||||
log.write(" %s:%s\n\n" % (type, content))
|
||||
if error_msg != '':
|
||||
log.write(" ----\n%s ----\n" % (error_msg))
|
||||
error_msg = ''
|
||||
log.write("\n")
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def runTestCases(case):
|
||||
profile = case.prop('PROFILE')
|
||||
if profile != None and \
|
||||
string.find(profile, "IBM XML Conformance Test Suite - Production") < 0:
|
||||
print "=>", profile
|
||||
test = case.children
|
||||
while test != None:
|
||||
if test.name == 'TEST':
|
||||
runTest(test)
|
||||
if test.name == 'TESTCASES':
|
||||
runTestCases(test)
|
||||
test = test.next
|
||||
|
||||
conf = loadNoentDoc(CONF)
|
||||
if conf == None:
|
||||
print "Unable to load %s" % CONF
|
||||
sys.exit(1)
|
||||
|
||||
testsuite = conf.getRootElement()
|
||||
if testsuite.name != 'TESTSUITE':
|
||||
print "Expecting TESTSUITE root element: aborting"
|
||||
sys.exit(1)
|
||||
|
||||
profile = testsuite.prop('PROFILE')
|
||||
if profile != None:
|
||||
print profile
|
||||
|
||||
start = time.time()
|
||||
|
||||
case = testsuite.children
|
||||
while case != None:
|
||||
if case.name == 'TESTCASES':
|
||||
old_test_nr = test_nr
|
||||
old_test_succeed = test_succeed
|
||||
old_test_failed = test_failed
|
||||
old_test_error = test_error
|
||||
runTestCases(case)
|
||||
print " Ran %d tests: %d suceeded, %d failed and %d generated an error" % (
|
||||
test_nr - old_test_nr, test_succeed - old_test_succeed,
|
||||
test_failed - old_test_failed, test_error - old_test_error)
|
||||
case = case.next
|
||||
|
||||
conf.freeDoc()
|
||||
log.close()
|
||||
|
||||
print "Ran %d tests: %d suceeded, %d failed and %d generated an error in %.2f s." % (
|
||||
test_nr, test_succeed, test_failed, test_error, time.time() - start)
|
||||
@ -1,420 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
import string
|
||||
import StringIO
|
||||
sys.path.insert(0, "python")
|
||||
import libxml2
|
||||
|
||||
# Memory debug specific
|
||||
libxml2.debugMemory(1)
|
||||
debug = 0
|
||||
verbose = 0
|
||||
quiet = 1
|
||||
|
||||
#
|
||||
# the testsuite description
|
||||
#
|
||||
CONF=os.path.join(os.path.dirname(__file__), "test/xsdtest/xsdtestsuite.xml")
|
||||
LOG="check-xsddata-test-suite.log"
|
||||
|
||||
log = open(LOG, "w")
|
||||
nb_schemas_tests = 0
|
||||
nb_schemas_success = 0
|
||||
nb_schemas_failed = 0
|
||||
nb_instances_tests = 0
|
||||
nb_instances_success = 0
|
||||
nb_instances_failed = 0
|
||||
|
||||
libxml2.lineNumbersDefault(1)
|
||||
#
|
||||
# Error and warnng callbacks
|
||||
#
|
||||
def callback(ctx, str):
|
||||
global log
|
||||
log.write("%s%s" % (ctx, str))
|
||||
|
||||
libxml2.registerErrorHandler(callback, "")
|
||||
|
||||
#
|
||||
# Resolver callback
|
||||
#
|
||||
resources = {}
|
||||
def resolver(URL, ID, ctxt):
|
||||
global resources
|
||||
|
||||
if resources.has_key(URL):
|
||||
return(StringIO.StringIO(resources[URL]))
|
||||
log.write("Resolver failure: asked %s\n" % (URL))
|
||||
log.write("resources: %s\n" % (resources))
|
||||
return None
|
||||
|
||||
#
|
||||
# handle a valid instance
|
||||
#
|
||||
def handle_valid(node, schema):
|
||||
global log
|
||||
global nb_instances_success
|
||||
global nb_instances_failed
|
||||
|
||||
instance = node.prop("dtd")
|
||||
if instance == None:
|
||||
instance = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
instance = instance + child.serialize()
|
||||
child = child.next
|
||||
|
||||
mem = libxml2.debugMemory(1);
|
||||
try:
|
||||
doc = libxml2.parseDoc(instance)
|
||||
except:
|
||||
doc = None
|
||||
|
||||
if doc == None:
|
||||
log.write("\nFailed to parse correct instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
return
|
||||
|
||||
if debug:
|
||||
print "instance line %d" % (node.lineNo())
|
||||
|
||||
try:
|
||||
ctxt = schema.relaxNGNewValidCtxt()
|
||||
ret = doc.relaxNGValidateDoc(ctxt)
|
||||
del ctxt
|
||||
except:
|
||||
ret = -1
|
||||
|
||||
doc.freeDoc()
|
||||
if mem != libxml2.debugMemory(1):
|
||||
print "validating instance %d line %d leaks" % (
|
||||
nb_instances_tests, node.lineNo())
|
||||
|
||||
if ret != 0:
|
||||
log.write("\nFailed to validate correct instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
else:
|
||||
nb_instances_success = nb_instances_success + 1
|
||||
|
||||
#
|
||||
# handle an invalid instance
|
||||
#
|
||||
def handle_invalid(node, schema):
|
||||
global log
|
||||
global nb_instances_success
|
||||
global nb_instances_failed
|
||||
|
||||
instance = node.prop("dtd")
|
||||
if instance == None:
|
||||
instance = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
instance = instance + child.serialize()
|
||||
child = child.next
|
||||
|
||||
# mem = libxml2.debugMemory(1);
|
||||
|
||||
try:
|
||||
doc = libxml2.parseDoc(instance)
|
||||
except:
|
||||
doc = None
|
||||
|
||||
if doc == None:
|
||||
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
return
|
||||
|
||||
if debug:
|
||||
print "instance line %d" % (node.lineNo())
|
||||
|
||||
try:
|
||||
ctxt = schema.relaxNGNewValidCtxt()
|
||||
ret = doc.relaxNGValidateDoc(ctxt)
|
||||
del ctxt
|
||||
|
||||
except:
|
||||
ret = -1
|
||||
|
||||
doc.freeDoc()
|
||||
# if mem != libxml2.debugMemory(1):
|
||||
# print "validating instance %d line %d leaks" % (
|
||||
# nb_instances_tests, node.lineNo())
|
||||
|
||||
if ret == 0:
|
||||
log.write("\nFailed to detect validation problem in instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
else:
|
||||
nb_instances_success = nb_instances_success + 1
|
||||
|
||||
#
|
||||
# handle an incorrect test
|
||||
#
|
||||
def handle_correct(node):
|
||||
global log
|
||||
global nb_schemas_success
|
||||
global nb_schemas_failed
|
||||
|
||||
schema = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
schema = schema + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
|
||||
rngs = rngp.relaxNGParse()
|
||||
except:
|
||||
rngs = None
|
||||
if rngs == None:
|
||||
log.write("\nFailed to compile correct schema:\n-----\n")
|
||||
log.write(schema)
|
||||
log.write("\n-----\n")
|
||||
nb_schemas_failed = nb_schemas_failed + 1
|
||||
else:
|
||||
nb_schemas_success = nb_schemas_success + 1
|
||||
return rngs
|
||||
|
||||
def handle_incorrect(node):
|
||||
global log
|
||||
global nb_schemas_success
|
||||
global nb_schemas_failed
|
||||
|
||||
schema = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
schema = schema + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
|
||||
rngs = rngp.relaxNGParse()
|
||||
except:
|
||||
rngs = None
|
||||
if rngs != None:
|
||||
log.write("\nFailed to detect schema error in:\n-----\n")
|
||||
log.write(schema)
|
||||
log.write("\n-----\n")
|
||||
nb_schemas_failed = nb_schemas_failed + 1
|
||||
else:
|
||||
# log.write("\nSuccess detecting schema error in:\n-----\n")
|
||||
# log.write(schema)
|
||||
# log.write("\n-----\n")
|
||||
nb_schemas_success = nb_schemas_success + 1
|
||||
return None
|
||||
|
||||
#
|
||||
# resource handling: keep a dictionary of URL->string mappings
|
||||
#
|
||||
def handle_resource(node, dir):
|
||||
global resources
|
||||
|
||||
try:
|
||||
name = node.prop('name')
|
||||
except:
|
||||
name = None
|
||||
|
||||
if name == None or name == '':
|
||||
log.write("resource has no name")
|
||||
return;
|
||||
|
||||
if dir != None:
|
||||
# name = libxml2.buildURI(name, dir)
|
||||
name = dir + '/' + name
|
||||
|
||||
res = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
res = res + child.serialize()
|
||||
child = child.next
|
||||
resources[name] = res
|
||||
|
||||
#
|
||||
# dir handling: pseudo directory resources
|
||||
#
|
||||
def handle_dir(node, dir):
|
||||
try:
|
||||
name = node.prop('name')
|
||||
except:
|
||||
name = None
|
||||
|
||||
if name == None or name == '':
|
||||
log.write("resource has no name")
|
||||
return;
|
||||
|
||||
if dir != None:
|
||||
# name = libxml2.buildURI(name, dir)
|
||||
name = dir + '/' + name
|
||||
|
||||
dirs = node.xpathEval('dir')
|
||||
for dir in dirs:
|
||||
handle_dir(dir, name)
|
||||
res = node.xpathEval('resource')
|
||||
for r in res:
|
||||
handle_resource(r, name)
|
||||
|
||||
#
|
||||
# handle a testCase element
|
||||
#
|
||||
def handle_testCase(node):
|
||||
global nb_schemas_tests
|
||||
global nb_instances_tests
|
||||
global resources
|
||||
|
||||
sections = node.xpathEval('string(section)')
|
||||
log.write("\n ======== test %d line %d section %s ==========\n" % (
|
||||
|
||||
nb_schemas_tests, node.lineNo(), sections))
|
||||
resources = {}
|
||||
if debug:
|
||||
print "test %d line %d" % (nb_schemas_tests, node.lineNo())
|
||||
|
||||
dirs = node.xpathEval('dir')
|
||||
for dir in dirs:
|
||||
handle_dir(dir, None)
|
||||
res = node.xpathEval('resource')
|
||||
for r in res:
|
||||
handle_resource(r, None)
|
||||
|
||||
tsts = node.xpathEval('incorrect')
|
||||
if tsts != []:
|
||||
if len(tsts) != 1:
|
||||
print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
|
||||
schema = handle_incorrect(tsts[0])
|
||||
else:
|
||||
tsts = node.xpathEval('correct')
|
||||
if tsts != []:
|
||||
if len(tsts) != 1:
|
||||
print "warning test line %d has more than one <correct> example"% (node.lineNo())
|
||||
schema = handle_correct(tsts[0])
|
||||
else:
|
||||
print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
|
||||
|
||||
nb_schemas_tests = nb_schemas_tests + 1;
|
||||
|
||||
valids = node.xpathEval('valid')
|
||||
invalids = node.xpathEval('invalid')
|
||||
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
|
||||
if schema != None:
|
||||
for valid in valids:
|
||||
handle_valid(valid, schema)
|
||||
for invalid in invalids:
|
||||
handle_invalid(invalid, schema)
|
||||
|
||||
|
||||
#
|
||||
# handle a testSuite element
|
||||
#
|
||||
def handle_testSuite(node, level = 0):
|
||||
global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
|
||||
global nb_instances_tests, nb_instances_success, nb_instances_failed
|
||||
if verbose and level >= 0:
|
||||
old_schemas_tests = nb_schemas_tests
|
||||
old_schemas_success = nb_schemas_success
|
||||
old_schemas_failed = nb_schemas_failed
|
||||
old_instances_tests = nb_instances_tests
|
||||
old_instances_success = nb_instances_success
|
||||
old_instances_failed = nb_instances_failed
|
||||
|
||||
docs = node.xpathEval('documentation')
|
||||
authors = node.xpathEval('author')
|
||||
if docs != []:
|
||||
msg = ""
|
||||
for doc in docs:
|
||||
msg = msg + doc.content + " "
|
||||
if authors != []:
|
||||
msg = msg + "written by "
|
||||
for author in authors:
|
||||
msg = msg + author.content + " "
|
||||
if quiet == 0:
|
||||
print msg
|
||||
sections = node.xpathEval('section')
|
||||
if verbose and sections != [] and level <= 0:
|
||||
msg = ""
|
||||
for section in sections:
|
||||
msg = msg + section.content + " "
|
||||
if quiet == 0:
|
||||
print "Tests for section %s" % (msg)
|
||||
for test in node.xpathEval('testCase'):
|
||||
handle_testCase(test)
|
||||
for test in node.xpathEval('testSuite'):
|
||||
handle_testSuite(test, level + 1)
|
||||
|
||||
|
||||
if verbose and level >= 0 :
|
||||
if sections != []:
|
||||
msg = ""
|
||||
for section in sections:
|
||||
msg = msg + section.content + " "
|
||||
print "Result of tests for section %s" % (msg)
|
||||
elif docs != []:
|
||||
msg = ""
|
||||
for doc in docs:
|
||||
msg = msg + doc.content + " "
|
||||
print "Result of tests for %s" % (msg)
|
||||
|
||||
if nb_schemas_tests != old_schemas_tests:
|
||||
print "found %d test schemas: %d success %d failures" % (
|
||||
nb_schemas_tests - old_schemas_tests,
|
||||
nb_schemas_success - old_schemas_success,
|
||||
nb_schemas_failed - old_schemas_failed)
|
||||
if nb_instances_tests != old_instances_tests:
|
||||
print "found %d test instances: %d success %d failures" % (
|
||||
nb_instances_tests - old_instances_tests,
|
||||
nb_instances_success - old_instances_success,
|
||||
nb_instances_failed - old_instances_failed)
|
||||
#
|
||||
# Parse the conf file
|
||||
#
|
||||
libxml2.substituteEntitiesDefault(1);
|
||||
testsuite = libxml2.parseFile(CONF)
|
||||
|
||||
#
|
||||
# Error and warnng callbacks
|
||||
#
|
||||
def callback(ctx, str):
|
||||
global log
|
||||
log.write("%s%s" % (ctx, str))
|
||||
|
||||
libxml2.registerErrorHandler(callback, "")
|
||||
|
||||
libxml2.setEntityLoader(resolver)
|
||||
root = testsuite.getRootElement()
|
||||
if root.name != 'testSuite':
|
||||
print "%s doesn't start with a testSuite element, aborting" % (CONF)
|
||||
sys.exit(1)
|
||||
if quiet == 0:
|
||||
print "Running Relax NG testsuite"
|
||||
handle_testSuite(root)
|
||||
|
||||
if quiet == 0 or nb_schemas_failed != 0:
|
||||
print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
|
||||
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
|
||||
if quiet == 0 or nb_instances_failed != 0:
|
||||
print "found %d test instances: %d success %d failures" % (
|
||||
nb_instances_tests, nb_instances_success, nb_instances_failed)
|
||||
|
||||
testsuite.freeDoc()
|
||||
|
||||
# Memory debug specific
|
||||
libxml2.relaxNGCleanupTypes()
|
||||
libxml2.cleanupParser()
|
||||
if libxml2.debugMemory(1) == 0:
|
||||
if quiet == 0:
|
||||
print "OK"
|
||||
else:
|
||||
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
||||
libxml2.dumpMemory()
|
||||
@ -1,336 +0,0 @@
|
||||
/*
|
||||
* chvalid.c: this module implements the character range
|
||||
* validation APIs
|
||||
*
|
||||
* This file is automatically generated from the cvs source
|
||||
* definition files using the genChRanges.py Python script
|
||||
*
|
||||
* Generation date: Mon Mar 27 11:09:48 2006
|
||||
* Sources: chvalid.def
|
||||
* William Brack <wbrack@mmm.com.hk>
|
||||
*/
|
||||
|
||||
#define IN_LIBXML
|
||||
#include "libxml.h"
|
||||
#include <libxml/chvalid.h>
|
||||
|
||||
/*
|
||||
* The initial tables ({func_name}_tab) are used to validate whether a
|
||||
* single-byte character is within the specified group. Each table
|
||||
* contains 256 bytes, with each byte representing one of the 256
|
||||
* possible characters. If the table byte is set, the character is
|
||||
* allowed.
|
||||
*
|
||||
*/
|
||||
const unsigned char xmlIsPubidChar_tab[256] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
|
||||
0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
static const xmlChSRange xmlIsBaseChar_srng[] = { {0x100, 0x131},
|
||||
{0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3},
|
||||
{0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8},
|
||||
{0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c},
|
||||
{0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da},
|
||||
{0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3},
|
||||
{0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481},
|
||||
{0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb},
|
||||
{0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559},
|
||||
{0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a},
|
||||
{0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce},
|
||||
{0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939},
|
||||
{0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990},
|
||||
{0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9},
|
||||
{0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a},
|
||||
{0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33},
|
||||
{0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e},
|
||||
{0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91},
|
||||
{0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9},
|
||||
{0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10},
|
||||
{0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39},
|
||||
{0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a},
|
||||
{0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c},
|
||||
{0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5},
|
||||
{0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28},
|
||||
{0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c},
|
||||
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
|
||||
{0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
|
||||
{0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e},
|
||||
{0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82},
|
||||
{0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d},
|
||||
{0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5},
|
||||
{0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0},
|
||||
{0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47},
|
||||
{0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100},
|
||||
{0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c},
|
||||
{0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140},
|
||||
{0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155},
|
||||
{0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165},
|
||||
{0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173},
|
||||
{0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab},
|
||||
{0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2},
|
||||
{0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b},
|
||||
{0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
|
||||
{0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b},
|
||||
{0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc},
|
||||
{0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3},
|
||||
{0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
|
||||
{0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182},
|
||||
{0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}};
|
||||
const xmlChRangeGroup xmlIsBaseCharGroup =
|
||||
{197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0};
|
||||
|
||||
static const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff},
|
||||
{0xe000, 0xfffd}};
|
||||
static const xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}};
|
||||
const xmlChRangeGroup xmlIsCharGroup =
|
||||
{2, 1, xmlIsChar_srng, xmlIsChar_lrng};
|
||||
|
||||
static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345},
|
||||
{0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9},
|
||||
{0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4},
|
||||
{0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df},
|
||||
{0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903},
|
||||
{0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954},
|
||||
{0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be},
|
||||
{0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd},
|
||||
{0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c},
|
||||
{0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48},
|
||||
{0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc},
|
||||
{0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03},
|
||||
{0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d},
|
||||
{0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8},
|
||||
{0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44},
|
||||
{0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83},
|
||||
{0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6},
|
||||
{0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d},
|
||||
{0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e},
|
||||
{0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd},
|
||||
{0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39},
|
||||
{0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b},
|
||||
{0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7},
|
||||
{0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f},
|
||||
{0x3099, 0x3099}, {0x309a, 0x309a}};
|
||||
const xmlChRangeGroup xmlIsCombiningGroup =
|
||||
{95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0};
|
||||
|
||||
static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669},
|
||||
{0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f},
|
||||
{0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f},
|
||||
{0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
|
||||
{0xf20, 0xf29}};
|
||||
const xmlChRangeGroup xmlIsDigitGroup =
|
||||
{14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0};
|
||||
|
||||
static const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0},
|
||||
{0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46},
|
||||
{0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e},
|
||||
{0x30fc, 0x30fe}};
|
||||
const xmlChRangeGroup xmlIsExtenderGroup =
|
||||
{10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0};
|
||||
|
||||
static const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007},
|
||||
{0x3021, 0x3029}, {0x4e00, 0x9fa5}};
|
||||
const xmlChRangeGroup xmlIsIdeographicGroup =
|
||||
{3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0};
|
||||
|
||||
|
||||
/**
|
||||
* xmlCharInRange:
|
||||
* @val: character to be validated
|
||||
* @rptr: pointer to range to be used to validate
|
||||
*
|
||||
* Does a binary search of the range table to determine if char
|
||||
* is valid
|
||||
*
|
||||
* Returns: true if character valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
|
||||
int low, high, mid;
|
||||
const xmlChSRange *sptr;
|
||||
const xmlChLRange *lptr;
|
||||
|
||||
if (rptr == NULL) return(0);
|
||||
if (val < 0x10000) { /* is val in 'short' or 'long' array? */
|
||||
if (rptr->nbShortRange == 0)
|
||||
return 0;
|
||||
low = 0;
|
||||
high = rptr->nbShortRange - 1;
|
||||
sptr = rptr->shortRange;
|
||||
while (low <= high) {
|
||||
mid = (low + high) / 2;
|
||||
if ((unsigned short) val < sptr[mid].low) {
|
||||
high = mid - 1;
|
||||
} else {
|
||||
if ((unsigned short) val > sptr[mid].high) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (rptr->nbLongRange == 0) {
|
||||
return 0;
|
||||
}
|
||||
low = 0;
|
||||
high = rptr->nbLongRange - 1;
|
||||
lptr = rptr->longRange;
|
||||
while (low <= high) {
|
||||
mid = (low + high) / 2;
|
||||
if (val < lptr[mid].low) {
|
||||
high = mid - 1;
|
||||
} else {
|
||||
if (val > lptr[mid].high) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsBaseChar:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsBaseChar_ch or xmlIsBaseCharQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsBaseChar(unsigned int ch) {
|
||||
return(xmlIsBaseCharQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsBlank:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsBlank_ch or xmlIsBlankQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsBlank(unsigned int ch) {
|
||||
return(xmlIsBlankQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsChar:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsChar_ch or xmlIsCharQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsChar(unsigned int ch) {
|
||||
return(xmlIsCharQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsCombining:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsCombiningQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsCombining(unsigned int ch) {
|
||||
return(xmlIsCombiningQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsDigit:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsDigit_ch or xmlIsDigitQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsDigit(unsigned int ch) {
|
||||
return(xmlIsDigitQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsExtender:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsExtender_ch or xmlIsExtenderQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsExtender(unsigned int ch) {
|
||||
return(xmlIsExtenderQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsIdeographic:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsIdeographicQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsIdeographic(unsigned int ch) {
|
||||
return(xmlIsIdeographicQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsPubidChar:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsPubidChar_ch or xmlIsPubidCharQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsPubidChar(unsigned int ch) {
|
||||
return(xmlIsPubidCharQ(ch));
|
||||
}
|
||||
|
||||
#define bottom_chvalid
|
||||
#include "elfgcchack.h"
|
||||
@ -1,361 +0,0 @@
|
||||
name xmlIsChar
|
||||
ur 0x9
|
||||
ur 0xA
|
||||
ur 0xD
|
||||
ur 0x20..0xFF
|
||||
ur 0x0100..0xD7FF
|
||||
ur 0xE000..0xFFFD
|
||||
ur 0x10000..0x10FFFF
|
||||
end xmlIsChar
|
||||
|
||||
name xmlIsPubidChar
|
||||
ur 0x20 0x0d 0x0a 'a'..'z' 'A'..'Z' '0'..'9'
|
||||
ur '-' 0x27 '(' ')' '+' ',' '.' '/'
|
||||
ur ':' '=' '?' ';' '!' '*' '#' '@'
|
||||
ur '$' '_' '%'
|
||||
end
|
||||
|
||||
name xmlIsBlank
|
||||
ur 0x09 0x0a 0x0d 0x20
|
||||
end xmlIsBlank
|
||||
|
||||
name xmlIsBaseChar
|
||||
ur 0x0041..0x005A
|
||||
ur 0x0061..0x007A
|
||||
ur 0x00C0..0x00D6
|
||||
ur 0x00D8..0x00F6
|
||||
ur 0x00F8..0x00FF
|
||||
ur 0x0100..0x0131
|
||||
ur 0x0134..0x013E
|
||||
ur 0x0141..0x0148
|
||||
ur 0x014A..0x017E
|
||||
ur 0x0180..0x01C3
|
||||
ur 0x01CD..0x01F0
|
||||
ur 0x01F4..0x01F5
|
||||
ur 0x01FA..0x0217
|
||||
ur 0x0250..0x02A8
|
||||
ur 0x02BB..0x02C1
|
||||
ur 0x0386
|
||||
ur 0x0388..0x038A
|
||||
ur 0x038C
|
||||
ur 0x038E..0x03A1
|
||||
ur 0x03A3..0x03CE
|
||||
ur 0x03D0..0x03D6
|
||||
ur 0x03DA
|
||||
ur 0x03DC
|
||||
ur 0x03DE
|
||||
ur 0x03E0
|
||||
ur 0x03E2..0x03F3
|
||||
ur 0x0401..0x040C
|
||||
ur 0x040E..0x044F
|
||||
ur 0x0451..0x045C
|
||||
ur 0x045E..0x0481
|
||||
ur 0x0490..0x04C4
|
||||
ur 0x04C7..0x04C8
|
||||
ur 0x04CB..0x04CC
|
||||
ur 0x04D0..0x04EB
|
||||
ur 0x04EE..0x04F5
|
||||
ur 0x04F8..0x04F9
|
||||
ur 0x0531..0x0556
|
||||
ur 0x0559
|
||||
ur 0x0561..0x0586
|
||||
ur 0x05D0..0x05EA
|
||||
ur 0x05F0..0x05F2
|
||||
ur 0x0621..0x063A
|
||||
ur 0x0641..0x064A
|
||||
ur 0x0671..0x06B7
|
||||
ur 0x06BA..0x06BE
|
||||
ur 0x06C0..0x06CE
|
||||
ur 0x06D0..0x06D3
|
||||
ur 0x06D5
|
||||
ur 0x06E5..0x06E6
|
||||
ur 0x0905..0x0939
|
||||
ur 0x093D
|
||||
ur 0x0958..0x0961
|
||||
ur 0x0985..0x098C
|
||||
ur 0x098F..0x0990
|
||||
ur 0x0993..0x09A8
|
||||
ur 0x09AA..0x09B0
|
||||
ur 0x09B2
|
||||
ur 0x09B6..0x09B9
|
||||
ur 0x09DC..0x09DD
|
||||
ur 0x09DF..0x09E1
|
||||
ur 0x09F0..0x09F1
|
||||
ur 0x0A05..0x0A0A
|
||||
ur 0x0A0F..0x0A10
|
||||
ur 0x0A13..0x0A28
|
||||
ur 0x0A2A..0x0A30
|
||||
ur 0x0A32..0x0A33
|
||||
ur 0x0A35..0x0A36
|
||||
ur 0x0A38..0x0A39
|
||||
ur 0x0A59..0x0A5C
|
||||
ur 0x0A5E
|
||||
ur 0x0A72..0x0A74
|
||||
ur 0x0A85..0x0A8B
|
||||
ur 0x0A8D
|
||||
ur 0x0A8F..0x0A91
|
||||
ur 0x0A93..0x0AA8
|
||||
ur 0x0AAA..0x0AB0
|
||||
ur 0x0AB2..0x0AB3
|
||||
ur 0x0AB5..0x0AB9
|
||||
ur 0x0ABD
|
||||
ur 0x0AE0
|
||||
ur 0x0B05..0x0B0C
|
||||
ur 0x0B0F..0x0B10
|
||||
ur 0x0B13..0x0B28
|
||||
ur 0x0B2A..0x0B30
|
||||
ur 0x0B32..0x0B33
|
||||
ur 0x0B36..0x0B39
|
||||
ur 0x0B3D
|
||||
ur 0x0B5C..0x0B5D
|
||||
ur 0x0B5F..0x0B61
|
||||
ur 0x0B85..0x0B8A
|
||||
ur 0x0B8E..0x0B90
|
||||
ur 0x0B92..0x0B95
|
||||
ur 0x0B99..0x0B9A
|
||||
ur 0x0B9C
|
||||
ur 0x0B9E..0x0B9F
|
||||
ur 0x0BA3..0x0BA4
|
||||
ur 0x0BA8..0x0BAA
|
||||
ur 0x0BAE..0x0BB5
|
||||
ur 0x0BB7..0x0BB9
|
||||
ur 0x0C05..0x0C0C
|
||||
ur 0x0C0E..0x0C10
|
||||
ur 0x0C12..0x0C28
|
||||
ur 0x0C2A..0x0C33
|
||||
ur 0x0C35..0x0C39
|
||||
ur 0x0C60..0x0C61
|
||||
ur 0x0C85..0x0C8C
|
||||
ur 0x0C8E..0x0C90
|
||||
ur 0x0C92..0x0CA8
|
||||
ur 0x0CAA..0x0CB3
|
||||
ur 0x0CB5..0x0CB9
|
||||
ur 0x0CDE
|
||||
ur 0x0CE0..0x0CE1
|
||||
ur 0x0D05..0x0D0C
|
||||
ur 0x0D0E..0x0D10
|
||||
ur 0x0D12..0x0D28
|
||||
ur 0x0D2A..0x0D39
|
||||
ur 0x0D60..0x0D61
|
||||
ur 0x0E01..0x0E2E
|
||||
ur 0x0E30
|
||||
ur 0x0E32..0x0E33
|
||||
ur 0x0E40..0x0E45
|
||||
ur 0x0E81..0x0E82
|
||||
ur 0x0E84
|
||||
ur 0x0E87..0x0E88
|
||||
ur 0x0E8A
|
||||
ur 0x0E8D
|
||||
ur 0x0E94..0x0E97
|
||||
ur 0x0E99..0x0E9F
|
||||
ur 0x0EA1..0x0EA3
|
||||
ur 0x0EA5
|
||||
ur 0x0EA7
|
||||
ur 0x0EAA..0x0EAB
|
||||
ur 0x0EAD..0x0EAE
|
||||
ur 0x0EB0
|
||||
ur 0x0EB2..0x0EB3
|
||||
ur 0x0EBD
|
||||
ur 0x0EC0..0x0EC4
|
||||
ur 0x0F40..0x0F47
|
||||
ur 0x0F49..0x0F69
|
||||
ur 0x10A0..0x10C5
|
||||
ur 0x10D0..0x10F6
|
||||
ur 0x1100
|
||||
ur 0x1102..0x1103
|
||||
ur 0x1105..0x1107
|
||||
ur 0x1109
|
||||
ur 0x110B..0x110C
|
||||
ur 0x110E..0x1112
|
||||
ur 0x113C
|
||||
ur 0x113E
|
||||
ur 0x1140
|
||||
ur 0x114C
|
||||
ur 0x114E
|
||||
ur 0x1150
|
||||
ur 0x1154..0x1155
|
||||
ur 0x1159
|
||||
ur 0x115F..0x1161
|
||||
ur 0x1163
|
||||
ur 0x1165
|
||||
ur 0x1167
|
||||
ur 0x1169
|
||||
ur 0x116D..0x116E
|
||||
ur 0x1172..0x1173
|
||||
ur 0x1175
|
||||
ur 0x119E
|
||||
ur 0x11A8
|
||||
ur 0x11AB
|
||||
ur 0x11AE..0x11AF
|
||||
ur 0x11B7..0x11B8
|
||||
ur 0x11BA
|
||||
ur 0x11BC..0x11C2
|
||||
ur 0x11EB
|
||||
ur 0x11F0
|
||||
ur 0x11F9
|
||||
ur 0x1E00..0x1E9B
|
||||
ur 0x1EA0..0x1EF9
|
||||
ur 0x1F00..0x1F15
|
||||
ur 0x1F18..0x1F1D
|
||||
ur 0x1F20..0x1F45
|
||||
ur 0x1F48..0x1F4D
|
||||
ur 0x1F50..0x1F57
|
||||
ur 0x1F59
|
||||
ur 0x1F5B
|
||||
ur 0x1F5D
|
||||
ur 0x1F5F..0x1F7D
|
||||
ur 0x1F80..0x1FB4
|
||||
ur 0x1FB6..0x1FBC
|
||||
ur 0x1FBE
|
||||
ur 0x1FC2..0x1FC4
|
||||
ur 0x1FC6..0x1FCC
|
||||
ur 0x1FD0..0x1FD3
|
||||
ur 0x1FD6..0x1FDB
|
||||
ur 0x1FE0..0x1FEC
|
||||
ur 0x1FF2..0x1FF4
|
||||
ur 0x1FF6..0x1FFC
|
||||
ur 0x2126
|
||||
ur 0x212A..0x212B
|
||||
ur 0x212E
|
||||
ur 0x2180..0x2182
|
||||
ur 0x3041..0x3094
|
||||
ur 0x30A1..0x30FA
|
||||
ur 0x3105..0x312C
|
||||
ur 0xAC00..0xD7A3
|
||||
end xmlIsBaseChar
|
||||
|
||||
name xmlIsIdeographic
|
||||
ur 0x4E00..0x9FA5
|
||||
ur 0x3007
|
||||
ur 0x3021..0x3029
|
||||
end xmlIsIdeographic
|
||||
|
||||
name xmlIsCombining
|
||||
ur 0x0300..0x0345
|
||||
ur 0x0360..0x0361
|
||||
ur 0x0483..0x0486
|
||||
ur 0x0591..0x05A1
|
||||
ur 0x05A3..0x05B9
|
||||
ur 0x05BB..0x05BD
|
||||
ur 0x05BF
|
||||
ur 0x05C1..0x05C2
|
||||
ur 0x05C4
|
||||
ur 0x064B..0x0652
|
||||
ur 0x0670
|
||||
ur 0x06D6..0x06DC
|
||||
ur 0x06DD..0x06DF
|
||||
ur 0x06E0..0x06E4
|
||||
ur 0x06E7..0x06E8
|
||||
ur 0x06EA..0x06ED
|
||||
ur 0x0901..0x0903
|
||||
ur 0x093C
|
||||
ur 0x093E..0x094C
|
||||
ur 0x094D
|
||||
ur 0x0951..0x0954
|
||||
ur 0x0962..0x0963
|
||||
ur 0x0981..0x0983
|
||||
ur 0x09BC
|
||||
ur 0x09BE
|
||||
ur 0x09BF
|
||||
ur 0x09C0..0x09C4
|
||||
ur 0x09C7..0x09C8
|
||||
ur 0x09CB..0x09CD
|
||||
ur 0x09D7
|
||||
ur 0x09E2..0x09E3
|
||||
ur 0x0A02
|
||||
ur 0x0A3C
|
||||
ur 0x0A3E
|
||||
ur 0x0A3F
|
||||
ur 0x0A40..0x0A42
|
||||
ur 0x0A47..0x0A48
|
||||
ur 0x0A4B..0x0A4D
|
||||
ur 0x0A70..0x0A71
|
||||
ur 0x0A81..0x0A83
|
||||
ur 0x0ABC
|
||||
ur 0x0ABE..0x0AC5
|
||||
ur 0x0AC7..0x0AC9
|
||||
ur 0x0ACB..0x0ACD
|
||||
ur 0x0B01..0x0B03
|
||||
ur 0x0B3C
|
||||
ur 0x0B3E..0x0B43
|
||||
ur 0x0B47..0x0B48
|
||||
ur 0x0B4B..0x0B4D
|
||||
ur 0x0B56..0x0B57
|
||||
ur 0x0B82..0x0B83
|
||||
ur 0x0BBE..0x0BC2
|
||||
ur 0x0BC6..0x0BC8
|
||||
ur 0x0BCA..0x0BCD
|
||||
ur 0x0BD7
|
||||
ur 0x0C01..0x0C03
|
||||
ur 0x0C3E..0x0C44
|
||||
ur 0x0C46..0x0C48
|
||||
ur 0x0C4A..0x0C4D
|
||||
ur 0x0C55..0x0C56
|
||||
ur 0x0C82..0x0C83
|
||||
ur 0x0CBE..0x0CC4
|
||||
ur 0x0CC6..0x0CC8
|
||||
ur 0x0CCA..0x0CCD
|
||||
ur 0x0CD5..0x0CD6
|
||||
ur 0x0D02..0x0D03
|
||||
ur 0x0D3E..0x0D43
|
||||
ur 0x0D46..0x0D48
|
||||
ur 0x0D4A..0x0D4D
|
||||
ur 0x0D57
|
||||
ur 0x0E31
|
||||
ur 0x0E34..0x0E3A
|
||||
ur 0x0E47..0x0E4E
|
||||
ur 0x0EB1
|
||||
ur 0x0EB4..0x0EB9
|
||||
ur 0x0EBB..0x0EBC
|
||||
ur 0x0EC8..0x0ECD
|
||||
ur 0x0F18..0x0F19
|
||||
ur 0x0F35
|
||||
ur 0x0F37
|
||||
ur 0x0F39
|
||||
ur 0x0F3E
|
||||
ur 0x0F3F
|
||||
ur 0x0F71..0x0F84
|
||||
ur 0x0F86..0x0F8B
|
||||
ur 0x0F90..0x0F95
|
||||
ur 0x0F97
|
||||
ur 0x0F99..0x0FAD
|
||||
ur 0x0FB1..0x0FB7
|
||||
ur 0x0FB9
|
||||
ur 0x20D0..0x20DC
|
||||
ur 0x20E1
|
||||
ur 0x302A..0x302F
|
||||
ur 0x3099
|
||||
ur 0x309A
|
||||
end xmlIsCombining
|
||||
|
||||
name xmlIsDigit
|
||||
ur 0x0030..0x0039
|
||||
ur 0x0660..0x0669
|
||||
ur 0x06F0..0x06F9
|
||||
ur 0x0966..0x096F
|
||||
ur 0x09E6..0x09EF
|
||||
ur 0x0A66..0x0A6F
|
||||
ur 0x0AE6..0x0AEF
|
||||
ur 0x0B66..0x0B6F
|
||||
ur 0x0BE7..0x0BEF
|
||||
ur 0x0C66..0x0C6F
|
||||
ur 0x0CE6..0x0CEF
|
||||
ur 0x0D66..0x0D6F
|
||||
ur 0x0E50..0x0E59
|
||||
ur 0x0ED0..0x0ED9
|
||||
ur 0x0F20..0x0F29
|
||||
end xmlIsDigit
|
||||
|
||||
name xmlIsExtender
|
||||
ur 0x00B7
|
||||
ur 0x02D0
|
||||
ur 0x02D1
|
||||
ur 0x0387
|
||||
ur 0x0640
|
||||
ur 0x0E46
|
||||
ur 0x0EC6
|
||||
ur 0x3005
|
||||
ur 0x3031..0x3035
|
||||
ur 0x309D..0x309E
|
||||
ur 0x30FC..0x30FE
|
||||
end xmlIsExtender
|
||||
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
$size = shift;
|
||||
|
||||
if ($size eq "")
|
||||
{
|
||||
die "usage: dbgen.pl [size]\n";
|
||||
}
|
||||
|
||||
@firstnames = ("Al", "Bob", "Charles", "David", "Egon", "Farbood",
|
||||
"George", "Hank", "Inki", "James");
|
||||
@lastnames = ("Aranow", "Barker", "Corsetti", "Dershowitz", "Engleman",
|
||||
"Franklin", "Grice", "Haverford", "Ilvedson", "Jones");
|
||||
@states = ("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
|
||||
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
|
||||
"MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
|
||||
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
|
||||
"SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY");
|
||||
|
||||
print "<?xml version=\"1.0\"?>\n";
|
||||
print "\n";
|
||||
print "<table>\n";
|
||||
|
||||
for ($i=0; $i<$size; $i++)
|
||||
{
|
||||
$first = $firstnames [$i % 10];
|
||||
$last = $lastnames [($i / 10) % 10];
|
||||
$state = $states [($i / 100) % 50];
|
||||
$zip = 22000 + $i / 5000;
|
||||
|
||||
printf " <row>\n";
|
||||
printf " <id>%04d</id>\n", $i;
|
||||
printf " <firstname>$first</firstname>\n", $i;
|
||||
printf " <lastname>$last</lastname>\n", $i;
|
||||
printf " <street>%d Any St.</street>\n", ($i % 100) + 1;
|
||||
printf " <city>Anytown</city>\n";
|
||||
printf " <state>$state</state>\n";
|
||||
printf " <zip>%d</zip>\n", $zip;
|
||||
printf " </row>\n";
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
$size = shift;
|
||||
|
||||
if ($size eq "")
|
||||
{
|
||||
die "usage: dbgen.pl [size]\n";
|
||||
}
|
||||
|
||||
@firstnames = ("Al", "Bob", "Charles", "David", "Egon", "Farbood",
|
||||
"George", "Hank", "Inki", "James");
|
||||
@lastnames = ("Aranow", "Barker", "Corsetti", "Dershowitz", "Engleman",
|
||||
"Franklin", "Grice", "Haverford", "Ilvedson", "Jones");
|
||||
@states = ("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
|
||||
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
|
||||
"MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
|
||||
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
|
||||
"SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY");
|
||||
|
||||
print "<?xml version=\"1.0\"?>\n";
|
||||
print "\n";
|
||||
print "<table>\n";
|
||||
|
||||
for ($i=0; $i<$size; $i++)
|
||||
{
|
||||
$first = $firstnames [$i % 10];
|
||||
$last = $lastnames [($i / 10) % 10];
|
||||
$state = $states [($i / 100) % 50];
|
||||
$zip = 22000 + $i / 5000;
|
||||
|
||||
printf " <row\n";
|
||||
printf " id='%04d'\n", $i;
|
||||
printf " firstname='$first'\n", $i;
|
||||
printf " lastname='$last'\n", $i;
|
||||
printf " street='%d Any St.'\n", ($i % 100) + 1;
|
||||
printf " city='Anytown'\n";
|
||||
printf " state='$state'\n";
|
||||
printf " zip='%d'/>\n", $zip;
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user