pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:4220:   static void low_automap(int d,    int depth,    struct svalue *fun,    struct svalue *real_args,    INT32 args)   {    INT32 x,e,tmp,size=0x7fffffff;    struct svalue *tmpargs=Pike_sp - args;    struct array *ret;    TYPE_FIELD types; +  struct reuse_frame_context *reuse_ctx;       for(e=0;e<args;e++)    {    if(TYPEOF(real_args[e]) == T_OBJECT &&    real_args[e].u.object->prog == automap_marker_program &&    OBJ2_AUTOMAP_MARKER(real_args[e].u.object)->depth >= d)    {    if(TYPEOF(tmpargs[e]) != T_ARRAY)    index_error("__automap__",    Pike_sp-args,
pike.git/src/builtin.cmod:4246:    size=tmp;    }    }       if(size == 0x7fffffff)    Pike_error("No automap markers found in __automap__\n");       push_array(ret=allocate_array(size));    types = 0;    +  if (d == depth) +  reuse_ctx = init_frame_reuse_context(fun, args); +  else +  reuse_ctx = NULL; +     for(x=0;x<size;x++)    {    for(e=0;e<args;e++)    {    if(TYPEOF(real_args[e]) == T_OBJECT &&    real_args[e].u.object->prog == automap_marker_program &&    OBJ2_AUTOMAP_MARKER(real_args[e].u.object)->depth >= d)    {   #ifdef PIKE_DEBUG    if(x >= tmpargs[e].u.array->size)    Pike_fatal("low_automap failed to determine size!\n");   #endif    push_svalue(ITEM(tmpargs[e].u.array)+x);    }else{    push_svalue(tmpargs+e);    }    }    -  if(d == depth) -  apply_svalue(fun,args); +  if(reuse_ctx != NULL) +  apply_svalue_reuse_context (reuse_ctx);    else    low_automap(d+1,depth,fun,real_args,args);    stack_pop_to_no_free (ITEM(ret) + x);    types |= 1 << TYPEOF(ITEM(ret)[x]);    } -  +  +  free_frame_reuse_context (reuse_ctx); +     ret->type_field = types;    stack_unlink(args);   }      /*! @decl array __automap__(function fun, mixed ... args)    *!    *! Automap execution function.    *!    *! @param fun    *! Function to call for each of the mapped arguments.