Annotation of parser3/src/types/pa_vmethod_frame.C, revision 1.1.2.5.2.5

1.1.2.1   paf         1: /**    @file
                      2:        Parser: method frame class.
                      3: 
1.1.2.3   paf         4:        Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
1.1.2.1   paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)\
                      6: */
                      7: 
1.1.2.5.2.5! paf         8: static const char* IDENT_VSTATELESS_CLASS_C="$Date: 2003/03/21 13:42:34 $";
1.1.2.1   paf         9: 
                     10: #include "pa_vmethod_frame.h"
                     11: #include "pa_request.h"
                     12: 
                     13: // defines
                     14: 
                     15: #define RESULT_VAR_NAME "result"
                     16: 
                     17: // globals
                     18: 
1.1.2.5.2.5! paf        19: const String result_var_name(RESULT_VAR_NAME);
1.1.2.1   paf        20: 
                     21: // MethodParams: methods
                     22: 
1.1.2.5.2.5! paf        23: Value& MethodParams::get_processed(int index, const char* msg, Request& r) {
1.1.2.1   paf        24:                return r.process_to_value(as_junction(index, msg), 0/*no name*/);
                     25: }
                     26: 
                     27: // VMethodFrame: methods
                     28: 
1.1.2.5.2.1  paf        29: VMethodFrame::VMethodFrame(
1.1.2.1   paf        30:        const Junction& ajunction/*info: always method-junction*/,
                     31:        VMethodFrame *acaller) : 
1.1.2.5.2.4  paf        32:        WContext(0/*empty*/, 0 /* no parent, junctions can be reattached only up to VMethodFrame */),
1.1.2.1   paf        33: 
1.1.2.5   paf        34:        fcaller(acaller),
                     35:        store_param_index(0),
                     36:        junction(ajunction) {
1.1.2.1   paf        37: 
                     38:        if(junction.method->max_numbered_params_count) // this method uses numbered params?
1.1.2.5.2.5! paf        39:                fnumbered_params=new MethodParams;
1.1.2.1   paf        40:        else {
1.1.2.5.2.5! paf        41:                my=new HashStringValue;
1.1.2.1   paf        42: 
                     43:                const Method &method=*junction.method;
                     44:                if(method.locals_names) { // are there any local var names?
                     45:                        // remember them
                     46:                        // those are flags that fname is local == to be looked up in 'my'
                     47:                        for(int i=0; i<method.locals_names->count(); i++) {
                     48:                                // speedup: not checking for clash with "result" fname
1.1.2.5.2.5! paf        49:                                const String& fname=*method.locals_names->get(i);
        !            50:                                set_my_variable(fname, *new VVoid);
1.1.2.1   paf        51:                        }
                     52:                }
                     53:                { // always there is one local: $result
1.1.2.5.2.5! paf        54:                        fresult_initial_void=new VVoid;
        !            55:                        set_my_variable(result_var_name, *fresult_initial_void);
1.1.2.1   paf        56:                }
                     57:        }
                     58: }
                     59: 
1.1.2.5.2.4  paf        60: Value* VMethodFrame::get_result_variable() {
                     61:        Value* result=my?my->get(result_var_name):0;
1.1.2.5.2.5! paf        62:        return result!=fresult_initial_void ? result : 0;
1.1.2.1   paf        63: }

E-mail: