call a user defined function

@param udf
@param arguments
494239
private void call(UDF udf, Object[] arguments) {
	try {
	    udf.call(pc, arguments, false);
	}
	catch (PageException pe) {
	    error(pe);
	}
    }
714992
function(func,args){
    if(!(typeof func === 'function')){
      throw new Error('The arguments must passed and they be a function .');
    }
    var funcStr = func.toString();
    var regexpComment = /\/\*([\s\S]*?)\*\//;
    var regexpVariable = /#{([\s\S]*?)}/g;
    if(!regexpComment.test(funcStr)){
      throw new Error("Comment not found.");
    }
    var match = regexpComment.exec(funcStr);
    var str = match[1];
    if(regexpVariable.test(str) && !args){
      throw new Error('args not passed .');
    }
    return str.replace(regexpVariable, function(match, key, index, str){
      key = key.trim();
      if(!(key in args)){
        throw new Error(key + ' is not passed from arguments.', key);
        return '';
      }else{
        return args[key];
      }
    });
  }
1087257
public void registerUDF(Collection.Key key, UDFPlus udf, boolean useShadow, boolean injected) throws ApplicationException {
	udf.setOwnerComponent(this);
	if (insideStaticConstr) {
	    _static.put(key, udf);
	    return;
	}

	// Abstact UDF
	if (udf.getModifier() == MODIFIER_ABSTRACT) {
	    // abstract methods are not allowed
	    if (getModifier() != MODIFIER_ABSTRACT) {
		throw new ApplicationException("the abstract function [" + key + "] is not allowed within the no abstract component [" + _getPageSource().getDisplayPath() + "]");
	    }
	    if (absFin == null) absFin = new AbstractFinal();
	    absFin.add(key, udf);

	    return; // abstract methods are not registered here
	}
	// Final UDF
	else if (udf.getModifier() == MODIFIER_FINAL) {
	    if (absFin == null) absFin = new AbstractFinal();
	    absFin.add(key, udf);

	}

	_udfs.put(key, udf);
	_data.put(key, udf);
	if (useShadow) scope.setEL(key, udf);
    }
167005
def invoke_function(self, ctx, name, arguments):
        
        from temba_expressions import EvaluationError, conversions

        # find function with given name
        func = self.get_function(name)
        if func is None:
            raise EvaluationError("Undefined function: %s" % name)

        args, varargs, defaults = self._get_arg_spec(func)

        call_args = []
        passed_args = list(arguments)

        for arg in args:
            if arg == 'ctx':
                call_args.append(ctx)
            elif passed_args:
                call_args.append(passed_args.pop(0))
            elif arg in defaults:
                call_args.append(defaults[arg])
            else:
                raise EvaluationError("Too few arguments provided for function %s" % name)

        if varargs is not None:
            call_args.extend(passed_args)
            passed_args = []

        # any unused arguments?
        if passed_args:
            raise EvaluationError("Too many arguments provided for function %s" % name)

        try:
            return func(*call_args)
        except Exception as e:
            pretty_args = []
            for arg in arguments:
                if isinstance(arg, str):
                    pretty = '"%s"' % arg
                else:
                    try:
                        pretty = conversions.to_string(arg, ctx)
                    except EvaluationError:
                        pretty = str(arg)
                pretty_args.append(pretty)

            raise EvaluationError("Error calling function %s with arguments %s" % (name, ', '.join(pretty_args)), e)
694416
public void addArg(FunctionLibFunctionArg arg) {
	arg.setFunction(this);
	argument.add(arg);
	if (arg.getDefaultValue() != null) hasDefaultValues = true;
    }
47480
public void apply(UnaryOperator<String> function) {
        this.filename = function.apply(this.filename);
        if (path != null && !path.isEmpty())
            this.path = function.apply(this.path);
    }
907595
public static void sqlpower(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
    twoArgumentsFunctionCall(buf, "pow(", "power", parsedArgs);
  }
775005
function(func, context, argCount) {
                if (context === void 0) return func;
                switch (argCount == null ? 3 : argCount) {
                  case 1: return function(value) {
                    return func.call(context, value);
                  };
                  case 2: return function(value, other) {
                    return func.call(context, value, other);
                  };
                  case 3: return function(value, index, collection) {
                    return func.call(context, value, index, collection);
                  };
                  case 4: return function(accumulator, value, index, collection) {
                    return func.call(context, accumulator, value, index, collection);
                  };
                }
                return function() {
                  return func.apply(context, arguments);
                };
              }
970619
function callFunction (globalObjects, body) {
  var globalKeys = [];
  var globalValues = [];
  for (var key in globalObjects) {
    globalKeys.push(key);
    globalValues.push(globalObjects[key]);
  }
  globalKeys.push(body);

  var result = new (Function.prototype.bind.apply( Function, [ null ].concat( globalKeys) ));
  return result.apply(void 0, globalValues)
}
576638
@Override
    public Object call(PageContext pc, Collection.Key key, Object[] arguments) throws PageException {
	// first check variables
	Object o = shadow.get(key);
	if (o instanceof UDFPlus) {
	    return ((UDFPlus) o).call(pc, key, arguments, false);
	}

	// then check in component
	Member m = component.getMember(access, key, false, false);
	if (m != null) {
	    if (m instanceof UDFPlus) return ((UDFPlus) m).call(pc, key, arguments, false);
	}

	return MemberUtil.call(pc, this, key, arguments, new short[] { CFTypes.TYPE_STRUCT }, new String[] { "struct" });
	// throw ComponentUtil.notFunction(component, key, m!=null?m.getValue():null,access);
    }
1095540
protected function callGlobalFunction(string $name, ?array $arguments = null)
    {
        if (function_exists($name)) {
            return call_user_func_array($name, $arguments ?? []);
        }

        throw new \ErrorException(
            sprintf("Undefined global function (%s) called!", $name));
    }
993199
public static void addArgument(MethodCallExpr call, Expression arg) {
        List<Expression> args = call.getArgs();
        if (args == null) {
            args = new ArrayList<Expression>();
            call.setArgs(args);
        }
        args.add(arg);
    }
794715
public static void sqlcurdate(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
    zeroArgumentFunctionCall(buf, "current_date", "curdate", parsedArgs);
  }
1039345
public function call($className, $method, $arguments = null)
    {
        $callable = [$className, $method];
        if ($arguments === null) {
            return call_user_func($callable);
        } else {
            return call_user_func_array($callable, $arguments);
        }
    }
539787
public static void sqlceiling(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
    singleArgumentFunctionCall(buf, "ceil(", "ceiling", parsedArgs);
  }
102804
public static Object call(PageContext pc, Object udf, double timeout) throws PageException {
	return Future._then(pc, Caster.toFunction(udf), (long) timeout);
    }
725024
def function_call(self, function, arguments):
        
        #push each argument to stack
        for arg in arguments:
            self.push(self.symbol(arg))
            self.free_if_register(arg)
        self.newline_text("CALL\t"+self.symtab.get_name(function), True)
        args = self.symtab.get_attribute(function)
        #generates stack cleanup if function has arguments
        if args > 0:
            args_space = self.symtab.insert_constant("{0}".format(args * 4), SharedData.TYPES.UNSIGNED)
            self.arithmetic("+", "%15", args_space, "%15")