pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:2048:    SIMPLE_BAD_ARG_ERROR("function_program", 1, "function");    }    pop_n_elems(args);    push_int(0);   }         /*! @decl mixed random(object o)    *! If random is called with an object, @[lfun::random] will be    *! called in the object. +  *!    *! @seealso -  *! @[lfun::_random] +  *! @[lfun::_random()]    */    - /*! @decl mixed lfun::_random() -  *! Called by @[random]. Typical uses is when the object implements -  *! a ADT, then a call to this lfun should return a random member of -  *! the ADT or range implied by the ADT. -  *! @seealso -  *! @[predef::random()] -  */ -  +    PMOD_EXPORT   PIKEFUN mixed random(object o)    efun;    optflags OPT_TRY_OPTIMIZE|OPT_EXTERNAL_DEPEND;   { -  apply(o,"_random",0); +  int f = low_find_lfun(o->prog, LFUN__RANDOM); +  if (f < 0) { +  Pike_error("Calling undefined lfun::%s.\n", lfun_names[LFUN__RANDOM]); +  } +  apply_low(o, f, 0);    stack_swap();    pop_stack();   }      /*! @decl int random(int max)    *! @decl float random(float max)    *!    *! This function returns a random number in the range 0 - @[max]-1.    *!    *! @seealso