# HG changeset patch # User John W. Eaton # Date 1448231908 18000 # Node ID c6464d78da6916dd32be2a7878e741649808bf8a # Parent 771d9fab5c24af6b67423d51420bea5ba07b77ff eliminate error_state from generated code * mk-opts.pl, genprops.awk: Eliminate error_state from generated code. diff -r 771d9fab5c24 -r c6464d78da69 build-aux/mk-opts.pl --- a/build-aux/mk-opts.pl Sun Nov 22 08:09:36 2015 -0800 +++ b/build-aux/mk-opts.pl Sun Nov 22 17:38:28 2015 -0500 @@ -752,44 +752,37 @@ if ($TYPE[$i] eq "double") { print " double tmp = val.double_value ();\n\n"; - print " if (! error_state) - $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; + print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; } elsif ($TYPE[$i] eq "float") { print " float tmp = val.float_value ();\n\n"; - print " if (! error_state) - $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; + print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; } elsif ($TYPE[$i] eq "int" or $TYPE[$i] eq "octave_idx_type") { print " int tmp = val.int_value ();\n\n"; - print " if (! error_state) - $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; + print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; } elsif ($TYPE[$i] eq "std::string") { print " std::string tmp = val.string_value ();\n\n"; - print " if (! error_state) - $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; + print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; } elsif ($TYPE[$i] eq "Array" or $TYPE[$i] eq "Array") { print " Array tmp = val.int_vector_value ();\n\n"; - print " if (! error_state) - $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; + print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; } elsif ($TYPE[$i] eq "Array") { print " Array tmp = val.vector_value ();\n\n"; - print " if (! error_state) - $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; + print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; } elsif ($TYPE[$i] eq "Array") { print " Array tmp = val.float_vector_value ();\n\n"; - print " if (! error_state) - $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; + print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n"; } else { @@ -945,17 +938,12 @@ } else if (nargin == 1 || nargin == 2) { - std::string keyword = args(0).string_value (); + std::string keyword = args(0).xstring_value ("$OPT_FCN_NAME: expecting keyword as first argument"); - if (! error_state) - { - if (nargin == 1) - retval = show_$CLASS_NAME (keyword); - else - set_$CLASS_NAME (keyword, args(1)); - } + if (nargin == 1) + retval = show_$CLASS_NAME (keyword); else - error ("$OPT_FCN_NAME: expecting keyword as first argument"); + set_$CLASS_NAME (keyword, args(1)); } else print_usage (); diff -r 771d9fab5c24 -r c6464d78da69 libinterp/genprops.awk --- a/libinterp/genprops.awk Sun Nov 22 08:09:36 2015 -0800 +++ b/libinterp/genprops.awk Sun Nov 22 17:38:28 2015 -0500 @@ -45,8 +45,7 @@ ## void ## set_NAME (const TYPE& val) ## { -## if (! error_state) -## NAME = val; +## NAME = val; ## } ## ## void @@ -374,7 +373,7 @@ else has_builtin_listeners = 0; - printf ("\n {\n if (! error_state)\n {\n if (%s.set (val, %s))\n {\n", + printf ("\n {\n {\n if (%s.set (val, %s))\n {\n", name[i], (has_builtin_listeners ? "false" : "true")); if (mode[i]) printf (" set_%smode (\"manual\");\n", name[i]); @@ -470,7 +469,7 @@ class_name); if (! base) - printf (" const std::set& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"set\", go_name, pnames, pname_arg);\n\n if (error_state)\n return;\n else if (has_readonly_property (pname))\n {\n error (\"set: \\\"%%s\\\" is read-only\", pname.c_str ());\n return;\n }\n\n"); + printf (" const std::set& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"set\", go_name, pnames, pname_arg);\n\n if (has_readonly_property (pname))\n {\n error (\"set: \\\"%%s\\\" is read-only\", pname.c_str ());\n return;\n }\n\n"); first = 1; @@ -524,7 +523,7 @@ printf (" octave_value retval;\n\n"); if (! base) - printf (" const std::set& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"get\", go_name, pnames, pname_arg);\n\n if (error_state)\n return retval;\n\n"); + printf (" const std::set& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"get\", go_name, pnames, pname_arg);\n\n"); for (i = 1; i<= idx; i++) { @@ -549,7 +548,7 @@ class_name); if (! base) - printf (" const std::set& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"get\", go_name, pnames, pname_arg);\n\n if (error_state)\n return property ();\n\n"); + printf (" const std::set& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"get\", go_name, pnames, pname_arg);\n\n"); for (i = 1; i<= idx; i++) {