pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:350:       if(!Pike_sp[1-args].u.integer)    PIKE_ERROR("7.0::hash", "Modulo by zero.\n", Pike_sp, args);       i%=(unsigned INT32)Pike_sp[1-args].u.integer;    }    pop_n_elems(args);    push_int( i );   }    - /*! @decl int hash_7_8(string s) -  *! @decl int hash_7_8(string s, int max) + /*! @decl int hash_8_0(string s) +  *! @decl int hash_8_0(string s, int max)    *!    *! Return an integer derived from the string @[s]. The same string    *! always hashes to the same value, also between processes,    *! architectures, and Pike versions (see compatibility notes below,    *! though).    *!    *! If @[max] is given, the result will be >= 0 and < @[max],    *! otherwise the result will be >= 0 and <= 0x7fffffff.    *!    *! @deprecated
pike.git/src/builtin_functions.c:386:    *! The difference only affects wide strings.    *!    *! The hash algorithm was also changed in Pike 7.1. If you want a hash    *! that is compatible with Pike 7.0 and earlier, use @[hash_7_0()].    *!    *! @note    *! This hash function differs from the one provided by @[hash_value()],    *! in that @[hash_value()] returns a process specific value.    *!    *! @seealso -  *! @[hash_7_0()], @[hash_7_4()], @[hash_value] +  *! @[hash()], @[hash_7_0()], @[hash_7_4()], @[hash_value]    */ - PMOD_EXPORT void f_hash_7_8(INT32 args) + PMOD_EXPORT void f_hash_8_0(INT32 args)   {    size_t i = 0;    struct pike_string *s;       if(!args)    SIMPLE_WRONG_NUM_ARGS_ERROR("hash",1);       if(TYPEOF(Pike_sp[-args]) != T_STRING)    SIMPLE_ARG_TYPE_ERROR("hash", 1, "string");   
pike.git/src/builtin_functions.c:415:    i = simple_hashmem1(STR1(s), s->len, 100);    break;    case 2:    i = simple_hashmem2(STR2(s), s->len, 100);    break;    }       if(args > 1)    {    if(TYPEOF(Pike_sp[1-args]) != T_INT) -  SIMPLE_ARG_TYPE_ERROR("hash",2,"int"); +  SIMPLE_ARG_TYPE_ERROR("hash_8_0",2,"int");       if(Pike_sp[1-args].u.integer <= 0) -  PIKE_ERROR("hash", "Modulo < 1.\n", Pike_sp, args); +  PIKE_ERROR("hash_8_0", "Modulo < 1.\n", Pike_sp, args);       i%=(unsigned INT32)Pike_sp[1-args].u.integer;    }    pop_n_elems(args);    push_int64(i);   }      /*! @decl int hash(string s)    *! @decl int hash(string s, int max)    *!    *! Return an integer derived from the string @[s]. The same string    *! always hashes to the same value, also between processes,    *! architectures, and Pike versions (see compatibility notes below,    *! though).    *!    *! If @[max] is given, the result will be >= 0 and < @[max],    *! otherwise the result will be >= 0 and <= 0x7fffffff.    *!    *! @note    *! The hash algorithm was changed in Pike 8.1. If you want a hash -  *! that is compatible with Pike 8.0 and earlier, use @[hash_7_8()]. +  *! that is compatible with Pike 8.0 and earlier, use @[hash_8_0()].    *!    *! The hash algorithm was also changed in Pike 7.5. If you want a hash    *! that is compatible with Pike 7.4 and earlier, use @[hash_7_4()].    *! The difference with regards to @[hash_8_0()] only affects wide strings.    *!    *! The hash algorithm was also changed in Pike 7.1. If you want a hash    *! that is compatible with Pike 7.0 and earlier, use @[hash_7_0()].    *!    *! @note    *! This hash function differs from the one provided by @[hash_value()],    *! in that @[hash_value()] returns a process specific value.    *!    *! @seealso -  *! @[hash_7_0()], @[hash_7_4()], @[hash_7_8()], @[hash_value] +  *! @[hash_7_0()], @[hash_7_4()], @[hash_8_0()], @[hash_value]    */   static void f_hash( INT32 args )   {    size_t res;    ptrdiff_t len = 0;       if( TYPEOF(Pike_sp[-args]) != PIKE_T_STRING )    PIKE_ERROR("hash","Argument is not a string\n",Pike_sp,args);       len = Pike_sp[-args].u.string->len;
pike.git/src/builtin_functions.c:9426:    ADD_EFUN("callablep", f_callablep,tFunc(tMix,tInt01),OPT_TRY_OPTIMIZE);       /* function(string,string:int(0..1))|function(string,string*:array(string)) */    ADD_EFUN("glob",f_glob,    tOr3(tFunc(tStr tStr,tInt01),    tFunc(tArr(tStr) tStr,tStr),    tFunc(tOr(tStr,tArr(tStr)) tSetvar(1,tArr(tStr)),tVar(1))),    OPT_TRY_OPTIMIZE);       /* function(string,int|void:int) */ -  ADD_EFUN("hash_7_8", f_hash_7_8, -  tAttr("deprecated",tFunc(tStr tOr(tInt,tVoid),tInt)),OPT_TRY_OPTIMIZE); +  ADD_EFUN("hash_8_0", f_hash_8_0, +  tAttr("deprecated",tFunc(tStr tOr(tInt1Plus,tVoid),tIntPos)), +  OPT_TRY_OPTIMIZE);       ADD_EFUN("hash_7_0",f_hash_7_0, -  tAttr("deprecated",tFunc(tStr tOr(tInt,tVoid),tInt)),OPT_TRY_OPTIMIZE); +  tAttr("deprecated",tFunc(tStr tOr(tInt1Plus,tVoid),tIntPos)), +  OPT_TRY_OPTIMIZE);       ADD_EFUN("hash",f_hash, -  tFunc(tStr tOr(tInt,tVoid),tInt), OPT_TRY_OPTIMIZE); +  tFunc(tStr tOr(tInt1Plus,tVoid),tIntPos), OPT_TRY_OPTIMIZE);       ADD_EFUN("hash_7_4",f_hash_7_4, -  tAttr("deprecated",tFunc(tStr tOr(tInt,tVoid),tInt)),OPT_TRY_OPTIMIZE); +  tAttr("deprecated",tFunc(tStr tOr(tInt1Plus,tVoid),tIntPos)), +  OPT_TRY_OPTIMIZE);    -  ADD_EFUN("hash_value",f_hash_value,tFunc(tMix,tInt),OPT_TRY_OPTIMIZE); +  ADD_EFUN("hash_value",f_hash_value,tFunc(tMix,tIntPos),OPT_TRY_OPTIMIZE);       ADD_EFUN2("indices",f_indices,    tOr3(tFunc(tArray,tArr(tIntPos)),    tFunc(tOr3(tMap(tSetvar(1,tMix),tMix),    tSet(tSetvar(1,tMix)),    tNStr(tSetvar(1,tInt))),    tArr(tVar(1))),    tFunc(tOr(tObj,tPrg(tObj)),tArr(tStr))),    OPT_TRY_OPTIMIZE,fix_indices_type,0);