--- parser3/src/classes/op.C 2002/02/08 08:30:10 1.71 +++ parser3/src/classes/op.C 2002/03/04 14:51:10 1.73 @@ -4,7 +4,7 @@ Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) - $Id: op.C,v 1.71 2002/02/08 08:30:10 paf Exp $ + $Id: op.C,v 1.73 2002/03/04 14:51:10 paf Exp $ */ #include "classes.h" @@ -112,7 +112,10 @@ static void _process(Request& r, const S #endif VStateless_class& self_class=*r.self->get_class(); + const Method *main_method; { + // temporary remove language change + Temp_lang temp_lang(r, String::UL_PASS_APPENDED); // temporary zero @main so to maybe-replace it in processed code Temp_method temp_method_main(self_class, *main_method_name, 0); // temporary zero @auto so it wouldn't be auto-called in Request::use_buf @@ -129,11 +132,14 @@ static void _process(Request& r, const S place, &self_class); - // maybe-execute @main[] - if(const Method *method=self_class.get_method(*main_method_name)) { - // execute! - r.execute(*method->parser_code); - } + // main_method + main_method=self_class.get_method(*main_method_name); + } + // after restoring current-request-lang + // maybe-execute @main[] + if(main_method) { + // execute! + r.execute(*main_method->parser_code); } } @@ -387,34 +393,26 @@ Value *locked_process_and_cache_put(Requ } String *cache_get(Pool& pool, const String& file_spec) { void* data; size_t data_size; - if(!file_read(pool, file_spec, + if(file_read(pool, file_spec, data, data_size, false/*as_text*/, false/*fail_on_read_problem*/) - || !data_size/* ignore reads which are empty due to - non-unary open+lockEX conflict with lockSH */) - return 0; + && data_size/* ignore reads which are empty due to + non-unary open+lockEX conflict with lockSH */) { - Data_string_serialized_prolog& prolog= - *static_cast(data); + Data_string_serialized_prolog& prolog= + *static_cast(data); - if(data_size=sizeof(Data_string_serialized_prolog) + && prolog.version==DATA_STRING_SERIALIZED_VERSION + && result->deserialize( + sizeof(Data_string_serialized_prolog), data, data_size, file_spec.cstr())) + return result; + } - String& result=*new(pool) String(pool); - result.deserialize( - sizeof(Data_string_serialized_prolog), - data, data_size, file_spec.cstr()); - return &result; + return 0; } static void _cache(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool();