Annotation of parser3/src/types/pa_vclass.C, revision 1.3
1.1 paf 1: /*
2: Parser
3: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.2 paf 4: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.1 paf 5:
1.3 ! paf 6: $Id: pa_vclass.C,v 1.2 2001/03/11 08:16:37 paf Exp $
1.1 paf 7: */
8:
9: #include "pa_vclass.h"
10: #include "pa_vstring.h"
11:
12: Value *VClass::get_element(const String& aname) {
13: // $NAME=my name
14: if(aname==NAME_NAME)
15: return NEW VString(fclass_alias->name());
16: // $CLASS=my class=myself
17: if(aname==CLASS_NAME)
18: return fclass_alias;
19: // $BASE=my parent
20: if(aname==BASE_NAME)
21: return fclass_alias->base();
22: // $method=junction(self+class+method)
23: if(Junction *junction=get_junction(*this, aname))
24: return NEW VJunction(*junction);
25: // $field=static field
26: return get_field(aname);
27: }
28:
29: // object_class, operator_class: (field)=value - static values only
30: void VClass::put_element(const String& name, Value *value) {
31: set_field(name, value);
32: }
1.3 ! paf 33:
! 34: void VClass::add_native_method(
! 35: const char *cstr_name,
! 36: Native_code_ptr native_code,
! 37: int min_numbered_params_count, int max_numbered_params_count) {
! 38:
! 39: String& name=*NEW String(pool()); name.APPEND_CONST(cstr_name);
! 40:
! 41: Method& method=*NEW Method(pool(),
! 42: name,
! 43: min_numbered_params_count, max_numbered_params_count,
! 44: 0/*params_names*/, 0/*locals_names*/,
! 45: 0/*parser_code*/, native_code
! 46: );
! 47: add_method(name, method);
! 48: }
E-mail: