--- parser3/src/classes/op.C 2017/01/13 13:50:28 1.249 +++ parser3/src/classes/op.C 2019/11/22 23:11:24 1.253 @@ -1,7 +1,7 @@ /** @file Parser: parser @b operators. - Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ @@ -18,7 +18,7 @@ #include "pa_vclass.h" #include "pa_charset.h" -volatile const char * IDENT_OP_C="$Id: op.C,v 1.249 2017/01/13 13:50:28 moko Exp $"; +volatile const char * IDENT_OP_C="$Id: op.C,v 1.253 2019/11/22 23:11:24 moko Exp $"; // defines @@ -331,9 +331,10 @@ static void _continue(Request& r, Method } static void _return(Request& r, MethodParams& params) { + VMethodFrame& caller=*r.get_method_frame()->caller(); if(params.count()) - r.put_element(*r.get_method_frame(), Symbols::RESULT_SYMBOL, ¶ms[0]); // not caller as CO_WITHOUT_FRAME - r.set_skip_return(); + r.put_element(caller, Symbols::RESULT_SYMBOL, ¶ms[0]); + r.set_skip_return(caller); } static void _for(Request& r, MethodParams& params) { @@ -703,20 +704,13 @@ struct Cache_get_result { static Cache_get_result cache_get(Request_charsets& charsets, const String& file_spec, time_t now) { Cache_get_result result={0, false}; - File_read_result file=file_read(charsets, file_spec, - false/*as_text*/, - 0, //no params - false/*fail_on_read_problem*/); - if(file.success && file.length/* ignore reads which are empty due to - non-unary open+lockEX conflict with lockSH */) { - - Data_string_serialized_prolog& prolog= - *reinterpret_cast(file.str); - + File_read_result file=file_read_binary(file_spec, false /*fail_on_read_problem*/); + if(file.success && file.length /*ignore reads which are empty due to non-unary open+lockEX conflict with lockSH*/) { + + Data_string_serialized_prolog& prolog = *reinterpret_cast(file.str); + String* body=new String; - if( - file.length>=sizeof(Data_string_serialized_prolog) - && prolog.version==DATA_STRING_SERIALIZED_VERSION) { + if(file.length>=sizeof(Data_string_serialized_prolog) && prolog.version==DATA_STRING_SERIALIZED_VERSION) { if(body->deserialize(sizeof(Data_string_serialized_prolog), file.str, file.length)) { result.body=body; result.expired=prolog.expires <= now; @@ -726,8 +720,8 @@ static Cache_get_result cache_get(Reques return result; } -static time_t as_expires(Request& r, MethodParams& params, - int index, time_t now) { + +static time_t as_expires(Request& r, MethodParams& params, int index, time_t now) { time_t result; if(Value* vdate=params[index].as(VDATE_TYPE)) result=(time_t)(static_cast(vdate)->get_time()); @@ -951,7 +945,7 @@ VClassMAIN::VClassMAIN(): VClass(MAIN_CL // ^return[] // ^return[result] - add_native_method("return", Method::CT_ANY, _return, 0, 1, Method::CO_WITHOUT_FRAME); + add_native_method("return", Method::CT_ANY, _return, 0, 1); // ^for[i](from-number;to-number-inclusive){code}[delim] add_native_method("for", Method::CT_ANY, _for, 3+1, 3+1+1);