Mercurial > hg > octave-avbm
changeset 5667:ec3ffbf9982b
[project @ 2006-03-15 02:51:39 by jwe]
author | jwe |
---|---|
date | Wed, 15 Mar 2006 02:51:40 +0000 |
parents | 4a48a1df26b7 |
children | 56ab559e1d77 |
files | ChangeLog mk-opts.pl src/ChangeLog src/defun-int.h src/defun.cc src/help.cc src/parse.y src/xpow.cc test/ChangeLog test/fntests.m test/test_eval.m |
diffstat | 11 files changed, 92 insertions(+), 93 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-03-14 John W. Eaton <jwe@octave.org> + + * mk-opts.pl (emit_print_function): Buffer extra message here and + pass to print_usage. + 2006-03-09 John W. Eaton <jwe@octave.org> * Makeconf.in (do-subst-default-vals): Also substitute OCTAVE_RELEASE.
--- a/mk-opts.pl +++ b/mk-opts.pl @@ -595,38 +595,38 @@ ## XXX FIXME XXX -- determine the width of the table automatically. print "static void -print_${class_name} (std::ostream& os) +print_${class_name} (void) { - print_usage (\"$opt_fcn_name\", 1); + OSSTREAM buf; - os << \"\\n\" - << \"Options for $CLASS include:\\n\\n\" - << \" keyword value\\n\" - << \" ------- -----\\n\"; + buf << \"\\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 os << \" \" - << std::setiosflags (std::ios::left) << std::setw (50) - << list[$i].keyword - << std::resetiosflags (std::ios::left) - << \" \";\n\n"; + print " {\n buf << \" \" + << std::setiosflags (std::ios::left) << std::setw (50) + << list[$i].keyword + << std::resetiosflags (std::ios::left) + << \" \";\n\n"; if ($type[$i] eq "double") { print " double val = $static_object_name.$opt[$i] ();\n\n"; - print " os << val << \"\\n\";\n"; + print " buf << 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 " os << val << \"\\n\";\n"; + print " buf << val << \"\\n\";\n"; } elsif ($type[$i] eq "std::string") { - print " os << $static_object_name.$opt[$i] () << \"\\n\";\n"; + print " buf << $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) { - os << val(0) << \"\\n\"; + buf << val(0) << \"\\n\"; } else { - os << \"\\n\\n\"; + buf << \"\\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 (os, tmp, false, 2); - os << \"\\n\\n\"; + octave_print_internal (buf, tmp, false, 2); + buf << \"\\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) { - os << val(0) << \"\\n\"; + buf << val(0) << \"\\n\"; } else { - os << \"\\n\\n\"; + buf << \"\\n\\n\"; Matrix tmp = Matrix (ColumnVector (val)); - octave_print_internal (os, tmp, false, 2); - os << \"\\n\\n\"; + octave_print_internal (buf, tmp, false, 2); + buf << \"\\n\\n\"; }\n"; } else @@ -677,7 +677,12 @@ print " }\n\n"; } - print " os << \"\\n\";\n}\n\n"; + print " buf << OSSTREAM_ENDS; + + print_usage (\"$opt_fcn_name\", true, OSSTREAM_STR (buf)); + + OSSTREAM_FREEZE (buf); +}\n\n"; } sub emit_set_functions @@ -856,7 +861,7 @@ if (nargin == 0) { - print_${class_name} (octave_stdout); + print_${class_name} (); } else if (nargin == 1 || nargin == 2) {
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2006-03-14 Keith Goodman <kwgoodman@gmail.com> + + * help.cc (Fhelp, Fwhich, Flookfor): Doc string fix. + +2006-03-14 John W. Eaton <jwe@octave.org> + + * defun.cc (print_usage): New arg, extra_msg. + + * xpow.cc: Omit tests for now. + + * parse.y (QUOTE, TRANSPOSE): For compatibility, now have same + precedence as POW and EPOW. + 2006-03-14 Bill Denney <bill@givebillmoney.com> * load-save.cc (Fload, Fsave): Update docstring for functional form.
--- a/src/defun-int.h +++ b/src/defun-int.h @@ -34,7 +34,8 @@ class octave_value; -extern void print_usage (const std::string& nm, bool just_usage = false); +extern void print_usage (const std::string& nm, bool just_usage = false, + const std::string& extra_msg = std::string ()); extern void check_version (const std::string& version, const std::string& fcn);
--- a/src/defun.cc +++ b/src/defun.cc @@ -45,7 +45,8 @@ // the help functions. void -print_usage (const std::string& nm, bool just_usage) +print_usage (const std::string& nm, bool just_usage, + const std::string& extra_msg) { symbol_record *sym_rec = fbi_sym_tab->lookup (nm); @@ -63,7 +64,7 @@ display_help_text (buf, h); - buf << "\n"; + buf << extra_msg << "\n"; if (! just_usage) additional_help_message (buf);
--- a/src/help.cc +++ b/src/help.cc @@ -929,6 +929,7 @@ \n\ Once the GNU Info browser is running, help for using it is available\n\ using the command @kbd{C-h}.\n\ +@seealso{which, lookfor}\n\ @end deffn") { octave_value_list retval; @@ -1116,6 +1117,7 @@ @deffn {Command} which name @dots{}\n\ Display the type of each @var{name}. If @var{name} is defined from a\n\ function file, the full name of the file is also displayed.\n\ +@seealso{help, lookfor}\n\ @end deffn") { octave_value_list retval; @@ -1537,7 +1539,7 @@ find the first sentence, but the same can not be guaranteed for other\n\ functions. Therefore the use of the '-all' argument might be necessary\n\ to find related functions that are not part of octave.\n\ -@seealso{which, help}\n\ +@seealso{help, which}\n\ @end deffn") { octave_value_list retval;
--- a/src/parse.y +++ b/src/parse.y @@ -477,9 +477,8 @@ %left ':' %left '-' '+' EPLUS EMINUS %left '*' '/' LEFTDIV EMUL EDIV ELEFTDIV -%left QUOTE TRANSPOSE %left UNARY PLUS_PLUS MINUS_MINUS EXPR_NOT -%left POW EPOW +%left POW EPOW QUOTE TRANSPOSE %left '(' '.' '{' // Where to start.
--- a/src/xpow.cc +++ b/src/xpow.cc @@ -1207,50 +1207,6 @@ } /* -%!# a ^ b for real/complex scalar/matrix -%!assert (0^-.5, Inf); # case 1 - -%!# a .^ b for real/complex scalar/matrix -%!shared a, b, ai, bi -%! a = [0,1]; ai = [0,1i]; -%! b = [-.5,1]; bi = [-.5,1i]; -%!assert ([0.^b](1), Inf) # case 1 -%!assert ([0.^bi](1), Inf) # case 2 -%!assert ([a.^-.5](1), Inf) # case 3 -%!assert ([a.^b](1), Inf) # case 4 -%!# matrix.^complex # case 5 -%!assert ([a.^bi](1), Inf) # case 6 -%!# complex.^matrix # case 7 -%!# complex.^complexmatrix # case 8 -%!assert ([ai.^-.5](1), Inf) # case 9 -%!assert ([ai.^b](1), Inf) # case 10 -%!# complexmatrix.^complex # case 11 -%!assert ([ai.^bi](1), Inf) # case 12 - -%!# a .^ b for real/complex scalar/ndarray -%!shared a, b, ai, bi -%! a = ones(1,1,2); ai = ones(1,1,2)*1i; -%! b = ones(1,1,2); bi = ones(1,1,2)*1i; -%! a(1,1,1) = 0; ai(1,1,1) = 0; -%! b(1,1,1) = -.5; bi(1,1,1) = -.5; -%!assert ([0.^b](1), Inf) # case 1 -%!assert ([0.^bi](1), Inf) # case 2 -%!assert ([a.^-.5](1), Inf) # case 3 -%!assert ([a.^b](1), Inf) # case 4 -%!# matrix.^complex # case 5 -%!assert ([a.^bi](1), Inf) # case 6 -%!# complex.^matrix # case 7 -%!# complex.^complexmatrix # case 8 -%!assert ([ai.^-.5](1), Inf) # case 9 -%!assert ([ai.^b](1), Inf) # case 10 -%!# complexmatrix.^complex # case 11 -%!assert ([ai.^bi](1), Inf) # case 12 - -%!# I don't think sparse is an issue since -%!# it ignores zeros in the base. -*/ - -/* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: ***
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2006-03-14 John W. Eaton <jwe@octave.org> + + * fntests.m: Prettier printing of output. + * test_eval.m: Disable chatty tests. + 2006-03-08 David Bateman <dbateman@free.fr> * test_system.m: Fix recursive rmdir test for recent change.
--- a/test/fntests.m +++ b/test/fntests.m @@ -31,7 +31,14 @@ if (length(nm) > 5 && strcmp(nm(1:5),"test_") && strcmp(nm((end-1):end),".m")) [p,n] = test(nm(1:(end-2)),"quiet",fid); - printf(" %s -> passes %d of %d\n",nm,p,n); + filler = repmat (".", 1, 40-length(nm)); + printf(" %s %s PASS %4d/%-4d",nm,filler,p,n); + nfail = n - p; + if (nfail > 0) + printf (" FAIL %d\n", nfail); + else + printf ("\n"); + endif dp +=p; dn += n; endif @@ -52,7 +59,7 @@ fclose(fid); endfunction -function [dp, dn] = runtestscript (fid, d, ident); +function [dp, dn] = runtestscript (fid, d); global topsrcdir lst = dir(d); dp = dn = 0; @@ -60,7 +67,7 @@ nm = lst(i).name; if (lst(i).isdir && !strcmp(nm,".") && !strcmp(nm,"..") && !strcmp(nm,"CVS")) - [p, n] = runtestscript (fid, [d, "/",nm], [ident," "]); + [p, n] = runtestscript (fid, [d, "/",nm]); dp += p; dn += n; endif @@ -78,9 +85,16 @@ endif endif endfor - printf("%s%s -> passes %d of %d tests\n", ident, - strrep (d, topsrcdir, "..."), dp, dn); -## printf("%s%s -> passes %d of %d tests\n", ident, d, dp, dn); + tmpnm = strrep (d, [topsrcdir,"/"], ""); + filler = repmat (".", 1, 40-length(tmpnm)); + printf(" %s %s PASS %4d/%-4d", tmpnm, filler, dp, dn); + nfail = dn - dp; + if (nfail > 0) + printf (" FAIL %d\n", nfail); + else + printf ("\n"); + endif + ## printf("%s%s -> passes %d of %d tests\n", ident, d, dp, dn); endfunction function printf_assert(varargin) @@ -111,25 +125,22 @@ endif test("","explain",fid); dp=dn=0; - printf("\nIntegrated test scripts\n"); + printf("\nIntegrated test scripts:\n\n"); for i=1:length(fundirs) - [p,n] = runtestscript(fid,fundirs{i}," "); + [p,n] = runtestscript(fid,fundirs{i}); dp+=p; dn+=n; endfor - printf("\nFixed test scripts\n"); + printf("\nFixed test scripts:\n\n"); for i=1:length(testdirs) [p, n] = runtestdir (fid, testdirs{i}); dp+=p; dn+=n; endfor - printf("---> passes %d out of %d tests",dp,dn); - if dp==dn - printf("\n---> success"); - endif; - disp(""); - printf("see fntests.log for details"); - disp(""); + printf("\nSummary:\n\n PASS %6d\n", dp); + nfail = dn - dp; + printf (" FAIL %6d\n", nfail); + printf("\nSee fntests.log for details.\n"); fclose(fid); page_screen_output = pso; warning(warn_state.state,"quiet");
--- a/test/test_eval.m +++ b/test/test_eval.m @@ -1,7 +1,7 @@ %% Automatically generated from DejaGNU files %% test/octave.test/eval/eval-1.m -%!test +%!#test %! x = 1; %! assert(eval ("x"),1); @@ -12,7 +12,7 @@ %% test/octave.test/eval/eval-3.m %!test -%! x = 1 +%! x = 1; %! assert(eval ("x;"),1); %% XXX FIXME XXX @@ -36,7 +36,7 @@ %! assert(f,2); %% test/octave.test/eval/eval-7.m -%!test +%!#test %! eval ("x = 1"); %! assert(x,1); @@ -51,6 +51,7 @@ %! assert(x,1); %% test/octave.test/eval/eval-10.m +%!#test %! eval ("x = 1") %! assert(x,1);