|
|
| version 1.355, 2016/07/20 16:36:49 | version 1.359, 2016/09/21 15:35:11 |
|---|---|
| Line 69 const String exception_handled_part_name | Line 69 const String exception_handled_part_name |
| #define CHARSETS_NAME "CHARSETS" | #define CHARSETS_NAME "CHARSETS" |
| #define MIME_TYPES_NAME "MIME-TYPES" | #define MIME_TYPES_NAME "MIME-TYPES" |
| #define STRICT_VARS_NAME "STRICT-VARS" | #define STRICT_VARS_NAME "STRICT-VARS" |
| #define PROTOTYPE_NAME "OBJECT-PROTOTYPE" | |
| #define CONF_METHOD_NAME "conf" | #define CONF_METHOD_NAME "conf" |
| #define POST_PROCESS_METHOD_NAME "postprocess" | #define POST_PROCESS_METHOD_NAME "postprocess" |
| #define CLASS_PATH_NAME "CLASS_PATH" | #define CLASS_PATH_NAME "CLASS_PATH" |
| Line 83 static const String charsets_name(CHARSE | Line 84 static const String charsets_name(CHARSE |
| static const String main_class_name(MAIN_CLASS_NAME); | static const String main_class_name(MAIN_CLASS_NAME); |
| static const String mime_types_name(MIME_TYPES_NAME); | static const String mime_types_name(MIME_TYPES_NAME); |
| static const String strict_vars_name(STRICT_VARS_NAME); | static const String strict_vars_name(STRICT_VARS_NAME); |
| static const String prototype_name(PROTOTYPE_NAME); | |
| static const String conf_method_name(CONF_METHOD_NAME); | static const String conf_method_name(CONF_METHOD_NAME); |
| static const String post_process_method_name(POST_PROCESS_METHOD_NAME); | static const String post_process_method_name(POST_PROCESS_METHOD_NAME); |
| static const String class_path_name(CLASS_PATH_NAME); | static const String class_path_name(CLASS_PATH_NAME); |
| Line 126 Request::Request(SAPI_Info& asapi_info, | Line 128 Request::Request(SAPI_Info& asapi_info, |
| // public | // public |
| request_info(arequest_info), | request_info(arequest_info), |
| sapi_info(asapi_info), | sapi_info(asapi_info), |
| charsets(UTF8_charset, UTF8_charset, UTF8_charset), // default charsets | charsets(pa_UTF8_charset, pa_UTF8_charset, pa_UTF8_charset), // default charsets |
| main_class(VClassMAIN_create()), | main_class(VClassMAIN_create()), |
| form(*new VForm(charsets, arequest_info)), | form(*new VForm(charsets, arequest_info)), |
| Line 217 VStateless_class* Request::get_class(con | Line 219 VStateless_class* Request::get_class(con |
| return result; | return result; |
| } | } |
| static void load_charset(HashStringValue::key_type akey, | static void load_charset(HashStringValue::key_type akey, HashStringValue::value_type avalue, Request_charsets* charsets) { |
| HashStringValue::value_type avalue, | pa_charsets.load_charset(*charsets, akey, avalue->as_string()); |
| Request_charsets* charsets) { | |
| const String::Body NAME=String(akey, String::L_CLEAN).change_case(charsets->source(), String::CC_UPPER); | |
| ::charsets.load_charset(*charsets, NAME, avalue->as_string()); | |
| } | } |
| void Request::configure_admin(VStateless_class& conf_class) { | void Request::configure_admin(VStateless_class& conf_class) { |
| if(configure_admin_done) | if(configure_admin_done) |
| throw Exception(PARSER_RUNTIME, | throw Exception(PARSER_RUNTIME, 0, "parser already configured"); |
| 0, | |
| "parser already configured"); | |
| configure_admin_done=true; | configure_admin_done=true; |
| // charsets must only be specified in method_frame config | // charsets must only be specified in method_frame config |
| Line 243 void Request::configure_admin(VStateless | Line 241 void Request::configure_admin(VStateless |
| if(HashStringValue* charsets=vcharsets->get_hash()) | if(HashStringValue* charsets=vcharsets->get_hash()) |
| charsets->for_each<Request_charsets*>(load_charset, &this->charsets); | charsets->for_each<Request_charsets*>(load_charset, &this->charsets); |
| else | else |
| throw Exception(PARSER_RUNTIME, | throw Exception(PARSER_RUNTIME, 0, "$" MAIN_CLASS_NAME ":" CHARSETS_NAME " must be hash"); |
| 0, | |
| "$" MAIN_CLASS_NAME ":" CHARSETS_NAME " must be hash"); | |
| } | } |
| } | } |
| Line 254 void Request::configure_admin(VStateless | Line 250 void Request::configure_admin(VStateless |
| if(Value* strict_vars=conf_class.get_element(strict_vars_name)) { | if(Value* strict_vars=conf_class.get_element(strict_vars_name)) { |
| if(strict_vars->is_bool()) | if(strict_vars->is_bool()) |
| VVoid::strict_vars=strict_vars->as_bool(); | VVoid::strict_vars=strict_vars->as_bool(); |
| else | else |
| throw Exception(PARSER_RUNTIME, | throw Exception(PARSER_RUNTIME, 0, "$" MAIN_CLASS_NAME ":" STRICT_VARS_NAME " must be bool"); |
| 0, | } |
| "$" MAIN_CLASS_NAME ":" STRICT_VARS_NAME " must be bool"); | #endif |
| #ifdef OBJECT_PROTOTYPE | |
| VClass::prototype=true; | |
| if(Value* prototype=conf_class.get_element(prototype_name)) { | |
| if(prototype->is_bool()) | |
| VClass::prototype=prototype->as_bool(); | |
| else | |
| throw Exception(PARSER_RUNTIME, 0, "$" MAIN_CLASS_NAME ":" PROTOTYPE_NAME " must be bool"); | |
| } | } |
| #endif | #endif |
| Line 595 void Request::use_file(VStateless_class& | Line 599 void Request::use_file(VStateless_class& |
| } | } |
| } | } |
| void Request::use_buf(VStateless_class& aclass, | void Request::use_buf(VStateless_class& aclass, const char* source, const String* main_alias, uint file_no, int line_no_offset) { |
| const char* source, const String* main_alias, | // temporary zero @conf to avoid it second execution |
| uint file_no, | |
| int line_no_offset) { | |
| // temporary zero @conf so to maybe-replace it in compiled code | |
| Temp_method temp_method_conf(aclass, conf_method_name, 0); | Temp_method temp_method_conf(aclass, conf_method_name, 0); |
| // temporary zero @auto so to maybe-replace it in compiled code | // temporary zero @auto to avoid it second execution |
| Temp_method temp_method_auto(aclass, auto_method_name, 0); | Temp_method temp_method_auto(aclass, auto_method_name, 0); |
| // compile loaded classes | // compile loaded classes |
| Line 614 void Request::use_buf(VStateless_class& | Line 615 void Request::use_buf(VStateless_class& |
| VStateless_class& cclass=*cclasses.get(i); | VStateless_class& cclass=*cclasses.get(i); |
| // locate and execute possible @conf[] static | // locate and execute possible @conf[] static |
| Execute_nonvirtual_method_result executed=execute_nonvirtual_method(cclass, | Execute_nonvirtual_method_result executed=execute_nonvirtual_method(cclass, conf_method_name, vfilespec, false/*no string result needed*/); |
| conf_method_name, vfilespec, | |
| false/*no string result needed*/); | |
| if(executed.method) | if(executed.method) |
| configure_admin(cclass/*, executed.method->name*/); | configure_admin(cclass/*, executed.method->name*/); |
| // locate and execute possible @auto[] static | // locate and execute possible @auto[] static |
| execute_nonvirtual_method(cclass, | execute_nonvirtual_method(cclass, auto_method_name, vfilespec, false/*no result needed*/); |
| auto_method_name, vfilespec, | |
| false/*no result needed*/); | |
| cclass.enable_default_setter(); | cclass.enable_default_setter(); |
| } | } |