pike.git / src / modules / Pipe / pipe.c

version» Context lines:

pike.git/src/modules/Pipe/pipe.c:765: Inside #if defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
   {    mmapped += len;       i->type=I_MMAP;    i->len = len;    i->u.mmap=m;   #if defined(HAVE_MADVISE) && defined(MADV_SEQUENTIAL)    /* Mark the pages as sequential read only access... */    madvise(m, len, MADV_SEQUENTIAL);   #endif -  pop_n_elems(args); -  push_int(0); +     return;    }    }    }   #endif       i->u.obj=obj;    nobjects++;    i->type=I_OBJ;    add_ref(i->u.obj);
pike.git/src/modules/Pipe/pipe.c:812:    return;    }    }       if (i==THIS->firstinput)    {    push_callback(offset_input_read_callback);    push_int(0);    push_callback(offset_input_close_callback);    apply_low(i->u.obj,i->set_nonblocking_offset,3); -  pop_stack(); +     }    else    {    /* DOESN'T WORK!!! */    push_int(0);    push_int(0);    push_callback(offset_input_close_callback);    apply_low(i->u.obj,i->set_nonblocking_offset,3); -  pop_stack(); +     } -  -  pop_n_elems(args); -  push_int(0); +    }      /*! @decl void write(string bytes)    *!    *! Add an input string to this pipe.    */   static void pipe_write(INT32 args)   {    struct input *i;   
pike.git/src/modules/Pipe/pipe.c:927:    nbuffers--;    free_string(b->s);    free(b);    }    THIS->lastbuffer=NULL;       /* keep the file pointer of the duped fd    THIS->pos=0; */    push_int(0);    apply(sp[-args-2].u.object,"set_id", 1); -  pop_n_elems(args+2); /* ... and from apply x 2 */ +     return;    }    pop_stack(); /* from apply */    }       THIS->living_outputs++;    /* add_ref(THISOBJ); */ /* Weird */       /* Allocate a new struct output */    obj=clone_object(output_program,0);
pike.git/src/modules/Pipe/pipe.c:979:    o->pos=THIS->pos;       push_object(obj); /* Ok, David, this is probably correct, but I dare you to explain why :) */    apply(o->obj,"set_id",1);    pop_stack();       push_int(0);    push_callback(offset_output_write_callback);    push_callback(offset_output_close_callback);    apply_low(o->obj,o->set_nonblocking_offset,3); -  pop_stack(); -  -  pop_n_elems(args-1); +    }      /*! @decl void set_done_callback(void|function(mixed:mixed) done_cb, @    *! void|mixed id)    *!    *! Set the callback function to be called when all the outputs    *! have been sent.    */   static void pipe_set_done_callback(INT32 args)   {
pike.git/src/modules/Pipe/pipe.c:1010:    Pike_error("Illegal argument to set_done_callback()\n");       if (args>1)    {    free_svalue(&THIS->id);    assign_svalue_no_free(&(THIS->id),sp-args+1);    }       free_svalue(&THIS->done_callback);    assign_svalue_no_free(&(THIS->done_callback),sp-args); -  pop_n_elems(args-1); +    }      /*! @decl void set_output_closed_callback(void|function(mixed, object:mixed) close_cb, @    *! void|mixed id)    *!    *! Set the callback function to be called when one of the outputs has    *! been closed from the other side.    */   static void pipe_set_output_closed_callback(INT32 args)   {
pike.git/src/modules/Pipe/pipe.c:1038:    TYPEOF(sp[-args]) != T_ARRAY))    Pike_error("Illegal argument to set_output_closed_callback()\n");       if (args>1)    {    free_svalue(&THIS->id);    assign_svalue_no_free(&(THIS->id),sp-args+1);    }    free_svalue(&THIS->output_closed_callback);    assign_svalue_no_free(&(THIS->output_closed_callback),sp-args); -  pop_n_elems(args-1); +    }      /*! @decl void finish()    *!    *! Terminate and reinitialize the pipe.    */   static void pipe_finish(INT32 args)   { -  pop_n_elems(args); -  push_int(0); +     pipe_done();   }      /*! @decl void start()    *!    *! Start sending the input(s) to the output(s).    */   static void pipe_start(INT32 args) /* force start */   {    low_start(); -  if(args) -  pop_n_elems(args-1); +    }      /*! @decl int bytes_sent()    *!    *! Return the number of bytes sent.    */   static void f_bytes_sent(INT32 args)   {    pop_n_elems(args);    push_int(THIS->sent);
pike.git/src/modules/Pipe/pipe.c:1087:    if (args<1 || TYPEOF(sp[-args]) != T_OBJECT)    Pike_error("Illegal argument to pipe->write_output_callback\n");       if(!sp[-args].u.object->prog) return;       if(sp[-args].u.object->prog != output_program)    Pike_error("Illegal argument to pipe->write_output_callback\n");       debug_malloc_touch(sp[-args].u.object);    output_try_write_some(sp[-args].u.object); -  pop_n_elems(args-1); +    }      static void pipe_close_output_callback(INT32 args)   {    struct output *o;    if (args<1 || TYPEOF(sp[-args]) != T_OBJECT)       if(!sp[-args].u.object->prog) return;       if(sp[-args].u.object->prog != output_program)
pike.git/src/modules/Pipe/pipe.c:1111:       if (TYPEOF(THIS->output_closed_callback) != T_INT)    {    assign_svalue_no_free(sp++,&THIS->id);    push_object(o->obj);    apply_svalue(&(THIS->output_closed_callback),2);    pop_stack();    }       output_finish(sp[-args].u.object); -  pop_n_elems(args-1); +    }      static void pipe_read_input_callback(INT32 args)   {    struct input *i;    struct pike_string *s;       if (args<2 || TYPEOF(sp[1-args]) != T_STRING)    Pike_error("Illegal argument to pipe->read_input_callback\n");   
pike.git/src/modules/Pipe/pipe.c:1141:    /* THIS DOES NOT WORK */    push_int(0);    push_int(0);    push_callback(offset_input_close_callback);    apply_low(i->u.obj,i->set_nonblocking_offset,3);    pop_stack();    THIS->sleeping=1;    }       low_start(); -  pop_n_elems(args-1); +    }      static void pipe_close_input_callback(INT32 args)   {    struct input *i;    i=THIS->firstinput;       if(!i)    Pike_error("Input close callback without inputs!\n");   
pike.git/src/modules/Pipe/pipe.c:1169:    pop_stack();   #endif    apply(i->u.obj,"close",0);    pop_stack();    }    nobjects--;    free_object(i->u.obj);    i->type=I_NONE;       input_finish(); -  if(args) -  pop_n_elems(args-1); +    }      /*! @decl string version()    *!    *! Return the version of the module.    */   static void pipe_version(INT32 args)   {    pop_n_elems(args);    push_static_text("PIPE ver 2.0");