--- parser3/src/main/pa_globals.C 2001/03/14 17:09:17 1.4 +++ parser3/src/main/pa_globals.C 2001/03/18 11:58:19 1.9 @@ -3,7 +3,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_globals.C,v 1.4 2001/03/14 17:09:17 paf Exp $ + $Id: pa_globals.C,v 1.9 2001/03/18 11:58:19 paf Exp $ */ #include "pa_globals.h" @@ -13,9 +13,14 @@ #include "_table.h" #include "_form.h" #include "_env.h" +#include "_request.h" +#include "_response.h" Service_funcs service_funcs; +String *content_type_name; +String *body_name; + String *exception_method_name; String *unnamed_name; @@ -29,18 +34,60 @@ String *main_class_name; String *env_class_name; String *table_class_name; String *form_class_name; +String *request_class_name; +String *response_class_name; + +String *result_var_name; String *limits_name; String *post_max_size_name; +String *defaults_name; + Hash *untaint_lang_name2enum; +short hex_value[0x100]; + +static void setup_hex_value() { + int i; + for (i=0; (i < 0x100); i++) { + hex_value[i] = 0; + } + hex_value['0'] = 0; + hex_value['1'] = 1; + hex_value['2'] = 2; + hex_value['3'] = 3; + hex_value['4'] = 4; + hex_value['5'] = 5; + hex_value['6'] = 6; + hex_value['7'] = 7; + hex_value['8'] = 8; + hex_value['9'] = 9; + hex_value['A'] = 10; + hex_value['B'] = 11; + hex_value['C'] = 12; + hex_value['D'] = 13; + hex_value['E'] = 14; + hex_value['F'] = 15; + hex_value['a'] = 10; + hex_value['b'] = 11; + hex_value['c'] = 12; + hex_value['d'] = 13; + hex_value['e'] = 14; + hex_value['f'] = 15; +} void globals_init(Pool& pool) { + // hex value + setup_hex_value(); + #define NEW_STRING(name, value) name=new(pool) String(pool); name->APPEND_CONST(value) #define LOCAL_STRING(name, value) String name(pool); name.APPEND_CONST(value) // names + NEW_STRING(content_type_name, CONTENT_TYPE_NAME); + NEW_STRING(body_name, BODY_NAME); + NEW_STRING(exception_method_name, EXCEPTION_METHOD_NAME); NEW_STRING(unnamed_name, UNNAMED_NAME); @@ -54,10 +101,17 @@ void globals_init(Pool& pool) { NEW_STRING(table_class_name, TABLE_CLASS_NAME); NEW_STRING(env_class_name, ENV_CLASS_NAME); NEW_STRING(form_class_name, FORM_CLASS_NAME); + NEW_STRING(request_class_name, REQUEST_CLASS_NAME); + NEW_STRING(response_class_name, RESPONSE_CLASS_NAME); + + NEW_STRING(result_var_name, RESULT_VAR_NAME); + NEW_STRING(limits_name, LIMITS_NAME); NEW_STRING(post_max_size_name, POST_MAX_SIZE_NAME); + NEW_STRING(defaults_name, DEFAULTS_NAME); + // hashes untaint_lang_name2enum=new(pool) Hash(pool); LOCAL_STRING(as_is, "as-is"); @@ -82,4 +136,6 @@ void globals_init(Pool& pool) { // read-only stateless base classes initialize_env_base_class(pool, *(env_base_class=new(pool) VStateless_class(pool))); env_base_class->set_name(*env_class_name); env_base_class->freeze(); initialize_form_base_class(pool, *(form_base_class=new(pool) VStateless_class(pool))); form_base_class->set_name(*form_class_name); form_base_class->freeze(); + initialize_request_base_class(pool, *(request_base_class=new(pool) VStateless_class(pool))); request_base_class->set_name(*request_class_name); request_base_class->freeze(); + initialize_response_base_class(pool, *(response_base_class=new(pool) VStateless_class(pool))); response_base_class->set_name(*response_class_name); response_base_class->freeze(); }