comparison libinterp/corefcn/colloc.cc @ 20617:ba2b07c13913

use new string_value method to handle value extraction errors * __dispatch__.cc, balance.cc, colloc.cc, conv2.cc, data.cc, debug.cc, graphics.cc, input.cc, matrix_type.cc, oct-hist.cc, schur.cc, spparms.cc, symtab.cc, sysdep.cc, toplev.cc, utils.cc: Use new string_value method.
author John W. Eaton <jwe@octave.org>
date Fri, 09 Oct 2015 10:06:39 -0400
parents f90c8372b7ba
children
comparison
equal deleted inserted replaced
20616:fd0efcdb3718 20617:ba2b07c13913
78 octave_idx_type left = 0; 78 octave_idx_type left = 0;
79 octave_idx_type right = 0; 79 octave_idx_type right = 0;
80 80
81 for (int i = 1; i < nargin; i++) 81 for (int i = 1; i < nargin; i++)
82 { 82 {
83 if (args(i).is_defined ()) 83 std::string s = args(i).string_value ("colloc: expecting string argument \"left\" or \"right\"");
84
85 if ((s.length () == 1 && (s[0] == 'R' || s[0] == 'r'))
86 || s == "right")
84 { 87 {
85 if (! args(i).is_string ()) 88 right = 1;
86 { 89 }
87 error ("colloc: expecting string argument \"left\" or \"right\""); 90 else if ((s.length () == 1 && (s[0] == 'L' || s[0] == 'l'))
88 return retval; 91 || s == "left")
89 } 92 {
90 93 left = 1;
91 std::string s = args(i).string_value ();
92
93 if ((s.length () == 1 && (s[0] == 'R' || s[0] == 'r'))
94 || s == "right")
95 {
96 right = 1;
97 }
98 else if ((s.length () == 1 && (s[0] == 'L' || s[0] == 'l'))
99 || s == "left")
100 {
101 left = 1;
102 }
103 else
104 {
105 error ("colloc: unrecognized argument");
106 return retval;
107 }
108 } 94 }
109 else 95 else
110 { 96 {
111 error ("colloc: unexpected empty argument"); 97 error ("colloc: unrecognized argument");
112 return retval; 98 return retval;
113 } 99 }
114 } 100 }
115 101
116 ntot += left + right; 102 ntot += left + right;