GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
#include <sstream>
#include "str-vec.h"
#include <defaults.h>
#include "Cell.h"
#include "builtins.h"
#include "defun.h"
#include "error.h"
#include "gripes.h"
#include "input.h"
#include "oct-obj.h"
#include "ov-usr-fcn.h"
#include "ov.h"
#include "pager.h"
#include "pt-eval.h"
#include "pt-jit.h"
#include "pt-jump.h"
#include "pt-misc.h"
#include "pt-pr-code.h"
#include "pt-stmt.h"
#include "pt-walk.h"
#include "symtab.h"
#include "toplev.h"
#include "unwind-prot.h"
#include "utils.h"
#include "parse.h"
#include "profiler.h"
#include "variables.h"
#include "ov-fcn-handle.h"
Go to the source code of this file.
Functions | |
DEFINE_OCTAVE_ALLOCATOR (octave_user_script) | |
DEFINE_OCTAVE_ALLOCATOR (octave_user_function) | |
DEFUN (nargin, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} nargin ()\n\ @deftypefnx {Built-in Function} {} nargin (@var{fcn})\n\ Within a function, return the number of arguments passed to the function.\n\ At the top level, return the number of command line arguments passed to\n\ Octave.\n\ \n\ If called with the optional argument @var{fcn}, a function name or handle,\n\ return the declared number of arguments that the function can accept.\n\ If the last argument is @var{varargin} the returned value is negative.\n\ This feature does not work on builtin functions.\n\ @seealso{nargout, varargin, isargout, varargout, nthargout}\n\ @end deftypefn") | |
DEFUN (nargout, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} nargout ()\n\ @deftypefnx {Built-in Function} {} nargout (@var{fcn})\n\ Within a function, return the number of values the caller expects to\n\ receive. If called with the optional argument @var{fcn}, a function\n\ name or handle, return the number of declared output values that the\n\ function can produce. If the final output argument is @var{varargout}\n\ the returned value is negative.\n\ \n\ For example,\n\ \n\ @example\n\ f ()\n\ @end example\n\ \n\ @noindent\n\ will cause @code{nargout} to return 0 inside the function @code{f} and\n\ \n\ @example\n\ [s, t] = f ()\n\ @end example\n\ \n\ @noindent\n\ will cause @code{nargout} to return 2 inside the function\n\ @code{f}.\n\ \n\ In the second usage,\n\ \n\ @example\n\ nargout (@@histc) \% or nargout (\"histc\")\n\ @end example\n\ \n\ @noindent\n\ will return 2, because @code{histc} has two outputs, whereas\n\ \n\ @example\n\ nargout (@@deal)\n\ @end example\n\ \n\ @noindent\n\ will return -1, because @code{deal} has a variable number of outputs.\n\ \n\ At the top level, @code{nargout} with no argument is undefined.\n\ @code{nargout} does not work on builtin functions.\n\ @code{nargout} returns -1 for all anonymous functions.\n\ @seealso{nargin, varargin, isargout, varargout, nthargout}\n\ @end deftypefn") | |
DEFUN (optimize_subsasgn_calls, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} optimize_subsasgn_calls ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} optimize_subsasgn_calls (@var{new_val})\n\ @deftypefnx {Built-in Function} {} optimize_subsasgn_calls (@var{new_val}, \"local\")\n\ Query or set the internal flag for subsasgn method call optimizations.\n\ If true, Octave will attempt to eliminate the redundant copying when calling\n\ subsasgn method of a user-defined class.\n\ \n\ When called from inside a function with the @qcode{\"local\"} option, the\n\ variable is changed locally for the function and any subroutines it calls. \n\ The original variable value is restored when exiting the function.\n\ @end deftypefn") | |
DEFUN (isargout, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} isargout (@var{k})\n\ Within a function, return a logical value indicating whether the argument\n\ @var{k} will be assigned on output to a variable. If the result is false,\n\ the argument has been ignored during the function call through the use of\n\ the tilde (~) special output argument. Functions can use @code{isargout} to\n\ avoid performing unnecessary calculations for outputs which are unwanted.\n\ \n\ If @var{k} is outside the range @code{1:max (nargout)}, the function returns\n\ false. @var{k} can also be an array, in which case the function works\n\ element-by-element and a logical array is returned. At the top level,\n\ @code{isargout} returns an error.\n\ @seealso{nargout, nargin, varargin, varargout, nthargout}\n\ @end deftypefn") | |
static bool | isargout1 (int nargout, const Matrix &ignored, double k) |
static bool | val_in_table (const Matrix &table, double val) |
Variables | |
static bool | Voptimize_subsasgn_calls = true |
char | Vstring_fill_char |
DEFINE_OCTAVE_ALLOCATOR | ( | octave_user_script | ) |
DEFINE_OCTAVE_ALLOCATOR | ( | octave_user_function | ) |
DEFUN | ( | nargin | , |
args | |||
) |
Definition at line 789 of file ov-usr-fcn.cc.
References error(), symbol_table::find_function(), octave_value::function_value(), octave_value::is_string(), octave_value::is_undefined(), octave_base_list< elt_type >::length(), octave_user_function::parameter_list(), print_usage(), octave_value::string_value(), octave_user_function::takes_varargs(), octave_base_value::user_function_value(), and symbol_table::varval().
DEFUN | ( | nargout | , |
args | |||
) |
Definition at line 856 of file ov-usr-fcn.cc.
References octave_fcn_handle::anonymous, symbol_table::at_top_level(), error(), octave_value::fcn_handle_value(), octave_fcn_handle::fcn_name(), symbol_table::find_function(), octave_value::function_value(), octave_value::is_function_handle(), octave_value::is_inline_function(), octave_value::is_string(), octave_value::is_undefined(), octave_base_list< elt_type >::length(), print_usage(), octave_user_function::return_list(), octave_value::string_value(), octave_user_function::takes_var_return(), octave_base_value::user_function_value(), and symbol_table::varval().
DEFUN | ( | optimize_subsasgn_calls | , |
args | , | ||
nargout | |||
) |
Definition at line 983 of file ov-usr-fcn.cc.
References SET_INTERNAL_VARIABLE.
DEFUN | ( | isargout | , |
args | |||
) |
Definition at line 1020 of file ov-usr-fcn.cc.
References symbol_table::at_top_level(), Array< T >::dims(), error(), error_state, gripe_wrong_type_arg(), octave_value::int_value(), octave_value::is_defined(), isargout1(), octave_value::matrix_value(), Array< T >::numel(), print_usage(), and symbol_table::varval().
Definition at line 1009 of file ov-usr-fcn.cc.
References error(), val_in_table(), and xround().
Referenced by DEFUN().
Definition at line 1000 of file ov-usr-fcn.cc.
References ASCENDING, Array< T >::is_empty(), and Array< T >::lookup().
Referenced by isargout1().
|
static |
Definition at line 59 of file ov-usr-fcn.cc.
Referenced by octave_user_function::subsasgn_optimization_ok().