|
|
| version 1.194, 2015/10/26 01:21:58 | version 1.198, 2017/02/07 22:00:43 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: globals. | Parser: globals. |
| Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) | Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| Line 17 extern "C" { | Line 17 extern "C" { |
| #endif | #endif |
| #include "pa_globals.h" | #include "pa_globals.h" |
| #include "pa_string.h" | |
| #include "pa_sapi.h" | #include "pa_sapi.h" |
| #include "pa_threads.h" | #include "pa_threads.h" |
| #include "pa_xml_io.h" | #include "pa_xml_io.h" |
| #include "pa_common.h" | #include "pa_common.h" |
| #include "pa_symbols.h" | |
| #include "pa_cache_managers.h" | #include "pa_cache_managers.h" |
| Line 34 volatile const char * IDENT_PA_GLOBALS_C | Line 34 volatile const char * IDENT_PA_GLOBALS_C |
| //#define PA_DEBUG_XML_GC_MEMORY | //#define PA_DEBUG_XML_GC_MEMORY |
| //20051130 trying to remove this, author claims that fixed a lot there // 20040920 for now both workarounds needed. wait for new libxml/xsl versions | |
| // // there is a problem with testcase, it's unstable. | |
| // // see paf@six/bug20040920/cgi-bin/t for it-showed-bug-on-20040920-day | |
| // #define PA_WORKAROUND_BUGGY_FREE_IN_LIBXML_GC_MEMORY | |
| // #define PA_WORKAROUND_BUGGY_MALLOCATOMIC_IN_LIBXML_GC_MEMORY | |
| // globals | // globals |
| short hex_value[0x100]; | short hex_value[0x100]={0}; |
| static void setup_hex_value() { | static void setup_hex_value() { |
| memset(hex_value, 0, sizeof(hex_value)); | hex_value['0'] = 0; |
| hex_value['0'] = 0; | hex_value['1'] = 1; |
| hex_value['1'] = 1; | hex_value['2'] = 2; |
| hex_value['2'] = 2; | hex_value['3'] = 3; |
| hex_value['3'] = 3; | hex_value['4'] = 4; |
| hex_value['4'] = 4; | hex_value['5'] = 5; |
| hex_value['5'] = 5; | hex_value['6'] = 6; |
| hex_value['6'] = 6; | hex_value['7'] = 7; |
| hex_value['7'] = 7; | hex_value['8'] = 8; |
| hex_value['8'] = 8; | |
| hex_value['9'] = 9; | hex_value['9'] = 9; |
| hex_value['A'] = 10; | hex_value['A'] = 10; |
| hex_value['B'] = 11; | hex_value['B'] = 11; |
| Line 123 const char* xmlGenericErrors() { | Line 116 const char* xmlGenericErrors() { |
| return 0; // no errors for our thread_id registered | return 0; // no errors for our thread_id registered |
| } | } |
| #endif | #endif // XML |
| #ifdef XML | #ifdef XML |
| Line 133 static char *pa_GC_strdup(const char *s) | Line 126 static char *pa_GC_strdup(const char *s) |
| size_t size=strlen(s)+1; | size_t size=strlen(s)+1; |
| char *result=(char *)pa_gc_malloc_atomic(size); | char *result=(char *)pa_gc_malloc_atomic(size); |
| if(!result) | if(!result) |
| pa_fail_alloc("duplicate XML string",size); | pa_fail_alloc("duplicate XML string",size); |
| Line 194 static void pa_gc_free_maybeignore(void* | Line 188 static void pa_gc_free_maybeignore(void* |
| } | } |
| #endif | #endif |
| #endif | |
| #endif // XML | |
| void pa_CORD_oom_fn(void) { | void pa_CORD_oom_fn(void) { |
| pa_fail_alloc("expand string", 0); | pa_fail_alloc("expand string", 0); |
| Line 240 void pa_globals_init() { | Line 235 void pa_globals_init() { |
| // global variables | // global variables |
| cache_managers=new Cache_managers; | cache_managers=new Cache_managers; |
| // in various libraries | // in various libraries |
| gc_substitute_memory_management_functions(); | gc_substitute_memory_management_functions(); |
| // hex value | // hex value |
| setup_hex_value(); | setup_hex_value(); |
| #ifdef SYMBOLS_CACHING | |
| // symbols cache | |
| Symbols::init(); | |
| #endif | |
| #ifdef XML | #ifdef XML |
| // initializing xml libs | // initializing xml libs |
| Line 286 void pa_globals_init() { | Line 285 void pa_globals_init() { |
| xmlSetGenericErrorFunc(0, xmlParserGenericErrorFunc); | xmlSetGenericErrorFunc(0, xmlParserGenericErrorFunc); |
| xsltSetGenericErrorFunc(0, xmlParserGenericErrorFunc); | xsltSetGenericErrorFunc(0, xmlParserGenericErrorFunc); |
| // FILE *f=fopen("y:\\xslt.log", "wt"); | // FILE *f=fopen("xslt.log", "wt"); |
| // xsltSetGenericDebugFunc(f/*stderr*/, 0); | // xsltSetGenericDebugFunc(f/*stderr*/, 0); |
| pa_xml_io_init(); | pa_xml_io_init(); |
| Line 322 void pa_dlinit() { | Line 321 void pa_dlinit() { |
| #pragma comment(lib, GC_LIB "/Release/gc.lib") | #pragma comment(lib, GC_LIB "/Release/gc.lib") |
| #endif | #endif |
| #endif | #endif // PA_DEBUG_DISABLE_GC |
| #ifdef XML | #ifdef XML |
| Line 355 void pa_dlinit() { | Line 354 void pa_dlinit() { |
| #pragma comment(lib, LIB_XSLT "libexslt.lib") | #pragma comment(lib, LIB_XSLT "libexslt.lib") |
| #endif | #endif |
| #endif | #endif // XML |
| // defines for VS2015 to link with gc/xml libs compiled in the previous VS versions | |
| #if _MSC_VER >= 1900 | |
| #pragma comment(lib,"legacy_stdio_definitions.lib") | |
| extern "C" { FILE _iob[3] = { *stdin, *stdout, *stderr }; } | |
| #endif | #endif |
| #endif // _MSC_VER |