Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: third_party/libxml/src/testRelax.c

Issue 1193533007: Upgrade to libxml 2.9.2 and libxslt 1.1.28 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no iconv Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libxml/src/testRegexp.c ('k') | third_party/libxml/src/testSAX.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * testRelax.c : a small tester program for RelaxNG validation 2 * testRelax.c : a small tester program for RelaxNG validation
3 * 3 *
4 * See Copyright for the status of this software. 4 * See Copyright for the status of this software.
5 * 5 *
6 * Daniel.Veillard@w3.org 6 * Daniel.Veillard@w3.org
7 */ 7 */
8 8
9 #include "libxml.h" 9 #include "libxml.h"
10 #ifdef LIBXML_SCHEMAS_ENABLED 10 #ifdef LIBXML_SCHEMAS_ENABLED
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 #include <libxml/xmlmemory.h> 43 #include <libxml/xmlmemory.h>
44 #include <libxml/debugXML.h> 44 #include <libxml/debugXML.h>
45 #include <libxml/relaxng.h> 45 #include <libxml/relaxng.h>
46 46
47 #ifdef LIBXML_DEBUG_ENABLED 47 #ifdef LIBXML_DEBUG_ENABLED
48 static int debug = 0; 48 static int debug = 0;
49 #endif 49 #endif
50 static int noout = 0; 50 static int noout = 0;
51 static int tree = 0; 51 static int tree = 0;
52 #ifdef HAVE_SYS_MMAN_H 52 #ifdef HAVE_MMAP
53 static int memory = 0; 53 static int memory = 0;
54 #endif 54 #endif
55 55
56 56
57 int main(int argc, char **argv) { 57 int main(int argc, char **argv) {
58 int i; 58 int i;
59 int files = 0; 59 int files = 0;
60 xmlRelaxNGPtr schema = NULL; 60 xmlRelaxNGPtr schema = NULL;
61 61
62 for (i = 1; i < argc ; i++) { 62 for (i = 1; i < argc ; i++) {
63 #ifdef LIBXML_DEBUG_ENABLED 63 #ifdef LIBXML_DEBUG_ENABLED
64 if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) 64 if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
65 debug++; 65 debug++;
66 else 66 else
67 #endif 67 #endif
68 #ifdef HAVE_SYS_MMAN_H 68 #ifdef HAVE_MMAP
69 if ((!strcmp(argv[i], "-memory")) || (!strcmp(argv[i], "--memory"))) { 69 if ((!strcmp(argv[i], "-memory")) || (!strcmp(argv[i], "--memory"))) {
70 memory++; 70 memory++;
71 } else 71 } else
72 #endif 72 #endif
73 if ((!strcmp(argv[i], "-noout")) || (!strcmp(argv[i], "--noout"))) { 73 if ((!strcmp(argv[i], "-noout")) || (!strcmp(argv[i], "--noout"))) {
74 noout++; 74 noout++;
75 } else 75 } else
76 if ((!strcmp(argv[i], "-tree")) || (!strcmp(argv[i], "--tree"))) { 76 if ((!strcmp(argv[i], "-tree")) || (!strcmp(argv[i], "--tree"))) {
77 tree++; 77 tree++;
78 } 78 }
79 } 79 }
80 xmlLineNumbersDefault(1); 80 xmlLineNumbersDefault(1);
81 xmlSubstituteEntitiesDefault(1); 81 xmlSubstituteEntitiesDefault(1);
82 for (i = 1; i < argc ; i++) { 82 for (i = 1; i < argc ; i++) {
83 if (argv[i][0] != '-') { 83 if (argv[i][0] != '-') {
84 if (schema == NULL) { 84 if (schema == NULL) {
85 xmlRelaxNGParserCtxtPtr ctxt; 85 xmlRelaxNGParserCtxtPtr ctxt;
86 86
87 #ifdef HAVE_SYS_MMAN_H 87 #ifdef HAVE_MMAP
88 if (memory) { 88 if (memory) {
89 int fd; 89 int fd;
90 struct stat info; 90 struct stat info;
91 const char *base; 91 const char *base;
92 » » if (stat(argv[i], &info) < 0) 92 » » if (stat(argv[i], &info) < 0)
93 break; 93 break;
94 if ((fd = open(argv[i], O_RDONLY)) < 0) 94 if ((fd = open(argv[i], O_RDONLY)) < 0)
95 break; 95 break;
96 base = mmap(NULL, info.st_size, PROT_READ, 96 base = mmap(NULL, info.st_size, PROT_READ,
97 MAP_SHARED, fd, 0) ; 97 MAP_SHARED, fd, 0) ;
98 if (base == (void *) MAP_FAILED) 98 if (base == (void *) MAP_FAILED)
99 break; 99 break;
100 100
101 ctxt = xmlRelaxNGNewMemParserCtxt((char *)base,info.st_size) ; 101 ctxt = xmlRelaxNGNewMemParserCtxt((char *)base,info.st_size) ;
102 102
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 xmlRelaxNGFree(schema); 167 xmlRelaxNGFree(schema);
168 if (files == 0) { 168 if (files == 0) {
169 printf("Usage : %s [--debug] [--noout] schemas XMLfiles ...\n", 169 printf("Usage : %s [--debug] [--noout] schemas XMLfiles ...\n",
170 argv[0]); 170 argv[0]);
171 printf("\tParse the HTML files and output the result of the parsing\n"); 171 printf("\tParse the HTML files and output the result of the parsing\n");
172 #ifdef LIBXML_DEBUG_ENABLED 172 #ifdef LIBXML_DEBUG_ENABLED
173 printf("\t--debug : dump a debug tree of the in-memory document\n"); 173 printf("\t--debug : dump a debug tree of the in-memory document\n");
174 #endif 174 #endif
175 printf("\t--noout : do not print the result\n"); 175 printf("\t--noout : do not print the result\n");
176 printf("\t--tree : print the intermediate Relax-NG document tree\n"); 176 printf("\t--tree : print the intermediate Relax-NG document tree\n");
177 #ifdef HAVE_SYS_MMAN_H 177 #ifdef HAVE_MMAP
178 printf("\t--memory : test the schemas in memory parsing\n"); 178 printf("\t--memory : test the schemas in memory parsing\n");
179 #endif 179 #endif
180 } 180 }
181 xmlRelaxNGCleanupTypes(); 181 xmlRelaxNGCleanupTypes();
182 xmlCleanupParser(); 182 xmlCleanupParser();
183 xmlMemoryDump(); 183 xmlMemoryDump();
184 184
185 return(0); 185 return(0);
186 } 186 }
187 187
188 #else 188 #else
189 #include <stdio.h> 189 #include <stdio.h>
190 int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { 190 int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
191 printf("%s : RelaxNG support not compiled in\n", argv[0]); 191 printf("%s : RelaxNG support not compiled in\n", argv[0]);
192 return(0); 192 return(0);
193 } 193 }
194 #endif /* LIBXML_SCHEMAS_ENABLED */ 194 #endif /* LIBXML_SCHEMAS_ENABLED */
OLDNEW
« no previous file with comments | « third_party/libxml/src/testRegexp.c ('k') | third_party/libxml/src/testSAX.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698