pike.git / lib / modules / Array.pmod

version» Context lines:

pike.git/lib/modules/Array.pmod:1:   #pike __REAL_VERSION__    - #define error(X) throw( ({ (X), backtrace()[0..sizeof(backtrace())-2] }) ) -  +    constant diff = __builtin.diff;   constant diff_longest_sequence = __builtin.diff_longest_sequence;   constant diff_compare_table = __builtin.diff_compare_table;   constant longest_ordered_sequence = __builtin.longest_ordered_sequence;   constant interleave_array = __builtin.interleave_array;      constant sort = __builtin.sort;   constant everynth = __builtin.everynth;   constant splice = __builtin.splice;   constant transpose = __builtin.transpose;
pike.git/lib/modules/Array.pmod:76:   }      //! @[search_array()] works like @[map()], only it returns the index   //! of the first call that returnes true instead.   //!   //! If no call returns true, -1 is returned.   //!   //! @seealso   //! @[sum()], @[map()]   //! - int search_array(array arr, mixed fun, mixed ... args) + int search_array(array arr, string|function|int fun, mixed ... args)   {    int e;       if(stringp(fun))    {    for(e=0;e<sizeof(arr);e++)    if(([function(mixed...:mixed)]([array(object)]arr)[e][fun])(@args))    return e;    return -1;    }
pike.git/lib/modules/Array.pmod:101:    return e;    return -1;    }    else if(intp(fun))    {    for(e=0;e<sizeof(arr);e++)    if(([array(function(mixed...:mixed))]arr)[e](@args))    return e;    return -1;    } -  else -  { -  error("Bad argument 2 to filter().\n"); +  +  error("Bad argument 2 to search_array().\n");   } - } +     - array sum_arrays(function sum, array(mixed) ... args) + array sum_arrays(function sum, mixed ... args)   {    array ret;    int e,d;    ret=allocate(sizeof(args[0]));    for(e=0;e<sizeof(args[0]);e++)    ret[e]=([function(mixed...:mixed)]sum)(@ column(args, e));    return ret;   }      //! This function sorts an array after a compare-function @[cmp]