pike.git / lib / modules / Function.pmod

version» Context lines:

pike.git/lib/modules/Function.pmod:203:   //! Placeholder arguments for Function.bind      //! @ignore   object Placeholder = class   {   //! @endignore       class Base    {    constant _is_placeholder = true; -  //! @decl mixed value(bind x, array args); -  //! -  //! The function that is called to return the argument value. +     }       class Arg(int num)    //! Arg(x) returns the value of argument X    {    inherit Base;    protected string _sprintf() {    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);    return args[num];    }    };       class Splice(int from, void|int end) -  //! Splice(from) adds all arguments starting with argument number @[from], +  //! Splice(from) adds all arguments starting with argument number @expr{from@},    //! optionally ending with end. -  //! Equivalent to @args[from..end] +  //! Equivalent to @expr{args[from .. end]@}    {    inherit Base;    constant _splice = true;    array(mixed) value(bind x, array args)    {    if( end )    return args[from..end];    return args[from..];    }    }
pike.git/lib/modules/Function.pmod:287:    //! @decl constant arg0;    //! @decl constant arg1;    //! @decl constant arg2;    //! @decl constant arg3;    //! @decl constant arg4;    //! @decl constant arg5;    //! @decl constant arg6;    //! @decl constant arg7;    //! @decl constant arg8;    //! @decl constant arg9; -  //! @decl constant arg...; +     //! arg<n> will return an instance of @[Arg] that returns the n:th arg.    //! For convenience for c++11 developers _0, _1 etc also works.    //!    //! Note that arg0 is the first argument, not arg1       class Expr(function func, void|bool _splice)    //! Expr(x) returns the result of calling @[x].    //! 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];}); +  //! @code +  //! Expr(lambda(array args){return args[1];}); +  //! @endcode    {    inherit Base;    protected string _sprintf() {    return sprintf("Expr(%O)",value);    }    mixed value( bind x, array args )    {    return func(args);    }    }