pike.git / lib / modules / Stdio.pmod

version» Context lines:

pike.git/lib/modules/Stdio.pmod:1: - // $Id: Stdio.pmod,v 1.34 1998/09/01 17:13:10 hubbe Exp $ + // $Id: Stdio.pmod,v 1.35 1998/10/21 22:13:54 grubba Exp $      #include <string.h>      inherit files;      class File   {    inherit Fd_ref;       mixed ___read_callback;    mixed ___write_callback;    mixed ___close_callback; - #if constant(__HAVE_OOB__)_ + #if constant(files.__HAVE_OOB__)    mixed ___read_oob_callback;    mixed ___write_oob_callback;   #endif    mixed ___id;      #ifdef __STDIO_DEBUG    string __closed_backtrace;   #define CHECK_OPEN() \    if(!_fd) \    { \
pike.git/lib/modules/Stdio.pmod:135:    _fd = o->dup();    }else{    _fd = o->_fd;    if(___read_callback = o->___read_callback)    _fd->_read_callback=__stdio_read_callback;       if(___write_callback = o->___write_callback)    _fd->_write_callback=__stdio_write_callback;       ___close_callback = o->___close_callback; - #if constant(__HAVE_OOB__)_ + #if constant(files.__HAVE_OOB__)    if(___read_oob_callback = o->___read_oob_callback) -  _fd->_read_oob_callback = __stdio_read_oob_callbac; +  _fd->_read_oob_callback = __stdio_read_oob_callback;       if(___write_oob_callback = o->___write_oob_callback) -  _fd->_write_oob_callback = __stdio_write_oob_callbac; +  _fd->_write_oob_callback = __stdio_write_oob_callback;   #endif    ___id = o->___id;       }    return 0;    }       object dup()    {    object to = File();    to->_fd = _fd;    if(to->___read_callback = ___read_callback)    _fd->_read_callback=to->__stdio_read_callback;       if(to->___write_callback = ___write_callback)    _fd->_write_callback=to->__stdio_write_callback;       to->___close_callback = ___close_callback; - #if constant(__HAVE_OOB__)_ + #if constant(files.__HAVE_OOB__)    if(to->___read_oob_callback = ___read_oob_callback)    _fd->_read_oob_callback=to->__stdio_read_oob_callback;       if(to->___write_oob_callback = ___write_oob_callback)    _fd->_write_oob_callback=to->__stdio_write_oob_callback;   #endif    to->___id = ___id;    return to;    }   
pike.git/lib/modules/Stdio.pmod:201:    {    ___read_callback(___id, s);    }else{    ::set_read_callback(0);    ___close_callback(___id);    }    }       static void __stdio_write_callback() { ___write_callback(___id); }    - #if constant(__HAVE_OOB__)_ + #if constant(files.__HAVE_OOB__)    static void __stdio_read_oob_callback()    {    string s=::read_oob(8192,1);    if(s && strlen(s))    {    ___read_oob_callback(___id, s);    }else{    ___close_callback(___id);    }    }
pike.git/lib/modules/Stdio.pmod:233:    SET( X , l##X ); \    } \    \    mixed query_##X () \    { \    return ___##X; \    }       CBFUNC(read_callback)    CBFUNC(write_callback) - #if constant(__HAVE_OOB__)_ + #if constant(files.__HAVE_OOB__)    CBFUNC(read_oob_callback)    CBFUNC(write_oob_callback)   #endif       mixed query_close_callback() { return ___close_callback; }    mixed set_close_callback(mixed c) { ___close_callback=c; }    void set_id(mixed i) { ___id=i; }    mixed query_id() { return ___id; }       void set_nonblocking(mixed|void rcb,    mixed|void wcb,    mixed|void ccb, - #if constant(__HAVE_OOB__)_ + #if constant(files.__HAVE_OOB__)    mixed|void roobcb,    mixed|void woobcb   #endif    )    {    CHECK_OPEN();    ::_disable_callbacks(); // Thread safing       _SET(read_callback,rcb);    _SET(write_callback,wcb);    ___close_callback=ccb;    - #if constant(__HAVE_OOB__)_ + #if constant(files.__HAVE_OOB__)    _SET(read_oob_callback,roobcb);    _SET(write_oob_callback,woobcb);   #endif   #ifdef __STDIO_DEBUG    if(mixed x=catch { ::set_nonblocking(); })    {    x[0]+=(__closed_backtrace ?    sprintf("File was closed from:\n %-=200s\n",__closed_backtrace) :    "This file has never been open.\n" )+    (_fd?"_fd is nonzero\n":"_fd is zero\n");
pike.git/lib/modules/Stdio.pmod:285:    ::_enable_callbacks();       }       void set_blocking()    {    CHECK_OPEN();    SET(read_callback,0);    SET(write_callback,0);    ___close_callback=0; - #if constant(__HAVE_OOB__)_ + #if constant(files.__HAVE_OOB__)    SET(read_oob_callback,0);    SET(write_oob_callback,0);   #endif    ::set_blocking();    }   };      class Port   {    inherit _port;