func init // initialize instance if(isdef("Name")) this.setfield('instance', this.codename) else this.setfield('instance', code(this.props("Name").value)) end // defines level this.level = isdef("AccessModifier") ? '' : lower(this.props("AccessModifier").value) // defines type if(isdef("Type")) this.type = 'void' else this.type = code(this.props("Type").value) end this.typecode = sys.type_code(this.type) // defines type modifier t = this.props("TypeModifier").value this.tMode = ((t _and_ 1) ? 'extern ' : '') + ((t _and_ 2) ? 'readonly ' : '') + ((t _and_ 4) ? 'sealed ' : '') + ((t _and_ 8) ? 'static ' : '') + ((t _and_ 16) ? 'virtual ' : '') + ((t _and_ 32) ? 'volatile ' : '') // defines params types if(not isdef("Types")) this.arr = this.props("Types").value end // defines params if(this.numvars) pname = code(this.pt_var(0).name) ptype = code(this.arr.get(0)) params = '' + ptype + ' ' + pname for(n = 1; n < this.numvars; n++) pname = code(this.pt_var(n).name) ptype = code(this.arr.get(n)) params = '' + params + ', ' + ptype + ' ' + pname end // initialize params methods for(i = 0; i < this.numvars; i++) method(code(this.pt_var(i).name)) pname = cgt.get_func_name() pcodename = code(pname) return(sub(pcodename, sys.type_code(this.get_type(pname)))) end end end // save original blocks sys.all_blocks_store() // defines method body event("onBody") // create a blocks of the element sys.create_blocks() // defines comments if(not isdef("Comment")) arr = this.props("Comment").value for(i = 0; i < arr.size(); i++) this._blk.println('/// ', code(arr.get(i))) end end // defines attributes if(not isdef("Attributes")) arr = this.props("Attributes").value attr = code(arr.join(',')) this._blk.println('[', attr, ']') end // declares method this._blk.println(len(this.level) ? this.level + ' ' : '', this.tMode, this.type, ' ', this.instance, '(', params, ')') .println('{').inc() sys.copy_blocks() this._blk.dec().println('}') // restore original blocks sys.all_blocks_restore() // cleanup arr.clear() end func doReturn(data) blk.println('return ', data, ';') end func get_type(pname) return(this.arr.get(1 + code(copy(pname, 1)) - 2)) end func doMethod(data) if(this.type == 'void') blk.println(this.instance, '(', this.get_arguments(data), ');') else dt = this.instance + '(' + this.get_arguments(data) + ')' event("onResult", sub(dt, this.typecode)) end end func get_arguments(data) arguments = '' if(this.numdatas) arr = this.props("Types").value arguments = '' + sys.to_type(d(this.pt_data(0).name), sys.type_code(arr.get(0))) for(n = 1; n < this.numdatas; n++) arguments = '' + arguments + ', ' + sys.to_type(d(this.pt_data(n).name), sys.type_code(arr.get(n))) end end return(arguments) end