Mercurial > octave
diff scripts/testfun/private/dump_demos.m @ 21758:ffad2baa90f7
maint: Use newlines to make code more readable.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 20 May 2016 15:46:45 -0700 |
parents | 516bb87ea72e |
children | 3f8ed6d7cb1c |
line wrap: on
line diff
--- a/scripts/testfun/private/dump_demos.m Fri May 20 12:03:39 2016 -0700 +++ b/scripts/testfun/private/dump_demos.m Fri May 20 15:46:45 2016 -0700 @@ -95,9 +95,11 @@ ## Close script fclose (fid); + endfunction function dump_all_demos (directory, fid, fmt) + dirinfo = dir (fullfile (directory, "*.m")); flist = {dirinfo.name}; ## Remove uigetdir, uigetfile, uiputfile, etc. @@ -147,9 +149,11 @@ endfor endfor fprintf (fid, "close all\n"); + endfunction function retval = get_demos (fcn) + [code, idx] = test (fcn, "grabdemo"); num_demos = length (idx) - 1; retval = cell (1, num_demos); @@ -157,9 +161,11 @@ for k = 1:num_demos retval{k} = oct2mat (code(idx(k):idx(k+1)-1)); endfor + endfunction function code = oct2mat (code) + ## Simple hacks to make things Matlab compatible code = strrep (code, "%!", "%%"); code = strrep (code, "!", "~"); @@ -183,5 +189,6 @@ ## Fix up sombrero which now has default argument in Octave code = strrep (code, "sombrero ()", "sombrero (41)"); + endfunction