Kitxuuu commited on
Commit
6fb3c1a
·
verified ·
1 Parent(s): c759c22

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. local-test-libxml2-delta-02/afc-libxml2/doc/Makefile.am +28 -0
  2. local-test-libxml2-delta-02/afc-libxml2/doc/apibuild.py +1930 -0
  3. local-test-libxml2-delta-02/afc-libxml2/doc/libxml2-api.xml +0 -0
  4. local-test-libxml2-delta-02/afc-libxml2/doc/meson.build +12 -0
  5. local-test-libxml2-delta-02/afc-libxml2/doc/xmllint.1 +686 -0
  6. local-test-libxml2-delta-02/afc-libxml2/test/att11 +13 -0
  7. local-test-libxml2-delta-02/afc-libxml2/test/att7 +10 -0
  8. local-test-libxml2-delta-02/afc-libxml2/test/att9 +5 -0
  9. local-test-libxml2-delta-02/afc-libxml2/test/attrib.xml +1 -0
  10. local-test-libxml2-delta-02/afc-libxml2/test/boundaries1.xml +16 -0
  11. local-test-libxml2-delta-02/afc-libxml2/test/cdata-3-byte-UTF-8.xml +7 -0
  12. local-test-libxml2-delta-02/afc-libxml2/test/comment2.xml +6 -0
  13. local-test-libxml2-delta-02/afc-libxml2/test/dav1 +25 -0
  14. local-test-libxml2-delta-02/afc-libxml2/test/dav12 +2 -0
  15. local-test-libxml2-delta-02/afc-libxml2/test/dav13 +16 -0
  16. local-test-libxml2-delta-02/afc-libxml2/test/dav19 +18 -0
  17. local-test-libxml2-delta-02/afc-libxml2/test/dav7 +16 -0
  18. local-test-libxml2-delta-02/afc-libxml2/test/def-xml-attr.xml +7 -0
  19. local-test-libxml2-delta-02/afc-libxml2/test/defattr2.xml +8 -0
  20. local-test-libxml2-delta-02/afc-libxml2/test/dtd11 +5 -0
  21. local-test-libxml2-delta-02/afc-libxml2/test/dtd12 +5 -0
  22. local-test-libxml2-delta-02/afc-libxml2/test/dtd13 +6 -0
  23. local-test-libxml2-delta-02/afc-libxml2/test/dtd7 +6 -0
  24. local-test-libxml2-delta-02/afc-libxml2/test/ent1 +7 -0
  25. local-test-libxml2-delta-02/afc-libxml2/test/ent13 +6 -0
  26. local-test-libxml2-delta-02/afc-libxml2/test/ent9 +61 -0
  27. local-test-libxml2-delta-02/afc-libxml2/test/japancrlf.xml +6 -0
  28. local-test-libxml2-delta-02/afc-libxml2/test/ns2 +3 -0
  29. local-test-libxml2-delta-02/afc-libxml2/test/svg2 +58 -0
  30. local-test-libxml2-delta-02/afc-libxml2/test/svg3 +0 -0
  31. local-test-libxml2-delta-02/afc-libxml2/test/utf16bom.xml +0 -0
  32. local-test-libxml2-delta-02/afc-libxml2/test/wap.xml +27 -0
  33. local-test-libxml2-delta-02/afc-libxml2/test/xhtml1 +34 -0
  34. local-test-libxml2-delta-02/afc-libxml2/test/xml2 +8 -0
  35. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/Dockerfile +26 -0
  36. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_build +28 -0
  37. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_install_dependencies +22 -0
  38. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_measure +32 -0
  39. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_run_fuzzer +41 -0
  40. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-go/Dockerfile +33 -0
  41. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-go/gosigfuzz.c +47 -0
  42. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-go/ossfuzz_coverage_runner.go +80 -0
  43. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-javascript/Dockerfile +20 -0
  44. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-jvm/Dockerfile +68 -0
  45. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-python/Dockerfile +20 -0
  46. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-ruby/Dockerfile +56 -0
  47. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-ruby/ruzzy-build +28 -0
  48. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-rust/Dockerfile +37 -0
  49. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-swift/Dockerfile +22 -0
  50. local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-swift/precompile_swift +33 -0
local-test-libxml2-delta-02/afc-libxml2/doc/Makefile.am ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Process this file with automake to produce Makefile.in
2
+ SUBDIRS = . devhelp
3
+
4
+ nobase_dist_doc_DATA = \
5
+ xmlcatalog.html \
6
+ xmllint.html
7
+
8
+ dist_man_MANS = xml2-config.1 xmllint.1 xmlcatalog.1
9
+
10
+ EXTRA_DIST = \
11
+ apibuild.py \
12
+ libxml2-api.xml \
13
+ xmlcatalog.xml \
14
+ xmllint.xml \
15
+ meson.build
16
+
17
+ DOCBOOK_HTML = http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
18
+
19
+ rebuild:
20
+ cd $(srcdir) && ./apibuild.py
21
+ cd $(srcdir) && $(XSLTPROC) --nonet xmllint.xml
22
+ cd $(srcdir) && $(XSLTPROC) --nonet -o xmllint.html $(DOCBOOK_HTML) xmllint.xml
23
+ cd $(srcdir) && $(XSLTPROC) --nonet xmlcatalog.xml
24
+ cd $(srcdir) && $(XSLTPROC) --nonet -o xmlcatalog.html $(DOCBOOK_HTML) xmlcatalog.xml
25
+ cd devhelp && $(MAKE) rebuild
26
+ cd .. && $(MAKE) rebuild_testapi
27
+
28
+ .PHONY: rebuild
local-test-libxml2-delta-02/afc-libxml2/doc/apibuild.py ADDED
@@ -0,0 +1,1930 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ #
3
+ # This is the API builder, it parses the C sources and build the
4
+ # API formal description in XML.
5
+ #
6
+ # See Copyright for the status of this software.
7
+ #
8
+ # daniel@veillard.com
9
+ #
10
+ import os, sys
11
+ import string
12
+ import glob
13
+
14
+ debug=0
15
+ #debugsym='ignorableWhitespaceSAXFunc'
16
+ debugsym=None
17
+
18
+ #
19
+ # C parser analysis code
20
+ #
21
+ ignored_files = {
22
+ "config.h": "generated portability layer",
23
+ "libxml.h": "internal only",
24
+ "legacy.c": "legacy code",
25
+ "testModule.c": "test tool",
26
+ "testapi.c": "generated regression tests",
27
+ "runtest.c": "regression tests program",
28
+ "runsuite.c": "regression tests program",
29
+ "tst.c": "not part of the library",
30
+ "test.c": "not part of the library",
31
+ "testdso.c": "test for dynamid shared libraries",
32
+ "testrecurse.c": "test for entities recursions",
33
+ "timsort.h": "Internal header only for xpath.c 2.9.0",
34
+ "nanoftp.h": "empty",
35
+ "SAX.h": "empty",
36
+ }
37
+
38
+ ignored_words = {
39
+ "WINAPI": (0, "Windows keyword"),
40
+ "LIBXML_DLL_IMPORT": (0, "Special macro to flag external keywords"),
41
+ "XMLPUBVAR": (0, "Special macro for extern vars for win32"),
42
+ "XSLTPUBVAR": (0, "Special macro for extern vars for win32"),
43
+ "EXSLTPUBVAR": (0, "Special macro for extern vars for win32"),
44
+ "XMLPUBFUN": (0, "Special macro for extern funcs for win32"),
45
+ "XSLTPUBFUN": (0, "Special macro for extern funcs for win32"),
46
+ "EXSLTPUBFUN": (0, "Special macro for extern funcs for win32"),
47
+ "XSLTCALL": (0, "Special macro for win32 calls"),
48
+ "EXSLTCALL": (0, "Special macro for win32 calls"),
49
+ "__declspec": (3, "Windows keyword"),
50
+ "__stdcall": (0, "Windows keyword"),
51
+ "ATTRIBUTE_UNUSED": (0, "macro keyword"),
52
+ "ATTRIBUTE_DESTRUCTOR": (0, "macro keyword"),
53
+ "LIBEXSLT_PUBLIC": (0, "macro keyword"),
54
+ "X_IN_Y": (5, "macro function builder"),
55
+ "ATTRIBUTE_ALLOC_SIZE": (3, "macro for gcc checking extension"),
56
+ "ATTRIBUTE_PRINTF": (5, "macro for gcc printf args checking extension"),
57
+ "LIBXML_ATTR_FORMAT": (5, "macro for gcc printf args checking extension"),
58
+ "LIBXML_ATTR_ALLOC_SIZE": (3, "macro for gcc checking extension"),
59
+ "ATTRIBUTE_NO_SANITIZE": (3, "macro keyword"),
60
+ "ATTRIBUTE_NO_SANITIZE_INTEGER": (0, "macro keyword"),
61
+ "ATTRIBUTE_COUNTED_BY": (3, "macro keyword"),
62
+ "XML_DEPRECATED": (0, "macro keyword"),
63
+ "XML_DEPRECATED_MEMBER": (0, "macro keyword"),
64
+ "XML_GLOBALS_ALLOC": (0, "macro keyword"),
65
+ "XML_GLOBALS_ERROR": (0, "macro keyword"),
66
+ "XML_GLOBALS_IO": (0, "macro keyword"),
67
+ "XML_GLOBALS_PARSER": (0, "macro keyword"),
68
+ "XML_GLOBALS_TREE": (0, "macro keyword"),
69
+ "XML_THREAD_LOCAL": (0, "macro keyword"),
70
+ }
71
+
72
+ def escape(raw):
73
+ raw = raw.replace('&', '&')
74
+ raw = raw.replace('<', '&lt;')
75
+ raw = raw.replace('>', '&gt;')
76
+ raw = raw.replace("'", '&apos;')
77
+ raw = raw.replace('"', '&quot;')
78
+ return raw
79
+
80
+ class identifier:
81
+ def __init__(self, name, header=None, module=None, type=None, lineno = 0,
82
+ info=None, extra=None, conditionals = None):
83
+ self.name = name
84
+ self.header = header
85
+ self.module = module
86
+ self.type = type
87
+ self.info = info
88
+ self.extra = extra
89
+ self.lineno = lineno
90
+ self.static = 0
91
+ if conditionals == None or len(conditionals) == 0:
92
+ self.conditionals = None
93
+ else:
94
+ self.conditionals = conditionals[:]
95
+ if self.name == debugsym:
96
+ print("=> define %s : %s" % (debugsym, (module, type, info,
97
+ extra, conditionals)))
98
+
99
+ def __repr__(self):
100
+ r = "%s %s:" % (self.type, self.name)
101
+ if self.static:
102
+ r = r + " static"
103
+ if self.module != None:
104
+ r = r + " from %s" % (self.module)
105
+ if self.info != None:
106
+ r = r + " " + repr(self.info)
107
+ if self.extra != None:
108
+ r = r + " " + repr(self.extra)
109
+ if self.conditionals != None:
110
+ r = r + " " + repr(self.conditionals)
111
+ return r
112
+
113
+
114
+ def set_header(self, header):
115
+ self.header = header
116
+ def set_module(self, module):
117
+ self.module = module
118
+ def set_type(self, type):
119
+ self.type = type
120
+ def set_info(self, info):
121
+ self.info = info
122
+ def set_extra(self, extra):
123
+ self.extra = extra
124
+ def set_lineno(self, lineno):
125
+ self.lineno = lineno
126
+ def set_static(self, static):
127
+ self.static = static
128
+ def set_conditionals(self, conditionals):
129
+ if conditionals == None or len(conditionals) == 0:
130
+ self.conditionals = None
131
+ else:
132
+ self.conditionals = conditionals[:]
133
+
134
+ def get_name(self):
135
+ return self.name
136
+ def get_header(self):
137
+ return self.module
138
+ def get_module(self):
139
+ return self.module
140
+ def get_type(self):
141
+ return self.type
142
+ def get_info(self):
143
+ return self.info
144
+ def get_lineno(self):
145
+ return self.lineno
146
+ def get_extra(self):
147
+ return self.extra
148
+ def get_static(self):
149
+ return self.static
150
+ def get_conditionals(self):
151
+ return self.conditionals
152
+
153
+ def update(self, header, module, type = None, info = None, extra=None,
154
+ conditionals=None):
155
+ if self.name == debugsym:
156
+ print("=> update %s : %s" % (debugsym, (module, type, info,
157
+ extra, conditionals)))
158
+ if header != None and self.header == None:
159
+ self.set_header(module)
160
+ if module != None and (self.module == None or self.header == self.module):
161
+ self.set_module(module)
162
+ if type != None and self.type == None:
163
+ self.set_type(type)
164
+ if info != None:
165
+ self.set_info(info)
166
+ if extra != None:
167
+ self.set_extra(extra)
168
+ if conditionals != None:
169
+ self.set_conditionals(conditionals)
170
+
171
+ class index:
172
+ def __init__(self, name = "noname"):
173
+ self.name = name
174
+ self.identifiers = {}
175
+ self.functions = {}
176
+ self.variables = {}
177
+ self.includes = {}
178
+ self.structs = {}
179
+ self.enums = {}
180
+ self.typedefs = {}
181
+ self.macros = {}
182
+ self.references = {}
183
+ self.info = {}
184
+
185
+ def add_ref(self, name, header, module, static, type, lineno, info=None, extra=None, conditionals = None):
186
+ if name[0:2] == '__':
187
+ return None
188
+ d = None
189
+ if name in self.identifiers:
190
+ d = self.identifiers[name]
191
+ d.update(header, module, type, info, extra, conditionals)
192
+ else:
193
+ d = identifier(name, header, module, type, lineno, info, extra, conditionals)
194
+ self.identifiers[name] = d
195
+
196
+ if d != None and static == 1:
197
+ d.set_static(1)
198
+
199
+ if d != None and name != None and type != None:
200
+ self.references[name] = d
201
+
202
+ if name == debugsym:
203
+ print("New ref: %s" % (d))
204
+
205
+ return d
206
+
207
+ def add(self, name, header, module, static, type, lineno, info=None, extra=None, conditionals = None):
208
+ if name[0:2] == '__':
209
+ return None
210
+ d = None
211
+ if name in self.identifiers:
212
+ d = self.identifiers[name]
213
+ d.update(header, module, type, info, extra, conditionals)
214
+ else:
215
+ d = identifier(name, header, module, type, lineno, info, extra, conditionals)
216
+ self.identifiers[name] = d
217
+
218
+ if d != None and static == 1:
219
+ d.set_static(1)
220
+
221
+ if d != None and name != None and type != None:
222
+ if type == "function":
223
+ self.functions[name] = d
224
+ elif type == "functype":
225
+ self.functions[name] = d
226
+ elif type == "variable":
227
+ self.variables[name] = d
228
+ elif type == "include":
229
+ self.includes[name] = d
230
+ elif type == "struct":
231
+ self.structs[name] = d
232
+ elif type == "enum":
233
+ self.enums[name] = d
234
+ elif type == "typedef":
235
+ self.typedefs[name] = d
236
+ elif type == "macro":
237
+ self.macros[name] = d
238
+ else:
239
+ print("Unable to register type ", type)
240
+
241
+ if name == debugsym:
242
+ print("New symbol: %s" % (d))
243
+
244
+ return d
245
+
246
+ def merge(self, idx):
247
+ for id in list(idx.functions.keys()):
248
+ #
249
+ # macro might be used to override functions or variables
250
+ # definitions
251
+ #
252
+ if id in self.macros:
253
+ del self.macros[id]
254
+ if id in self.functions:
255
+ print("function %s from %s redeclared in %s" % (
256
+ id, self.functions[id].header, idx.functions[id].header))
257
+ else:
258
+ self.functions[id] = idx.functions[id]
259
+ self.identifiers[id] = idx.functions[id]
260
+ for id in list(idx.variables.keys()):
261
+ #
262
+ # macro might be used to override functions or variables
263
+ # definitions
264
+ #
265
+ if id in self.macros:
266
+ del self.macros[id]
267
+ if id in self.variables:
268
+ print("variable %s from %s redeclared in %s" % (
269
+ id, self.variables[id].header, idx.variables[id].header))
270
+ else:
271
+ self.variables[id] = idx.variables[id]
272
+ self.identifiers[id] = idx.variables[id]
273
+ for id in list(idx.structs.keys()):
274
+ if id in self.structs:
275
+ print("struct %s from %s redeclared in %s" % (
276
+ id, self.structs[id].header, idx.structs[id].header))
277
+ else:
278
+ self.structs[id] = idx.structs[id]
279
+ self.identifiers[id] = idx.structs[id]
280
+ for id in list(idx.typedefs.keys()):
281
+ if id in self.typedefs:
282
+ print("typedef %s from %s redeclared in %s" % (
283
+ id, self.typedefs[id].header, idx.typedefs[id].header))
284
+ else:
285
+ self.typedefs[id] = idx.typedefs[id]
286
+ self.identifiers[id] = idx.typedefs[id]
287
+ for id in list(idx.macros.keys()):
288
+ #
289
+ # macro might be used to override functions or variables
290
+ # definitions
291
+ #
292
+ if id in self.variables:
293
+ continue
294
+ if id in self.functions:
295
+ continue
296
+ if id in self.enums:
297
+ continue
298
+ if id in self.macros and id != 'XML_OP':
299
+ print("macro %s from %s redeclared in %s" % (
300
+ id, self.macros[id].header, idx.macros[id].header))
301
+ else:
302
+ self.macros[id] = idx.macros[id]
303
+ self.identifiers[id] = idx.macros[id]
304
+ for id in list(idx.enums.keys()):
305
+ if id in self.enums:
306
+ print("enum %s from %s redeclared in %s" % (
307
+ id, self.enums[id].header, idx.enums[id].header))
308
+ else:
309
+ self.enums[id] = idx.enums[id]
310
+ self.identifiers[id] = idx.enums[id]
311
+
312
+ def merge_public(self, idx):
313
+ for id in list(idx.functions.keys()):
314
+ if id in self.functions:
315
+ # check that function condition agrees with header
316
+ if idx.functions[id].conditionals != \
317
+ self.functions[id].conditionals:
318
+ print("Header condition differs from Function for %s:" \
319
+ % id)
320
+ print(" H: %s" % self.functions[id].conditionals)
321
+ print(" C: %s" % idx.functions[id].conditionals)
322
+ up = idx.functions[id]
323
+ self.functions[id].update(None, up.module, up.type, up.info, up.extra)
324
+ # else:
325
+ # print "Function %s from %s is not declared in headers" % (
326
+ # id, idx.functions[id].module)
327
+
328
+ for id in list(idx.variables.keys()):
329
+ if id in self.variables:
330
+ # check that variable condition agrees with header
331
+ # TODO: produces many false positives
332
+ #if idx.variables[id].conditionals != \
333
+ # self.variables[id].conditionals:
334
+ # print("Header condition differs from Variable for %s:" \
335
+ # % id)
336
+ # print(" H: %s" % self.variables[id].conditionals)
337
+ # print(" C: %s" % idx.variables[id].conditionals)
338
+ up = idx.variables[id]
339
+ self.variables[id].update(None, up.module, up.type, up.info, up.extra)
340
+
341
+ def analyze_dict(self, type, dict):
342
+ count = 0
343
+ public = 0
344
+ for name in list(dict.keys()):
345
+ id = dict[name]
346
+ count = count + 1
347
+ if id.static == 0:
348
+ public = public + 1
349
+ if count != public:
350
+ print(" %d %s , %d public" % (count, type, public))
351
+ elif count != 0:
352
+ print(" %d public %s" % (count, type))
353
+
354
+
355
+ def analyze(self):
356
+ self.analyze_dict("functions", self.functions)
357
+ self.analyze_dict("variables", self.variables)
358
+ self.analyze_dict("structs", self.structs)
359
+ self.analyze_dict("typedefs", self.typedefs)
360
+ self.analyze_dict("macros", self.macros)
361
+
362
+ class CLexer:
363
+ """A lexer for the C language, tokenize the input by reading and
364
+ analyzing it line by line"""
365
+ def __init__(self, input):
366
+ self.input = input
367
+ self.tokens = []
368
+ self.line = ""
369
+ self.lineno = 0
370
+
371
+ def getline(self):
372
+ line = ''
373
+ while line == '':
374
+ line = self.input.readline()
375
+ if not line:
376
+ return None
377
+ self.lineno = self.lineno + 1
378
+ line = line.lstrip()
379
+ line = line.rstrip()
380
+ if line == '':
381
+ continue
382
+ while line[-1] == '\\':
383
+ line = line[:-1]
384
+ n = self.input.readline()
385
+ self.lineno = self.lineno + 1
386
+ n = n.lstrip()
387
+ n = n.rstrip()
388
+ if not n:
389
+ break
390
+ else:
391
+ line = line + n
392
+ return line
393
+
394
+ def getlineno(self):
395
+ return self.lineno
396
+
397
+ def push(self, token):
398
+ self.tokens.insert(0, token);
399
+
400
+ def debug(self):
401
+ print("Last token: ", self.last)
402
+ print("Token queue: ", self.tokens)
403
+ print("Line %d end: " % (self.lineno), self.line)
404
+
405
+ def token(self):
406
+ while self.tokens == []:
407
+ if self.line == "":
408
+ line = self.getline()
409
+ else:
410
+ line = self.line
411
+ self.line = ""
412
+ if line == None:
413
+ return None
414
+
415
+ if line[0] == '#':
416
+ self.tokens = list(map((lambda x: ('preproc', x)),
417
+ line.split()))
418
+ break;
419
+ l = len(line)
420
+ if line[0] == '"' or line[0] == "'":
421
+ end = line[0]
422
+ line = line[1:]
423
+ found = 0
424
+ tok = ""
425
+ while found == 0:
426
+ i = 0
427
+ l = len(line)
428
+ while i < l:
429
+ if line[i] == end:
430
+ self.line = line[i+1:]
431
+ line = line[:i]
432
+ l = i
433
+ found = 1
434
+ break
435
+ if line[i] == '\\':
436
+ i = i + 1
437
+ i = i + 1
438
+ tok = tok + line
439
+ if found == 0:
440
+ line = self.getline()
441
+ if line == None:
442
+ return None
443
+ self.last = ('string', tok)
444
+ return self.last
445
+
446
+ if l >= 2 and line[0] == '/' and line[1] == '*':
447
+ line = line[2:]
448
+ found = 0
449
+ tok = ""
450
+ while found == 0:
451
+ i = 0
452
+ l = len(line)
453
+ while i < l:
454
+ if line[i] == '*' and i+1 < l and line[i+1] == '/':
455
+ self.line = line[i+2:]
456
+ line = line[:i-1]
457
+ l = i
458
+ found = 1
459
+ break
460
+ i = i + 1
461
+ if tok != "":
462
+ tok = tok + "\n"
463
+ tok = tok + line
464
+ if found == 0:
465
+ line = self.getline()
466
+ if line == None:
467
+ return None
468
+ self.last = ('comment', tok)
469
+ return self.last
470
+ if l >= 2 and line[0] == '/' and line[1] == '/':
471
+ line = line[2:]
472
+ self.last = ('comment', line)
473
+ return self.last
474
+ i = 0
475
+ while i < l:
476
+ if line[i] == '/' and i+1 < l and line[i+1] == '/':
477
+ self.line = line[i:]
478
+ line = line[:i]
479
+ break
480
+ if line[i] == '/' and i+1 < l and line[i+1] == '*':
481
+ self.line = line[i:]
482
+ line = line[:i]
483
+ break
484
+ if line[i] == '"' or line[i] == "'":
485
+ self.line = line[i:]
486
+ line = line[:i]
487
+ break
488
+ i = i + 1
489
+ l = len(line)
490
+ i = 0
491
+ while i < l:
492
+ if line[i] == ' ' or line[i] == '\t':
493
+ i = i + 1
494
+ continue
495
+ o = ord(line[i])
496
+ if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \
497
+ (o >= 48 and o <= 57):
498
+ s = i
499
+ while i < l:
500
+ o = ord(line[i])
501
+ if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \
502
+ (o >= 48 and o <= 57) or \
503
+ (" \t(){}:;,+-*/%&!|[]=><".find(line[i])) == -1:
504
+ i = i + 1
505
+ else:
506
+ break
507
+ self.tokens.append(('name', line[s:i]))
508
+ continue
509
+ if "(){}:;,[]".find(line[i]) != -1:
510
+ # if line[i] == '(' or line[i] == ')' or line[i] == '{' or \
511
+ # line[i] == '}' or line[i] == ':' or line[i] == ';' or \
512
+ # line[i] == ',' or line[i] == '[' or line[i] == ']':
513
+ self.tokens.append(('sep', line[i]))
514
+ i = i + 1
515
+ continue
516
+ if "+-*><=/%&!|.".find(line[i]) != -1:
517
+ # if line[i] == '+' or line[i] == '-' or line[i] == '*' or \
518
+ # line[i] == '>' or line[i] == '<' or line[i] == '=' or \
519
+ # line[i] == '/' or line[i] == '%' or line[i] == '&' or \
520
+ # line[i] == '!' or line[i] == '|' or line[i] == '.':
521
+ if line[i] == '.' and i + 2 < l and \
522
+ line[i+1] == '.' and line[i+2] == '.':
523
+ self.tokens.append(('name', '...'))
524
+ i = i + 3
525
+ continue
526
+
527
+ j = i + 1
528
+ if j < l and (
529
+ "+-*><=/%&!|".find(line[j]) != -1):
530
+ # line[j] == '+' or line[j] == '-' or line[j] == '*' or \
531
+ # line[j] == '>' or line[j] == '<' or line[j] == '=' or \
532
+ # line[j] == '/' or line[j] == '%' or line[j] == '&' or \
533
+ # line[j] == '!' or line[j] == '|'):
534
+ self.tokens.append(('op', line[i:j+1]))
535
+ i = j + 1
536
+ else:
537
+ self.tokens.append(('op', line[i]))
538
+ i = i + 1
539
+ continue
540
+ s = i
541
+ while i < l:
542
+ o = ord(line[i])
543
+ if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \
544
+ (o >= 48 and o <= 57) or (
545
+ " \t(){}:;,+-*/%&!|[]=><".find(line[i]) == -1):
546
+ # line[i] != ' ' and line[i] != '\t' and
547
+ # line[i] != '(' and line[i] != ')' and
548
+ # line[i] != '{' and line[i] != '}' and
549
+ # line[i] != ':' and line[i] != ';' and
550
+ # line[i] != ',' and line[i] != '+' and
551
+ # line[i] != '-' and line[i] != '*' and
552
+ # line[i] != '/' and line[i] != '%' and
553
+ # line[i] != '&' and line[i] != '!' and
554
+ # line[i] != '|' and line[i] != '[' and
555
+ # line[i] != ']' and line[i] != '=' and
556
+ # line[i] != '*' and line[i] != '>' and
557
+ # line[i] != '<'):
558
+ i = i + 1
559
+ else:
560
+ break
561
+ self.tokens.append(('name', line[s:i]))
562
+
563
+ tok = self.tokens[0]
564
+ self.tokens = self.tokens[1:]
565
+ self.last = tok
566
+ return tok
567
+
568
+ class CParser:
569
+ """The C module parser"""
570
+ def __init__(self, filename, idx = None):
571
+ self.filename = filename
572
+ if len(filename) > 2 and filename[-2:] == '.h':
573
+ self.is_header = 1
574
+ else:
575
+ self.is_header = 0
576
+ self.input = open(filename)
577
+ self.lexer = CLexer(self.input)
578
+ if idx == None:
579
+ self.index = index()
580
+ else:
581
+ self.index = idx
582
+ self.top_comment = ""
583
+ self.last_comment = ""
584
+ self.comment = None
585
+ self.collect_ref = 0
586
+ self.doc_disable = 0
587
+ self.conditionals = []
588
+ self.defines = []
589
+
590
+ def collect_references(self):
591
+ self.collect_ref = 1
592
+
593
+ def disable(self):
594
+ self.doc_disable = 1
595
+
596
+ def enable(self):
597
+ self.doc_disable = 0
598
+
599
+ def lineno(self):
600
+ return self.lexer.getlineno()
601
+
602
+ def index_add(self, name, module, static, type, info=None, extra = None):
603
+ if self.doc_disable:
604
+ return
605
+ if self.is_header == 1:
606
+ self.index.add(name, module, module, static, type, self.lineno(),
607
+ info, extra, self.conditionals)
608
+ else:
609
+ self.index.add(name, None, module, static, type, self.lineno(),
610
+ info, extra, self.conditionals)
611
+
612
+ def index_add_ref(self, name, module, static, type, info=None,
613
+ extra = None):
614
+ if self.is_header == 1:
615
+ self.index.add_ref(name, module, module, static, type,
616
+ self.lineno(), info, extra, self.conditionals)
617
+ else:
618
+ self.index.add_ref(name, None, module, static, type, self.lineno(),
619
+ info, extra, self.conditionals)
620
+
621
+ def warning(self, msg):
622
+ if self.doc_disable:
623
+ return
624
+ print(msg)
625
+
626
+ def error(self, msg, token=-1):
627
+ if self.doc_disable:
628
+ return
629
+
630
+ print("Parse Error: " + msg)
631
+ if token != -1:
632
+ print("Got token ", token)
633
+ self.lexer.debug()
634
+ sys.exit(1)
635
+
636
+ def debug(self, msg, token=-1):
637
+ print("Debug: " + msg)
638
+ if token != -1:
639
+ print("Got token ", token)
640
+ self.lexer.debug()
641
+
642
+ def parseTopComment(self, comment):
643
+ res = {}
644
+ lines = comment.split("\n")
645
+ item = None
646
+ for line in lines:
647
+ while line != "" and (line[0] == ' ' or line[0] == '\t'):
648
+ line = line[1:]
649
+ while line != "" and line[0] == '*':
650
+ line = line[1:]
651
+ while line != "" and (line[0] == ' ' or line[0] == '\t'):
652
+ line = line[1:]
653
+ try:
654
+ (it, line) = line.split(":", 1)
655
+ item = it
656
+ while line != "" and (line[0] == ' ' or line[0] == '\t'):
657
+ line = line[1:]
658
+ if item in res:
659
+ res[item] = res[item] + " " + line
660
+ else:
661
+ res[item] = line
662
+ except:
663
+ if item != None:
664
+ if item in res:
665
+ res[item] = res[item] + " " + line
666
+ else:
667
+ res[item] = line
668
+ self.index.info = res
669
+
670
+ def parseComment(self, token):
671
+ if self.top_comment == "":
672
+ self.top_comment = token[1]
673
+ if self.comment == None or token[1][0] == '*':
674
+ self.comment = token[1];
675
+ else:
676
+ self.comment = self.comment + token[1]
677
+ token = self.lexer.token()
678
+
679
+ if self.comment.find("DOC_DISABLE") != -1:
680
+ self.disable()
681
+
682
+ if self.comment.find("DOC_ENABLE") != -1:
683
+ self.enable()
684
+
685
+ return token
686
+
687
+ #
688
+ # Parse a simple comment block for typedefs or global variables
689
+ #
690
+ def parseSimpleComment(self, name, quiet = False):
691
+ if name[0:2] == '__':
692
+ quiet = 1
693
+
694
+ args = []
695
+ desc = ""
696
+
697
+ if self.comment == None:
698
+ if not quiet:
699
+ self.warning("Missing comment for %s" % (name))
700
+ return(None)
701
+ if self.comment[0] != '*':
702
+ if not quiet:
703
+ self.warning("Missing * in comment for %s" % (name))
704
+ return(None)
705
+ lines = self.comment.split('\n')
706
+ if lines[0] == '*':
707
+ del lines[0]
708
+ if lines[0] != "* %s:" % (name):
709
+ if not quiet:
710
+ self.warning("Misformatted comment for %s" % (name))
711
+ self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0]))
712
+ return(None)
713
+ del lines[0]
714
+ while len(lines) > 0 and lines[0] == '*':
715
+ del lines[0]
716
+ desc = ""
717
+ while len(lines) > 0:
718
+ l = lines[0]
719
+ while len(l) > 0 and l[0] == '*':
720
+ l = l[1:]
721
+ l = l.strip()
722
+ desc = desc + " " + l
723
+ del lines[0]
724
+
725
+ desc = desc.strip()
726
+
727
+ if quiet == 0:
728
+ if desc == "":
729
+ self.warning("Comment for %s lacks description" % (name))
730
+
731
+ return(desc)
732
+ #
733
+ # Parse a comment block associate to a macro
734
+ #
735
+ def parseMacroComment(self, name, quiet = 0):
736
+ if name[0:2] == '__':
737
+ quiet = 1
738
+
739
+ args = []
740
+ desc = ""
741
+
742
+ if self.comment == None:
743
+ if not quiet:
744
+ self.warning("Missing comment for macro %s" % (name))
745
+ return((args, desc))
746
+ if self.comment[0] != '*':
747
+ if not quiet:
748
+ self.warning("Missing * in macro comment for %s" % (name))
749
+ return((args, desc))
750
+ lines = self.comment.split('\n')
751
+ if lines[0] == '*':
752
+ del lines[0]
753
+ if lines[0] != "* %s:" % (name):
754
+ if not quiet:
755
+ self.warning("Misformatted macro comment for %s" % (name))
756
+ self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0]))
757
+ return((args, desc))
758
+ del lines[0]
759
+ while lines[0] == '*':
760
+ del lines[0]
761
+ while len(lines) > 0 and lines[0][0:3] == '* @':
762
+ l = lines[0][3:]
763
+ try:
764
+ (arg, desc) = l.split(':', 1)
765
+ desc=desc.strip()
766
+ arg=arg.strip()
767
+ except:
768
+ if not quiet:
769
+ self.warning("Misformatted macro comment for %s" % (name))
770
+ self.warning(" problem with '%s'" % (lines[0]))
771
+ del lines[0]
772
+ continue
773
+ del lines[0]
774
+ l = lines[0].strip()
775
+ while len(l) > 2 and l[0:3] != '* @':
776
+ while l[0] == '*':
777
+ l = l[1:]
778
+ desc = desc + ' ' + l.strip()
779
+ del lines[0]
780
+ if len(lines) == 0:
781
+ break
782
+ l = lines[0]
783
+ args.append((arg, desc))
784
+ while len(lines) > 0 and lines[0] == '*':
785
+ del lines[0]
786
+ desc = ""
787
+ while len(lines) > 0:
788
+ l = lines[0]
789
+ while len(l) > 0 and l[0] == '*':
790
+ l = l[1:]
791
+ l = l.strip()
792
+ desc = desc + " " + l
793
+ del lines[0]
794
+
795
+ desc = desc.strip()
796
+
797
+ if quiet == 0:
798
+ if desc == "":
799
+ self.warning("Macro comment for %s lack description of the macro" % (name))
800
+
801
+ return((args, desc))
802
+
803
+ #
804
+ # Parse a comment block and merge the information found in the
805
+ # parameters descriptions, finally returns a block as complete
806
+ # as possible
807
+ #
808
+ def mergeFunctionComment(self, name, description, quiet = 0):
809
+ if name == 'main':
810
+ quiet = 1
811
+ if name[0:2] == '__':
812
+ quiet = 1
813
+
814
+ (ret, args) = description
815
+ desc = ""
816
+ retdesc = ""
817
+
818
+ if self.comment == None:
819
+ if not quiet:
820
+ self.warning("Missing comment for function %s" % (name))
821
+ return(((ret[0], retdesc), args, desc))
822
+ if self.comment[0] != '*':
823
+ if not quiet:
824
+ self.warning("Missing * in function comment for %s" % (name))
825
+ return(((ret[0], retdesc), args, desc))
826
+ lines = self.comment.split('\n')
827
+ if lines[0] == '*':
828
+ del lines[0]
829
+ if lines[0] != "* %s:" % (name):
830
+ if not quiet:
831
+ self.warning("Misformatted function comment for %s" % (name))
832
+ self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0]))
833
+ return(((ret[0], retdesc), args, desc))
834
+ del lines[0]
835
+ while lines[0] == '*':
836
+ del lines[0]
837
+ nbargs = len(args)
838
+ while len(lines) > 0 and lines[0][0:3] == '* @':
839
+ l = lines[0][3:]
840
+ try:
841
+ (arg, desc) = l.split(':', 1)
842
+ desc=desc.strip()
843
+ arg=arg.strip()
844
+ except:
845
+ if not quiet:
846
+ self.warning("Misformatted function comment for %s" % (name))
847
+ self.warning(" problem with '%s'" % (lines[0]))
848
+ del lines[0]
849
+ continue
850
+ del lines[0]
851
+ l = lines[0].strip()
852
+ while len(l) > 2 and l[0:3] != '* @':
853
+ while l[0] == '*':
854
+ l = l[1:]
855
+ desc = desc + ' ' + l.strip()
856
+ del lines[0]
857
+ if len(lines) == 0:
858
+ break
859
+ l = lines[0]
860
+ i = 0
861
+ while i < nbargs:
862
+ if args[i][1] == arg:
863
+ args[i] = (args[i][0], arg, desc)
864
+ break;
865
+ i = i + 1
866
+ if i >= nbargs:
867
+ if not quiet:
868
+ self.warning("Unable to find arg %s from function comment for %s" % (
869
+ arg, name))
870
+ while len(lines) > 0 and lines[0] == '*':
871
+ del lines[0]
872
+ desc = ""
873
+ while len(lines) > 0:
874
+ l = lines[0]
875
+ while len(l) > 0 and l[0] == '*':
876
+ l = l[1:]
877
+ l = l.strip()
878
+ if len(l) >= 6 and l[0:6] == "return" or l[0:6] == "Return":
879
+ try:
880
+ l = l.split(' ', 1)[1]
881
+ except:
882
+ l = ""
883
+ retdesc = l.strip()
884
+ del lines[0]
885
+ while len(lines) > 0:
886
+ l = lines[0]
887
+ while len(l) > 0 and l[0] == '*':
888
+ l = l[1:]
889
+ l = l.strip()
890
+ retdesc = retdesc + " " + l
891
+ del lines[0]
892
+ else:
893
+ desc = desc + " " + l
894
+ del lines[0]
895
+
896
+ retdesc = retdesc.strip()
897
+ desc = desc.strip()
898
+
899
+ if quiet == 0:
900
+ #
901
+ # report missing comments
902
+ #
903
+ i = 0
904
+ while i < nbargs:
905
+ if args[i][2] == None and args[i][0] != "void" and \
906
+ ((args[i][1] != None) or (args[i][1] == '')):
907
+ self.warning("Function comment for %s lacks description of arg %s" % (name, args[i][1]))
908
+ i = i + 1
909
+ if retdesc == "" and ret[0] != "void":
910
+ self.warning("Function comment for %s lacks description of return value" % (name))
911
+ if desc == "" and retdesc == "":
912
+ self.warning("Function comment for %s lacks description of the function" % (name))
913
+
914
+ return(((ret[0], retdesc), args, desc))
915
+
916
+ def parsePreproc(self, token):
917
+ if debug:
918
+ print("=> preproc ", token, self.lexer.tokens)
919
+ name = token[1]
920
+ if name == "#include":
921
+ token = self.lexer.token()
922
+ if token == None:
923
+ return None
924
+ if token[0] == 'preproc':
925
+ self.index_add(token[1], self.filename, not self.is_header,
926
+ "include")
927
+ return self.lexer.token()
928
+ return token
929
+ if name == "#define":
930
+ token = self.lexer.token()
931
+ if token == None:
932
+ return None
933
+ if token[0] == 'preproc':
934
+ # TODO macros with arguments
935
+ name = token[1]
936
+ lst = []
937
+ token = self.lexer.token()
938
+ while token != None and token[0] == 'preproc' and \
939
+ token[1][0] != '#':
940
+ lst.append(token[1])
941
+ token = self.lexer.token()
942
+ try:
943
+ name = name.split('(') [0]
944
+ except:
945
+ pass
946
+ info = self.parseMacroComment(name, True)
947
+ self.index_add(name, self.filename, not self.is_header,
948
+ "macro", info)
949
+ return token
950
+
951
+ #
952
+ # Processing of conditionals modified by Bill 1/1/05
953
+ #
954
+ # We process conditionals (i.e. tokens from #ifdef, #ifndef,
955
+ # #if, #else and #endif) for headers and mainline code,
956
+ # store the ones from the header in libxml2-api.xml, and later
957
+ # (in the routine merge_public) verify that the two (header and
958
+ # mainline code) agree.
959
+ #
960
+ # There is a small problem with processing the headers. Some of
961
+ # the variables are not concerned with enabling / disabling of
962
+ # library functions (e.g. '__XML_PARSER_H__'), and we don't want
963
+ # them to be included in libxml2-api.xml, or involved in
964
+ # the check between the header and the mainline code. To
965
+ # accomplish this, we ignore any conditional which doesn't include
966
+ # the string 'ENABLED'
967
+ #
968
+ if name == "#ifdef":
969
+ apstr = self.lexer.tokens[0][1]
970
+ try:
971
+ self.defines.append(apstr)
972
+ if apstr.find('ENABLED') != -1:
973
+ self.conditionals.append("defined(%s)" % apstr)
974
+ except:
975
+ pass
976
+ elif name == "#ifndef":
977
+ apstr = self.lexer.tokens[0][1]
978
+ try:
979
+ self.defines.append(apstr)
980
+ if apstr.find('ENABLED') != -1:
981
+ self.conditionals.append("!defined(%s)" % apstr)
982
+ except:
983
+ pass
984
+ elif name == "#if":
985
+ apstr = ""
986
+ for tok in self.lexer.tokens:
987
+ if apstr != "":
988
+ apstr = apstr + " "
989
+ apstr = apstr + tok[1]
990
+ try:
991
+ self.defines.append(apstr)
992
+ if apstr.find('ENABLED') != -1:
993
+ self.conditionals.append(apstr)
994
+ except:
995
+ pass
996
+ elif name == "#else":
997
+ if self.conditionals != [] and \
998
+ self.defines[-1].find('ENABLED') != -1:
999
+ self.conditionals[-1] = "!(%s)" % self.conditionals[-1]
1000
+ elif name == "#endif":
1001
+ if self.conditionals != [] and \
1002
+ self.defines[-1].find('ENABLED') != -1:
1003
+ self.conditionals = self.conditionals[:-1]
1004
+ self.defines = self.defines[:-1]
1005
+ token = self.lexer.token()
1006
+ while token != None and token[0] == 'preproc' and \
1007
+ token[1][0] != '#':
1008
+ token = self.lexer.token()
1009
+ return token
1010
+
1011
+ #
1012
+ # token acquisition on top of the lexer, it handle internally
1013
+ # preprocessor and comments since they are logically not part of
1014
+ # the program structure.
1015
+ #
1016
+ def token(self):
1017
+ global ignored_words
1018
+
1019
+ token = self.lexer.token()
1020
+ while token != None:
1021
+ if token[0] == 'comment':
1022
+ token = self.parseComment(token)
1023
+ continue
1024
+ elif token[0] == 'preproc':
1025
+ token = self.parsePreproc(token)
1026
+ continue
1027
+ elif token[0] == "name" and token[1] == "__const":
1028
+ token = ("name", "const")
1029
+ return token
1030
+ elif token[0] == "name" and token[1] == "__attribute":
1031
+ token = self.lexer.token()
1032
+ while token != None and token[1] != ";":
1033
+ token = self.lexer.token()
1034
+ return token
1035
+ elif token[0] == "name" and token[1] in ignored_words:
1036
+ (n, info) = ignored_words[token[1]]
1037
+ i = 0
1038
+ while i < n:
1039
+ token = self.lexer.token()
1040
+ i = i + 1
1041
+ token = self.lexer.token()
1042
+ continue
1043
+ else:
1044
+ if debug:
1045
+ print("=> ", token)
1046
+ return token
1047
+ return None
1048
+
1049
+ #
1050
+ # Parse a typedef, it records the type and its name.
1051
+ #
1052
+ def parseTypedef(self, token):
1053
+ if token == None:
1054
+ return None
1055
+ token = self.parseType(token)
1056
+ if token == None:
1057
+ self.error("parsing typedef")
1058
+ return None
1059
+ base_type = self.type
1060
+ type = base_type
1061
+ #self.debug("end typedef type", token)
1062
+ while token != None:
1063
+ if token[0] == "name":
1064
+ name = token[1]
1065
+ signature = self.signature
1066
+ if signature != None:
1067
+ type = type.split('(')[0]
1068
+ d = self.mergeFunctionComment(name,
1069
+ ((type, None), signature), 1)
1070
+ self.index_add(name, self.filename, not self.is_header,
1071
+ "functype", d)
1072
+ else:
1073
+ if base_type == "struct":
1074
+ self.index_add(name, self.filename, not self.is_header,
1075
+ "struct", type)
1076
+ base_type = "struct " + name
1077
+ else:
1078
+ # TODO report missing or misformatted comments
1079
+ info = self.parseSimpleComment(name, True)
1080
+ self.index_add(name, self.filename, not self.is_header,
1081
+ "typedef", type, info)
1082
+ token = self.token()
1083
+ else:
1084
+ self.error("parsing typedef: expecting a name")
1085
+ return token
1086
+ #self.debug("end typedef", token)
1087
+ if token != None and token[0] == 'sep' and token[1] == ',':
1088
+ type = base_type
1089
+ token = self.token()
1090
+ while token != None and token[0] == "op":
1091
+ type = type + token[1]
1092
+ token = self.token()
1093
+ elif token != None and token[0] == 'sep' and token[1] == ';':
1094
+ break;
1095
+ elif token != None and token[0] == 'name':
1096
+ type = base_type
1097
+ continue;
1098
+ else:
1099
+ self.error("parsing typedef: expecting ';'", token)
1100
+ return token
1101
+ token = self.token()
1102
+ return token
1103
+
1104
+ #
1105
+ # Parse a C code block, used for functions it parse till
1106
+ # the balancing } included
1107
+ #
1108
+ def parseBlock(self, token):
1109
+ while token != None:
1110
+ if token[0] == "sep" and token[1] == "{":
1111
+ token = self.token()
1112
+ token = self.parseBlock(token)
1113
+ elif token[0] == "sep" and token[1] == "}":
1114
+ token = self.token()
1115
+ return token
1116
+ else:
1117
+ if self.collect_ref == 1:
1118
+ oldtok = token
1119
+ token = self.token()
1120
+ if oldtok[0] == "name" and oldtok[1][0:3] == "xml":
1121
+ if token[0] == "sep" and token[1] == "(":
1122
+ self.index_add_ref(oldtok[1], self.filename,
1123
+ 0, "function")
1124
+ token = self.token()
1125
+ elif token[0] == "name":
1126
+ token = self.token()
1127
+ if token[0] == "sep" and (token[1] == ";" or
1128
+ token[1] == "," or token[1] == "="):
1129
+ self.index_add_ref(oldtok[1], self.filename,
1130
+ 0, "type")
1131
+ elif oldtok[0] == "name" and oldtok[1][0:4] == "XML_":
1132
+ self.index_add_ref(oldtok[1], self.filename,
1133
+ 0, "typedef")
1134
+ elif oldtok[0] == "name" and oldtok[1][0:7] == "LIBXML_":
1135
+ self.index_add_ref(oldtok[1], self.filename,
1136
+ 0, "typedef")
1137
+
1138
+ else:
1139
+ token = self.token()
1140
+ return token
1141
+
1142
+ #
1143
+ # Parse a C struct definition till the balancing }
1144
+ #
1145
+ def parseStruct(self, token):
1146
+ fields = []
1147
+ #self.debug("start parseStruct", token)
1148
+ while token != None:
1149
+ if token[0] == "sep" and token[1] == "{":
1150
+ token = self.token()
1151
+ token = self.parseTypeBlock(token)
1152
+ elif token[0] == "sep" and token[1] == "}":
1153
+ self.struct_fields = fields
1154
+ #self.debug("end parseStruct", token)
1155
+ #print fields
1156
+ token = self.token()
1157
+ return token
1158
+ else:
1159
+ base_type = self.type
1160
+ #self.debug("before parseType", token)
1161
+ token = self.parseType(token)
1162
+ #self.debug("after parseType", token)
1163
+ if token != None and token[0] == "name":
1164
+ fname = token[1]
1165
+ token = self.token()
1166
+ if token[0] == "sep" and token[1] == ";":
1167
+ token = self.token()
1168
+ fields.append((self.type, fname))
1169
+ else:
1170
+ self.error("parseStruct: expecting ;", token)
1171
+ elif token != None and token[0] == "sep" and token[1] == "{":
1172
+ token = self.token()
1173
+ token = self.parseTypeBlock(token)
1174
+ if token != None and token[0] == "name":
1175
+ token = self.token()
1176
+ if token != None and token[0] == "sep" and token[1] == ";":
1177
+ token = self.token()
1178
+ else:
1179
+ self.error("parseStruct: expecting ;", token)
1180
+ else:
1181
+ self.error("parseStruct: name", token)
1182
+ token = self.token()
1183
+ self.type = base_type;
1184
+ self.struct_fields = fields
1185
+ #self.debug("end parseStruct", token)
1186
+ #print fields
1187
+ return token
1188
+
1189
+ #
1190
+ # Parse a C enum block, parse till the balancing }
1191
+ #
1192
+ def parseEnumBlock(self, token):
1193
+ self.enums = []
1194
+ name = None
1195
+ self.comment = None
1196
+ comment = ""
1197
+ value = "0"
1198
+ while token != None:
1199
+ if token[0] == "sep" and token[1] == "{":
1200
+ token = self.token()
1201
+ token = self.parseTypeBlock(token)
1202
+ elif token[0] == "sep" and token[1] == "}":
1203
+ if name != None:
1204
+ if self.comment != None:
1205
+ comment = self.comment
1206
+ self.comment = None
1207
+ self.enums.append((name, value, comment))
1208
+ token = self.token()
1209
+ return token
1210
+ elif token[0] == "name":
1211
+ if name != None:
1212
+ if self.comment != None:
1213
+ comment = self.comment.strip()
1214
+ self.comment = None
1215
+ self.enums.append((name, value, comment))
1216
+ name = token[1]
1217
+ comment = ""
1218
+ token = self.token()
1219
+ if token[0] == "op" and token[1][0] == "=":
1220
+ value = ""
1221
+ if len(token[1]) > 1:
1222
+ value = token[1][1:]
1223
+ token = self.token()
1224
+ while token[0] != "sep" or (token[1] != ',' and
1225
+ token[1] != '}'):
1226
+ value = value + token[1]
1227
+ token = self.token()
1228
+ else:
1229
+ try:
1230
+ value = "%d" % (int(value) + 1)
1231
+ except:
1232
+ self.warning("Failed to compute value of enum %s" % (name))
1233
+ value=""
1234
+ if token[0] == "sep" and token[1] == ",":
1235
+ token = self.token()
1236
+ else:
1237
+ token = self.token()
1238
+ return token
1239
+
1240
+ #
1241
+ # Parse a C definition block, used for structs it parse till
1242
+ # the balancing }
1243
+ #
1244
+ def parseTypeBlock(self, token):
1245
+ while token != None:
1246
+ if token[0] == "sep" and token[1] == "{":
1247
+ token = self.token()
1248
+ token = self.parseTypeBlock(token)
1249
+ elif token[0] == "sep" and token[1] == "}":
1250
+ token = self.token()
1251
+ return token
1252
+ else:
1253
+ token = self.token()
1254
+ return token
1255
+
1256
+ #
1257
+ # Parse a type: the fact that the type name can either occur after
1258
+ # the definition or within the definition makes it a little harder
1259
+ # if inside, the name token is pushed back before returning
1260
+ #
1261
+ def parseType(self, token):
1262
+ self.type = ""
1263
+ self.struct_fields = []
1264
+ self.signature = None
1265
+ if token == None:
1266
+ return token
1267
+
1268
+ have_sign = 0
1269
+ done = 0
1270
+
1271
+ while token[0] == "name" and (
1272
+ token[1] == "const" or \
1273
+ token[1] == "unsigned" or \
1274
+ token[1] == "signed"):
1275
+ if token[1] == "unsigned" or token[1] == "signed":
1276
+ have_sign = 1
1277
+ if self.type == "":
1278
+ self.type = token[1]
1279
+ else:
1280
+ self.type = self.type + " " + token[1]
1281
+ token = self.token()
1282
+
1283
+ if token[0] == "name" and token[1] in ("char", "short", "int", "long"):
1284
+ if self.type == "":
1285
+ self.type = token[1]
1286
+ else:
1287
+ self.type = self.type + " " + token[1]
1288
+
1289
+ elif have_sign:
1290
+ done = 1
1291
+
1292
+ elif token[0] == "name" and token[1] == "struct":
1293
+ if self.type == "":
1294
+ self.type = token[1]
1295
+ else:
1296
+ self.type = self.type + " " + token[1]
1297
+ token = self.token()
1298
+ nametok = None
1299
+ if token[0] == "name":
1300
+ nametok = token
1301
+ token = self.token()
1302
+ if token != None and token[0] == "sep" and token[1] == "{":
1303
+ token = self.token()
1304
+ token = self.parseStruct(token)
1305
+ elif token != None and token[0] == "op" and token[1] == "*":
1306
+ self.type = self.type + " " + nametok[1] + " *"
1307
+ token = self.token()
1308
+ while token != None and token[0] == "op" and token[1] == "*":
1309
+ self.type = self.type + " *"
1310
+ token = self.token()
1311
+ if token[0] == "name":
1312
+ nametok = token
1313
+ token = self.token()
1314
+ else:
1315
+ self.error("struct : expecting name", token)
1316
+ return token
1317
+ elif token != None and token[0] == "name" and nametok != None:
1318
+ self.type = self.type + " " + nametok[1]
1319
+ return token
1320
+
1321
+ if nametok != None:
1322
+ self.lexer.push(token)
1323
+ token = nametok
1324
+ return token
1325
+
1326
+ elif token[0] == "name" and token[1] == "enum":
1327
+ if self.type == "":
1328
+ self.type = token[1]
1329
+ else:
1330
+ self.type = self.type + " " + token[1]
1331
+ self.enums = []
1332
+ token = self.token()
1333
+ if token != None and token[0] == "sep" and token[1] == "{":
1334
+ token = self.token()
1335
+ token = self.parseEnumBlock(token)
1336
+ else:
1337
+ self.error("parsing enum: expecting '{'", token)
1338
+ enum_type = None
1339
+ if token != None and token[0] != "name":
1340
+ self.lexer.push(token)
1341
+ token = ("name", "enum")
1342
+ else:
1343
+ enum_type = token[1]
1344
+ for enum in self.enums:
1345
+ self.index_add(enum[0], self.filename,
1346
+ not self.is_header, "enum",
1347
+ (enum[1], enum[2], enum_type))
1348
+ return token
1349
+
1350
+ elif token[0] == "name":
1351
+ if self.type == "":
1352
+ self.type = token[1]
1353
+ else:
1354
+ self.type = self.type + " " + token[1]
1355
+ else:
1356
+ self.error("parsing type %s: expecting a name" % (self.type),
1357
+ token)
1358
+ return token
1359
+ if not done:
1360
+ token = self.token()
1361
+ while token != None and (token[0] == "op" or
1362
+ token[0] == "name" and token[1] == "const"):
1363
+ self.type = self.type + " " + token[1]
1364
+ token = self.token()
1365
+
1366
+ #
1367
+ # if there is a parenthesis here, this means a function type
1368
+ #
1369
+ if token != None and token[0] == "sep" and token[1] == '(':
1370
+ self.type = self.type + token[1]
1371
+ token = self.token()
1372
+ while token != None and token[0] == "op" and token[1] == '*':
1373
+ self.type = self.type + token[1]
1374
+ token = self.token()
1375
+ if token == None or token[0] != "name" :
1376
+ self.error("parsing function type, name expected", token);
1377
+ return token
1378
+ self.type = self.type + token[1]
1379
+ nametok = token
1380
+ token = self.token()
1381
+ if token != None and token[0] == "sep" and token[1] == ')':
1382
+ self.type = self.type + token[1]
1383
+ token = self.token()
1384
+ if token != None and token[0] == "sep" and token[1] == '(':
1385
+ token = self.token()
1386
+ type = self.type;
1387
+ token = self.parseSignature(token);
1388
+ self.type = type;
1389
+ else:
1390
+ self.error("parsing function type, '(' expected", token);
1391
+ return token
1392
+ else:
1393
+ self.error("parsing function type, ')' expected", token);
1394
+ return token
1395
+ self.lexer.push(token)
1396
+ token = nametok
1397
+ return token
1398
+
1399
+ #
1400
+ # do some lookahead for arrays
1401
+ #
1402
+ if token != None and token[0] == "name":
1403
+ nametok = token
1404
+ token = self.token()
1405
+ if token != None and token[0] == "sep" and token[1] == '[':
1406
+ self.type = self.type + nametok[1]
1407
+ while token != None and token[0] == "sep" and token[1] == '[':
1408
+ self.type = self.type + token[1]
1409
+ token = self.token()
1410
+ while token != None and token[0] != 'sep' and \
1411
+ token[1] != ']' and token[1] != ';':
1412
+ self.type = self.type + token[1]
1413
+ token = self.token()
1414
+ if token != None and token[0] == 'sep' and token[1] == ']':
1415
+ self.type = self.type + token[1]
1416
+ token = self.token()
1417
+ else:
1418
+ self.error("parsing array type, ']' expected", token);
1419
+ return token
1420
+ elif token != None and token[0] == "sep" and token[1] == ':':
1421
+ # remove :12 in case it's a limited int size
1422
+ token = self.token()
1423
+ token = self.token()
1424
+ self.lexer.push(token)
1425
+ token = nametok
1426
+
1427
+ return token
1428
+
1429
+ #
1430
+ # Parse a signature: '(' has been parsed and we scan the type definition
1431
+ # up to the ')' included
1432
+ def parseSignature(self, token):
1433
+ signature = []
1434
+ if token != None and token[0] == "sep" and token[1] == ')':
1435
+ self.signature = []
1436
+ token = self.token()
1437
+ return token
1438
+ while token != None:
1439
+ token = self.parseType(token)
1440
+ if token != None and token[0] == "name":
1441
+ signature.append((self.type, token[1], None))
1442
+ token = self.token()
1443
+ elif token != None and token[0] == "sep" and token[1] == ',':
1444
+ token = self.token()
1445
+ continue
1446
+ elif token != None and token[0] == "sep" and token[1] == ')':
1447
+ # only the type was provided
1448
+ if self.type == "...":
1449
+ signature.append((self.type, "...", None))
1450
+ else:
1451
+ signature.append((self.type, None, None))
1452
+ if token != None and token[0] == "sep":
1453
+ if token[1] == ',':
1454
+ token = self.token()
1455
+ continue
1456
+ elif token[1] == ')':
1457
+ token = self.token()
1458
+ break
1459
+ self.signature = signature
1460
+ return token
1461
+
1462
+ #
1463
+ # Parse a global definition, be it a type, variable or function
1464
+ # the extern "C" blocks are a bit nasty and require it to recurse.
1465
+ #
1466
+ def parseGlobal(self, token):
1467
+ static = 0
1468
+ if token[1] == 'extern':
1469
+ token = self.token()
1470
+ if token == None:
1471
+ return token
1472
+ if token[0] == 'string':
1473
+ if token[1] == 'C':
1474
+ token = self.token()
1475
+ if token == None:
1476
+ return token
1477
+ if token[0] == 'sep' and token[1] == "{":
1478
+ token = self.token()
1479
+ # print 'Entering extern "C line ', self.lineno()
1480
+ while token != None and (token[0] != 'sep' or
1481
+ token[1] != "}"):
1482
+ if token[0] == 'name':
1483
+ token = self.parseGlobal(token)
1484
+ else:
1485
+ self.error(
1486
+ "token %s %s unexpected at the top level" % (
1487
+ token[0], token[1]))
1488
+ token = self.parseGlobal(token)
1489
+ # print 'Exiting extern "C" line', self.lineno()
1490
+ token = self.token()
1491
+ return token
1492
+ else:
1493
+ return token
1494
+ elif token[1] == 'static':
1495
+ static = 1
1496
+ token = self.token()
1497
+ if token == None or token[0] != 'name':
1498
+ return token
1499
+
1500
+ if token[1] == 'typedef':
1501
+ token = self.token()
1502
+ return self.parseTypedef(token)
1503
+ else:
1504
+ token = self.parseType(token)
1505
+ type_orig = self.type
1506
+ if token == None or token[0] != "name":
1507
+ return token
1508
+ type = type_orig
1509
+ self.name = token[1]
1510
+ token = self.token()
1511
+ while token != None and (token[0] == "sep" or token[0] == "op"):
1512
+ if token[0] == "sep":
1513
+ if token[1] == "[":
1514
+ type = type + token[1]
1515
+ token = self.token()
1516
+ while token != None and (token[0] != "sep" or \
1517
+ token[1] != ";"):
1518
+ type = type + token[1]
1519
+ token = self.token()
1520
+
1521
+ if token != None and token[0] == "op" and token[1] == "=":
1522
+ #
1523
+ # Skip the initialization of the variable
1524
+ #
1525
+ token = self.token()
1526
+ if token[0] == 'sep' and token[1] == '{':
1527
+ token = self.token()
1528
+ token = self.parseBlock(token)
1529
+ else:
1530
+ while token != None and (token[0] != "sep" or \
1531
+ (token[1] != ';' and token[1] != ',')):
1532
+ token = self.token()
1533
+ if token == None or token[0] != "sep" or (token[1] != ';' and
1534
+ token[1] != ','):
1535
+ self.error("missing ';' or ',' after value")
1536
+
1537
+ if token != None and token[0] == "sep":
1538
+ if token[1] == ";":
1539
+ if type == "struct":
1540
+ self.index_add(self.name, self.filename,
1541
+ not self.is_header, "struct", self.struct_fields)
1542
+ else:
1543
+ info = self.parseSimpleComment(self.name, True)
1544
+ self.index_add(self.name, self.filename,
1545
+ not self.is_header, "variable", type, info)
1546
+ self.comment = None
1547
+ token = self.token()
1548
+ break
1549
+ elif token[1] == "(":
1550
+ token = self.token()
1551
+ token = self.parseSignature(token)
1552
+ if token == None:
1553
+ return None
1554
+ if token[0] == "sep" and token[1] == ";":
1555
+ d = self.mergeFunctionComment(self.name,
1556
+ ((type, None), self.signature), 1)
1557
+ self.index_add(self.name, self.filename, static,
1558
+ "function", d)
1559
+ self.comment = None
1560
+ token = self.token()
1561
+ elif token[0] == "sep" and token[1] == "{":
1562
+ d = self.mergeFunctionComment(self.name,
1563
+ ((type, None), self.signature), static)
1564
+ self.index_add(self.name, self.filename, static,
1565
+ "function", d)
1566
+ self.comment = None
1567
+ token = self.token()
1568
+ token = self.parseBlock(token);
1569
+ elif token[1] == ',':
1570
+ self.index_add(self.name, self.filename, static,
1571
+ "variable", type)
1572
+ self.comment = None
1573
+ type = type_orig
1574
+ token = self.token()
1575
+ while token != None and token[0] == "sep":
1576
+ type = type + token[1]
1577
+ token = self.token()
1578
+ if token != None and token[0] == "name":
1579
+ self.name = token[1]
1580
+ token = self.token()
1581
+ else:
1582
+ break
1583
+
1584
+ return token
1585
+
1586
+ def parse(self):
1587
+ self.warning("Parsing %s" % (self.filename))
1588
+ token = self.token()
1589
+ while token != None:
1590
+ if token[0] == 'name':
1591
+ token = self.parseGlobal(token)
1592
+ else:
1593
+ self.error("token %s %s unexpected at the top level" % (
1594
+ token[0], token[1]))
1595
+ token = self.parseGlobal(token)
1596
+ return
1597
+ self.parseTopComment(self.top_comment)
1598
+ return self.index
1599
+
1600
+
1601
+ class docBuilder:
1602
+ """A documentation builder"""
1603
+ def __init__(self, name, directories=['.'], excludes=[]):
1604
+ self.name = name
1605
+ self.directories = directories
1606
+ self.excludes = excludes + list(ignored_files.keys())
1607
+ self.modules = {}
1608
+ self.headers = {}
1609
+ self.idx = index()
1610
+ self.index = {}
1611
+ if name == 'libxml2':
1612
+ self.basename = 'libxml'
1613
+ else:
1614
+ self.basename = name
1615
+
1616
+ def analyze(self):
1617
+ print("Project %s : %d headers, %d modules" % (self.name, len(list(self.headers.keys())), len(list(self.modules.keys()))))
1618
+ self.idx.analyze()
1619
+
1620
+ def scanHeaders(self):
1621
+ for header in list(self.headers.keys()):
1622
+ parser = CParser(header)
1623
+ idx = parser.parse()
1624
+ self.headers[header] = idx;
1625
+ self.idx.merge(idx)
1626
+
1627
+ def scanModules(self):
1628
+ for module in list(self.modules.keys()):
1629
+ parser = CParser(module)
1630
+ idx = parser.parse()
1631
+ # idx.analyze()
1632
+ self.modules[module] = idx
1633
+ self.idx.merge_public(idx)
1634
+
1635
+ def scan(self):
1636
+ for directory in self.directories:
1637
+ files = glob.glob(directory + "/*.c")
1638
+ for file in files:
1639
+ skip = 0
1640
+ for excl in self.excludes:
1641
+ if file.find(excl) != -1:
1642
+ print("Skipping %s" % file)
1643
+ skip = 1
1644
+ break
1645
+ if skip == 0:
1646
+ self.modules[file] = None;
1647
+ files = glob.glob(directory + "/*.h")
1648
+ for file in files:
1649
+ skip = 0
1650
+ for excl in self.excludes:
1651
+ if file.find(excl) != -1:
1652
+ print("Skipping %s" % file)
1653
+ skip = 1
1654
+ break
1655
+ if skip == 0:
1656
+ self.headers[file] = None;
1657
+ self.scanHeaders()
1658
+ self.scanModules()
1659
+
1660
+ def modulename_file(self, file):
1661
+ module = os.path.basename(file)
1662
+ if module[-2:] == '.h':
1663
+ module = module[:-2]
1664
+ elif module[-2:] == '.c':
1665
+ module = module[:-2]
1666
+ return module
1667
+
1668
+ def serialize_enum(self, output, name):
1669
+ id = self.idx.enums[name]
1670
+ output.write(" <enum name='%s' file='%s'" % (name,
1671
+ self.modulename_file(id.header)))
1672
+ if id.info != None:
1673
+ info = id.info
1674
+ if info[0] != None and info[0] != '':
1675
+ try:
1676
+ val = eval(info[0])
1677
+ except:
1678
+ val = info[0]
1679
+ output.write(" value='%s'" % (val));
1680
+ if info[2] != None and info[2] != '':
1681
+ output.write(" type='%s'" % info[2]);
1682
+ if info[1] != None and info[1] != '':
1683
+ output.write(" info='%s'" % escape(info[1]));
1684
+ output.write("/>\n")
1685
+
1686
+ def serialize_macro(self, output, name):
1687
+ id = self.idx.macros[name]
1688
+ output.write(" <macro name='%s' file='%s'>\n" % (name,
1689
+ self.modulename_file(id.header)))
1690
+ if id.info != None:
1691
+ try:
1692
+ (args, desc) = id.info
1693
+ if desc != None and desc != "":
1694
+ output.write(" <info>%s</info>\n" % (escape(desc)))
1695
+ for arg in args:
1696
+ (name, desc) = arg
1697
+ if desc != None and desc != "":
1698
+ output.write(" <arg name='%s' info='%s'/>\n" % (
1699
+ name, escape(desc)))
1700
+ else:
1701
+ output.write(" <arg name='%s'/>\n" % (name))
1702
+ except:
1703
+ pass
1704
+ output.write(" </macro>\n")
1705
+
1706
+ def serialize_typedef(self, output, name):
1707
+ id = self.idx.typedefs[name]
1708
+ if id.info[0:7] == 'struct ':
1709
+ output.write(" <struct name='%s' file='%s' type='%s'" % (
1710
+ name, self.modulename_file(id.header), id.info))
1711
+ name = id.info[7:]
1712
+ if name in self.idx.structs and ( \
1713
+ type(self.idx.structs[name].info) == type(()) or
1714
+ type(self.idx.structs[name].info) == type([])):
1715
+ output.write(">\n");
1716
+ try:
1717
+ for field in self.idx.structs[name].info:
1718
+ output.write(" <field name='%s' type='%s'/>\n" % (field[1] , field[0]))
1719
+ except:
1720
+ print("Failed to serialize struct %s" % (name))
1721
+ output.write(" </struct>\n")
1722
+ else:
1723
+ output.write("/>\n");
1724
+ else :
1725
+ output.write(" <typedef name='%s' file='%s' type='%s'" % (
1726
+ name, self.modulename_file(id.header), id.info))
1727
+ try:
1728
+ desc = id.extra
1729
+ if desc != None and desc != "":
1730
+ output.write(">\n <info>%s</info>\n" % (escape(desc)))
1731
+ output.write(" </typedef>\n")
1732
+ else:
1733
+ output.write("/>\n")
1734
+ except:
1735
+ output.write("/>\n")
1736
+
1737
+ def serialize_variable(self, output, name):
1738
+ id = self.idx.variables[name]
1739
+ if id.info != None:
1740
+ output.write(" <variable name='%s' file='%s' type='%s'" % (
1741
+ name, self.modulename_file(id.header), id.info))
1742
+ else:
1743
+ output.write(" <variable name='%s' file='%s'" % (
1744
+ name, self.modulename_file(id.header)))
1745
+ desc = id.extra
1746
+ if desc != None and desc != "":
1747
+ output.write(">\n <info>%s</info>\n" % (escape(desc)))
1748
+ output.write(" </variable>\n")
1749
+ else:
1750
+ output.write("/>\n")
1751
+
1752
+ def serialize_function(self, output, name):
1753
+ id = self.idx.functions[name]
1754
+ if name == debugsym:
1755
+ print("=>", id)
1756
+
1757
+ output.write(" <%s name='%s' file='%s' module='%s'>\n" % (id.type,
1758
+ name, self.modulename_file(id.header),
1759
+ self.modulename_file(id.module)))
1760
+ #
1761
+ # Processing of conditionals modified by Bill 1/1/05
1762
+ #
1763
+ if id.conditionals != None:
1764
+ apstr = ""
1765
+ for cond in id.conditionals:
1766
+ if apstr != "":
1767
+ apstr = apstr + " &amp;&amp; "
1768
+ apstr = apstr + cond
1769
+ output.write(" <cond>%s</cond>\n"% (apstr));
1770
+ try:
1771
+ (ret, params, desc) = id.info
1772
+ if (desc == None or desc == '') and \
1773
+ name[0:9] != "xmlThrDef" and name != "xmlDllMain" and \
1774
+ ret[1] == '':
1775
+ print("%s %s from %s has no description" % (id.type, name,
1776
+ self.modulename_file(id.module)))
1777
+
1778
+ output.write(" <info>%s</info>\n" % (escape(desc)))
1779
+ if ret[0] != None:
1780
+ if ret[0] == "void":
1781
+ output.write(" <return type='void'/>\n")
1782
+ else:
1783
+ output.write(" <return type='%s' info='%s'/>\n" % (
1784
+ ret[0], escape(ret[1])))
1785
+ for param in params:
1786
+ if param[0] == 'void':
1787
+ continue
1788
+ if param[2] == None:
1789
+ output.write(" <arg name='%s' type='%s' info=''/>\n" % (param[1], param[0]))
1790
+ else:
1791
+ output.write(" <arg name='%s' type='%s' info='%s'/>\n" % (param[1], param[0], escape(param[2])))
1792
+ except:
1793
+ print("Failed to save function %s info: " % name, repr(id.info))
1794
+ output.write(" </%s>\n" % (id.type))
1795
+
1796
+ def serialize_exports(self, output, file):
1797
+ module = self.modulename_file(file)
1798
+ output.write(" <file name='%s'>\n" % (module))
1799
+ dict = self.headers[file]
1800
+ if dict.info != None:
1801
+ for data in ('Summary', 'Description', 'Author'):
1802
+ try:
1803
+ output.write(" <%s>%s</%s>\n" % (
1804
+ data.lower(),
1805
+ escape(dict.info[data]),
1806
+ data.lower()))
1807
+ except:
1808
+ if data != 'Author':
1809
+ print("Header %s lacks a %s description" % (module, data))
1810
+ if 'Description' in dict.info:
1811
+ desc = dict.info['Description']
1812
+ if desc.find("DEPRECATED") != -1:
1813
+ output.write(" <deprecated/>\n")
1814
+
1815
+ ids = list(dict.macros.keys())
1816
+ ids.sort()
1817
+ for id in ids:
1818
+ # Macros are sometime used to masquerade other types.
1819
+ if id in dict.functions:
1820
+ continue
1821
+ if id in dict.variables:
1822
+ continue
1823
+ if id in dict.typedefs:
1824
+ continue
1825
+ if id in dict.structs:
1826
+ continue
1827
+ if id in dict.enums:
1828
+ continue
1829
+ output.write(" <exports symbol='%s' type='macro'/>\n" % (id))
1830
+ ids = list(dict.enums.keys())
1831
+ ids.sort()
1832
+ for id in ids:
1833
+ output.write(" <exports symbol='%s' type='enum'/>\n" % (id))
1834
+ ids = list(dict.typedefs.keys())
1835
+ ids.sort()
1836
+ for id in ids:
1837
+ output.write(" <exports symbol='%s' type='typedef'/>\n" % (id))
1838
+ ids = list(dict.structs.keys())
1839
+ ids.sort()
1840
+ for id in ids:
1841
+ output.write(" <exports symbol='%s' type='struct'/>\n" % (id))
1842
+ ids = list(dict.variables.keys())
1843
+ ids.sort()
1844
+ for id in ids:
1845
+ output.write(" <exports symbol='%s' type='variable'/>\n" % (id))
1846
+ ids = list(dict.functions.keys())
1847
+ ids.sort()
1848
+ for id in ids:
1849
+ output.write(" <exports symbol='%s' type='function'/>\n" % (id))
1850
+ output.write(" </file>\n")
1851
+
1852
+ def serialize(self):
1853
+ filename = "%s-api.xml" % self.name
1854
+ print("Saving XML description %s" % (filename))
1855
+ output = open(filename, "w")
1856
+ output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
1857
+ output.write("<api name='%s'>\n" % self.name)
1858
+ output.write(" <files>\n")
1859
+ headers = list(self.headers.keys())
1860
+ headers.sort()
1861
+ for file in headers:
1862
+ self.serialize_exports(output, file)
1863
+ output.write(" </files>\n")
1864
+ output.write(" <symbols>\n")
1865
+ macros = list(self.idx.macros.keys())
1866
+ macros.sort()
1867
+ for macro in macros:
1868
+ self.serialize_macro(output, macro)
1869
+ enums = list(self.idx.enums.keys())
1870
+ enums.sort()
1871
+ for enum in enums:
1872
+ self.serialize_enum(output, enum)
1873
+ typedefs = list(self.idx.typedefs.keys())
1874
+ typedefs.sort()
1875
+ for typedef in typedefs:
1876
+ self.serialize_typedef(output, typedef)
1877
+ variables = list(self.idx.variables.keys())
1878
+ variables.sort()
1879
+ for variable in variables:
1880
+ self.serialize_variable(output, variable)
1881
+ functions = list(self.idx.functions.keys())
1882
+ functions.sort()
1883
+ for function in functions:
1884
+ self.serialize_function(output, function)
1885
+ output.write(" </symbols>\n")
1886
+ output.write("</api>\n")
1887
+ output.close()
1888
+
1889
+
1890
+ def rebuild():
1891
+ builder = None
1892
+ if glob.glob("parser.c") != [] :
1893
+ print("Rebuilding API description for libxml2")
1894
+ builder = docBuilder("libxml2", [".", "."],
1895
+ ["tst.c"])
1896
+ elif glob.glob("../parser.c") != [] :
1897
+ print("Rebuilding API description for libxml2")
1898
+ builder = docBuilder("libxml2", ["..", "../include/libxml"],
1899
+ ["tst.c"])
1900
+ elif glob.glob("../libxslt/transform.c") != [] :
1901
+ print("Rebuilding API description for libxslt")
1902
+ builder = docBuilder("libxslt", ["../libxslt"],
1903
+ ["win32config.h", "libxslt.h", "tst.c"])
1904
+ else:
1905
+ print("rebuild() failed, unable to guess the module")
1906
+ return None
1907
+ builder.scan()
1908
+ builder.analyze()
1909
+ builder.serialize()
1910
+ if glob.glob("../libexslt/exslt.c") != [] :
1911
+ extra = docBuilder("libexslt", ["../libexslt"], ["libexslt.h"])
1912
+ extra.scan()
1913
+ extra.analyze()
1914
+ extra.serialize()
1915
+ return builder
1916
+
1917
+ #
1918
+ # for debugging the parser
1919
+ #
1920
+ def parse(filename):
1921
+ parser = CParser(filename)
1922
+ idx = parser.parse()
1923
+ return idx
1924
+
1925
+ if __name__ == "__main__":
1926
+ if len(sys.argv) > 1:
1927
+ debug = 1
1928
+ parse(sys.argv[1])
1929
+ else:
1930
+ rebuild()
local-test-libxml2-delta-02/afc-libxml2/doc/libxml2-api.xml ADDED
The diff for this file is too large to render. See raw diff
 
