--- parser3/src/include/pa_request.h 2015/10/26 01:21:56 1.221 +++ parser3/src/include/pa_request.h 2016/09/29 18:49:43 1.227 @@ -8,7 +8,7 @@ #ifndef PA_REQUEST_H #define PA_REQUEST_H -#define IDENT_PA_REQUEST_H "$Id: pa_request.h,v 1.221 2015/10/26 01:21:56 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()