Annotation of parser3/src/types/pa_vstateless_class.C, revision 1.4

1.2       paf         1: /*
                      2:        Parser
                      3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
                      4:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      5: 
1.4     ! paf         6:        $Id: pa_vstateless_class.C,v 1.3 2001/03/13 20:02:11 paf Exp $
1.2       paf         7: */
                      8: 
                      9: #include "pa_vstateless_class.h"
                     10: #include "pa_vstring.h"
                     11: 
                     12: Value *VStateless_class::get_element(const String& aname) {
                     13:        // $CLASS=my class=myself
                     14:        if(aname==CLASS_NAME)
                     15:                return fclass_alias;
                     16:        // $BASE=my parent
                     17:        if(aname==BASE_NAME)
                     18:                return fclass_alias->base();
                     19:        // $method=junction(self+class+method)
                     20:        if(Junction *junction=get_junction(*this, aname))
                     21:                return NEW VJunction(*junction);
                     22: 
                     23:        return 0;
                     24: }
                     25: 
                     26: void VStateless_class::add_native_method(
                     27:        const char *cstr_name,
                     28:        Native_code_ptr native_code,
                     29:        int min_numbered_params_count, int max_numbered_params_count) {
                     30: 
1.4     ! paf        31:        String& name=*NEW String(pool(), cstr_name);
1.2       paf        32:        
                     33:        Method& method=*NEW Method(pool(),
                     34:                name,
                     35:                min_numbered_params_count, max_numbered_params_count,
                     36:                0/*params_names*/, 0/*locals_names*/,
                     37:                0/*parser_code*/, native_code
                     38:                );
                     39:        add_method(name, method);
                     40: }
                     41: 
                     42: void VStateless_class::put_method(const String& aname, Method *amethod) {
                     43:        if(read_only)
                     44:                THROW(0, 0,
                     45:                        &aname,
                     46:                        "can not add method to read-only '%s' class",
                     47:                                name().cstr());
                     48:        
                     49:        fmethods.put(aname, amethod); 
                     50: }

E-mail: