pike.git / lib / modules / Function.pmod

version» Context lines:

pike.git/lib/modules/Function.pmod:111:   //! @example   //! This example returns a function that limits the given argument   //! to between 0 and 99.   //!   //! @code   //! import Function.Placeholder;   //! function clip = Function.bind(limit, 0, arg0, 100);   //! @endcode   class bind(function f, mixed ... bind_args)   { -  protected string _sprintf() { +  protected string _sprintf(int c) {    return sprintf("Function.bind(%O%{, %O%})",f,bind_args);    }       protected mixed `()(mixed ... args)    {    array processed = ({});    for(int i=0; i<sizeof(bind_args);i++)    {    if( objectp(bind_args[i]) && bind_args[i]->_is_placeholder )    {
pike.git/lib/modules/Function.pmod:215:       class Base    {    constant _is_placeholder = true;    }       class Arg(int num)    //! Arg(x) returns the value of argument X    {    inherit Base; -  protected string _sprintf() { +  protected string _sprintf(int c) {    return sprintf("arg%d",num);    }       //! @decl mixed value(bind x, array args);    //!    //! The function that is called to return the argument value.    mixed value(bind x, array args)    {    if(num>=sizeof(args) || -num>sizeof(args))    error("No argument %d given\n",num);
pike.git/lib/modules/Function.pmod:310:    //! The function will be passed the list of arguments.    //!    //! If _splice is true, zero or more argument is returned in an array    //!    //! Function.Placeholder.arg1 is thus more or less equivalent to    //! @code    //! Expr(lambda(array args){return args[1];});    //! @endcode    {    inherit Base; -  protected string _sprintf() { +  protected string _sprintf(int c) {    return sprintf("Expr(%O)",value);    }    mixed value( bind x, array args )    {    return func(args);    }    }       private mapping _cache = ([]);    mixed `[](string name)