--- parser3/src/include/pa_request.h 2015/10/21 21:45:25 1.220 +++ parser3/src/include/pa_request.h 2016/09/29 18:49:43 1.227 @@ -1,14 +1,14 @@ /** @file Parser: request class decl. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_REQUEST_H #define PA_REQUEST_H -#define IDENT_PA_REQUEST_H "$Id: pa_request.h,v 1.220 2015/10/21 21:45:25 moko Exp $" +#define IDENT_PA_REQUEST_H "$Id: pa_request.h,v 1.227 2016/09/29 18:49:43 moko Exp $" #include "pa_pool.h" #include "pa_hash.h" @@ -112,7 +112,7 @@ private: ///@{ core data /// classes - HashString fclasses; + HashString fclasses; /// already used files to avoid cyclic uses HashString used_files; @@ -180,8 +180,9 @@ public: ~Request(); /// global classes - HashString& classes() { return fclasses; } - Value* get_class(const String& name); + HashString& classes() { return fclasses; } + VStateless_class* get_class(const String& name); + void put_class(VStateless_class *aclass){ classes().put(aclass->type(), aclass); } /** core request processing @@ -197,7 +198,7 @@ public: void execute(ArrayOperation& ops); // execute.C void op_call(VMethodFrame &frame); void op_call_write(VMethodFrame &frame); - Value& construct(Value &class_value, const Method &method); + Value& construct(VStateless_class &class_value, const Method &method); /// execute ops with anti-recoursion check void recoursion_checked_execute(/*const String& name, */ArrayOperation& ops) { @@ -230,28 +231,20 @@ public: int line_no_offset=0); /// processes any code-junction there may be inside of @a value - StringOrValue process_getter(Junction& junction); // execute.C - StringOrValue process(Value& input_value, bool intercept_string=true); // execute.C + Value& process_getter(Junction& junction); // execute.C + Value& process(Value& input_value, bool intercept_string=true); // execute.C void process_write(Value& input_value); // execute.C //@{ convinient helpers const String& process_to_string(Value& input_value) { return process(input_value, true/*intercept_string*/).as_string(); } Value& process_to_value(Value& input_value, bool intercept_string=true) { - return process(input_value, intercept_string).as_value(); + return process(input_value, intercept_string); } //@} const String* get_method_filename(const Method* method); // execute.C const String* get_used_filename(uint file_no); -#define DEFINE_DUAL(modification) \ - void write_##modification##_lang(StringOrValue dual) { \ - if(const String* string=dual.get_string()) \ - write_##modification##_lang(*string); \ - else \ - write_##modification##_lang(*dual.get_value()); \ - } - /// appending, sure of clean string inside void write_no_lang(const String& astring) { wcontext->write(astring, @@ -274,7 +267,6 @@ public: void write_pass_lang(Value& avalue) { wcontext->write(avalue, String::L_PASS_APPENDED); } - DEFINE_DUAL(pass) /// appending possible string, assigning untaint language void write_assign_lang(Value& avalue) { @@ -284,7 +276,11 @@ public: void write_assign_lang(const String& astring) { wcontext->write(astring, flang); } - DEFINE_DUAL(assign) + + /// appending sure value + void write_value(Value& avalue) { + wcontext->write(avalue); + } /// returns relative to @a path path to @a file const String& relative(const char* apath, const String& relative_name); @@ -348,6 +344,7 @@ public: // status read methods VMethodFrame *get_method_frame() { return method_frame; } Value& get_self(); + #define GET_SELF(request, type) (static_cast(request.get_self())) /* for strange reason call to this: r.get_self()