pike.git / lib / modules / Protocols.pmod / Line.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/Line.pmod:1:   /* -  * $Id: Line.pmod,v 1.18 2002/09/21 15:08:31 mast Exp $ +  * $Id: Line.pmod,v 1.19 2002/11/26 21:28:11 grubba Exp $    *    * Line-buffered protocol handling.    *    * Henrik Grubbström 1998-05-27    */      #pike __REAL_VERSION__      //! Simple nonblocking line-oriented I/O.   class simple
pike.git/lib/modules/Protocols.pmod/Line.pmod:21:    //! @[handle_data()] will then be called with the accumulated data    //! as the argument.    //!    //! @note    //! @[handle_data()] is one-shot, ie it will be cleared when it is called.    //!    //! The line with the single @tt{'.'@} (period) will not be in the    //! accumulated data.    //!    //! @seealso -  //! @[handle_command()] +  //! @[handle_command()]    //!    function(string:void) handle_data;       //! This function will be called once for every line that is received.    //!    //! Overload this function as appropriate.    //!    //! @note    //! It will not be called if @[handle_data()] has been set.    //!
pike.git/lib/modules/Protocols.pmod/Line.pmod:137:    //! Read a line from the input.    //!    //! @returns    //! Returns @tt{0@} when more input is needed.    //! Returns the requested line otherwise.    //!    //! @note    //! The returned line will not contain the line separator.    //!    //! @seealso -  //! @[handle_command()], @[line_separator] +  //! @[handle_command()], @[line_separator]    //!    static string read_line()    {    // FIXME: Should probably keep track of where the search ended last time.    int i = search(read_buffer, line_separator);    if (i == -1) {    return 0;    }    string data = read_buffer[..i-1]; // Not the line separator.    read_buffer = read_buffer[i+sizeof(line_separator)..];
pike.git/lib/modules/Protocols.pmod/Line.pmod:159:    return data;    }       //! Called when data has been received.    //!    //! Overload as appropriate.    //!    //! Calls the handle callbacks repeatedly until no more lines are available.    //!    //! @seealso -  //! @[handle_data()], @[handle_command()], @[read_line()] +  //! @[handle_data()], @[handle_command()], @[read_line()]    //!    static void read_callback(mixed ignored, string data)    {    touch_time();       read_buffer += data;       string line;       while( (line = read_line()) )
pike.git/lib/modules/Protocols.pmod/Line.pmod:362:    //! accumulated, and this function will be called with the resulting data.    //!    //! @note    //! @[handle_literal()] is one-shot, ie it will be cleared when it is called.    //!    function(string:void) handle_literal;       //! This function will be called once for every line that is received.    //!    //! @note -  //! This API is provided for backward compatibility; overload -  //! @[handle_command()] instead. +  //! This API is provided for backward compatibility; overload +  //! @[handle_command()] instead.    //!    //! @seealso -  //! @[handle_command()] +  //! @[Protocols.Line.simple()->handle_command()]    function(string:void) handle_line;    -  +  //! Function called once for every received line.    void handle_command(string line)    {    handle_line(line);    }       static void read_callback(mixed ignored, string data)    {    touch_time();       read_buffer += data;