|
|
| version 1.8, 2001/03/18 11:37:52 | version 1.26, 2001/03/22 11:19:11 |
|---|---|
| Line 1 | Line 1 |
| /* | /** @file |
| Parser | Parser: globals. |
| Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) | Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) |
| $Id$ | $Id$ |
| Line 12 | Line 14 |
| #include "_int.h" | #include "_int.h" |
| #include "_table.h" | #include "_table.h" |
| #include "_form.h" | #include "_form.h" |
| #include "_env.h" | |
| #include "_request.h" | |
| #include "_response.h" | #include "_response.h" |
| #include "_file.h" | |
| Service_funcs service_funcs; | |
| String *content_type_name; | String *content_type_name; |
| String *body_name; | String *body_name; |
| String *value_name; | |
| String *expires_name; | |
| String *path_name; | |
| String *name_name; | |
| String *size_name; | |
| String *text_name; | |
| String *exception_method_name; | String *exception_method_name; |
| Line 36 String *table_class_name; | Line 41 String *table_class_name; |
| String *form_class_name; | String *form_class_name; |
| String *request_class_name; | String *request_class_name; |
| String *response_class_name; | String *response_class_name; |
| String *cookie_class_name; | |
| String *result_var_name; | String *result_var_name; |
| String *limits_name; | String *limits_name; |
| String *post_max_size_name; | String *post_max_size_name; |
| String *defaults_name; | |
| Hash *untaint_lang_name2enum; | Hash *untaint_lang_name2enum; |
| short hex_value[0x100]; | short hex_value[0x100]; |
| Line 79 void globals_init(Pool& pool) { | Line 87 void globals_init(Pool& pool) { |
| // hex value | // hex value |
| setup_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 | // names |
| NEW_STRING(content_type_name, CONTENT_TYPE_NAME); | content_type_name=new(pool) String(pool, CONTENT_TYPE_NAME); |
| NEW_STRING(body_name, BODY_NAME); | body_name=new(pool) String(pool, BODY_NAME); |
| value_name=new(pool) String(pool, VALUE_NAME); | |
| expires_name=new(pool) String(pool, EXPIRES_NAME); | |
| path_name=new(pool) String(pool, PATH_NAME); | |
| name_name=new(pool) String(pool, NAME_NAME); | |
| size_name=new(pool) String(pool, SIZE_NAME); | |
| text_name=new(pool) String(pool, TEXT_NAME); | |
| NEW_STRING(exception_method_name, EXCEPTION_METHOD_NAME); | exception_method_name=new(pool) String(pool, EXCEPTION_METHOD_NAME); |
| NEW_STRING(unnamed_name, UNNAMED_NAME); | unnamed_name=new(pool) String(pool, UNNAMED_NAME); |
| empty_string=new(pool) String(pool); | empty_string=new(pool) String(pool); |
| NEW_STRING(auto_method_name, AUTO_METHOD_NAME); | auto_method_name=new(pool) String(pool, AUTO_METHOD_NAME); |
| NEW_STRING(main_method_name, MAIN_METHOD_NAME); | main_method_name=new(pool) String(pool, MAIN_METHOD_NAME); |
| root_class_name=new(pool) String(pool, ROOT_CLASS_NAME); | |
| main_class_name=new(pool) String(pool, MAIN_CLASS_NAME); | |
| table_class_name=new(pool) String(pool, TABLE_CLASS_NAME); | |
| env_class_name=new(pool) String(pool, ENV_CLASS_NAME); | |
| form_class_name=new(pool) String(pool, FORM_CLASS_NAME); | |
| request_class_name=new(pool) String(pool, REQUEST_CLASS_NAME); | |
| response_class_name=new(pool) String(pool, RESPONSE_CLASS_NAME); | |
| cookie_class_name=new(pool) String(pool, COOKIE_CLASS_NAME); | |
| NEW_STRING(root_class_name, ROOT_CLASS_NAME); | result_var_name=new(pool) String(pool, RESULT_VAR_NAME); |
| NEW_STRING(main_class_name, MAIN_CLASS_NAME); | |
| 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); | |
| limits_name=new(pool) String(pool, LIMITS_NAME); | |
| post_max_size_name=new(pool) String(pool, POST_MAX_SIZE_NAME); | |
| NEW_STRING(limits_name, LIMITS_NAME); | defaults_name=new(pool) String(pool, DEFAULTS_NAME); |
| NEW_STRING(post_max_size_name, POST_MAX_SIZE_NAME); | |
| // hashes | // hashes |
| untaint_lang_name2enum=new(pool) Hash(pool); | untaint_lang_name2enum=new(pool) Hash(pool); |
| LOCAL_STRING(as_is, "as-is"); | String as_is(pool, "as-is"); |
| untaint_lang_name2enum->put(as_is, (int)String::Untaint_lang::AS_IS); | untaint_lang_name2enum->put(as_is, (int)String::UL_AS_IS); |
| LOCAL_STRING(table, "table"); | String file_name(pool, "file-name"); |
| untaint_lang_name2enum->put(table, (int)String::Untaint_lang::TABLE); | untaint_lang_name2enum->put(file_name, (int)String::UL_FILE_NAME); |
| LOCAL_STRING(sql, "sql"); | String header(pool, "header"); |
| untaint_lang_name2enum->put(sql, (int)String::Untaint_lang::SQL); | untaint_lang_name2enum->put(header, (int)String::UL_HEADER); |
| LOCAL_STRING(js, "js"); | String uri(pool, "uri"); |
| untaint_lang_name2enum->put(js, (int)String::Untaint_lang::JS); | untaint_lang_name2enum->put(uri, (int)String::UL_URI); |
| LOCAL_STRING(html, "html"); | String table(pool, "table"); |
| untaint_lang_name2enum->put(html, (int)String::Untaint_lang::HTML); | untaint_lang_name2enum->put(table, (int)String::UL_TABLE); |
| LOCAL_STRING(html_typo, "html-typo"); | String sql(pool, "sql"); |
| untaint_lang_name2enum->put(html_typo, (int)String::Untaint_lang::HTML_TYPO); | untaint_lang_name2enum->put(sql, (int)String::UL_SQL); |
| String js(pool, "js"); | |
| untaint_lang_name2enum->put(js, (int)String::UL_JS); | |
| String html(pool, "html"); | |
| untaint_lang_name2enum->put(html, (int)String::UL_HTML); | |
| String html_typo(pool, "html-typo"); | |
| untaint_lang_name2enum->put(html_typo, (int)String::UL_HTML_TYPO); | |
| // read-only stateless classes | // read-only stateless classes |
| initialize_string_class(pool, *(string_class=new(pool) VStateless_class(pool))); string_class->freeze(); | initialize_string_class(pool, *(string_class=new(pool) VStateless_class(pool))); string_class->freeze(); |
| initialize_double_class(pool, *(double_class=new(pool) VStateless_class(pool))); double_class->freeze(); | initialize_double_class(pool, *(double_class=new(pool) VStateless_class(pool))); double_class->freeze(); |
| initialize_int_class(pool, *(int_class=new(pool) VStateless_class(pool))); int_class->freeze(); | initialize_int_class(pool, *(int_class=new(pool) VStateless_class(pool))); int_class->freeze(); |
| initialize_table_class(pool, *(table_class=new(pool) VStateless_class(pool))); table_class->freeze(); | initialize_table_class(pool, *(table_class=new(pool) VStateless_class(pool))); table_class->freeze(); |
| initialize_file_class(pool, *(file_class=new(pool) VStateless_class(pool))); file_class->freeze(); | |
| initialize_response_class(pool, *(response_class=new(pool) VStateless_class(pool))); response_class->freeze(); | |
| // read-only stateless base classes | // 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_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(); | |
| } | } |