Mercurial > hg > octave-jordi
comparison libinterp/corefcn/variables.cc @ 20710:7b608fadc663
Make error messages more specific about the variable and problem encountered.
* besselj.cc, bitfcns.cc, colloc.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc,
dirfns.cc, ellipj.cc, error.cc, gl-render.cc, graphics.cc, graphics.in.h,
load-path.cc, lsode.cc, lu.cc, luinc.cc, oct-hist.cc, oct-obj.cc,
octave-link.cc, quad.cc, rand.cc, symtab.cc, sysdep.cc, toplev.cc, utils.cc,
variables.cc, __init_fltk__.cc, chol.cc, fftw.cc, ov-cell.cc, ov-ch-mat.cc,
ov-class.cc, ov-classdef.cc, ov-cx-mat.cc, ov-fcn-inline.cc, ov-struct.cc,
ov-usr-fcn.cc, CMatrix.cc, dMatrix.cc, fCMatrix.cc, fMatrix.cc, lo-specfun.cc,
curl.m, divergence.m, __fltk_file_filter__.m, __uiobject_split_args__.m,
uigetfile.m, doc.m, imshow.m, rref.m, subspace.m, edit.m, fileattrib.m, open.m,
substruct.m, annotation.m, axis.m, caxis.m, datetick.m, hidden.m, legend.m,
whitebg.m, colorbar.m, __add_datasource__.m, __ezplot__.m, __pie__.m,
__plt_get_axis_arg__.m, pan.m, __print_parse_opts__.m, rotate3d.m, subplot.m,
zoom.m, compan.m, addpref.m, getpref.m, setpref.m, powerset.m, bicg.m,
bicgstab.m, cgs.m, qmr.m, spaugment.m, pascal.m, moment.m, cstrcat.m,
system.tst:
Make error messages more specific about the variable and problem encountered.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 18 Nov 2015 10:40:26 -0800 |
parents | 571508c1ed06 |
children | 2469d78a1d8b |
comparison
equal
deleted
inserted
replaced
20709:73800f39da6f | 20710:7b608fadc663 |
---|---|
129 fcn_name = arg.string_value (); | 129 fcn_name = arg.string_value (); |
130 | 130 |
131 ans = is_valid_function (fcn_name, warn_for, warn); | 131 ans = is_valid_function (fcn_name, warn_for, warn); |
132 } | 132 } |
133 else if (warn) | 133 else if (warn) |
134 error ("%s: expecting function name as argument", warn_for.c_str ()); | 134 error ("%s: argument must be a string containing function name", warn_for.c_str ()); |
135 | 135 |
136 return ans; | 136 return ans; |
137 } | 137 } |
138 | 138 |
139 octave_function * | 139 octave_function * |
145 | 145 |
146 retval = is_valid_function (arg, warn_for, 0); | 146 retval = is_valid_function (arg, warn_for, 0); |
147 | 147 |
148 if (! retval) | 148 if (! retval) |
149 { | 149 { |
150 std::string s = arg.xstring_value ("%s: expecting first argument to be a string", | 150 std::string s = arg.xstring_value ("%s: first argument must be a string", |
151 warn_for.c_str ()); | 151 warn_for.c_str ()); |
152 | 152 |
153 std::string cmd = header; | 153 std::string cmd = header; |
154 cmd.append (s); | 154 cmd.append (s); |
155 cmd.append (trailer); | 155 cmd.append (trailer); |
156 | 156 |
736 nargin = 1; | 736 nargin = 1; |
737 retval = true; | 737 retval = true; |
738 } | 738 } |
739 else | 739 else |
740 { | 740 { |
741 error_with_cfn ("expecting second argument to be \"local\""); | 741 error_with_cfn ("second argument must be \"local\""); |
742 nargin = 0; | 742 nargin = 0; |
743 } | 743 } |
744 } | 744 } |
745 | 745 |
746 return retval; | 746 return retval; |
777 warning ("\"local\" has no effect outside a function"); | 777 warning ("\"local\" has no effect outside a function"); |
778 } | 778 } |
779 | 779 |
780 if (nargin == 1) | 780 if (nargin == 1) |
781 { | 781 { |
782 bool bval = args(0).xbool_value ("%s: expecting arg to be a logical value", nm); | 782 bool bval = args(0).xbool_value ("%s: argument must be a logical value", nm); |
783 | 783 |
784 var = bval; | 784 var = bval; |
785 } | 785 } |
786 else if (nargin > 1) | 786 else if (nargin > 1) |
787 print_usage (); | 787 print_usage (); |
849 warning ("\"local\" has no effect outside a function"); | 849 warning ("\"local\" has no effect outside a function"); |
850 } | 850 } |
851 | 851 |
852 if (nargin == 1) | 852 if (nargin == 1) |
853 { | 853 { |
854 int ival = args(0).xint_value ("%s: expecting arg to be an integer value", nm); | 854 int ival = args(0).xint_value ("%s: argument must be an integer value", nm); |
855 | 855 |
856 if (ival < minval) | 856 if (ival < minval) |
857 error ("%s: expecting arg to be greater than %d", nm, minval); | 857 error ("%s: arg must be greater than %d", nm, minval); |
858 else if (ival > maxval) | 858 else if (ival > maxval) |
859 error ("%s: expecting arg to be less than or equal to %d", | 859 error ("%s: arg must be less than or equal to %d", |
860 nm, maxval); | 860 nm, maxval); |
861 else | 861 else |
862 var = ival; | 862 var = ival; |
863 } | 863 } |
864 else if (nargin > 1) | 864 else if (nargin > 1) |
885 warning ("\"local\" has no effect outside a function"); | 885 warning ("\"local\" has no effect outside a function"); |
886 } | 886 } |
887 | 887 |
888 if (nargin == 1) | 888 if (nargin == 1) |
889 { | 889 { |
890 double dval = args(0).xscalar_value ("%s: expecting arg to be a scalar value", nm); | 890 double dval = args(0).xscalar_value ("%s: argument must be a scalar value", nm); |
891 | 891 |
892 if (dval < minval) | 892 if (dval < minval) |
893 error ("%s: expecting arg to be greater than %g", minval); | 893 error ("%s: argument must be greater than %g", minval); |
894 else if (dval > maxval) | 894 else if (dval > maxval) |
895 error ("%s: expecting arg to be less than or equal to %g", maxval); | 895 error ("%s: argument must be less than or equal to %g", maxval); |
896 else | 896 else |
897 var = dval; | 897 var = dval; |
898 } | 898 } |
899 else if (nargin > 1) | 899 else if (nargin > 1) |
900 print_usage (); | 900 print_usage (); |
2659 { | 2659 { |
2660 octave_value retval; | 2660 octave_value retval; |
2661 | 2661 |
2662 if (args.length () == 1) | 2662 if (args.length () == 1) |
2663 { | 2663 { |
2664 std::string name = args(0).xstring_value ("__varval__: expecting argument to be variable name"); | 2664 std::string name = args(0).xstring_value ("__varval__: first argument must be a variable name"); |
2665 | 2665 |
2666 retval = symbol_table::varval (args(0).string_value ()); | 2666 retval = symbol_table::varval (args(0).string_value ()); |
2667 } | 2667 } |
2668 else | 2668 else |
2669 print_usage (); | 2669 print_usage (); |