--- parser3/src/classes/op.C 2003/04/03 10:51:51 1.127.2.22.2.28 +++ parser3/src/classes/op.C 2003/07/24 11:31:20 1.129 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_OP_C="$Date: 2003/04/03 10:51:51 $"; +static const char* IDENT_OP_C="$Date: 2003/07/24 11:31:20 $"; #include "classes.h" #include "pa_vmethod_frame.h" @@ -134,13 +134,18 @@ static void _taint(Request& r, MethodPar static void _process(Request& r, MethodParams& params) { Method* main_method; - Value& value=params[0]; - Value& target_self=params.count()>1? - params.as_no_junction(0, "target must not be code") - :r.get_method_frame()->caller()->self(); + size_t index=0; + Value* target_self; + Value& maybe_target_self=params[index]; + if(maybe_target_self.get_string() || maybe_target_self.get_junction()) + target_self=&r.get_method_frame()->caller()->self(); + else { + target_self=&maybe_target_self; index++; + } + { - VStateless_class *target_class=target_self.get_last_derived_class(); + VStateless_class *target_class=target_self->get_last_derived_class(); if(!target_class) throw Exception("parser.runtime", 0, @@ -153,14 +158,20 @@ static void _process(Request& r, MethodP // temporary zero @auto so it wouldn't be auto-called in Request::use_buf Temp_method temp_method_auto(*target_class, auto_method_name, 0); - if(const String* file_name=params.last().get_string()) { // ^process...[file] - r.use_file(*target_class, r.absolute(*file_name), true/*ignore_class_path*/); + size_t main_alias_index=index+1; + const String* main_alias=0; + if(main_alias_indexparser_code); } @@ -287,9 +298,12 @@ r.sql_connect_time+=t[1]-t[0]; // execute body try { r.write_assign_lang(r.process(body_code)); + connection->commit(); + connection->close(); } catch(...) { // process problem - connection->mark_to_rollback(); - rethrow; + connection->rollback(); + connection->close(); + rethrow; } } @@ -405,7 +419,7 @@ static void locked_process_and_cache_put // expiration time not spoiled by ^cache(0) or something? if(info.data->expires > time(0)) { // string -serialize> buffer - String::C serialized=info.evaluated_body->serialize( + String::Cm serialized=info.evaluated_body->serialize( sizeof(Data_string_serialized_prolog)); Data_string_serialized_prolog& prolog= *reinterpret_cast(serialized.str); @@ -421,7 +435,7 @@ const String* locked_process_and_cache_p Value& body_code, Cache_data& data, const String& file_spec) { - Locked_process_and_cache_put_action_info info; + Locked_process_and_cache_put_action_info info={0}; info.r=&r; info.data=&data; info.body_code=&body_code; @@ -438,8 +452,8 @@ const String* locked_process_and_cache_p cache_delete(file_spec); return result; } -const String* cache_get(Charset& charset, const String& file_spec, time_t now) { - File_read_result file=file_read(charset, file_spec, +const String* cache_get(Request_charsets& charsets, const String& file_spec, time_t now) { + File_read_result file=file_read(charsets, file_spec, false/*as_text*/, 0, //no params false/*fail_on_read_problem*/); @@ -524,7 +538,7 @@ static void _cache(Request& r, MethodPar // |lockSH succeeds; ... for(int retry=0; retry<2; retry++) { - if(const String* cached_body=cache_get(r.charsets.source(), file_spec, now)) { // have cached copy? + if(const String* cached_body=cache_get(r.charsets, file_spec, now)) { // have cached copy? // write it out r.write_assign_lang(*cached_body); // happy with it @@ -573,11 +587,11 @@ static void _try_operator(Request& r, Me try { result=r.process(body_code); } catch(const Exception& e) { + Request::Exception_details details=r.get_details(e); + Request_context_saver throw_context(r); // taking snapshot of throw-context [stack trace contains error] try_context.restore(); // restoring try-context to perform catch-code - Request::Exception_details details=r.get_details(e); - Junction* junction=catch_code.get_junction(); Value* method_frame=junction->method_frame; Value* saved_exception_var_value=method_frame->get_element(exception_var_name, *method_frame, false);