comparison libinterp/octave-value/ov-usr-fcn.cc @ 18537:f958e8cd6348

maint: Periodic merge of gui-release to default.
author Rik <rik@octave.org>
date Sat, 01 Mar 2014 22:11:32 -0800
parents 6a71e5030df5 ea0d4dea1a17
children 75467145096f
comparison
equal deleted inserted replaced
18528:9c8321ea6f58 18537:f958e8cd6348
829 @deftypefnx {Built-in Function} {} nargin (@var{fcn})\n\ 829 @deftypefnx {Built-in Function} {} nargin (@var{fcn})\n\
830 Within a function, return the number of arguments passed to the function.\n\ 830 Within a function, return the number of arguments passed to the function.\n\
831 At the top level, return the number of command line arguments passed to\n\ 831 At the top level, return the number of command line arguments passed to\n\
832 Octave.\n\ 832 Octave.\n\
833 \n\ 833 \n\
834 If called with the optional argument @var{fcn}, a function name or handle,\n\ 834 If called with the optional argument @var{fcn}---a function name or handle---\n\
835 return the declared number of arguments that the function can accept.\n\ 835 return the declared number of arguments that the function can accept.\n\
836 If the last argument is @var{varargin} the returned value is negative.\n\ 836 \n\
837 This feature does not work on builtin functions.\n\ 837 If the last argument to @var{fcn} is @var{varargin} the returned value is\n\
838 negative. For example, the function @code{union} for sets is declared as\n\
839 \n\
840 @example\n\
841 @group\n\
842 function [y, ia, ib] = union (a, b, varargin)\n\
843 \n\
844 and\n\
845 \n\
846 nargin (\"union\")\n\
847 @result{} -3\n\
848 @end group\n\
849 @end example\n\
850 \n\
851 Programming Note: @code{nargin} does not work on built-in functions.\n\
838 @seealso{nargout, varargin, isargout, varargout, nthargout}\n\ 852 @seealso{nargout, varargin, isargout, varargout, nthargout}\n\
839 @end deftypefn") 853 @end deftypefn")
840 { 854 {
841 octave_value retval; 855 octave_value retval;
842 856
893 DEFUN (nargout, args, , 907 DEFUN (nargout, args, ,
894 "-*- texinfo -*-\n\ 908 "-*- texinfo -*-\n\
895 @deftypefn {Built-in Function} {} nargout ()\n\ 909 @deftypefn {Built-in Function} {} nargout ()\n\
896 @deftypefnx {Built-in Function} {} nargout (@var{fcn})\n\ 910 @deftypefnx {Built-in Function} {} nargout (@var{fcn})\n\
897 Within a function, return the number of values the caller expects to\n\ 911 Within a function, return the number of values the caller expects to\n\
898 receive. If called with the optional argument @var{fcn}, a function\n\ 912 receive. If called with the optional argument @var{fcn}---a function\n\
899 name or handle, return the number of declared output values that the\n\ 913 name or handle---return the number of declared output values that the\n\
900 function can produce. If the final output argument is @var{varargout}\n\ 914 function can produce. If the final output argument is @var{varargout}\n\
901 the returned value is negative.\n\ 915 the returned value is negative.\n\
902 \n\ 916 \n\
903 For example,\n\ 917 For example,\n\
904 \n\ 918 \n\
912 @example\n\ 926 @example\n\
913 [s, t] = f ()\n\ 927 [s, t] = f ()\n\
914 @end example\n\ 928 @end example\n\
915 \n\ 929 \n\
916 @noindent\n\ 930 @noindent\n\
917 will cause @code{nargout} to return 2 inside the function\n\ 931 will cause @code{nargout} to return 2 inside the function @code{f}.\n\
918 @code{f}.\n\
919 \n\ 932 \n\
920 In the second usage,\n\ 933 In the second usage,\n\
921 \n\ 934 \n\
922 @example\n\ 935 @example\n\
923 nargout (@@histc) \% or nargout (\"histc\")\n\ 936 nargout (@@histc) \% or nargout (\"histc\")\n\
925 \n\ 938 \n\
926 @noindent\n\ 939 @noindent\n\
927 will return 2, because @code{histc} has two outputs, whereas\n\ 940 will return 2, because @code{histc} has two outputs, whereas\n\
928 \n\ 941 \n\
929 @example\n\ 942 @example\n\
930 nargout (@@deal)\n\ 943 nargout (@@imread)\n\
931 @end example\n\ 944 @end example\n\
932 \n\ 945 \n\
933 @noindent\n\ 946 @noindent\n\
934 will return -1, because @code{deal} has a variable number of outputs.\n\ 947 will return -2, because @code{imread} has two outputs and the second is\n\
935 \n\ 948 @var{varargout}.\n\
936 At the top level, @code{nargout} with no argument is undefined.\n\ 949 \n\
937 @code{nargout} does not work on builtin functions.\n\ 950 At the top level, @code{nargout} with no argument is undefined and will\n\
938 @code{nargout} returns -1 for all anonymous functions.\n\ 951 produce an error. @code{nargout} does not work for built-in functions and\n\
952 returns -1 for all anonymous functions.\n\
939 @seealso{nargin, varargin, isargout, varargout, nthargout}\n\ 953 @seealso{nargin, varargin, isargout, varargout, nthargout}\n\
940 @end deftypefn") 954 @end deftypefn")
941 { 955 {
942 octave_value retval; 956 octave_value retval;
943 957
1021 "-*- texinfo -*-\n\ 1035 "-*- texinfo -*-\n\
1022 @deftypefn {Built-in Function} {@var{val} =} optimize_subsasgn_calls ()\n\ 1036 @deftypefn {Built-in Function} {@var{val} =} optimize_subsasgn_calls ()\n\
1023 @deftypefnx {Built-in Function} {@var{old_val} =} optimize_subsasgn_calls (@var{new_val})\n\ 1037 @deftypefnx {Built-in Function} {@var{old_val} =} optimize_subsasgn_calls (@var{new_val})\n\
1024 @deftypefnx {Built-in Function} {} optimize_subsasgn_calls (@var{new_val}, \"local\")\n\ 1038 @deftypefnx {Built-in Function} {} optimize_subsasgn_calls (@var{new_val}, \"local\")\n\
1025 Query or set the internal flag for subsasgn method call optimizations.\n\ 1039 Query or set the internal flag for subsasgn method call optimizations.\n\
1040 \n\
1026 If true, Octave will attempt to eliminate the redundant copying when calling\n\ 1041 If true, Octave will attempt to eliminate the redundant copying when calling\n\
1027 subsasgn method of a user-defined class.\n\ 1042 the subsasgn method of a user-defined class.\n\
1028 \n\ 1043 \n\
1029 When called from inside a function with the @qcode{\"local\"} option, the\n\ 1044 When called from inside a function with the @qcode{\"local\"} option, the\n\
1030 variable is changed locally for the function and any subroutines it calls. \n\ 1045 variable is changed locally for the function and any subroutines it calls. \n\
1031 The original variable value is restored when exiting the function.\n\ 1046 The original variable value is restored when exiting the function.\n\
1032 @end deftypefn") 1047 @end deftypefn")
1056 1071
1057 DEFUN (isargout, args, , 1072 DEFUN (isargout, args, ,
1058 "-*- texinfo -*-\n\ 1073 "-*- texinfo -*-\n\
1059 @deftypefn {Built-in Function} {} isargout (@var{k})\n\ 1074 @deftypefn {Built-in Function} {} isargout (@var{k})\n\
1060 Within a function, return a logical value indicating whether the argument\n\ 1075 Within a function, return a logical value indicating whether the argument\n\
1061 @var{k} will be assigned on output to a variable. If the result is false,\n\ 1076 @var{k} will be assigned to a variable on output. If the result is false,\n\
1062 the argument has been ignored during the function call through the use of\n\ 1077 the argument has been ignored during the function call through the use of\n\
1063 the tilde (~) special output argument. Functions can use @code{isargout} to\n\ 1078 the tilde (~) special output argument. Functions can use @code{isargout} to\n\
1064 avoid performing unnecessary calculations for outputs which are unwanted.\n\ 1079 avoid performing unnecessary calculations for outputs which are unwanted.\n\
1065 \n\ 1080 \n\
1066 If @var{k} is outside the range @code{1:max (nargout)}, the function returns\n\ 1081 If @var{k} is outside the range @code{1:max (nargout)}, the function returns\n\