Annotation of parser3/src/types/pa_vmethod_frame.C, revision 1.1.2.3
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.3 ! paf 8: static const char* IDENT_VSTATELESS_CLASS_C="$Date: 2003/01/31 12:10:51 $";
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:
19: StringPtr result_var_name(new String(RESULT_VAR_NAME));
20:
21: // MethodParams: methods
22:
1.1.2.3 ! paf 23: ValuePtr 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:
29: VMethodFrame::VMethodFrame(Pool& apool,
1.1.2.2 paf 30: StringPtr aname,
1.1.2.1 paf 31: const Junction& ajunction/*info: always method-junction*/,
32: VMethodFrame *acaller) :
33: WContext(0 /* empty */, 0 /* no parent, junctions can be reattached only up to VMethodFrame */ ),
34:
35: pool(apool),
36: fname(aname),
37: junction(ajunction),
38: fcaller(acaller) {
39:
40: if(junction.method->max_numbered_params_count) // this method uses numbered params?
41: fnumbered_params=MethodParamsPtr(new MethodParams(pool, fname));
42: else {
43: my=HashStringValuePtr(new HashStringValue);
44:
45: const Method &method=*junction.method;
46: if(method.locals_names) { // are there any local var names?
47: // remember them
48: // those are flags that fname is local == to be looked up in 'my'
49: for(int i=0; i<method.locals_names->count(); i++) {
50: // speedup: not checking for clash with "result" fname
51: ValuePtr value(new VVoid);
1.1.2.2 paf 52: StringPtr fname=method.locals_names->get(i);
1.1.2.1 paf 53: set_my_variable(fname, value);
54: }
55: }
56: { // always there is one local: $result
57: fresult_initial_void=ValuePtr(new VVoid);
58: set_my_variable(result_var_name, fresult_initial_void);
59: }
60: }
61: }
62:
63: ValuePtr VMethodFrame::get_result_variable() {
64: ValuePtr result=my?my->get(result_var_name):ValuePtr(0);
65: return result && result!=fresult_initial_void ? result : ValuePtr(0);
66: }
E-mail: