--- parser3/src/main/pa_globals.C 2003/01/29 11:06:44 1.152.2.6 +++ parser3/src/main/pa_globals.C 2003/02/26 11:51:15 1.152.2.16 @@ -1,11 +1,11 @@ /** @file Parser: globals. - Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_GLOBALS_C="$Date: 2003/01/29 11:06:44 $"; +static const char* IDENT_GLOBALS_C="$Date: 2003/02/26 11:51:15 $"; #include "pa_config_includes.h" @@ -26,121 +26,6 @@ extern "C" { #include "pa_stylesheet_manager.h" #endif -#define AUTO_FILE_NAME "auto.p" - -#define CONTENT_TYPE_NAME "content-type" -#define BODY_NAME "body" -#define DOWNLOAD_NAME "download" -#define VALUE_NAME "value" -#define EXPIRES_NAME "expires" -#define PATH_NAME "path" -#define NAME_NAME "name" -#define NONAME_DAT "noname.dat" -#define SIZE_NAME "size" -#define TEXT_NAME "text" - -#define CONF_METHOD_NAME "conf" -#define AUTO_METHOD_NAME "auto" - -#define MAIN_CLASS_NAME "MAIN" - -#define DEFAULTS_NAME "DEFAULTS" -#define CHARSETS_NAME "CHARSETS" -#define MIME_TYPES_NAME "MIME-TYPES" -#define ORIGINS_MODE_NAME "ORIGINS" - -#define RESULT_VAR_NAME "result" -#define MATCH_VAR_NAME "match" - -#define EXCEPTION_VAR_NAME "exception" -#define EXCEPTION_TYPE_PART_NAME "type" -#define EXCEPTION_SOURCE_PART_NAME "source" -#define EXCEPTION_COMMENT_PART_NAME "comment" -#define EXCEPTION_HANDLED_PART_NAME "handled" - - -#define DATE_CALENDAR_WEEKNO_NAME "week" -#define DATE_CALENDAR_WEEKYEAR_NAME "year" - -#define CONTENT_DISPOSITION_NAME "content-disposition" -#define CONTENT_DISPOSITION_VALUE "attachment" -#define CONTENT_DISPOSITION_FILENAME_NAME "filename" - -#define SWITCH_DATA_NAME "SWITCH-DATA" - -#define CACHE_DATA_NAME "CACHE-DATA" - -#define CLASS_PATH_NAME "CLASS_PATH" - -#define SQL_LIMIT_NAME "limit" -#define SQL_OFFSET_NAME "offset" -#define SQL_DEFAULT_NAME "default" -#define SQL_DISTINCT_NAME "distinct" - -#define HASH_DEFAULT_ELEMENT_NAME "_default" - -#define HTTP_METHOD_NAME "method" -#define HTTP_TIMEOUT_NAME "timeout" -#define HTTP_HEADERS_NAME "headers" -#define HTTP_ANY_STATUS_NAME "any-status" -#define FILE_STATUS_NAME "status" - -StringPtr content_type_name(new String(CONTENT_TYPE_NAME)); -StringPtr body_name(new String(BODY_NAME)); -StringPtr download_name(new String(DOWNLOAD_NAME)); -StringPtr value_name(new String(VALUE_NAME)); -StringPtr expires_name(new String(EXPIRES_NAME)); -StringPtr path_name(new String(PATH_NAME)); -StringPtr name_name(new String(NAME_NAME)); -StringPtr size_name(new String(SIZE_NAME)); -StringPtr text_name(new String(TEXT_NAME)); - -StringPtr content_disposition_name(new String(CONTENT_DISPOSITION_NAME)); -StringPtr content_disposition_value(new String(CONTENT_DISPOSITION_VALUE)); -StringPtr content_disposition_filename_name(new String(CONTENT_DISPOSITION_FILENAME_NAME)); - -StringPtr conf_method_name(new String(CONF_METHOD_NAME)); -StringPtr auto_method_name(new String(AUTO_METHOD_NAME)); - -StringPtr main_class_name(new String(MAIN_CLASS_NAME)); - -StringPtr result_var_name(new String(RESULT_VAR_NAME)); -StringPtr match_var_name(new String(MATCH_VAR_NAME)); - -StringPtr exception_var_name(new String(EXCEPTION_VAR_NAME)); -StringPtr exception_type_part_name(new String(EXCEPTION_TYPE_PART_NAME)); -StringPtr exception_source_part_name(new String(EXCEPTION_SOURCE_PART_NAME)); -StringPtr exception_comment_part_name(new String(EXCEPTION_COMMENT_PART_NAME)); -StringPtr exception_handled_part_name(new String(EXCEPTION_HANDLED_PART_NAME)); - -StringPtr charsets_name(new String(CHARSETS_NAME)); -StringPtr mime_types_name(new String(MIME_TYPES_NAME)); -StringPtr origins_mode_name(new String(ORIGINS_MODE_NAME)); - -StringPtr class_path_name(new String(CLASS_PATH_NAME)); - -//^switch ^case -StringPtr switch_data_name(new String(SWITCH_DATA_NAME)); - -//^cache -StringPtr cache_data_name(new String(CACHE_DATA_NAME)); - -// sql -StringPtr sql_limit_name(new String(SQL_LIMIT_NAME)); -StringPtr sql_offset_name(new String(SQL_OFFSET_NAME)); -StringPtr sql_default_name(new String(SQL_DEFAULT_NAME)); -StringPtr sql_distinct_name(new String(SQL_DISTINCT_NAME)); - -// hash -StringPtr hash_default_element_name(new String(HASH_DEFAULT_ELEMENT_NAME)); - -// http -StringPtr http_method_name(new String(HTTP_METHOD_NAME)); -StringPtr http_timeout_name(new String(HTTP_TIMEOUT_NAME)); -StringPtr http_headers_name(new String(HTTP_HEADERS_NAME)); -StringPtr http_any_status_name(new String(HTTP_ANY_STATUS_NAME)); -StringPtr file_status_name(new String(FILE_STATUS_NAME)); - short hex_value[0x100]; #ifdef XML @@ -192,7 +77,7 @@ XML_Generic_error_info *xml_generic_erro } static void -xmlParserGenericErrorFunc(void *ctx, const char *msg, ...) { +xmlParserGenericErrorFunc(void *ctx, const char* msg, ...) { pa_thread_t thread_id=pa_get_thread_id(); // infinitely looking for free slot to fill it @@ -211,7 +96,7 @@ xmlParserGenericErrorFunc(void *ctx, con size_t offset=p->message?strlen(p->message):0; p->message=(char *)realloc(p->message, offset+MAX_STRING); if(!p->message) - SAPI::die( + SAPI::abort( "out of memory in 'xmlParserGenericErrorFunc', failed to reallocate to %u bytes", offset+MAX_STRING); @@ -232,7 +117,7 @@ bool xmlHaveGenericErrors() { return xml_generic_error_info(thread_id)!=0; } -const char *xmlGenericErrors() { +const char* xmlGenericErrors() { pa_thread_t thread_id=pa_get_thread_id(); SYNCHRONIZED; // find+free blocked @@ -241,7 +126,7 @@ const char *xmlGenericErrors() { if(!p) // no errors for our thread_id registered return 0; - const char *result=p->message; + const char* result=p->message; // free slot up memset(p, 0, sizeof(*p)); @@ -259,7 +144,7 @@ const char *xmlGenericErrors() { * Returns 1 if matches, 0 otherwise */ static int -xmlFileMatchLocalhost(const char *filename) { +xmlFileMatchLocalhost(const char* filename) { if (!strncmp(filename, "http://localhost", 16)) return(1); return(0); @@ -278,7 +163,7 @@ xmlFileMatchLocalhost(const char *filena * Returns an I/O context or NULL in case of error */ static void * -xmlFileOpenLocalhost (const char *filename) { +xmlFileOpenLocalhost (const char* filename) { FILE *fd; const char* documentRoot; char path[1000]; @@ -330,7 +215,7 @@ void pa_globals_destroy(void *) { gdome_di_unref (domimpl, &exc); #endif } catch(const Exception& e) { - SAPI::die("pa_globals_destroy failed: %s", e.comment()); + SAPI::abort("pa_globals_destroy failed: %s", e.comment()); } }