comparison scripts/miscellaneous/edit.m @ 17174:c3c1ebfaa7dc

maint: Use common indentation for switch statement. * scripts/general/interp1.m, scripts/geometry/delaunay.m, scripts/help/__unimplemented__.m, scripts/image/cmunique.m, scripts/miscellaneous/edit.m, scripts/optimization/fzero.m, scripts/optimization/sqp.m, scripts/plot/__gnuplot_drawnow__.m, scripts/plot/hidden.m, scripts/plot/legend.m, scripts/plot/print.m, scripts/plot/printd.m, scripts/plot/private/__contour__.m, scripts/plot/private/__fltk_print__.m, scripts/plot/private/__gnuplot_print__.m, scripts/plot/private/__go_draw_axes__.m, scripts/plot/private/__print_parse_opts__.m, scripts/signal/periodogram.m, scripts/sparse/bicg.m, test/slice.tst, test/switch.tst: Use common indentation for switch statement.
author Rik <rik@octave.org>
date Sun, 04 Aug 2013 15:11:34 -0700
parents c3bd7314643c
children 7babcdb9bc13
comparison
equal deleted inserted replaced
17173:3a23cbde59d5 17174:c3c1ebfaa7dc
180 ## or a combination of editor state name and new value for that state, 180 ## or a combination of editor state name and new value for that state,
181 ## so first check for the various states 181 ## so first check for the various states
182 statevar = varargin{1}; 182 statevar = varargin{1};
183 stateval = varargin{2}; 183 stateval = varargin{2};
184 switch (toupper (statevar)) 184 switch (toupper (statevar))
185 case "EDITOR" 185 case "EDITOR"
186 FUNCTION.EDITOR = stateval; 186 FUNCTION.EDITOR = stateval;
187 return; 187 return;
188 case "HOME" 188 case "HOME"
189 if (! isempty (stateval) && stateval(1) == "~") 189 if (! isempty (stateval) && stateval(1) == "~")
190 stateval = [ default_home, stateval(2:end) ]; 190 stateval = [ default_home, stateval(2:end) ];
191 endif 191 endif
192 FUNCTION.HOME = stateval; 192 FUNCTION.HOME = stateval;
193 return; 193 return;
194 case "AUTHOR" 194 case "AUTHOR"
195 FUNCTION.AUTHOR = stateval; 195 FUNCTION.AUTHOR = stateval;
196 return; 196 return;
197 case "EMAIL" 197 case "EMAIL"
198 FUNCTION.EMAIL = stateval; 198 FUNCTION.EMAIL = stateval;
199 return; 199 return;
200 case "LICENSE" 200 case "LICENSE"
201 FUNCTION.LICENSE = stateval; 201 FUNCTION.LICENSE = stateval;
202 return; 202 return;
203 case "MODE" 203 case "MODE"
204 if (strcmp (stateval, "sync") || strcmp (stateval, "async")) 204 if (strcmp (stateval, "sync") || strcmp (stateval, "async"))
205 FUNCTION.MODE = stateval; 205 FUNCTION.MODE = stateval;
206 else
207 error ('edit: expected "edit MODE sync|async"');
208 endif
209 return
210 case "EDITINPLACE"
211 if (ischar (stateval))
212 if (strcmpi (stateval, "true"))
213 stateval = true;
214 elseif (strcmpi (stateval, "false"))
215 stateval = false;
216 else 206 else
217 stateval = eval (stateval); 207 error ('edit: expected "edit MODE sync|async"');
218 endif 208 endif
219 endif 209 return
220 FUNCTION.EDITINPLACE = stateval; 210 case "EDITINPLACE"
221 return 211 if (ischar (stateval))
222 case "GET" 212 if (strcmpi (stateval, "true"))
223 if (isfield (FUNCTION, toupper (stateval))) 213 stateval = true;
224 ret = FUNCTION.(toupper (stateval)); 214 elseif (strcmpi (stateval, "false"))
225 else 215 stateval = false;
226 ret = FUNCTION; 216 else
227 endif 217 stateval = eval (stateval);
228 return 218 endif
229 otherwise 219 endif
230 ## If none of the states match, assume both inputs are 220 FUNCTION.EDITINPLACE = stateval;
231 ## actually both file names to be opened 221 return
232 editfilelist = varargin; 222 case "GET"
223 if (isfield (FUNCTION, toupper (stateval)))
224 ret = FUNCTION.(toupper (stateval));
225 else
226 ret = FUNCTION;
227 endif
228 return
229 otherwise
230 ## If none of the states match, assume both inputs are
231 ## actually both file names to be opened
232 editfilelist = varargin;
233 endswitch 233 endswitch
234 elseif (nargin > 2) 234 elseif (nargin > 2)
235 if (iscellstr (varargin)) 235 if (iscellstr (varargin))
236 editfilelist = varargin; 236 editfilelist = varargin;
237 else 237 else