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 params if(this.numdatas) // defines types if(not isdef("Types")) arr = this.props("Types").value end if(arr.size() != this.numdatas) error(this.name + ' - property ' + this.props("Types").name + ' does not matches the number of points') else t = arr.get(0) if(pos(t, "args", 0) > 0) params = '' + code(t) else params = '' + code(t) + ' ' + code(this.pt_data(0).name) end for(n = 1; n < this.numdatas; n++) t = arr.get(n) if(pos(t, "args", 0) > 0) params = '' + params + ', ' + code(t) else params = '' + params + ', ' + code(t) + ' ' + code(this.pt_data(n).name) end end end end // defines type modifier t = this.props("TypeModifier").value this.tMode = ((t _and_ 1) ? 'readonly ' : '') + ((t _and_ 2) ? 'static ' : '') + ((t _and_ 4) ? 'virtual ' : '') + ((t _and_ 8) ? 'volatile ' : '') // defines delegate this.delegate = 'myDelegate' + this.id // defines handler this.handler = sys.if_null(sys.get_undef_manager('Delegate')) // 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 delegate this._blk_class.println(this.level, this.tMode, 'delegate ', this.type, ' ', this.delegate, ' (', params, ');') // declares event this._blk_vars.println(this.level, this.tMode, 'event ', this.delegate, ' ', this.instance, ';') // cleanup arr.clear() end func doEvent(data) // may be split to EventRaise blk.println(this.instance, '(', this.get_arguments(data), ');') end func doAddHandler() // Singleton.Instance.UserEvent19 += new myEvent(MyForm_Load); blk.println(this.get_namespace(), '.', this.instance, ' += new ', this.delegate, '(', this.handler, ');') end func Event return(this.instance) end func get_arguments(data) arguments = '' if(this.numdatas) dname = code(this.pt_data(0).name) arguments = d(dname) for(n = 1; n < this.numdatas; n++) dname = code(this.pt_data(n).name) arguments = '' + arguments + ', ' + d(dname) end end return(arguments) end func get_namespace() el = this.parent.get_parent_sdk() if(isdef("Namespace")) tMode = this.props("TypeModifier").value if(tMode _and_ 2) // static? namespace = code(el.cName) else namespace = code(el.instance) end else namespace = code(el.cName) + '.' + this.props("Namespace").value.instance end return(namespace) end