Mercurial > jwe > octave
changeset 22262:a41c83fc601b
dump_demos.m: Backout a8a9c275e12d and fix filesep on non-unix
author | Andreas Weber <andy.weber.aw@gmail.com> |
---|---|
date | Thu, 11 Aug 2016 08:00:49 +0200 |
parents | 77c4d43e06d1 |
children | 05a8be08368e |
files | scripts/testfun/private/dump_demos.m |
diffstat | 1 files changed, 23 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/private/dump_demos.m Wed Aug 10 22:38:44 2016 -0700 +++ b/scripts/testfun/private/dump_demos.m Thu Aug 11 08:00:49 2016 +0200 @@ -17,12 +17,28 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {} {} dump_demos (@var{dirs}, @var{mfile}, @var{fmt}) +## @deftypefn {} {} dump_demos () +## @deftypefnx {} {} dump_demos (@var{dirs}) +## @deftypefnx {} {} dump_demos (@var{dirs}, @var{mfile}) +## @deftypefnx {} {} dump_demos (@var{dirs}, @var{mfile}, @var{fmt}) ## Produce a script, with the name specified by @var{mfile}, containing ## the demos in the directories, @var{dirs}. The demos are assumed to produce ## graphical output, whose renderings are saved with the specified format, ## @var{fmt}. ## +## The defaults for each input are; +## +## @table @var +## @item @var{dirs} +## @code{@{"plot/appearance", "plot/draw", "plot/util", "image"@}} +## +## @item @var{mfile} +## @qcode{"dump.m"} +## +## @item @var{fmt} +## @qcode{"png"} +## @end table +## ## For example, to produce PNG output for all demos of the functions ## in the plot directory; ## @@ -34,9 +50,9 @@ ## Author: Søren Hauberg <soren@hauberg.org> -function dump_demos (dirs, output, fmt) +function dump_demos (dirs={"plot/appearance", "plot/draw", "plot/util", "image"}, output="dump_plot_demos.m", fmt="png") - if (nargin != 3) + if (nargin > 3) print_usage (); endif @@ -46,6 +62,10 @@ error ("dump_demos: DIRS must be a cell array of strings with directory names"); endif + if (! isunix ()) + dirs = strrep (dirs, "/", filesep ()); + endif + [~, funcname, ext] = fileparts (output); if (isempty (ext)) output = [output ".m"];