Mercurial > hg > octave-lyh
changeset 6755:55411ecc8d8b
[project @ 2007-06-25 18:16:58 by jwe]
author | jwe |
---|---|
date | Mon, 25 Jun 2007 18:16:58 +0000 |
parents | 451b346d8c2f |
children | 47dc81fefe8a |
files | ChangeLog mk-opts.pl src/DLD-FUNCTIONS/lsode.cc |
diffstat | 3 files changed, 28 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-06-25 John W. Eaton <jwe@octave.org> + + * mk-opts.pl (emit_print_function): Make generated function print + to ostream (passed as arg) instead of local buffer. Don't call + print_usage in generated function. + (emit_options_function): Fix call to print_${class_name} in + generated to pass octave_stdout as arg. + 2007-06-18 John W. Eaton <jwe@octave.org> * emacs/octave-inf.el (inferior-octave-prompt): Match "octave.bin"
--- a/mk-opts.pl +++ b/mk-opts.pl @@ -595,20 +595,20 @@ ## FIXME -- determine the width of the table automatically. print "static void -print_${class_name} (void) +print_${class_name} (std::ostream& os) { std::ostringstream buf; - buf << \"\\n\" - << \"Options for $CLASS include:\\n\\n\" - << \" keyword value\\n\" - << \" ------- -----\\n\"; + os << \"\\n\" + << \"Options for $CLASS include:\\n\\n\" + << \" keyword value\\n\" + << \" ------- -----\\n\"; $struct_name *list = $static_table_name;\n\n"; for ($i = 0; $i < $opt_num; $i++) { - print " {\n buf << \" \" + print " {\n os << \" \" << std::setiosflags (std::ios::left) << std::setw (50) << list[$i].keyword << std::resetiosflags (std::ios::left) @@ -617,16 +617,16 @@ if ($type[$i] eq "double") { print " double val = $static_object_name.$opt[$i] ();\n\n"; - print " buf << val << \"\\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"; - print " buf << val << \"\\n\";\n"; + print " os << val << \"\\n\";\n"; } elsif ($type[$i] eq "std::string") { - print " buf << $static_object_name.$opt[$i] () << \"\\n\";\n"; + print " os << $static_object_name.$opt[$i] () << \"\\n\";\n"; } elsif ($type[$i] eq "Array<int>" || $type[$i] eq "Array<octave_idx_type>") { @@ -641,17 +641,17 @@ print " Array<$elt_type> val = $static_object_name.$opt[$i] ();\n\n"; print " if (val.length () == 1) { - buf << val(0) << \"\\n\"; + os << val(0) << \"\\n\"; } else { - buf << \"\\n\\n\"; + os << \"\\n\\n\"; octave_idx_type len = val.length (); Matrix tmp (len, 1); for (octave_idx_type i = 0; i < len; i++) tmp(i,0) = val(i); - octave_print_internal (buf, tmp, false, 2); - buf << \"\\n\\n\"; + octave_print_internal (os, tmp, false, 2); + os << \"\\n\\n\"; }\n"; } elsif ($type[$i] eq "Array<double>") @@ -659,14 +659,14 @@ print " Array<double> val = $static_object_name.$opt[$i] ();\n\n"; print " if (val.length () == 1) { - buf << val(0) << \"\\n\"; + os << val(0) << \"\\n\"; } else { - buf << \"\\n\\n\"; + os << \"\\n\\n\"; Matrix tmp = Matrix (ColumnVector (val)); - octave_print_internal (buf, tmp, false, 2); - buf << \"\\n\\n\"; + octave_print_internal (os, tmp, false, 2); + os << \"\\n\\n\"; }\n"; } else @@ -677,8 +677,7 @@ print " }\n\n"; } - print "print_usage (); -}\n\n"; + print " os << \"\\n\";\n}\n\n"; } sub emit_set_functions @@ -857,7 +856,7 @@ if (nargin == 0) { - print_${class_name} (); + print_${class_name} (octave_stdout); } else if (nargin == 1 || nargin == 2) {
--- a/src/DLD-FUNCTIONS/lsode.cc +++ b/src/DLD-FUNCTIONS/lsode.cc @@ -164,7 +164,7 @@ DEFUN_DLD (lsode, args, nargout, "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} {[@var{x}, @var{istate}, @var{msg}]} lsode (@var{fcn}, @var{x_0}, @var{t}, @var{t_crit})\n\ +@deftypefn {Loadable Function} {[@var{x}, @var{istate}, @var{msg}] =} lsode (@var{fcn}, @var{x_0}, @var{t}, @var{t_crit})\n\ Solve the set of differential equations\n\ @tex\n\ $$ {dx \\over dt} = f (x, t) $$\n\