--- 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 09:32:11 1.160.2.37.2.15 @@ -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 09:32:11 $"; -#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 { @@ -61,26 +60,36 @@ class Request: public PA_Object { ///@} -public: - union StackItem { - const String* string() const { return value->get_string(); } - Value* value; - ArrayOperation* ops; - VMethodFrame* method_frame; + private: + 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): value(avalue) {} - StackItem(ArrayOperation* aops): ops(aops) {} - StackItem(VMethodFrame* amethod_frame): method_frame(amethod_frame) {} + StackItem(Value& avalue): fvalue(&avalue) {} + StackItem(ArrayOperation& aops): fops(&aops) {} + StackItem(VMethodFrame& amethod_frame): fmethod_frame(&amethod_frame) {} }; + /// execution stack + Stack stack; + +public: + //@{ request processing status /// exception stack trace //Stack exception_trace; - /// execution stack - Stack stack; /// contexts VMethodFrame* method_frame; Value* rcontext; @@ -94,6 +103,11 @@ public: bool finterrupted; public: + + /// @see Stack::wipe_unused + void wipe_unused_execution_stack() { + stack.wipe_unused(); + } #ifdef RESOURCES_DEBUG /// measures @@ -266,6 +280,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); @@ -303,7 +319,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(bool can_call_operator); private: // defaults