Mercurial > hg > octave-lyh
changeset 7806:edc25a3fb2bc
handle floats in mk-opts.pl
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 22 May 2008 11:20:09 +0200 |
parents | 62affb34e648 |
children | d4565e812948 |
files | ChangeLog mk-opts.pl |
diffstat | 2 files changed, 54 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-22 Jaroslav Hajek <highegg@gmail.com> + + * mk-opts.pl (emit_print_function, emit_set_function, + emit_show_function): Support float type. + 2008-05-20 David Bateman <dbateman@free.fr> * configure.in (AC_CHECK_FUNCS): Add expm1, lgammaf, lgammaf_r,
--- 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<float>") + { + print " Array<float> 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<float>") + { + print " Array<float> 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<float>") + { + print " Array<float> 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]");