pike.git / lib / modules / Stdio.pmod

version» Context lines:

pike.git/lib/modules/Stdio.pmod:8:       mixed ___read_callback;    mixed ___write_callback;    mixed ___close_callback;   #if constant(__HAVE_OOB__)_    mixed ___read_oob_callback;    mixed ___write_oob_callback;   #endif    mixed ___id;    -  // This function is needed so that create() doesn't call an overloaded -  // variant by mistake. -  static private nomask int __open(string file, string mode,void|int bits) +  int open(string file, string mode, void|int bits)    {    _fd=Fd();    if(query_num_arg()<3) bits=0666;    return ::open(file,mode,bits);    }    -  int open(string file, string mode, void|int bits) -  { -  if(query_num_arg()<3) bits=0666; -  return __open(file, mode, bits); -  } -  +     int open_socket(int|void port, string|void address)    {    _fd=Fd();    switch(query_num_arg()) {    case 0:    return ::open_socket();    case 1:    return ::open_socket(port);    default:    return ::open_socket(port, address);
pike.git/lib/modules/Stdio.pmod:57:    if(object(Fd) fd=::pipe(how))    {    object o=File();    o->_fd=fd;    return o;    }else{    return 0;    }    }    -  void create(mixed ... args) +  void create(string|void file,void|string mode,void|int bits)    { -  if(sizeof(args)) +  switch(file)    { -  switch(args[0]) -  { +     case "stdin":    _fd=_stdin; -  +  case 0:    break;       case "stdout":    _fd=_stdin;    break;       case "stderr":    _fd=_stderr;    break;       default: -  __open(@args); +  _fd=Fd(); +  if(query_num_arg()<3) bits=0666; +  ::open(file,mode,bits);    }    } -  } +        // Don't allow overloading of this function.    static private nomask int do_assign(object to, object from)    {    if((program)Fd == (program)object_program(from))    {    to->_fd = from->dup();    }else{    to->_fd = from->_fd;    to->___read_callback = from->___read_callback;
pike.git/lib/modules/Stdio.pmod:160: Inside #if constant(__HAVE_OOB__)_
   {    ___read_oob_callback(___id, s);    }else{    ___close_callback(___id);    }    }       static void my_write_oob_callback() { ___write_oob_callback(___id); }   #endif    + #define SET(X,Y) ::set_##X ((___##X = (Y)) && my_##X) +    #define CBFUNC(X) \ -  static private nomask void __set_##X (mixed l##X) \ -  { \ -  ___##X=l##X; \ -  ::set_##X(l##X && my_##X); \ -  } \ -  \ +     void set_##X (mixed l##X) \    { \ -  __set_##X(l##X); \ +  SET( X , l##X ); \    } \    \    mixed query_##X () \    { \    return ___##X; \    }       CBFUNC(read_callback)    CBFUNC(write_callback)   #if constant(__HAVE_OOB__)_    CBFUNC(read_oob_callback)    CBFUNC(write_oob_callback)   #endif       mixed query_close_callback() { return ___close_callback; } -  static private nomask void __set_close_callback(mixed c) -  { -  ___close_callback=c; -  } -  mixed set_close_callback(mixed c) { __set_close_callback(c); } +  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__)_    mixed|void roobcb,    mixed|void woobcb   #endif    )    { -  // Use the __set_xxxx_callback() functions here, so that we -  // don't call overloaded versions by mistake. -  // /grubba 1998-04-10 -  __set_read_callback(rcb); -  __set_write_callback(wcb); -  __set_close_callback(ccb); +  SET(read_callback,rcb); +  SET(write_callback,wcb); +  ___close_callback=ccb; +    #if constant(__HAVE_OOB__)_ -  __set_read_oob_callback(roobcb); -  __set_write_oob_callback(woobcb); +  SET(read_oob_callback,roobcb); +  SET(write_oob_callback,woobcb);   #endif    ::set_nonblocking();    }       void set_blocking()    { -  // Use the __set_xxxx_callback() functions here, so that we -  // don't call overloaded versions by mistake. -  // /grubba 1998-04-10 -  __set_read_callback(0); -  __set_write_callback(0); -  __set_close_callback(0); +  SET(read_callback,0); +  SET(write_callback,0); +  ___close_callback=0;   #if constant(__HAVE_OOB__)_ -  __set_read_oob_callback(0); -  __set_write_oob_callback(0); +  SET(read_oob_callback,0); +  SET(write_oob_callback,0);   #endif    ::set_blocking();    }   };      class Port   {    inherit port;    object(File) accept()    {