local-test-libxml2-delta-02/afc-libxml2/doc/meson.build ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ install_man(files(['xml2-config.1', 'xmlcatalog.1', 'xmllint.1']))
3
+
4
+
5
+ tutorial_files = files(
6
+ 'xmlcatalog.html',
7
+ 'xmllint.html',
8
+ )
9
+
10
+ install_data(tutorial_files, install_dir: dir_doc)
11
+
12
+ subdir('devhelp')
local-test-libxml2-delta-02/afc-libxml2/doc/xmllint.1 ADDED
@@ -0,0 +1,686 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '\" t
2
+ .\" Title: xmllint
3
+ .\" Author: John Fleck <jfleck@inkstain.net>
4
+ .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5
+ .\" Date: 12/26/2024
6
+ .\" Manual: xmllint Manual
7
+ .\" Source: libxml2
8
+ .\" Language: English
9
+ .\"
10
+ .TH "XMLLINT" "1" "12/26/2024" "libxml2" "xmllint Manual"
11
+ .\" -----------------------------------------------------------------
12
+ .\" * Define some portability stuff
13
+ .\" -----------------------------------------------------------------
14
+ .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
+ .\" http://bugs.debian.org/507673
16
+ .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17
+ .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18
+ .ie \n(.g .ds Aq \(aq
19
+ .el .ds Aq '
20
+ .\" -----------------------------------------------------------------
21
+ .\" * set default formatting
22
+ .\" -----------------------------------------------------------------
23
+ .\" disable hyphenation
24
+ .nh
25
+ .\" disable justification (adjust text to left margin only)
26
+ .ad l
27
+ .\" -----------------------------------------------------------------
28
+ .\" * MAIN CONTENT STARTS HERE *
29
+ .\" -----------------------------------------------------------------
30
+ .SH "NAME"
31
+ xmllint \- command line XML tool
32
+ .SH "SYNOPSIS"
33
+ .HP \w'\fBxmllint\fR\ 'u
34
+ \fBxmllint\fR [\fB\-\-version\fR | \fB\-\-debug\fR | \fB\-\-quiet\fR | \fB\-\-shell\fR | \fB\-\-xpath\ "\fR\fB\fIXPath_expression\fR\fR\fB"\fR | \fB\-\-debugent\fR | \fB\-\-copy\fR | \fB\-\-recover\fR | \fB\-\-huge\fR | \fB\-\-nocompact\fR | \fB\-\-nodefdtd\fR | \fB\-\-nodict\fR | \fB\-\-noenc\fR | \fB\-\-noent\fR | \fB\-\-nofixup\-base\-uris\fR | \fB\-\-noout\fR | \fB\-\-nonet\fR | \fB\-\-path\ "\fR\fB\fIPATH(S)\fR\fR\fB"\fR | \fB\-\-load\-trace\fR | \fB\-\-htmlout\fR | \fB\-\-nowrap\fR | \fB\-\-valid\fR | \fB\-\-postvalid\fR | \fB\-\-dtdvalid\ \fR\fB\fIURL\fR\fR | \fB\-\-dtdvalidfpi\ \fR\fB\fIFPI\fR\fR | \fB\-\-timing\fR | \fB\-\-output\ \fR\fB\fIFILE\fR\fR | \fB\-\-repeat\fR | \fB\-\-insert\fR | \fB\-\-compress\fR | \fB\-\-html\fR | \fB\-\-xmlout\fR | \fB\-\-push\fR | \fB\-\-memory\fR | \fB\-\-max\-ampl\ \fR\fB\fIINTEGER\fR\fR | \fB\-\-maxmem\ \fR\fB\fINBBYTES\fR\fR | \fB\-\-nowarning\fR | \fB\-\-noblanks\fR | \fB\-\-nocdata\fR | \fB\-\-format\fR | \fB\-\-pretty\ \fR\fB\fIINTEGER\fR\fR | \fB\-\-encode\ \fR\fB\fIENCODING\fR\fR | \fB\-\-dropdtd\fR | \fB\-\-nsclean\fR | \fB\-\-testIO\fR | \fB\-\-catalogs\fR | \fB\-\-nocatalogs\fR | \fB\-\-auto\fR | \fB\-\-xinclude\fR | \fB\-\-noxincludenode\fR | \fB\-\-loaddtd\fR | \fB\-\-dtdattr\fR | \fB\-\-stream\fR | \fB\-\-walker\fR | \fB\-\-pattern\ \fR\fB\fIPATTERNVALUE\fR\fR | \fB\-\-relaxng\ \fR\fB\fISCHEMA\fR\fR | \fB\-\-schema\ \fR\fB\fISCHEMA\fR\fR | \fB\-\-schematron\ \fR\fB\fISCHEMA\fR\fR | \fB\-\-c14n\fR | \fB\-\-c14n11\fR | \fB\-\-exc\-c14n\fR | \fB\-\-pedantic\fR | \fB\-\-sax\fR | \fB\-\-sax1\fR | \fB\-\-oldxml10\fR] {\fIXML\-FILE(S)\fR... | \-}
35
+ .SH "DESCRIPTION"
36
+ .PP
37
+ The
38
+ \fBxmllint\fR
39
+ program parses one or more
40
+ XML
41
+ files, specified on the command line as
42
+ \fIXML\-FILE\fR
43
+ (or the standard input if the filename provided is
44
+ \fB\-\fR
45
+ )\&. It prints various types of output, depending upon the options selected\&. It is useful for detecting errors both in
46
+ XML
47
+ code and in the
48
+ XML
49
+ parser itself\&.
50
+ .PP
51
+ \fBxmllint\fR
52
+ is included in
53
+ \fBlibxml\fR(3)\&.
54
+ .SH "OPTIONS"
55
+ .PP
56
+ \fBxmllint\fR
57
+ accepts the following options (in alphabetical order):
58
+ .PP
59
+ \fB\-\-auto\fR
60
+ .RS 4
61
+ Generate a small document for testing purposes\&.
62
+ .RE
63
+ .PP
64
+ \fB\-\-catalogs\fR
65
+ .RS 4
66
+ Use the
67
+ SGML
68
+ catalog(s) from
69
+ \fBSGML_CATALOG_FILES\fR\&. Otherwise
70
+ XML
71
+ catalogs starting from
72
+ /etc/xml/catalog
73
+ or, more specifically,
74
+ ${sysconfdir}/xml/catalog
75
+ are used by default\&.
76
+ .RE
77
+ .PP
78
+ \fB\-\-compress\fR
79
+ .RS 4
80
+ Turn on
81
+ \fBgzip\fR(1)
82
+ compression of output\&.
83
+ .RE
84
+ .PP
85
+ \fB\-\-copy\fR
86
+ .RS 4
87
+ Test the internal copy implementation\&.
88
+ .RE
89
+ .PP
90
+ \fB\-\-c14n\fR, \fB\-\-c14n11\fR, \fB\-\-exc\-c14n\fR
91
+ .RS 4
92
+ Use the W3C
93
+ XML
94
+ Canonicalisation (C14N) to serialize the result of parsing to
95
+ stdout\&. It keeps comments in the result\&.
96
+ .RE
97
+ .PP
98
+ \fB\-\-dtdvalid \fR\fB\fIURL\fR\fR
99
+ .RS 4
100
+ Use the
101
+ DTD
102
+ specified by an
103
+ \fIURL\fR
104
+ for validation\&.
105
+ .RE
106
+ .PP
107
+ \fB\-\-dtdvalidfpi \fR\fB\fIFPI\fR\fR
108
+ .RS 4
109
+ Use the
110
+ DTD
111
+ specified by a Formal Public Identifier
112
+ \fIFPI\fR
113
+ for validation, note that this will require a catalog exporting that Formal Public Identifier to work\&.
114
+ .RE
115
+ .PP
116
+ \fB\-\-debug\fR
117
+ .RS 4
118
+ Parse a file and output an annotated tree of the in\-memory version of the document\&.
119
+ .RE
120
+ .PP
121
+ \fB\-\-debugent\fR
122
+ .RS 4
123
+ Debug the entities defined in the document\&.
124
+ .RE
125
+ .PP
126
+ \fB\-\-dropdtd\fR
127
+ .RS 4
128
+ Remove
129
+ DTD
130
+ from output\&.
131
+ .RE
132
+ .PP
133
+ \fB\-\-dtdattr\fR
134
+ .RS 4
135
+ Fetch external
136
+ DTD
137
+ and populate the tree with inherited attributes\&.
138
+ .RE
139
+ .PP
140
+ \fB\-\-encode \fR\fB\fIENCODING\fR\fR
141
+ .RS 4
142
+ Output in the given encoding\&. Note that this works for full document not fragments or result from XPath queries\&.
143
+ .RE
144
+ .PP
145
+ \fB\-\-format\fR
146
+ .RS 4
147
+ Reformat and reindent the output\&. The
148
+ \fBXMLLINT_INDENT\fR
149
+ environment variable controls the indentation\&. The default value is two spaces " ")\&.
150
+ .RE
151
+ .PP
152
+ \fB\-\-html\fR
153
+ .RS 4
154
+ Use the
155
+ HTML
156
+ parser\&.
157
+ .RE
158
+ .PP
159
+ \fB\-\-htmlout\fR
160
+ .RS 4
161
+ Output results as an
162
+ HTML
163
+ file\&. This causes
164
+ \fBxmllint\fR
165
+ to output the necessary
166
+ HTML
167
+ tags surrounding the result tree output so the results can be displayed/viewed in a browser\&.
168
+ .RE
169
+ .PP
170
+ \fB\-\-huge\fR
171
+ .RS 4
172
+ Ignore some hardcoded parser limits\&.
173
+ .RE
174
+ .PP
175
+ \fB\-\-insert\fR
176
+ .RS 4
177
+ Test for valid insertions\&.
178
+ .RE
179
+ .PP
180
+ \fB\-\-loaddtd\fR
181
+ .RS 4
182
+ Fetch an external
183
+ DTD\&.
184
+ .RE
185
+ .PP
186
+ \fB\-\-load\-trace\fR
187
+ .RS 4
188
+ Display all the documents loaded during the processing to
189
+ stderr\&.
190
+ .RE
191
+ .PP
192
+ \fB\-\-max\-ampl \fR\fB\fIINTEGER\fR\fR
193
+ .RS 4
194
+ Set the maximum amplification factor which protects against exponential entity expansion ("billion laughs")\&. The default value is 5\&. Documents making heavy use of entity expansion may require a higher value\&.
195
+ .RE
196
+ .PP
197
+ \fB\-\-maxmem \fR\fB\fINNBYTES\fR\fR
198
+ .RS 4
199
+ Test the parser memory support\&.
200
+ \fINNBYTES\fR
201
+ is the maximum number of bytes the library is allowed to allocate\&. This can also be used to make sure batch processing of
202
+ XML
203
+ files will not exhaust the virtual memory of the server running them\&.
204
+ .RE
205
+ .PP
206
+ \fB\-\-memory\fR
207
+ .RS 4
208
+ Parse from memory\&.
209
+ .RE
210
+ .PP
211
+ \fB\-\-noblanks\fR
212
+ .RS 4
213
+ Drop ignorable blank spaces\&.
214
+ .RE
215
+ .PP
216
+ \fB\-\-nocatalogs\fR
217
+ .RS 4
218
+ Do not use any catalogs\&.
219
+ .RE
220
+ .PP
221
+ \fB\-\-nocdata\fR
222
+ .RS 4
223
+ Substitute CDATA section by equivalent text nodes\&.
224
+ .RE
225
+ .PP
226
+ \fB\-\-nocompact\fR
227
+ .RS 4
228
+ Do not generate compact text nodes (parser option XML_PARSE_COMPACT)\&. Only for debugging\&.
229
+ .RE
230
+ .PP
231
+ \fB\-\-nodefdtd\fR
232
+ .RS 4
233
+ Do not set default HTML doctype (parser option HTML_PARSE_NODEFDTD)\&.
234
+ .RE
235
+ .PP
236
+ \fB\-\-nodict\fR
237
+ .RS 4
238
+ Don\*(Aqt use dictionaries (parser option XML_PARSE_NODICT)\&. Only for debugging\&.
239
+ .RE
240
+ .PP
241
+ \fB\-\-noenc\fR
242
+ .RS 4
243
+ Ignore encoding declaration (parser option XML_PARSE_IGNORE_ENC)\&.
244
+ .RE
245
+ .PP
246
+ \fB\-\-noent\fR
247
+ .RS 4
248
+ Substitute entity values for entity references\&. By default,
249
+ \fBxmllint\fR
250
+ leaves entity references in place\&.
251
+ .RE
252
+ .PP
253
+ \fB\-\-nofixup\-base\-uris\fR
254
+ .RS 4
255
+ Don\*(Aqt fix xml:base URIs when processing XIncludes (parser option XML_PARSE_NOBASEFIX)\&.
256
+ .RE
257
+ .PP
258
+ \fB\-\-nonet\fR
259
+ .RS 4
260
+ Do not use the Internet to fetch
261
+ DTDs or entities\&.
262
+ .RE
263
+ .PP
264
+ \fB\-\-noout\fR
265
+ .RS 4
266
+ Suppress output\&. By default,
267
+ \fBxmllint\fR
268
+ outputs the result tree\&.
269
+ .RE
270
+ .PP
271
+ \fB\-\-nowarning\fR
272
+ .RS 4
273
+ Do not emit warnings from the parser and/or validator\&.
274
+ .RE
275
+ .PP
276
+ \fB\-\-nowrap\fR
277
+ .RS 4
278
+ Do not output
279
+ HTML
280
+ doc wrapper\&.
281
+ .RE
282
+ .PP
283
+ \fB\-\-noxincludenode\fR
284
+ .RS 4
285
+ Do XInclude processing but do not generate XInclude start and end nodes\&.
286
+ .RE
287
+ .PP
288
+ \fB\-\-nsclean\fR
289
+ .RS 4
290
+ Remove redundant namespace declarations\&.
291
+ .RE
292
+ .PP
293
+ \fB\-\-oldxml10\fR
294
+ .RS 4
295
+ Use deprecated parsing rules before XML 1\&.0, 5th edition\&.
296
+ .RE
297
+ .PP
298
+ \fB\-\-output \fR\fB\fIFILE\fR\fR
299
+ .RS 4
300
+ Define a file path where
301
+ \fBxmllint\fR
302
+ will save the result of parsing\&. Usually the programs build a tree and save it on
303
+ stdout, with this option the result
304
+ XML
305
+ instance will be saved onto a file\&.
306
+ .RE
307
+ .PP
308
+ \fB\-\-path "\fR\fB\fIPATH(S)\fR\fR\fB"\fR
309
+ .RS 4
310
+ Use the (space\- or colon\-separated) list of filesystem paths specified by
311
+ \fIPATHS\fR
312
+ to load
313
+ DTDs or entities\&. Enclose space\-separated lists by quotation marks\&.
314
+ .RE
315
+ .PP
316
+ \fB\-\-pattern \fR\fB\fIPATTERNVALUE\fR\fR
317
+ .RS 4
318
+ Used to exercise the pattern recognition engine, which can be used with the reader interface to the parser\&. It allows to select some nodes in the document based on an XPath (subset) expression\&. Used for debugging\&.
319
+ .RE
320
+ .PP
321
+ \fB\-\-pedantic\fR
322
+ .RS 4
323
+ Enable additional warnings\&.
324
+ .RE
325
+ .PP
326
+ \fB\-\-postvalid\fR
327
+ .RS 4
328
+ Validate after parsing has completed\&.
329
+ .RE
330
+ .PP
331
+ \fB\-\-pretty \fR\fB\fIINTEGER\fR\fR
332
+ .RS 4
333
+ Value 0 means no formatting, 1 means XML_SAVE_FORMAT (same as \-\-format), 2 means XML_SAVE_WSNONSIG\&.
334
+ .RE
335
+ .PP
336
+ \fB\-\-push\fR
337
+ .RS 4
338
+ Use the push mode of the parser\&.
339
+ .RE
340
+ .PP
341
+ \fB\-\-quiet\fR
342
+ .RS 4
343
+ Don\*(Aqt print informational messages to stderr\&.
344
+ .RE
345
+ .PP
346
+ \fB\-\-recover\fR
347
+ .RS 4
348
+ Output any parsable portions of an invalid document\&.
349
+ .RE
350
+ .PP
351
+ \fB\-\-relaxng \fR\fB\fISCHEMA\fR\fR
352
+ .RS 4
353
+ Use RelaxNG file named
354
+ \fISCHEMA\fR
355
+ for validation\&.
356
+ .RE
357
+ .PP
358
+ \fB\-\-repeat\fR
359
+ .RS 4
360
+ Repeat 100 times, for timing or profiling\&.
361
+ .RE
362
+ .PP
363
+ \fB\-\-sax\fR
364
+ .RS 4
365
+ Print SAX callbacks (only for debugging)\&.
366
+ .RE
367
+ .PP
368
+ \fB\-\-sax1\fR
369
+ .RS 4
370
+ Use deprecated SAX1 interface (only for debugging)\&.
371
+ .RE
372
+ .PP
373
+ \fB\-\-schema \fR\fB\fISCHEMA\fR\fR
374
+ .RS 4
375
+ Use a W3C
376
+ XML
377
+ Schema file named
378
+ \fISCHEMA\fR
379
+ for validation\&.
380
+ .RE
381
+ .PP
382
+ \fB\-\-schematron \fR\fB\fISCHEMA\fR\fR
383
+ .RS 4
384
+ Use a Schematron file named
385
+ \fISCHEMA\fR
386
+ for validation\&.
387
+ .RE
388
+ .PP
389
+ \fB\-\-shell\fR
390
+ .RS 4
391
+ Run a navigating shell\&. Details on available commands in shell mode are below (see
392
+ the section called \(lqSHELL COMMANDS\(rq)\&.
393
+ .RE
394
+ .PP
395
+ \fB\-\-xpath "\fR\fB\fIXPath_expression\fR\fR\fB"\fR
396
+ .RS 4
397
+ Run an XPath expression given as argument and print the result\&. In case of a nodeset result, each node in the node set is serialized in full in the output\&. In case of an empty node set the "XPath set is empty" result will be shown and exit code 11 will be returned\&.\&. This feature is EXPERIMENTAL\&. Implementation details can change without futher notice\&.
398
+ .RE
399
+ .PP
400
+ \fB\-\-stream\fR
401
+ .RS 4
402
+ Use streaming
403
+ API
404
+ \- useful when used in combination with
405
+ \fB\-\-relaxng\fR
406
+ or
407
+ \fB\-\-valid\fR
408
+ options for validation of files that are too large to be held in memory\&.
409
+ .RE
410
+ .PP
411
+ \fB\-\-testIO\fR
412
+ .RS 4
413
+ Test user input/output support\&.
414
+ .RE
415
+ .PP
416
+ \fB\-\-timing\fR
417
+ .RS 4
418
+ Output information about the time it takes
419
+ \fBxmllint\fR
420
+ to perform the various steps\&.
421
+ .RE
422
+ .PP
423
+ \fB\-\-valid\fR
424
+ .RS 4
425
+ Determine if the document is a valid instance of the included Document Type Definition (DTD)\&. A
426
+ DTD
427
+ to be validated against also can be specified at the command line using the
428
+ \fB\-\-dtdvalid\fR
429
+ option\&. By default,
430
+ \fBxmllint\fR
431
+ also checks to determine if the document is well\-formed\&.
432
+ .RE
433
+ .PP
434
+ \fB\-\-version\fR
435
+ .RS 4
436
+ Display the version of
437
+ \fBlibxml\fR(3)
438
+ used\&.
439
+ .RE
440
+ .PP
441
+ \fB\-\-walker\fR
442
+ .RS 4
443
+ Test the walker module, which is a reader interface but for a document tree, instead of using the reader
444
+ API
445
+ on an unparsed document it works on an existing in\-memory tree\&. Used for debugging\&.
446
+ .RE
447
+ .PP
448
+ \fB\-\-xinclude\fR
449
+ .RS 4
450
+ Do XInclude processing\&.
451
+ .RE
452
+ .PP
453
+ \fB\-\-xmlout\fR
454
+ .RS 4
455
+ Used in conjunction with
456
+ \fB\-\-html\fR\&. Usually when
457
+ HTML
458
+ is parsed the document is saved with the
459
+ HTML
460
+ serializer\&. But with this option the resulting document is saved with the
461
+ XML
462
+ serializer\&. This is primarily used to generate
463
+ XHTML
464
+ from
465
+ HTML
466
+ input\&.
467
+ .RE
468
+ .SH "SHELL COMMANDS"
469
+ .PP
470
+ \fBxmllint\fR
471
+ offers an interactive shell mode invoked with the
472
+ \fB\-\-shell\fR
473
+ command\&. Available commands in shell mode include (in alphabetical order):
474
+ .PP
475
+ \fBbase\fR
476
+ .RS 4
477
+ Display
478
+ XML
479
+ base of the node\&.
480
+ .RE
481
+ .PP
482
+ \fBbye\fR
483
+ .RS 4
484
+ Leave the shell\&.
485
+ .RE
486
+ .PP
487
+ \fBcat \fR\fB\fINODE\fR\fR
488
+ .RS 4
489
+ Display the given node or the current one\&.
490
+ .RE
491
+ .PP
492
+ \fBcd \fR\fB\fIPATH\fR\fR
493
+ .RS 4
494
+ Change the current node to the given path (if unique) or root if no argument is given\&.
495
+ .RE
496
+ .PP
497
+ \fBdir \fR\fB\fIPATH\fR\fR
498
+ .RS 4
499
+ Dumps information about the node (namespace, attributes, content)\&.
500
+ .RE
501
+ .PP
502
+ \fBdu \fR\fB\fIPATH\fR\fR
503
+ .RS 4
504
+ Show the structure of the subtree under the given path or the current node\&.
505
+ .RE
506
+ .PP
507
+ \fBexit\fR
508
+ .RS 4
509
+ Leave the shell\&.
510
+ .RE
511
+ .PP
512
+ \fBhelp\fR
513
+ .RS 4
514
+ Show this help\&.
515
+ .RE
516
+ .PP
517
+ \fBload \fR\fB\fIFILENAME\fR\fR
518
+ .RS 4
519
+ Load a new document with the given filename\&.
520
+ .RE
521
+ .PP
522
+ \fBls \fR\fB\fIPATH\fR\fR
523
+ .RS 4
524
+ List contents of the given path or the current directory\&.
525
+ .RE
526
+ .PP
527
+ \fBpwd\fR
528
+ .RS 4
529
+ Display the path to the current node\&.
530
+ .RE
531
+ .PP
532
+ \fBquit\fR
533
+ .RS 4
534
+ Leave the shell\&.
535
+ .RE
536
+ .PP
537
+ \fBsave \fR\fB\fIFILENAME\fR\fR
538
+ .RS 4
539
+ Save the current document to the given filename or to the original name\&.
540
+ .RE
541
+ .PP
542
+ \fBvalidate\fR
543
+ .RS 4
544
+ Check the document for errors\&.
545
+ .RE
546
+ .PP
547
+ \fBwrite \fR\fB\fIFILENAME\fR\fR
548
+ .RS 4
549
+ Write the current node to the given filename\&.
550
+ .RE
551
+ .SH "ENVIRONMENT"
552
+ .PP
553
+ \fBSGML_CATALOG_FILES\fR
554
+ .RS 4
555
+ SGML
556
+ catalog behavior can be changed by redirecting queries to the user\*(Aqs own set of catalogs\&. This can be done by setting the
557
+ \fBSGML_CATALOG_FILES\fR
558
+ environment variable to a list of catalogs\&. An empty one should deactivate loading the default catalog\&.
559
+ .RE
560
+ .PP
561
+ \fBXML_CATALOG_FILES\fR
562
+ .RS 4
563
+ XML
564
+ catalog behavior can be changed by redirecting queries to the user\*(Aqs own set of catalogs\&. This can be done by setting the
565
+ \fBXML_CATALOG_FILES\fR
566
+ environment variable to a space\-separated list of catalogs\&. Use percent\-encoding to escape spaces or other characters\&. An empty variable should deactivate loading the default catalog\&.
567
+ .RE
568
+ .PP
569
+ \fBXML_DEBUG_CATALOG\fR
570
+ .RS 4
571
+ Setting the environment variable
572
+ \fBXML_DEBUG_CATALOG\fR
573
+ to
574
+ \fInon\-zero\fR
575
+ using the
576
+ \fBexport\fR
577
+ command outputs debugging information related to catalog operations\&.
578
+ .RE
579
+ .PP
580
+ \fBXMLLINT_INDENT\fR
581
+ .RS 4
582
+ Setting the environment variable
583
+ \fBXMLLINT_INDENT\fR
584
+ controls the indentation\&. The default value is two spaces " "\&.
585
+ .RE
586
+ .SH "DIAGNOSTICS"
587
+ .PP
588
+ \fBxmllint\fR
589
+ return codes provide information that can be used when calling it from scripts\&.
590
+ .PP
591
+ \fB0\fR
592
+ .RS 4
593
+ No error
594
+ .RE
595
+ .PP
596
+ \fB1\fR
597
+ .RS 4
598
+ Unclassified
599
+ .RE
600
+ .PP
601
+ \fB2\fR
602
+ .RS 4
603
+ Error in
604
+ DTD
605
+ .RE
606
+ .PP
607
+ \fB3\fR
608
+ .RS 4
609
+ Validation error
610
+ .RE
611
+ .PP
612
+ \fB4\fR
613
+ .RS 4
614
+ Validation error
615
+ .RE
616
+ .PP
617
+ \fB5\fR
618
+ .RS 4
619
+ Error in schema compilation
620
+ .RE
621
+ .PP
622
+ \fB6\fR
623
+ .RS 4
624
+ Error writing output
625
+ .RE
626
+ .PP
627
+ \fB7\fR
628
+ .RS 4
629
+ Error in pattern (generated when
630
+ \fB\-\-pattern\fR
631
+ option is used)
632
+ .RE
633
+ .PP
634
+ \fB9\fR
635
+ .RS 4
636
+ Out of memory error
637
+ .RE
638
+ .PP
639
+ \fB10\fR
640
+ .RS 4
641
+ XPath evaluation error
642
+ .RE
643
+ .PP
644
+ \fB11\fR
645
+ .RS 4
646
+ XPath result is empty
647
+ .RE
648
+ .SH "SEE ALSO"
649
+ .PP
650
+ \fBlibxml\fR(3)
651
+ .PP
652
+ More information can be found at
653
+ .sp
654
+ .RS 4
655
+ .ie n \{\
656
+ \h'-04'\(bu\h'+03'\c
657
+ .\}
658
+ .el \{\
659
+ .sp -1
660
+ .IP \(bu 2.3
661
+ .\}
662
+ \fBlibxml\fR(3)
663
+ web page
664
+ \m[blue]\fB\%https://gitlab.gnome.org/GNOME/libxml2\fR\m[]
665
+ .RE
666
+ .sp
667
+ .SH "AUTHORS"
668
+ .PP
669
+ \fBJohn Fleck\fR <\&jfleck@inkstain\&.net\&>
670
+ .RS 4
671
+ Author.
672
+ .RE
673
+ .PP
674
+ \fBZiying Sherwin\fR <\&sherwin@nlm\&.nih\&.gov\&>
675
+ .RS 4
676
+ Author.
677
+ .RE
678
+ .PP
679
+ \fBHeiko Rupp\fR <\&hwr@pilhuhn\&.de\&>
680
+ .RS 4
681
+ Author.
682
+ .RE
683
+ .SH "COPYRIGHT"
684
+ .br
685
+ Copyright \(co 2001, 2004
686
+ .br
local-test-libxml2-delta-02/afc-libxml2/test/att11 ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version='1.0' standalone='yes'?>
2
+ <!DOCTYPE attributes [
3
+ <!ELEMENT attributes EMPTY>
4
+ <!ATTLIST attributes
5
+ nmtoken NMTOKEN #IMPLIED
6
+ nmtokens NMTOKENS #IMPLIED>
7
+ <!ENTITY ent " entity&recursive; ">
8
+ <!ENTITY recursive "reference">
9
+ ]>
10
+ <attributes
11
+ nmtoken = " &ent; &ent; &ent; "
12
+ nmtokens = " Test&#x0d;&#x0a; this&#x20; normalization "
13
+ />
local-test-libxml2-delta-02/afc-libxml2/test/att7 ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE x [
2
+ <!ELEMENT x (test*)>
3
+ <!ELEMENT test EMPTY>
4
+ <!ATTLIST test att CDATA "attvalue">
5
+ <!ENTITY test.ent "<test/>">
6
+ ]>
7
+ <x>
8
+ <test/>
9
+ &test.ent;
10
+ </x>
local-test-libxml2-delta-02/afc-libxml2/test/att9 ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ <!DOCTYPE doc [
2
+ <!ATTLIST doc a1 NMTOKENS " 1 2 ">
3
+ <!ELEMENT doc (#PCDATA)>
4
+ ]>
5
+ <doc/>
local-test-libxml2-delta-02/afc-libxml2/test/attrib.xml ADDED
@@ -0,0 +1 @@
 
 
1
+ <item title="Icrontic.com - Warning: Breakdancing midget with tourette&apos;s syndrome on-board&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;" url="http://www.icrontic.com/" first_time="985034339" last_time="985034339" visits="1"/>
local-test-libxml2-delta-02/afc-libxml2/test/boundaries1.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE d [
3
+ <!ENTITY a "]>">
4
+ <!ENTITY b ']>'>
5
+ <!--> ]> -->
6
+ ] >
7
+ <?pi p1?>
8
+ <!--> c1 -->
9
+ <d a=">" b='>'>
10
+ text&a;text
11
+ <![CDATA[cdata]]>
12
+ <?pi p2?>
13
+ <!--> c2 -->
14
+ </d>
15
+ <?pi p3?>
16
+ <!--> c3 -->
local-test-libxml2-delta-02/afc-libxml2/test/cdata-3-byte-UTF-8.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- This tests that three-byte UTF-8 characters are parsed properly when split across a buffer boundary of length XML_PARSER_BIG_BUFFER_SIZE (300 bytes). -->
3
+ <doc>
4
+ <p><![CDATA[牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛]]></p>
5
+ <p><![CDATA[ 牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛]]></p>
6
+ <p><![CDATA[ 牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛牛]]></p>
7
+ </doc>
local-test-libxml2-delta-02/afc-libxml2/test/comment2.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!-- document start -->
3
+ <doc>
4
+ <empty/>
5
+ </doc>
6
+ <!-- document end -->
local-test-libxml2-delta-02/afc-libxml2/test/dav1 ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <D:multistatus xmlns:D="http://www.ietf.org/standards/dav/" xmlns:R="http://www.foo.bar/boxschema">
3
+ <D:response>
4
+ <D:prop>
5
+ <R:bigbox>
6
+ <R:BoxType>Box type A</R:BoxType>
7
+ </R:bigbox>
8
+ <R:author>
9
+ <R:Name>J.J. Dingleheimerschmidt</R:Name>
10
+ </R:author>
11
+ </D:prop>
12
+ <D:status>HTTP/1.1 200 OK</D:status>
13
+ </D:response>
14
+ <D:response>
15
+ <D:prop>
16
+ <R:DingALing/>
17
+ <R:Random/>
18
+ </D:prop>
19
+ <D:status>HTTP/1.1 403 Forbidden</D:status>
20
+ <D:responsedescription> The user does not have access to the DingALing property.
21
+ </D:responsedescription>
22
+ </D:response>
23
+ <D:responsedescription> There has been an access violation error.
24
+ </D:responsedescription>
25
+ </D:multistatus>
local-test-libxml2-delta-02/afc-libxml2/test/dav12 ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ <?xml version="1.0"?>
2
+ <D:href xmlns:D="http://www.ietf.org/standards/dav/">http://www.ics.uci.edu/~ejw/contact.html</D:href>
local-test-libxml2-delta-02/afc-libxml2/test/dav13 ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <D:multistatus xmlns:D="http://www.ietf.org/standards/dav/">
3
+ <D:response>
4
+ <D:href>
5
+ http://webdav.sb.aol.com/workspace/webdav/proposal.doc
6
+ </D:href>
7
+ <D:href>
8
+ http://webdav.sb.aol.com/workspace/webdav/
9
+ </D:href>
10
+ <D:status>HTTP/1.1 202 Accepted</D:status>
11
+ </D:response>
12
+ <D:response>
13
+ <D:href>http://foo.bar/blah</D:href>
14
+ <D:status>HTTP/1.1 403 Forbidden</D:status>
15
+ </D:response>
16
+ </D:multistatus>
local-test-libxml2-delta-02/afc-libxml2/test/dav19 ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <D:multistatus xmlns:D="http://www.ietf.org/standards/dav/">
3
+ <D:response>
4
+ <D:prop>
5
+ <D:supportedlock>
6
+ <D:LockEntry>
7
+ <D:locktype>Write</D:locktype>
8
+ <D:lockscope>Exclusive</D:lockscope>
9
+ </D:LockEntry>
10
+ <D:LockEntry>
11
+ <D:locktype>Write</D:locktype>
12
+ <D:lockscope>Shared</D:lockscope>
13
+ </D:LockEntry>
14
+ </D:supportedlock>
15
+ </D:prop>
16
+ <D:status>HTTP/1.1 200 OK</D:status>
17
+ </D:response>
18
+ </D:multistatus>
local-test-libxml2-delta-02/afc-libxml2/test/dav7 ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <d:multistatus xmlns:d="http://www.ietf.org/standards/dav/">
3
+ <d:response>
4
+ <d:href>http://www.foo.bar/container/resource1</d:href>
5
+ <d:href>http://www.foo.bar/container/resource2</d:href>
6
+ <d:status>HTTP/1.1 200 OK</d:status>
7
+ </d:response>
8
+ <d:response>
9
+ <d:href>http://www.foo.bar/container/</d:href>
10
+ <d:status>HTTP/1.1 420 Method Failure</d:status>
11
+ </d:response>
12
+ <d:response>
13
+ <d:href>http://www.foo.bar/container/resource3</d:href>
14
+ <d:status>HTTP/1.1 412 Precondition Failed</d:status>
15
+ </d:response>
16
+ </d:multistatus>
local-test-libxml2-delta-02/afc-libxml2/test/def-xml-attr.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE root [
3
+ <!ATTLIST foo xml:lang CDATA "eng">
4
+ ]>
5
+ <root>
6
+ <foo xml:lang="ger">Ja</foo>
7
+ </root>
local-test-libxml2-delta-02/afc-libxml2/test/defattr2.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE doc [
2
+ <!ELEMENT doc EMPTY>
3
+ <!ATTLIST doc
4
+ defatt (0|1) "0"
5
+ xmlns:tst CDATA #FIXED "http://example.org"
6
+ tst:att (0|1) "1">
7
+ ]>
8
+ <doc att="1"/>
local-test-libxml2-delta-02/afc-libxml2/test/dtd11 ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ <!DOCTYPE doc [
2
+ <!ELEMENT doc (#PCDATA)>
3
+ <!ATTLIST doc val CDATA #IMPLIED>
4
+ ]>
5
+ <doc val="v1"/>
local-test-libxml2-delta-02/afc-libxml2/test/dtd12 ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ <!DOCTYPE doc [
2
+ <!ENTITY YN '"Yes"' >
3
+ <!ENTITY WhatHeSaid "He said &YN;" >
4
+ ]>
5
+ <doc>&WhatHeSaid;</doc>
local-test-libxml2-delta-02/afc-libxml2/test/dtd13 ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <!-- comment before the DTD -->
2
+ <!DOCTYPE doc [
3
+ <!ELEMENT doc ANY>
4
+ ]>
5
+ <!-- comment after the DTD -->
6
+ <doc/>
local-test-libxml2-delta-02/afc-libxml2/test/dtd7 ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <!DOCTYPE doc [
2
+ <!ELEMENT doc (a , b)*>
3
+ <!ELEMENT a (#PCDATA)>
4
+ <!ELEMENT b (#PCDATA)>
5
+ ]>
6
+ <doc><a>This</a><b> is a valid document</b></doc>
local-test-libxml2-delta-02/afc-libxml2/test/ent1 ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE EXAMPLE SYSTEM "example.dtd" [
3
+ <!ENTITY xml "Extensible Markup Language">
4
+ ]>
5
+ <EXAMPLE>
6
+ &xml;
7
+ </EXAMPLE>
local-test-libxml2-delta-02/afc-libxml2/test/ent13 ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version='1.0' ?>
2
+ <!DOCTYPE test [
3
+ <!ENTITY ampproblem '&amp;'>
4
+ ]>
5
+ <t a="&ampproblem;">a</t>
6
+
local-test-libxml2-delta-02/afc-libxml2/test/ent9 ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE doc [
2
+ <!ENTITY test1 "<a/>,<b/>,<c/>,<d/>">
3
+ ]>
4
+ <doc>
5
+ <ent>&test1;</ent>
6
+ <p> WE need lot of garbage now to trigger the problem</p>
7
+ <p> WE need lot of garbage now to trigger the problem</p>
8
+ <p> WE need lot of garbage now to trigger the problem</p>
9
+ <p> WE need lot of garbage now to trigger the problem</p>
10
+ <p> WE need lot of garbage now to trigger the problem</p>
11
+ <p> WE need lot of garbage now to trigger the problem</p>
12
+ <p> WE need lot of garbage now to trigger the problem</p>
13
+ <p> WE need lot of garbage now to trigger the problem</p>
14
+ <p> WE need lot of garbage now to trigger the problem</p>
15
+ <p> WE need lot of garbage now to trigger the problem</p>
16
+ <p> WE need lot of garbage now to trigger the problem</p>
17
+ <p> WE need lot of garbage now to trigger the problem</p>
18
+ <p> WE need lot of garbage now to trigger the problem</p>
19
+ <p> WE need lot of garbage now to trigger the problem</p>
20
+ <p> WE need lot of garbage now to trigger the problem</p>
21
+ <p> WE need lot of garbage now to trigger the problem</p>
22
+ <p> WE need lot of garbage now to trigger the problem</p>
23
+ <p> WE need lot of garbage now to trigger the problem</p>
24
+ <p> WE need lot of garbage now to trigger the problem</p>
25
+ <p> WE need lot of garbage now to trigger the problem</p>
26
+ <p> WE need lot of garbage now to trigger the problem</p>
27
+ <p> WE need lot of garbage now to trigger the problem</p>
28
+ <p> WE need lot of garbage now to trigger the problem</p>
29
+ <p> WE need lot of garbage now to trigger the problem</p>
30
+ <p> WE need lot of garbage now to trigger the problem</p>
31
+ <p> WE need lot of garbage now to trigger the problem</p>
32
+ <p> WE need lot of garbage now to trigger the problem</p>
33
+ <p> WE need lot of garbage now to trigger the problem</p>
34
+ <p> WE need lot of garbage now to trigger the problem</p>
35
+ <p> WE need lot of garbage now to trigger the problem</p>
36
+ <p> WE need lot of garbage now to trigger the problem</p>
37
+ <p> WE need lot of garbage now to trigger the problem</p>
38
+ <p> WE need lot of garbage now to trigger the problem</p>
39
+ <p> WE need lot of garbage now to trigger the problem</p>
40
+ <p> WE need lot of garbage now to trigger the problem</p>
41
+ <p> WE need lot of garbage now to trigger the problem</p>
42
+ <p> WE need lot of garbage now to trigger the problem</p>
43
+ <p> WE need lot of garbage now to trigger the problem</p>
44
+ <p> WE need lot of garbage now to trigger the problem</p>
45
+ <p> WE need lot of garbage now to trigger the problem</p>
46
+ <p> WE need lot of garbage now to trigger the problem</p>
47
+ <p> WE need lot of garbage now to trigger the problem</p>
48
+ <p> WE need lot of garbage now to trigger the problem</p>
49
+ <p> WE need lot of garbage now to trigger the problem</p>
50
+ <p> WE need lot of garbage now to trigger the problem</p>
51
+ <p> WE need lot of garbage now to trigger the problem</p>
52
+ <p> WE need lot of garbage now to trigger the problem</p>
53
+ <p> WE need lot of garbage now to trigger the problem</p>
54
+ <p> WE need lot of garbage now to trigger the problem</p>
55
+ <p> WE need lot of garbage now to trigger the problem</p>
56
+ <p> WE need lot of garbage now to trigger the problem</p>
57
+ <p> WE need lot of garbage now to trigger the problem</p>
58
+ <p> WE need lot of garbage now to trigger the problem</p>
59
+ <ent>&test1;</ent>
60
+ </doc>
61
+
local-test-libxml2-delta-02/afc-libxml2/test/japancrlf.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <入力メッセージ
2
+ xmlns="http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826">
3
+ <c8c:Ele
4
+ xmlns:c8c="http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826"
5
+ />
6
+ </入力メッセージ>
local-test-libxml2-delta-02/afc-libxml2/test/ns2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/"
3
+ dia:testattr="test"/>
local-test-libxml2-delta-02/afc-libxml2/test/svg2 ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version = "1.0" standalone = "yes"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG April 1999//EN"
3
+ "http://www.w3.org/Graphics/SVG/svg-19990412.dtd">
4
+ <svg width = "268px" height="207px">
5
+ <g style = "stroke: #000000" >
6
+ <path d = " M 29 28 "/>
7
+ <path d = " L 19 74 "/>
8
+ </g>
9
+ <g style = "stroke: #800040" >
10
+ <polyline verts = " 32,100 72,50 90,82 73,16 120,64 152,9 177,107"/>
11
+ </g>
12
+ <g style = "stroke: #000000" >
13
+ </g>
14
+ <g style = "stroke: #0000ff" >
15
+ <rect x = "30" y = "101" width = "51" height = "33"/>
16
+ </g>
17
+ <g style = "fill: #0000ff" >
18
+ <ellipse cx = "182" cy = "127" major = "37" minor = "31" angle = "90"/>
19
+ </g>
20
+ <g style = "fill: #ff0000" >
21
+ <polyline verts = " 78,180 76,151 131,149 136,182 135,182 134,183 127,185 117,186 109,192 104,194 98,199 96,200 95,201 94,202 92,202 85,202 70,200 54,199 47,198 46,197 45,197 37,195 26,193 17,187 9,181 8,181 7,176 6,175 6,173 6,172 6,170 8,164 8,163 8,162 9,162 10,162 11,162 13,162 20,162 26,162 27,162 28,162 30,162 30,163 31,163 32,164 34,166 35,166 36,167 36,168 37,169 38,169 39,169 41,170 43,170 45,170 47,170 49,170 50,168 50,161 50,160 50,159 47,162 78,180"/>
22
+ <g>
23
+ <desc> Java Font definition:Dialog 0</desc>
24
+ </g>
25
+ <g>
26
+ <desc> Java Font definition:Helvetica 0</desc>
27
+ </g>
28
+ </g>
29
+ <g style = "stroke: #000000" >
30
+ <text x = "188" y = "36" >this is text</text>
31
+ </g>
32
+ <g style = "stroke: #000000" >
33
+ <g>
34
+ <desc> Java Font definition:Dialog 0</desc>
35
+ </g>
36
+ <g>
37
+ <desc> Java Font definition:Helvetica 700</desc>
38
+ </g>
39
+ </g>
40
+ <g style = "stroke: #008080" >
41
+ <text x = "176" y = "85" >sadfsadfsad</text>
42
+ </g>
43
+ <g style = "stroke: #000000" >
44
+ </g>
45
+ <g style = "fill: #800040" >
46
+ <ellipse cx = "208" cy = "180" major = "45" minor = "31" angle = "0"/>
47
+ </g>
48
+ <g style = "stroke: #000000" >
49
+ </g>
50
+ <g style = "fill: #ffffff" >
51
+ <g>
52
+ <desc> Java Font definition:Dialog 700</desc>
53
+ </g>
54
+ <g>
55
+ <desc> Java Font definition:Dialog 700</desc>
56
+ </g>
57
+ </g></svg>
58
+
local-test-libxml2-delta-02/afc-libxml2/test/svg3 ADDED
The diff for this file is too large to render. See raw diff
 
local-test-libxml2-delta-02/afc-libxml2/test/utf16bom.xml ADDED
Binary file (256 Bytes). View file
 
local-test-libxml2-delta-02/afc-libxml2/test/wap.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
3
+ "http://dark.wapit.com/vswap/tests/wap/DTD/wml11.dtd">
4
+ <!-- (C) 1999, 2000 WAP Forum Ltd. All rights reserved -->
5
+ <wml>
6
+ <card id="card1">
7
+ <onevent type="onenterforward">
8
+ <go href="/vswap/run/result.eml">
9
+ <postfield name="var" value="&#36;test"/>
10
+ <postfield name="v" value="dark"/>
11
+ <postfield name="ts" value="0003"/>
12
+ <postfield name="tp" value="wml/state/variables/parsing/1"/>
13
+ <postfield name="ti" value="1"/>
14
+ <postfield name="expected" value="var:pass"/>
15
+ </go>
16
+ </onevent>
17
+ <p>If automatic testing failed, select <anchor>Failed<go
18
+ href='/vswap/run/result.eml'>
19
+ <postfield name="SUBMIT" value="No"/><postfield name="v"
20
+ value="dark"/>
21
+ <postfield name="ts" value="0003"/>
22
+ <postfield name="tp" value="wml/state/variables/parsing/1"/>
23
+ <postfield name="ti" value="1"/>
24
+ <postfield name="expected" value="var:pass"/></go></anchor>.</p>
25
+ </card>
26
+
27
+ </wml>
local-test-libxml2-delta-02/afc-libxml2/test/xhtml1 ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
+ <!-- 3.1.1 3/ -->
6
+ <html xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Virtual Library</title>
9
+ </head>
10
+ <!-- 4.8 -->
11
+ <script type="text/javascript">
12
+ ... unescaped script &lt; content ...
13
+ </script>
14
+ <body>
15
+ <p>Moved to <a href="http://example.org/">example.org</a>.</p>
16
+ </body>
17
+ <!-- C2 -->
18
+ <img src="foo.gif" alt="foo"/>
19
+ <!-- C3 -->
20
+ <p/>
21
+ <!-- C7 -->
22
+ <p lang="fr">coucou</p>
23
+ <p xml:lang="fr">salut</p>
24
+ <!-- C8 -->
25
+ <p name="fragid">test</p>
26
+ <!-- 4.5 -->
27
+ <dl compact="">
28
+ <dt>Internet Engineering Task Force</dt>
29
+ <dd>An organization which establishes technical standards for the Internet</dd>
30
+ </dl>
31
+
32
+ </html>
33
+
34
+
local-test-libxml2-delta-02/afc-libxml2/test/xml2 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version='1.0'?>
2
+ <!DOCTYPE test [
3
+ <!ELEMENT test (#PCDATA) >
4
+ <!ENTITY % xx '&#37;zz;'>
5
+ <!ENTITY % zz '&#60;!ENTITY tricky "error-prone" >' >
6
+ %xx;
7
+ ]>
8
+ <test>This sample shows a &tricky; method.</test>
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/Dockerfile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2023 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+
17
+ ARG IMG_TAG=latest
18
+ FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
19
+
20
+ # Copy/Run this now to make the cache more resilient.
21
+ COPY fuzzbench_install_dependencies /usr/local/bin
22
+ RUN fuzzbench_install_dependencies
23
+
24
+ ENV OSS_FUZZ_ON_DEMAND=1
25
+
26
+ COPY fuzzbench_build fuzzbench_run_fuzzer fuzzbench_measure /usr/local/bin/
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_build ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/bash -eux
2
+ # Copyright 2023 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ # TODO(metzman): Do this in a docket image so we don't need to waste time
19
+ # reinstalling.
20
+ PYTHONPATH=$FUZZBENCH_PATH python3 -B -u -c "from fuzzers.$FUZZING_ENGINE import fuzzer; fuzzer.build()"
21
+
22
+ if [ "$FUZZING_ENGINE" = "coverage" ]; then
23
+ cd $OUT
24
+ mkdir -p filestore/oss-fuzz-on-demand/coverage-binaries
25
+ # We expect an error regarding leading slashes. Just assume this step succeeds.
26
+ # TODO(metzman): Fix this when I get a chance.
27
+ tar -czvf filestore/oss-fuzz-on-demand/coverage-binaries/coverage-build-$PROJECT.tar.gz * /src /work || exit 0
28
+ fi
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_install_dependencies ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/bash -eux
2
+ # Copyright 2023 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ apt-get update && apt-get install -y gcc gfortran python-dev libopenblas-dev liblapack-dev cython libpq-dev
19
+ wget -O /tmp/requirements.txt https://raw.githubusercontent.com/google/fuzzbench/master/requirements.txt
20
+ pip3 install pip --upgrade
21
+ CFLAGS= CXXFLAGS= pip3 install -r /tmp/requirements.txt
22
+ rm /tmp/requirements.txt
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_measure ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/bash -eux
2
+ # Copyright 2023 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ # TODO(metzman): Make these configurable.
19
+ export DB_PATH=$OUT/experiment.db
20
+ export SNAPSHOT_PERIOD=30
21
+ export EXPERIMENT_FILESTORE=$OUT/filestore
22
+ export MAX_TOTAL_TIME=120
23
+ export EXPERIMENT=oss-fuzz-on-demand
24
+
25
+ rm -f $DB_PATH
26
+
27
+ # FUZZER=mopt BENCHMARK=skcms
28
+
29
+ export SQL_DATABASE_URL=sqlite:///$DB_PATH
30
+
31
+ cd $FUZZBENCH_PATH
32
+ PYTHONPATH=. python3 -B experiment/measurer/standalone.py $MAX_TOTAL_TIME
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_run_fuzzer ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/bash -eux
2
+ # Copyright 2023 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ export RUNNER_NICENESS="-5"
19
+ export EXPERIMENT_FILESTORE=$OUT/filestore
20
+ export EXPERIMENT=oss-fuzz-on-demand
21
+ export OSS_FUZZ_ON_DEMAND=1
22
+ export OUTPUT_CORPUS_DIR=/output-corpus
23
+ export SEED_CORPUS_DIR=/input-corpus
24
+ mkdir $SEED_CORPUS_DIR
25
+ rm -rf $OUTPUT_CORPUS_DIR
26
+ mkdir $OUTPUT_CORPUS_DIR
27
+ export FUZZER=$FUZZING_ENGINE
28
+ # TODO(metzman): Make this configurable.
29
+ export MAX_TOTAL_TIME=120
30
+ export SNAPSHOT_PERIOD=30
31
+ export TRIAL_ID=1
32
+ export FORCE_LOCAL=1
33
+
34
+ # BENCHMARK, FUZZ_TARGET
35
+ cd $OUT
36
+
37
+ # Prevent permissions issues with pyc files and docker.
38
+ cp -r $FUZZBENCH_PATH /tmp/fuzzbench
39
+
40
+ PYTHONPATH=/tmp/fuzzbench nice -n $RUNNER_NICENESS python3 -B -u /tmp/fuzzbench/experiment/runner.py
41
+ cat $EXPERIMENT_FILESTORE/$EXPERIMENT/experiment-folders/$BENCHMARK-$FUZZER/trial-$TRIAL_ID/results/fuzzer-log.txt
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-go/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+
17
+ ARG IMG_TAG=latest
18
+ FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
19
+
20
+ # Set up Golang environment variables (copied from /root/.bash_profile).
21
+ ENV GOPATH /root/go
22
+
23
+ # /root/.go/bin is for the standard Go binaries (i.e. go, gofmt, etc).
24
+ # $GOPATH/bin is for the binaries from the dependencies installed via "go get".
25
+ ENV PATH $PATH:/root/.go/bin:$GOPATH/bin
26
+
27
+ COPY gosigfuzz.c $GOPATH/gosigfuzz/
28
+
29
+ RUN install_go.sh
30
+
31
+ # TODO(jonathanmetzman): Install this file using install_go.sh.
32
+ COPY ossfuzz_coverage_runner.go \
33
+ $GOPATH/
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-go/gosigfuzz.c ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2023 Google LLC
3
+
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ #include<stdlib.h>
18
+ #include<signal.h>
19
+
20
+ static void fixSignalHandler(int signum) {
21
+ struct sigaction new_action;
22
+ struct sigaction old_action;
23
+ sigemptyset (&new_action.sa_mask);
24
+ sigaction (signum, NULL, &old_action);
25
+ new_action.sa_flags = old_action.sa_flags | SA_ONSTACK;
26
+ new_action.sa_sigaction = old_action.sa_sigaction;
27
+ new_action.sa_handler = old_action.sa_handler;
28
+ sigaction (signum, &new_action, NULL);
29
+ }
30
+
31
+ static void FixStackSignalHandler() {
32
+ fixSignalHandler(SIGSEGV);
33
+ fixSignalHandler(SIGABRT);
34
+ fixSignalHandler(SIGALRM);
35
+ fixSignalHandler(SIGINT);
36
+ fixSignalHandler(SIGTERM);
37
+ fixSignalHandler(SIGBUS);
38
+ fixSignalHandler(SIGFPE);
39
+ fixSignalHandler(SIGXFSZ);
40
+ fixSignalHandler(SIGUSR1);
41
+ fixSignalHandler(SIGUSR2);
42
+ }
43
+
44
+ int LLVMFuzzerInitialize(int *argc, char ***argv) {
45
+ FixStackSignalHandler();
46
+ return 0;
47
+ }
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-go/ossfuzz_coverage_runner.go ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2020 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ package mypackagebeingfuzzed
16
+
17
+ import (
18
+ "io/fs"
19
+ "io/ioutil"
20
+ "os"
21
+ "path/filepath"
22
+ "runtime/pprof"
23
+ "testing"
24
+ )
25
+
26
+ func TestFuzzCorpus(t *testing.T) {
27
+ dir := os.Getenv("FUZZ_CORPUS_DIR")
28
+ if dir == "" {
29
+ t.Logf("No fuzzing corpus directory set")
30
+ return
31
+ }
32
+ filename := ""
33
+ defer func() {
34
+ if r := recover(); r != nil {
35
+ t.Error("Fuzz panicked in "+filename, r)
36
+ }
37
+ }()
38
+ profname := os.Getenv("FUZZ_PROFILE_NAME")
39
+ if profname != "" {
40
+ f, err := os.Create(profname + ".cpu.prof")
41
+ if err != nil {
42
+ t.Logf("error creating profile file %s\n", err)
43
+ } else {
44
+ _ = pprof.StartCPUProfile(f)
45
+ }
46
+ }
47
+ _, err := ioutil.ReadDir(dir)
48
+ if err != nil {
49
+ t.Logf("Not fuzzing corpus directory %s", err)
50
+ return
51
+ }
52
+ // recurse for regressions subdirectory
53
+ err = filepath.Walk(dir, func(fname string, info fs.FileInfo, err error) error {
54
+ if info.IsDir() {
55
+ return nil
56
+ }
57
+ data, err := ioutil.ReadFile(fname)
58
+ if err != nil {
59
+ t.Error("Failed to read corpus file", err)
60
+ return err
61
+ }
62
+ filename = fname
63
+ FuzzFunction(data)
64
+ return nil
65
+ })
66
+ if err != nil {
67
+ t.Error("Failed to run corpus", err)
68
+ }
69
+ if profname != "" {
70
+ pprof.StopCPUProfile()
71
+ f, err := os.Create(profname + ".heap.prof")
72
+ if err != nil {
73
+ t.Logf("error creating heap profile file %s\n", err)
74
+ }
75
+ if err = pprof.WriteHeapProfile(f); err != nil {
76
+ t.Logf("error writing heap profile file %s\n", err)
77
+ }
78
+ f.Close()
79
+ }
80
+ }
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-javascript/Dockerfile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+
17
+ ARG IMG_TAG=latest
18
+ FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
19
+
20
+ RUN install_javascript.sh
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-jvm/Dockerfile ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+
17
+ ARG IMG_TAG=latest
18
+ FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG} AS base
19
+
20
+ ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
21
+ ENV JAVA_15_HOME /usr/lib/jvm/java-15-openjdk-amd64
22
+ ENV JVM_LD_LIBRARY_PATH $JAVA_HOME/lib/server
23
+ ENV PATH $PATH:$JAVA_HOME/bin
24
+ ENV JAZZER_API_PATH "/usr/local/lib/jazzer_api_deploy.jar"
25
+ ENV JAZZER_JUNIT_PATH "/usr/local/bin/jazzer_junit.jar"
26
+
27
+ RUN install_java.sh
28
+
29
+ RUN chmod 777 /usr/local/bin && chmod 777 /usr/local/lib
30
+
31
+ FROM base AS builder
32
+ RUN useradd -m jazzer_user
33
+
34
+ USER jazzer_user
35
+
36
+ WORKDIR $SRC
37
+
38
+ RUN git clone https://github.com/aixcc-finals/jazzer-aixcc jazzer && \
39
+ cd jazzer && \
40
+ git checkout 43791565a765b854b537d878c9cab757ff1f2140
41
+
42
+ WORKDIR $SRC/jazzer
43
+
44
+ RUN echo "build --java_runtime_version=local_jdk_17" >> .bazelrc \
45
+ && echo "build --cxxopt=-stdlib=libc++" >> .bazelrc \
46
+ && echo "build --linkopt=-lc++" >> .bazelrc
47
+
48
+ RUN bazel build \
49
+ //src/main/java/com/code_intelligence/jazzer:jazzer_standalone_deploy.jar \
50
+ //deploy:jazzer-api \
51
+ //deploy:jazzer-junit \
52
+ //launcher:jazzer
53
+
54
+ RUN cp $(bazel cquery --output=files //src/main/java/com/code_intelligence/jazzer:jazzer_standalone_deploy.jar) /usr/local/bin/jazzer_agent_deploy.jar && \
55
+ cp $(bazel cquery --output=files //launcher:jazzer) /usr/local/bin/jazzer_driver && \
56
+ cp $(bazel cquery --output=files //deploy:jazzer-api) $JAZZER_API_PATH && \
57
+ cp $(bazel cquery --output=files //deploy:jazzer-junit) $JAZZER_JUNIT_PATH
58
+
59
+ FROM base AS final
60
+
61
+ COPY --from=builder /usr/local/bin/jazzer_agent_deploy.jar /usr/local/bin/jazzer_agent_deploy.jar
62
+ COPY --from=builder /usr/local/bin/jazzer_driver /usr/local/bin/jazzer_driver
63
+ COPY --from=builder $JAZZER_API_PATH $JAZZER_API_PATH
64
+ COPY --from=builder $JAZZER_JUNIT_PATH $JAZZER_JUNIT_PATH
65
+
66
+ RUN chmod 755 /usr/local/bin && chmod 755 /usr/local/lib
67
+
68
+ WORKDIR $SRC
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-python/Dockerfile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+
17
+ ARG IMG_TAG=latest
18
+ FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
19
+
20
+ RUN install_python.sh
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-ruby/Dockerfile ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+
17
+ ARG IMG_TAG=latest
18
+ FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
19
+
20
+ RUN git clone https://github.com/trailofbits/ruzzy.git $SRC/ruzzy
21
+
22
+ RUN install_ruby.sh
23
+ ENV PATH="$PATH:/usr/local/rvm/rubies/ruby-3.3.1/bin"
24
+
25
+ RUN gem update --system 3.5.11
26
+
27
+ # Install ruzzy
28
+ WORKDIR $SRC/ruzzy
29
+
30
+ # The MAKE variable allows overwriting the make command at runtime. This forces the
31
+ # Ruby C extension to respect ENV variables when compiling, like CC, CFLAGS, etc.
32
+ ENV MAKE="make --environment-overrides V=1"
33
+
34
+ RUN CC="clang" \
35
+ CXX="clang++" \
36
+ LDSHARED="clang -shared" \
37
+ LDSHAREDXX="clang++ -shared" \
38
+ gem build
39
+
40
+ RUN MAKE="make --environment-overrides V=1" \
41
+ CC="clang" \
42
+ CXX="clang++" \
43
+ LDSHARED="clang -shared" \
44
+ LDSHAREDXX="clang++ -shared" \
45
+ CXXFLAGS="-fPIC" \
46
+ CFLAGS="-fPIC" \
47
+ RUZZY_DEBUG=1 gem install --install-dir /install/ruzzy --development --verbose ruzzy-*.gem
48
+
49
+
50
+ ENV LDSHARED="$CC -shared"
51
+ ENV LDSHAREDXX="$CXX -shared"
52
+
53
+ ENV GEM_HOME="$OUT/fuzz-gem"
54
+ ENV GEM_PATH="/install/ruzzy"
55
+
56
+ COPY ruzzy-build /usr/bin/ruzzy-build
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-ruby/ruzzy-build ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash -e
2
+ # Copyright 2024 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ fuzz_target=$(basename "$1")
19
+ echo "BASENAME: $fuzz_target ---"
20
+ harness_sh=${fuzz_target::-3}
21
+
22
+ cp $1 $OUT/$fuzz_target
23
+
24
+ echo """#!/usr/bin/env bash
25
+
26
+ ruzzy $fuzz_target
27
+ """ > $OUT/$harness_sh
28
+ chmod +x $OUT/$harness_sh
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-rust/Dockerfile ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+
17
+ ARG IMG_TAG=latest
18
+ FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
19
+
20
+ ENV CARGO_HOME=/rust
21
+ ENV RUSTUP_HOME=/rust/rustup
22
+ ENV PATH=$PATH:/rust/bin
23
+ # Set up custom environment variable for source code copy for coverage reports
24
+ ENV OSSFUZZ_RUSTPATH /rust
25
+
26
+ # Force rustup to ignore `rust-toolchain` and `rust-toolchain.toml` files by
27
+ # manually specifying what toolchain to use. Note that this environment variable
28
+ # is additionally used by `install_rust.sh` as the toolchain to install.
29
+ # cf https://rust-lang.github.io/rustup/overrides.html
30
+ ENV RUSTUP_TOOLCHAIN nightly-2024-07-12
31
+
32
+ # Configure the linker used by default for x86_64 linux to be `clang` instead of
33
+ # rustc's default of `cc` which is able to find custom-built libraries like
34
+ # `libc++` by default more easily.
35
+ ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER clang
36
+
37
+ RUN install_rust.sh
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-swift/Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+
17
+ ARG IMG_TAG=latest
18
+ FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
19
+
20
+ RUN install_swift.sh
21
+
22
+ COPY precompile_swift /usr/local/bin/
local-test-libxml2-delta-02/fuzz-tooling/infra/base-images/base-builder-swift/precompile_swift ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash -eu
2
+ # Copyright 2021 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ cp /usr/local/bin/llvm-symbolizer-swift $OUT/llvm-symbolizer
19
+
20
+ export SWIFTFLAGS="-Xswiftc -parse-as-library -Xswiftc -static-stdlib --static-swift-stdlib"
21
+ if [ "$SANITIZER" = "coverage" ]
22
+ then
23
+ export SWIFTFLAGS="$SWIFTFLAGS -Xswiftc -profile-generate -Xswiftc -profile-coverage-mapping -Xswiftc -sanitize=fuzzer"
24
+ else
25
+ export SWIFTFLAGS="$SWIFTFLAGS -Xswiftc -sanitize=fuzzer,$SANITIZER --sanitize=$SANITIZER"
26
+ for f in $CFLAGS; do
27
+ export SWIFTFLAGS="$SWIFTFLAGS -Xcc=$f"
28
+ done
29
+
30
+ for f in $CXXFLAGS; do
31
+ export SWIFTFLAGS="$SWIFTFLAGS -Xcxx=$f"
32
+ done
33
+ fi