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