--- parser3/src/include/pa_request.h 2003/03/24 17:52:19 1.160.2.37.2.11 +++ parser3/src/include/pa_request.h 2003/04/02 16:05:19 1.160.2.37.2.17 @@ -8,9 +8,8 @@ #ifndef PA_REQUEST_H #define PA_REQUEST_H -static const char* IDENT_REQUEST_H="$Date: 2003/03/24 17:52:19 $"; +static const char* IDENT_REQUEST_H="$Date: 2003/04/02 16:05:19 $"; -#include "pa_request_info.h" #include "pa_hash.h" #include "pa_wcontext.h" #include "pa_value.h" @@ -33,11 +32,11 @@ class Temp_lang; class Methoded; class VMethodFrame; class GdomeDOMString_auto_ptr; -class VMail; DECLARE_OBJECT_PTR(VMail); -class VForm; DECLARE_OBJECT_PTR(VForm); -class VResponse; DECLARE_OBJECT_PTR(VResponse); -class VCookie; DECLARE_OBJECT_PTR(VCookie); -class VStateless_class; DECLARE_OBJECT_PTR(VStateless_class); +class VMail; +class VForm; +class VResponse; +class VCookie; +class VStateless_class; /// Main workhorse. class Request: public PA_Object { @@ -46,6 +45,38 @@ class Request: public PA_Object { friend class Request_context_saver; friend class Temp_request_self; + union StackItem { + Value* fvalue; + ArrayOperation* fops; + VMethodFrame* fmethod_frame; + public: + Value& value() const { return *fvalue; } + const String& string() const { + const String* result=fvalue->get_string(); + assert(result); + return *result; + } + ArrayOperation& ops() const { return *fops; } + VMethodFrame& method_frame() const { return *fmethod_frame; } + + /// needed to fill unused Array entries + StackItem() {} + StackItem(Value& avalue): fvalue(&avalue) {} + StackItem(ArrayOperation& aops): fops(&aops) {} + StackItem(VMethodFrame& amethod_frame): fmethod_frame(&amethod_frame) {} + }; + + class Trace { + const String* fname; + Operation::Info forigin; + public: + Trace(const String* aname, Operation::Info aorigin): + fname(aname), forigin(aorigin) {} + + const String* name() { return fname; } + Operation::Info origin() { return forigin; } + }; + ///@{ core data /// classes @@ -53,6 +84,8 @@ class Request: public PA_Object { /// already used files to avoid cyclic uses Hash used_files; + /// list of all used files, Operation::file_no = index to it + Array file_list; /** endless execute(execute(... preventing counter @see ANTI_ENDLESS_EXECUTE_RECOURSION @@ -61,26 +94,14 @@ class Request: public PA_Object { ///@} -public: - - union StackItem { - const String* string() const { return value->get_string(); } - Value* value; - ArrayOperation* ops; - VMethodFrame* method_frame; + /// execution stack + Stack stack; - /// needed to fill unused Array entries - StackItem() {} - StackItem(Value* avalue): value(avalue) {} - StackItem(ArrayOperation* aops): ops(aops) {} - StackItem(VMethodFrame* amethod_frame): method_frame(amethod_frame) {} - }; + /// exception stack trace + Stack exception_trace; +public: //@{ request processing status - /// exception stack trace - //Stack exception_trace; - /// execution stack - Stack stack; /// contexts VMethodFrame* method_frame; Value* rcontext; @@ -94,6 +115,11 @@ public: bool finterrupted; public: + + /// @see Stack::wipe_unused + void wipe_unused_execution_stack() { + stack.wipe_unused(); + } #ifdef RESOURCES_DEBUG /// measures @@ -143,7 +169,7 @@ public: /// compiles a @a source buffer void use_buf(VStateless_class& aclass, const char* source, - const String& filespec, const char* filespec_cstr); // pa_request.C + uint file_no); // pa_request.C /// processes any code-junction there may be inside of @a value StringOrValue process(Value& input_value, bool intercept_string=true); // execute.C @@ -266,6 +292,8 @@ public: // charset helpers /// @see Charset::transcode GdomeDOMString_auto_ptr transcode(const String& s); /// @see Charset::transcode + GdomeDOMString_auto_ptr transcode(const StringBody s); + /// @see Charset::transcode const String& transcode(GdomeDOMString* s); /// @see Charset::transcode const String& transcode(xmlChar* s); @@ -281,7 +309,7 @@ private: private: // compile.C - VStateless_class& compile(VStateless_class* aclass, const char* source, const char* file); + VStateless_class& compile(VStateless_class* aclass, const char* source, uint file_no); private: // execute.C @@ -303,7 +331,7 @@ private: // execute.C /// for @main[] const String* execute_virtual_method(Value& aself, const String& method_name); - Value* get_element(bool can_call_operator); + Value& get_element(Value& ncontext, const String& name, bool can_call_operator); private: // defaults