Mercurial > hg > octave-terminal
changeset 13952:acaf33ccc04f
Use "local" option to configuration variables to simplify code.
menu.m, __xzip__.m, pkg.m: Use "local" option to configuration variables
instead of unwind_protect blocks.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 27 Nov 2011 16:51:06 -0800 |
parents | 79aa00a94e9e |
children | 642e43164af6 |
files | scripts/miscellaneous/menu.m scripts/miscellaneous/private/__xzip__.m scripts/pkg/pkg.m |
diffstat | 3 files changed, 25 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/miscellaneous/menu.m +++ b/scripts/miscellaneous/menu.m @@ -42,38 +42,29 @@ ## Don't send the menu through the pager since doing that can cause ## major confusion. - save_page_screen_output = page_screen_output (); - - unwind_protect - - page_screen_output (0); + page_screen_output (0, "local"); - if (! isempty (title)) - disp (title); - printf ("\n"); - endif + if (! isempty (title)) + disp (title); + printf ("\n"); + endif - nopt = nargin - 1; + nopt = nargin - 1; - while (1) - for i = 1:nopt - printf (" [%2d] ", i); - disp (varargin{i}); - endfor - printf ("\n"); - s = input ("pick a number, any number: ", "s"); - num = sscanf (s, "%d"); - if (! isscalar (num) || num < 1 || num > nopt) - printf ("\nerror: input invalid or out of range\n\n"); - else - break; - endif - endwhile - - unwind_protect_cleanup - - page_screen_output (save_page_screen_output); - - end_unwind_protect + while (1) + for i = 1:nopt + printf (" [%2d] ", i); + disp (varargin{i}); + endfor + printf ("\n"); + s = input ("pick a number, any number: ", "s"); + num = sscanf (s, "%d"); + if (! isscalar (num) || num < 1 || num > nopt) + printf ("\nerror: input invalid or out of range\n\n"); + else + break; + endif + endwhile endfunction +
--- a/scripts/miscellaneous/private/__xzip__.m +++ b/scripts/miscellaneous/private/__xzip__.m @@ -99,13 +99,8 @@ unwind_protect_cleanup cd (cwd); if (nargin == 4) - crr = confirm_recursive_rmdir (); - unwind_protect - confirm_recursive_rmdir (false); - rmdir (outdir, "s"); - unwind_protect_cleanup - confirm_recursive_rmdir (crr); - end_unwind_protect + confirm_recursive_rmdir (false, "local"); + rmdir (outdir, "s"); endif end_unwind_protect
--- a/scripts/pkg/pkg.m +++ b/scripts/pkg/pkg.m @@ -2190,13 +2190,8 @@ function [status_out, msg_out] = rm_rf (dir) if (exist (dir)) - crr = confirm_recursive_rmdir (); - unwind_protect - confirm_recursive_rmdir (false); - [status, msg] = rmdir (dir, "s"); - unwind_protect_cleanup - confirm_recursive_rmdir (crr); - end_unwind_protect + crr = confirm_recursive_rmdir (false, "local"); + [status, msg] = rmdir (dir, "s"); else status = 1; msg = "";