annotate scripts/general/profexplore.m @ 21633:dcf8922b724b

Deprecate printf, puts, and scanf. Make fputs a M-file. * libinterp/corefcn/file-io.cc: extracted printf, puts, and scanf to M-files. * scripts/deprecated/printf.m: new function, equivalent to version file-io.cc. * scripts/deprecated/puts.m: new function, equivalent to version file-io.cc. * scripts/deprecated/scanf.m: new function, equivalent to version file-io.cc. * scripts/deprecated/module.mk: added printf, puts, and scanf. * scripts/io/fputs.m: new function, equivalent to version file-io.cc. * scripts/io/module.mk: added fputs. * doc/interpreter/io.txi: adapted documentation to current implementation. * NEWS: announced changes. * doc/interpreter/basics.txi: replaced printf by fprintf. * doc/interpreter/stmt.txi: replaced printf by fprintf. * doc/interpreter/var.txi: replaced printf by fprintf. * doc/refcard/refcard.tex: removed printf and scanf. * examples/code/@FIRfilter/display.m: replaced printf by fprintf. * examples/code/@polynomial/display.m: replaced printf by fprintf. * scripts/@ftp/display.m: replaced printf by fprintf. * scripts/general/inputParser.m: replaced printf by fprintf. * scripts/general/methods.m: replaced printf by fprintf. * scripts/general/profexplore.m: replaced printf by fprintf. * scripts/general/profshow.m: replaced printf by fprintf. * scripts/help/help.m: replaced puts by fputs and printf by fprintf. * scripts/help/lookfor.m: replaced puts by fputs and printf by fprintf. * scripts/help/which.m: replaced printf by fprintf. * scripts/image/imformats.m: replaced printf by fprintf. * scripts/io/beep.m: replaced puts by fputs. * scripts/io/textread.m: replaced printf by fprintf. * scripts/java/javaclasspath.m: replaced printf by fprintf. * scripts/java/javamem.m: replaced printf by fprintf. * scripts/miscellaneous/dir.m: replaced printf by fprintf. * scripts/miscellaneous/dos.m: replaced printf by fprintf. * scripts/miscellaneous/fact.m: replaced printf by fprintf. * scripts/miscellaneous/info.m: replaced printf by fprintf. * scripts/miscellaneous/license.m: replaced printf by fprintf. * scripts/miscellaneous/ls.m: replaced puts by fputs. * scripts/miscellaneous/menu.m: replaced printf by fprintf. * scripts/miscellaneous/mkoctfile.m: replaced printf by fprintf. * scripts/miscellaneous/private/display_info_file.m: * scripts/miscellaneous/unix.m: replaced printf by fprintf. * scripts/miscellaneous/ver.m: replaced printf by fprintf. * scripts/miscellaneous/what.m: replaced printf by fprintf. * scripts/ode/ode23.m: replaced printf by fprintf. * scripts/ode/ode45.m: replaced printf by fprintf. * scripts/optimization/fminbnd.m: replaced printf by fprintf. * scripts/optimization/optimset.m: replaced puts by fputs and printf by fprintf. * scripts/optimization/sqp.m: replaced printf by fprintf. * scripts/pkg/pkg.m: replaced printf by fprintf. * scripts/pkg/private/describe.m: replaced printf by fprintf. * scripts/pkg/private/install.m: replaced printf by fprintf. * scripts/pkg/private/installed_packages.m: replaced printf by fprintf. * scripts/pkg/private/list_forge_packages.m: replaced puts by fputs and printf by fprintf. * scripts/pkg/private/rebuild.m: replaced printf by fprintf. * scripts/plot/util/__gnuplot_drawnow__.m: replaced puts by fputs and printf by fprintf. * scripts/signal/stft.m: replaced printf by fprintf. * scripts/sparse/bicg.m: replaced printf by fprintf. * scripts/sparse/bicgstab.m: replaced printf by fprintf. * scripts/sparse/cgs.m: replaced printf by fprintf. * scripts/sparse/pcg.m: replaced printf by fprintf. * scripts/sparse/pcr.m: replaced printf by fprintf. * scripts/sparse/qmr.m: replaced printf by fprintf. * scripts/statistics/models/logistic_regression.m: replaced printf by fprintf. * scripts/statistics/tests/anova.m: replaced printf by fprintf. * scripts/statistics/tests/bartlett_test.m: replaced printf by fprintf. * scripts/statistics/tests/chisquare_test_homogeneity.m: replaced printf by fprintf. * scripts/statistics/tests/chisquare_test_independence.m: replaced printf by fprintf. * scripts/statistics/tests/cor_test.m: replaced printf by fprintf. * scripts/statistics/tests/f_test_regression.m: replaced printf by fprintf. * scripts/statistics/tests/hotelling_test.m: replaced printf by fprintf. * scripts/statistics/tests/hotelling_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/kolmogorov_smirnov_test.m: replaced printf by fprintf. * scripts/statistics/tests/kolmogorov_smirnov_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/kruskal_wallis_test.m: replaced printf by fprintf. * scripts/statistics/tests/manova.m: replaced printf by fprintf. * scripts/statistics/tests/mcnemar_test.m: replaced printf by fprintf. * scripts/statistics/tests/prop_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/run_test.m: replaced printf by fprintf. * scripts/statistics/tests/sign_test.m: replaced printf by fprintf. * scripts/statistics/tests/t_test.m: replaced printf by fprintf. * scripts/statistics/tests/t_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/t_test_regression.m: replaced printf by fprintf. * scripts/statistics/tests/u_test.m: replaced printf by fprintf. * scripts/statistics/tests/var_test.m: replaced printf by fprintf. * scripts/statistics/tests/welch_test.m: replaced printf by fprintf. * scripts/statistics/tests/wilcoxon_test.m: replaced printf by fprintf. * scripts/statistics/tests/z_test.m: replaced printf by fprintf. * scripts/statistics/tests/z_test_2.m: replaced printf by fprintf. * scripts/strings/strtok.m: replaced printf by fprintf. * scripts/testfun/__run_test_suite__.m: replaced puts by fputs and printf by fprintf. * scripts/testfun/demo.m: replaced printf by fprintf. * scripts/testfun/example.m: replaced printf by fprintf. * scripts/testfun/private/compare_plot_demos.m: replaced printf by fprintf. * scripts/testfun/rundemos.m: replaced printf by fprintf. * scripts/testfun/runtests.m: replaced puts by fputs and printf by fprintf. * scripts/testfun/speed.m: replaced printf by fprintf. * scripts/testfun/test.m: replaced printf by fprintf. * scripts/time/calendar.m: replaced puts by fputs and printf by fprintf. * test/io.tst: replaced printf by fprintf.
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Wed, 20 Apr 2016 17:53:10 +0200
parents 516bb87ea72e
children 96518f623c91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
1 ## Copyright (C) 2012-2015 Daniel Kraft
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
2 ##
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
3 ## This file is part of Octave.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
4 ##
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
8 ## your option) any later version.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
9 ##
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
13 ## General Public License for more details.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
14 ##
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
18
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
19 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20231
diff changeset
20 ## @deftypefn {} {} profexplore ()
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20231
diff changeset
21 ## @deftypefnx {} {} profexplore (@var{data})
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
22 ## Interactively explore hierarchical profiler output.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
23 ##
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
24 ## Assuming @var{data} is the structure with profile data returned by
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17202
diff changeset
25 ## @code{profile (@qcode{"info"})}, this command opens an interactive prompt
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
26 ## that can be used to explore the call-tree. Type @kbd{help} to get a list
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17202
diff changeset
27 ## of possible commands. If @var{data} is omitted, @code{profile ("info")}
17202
9e613baf431e profexplore.m: Allow calling with no args, add "quit" as alias to "exit".
Philipp Kutin <philipp.kutin@gmail.com>
parents: 14359
diff changeset
28 ## is called and used in its place.
13191
c5ddb99ff5de Put @seealso in profiler functions' docstrings.
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 13189
diff changeset
29 ## @seealso{profile, profshow}
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
30 ## @end deftypefn
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
31
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
32 ## Built-in profiler.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
33 ## Author: Daniel Kraft <d@domob.eu>
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
34
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
35 function profexplore (data)
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
36
17202
9e613baf431e profexplore.m: Allow calling with no args, add "quit" as alias to "exit".
Philipp Kutin <philipp.kutin@gmail.com>
parents: 14359
diff changeset
37 if (nargin == 0)
9e613baf431e profexplore.m: Allow calling with no args, add "quit" as alias to "exit".
Philipp Kutin <philipp.kutin@gmail.com>
parents: 14359
diff changeset
38 data = profile ("info");
9e613baf431e profexplore.m: Allow calling with no args, add "quit" as alias to "exit".
Philipp Kutin <philipp.kutin@gmail.com>
parents: 14359
diff changeset
39 elseif (nargin != 1)
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
40 print_usage ();
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
41 endif
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
42
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
43 ## The actual work is done by a recursive worker function, since that
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
44 ## is an easy way to traverse the tree datastructure. Here, we just check
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
45 ## the arguments (already done) and give over to it.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
46
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
47 __profexplore_worker (data.FunctionTable, data.Hierarchical, "Top\n", " ");
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
48
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
49 endfunction
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
50
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
51 ## This is the worker function. tree is the current subtree we want to
14359
7277fe922e99 doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents: 14222
diff changeset
52 ## display / explore. parents is a string containing the already "rendered"
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
53 ## data for the parents which is displayed on top of the list of current
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
54 ## children. prefix is the prefix to add to each line rendered; this
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
55 ## is just a string of spaces to get indentation right.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
56 ##
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
57 ## Returning 0 indicates that the user requested to totally exit the
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
58 ## explorer, thus also all higher levels should exit immediately. An integer
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
59 ## greater zero indicates to exit that many levels since the user wants to go
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
60 ## up (but not necessarily quit).
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
61
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
62 function rv = __profexplore_worker (fcn_table, tree, parents, prefix)
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
63
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
64 ## Sort children by total time.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
65 times = -[ tree.TotalTime ];
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
66 [~, p] = sort (times);
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
67 tree = tree(p);
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
68
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
69 while (true)
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
70
21633
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
71 fprintf ("\n%s", parents);
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
72 strings = cell (length (tree), 1);
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
73 for i = 1 : length (tree)
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
74 strings{i} = sprintf ("%s: %d calls, %.3f total, %.3f self", ...
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
75 fcn_table(tree(i).Index).FunctionName, ...
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
76 tree(i).NumCalls, ...
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
77 tree(i).TotalTime, tree(i).SelfTime);
21633
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
78 fprintf ("%s%d) %s\n", prefix, i, strings{i});
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
79 endfor
21633
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
80 fprintf ("\n");
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
81
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
82 cmd = input ("profexplore> ", "s");
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
83 option = fix (str2double (cmd));
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
84
17202
9e613baf431e profexplore.m: Allow calling with no args, add "quit" as alias to "exit".
Philipp Kutin <philipp.kutin@gmail.com>
parents: 14359
diff changeset
85 if (strcmp (cmd, "exit") || strcmp (cmd, "quit"))
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
86 rv = 0;
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
87 return;
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
88 elseif (strcmp (cmd, "help"))
21633
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
89 fprintf ("\nCommands for profile explorer:\n\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
90 fprintf ("exit Return to Octave prompt.\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
91 fprintf ("quit Return to Octave prompt.\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
92 fprintf ("help Display this help message.\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
93 fprintf ("up [N] Go up N levels, where N is an integer. Default is 1.\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
94 fprintf ("N Go down a level into option N.\n");
14222
190952239c2c Use '!' for not operation in preference to '~'.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
95 elseif (! isnan (option))
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
96 if (option < 1 || option > length (tree))
21633
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
97 fprintf ("The chosen option is out of range!\n");
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
98 else
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
99 newParents = sprintf ("%s%s%s\n", parents, prefix, strings{option});
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
100 newPrefix = sprintf ("%s ", prefix);
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
101
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
102 rv = __profexplore_worker (fcn_table, tree(option).Children, ...
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
103 newParents, newPrefix);
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
104
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
105 if (rv == 0)
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
106 return;
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
107 elseif (rv > 1)
20231
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 19697
diff changeset
108 rv -= 1;
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
109 return;
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
110 else
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
111 assert (rv == 1);
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
112 ## It was requested to return to this level, so just stay.
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
113 endif
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
114 endif
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
115 elseif (length (cmd) >= 2 && strcmp (substr (cmd, 1, 2), "up"))
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
116 if (length (cmd) == 2)
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
117 rv = 1;
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
118 return;
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
119 endif
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
120
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
121 if (length (cmd) > 3 && cmd(3) == ' ')
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
122 opt = fix (str2double (substr (cmd, 3)));
14222
190952239c2c Use '!' for not operation in preference to '~'.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
123 if (! isnan (opt) && opt > 0)
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
124 rv = opt;
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
125 return;
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
126 endif
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
127 endif
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
128
21633
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
129 fprintf ("Invalid 'up' command. Type 'help' for further");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
130 fprintf (" information.\n");
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
131 else
21633
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
132 fprintf ("Unrecognized input. Type 'help' to get a list of possible");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
133 fprintf (" commands.\n");
13189
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
134 endif
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
135
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
136 endwhile
c5a8b23db680 New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff changeset
137 endfunction
17338
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 17281
diff changeset
138