func init if(linked("Line") and linked("doReadLine")) sys.add_var_extern('line_', 'string') end if(linked("CharInt") and linked("doRead")) sys.add_var_extern('char_', 'int') end end func doWrite(data) blk.println(d('Stream'), '.Write(', d("Data"), ');') end func doWriteLine(data) blk.println(d('Stream'), '.WriteLine(', d("Data"), ');') end func make_readline(data) return(d('Stream') && '.ReadLine()') end func doReadLine(data) if(linked("Line")) blk.println(this.line_, ' = ', make_readline(data), ';') event("onReadLine", this.line_) else event("onReadLine", make_readline(data)) end end func Line if(linked("doReadLine")) return(this.line_) else return(make_readline()) end end func make_read(data) return(d('Stream') + '.Read()') end func doRead(data) if(linked("CharInt")) blk.println(this.char_, ' = ', make_read(data), ';') event("onRead", this.char_) else event("onRead", make_read(data)) end end func CharInt if(linked("doRead")) return(this.char_) else return(make_read()) end end