func init // defines instance el = this.parent.get_parent_sdk() this.setfield('cName', code(el.cName)) this.setfield('instance', code(el.instance)) // defines level this.level = isdef("AccessModifier") ? '' : lower(this.props("AccessModifier").value) // defines type modifier t = this.props("TypeModifier").value this.tMode = ((t _and_ 1) ? 'static ' : '') + ((t _and_ 2) ? 'virtual ' : '') + ((t _and_ 4) ? 'volatile ' : '') // initialize types if(not isdef("Types")) this.arr = this.props("Types").value end // initialize 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 constructor body event("onBody") // create a blocks of the element sys.create_blocks() // defines comments if(not isdef("Comment")) arr = this.props("Comment").value if(arr.size()) for(i = 0; i < arr.size(); i++) this._blk.println('/// ', code(arr.get(i))) end end end // defines attributes if(not isdef("Attributes")) arr = this.props("Attributes").value attr = code(arr.join(',')) this._blk.println('[', attr, ']') end // declares constructor this._blk.println(len(this.level) ? this.level + ' ' : '', this.cName , '(', code(params), ') : this()') .println('{').inc() sys.copy_blocks() this._blk.dec().println('}') // restore original blocks sys.all_blocks_restore() // cleanup arr.clear() end func doConstructor(data) blk.println(this.instance, ' = new ', this.cName, '(', this.get_arguments(data), ');') end func get_type(pname) return(this.arr.get(1 + code(copy(pname, 1)) - 2)) 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