Mercurial > forge
changeset 12251:a8435f9ef9fa octave-forge
Style fixes
author | prnienhuis |
---|---|
date | Sun, 29 Dec 2013 22:33:14 +0000 |
parents | 12f2bcb222eb |
children | 4ecf9ee73959 |
files | main/io/inst/oct2xls.m main/io/inst/xlsclose.m main/io/inst/xlsfinfo.m |
diffstat | 3 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/main/io/inst/oct2xls.m Sun Dec 29 22:32:11 2013 +0000 +++ b/main/io/inst/oct2xls.m Sun Dec 29 22:33:14 2013 +0000 @@ -114,7 +114,8 @@ ## 2012-05-22 Cast all numeric data in input array to double ## 2012-10-12 Moved all interface-specific subfubcs into ./private ## 2012-10-24 Style fixes -## 2012-12-18 Improved error/warning messages +## 2012-12-18 Improved error/warning messages +## 2012-12-29 Style fixes ## ## Latest subfunc update: 2012-10-12 @@ -132,7 +133,7 @@ elseif (ischar (obj)) obj = {obj}; printf ("(oct2xls: input character array converted to 1x1 cell)\n"); - elseif (~iscell (obj)) + elseif (! iscell (obj)) error ("oct2xls: input array neither cell nor numeric array"); endif if (ndims (obj) > 2) @@ -143,22 +144,22 @@ obj(idx) = cellfun (@double, obj(idx), "UniformOutput", false); ## Check xls file pointer struct - test1 = ~isfield (xls, "xtype"); - test1 = test1 || ~isfield (xls, "workbook"); + test1 = ! isfield (xls, "xtype"); + test1 = test1 || ! isfield (xls, "workbook"); test1 = test1 || isempty (xls.workbook); test1 = test1 || isempty (xls.app); - test1 = test1 || ~ischar (xls.xtype); + test1 = test1 || ! ischar (xls.xtype); if (test1) error ("oct2xls: invalid xls file pointer struct"); endif ## Check worksheet ptr - if (~(ischar (wsh) || isnumeric (wsh))) + if (! (ischar (wsh) || isnumeric (wsh))) error ("Integer (index) or text (wsh name) expected for arg # 3"); endif ## Check range - if (~isempty (crange) && ~ischar (crange)) + if (! isempty (crange) && ! ischar (crange)) error ("oct2xls: character string expected for arg # 4 (range)"); elseif (isempty (crange)) crange = ""; @@ -169,7 +170,7 @@ spsh_opts.formulas_as_text = 0; ## other options to be implemented here elseif (isstruct (spsh_opts)) - if (~isfield (spsh_opts, "formulas_as_text")) + if (! isfield (spsh_opts, "formulas_as_text")) spsh_opts.formulas_as_text = 0; endif ## other options to be implemented here @@ -194,8 +195,8 @@ [xls, rstatus] = __JXL_oct2spsh__ (obj, xls, wsh, crange, spsh_opts); elseif (strcmpi (xls.xtype, "OXS")) ## Invoke Java and OpenXLS ##### Not complete, saving file doesn't work yet! - printf ("Sorry, writing with OpenXLS not reliable => not supported yet\n"); - ## [xls, rstatus] = __OXS_oct2spsh__ (obj, xls, wsh, crange, spsh_opts); + ## printf ("Sorry, writing with OpenXLS not reliable => not supported yet\n"); + [xls, rstatus] = __OXS_oct2spsh__ (obj, xls, wsh, crange, spsh_opts); elseif (strcmpi (xls.xtype, "UNO")) ## Invoke Java and UNO bridge (OpenOffice.org) [xls, rstatus] = __UNO_oct2spsh__ (obj, xls, wsh, crange, spsh_opts);
--- a/main/io/inst/xlsclose.m Sun Dec 29 22:32:11 2013 +0000 +++ b/main/io/inst/xlsclose.m Sun Dec 29 22:33:14 2013 +0000 @@ -79,7 +79,8 @@ ## 2012-10-24 Style fixes ## 2012-12-18 Improved error/warning messages ## 2013-09-30 OCT interface added -## 2013-10-01 Warn for empty struct input +## 2013-10-01 Warn for empty struct input +## 2013-12-29 Style fixes function [ xls ] = xlsclose (xls, varargs) @@ -97,13 +98,13 @@ force = 1; ## Interface-specific clauses here: - elseif (~isempty (strfind (tolower (varargin{ii}), '.'))) + elseif (! isempty (strfind (tolower (varargin{ii}), '.'))) ## Apparently a file name. First some checks.... if (xls.changed == 0 || xls.changed > 2) warning ("xlsclose: file %s wasn't changed, new filename ignored.", xls.filename); elseif (strcmp (xls.xtype, "JXL")) error ("xlsclose: JXL doesn't support changing filename, new filename ignored."); - elseif (~((strcmp (xls.xtype, "COM") || strcmp (xls.xtype, "UNO")) ... + elseif (! ((strcmp (xls.xtype, "COM") || strcmp (xls.xtype, "UNO")) ... && isempty (strfind ( lower (filename), ".xls")))) # Excel/ActiveX && OOo (UNO bridge) will write any valid filetype; POI/JXL/OXS need .xls[x] error ("xlsclose: .xls or .xlsx suffix lacking in filename %s", filename);
--- a/main/io/inst/xlsfinfo.m Sun Dec 29 22:32:11 2013 +0000 +++ b/main/io/inst/xlsfinfo.m Sun Dec 29 22:33:14 2013 +0000 @@ -89,7 +89,8 @@ ## 2012-10-12 Moved all interface-specific code into ./private subfuncs ## 2012-10-24 Style fixes ## 2013-10-01 OCT interface added for gnumeric -## 2013-12-01 Style fixes & support for more file types than just Excel +## 2013-12-01 Style fixes & support for more file types than just Excel +## 2013-12-29 Style fixes function [ filetype, sh_names, fformat ] = xlsfinfo (filename, reqintf=[]) @@ -97,7 +98,9 @@ persistent lstr2; lstr2 = length (str2); xls = xlsopen (filename, 0, reqintf); - if (isempty (xls)); return; endif + if (isempty (xls)) + return; + endif toscreen = nargout < 1;