Mercurial > octave-nkf
comparison src/ov-usr-fcn.cc @ 14573:1c0f0e8f9a1b
maint: periodic merge of stable to default
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 19 Apr 2012 16:26:56 -0400 |
parents | be18c9e359bf 6131fead3135 |
children | f7afecdd87ef |
comparison
equal
deleted
inserted
replaced
14569:3a9a56999ce5 | 14573:1c0f0e8f9a1b |
---|---|
600 symbol_table::mark_automatic (".nargout."); | 600 symbol_table::mark_automatic (".nargout."); |
601 | 601 |
602 if (takes_varargs ()) | 602 if (takes_varargs ()) |
603 symbol_table::varref ("varargin") = va_args.cell_value (); | 603 symbol_table::varref ("varargin") = va_args.cell_value (); |
604 | 604 |
605 // Force .ignored. variable to be undefined by default. | |
606 symbol_table::varref (".ignored.") = octave_value (); | |
607 | |
605 if (lvalue_list) | 608 if (lvalue_list) |
606 { | 609 { |
607 octave_idx_type nbh = 0; | 610 octave_idx_type nbh = 0; |
608 for (std::list<octave_lvalue>::const_iterator p = lvalue_list->begin (); | 611 for (std::list<octave_lvalue>::const_iterator p = lvalue_list->begin (); |
609 p != lvalue_list->end (); p++) | 612 p != lvalue_list->end (); p++) |
621 bh(l++) = k+1; | 624 bh(l++) = k+1; |
622 k += p->numel (); | 625 k += p->numel (); |
623 } | 626 } |
624 | 627 |
625 symbol_table::varref (".ignored.") = bh; | 628 symbol_table::varref (".ignored.") = bh; |
626 | 629 } |
627 symbol_table::mark_hidden (".ignored."); | 630 } |
628 symbol_table::mark_automatic (".ignored."); | 631 |
629 } | 632 symbol_table::mark_hidden (".ignored."); |
630 } | 633 symbol_table::mark_automatic (".ignored."); |
631 } | 634 } |
632 | 635 |
633 DEFUN (nargin, args, , | 636 DEFUN (nargin, args, , |
634 "-*- texinfo -*-\n\ | 637 "-*- texinfo -*-\n\ |
635 @deftypefn {Built-in Function} {} nargin ()\n\ | 638 @deftypefn {Built-in Function} {} nargin ()\n\ |
922 else | 925 else |
923 print_usage (); | 926 print_usage (); |
924 | 927 |
925 return retval; | 928 return retval; |
926 } | 929 } |
930 | |
931 /* | |
932 %!function [x, y] = try_isargout () | |
933 %! if (isargout (1)) | |
934 %! if (isargout (2)) | |
935 %! x = 1; y = 2; | |
936 %! else | |
937 %! x = -1; | |
938 %! endif | |
939 %! else | |
940 %! if (isargout (2)) | |
941 %! y = -2; | |
942 %! else | |
943 %! error ("no outputs requested"); | |
944 %! endif | |
945 %! endif | |
946 %!endfunction | |
947 %! | |
948 %!test | |
949 %! [x, y] = try_isargout (); | |
950 %! assert ([x, y], [1, 2]); | |
951 %! | |
952 %!test | |
953 %! [x, ~] = try_isargout (); | |
954 %! assert (x, -1); | |
955 %! | |
956 %!test | |
957 %! [~, y] = try_isargout (); | |
958 %! assert (y, -2); | |
959 %! | |
960 %!error [~, ~] = try_isargout (); | |
961 %! | |
962 %% Check to see that isargout isn't sticky: | |
963 %!test | |
964 %! [x, y] = try_isargout (); | |
965 %! assert ([x, y], [1, 2]); | |
966 */ |