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