pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin_functions.c,v 1.698 2010/02/23 14:37:22 grubba Exp $ + || $Id: builtin_functions.c,v 1.699 2010/03/30 11:54:56 peter Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"
pike.git/src/builtin_functions.c:861:    *! @note    *! If @[start] is supplied to an iterator object without an    *! @[lfun::_search()], @[haystack] will need to implement    *! @[Iterator()->set_index()].    *!    *! @note    *! For mappings and object @[UNDEFINED] will be returned when not found.    *! In all other cases @expr{-1@} will be returned when not found.    *!    *! @seealso -  *! @[indices()], @[values()], @[zero_type()] +  *! @[indices()], @[values()], @[zero_type()], @[has_value()], +  *! @[has_prefix()], @[has_suffix()]    */   PMOD_EXPORT void f_search(INT32 args)   {    ptrdiff_t start;       if(args < 2)    SIMPLE_TOO_FEW_ARGS_ERROR("search", 2);       switch(Pike_sp[-args].type)    {
pike.git/src/builtin_functions.c:1068:    /* FALL_THROUGH */    default:    SIMPLE_BAD_ARG_ERROR("search", 1, "string|array|mapping|object");    }   }      /*! @decl int has_prefix(string|object s, string prefix)    *!    *! Returns @expr{1@} if the string @[s] starts with @[prefix],    *! returns @expr{0@} (zero) otherwise. +  *! +  *! @seealso +  *! @[has_suffix()], @[has_value()], @[search()]    */   PMOD_EXPORT void f_has_prefix(INT32 args)   {    struct pike_string *a, *b;       if(args<2)    SIMPLE_TOO_FEW_ARGS_ERROR("has_prefix", 2);    if((Pike_sp[-args].type!=T_STRING) && (Pike_sp[-args].type!=T_OBJECT))    SIMPLE_ARG_TYPE_ERROR("has_prefix", 1, "string|object");    if(Pike_sp[1-args].type!=T_STRING)
pike.git/src/builtin_functions.c:1163:    break;    }   #undef CASE_SHIFT   #undef TWO_SHIFTS   }      /*! @decl int has_suffix(string s, string suffix)    *!    *! Returns @expr{1@} if the string @[s] ends with @[suffix],    *! returns @expr{0@} (zero) otherwise. +  *! +  *! @seealso +  *! @[has_prefix()], @[has_value()], @[search()]    */   PMOD_EXPORT void f_has_suffix(INT32 args)   {    struct pike_string *a, *b;       if(args<2)    SIMPLE_TOO_FEW_ARGS_ERROR("has_suffix", 2);    if(Pike_sp[-args].type!=T_STRING)    SIMPLE_ARG_TYPE_ERROR("has_suffix", 1, "string");    if(Pike_sp[1-args].type!=T_STRING)
pike.git/src/builtin_functions.c:1251:    *! @code    *! search(indices(haystack), index) != -1    *! @endcode    *!    *! @note    *! A negative index in strings and arrays as recognized by the    *! index operators @expr{`[]()@} and @expr{`[]=()@} is not considered    *! a proper index by @[has_index()]    *!    *! @seealso -  *! @[has_value()], @[indices()], @[search()], @[values()], @[zero_type()] +  *! @[has_value()], @[has_prefix()], @[has_suffix()], @[indices()], +  *! @[search()], @[values()], @[zero_type()]    */   PMOD_EXPORT void f_has_index(INT32 args)   {    int t = 0;       if(args < 2)    SIMPLE_TOO_FEW_ARGS_ERROR("has_index", 2);    if(args > 2)    pop_n_elems(args-2);   
pike.git/src/builtin_functions.c:1348:    *! search(values(@[haystack]), @[value]) != -1    *! @endcode    *!    *! If both arguments are strings, @[has_value()] is equivalent to:    *!    *! @code    *! search(@[haystack], @[value]) != -1    *! @endcode    *!    *! @seealso -  *! @[has_index()], @[indices()], @[search()], @[values()], @[zero_type()] +  *! @[has_index()], @[indices()], @[search()], @[has_prefix()], +  *! @[has_suffix()], @[values()], @[zero_type()]    */   PMOD_EXPORT void f_has_value(INT32 args)   {    if(args < 2)    SIMPLE_TOO_FEW_ARGS_ERROR("has_value", 2);    if(args > 2)    pop_n_elems(args-2);       switch(Pike_sp[-2].type)    {