pike.git / lib / modules / Array.pmod

version» Context lines:

pike.git/lib/modules/Array.pmod:131:   //! @[cmp] which takes two arguments and should return @tt{1@} if the   //! first argument is larger then the second. Returns the sorted array   //! - @[arr] is not sorted destructively.   //!   //! The remaining arguments @[args] will be sent as 3rd, 4th etc. argument   //! to @[cmp].   //!   //! If @[cmp] is omitted, @[`>()] is used instead.   //!   //! @seealso - //! @[map()], @[sort()], @[`>()], @[dwim_sort_func], @[lyskom_sort_func] + //! @[map()], @[sort()], @[`>()], @[dwim_sort_func], @[lyskom_sort_func], + //! @[oid_sort_func]   //!   array sort_array(array foo, function|void cmp, mixed ... args)   {    array bar,tmp;    int len,start;    int length;    int foop, fooend, barp, barend;       if(!cmp || cmp==`>)    {
pike.git/lib/modules/Array.pmod:598:   //! @enddl   array arrayify(void|array|mixed x)   {    if(zero_type(x)) return ({});    if(arrayp(x)) return [array]x;    return ({ x });   }      //! Sort with care of numerical sort for OID values:   //! "1.2.1" before "1.11.1" + //! @seealso + //! @[sort_array]   int oid_sort_func(string a0,string b0)   {    string a2="",b2="";    int a1, b1;    sscanf(a0,"%d.%s",a1,a2);    sscanf(b0,"%d.%s",b1,b2);    if (a1>b1) return 1;    if (a1<b1) return 0;    if (a2==b2) return 0;    return oid_sort_func(a2,b2);