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.21 2003/01/20 17:44:00 nilsson Exp $ +  * $Id: Line.pmod,v 1.22 2003/04/07 17:12:02 nilsson Exp $    *    * Line-buffered protocol handling.    *    * Henrik Grubbström 1998-05-27    */      #pike __REAL_VERSION__      //! Simple nonblocking line-oriented I/O.   class simple   {    static object con;       //! The sequence separating lines from eachother. "\r\n" by default.    static constant line_separator = "\r\n";       //! If this variable has been set, multiple lines will be accumulated, -  //! until a line with a single @tt{'.'@} (period) is received. +  //! until a line with a single @expr{"."@} (period) is received.    //! @[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 +  //! The line with the single @expr{"."@} (period) will not be in the    //! accumulated data.    //!    //! @seealso    //! @[handle_command()]    //!    function(string:void) handle_data;       //! This function will be called once for every line that is received.    //!    //! Overload this function as appropriate.
pike.git/lib/modules/Protocols.pmod/Line.pmod:130:    } else {    handle_command(line);    }    }       static string read_buffer = "";       //! Read a line from the input.    //!    //! @returns -  //! Returns @tt{0@} when more input is needed. +  //! Returns @expr{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]    //!    static string read_line()    {
pike.git/lib/modules/Protocols.pmod/Line.pmod:176:       string line;       while( (line = read_line()) )    _handle_command(line);    }       //! Queue of data that is pending to send.    //!    //! The elements in the queue are either strings with data to send, -  //! or @tt{0@} (zero) which is the end of file marker. The connection +  //! or @expr{0@} (zero) which is the end of file marker. The connection    //! will be closed when the end of file marker is reached.    //!    //! @seealso    //! @[send()], @[disconnect()]    //!    object(ADT.Queue) send_q = ADT.Queue();       static string write_buffer = "";    static void write_callback(mixed ignored)    {
pike.git/lib/modules/Protocols.pmod/Line.pmod:277:    con = 0;    }       //! Create a simple nonblocking line-based protocol handler.    //!    //! @[con] is the connection.    //!    //! @[timeout] is an optional timeout in seconds after which the connection    //! will be closed if there has been no data sent or received.    //! -  //! If @[timeout] is @tt{0@} (zero), no timeout will be in effect. +  //! If @[timeout] is @expr{0@} (zero), no timeout will be in effect.    //!    //! @seealso    //! @[touch_time()], @[do_timeout()]    //!    void create(object(Stdio.File) con, int|void timeout)    {    this_program::con = con;    this_program::timeout = timeout;       // Start the timeout handler.
pike.git/lib/modules/Protocols.pmod/Line.pmod:316:       constant errorcodes = ([]);       //! Send an SMTP-style return-code.    //!    //! @[code] is an SMTP-style return-code.    //!    //! If @[lines] is omitted, @[errorcodes] will be used to lookup    //! an appropriate error-message.    //! -  //! If @[lines] is a string, it will be split on @tt{'\n'@} (newline), -  //! and the error-code interspersed as appropriate. +  //! If @[lines] is a string, it will be split on @expr{"\n"@} +  //! (newline), and the error-code interspersed as appropriate.    //!    //! @seealso    //! @[errorcodes]    //!    void send(int(100 .. 999) code, array(string)|string|void lines)    {    lines = lines || errorcodes[code] || "Error";       if (stringp(lines)) {    lines /= "\n";