Annotation of parser3/src/types/pa_junction.h, revision 1.2

1.2     ! paf         1: /** @file
        !             2:        Parser: Junction class decl.
        !             3: 
        !             4:        Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
        !             5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
        !             6: */
        !             7: 
        !             8: #ifndef PA_JUNCTION_H
        !             9: #define PA_JUNCTION_H
        !            10: 
        !            11: static const char* IDENT_JUNCTION_H="$Date: 2003/03/21 14:27:53 $";
        !            12: 
        !            13: 
        !            14: #include "pa_string.h"
        !            15: #include "pa_array.h"
        !            16: #include "pa_exception.h"
        !            17: #include "pa_operation.h"
        !            18: #include "pa_value.h"
        !            19: 
        !            20: /** \b junction is some code joined with context of it's evaluation.
        !            21: 
        !            22:        there are code-junctions and method-junctions
        !            23:        - code-junctions are used when some parameter passed in cury brackets
        !            24:        - method-junctions used in ^method[] calls or $method references
        !            25: 
        !            26:        Junctions register themselves in method_frame [if any] for consequent invalidation.
        !            27:        This prevents evaluation of junctions in outdated context
        !            28: 
        !            29:        To stop situations like this:
        !            30: @code
        !            31:        @main[]
        !            32:        ^method1[]
        !            33:        ^method2[]
        !            34: 
        !            35:        @method1[]
        !            36:        $junction{
        !            37:                some code
        !            38:        }
        !            39: 
        !            40:        @method2[]
        !            41:        ^junction[]
        !            42: @endcode
        !            43: 
        !            44:        On wcontext[most dynamic context of all] scope exit (WContext::~WContext()) got cleaned - 
        !            45:        Junction::wcontext becomes WContext.fparent (if any), 
        !            46:        or Junction::method_frame becomes 0 (if no parent), which later in Request::process triggers exception
        !            47: 
        !            48:        parent changing helps ^switch implementation to remain simple
        !            49: */
        !            50: class Junction: public PA_Object {
        !            51: public:
        !            52: 
        !            53:        Junction(
        !            54:                Value& aself,
        !            55:                const Method* amethod,
        !            56:                VMethodFrame* amethod_frame,
        !            57:                Value* arcontext,
        !            58:                WContext* awcontext,
        !            59:                ArrayOperation* acode);
        !            60: 
        !            61:        void reattach(WContext *new_wcontext);
        !            62: 
        !            63:        /// always present
        !            64:        Value& self;
        !            65:        //@{
        !            66:        /// @name either these // so called 'method-junction'
        !            67:        const Method* method;
        !            68:        //@}
        !            69:        //@{
        !            70:        /// @name or these are present // so called 'code-junction'
        !            71:        VMethodFrame* method_frame;
        !            72:        Value* rcontext;
        !            73:        WContext* wcontext;
        !            74:        ArrayOperation* code;
        !            75:        //@}
        !            76: };
        !            77: 
        !            78: #endif

E-mail: