pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:901:    */   void f_query_num_arg(INT32 args)   {    pop_n_elems(args);    push_int(Pike_fp ? Pike_fp->args : 0);   }      /*! @decl int search(string haystack, string|int needle, int|void start)    *! @decl int search(array haystack, mixed needle, int|void start)    *! @decl mixed search(mapping haystack, mixed needle, mixed|void start) -  *! @decl mixed search(object haystack, mixed needle, mixed|void start) +  *! @decl mixed search(object haystack, mixed needle, mixed|void start, @ +  *! mixed ... extra_args)    *!    *! Search for @[needle] in @[haystack].    *!    *! @param haystack    *! Item to search in. This can be one of:    *! @mixed    *! @type string    *! When @[haystack] is a string @[needle] must be a string or an int,    *! and the first occurrence of the string or int is returned.    *!
pike.git/src/builtin_functions.c:923:    *! When @[haystack] is an array, @[needle] is compared only to    *! one value at a time in @[haystack].    *!    *! @type mapping    *! When @[haystack] is a mapping, @[search()] tries to find the index    *! connected to the data @[needle]. That is, it tries to lookup the    *! mapping backwards.    *!    *! @type object    *! When @[haystack] is an object implementing @[lfun::_search()], -  *! the result of calling @[lfun::_search()] with @[needle] and @[start] -  *! will be returned. +  *! the result of calling @[lfun::_search()] with @[needle], @[start] +  *! and any @[extra_args] will be returned.    *!    *! If @[haystack] is an object that doesn't implement @[lfun::_search()]    *! it is assumed to be an @[Iterator], and implement    *! @[Iterator()->index()], @[Iterator()->value()], and    *! @[Iterator()->next()]. @[search()] will then start comparing    *! elements with @[`==()] until a match with @[needle] is found.    *! If @[needle] is found @[haystack] will be advanced to the element,    *! and the iterator index will be returned. If @[needle] is not    *! found, @[haystack] will be advanced to the end.    *! @endmixed
pike.git/src/builtin_functions.c:9534:    tFunc(tOr4(tObj,tFunction,tPrg(tObj),tInt) tArray, tArray)), 0);       /* FIXME: Is the third arg a good idea when the first is a mapping? */    ADD_EFUN("search",f_search,    tOr4(tFunc(tStr tOr(tStr,tInt) tOr(tVoid,tInt),    tInt),    tFunc(tArr(tSetvar(0,tMix)) tVar(0) tOr(tVoid,tInt),    tInt),    tFunc(tMap(tSetvar(1,tMix),tSetvar(2,tMix)) tVar(2)    tOr(tVoid,tVar(1)), tVar(1)), -  tFunc(tObj tMix tOr(tVoid, tSetvar(3, tMix)), tVar(3))), +  tFuncV(tObj tMix tOr(tVoid, tSetvar(3, tMix)), tMix, tVar(3))),    0);       ADD_EFUN2("has_prefix", f_has_prefix, tFunc(tOr(tStr,tObj) tStr,tInt01),    OPT_TRY_OPTIMIZE, 0, 0);       ADD_EFUN2("has_suffix", f_has_suffix, tFunc(tStr tStr,tInt01),    OPT_TRY_OPTIMIZE, 0, 0);       ADD_EFUN("has_index",f_has_index,    tOr5(tFunc(tStr tIntPos, tInt01),