# HG changeset patch # User Jaroslav Hajek # Date 1211448009 -7200 # Node ID edc25a3fb2bce80302402d876e660de57e332c43 # Parent 62affb34e6487a40de790346e0aced86da958cc4 handle floats in mk-opts.pl diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-22 Jaroslav Hajek + + * mk-opts.pl (emit_print_function, emit_set_function, + emit_show_function): Support float type. + 2008-05-20 David Bateman * configure.in (AC_CHECK_FUNCS): Add expm1, lgammaf, lgammaf_r, diff --git a/mk-opts.pl b/mk-opts.pl --- a/mk-opts.pl +++ b/mk-opts.pl @@ -638,6 +638,11 @@ print " double val = $static_object_name.$opt[$i] ();\n\n"; print " os << val << \"\\n\";\n"; } + elsif ($type[$i] eq "float") + { + print " float val = $static_object_name.$opt[$i] ();\n\n"; + print " os << val << \"\\n\";\n"; + } elsif ($type[$i] eq "int" || $type[$i] eq "octave_idx_type") { print " int val = $static_object_name.$opt[$i] ();\n\n"; @@ -688,6 +693,21 @@ os << \"\\n\\n\"; }\n"; } + elsif ($type[$i] eq "Array") + { + print " Array val = $static_object_name.$opt[$i] ();\n\n"; + print " if (val.length () == 1) + { + os << val(0) << \"\\n\"; + } + else + { + os << \"\\n\\n\"; + FloatMatrix tmp = FloatMatrix (FloatColumnVector (val)); + octave_print_internal (os, tmp, false, 2); + os << \"\\n\\n\"; + }\n"; + } else { die ("unknown type $type[$i]"); @@ -722,6 +742,12 @@ print " if (! error_state) $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"; + } elsif ($type[$i] eq "int" || $type[$i] eq "octave_idx_type") { print " int tmp = val.int_value ();\n\n"; @@ -746,6 +772,12 @@ print " if (! error_state) $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"; + } else { die ("unknown type $type[$i]"); @@ -787,6 +819,11 @@ print " double val = $static_object_name.$opt[$i] ();\n\n"; print " retval = val;\n"; } + elsif ($type[$i] eq "float") + { + print " float val = $static_object_name.$opt[$i] ();\n\n"; + print " retval = val;\n"; + } elsif ($type[$i] eq "int" || $type[$i] eq "octave_idx_type") { print " int val = $static_object_name.$opt[$i] ();\n\n"; @@ -832,6 +869,18 @@ retval = ColumnVector (val); }\n"; } + elsif ($type[$i] eq "Array") + { + print " Array val = $static_object_name.$opt[$i] ();\n\n"; + print " if (val.length () == 1) + { + retval = val(0); + } + else + { + retval = FloatColumnVector (val); + }\n"; + } else { die ("unknown type $type[$i]");