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.455 2003/01/04 15:24:51 nilsson Exp $ + || $Id: builtin_functions.c,v 1.456 2003/01/05 00:55:44 nilsson Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.455 2003/01/04 15:24:51 nilsson Exp $"); + RCSID("$Id: builtin_functions.c,v 1.456 2003/01/05 00:55:44 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"   #include "constants.h"   #include "mapping.h"   #include "stralloc.h"
pike.git/src/builtin_functions.c:836:    *! index operators @tt{`[]()@} and @tt{`[]=()@} is not considered    *! a proper index by @[has_index()]    *!    *! @seealso    *! @[has_value()], @[indices()], @[search()], @[values()], @[zero_type()]    */   PMOD_EXPORT void f_has_index(INT32 args)   {    int t = 0;    -  if(args != 2) -  PIKE_ERROR("has_index", "Bad number of arguments.\n", Pike_sp, args); +  if(args < 2) +  SIMPLE_TOO_FEW_ARGS_ERROR("has_index", 2); +  if(args > 2) +  pop_n_elems(args-2);       switch(Pike_sp[-2].type)    {    case T_STRING:    if(Pike_sp[-1].type == T_INT)    t = (0 <= Pike_sp[-1].u.integer && Pike_sp[-1].u.integer < Pike_sp[-2].u.string->len);       pop_n_elems(args);    push_int(t);    break;
pike.git/src/builtin_functions.c:920:    *!    *! If both arguments are strings, @[has_value()] is equivalent to:    *!    *! @code{search(@[haystack], @[value]) != -1@}    *!    *! @seealso    *! @[has_index()], @[indices()], @[search()], @[values()], @[zero_type()]    */   PMOD_EXPORT void f_has_value(INT32 args)   { -  if(args != 2) -  PIKE_ERROR("has_value", "Bad number of arguments.\n", Pike_sp, 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)    {    case T_MAPPING:    f_search(2);    f_zero_type(1);       if(Pike_sp[-1].type == T_INT)    Pike_sp[-1].u.integer = !Pike_sp[-1].u.integer;    else
pike.git/src/builtin_functions.c:4194: Inside #if defined(HAVE_MKTIME)
   MEMSET(&date, 0, sizeof(date));    date.tm_sec=sec;    date.tm_min=min;    date.tm_hour=hour;    date.tm_mday=mday;    date.tm_mon=mon;    date.tm_year=year;       if (args > 6) {    if (Pike_sp[6-args].type != T_INT) { -  PIKE_ERROR("mktime", "Bad argument 6 (expected int).\n", Pike_sp, args); +  SIMPLE_BAD_ARG_ERROR("mktime", 6, "int");    }    if (args > 7) {    if (Pike_sp[7-args].type != T_INT) { -  PIKE_ERROR("mktime", "Bad argument 7 (expected int).\n", -  Pike_sp, args); +  SIMPLE_BAD_ARG_ERROR("mktime", 7, "int");    }    }    }       if ((args > 6) && (Pike_sp[6-args].subtype == NUMBER_NUMBER))    {    date.tm_isdst = Pike_sp[6-args].u.integer;    } else {    date.tm_isdst = -1;    }