Annotation of parser3/src/main/pa_globals.C, revision 1.142
1.15 paf 1: /** @file
1.16 paf 2: Parser: globals.
3:
1.112 paf 4: Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.113 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.133 paf 6: */
1.16 paf 7:
1.142 ! paf 8: static const char* IDENT_GLOBALS_C="$Date: 2002/11/25 14:10:52 $";
1.1 paf 9:
1.102 paf 10: #include "pa_config_includes.h"
11:
12: #ifdef XML
13: #include "libxslt/extensions.h"
14: #include "libxslt/xsltutils.h"
1.116 paf 15: extern "C" {
1.102 paf 16: #include "libexslt/exslt.h"
1.116 paf 17: };
1.102 paf 18: #endif
19:
1.1 paf 20: #include "pa_globals.h"
1.32 paf 21: #include "pa_string.h"
22: #include "pa_hash.h"
1.42 paf 23: #include "pa_sql_driver_manager.h"
1.77 parser 24: #include "pa_dictionary.h"
1.100 paf 25: #include "pa_stylesheet_manager.h"
1.83 parser 26: #include "pa_sapi.h"
1.90 paf 27: #include "pa_cache_managers.h"
1.95 paf 28: #include "pa_charsets.h"
29: #include "pa_charset.h"
1.101 paf 30: #include "pa_threads.h"
1.84 parser 31:
1.8 paf 32: String *content_type_name;
1.75 parser 33: String *charset_name;
1.8 paf 34: String *body_name;
1.13 paf 35: String *value_name;
1.14 paf 36: String *expires_name;
37: String *path_name;
1.17 paf 38: String *name_name;
39: String *size_name;
40: String *text_name;
1.8 paf 41:
1.39 paf 42: String *content_disposition_name;
43: String *content_disposition_filename_name;
44:
1.130 paf 45: String *conf_method_name;
1.1 paf 46: String *auto_method_name;
47:
48: String *main_class_name;
49:
1.6 paf 50: String *result_var_name;
1.64 parser 51: String *match_var_name;
1.6 paf 52:
1.119 paf 53: String *exception_var_name;
54: String *exception_type_part_name;
55: String *exception_source_part_name;
56: String *exception_comment_part_name;
57: String *exception_handled_part_name;
58:
1.79 parser 59: String *charsets_name;
1.36 paf 60: String *mime_types_name;
61: String *vfile_mime_type_name;
1.63 parser 62: String *origins_mode_name;
1.67 parser 63:
1.69 parser 64: String *class_path_name;
65:
1.67 parser 66: String *switch_data_name;
67:
1.120 paf 68: String *cache_data_name;
69:
1.70 parser 70: String *sql_limit_name;
71: String *sql_offset_name;
72: String *sql_default_name;
1.139 paf 73: String *sql_distinct_name;
1.70 parser 74:
1.95 paf 75: String *charset_UTF8_name;
76:
1.71 parser 77: String *hash_default_element_name;
1.42 paf 78:
1.141 paf 79: String *http_method_name;
80: String *http_timeout_name;
81: String *http_headers_name;
82: String *file_status_name;
83:
1.140 paf 84:
1.124 paf 85: Table *string_match_table_template;
1.123 paf 86:
1.135 paf 87: Table *date_calendar_table_template;
88:
1.1 paf 89: Hash *untaint_lang_name2enum;
1.140 paf 90: Hash *exif_tag_value2name;
1.1 paf 91:
1.95 paf 92: Charset *utf8_charset;
1.32 paf 93:
1.5 paf 94: short hex_value[0x100];
1.111 paf 95:
96: #ifdef XML
97: GdomeDOMImplementation *domimpl;
98: #endif
1.5 paf 99:
100: static void setup_hex_value() {
1.68 parser 101: memset(hex_value, 0, sizeof(hex_value));
1.5 paf 102: hex_value['0'] = 0;
103: hex_value['1'] = 1;
104: hex_value['2'] = 2;
105: hex_value['3'] = 3;
106: hex_value['4'] = 4;
107: hex_value['5'] = 5;
108: hex_value['6'] = 6;
109: hex_value['7'] = 7;
110: hex_value['8'] = 8;
111: hex_value['9'] = 9;
112: hex_value['A'] = 10;
113: hex_value['B'] = 11;
114: hex_value['C'] = 12;
115: hex_value['D'] = 13;
116: hex_value['E'] = 14;
117: hex_value['F'] = 15;
118: hex_value['a'] = 10;
119: hex_value['b'] = 11;
120: hex_value['c'] = 12;
121: hex_value['d'] = 13;
122: hex_value['e'] = 14;
123: hex_value['f'] = 15;
124: }
1.1 paf 125:
1.99 paf 126: #ifdef XML
1.101 paf 127:
128: const int MAX_CONCURRENT_XML_GENERIC_ERROR_THREADS=10;
129:
130: struct XML_Generic_error_info {
131: pa_thread_t thread_id;
132: char *message;
133: } xml_generic_error_infos[MAX_CONCURRENT_XML_GENERIC_ERROR_THREADS];
134:
135: XML_Generic_error_info *xml_generic_error_info(pa_thread_t thread_id) {
136: for(int i=0; i<MAX_CONCURRENT_XML_GENERIC_ERROR_THREADS; i++) {
137: XML_Generic_error_info *p=xml_generic_error_infos+i;
138: if(p->thread_id==thread_id)
139: return p;
140: }
141: return 0;
142: }
143:
1.99 paf 144: static void
1.101 paf 145: xmlParserGenericErrorFunc(void *ctx, const char *msg, ...) {
146: pa_thread_t thread_id=pa_get_thread_id();
147:
148: // infinitely looking for free slot to fill it
149: while(true) {
150: SYNCHRONIZED; // find+fill blocked
151:
152: // first try to get existing for this thread_id
153: XML_Generic_error_info *p=xml_generic_error_info(thread_id);
154: if(!p) { // occupy empty one
155: p=xml_generic_error_info(0);
156: if(!p) // wait for empty for it to appear
157: continue;
158: }
159:
1.102 paf 160: p->thread_id=thread_id;
1.101 paf 161: size_t offset=p->message?strlen(p->message):0;
162: p->message=(char *)realloc(p->message, offset+MAX_STRING);
163: if(!p->message)
164: SAPI::die(
165: "out of memory in 'xmlParserGenericErrorFunc', failed to reallocate to %u bytes",
166: offset+MAX_STRING);
167:
168: va_list args;
169: va_start(args, msg);
170: vsnprintf(p->message+offset, MAX_STRING, msg, args);
171: va_end(args);
172:
173: break;
174: }
175: }
176:
1.102 paf 177: bool xmlHaveGenericErrors() {
178: pa_thread_t thread_id=pa_get_thread_id();
179:
180: SYNCHRONIZED; // find blocked
181:
182: return xml_generic_error_info(thread_id)!=0;
183: }
184:
1.101 paf 185: const char *xmlGenericErrors() {
186: pa_thread_t thread_id=pa_get_thread_id();
187:
188: SYNCHRONIZED; // find+free blocked
189:
190: XML_Generic_error_info *p=xml_generic_error_info(thread_id);
191: if(!p) // no errors for our thread_id registered
192: return 0;
193:
194: const char *result=p->message;
195:
196: // free slot up
197: memset(p, 0, sizeof(*p));
198:
199: // it is up to caller to free it
200: return result;
1.99 paf 201: }
1.110 paf 202:
203: /**
204: * xmlFileMatchWithLocalhostEqDocumentRoot:
205: * filename: the URI for matching
206: *
207: * check if the URI matches an HTTP one
208: *
209: * Returns 1 if matches, 0 otherwise
210: */
211: static int
212: xmlFileMatchLocalhost(const char *filename) {
213: if (!strncmp(filename, "http://localhost", 16))
214: return(1);
215: return(0);
216: }
217:
218:
219: /**
220: * xmlFileOpenHttpLocalhost :
221: * filename: the URI for matching
222: *
223: * http://localhost/abc -> $ENV{DOCUMENT_ROOT}/abc | ./abc
224: *
225: * input from FILE *, supports compressed input
226: * if filename is " " then the standard input is used
227: *
228: * Returns an I/O context or NULL in case of error
229: */
230: static void *
231: xmlFileOpenLocalhost (const char *filename) {
232: FILE *fd;
233: const char* documentRoot;
234: char path[1000];
235:
236: path[0]=0;
237: strcat(path, (documentRoot=getenv("DOCUMENT_ROOT"))?documentRoot:".");
238: strcat(path, &filename[16]);
239:
240: #ifdef WIN32
241: fd = fopen(path, "rb");
242: #else
243: fd = fopen(path, "r");
244: #endif /* WIN32 */
245: return((void *) fd);
246: }
247:
248: /**
249: * xmlFileRead:
250: * @context: the I/O context
251: * @buffer: where to drop data
252: * @len: number of bytes to write
253: *
254: * Read @len bytes to @buffer from the I/O channel.
255: *
256: * Returns the number of bytes written
257: */
258: static int
259: xmlFileRead (void * context, char * buffer, int len) {
260: return(fread(&buffer[0], 1, len, (FILE *) context));
261: }
262:
263: /**
264: * xmlFileWrite:
265: * @context: the I/O context
266: * @buffer: where to drop data
267: * @len: number of bytes to write
268: *
269: * Write @len bytes from @buffer to the I/O channel.
270: *
271: * Returns the number of bytes written
272: */
273: static int
274: xmlFileWrite (void * context, const char * buffer, int len) {
275: return(fwrite(&buffer[0], 1, len, (FILE *) context));
276: }
277:
278: /**
279: * xmlFileClose:
280: * @context: the I/O context
281: *
282: * Close an I/O channel
283: */
284: static int
285: xmlFileClose (void * context) {
286: return ( ( fclose((FILE *) context) == EOF ) ? -1 : 0 );
287: }
288:
1.99 paf 289: #endif
290:
1.83 parser 291: void pa_globals_destroy(void *) {
292: try {
1.96 paf 293: #ifdef XML
294: GdomeException exc;
295: gdome_di_unref (domimpl, &exc);
296: #endif
1.93 paf 297: if(cache_managers)
298: cache_managers->~Cache_managers();
1.95 paf 299:
300: charsets->~Charsets();
1.83 parser 301:
302: } catch(const Exception& e) {
303: SAPI::die("pa_globals_destroy failed: %s", e.comment());
304: }
305: }
306:
1.108 paf 307: /// @test hint on one should call this for each thread xmlSubstituteEntitiesDefault(1);
1.27 paf 308: void pa_globals_init(Pool& pool) {
1.83 parser 309: pool.register_cleanup(pa_globals_destroy, 0);
310:
1.32 paf 311: #undef NEW
312: #define NEW new(pool)
313:
1.5 paf 314: // hex value
315: setup_hex_value();
316:
1.1 paf 317: // names
1.32 paf 318: content_type_name=NEW String(pool, CONTENT_TYPE_NAME);
1.75 parser 319: charset_name=NEW String(pool, CHARSET_NAME);
1.32 paf 320: body_name=NEW String(pool, BODY_NAME);
321: value_name=NEW String(pool, VALUE_NAME);
322: expires_name=NEW String(pool, EXPIRES_NAME);
323: path_name=NEW String(pool, PATH_NAME);
324: name_name=NEW String(pool, NAME_NAME);
325: size_name=NEW String(pool, SIZE_NAME);
326: text_name=NEW String(pool, TEXT_NAME);
327:
1.39 paf 328: content_disposition_name=NEW String(pool, CONTENT_DISPOSITION_NAME);
329: content_disposition_filename_name=NEW String(pool, CONTENT_DISPOSITION_FILENAME_NAME);
1.32 paf 330:
1.130 paf 331: conf_method_name=NEW String(pool, CONF_METHOD_NAME);
1.32 paf 332: auto_method_name=NEW String(pool, AUTO_METHOD_NAME);
333:
334: main_class_name=NEW String(pool, MAIN_CLASS_NAME);
1.6 paf 335:
1.32 paf 336: result_var_name=NEW String(pool, RESULT_VAR_NAME);
1.64 parser 337: match_var_name=NEW String(pool, MATCH_VAR_NAME);
1.6 paf 338:
1.119 paf 339: exception_var_name=NEW String(pool, EXCEPTION_VAR_NAME);
340: exception_type_part_name=NEW String(pool, EXCEPTION_TYPE_PART_NAME);
341: exception_source_part_name=NEW String(pool, EXCEPTION_SOURCE_PART_NAME);
342: exception_comment_part_name=NEW String(pool, EXCEPTION_COMMENT_PART_NAME);
343: exception_handled_part_name=NEW String(pool, EXCEPTION_HANDLED_PART_NAME);
1.4 paf 344:
1.79 parser 345: charsets_name=NEW String(pool, CHARSETS_NAME);
1.36 paf 346: mime_types_name=NEW String(pool, MIME_TYPES_NAME);
1.63 parser 347: origins_mode_name=NEW String(pool, ORIGINS_MODE_NAME);
1.69 parser 348:
349: class_path_name=NEW String(pool, CLASS_PATH_NAME);
1.66 parser 350:
351: //^switch ^case
352: switch_data_name=NEW String(pool, SWITCH_DATA_NAME);
1.120 paf 353:
354: //^cache
355: cache_data_name=NEW String(pool, CACHE_DATA_NAME);
1.70 parser 356:
357: // sql
358: sql_limit_name=NEW String(pool, SQL_LIMIT_NAME);
359: sql_offset_name=NEW String(pool, SQL_OFFSET_NAME);
360: sql_default_name=NEW String(pool, SQL_DEFAULT_NAME);
1.139 paf 361: sql_distinct_name=NEW String(pool, SQL_DISTINCT_NAME);
1.71 parser 362:
1.95 paf 363: // charsets
364: charset_UTF8_name=NEW String(pool, CHARSET_UTF8_NAME);
365:
1.71 parser 366: // hash
367: hash_default_element_name=NEW String(pool, HASH_DEFAULT_ELEMENT_NAME);
1.70 parser 368:
1.141 paf 369: // http
370: http_method_name=NEW String(pool, HTTP_METHOD_NAME);
371: http_timeout_name=NEW String(pool, HTTP_TIMEOUT_NAME);
372: http_headers_name=NEW String(pool, HTTP_HEADERS_NAME);
373: file_status_name=NEW String(pool, FILE_STATUS_NAME);
374:
375:
1.1 paf 376: // hashes
1.32 paf 377: untaint_lang_name2enum=NEW Hash(pool);
1.87 paf 378: #define ULN(cstr, LANG) \
379: untaint_lang_name2enum->put(*NEW String(pool, cstr), (int)String::UL_##LANG);
380: ULN("as-is", AS_IS);
381: ULN("file-spec", FILE_SPEC);
382: ULN("http-header", HTTP_HEADER);
383: ULN("mail-header", MAIL_HEADER);
384: ULN("uri", URI);
385: ULN("table", TABLE);
386: ULN("sql", SQL);
387: ULN("js", JS);
388: ULN("xml", XML);
389: ULN("html", HTML);
1.92 paf 390: ULN("optimized-html", HTML|String::UL_OPTIMIZE_BIT);
1.140 paf 391:
392: // image JPEG Exif
393: exif_tag_value2name=NEW Hash(pool);
394: #define EXIF_TAG(tag, name) \
395: { \
396: char *buf=(char *)malloc(MAX_NUMBER); \
397: snprintf(buf, MAX_NUMBER, "%u", tag); \
1.142 ! paf 398: exif_tag_value2name->put(*NEW String(pool, buf), (void *)#name); \
1.140 paf 399: }
400: // Tags used by IFD0 (main image)
401: EXIF_TAG(0x010e, ImageDescription);
402: EXIF_TAG(0x010f, Make);
403: EXIF_TAG(0x0110, Model);
404: EXIF_TAG(0x0112, Orientation);
405: EXIF_TAG(0x011a, XResolution);
406: EXIF_TAG(0x011b, YResolution);
407: EXIF_TAG(0x0128, ResolutionUnit);
408: EXIF_TAG(0x0131, Software);
409: EXIF_TAG(0x0132, DateTime);
410: EXIF_TAG(0x013e, WhitePoint);
411: EXIF_TAG(0x013f, PrimaryChromaticities);
412: EXIF_TAG(0x0211, YCbCrCoefficients);
413: EXIF_TAG(0x0213, YCbCrPositioning);
414: EXIF_TAG(0x0214, ReferenceBlackWhite);
415: EXIF_TAG(0x8298, Copyright);
416: EXIF_TAG(0x8769, ExifOffset);
417: // Tags used by Exif SubIFD
418: EXIF_TAG(0x829a, ExposureTime);
419: EXIF_TAG(0x829d, FNumber);
420: EXIF_TAG(0x8822, ExposureProgram);
421: EXIF_TAG(0x8827, ISOSpeedRatings);
422: EXIF_TAG(0x9000, ExifVersion);
423: EXIF_TAG(0x9003, DateTimeOriginal);
424: EXIF_TAG(0x9004, DateTimeDigitized);
425: EXIF_TAG(0x9101, ComponentsConfiguration);
426: EXIF_TAG(0x9102, CompressedBitsPerPixel);
427: EXIF_TAG(0x9201, ShutterSpeedValue);
428: EXIF_TAG(0x9202, ApertureValue);
429: EXIF_TAG(0x9203, BrightnessValue);
430: EXIF_TAG(0x9204, ExposureBiasValue);
431: EXIF_TAG(0x9205, MaxApertureValue);
432: EXIF_TAG(0x9206, SubjectDistance);
433: EXIF_TAG(0x9207, MeteringMode);
434: EXIF_TAG(0x9208, LightSource);
435: EXIF_TAG(0x9209, Flash);
436: EXIF_TAG(0x920a, FocalLength);
437: EXIF_TAG(0x927c, MakerNote);
438: EXIF_TAG(0x9286, UserComment);
439: EXIF_TAG(0x9290, SubsecTime);
440: EXIF_TAG(0x9291, SubsecTimeOriginal);
441: EXIF_TAG(0x9292, SubsecTimeDigitized);
442: EXIF_TAG(0xa000, FlashPixVersion);
443: EXIF_TAG(0xa001, ColorSpace);
444: EXIF_TAG(0xa002, ExifImageWidth);
445: EXIF_TAG(0xa003, ExifImageHeight);
446: EXIF_TAG(0xa004, RelatedSoundFile);
447: EXIF_TAG(0xa005, ExifInteroperabilityOffset);
448: EXIF_TAG(0xa20e, FocalPlaneXResolution);
449: EXIF_TAG(0xa20f, FocalPlaneYResolution);
450: EXIF_TAG(0xa210, FocalPlaneResolutionUnit);
451: EXIF_TAG(0xa215, ExposureIndex);
452: EXIF_TAG(0xa217, SensingMethod);
453: EXIF_TAG(0xa300, FileSource);
454: EXIF_TAG(0xa301, SceneType);
455: EXIF_TAG(0xa302, CFAPattern);
456: // Misc Tags
457: EXIF_TAG(0x00fe, NewSubfileType);
458: EXIF_TAG(0x00ff, SubfileType);
459: EXIF_TAG(0x012d, TransferFunction);
460: EXIF_TAG(0x013b, Artist);
461: EXIF_TAG(0x013d, Predictor);
462: EXIF_TAG(0x0142, TileWidth);
463: EXIF_TAG(0x0143, TileLength);
464: EXIF_TAG(0x0144, TileOffsets);
465: EXIF_TAG(0x0145, TileByteCounts);
466: EXIF_TAG(0x014a, SubIFDs);
467: EXIF_TAG(0x015b, JPEGTables);
468: EXIF_TAG(0x828d, CFARepeatPatternDim);
469: EXIF_TAG(0x828e, CFAPattern);
470: EXIF_TAG(0x828f, BatteryLevel);
471: EXIF_TAG(0x83bb, IPTC/NAA);
472: EXIF_TAG(0x8773, InterColorProfile);
473: EXIF_TAG(0x8824, SpectralSensitivity);
474: EXIF_TAG(0x8825, GPSInfo);
475: EXIF_TAG(0x8828, OECF);
476: EXIF_TAG(0x8829, Interlace);
477: EXIF_TAG(0x882a, TimeZoneOffset);
478: EXIF_TAG(0x882b, SelfTimerMode);
479: EXIF_TAG(0x920b, FlashEnergy);
480: EXIF_TAG(0x920c, SpatialFrequencyResponse);
481: EXIF_TAG(0x920d, Noise);
482: EXIF_TAG(0x9211, ImageNumber);
483: EXIF_TAG(0x9212, SecurityClassification);
484: EXIF_TAG(0x9213, ImageHistory);
485: EXIF_TAG(0x9214, SubjectLocation);
486: EXIF_TAG(0x9215, ExposureIndex);
487: EXIF_TAG(0x9216, TIFF/EPStandardID);
488: EXIF_TAG(0xa20b, FlashEnergy);
489: EXIF_TAG(0xa20c, SpatialFrequencyResponse);
490: EXIF_TAG(0xa214, SubjectLocation);
1.123 paf 491:
1.135 paf 492: // string_match_table_template
493: {
494: Array *columns=NEW Array(pool);
495: *columns+=NEW String(pool, STRING_PRE_MATCH_NAME);
496: *columns+=NEW String(pool, STRING_MATCH_NAME);
497: *columns+=NEW String(pool, STRING_POST_MATCH_NAME);
1.123 paf 498: for(int i=1; i<=MAX_STRING_MATCH_TABLE_COLUMNS; i++) {
1.125 paf 499: char *column=(char *)pool.malloc(MAX_NUMBER);
1.123 paf 500: snprintf(column, MAX_NUMBER, "%d", i);
1.135 paf 501: *columns+=NEW String(pool, column); // .i column name
502: }
503: string_match_table_template=NEW Table(pool, 0, columns);
504: }
505:
506: // date_calendar_table_template
507: {
508: Array *columns=NEW Array(pool);
509: for(int i=0; i<=6; i++) {
510: char *column=(char *)pool.malloc(MAX_NUMBER);
511: snprintf(column, MAX_NUMBER, "%d", i);
512: *columns+=NEW String(pool, column); // .i column name
1.123 paf 513: }
1.135 paf 514: *columns+=NEW String(pool, DATE_CALENDAR_WEEKNO_NAME);
1.137 paf 515: *columns+=NEW String(pool, DATE_CALENDAR_WEEKYEAR_NAME);
1.135 paf 516: date_calendar_table_template=NEW Table(pool, 0, columns);
1.123 paf 517: }
1.1 paf 518:
1.95 paf 519: // charsets
520: charsets=NEW Charsets(pool);
521: charsets->put(*charset_UTF8_name,
522: utf8_charset=NEW Charset(pool, *charset_UTF8_name, 0/*no file=system*/));
1.88 paf 523:
1.101 paf 524:
1.88 paf 525: // Status registration, must be initialized before all registrants
1.90 paf 526: cache_managers=NEW Cache_managers(pool);
1.42 paf 527:
1.73 parser 528: // SQL driver manager
1.90 paf 529: cache_managers->put(*NEW String(pool, "sql"),
530: SQL_driver_manager=NEW SQL_Driver_manager(pool));
1.74 parser 531:
1.76 parser 532: #ifdef XML
1.96 paf 533: // initializing xml libs
534:
535: /* First I get a DOMImplementation reference */
536: domimpl = gdome_di_mkref ();
537: /*
538: * Register the EXSLT extensions and the test module
539: */
540: exsltRegisterAll();
541: xsltRegisterTestModule();
542: xmlDefaultSAXHandlerInit();
543: /*
544: * disable CDATA from being built in the document tree
545: */
1.101 paf 546: // never added yet xmlDefaultSAXHandler.cdataBlock = NULL;
1.99 paf 547:
548: /*
549: * Initialization function for the XML parser.
550: * This is not reentrant. Call once before processing in case of
551: * use in multithreaded programs.
552: */
553: xmlInitParser();
1.107 paf 554:
555: // 1. this is needed for proper parsing of stylesheets
556: // there were a situation where honest entity ruined innocent xpath compilation
557: // doc says "you sould turn it on on stylesheet load" without deepening into details
558: // 2. when dom tree with entites goes under transform text nodes
559: // got [erroreosly] cut on first entity occurance
1.109 paf 560: // --
1.107 paf 561: // that is why this is:
562: xmlSubstituteEntitiesDefault(1);
1.100 paf 563:
564: // Bit in the loadsubset context field to tell to do ID/REFs lookups
565: xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS;
566: // Bit in the loadsubset context field to tell to do complete the elements attributes lists
567: // with the ones defaulted from the DTDs
1.138 paf 568: xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
569:
570: // validate each document after load/create (?)
571: //xmlDoValidityCheckingDefaultValue = 1;
1.99 paf 572:
1.104 paf 573: //regretfully this not only replaces entities on parse, but also on generate xmlSubstituteEntitiesDefault(1);
1.105 paf 574: // never switched this on xmlIndentTreeOutput=1;
1.104 paf 575:
1.101 paf 576: memset(xml_generic_error_infos, 0, sizeof(xml_generic_error_infos));
577: xmlSetGenericErrorFunc(0, xmlParserGenericErrorFunc);
1.102 paf 578: xsltSetGenericErrorFunc(0, xmlParserGenericErrorFunc);
1.105 paf 579: // FILE *f=fopen("y:\\xslt.log", "wt");
580: // xsltSetGenericDebugFunc(f/*stderr*/, 0);
1.110 paf 581:
582: // http://localhost/abc -> $ENV{DOCUMENT_ROOT}/abc | ./abc
583: xmlRegisterInputCallbacks(
584: xmlFileMatchLocalhost, xmlFileOpenLocalhost,
585: xmlFileRead, xmlFileClose);
1.96 paf 586:
587: // XSLT stylesheet manager
1.90 paf 588: cache_managers->put(*NEW String(pool, "stylesheet"),
589: stylesheet_manager=NEW Stylesheet_manager(pool));
1.76 parser 590: #endif
1.1 paf 591: }
1.76 parser 592:
593: #if defined(XML) && defined(_MSC_VER)
1.132 paf 594: # define GNOME_LIBS "/parser3project/win32xml/win32/gnome"
1.131 paf 595: # pragma comment(lib, GNOME_LIBS "/glib/lib/libglib-1.3-11.lib")
1.76 parser 596: # ifdef _DEBUG
1.131 paf 597: # pragma comment(lib, GNOME_LIBS "/libxml2-x.x.x/win32/dsp/libxml2_so_debug/libxml2.lib")
598: # pragma comment(lib, GNOME_LIBS "/libxslt-x.x.x/win32/dsp/libexslt_so_debug/libexslt.lib")
599: # pragma comment(lib, GNOME_LIBS "/libxslt-x.x.x/win32/dsp/libxslt_so_debug/libxslt.lib")
600: # pragma comment(lib, GNOME_LIBS "/gdome2-x.x.x/win32/dsp/Debug/libgdome.lib")
1.76 parser 601: # else
1.131 paf 602: # pragma comment(lib, GNOME_LIBS "/libxml2-x.x.x/win32/dsp/libxml2_so_release/libxml2.lib")
603: # pragma comment(lib, GNOME_LIBS "/libxslt-x.x.x/win32/dsp/libexslt_so_release/libexslt.lib")
604: # pragma comment(lib, GNOME_LIBS "/libxslt-x.x.x/win32/dsp/libxslt_so_release/libxslt.lib")
605: # pragma comment(lib, GNOME_LIBS "/gdome2-x.x.x/win32/dsp/Release/libgdome.lib")
1.85 paf 606: # endif
607: #endif
E-mail: