From: <car...@us...> - 2012-03-21 00:12:32
|
Revision: 9982 http://octave.svn.sourceforge.net/octave/?rev=9982&view=rev Author: carandraug Date: 2012-03-21 00:12:25 +0000 (Wed, 21 Mar 2012) Log Message: ----------- csvexplode.cc xmlread.cc cell2csv.cc xmltree.c: replace tabs per spaces and typos on help text Modified Paths: -------------- trunk/octave-forge/main/io/src/cell2csv.cc trunk/octave-forge/main/io/src/csvexplode.cc trunk/octave-forge/main/io/src/xmlread.cc trunk/octave-forge/main/io/src/xmltree.c Modified: trunk/octave-forge/main/io/src/cell2csv.cc =================================================================== --- trunk/octave-forge/main/io/src/cell2csv.cc 2012-03-20 21:41:38 UTC (rev 9981) +++ trunk/octave-forge/main/io/src/cell2csv.cc 2012-03-21 00:12:25 UTC (rev 9982) @@ -21,15 +21,15 @@ DEFUN_DLD (cell2csv, args, nargout, "-*- texinfo -*-\n" "@deftypefn {Loadable Function} {} cell2csv (@var{file}, @var{c})\n" - "@deftypefnx {Loadable Function} {} cell2csv (@var{file}, @var{c}, @var{sep})\n" - "@deftypefnx {Loadable Function} {} cell2csv (@var{file}, @var{c}, @var{sep}, @var{prot})\n" - "\n" - "Create a CSV file from a cell array. " - "@var{sep} (character value) changes the character used to separate two fields. " - "The default value is a comma " - "(@code{,}). @var{prot} (character value) changes the character used to protect a string. " - "Default value is a double quote (@code{\"}).\n" - "@end deftypefn") { + "@deftypefnx {Loadable Function} {} cell2csv (@var{file}, @var{c}, @var{sep})\n" + "@deftypefnx {Loadable Function} {} cell2csv (@var{file}, @var{c}, @var{sep}, @var{prot})\n" + "\n" + "Create a CSV file from a cell array. " + "@var{sep} (character value) changes the character used to separate two fields. " + "The default value is a comma " + "(@code{,}). @var{prot} (character value) changes the character used to protect a string. " + "Default value is a double quote (@code{\"}).\n" + "@end deftypefn") { /* Check argument */ if ((args.length() < 2) || (args.length() > 4)) { @@ -72,34 +72,34 @@ /* Add separator */ if (j != 0) - word += sep; + word += sep; if (c(i, j).is_real_scalar()) { - /* Output real value */ - char tmp[20]; - sprintf(tmp, "%g", c(i, j).double_value()); - word += tmp; + /* Output real value */ + char tmp[20]; + sprintf(tmp, "%g", c(i, j).double_value()); + word += tmp; } else if (c(i, j).is_string()) { - /* Output string value */ - std::string str = c(i, j).string_value(); - if (str.find(sep) != str.npos) { - size_t pos = 0; - while ((pos=str.find(prot, pos)) != str.npos) { - str.replace(pos, 1, prot+prot); - pos += 2; - } - str = prot + str + prot; - } - word += str; + /* Output string value */ + std::string str = c(i, j).string_value(); + if (str.find(sep) != str.npos) { + size_t pos = 0; + while ((pos=str.find(prot, pos)) != str.npos) { + str.replace(pos, 1, prot+prot); + pos += 2; + } + str = prot + str + prot; + } + word += str; } else if (!c(i, j).is_empty()) { - /* Output NaN value */ - warning ("cell2csv: empty cell or not a real or a string value - converted to 'NaN'\n"); - word += "NaN"; + /* Output NaN value */ + warning ("cell2csv: empty cell or not a real or a string value - converted to 'NaN'\n"); + word += "NaN"; } fd << word; Modified: trunk/octave-forge/main/io/src/csvexplode.cc =================================================================== --- trunk/octave-forge/main/io/src/csvexplode.cc 2012-03-20 21:41:38 UTC (rev 9981) +++ trunk/octave-forge/main/io/src/csvexplode.cc 2012-03-21 00:12:25 UTC (rev 9982) @@ -18,14 +18,14 @@ DEFUN_DLD (csvexplode, args, nargout, "-*- texinfo -*-\n" - "@deftypefn {Loadable Function} {@var{c} = } csvexplode (@var{str})\n" - "@deftypefnx {Loadable Function} {@var{c} = } csvexplode (@var{str}, @var{sep})\n" - "@deftypefnx {Loadable Function} {@var{c} = } csvexplode (@var{str}, @var{sep}, @var{prot})\n" - "\n" - "Explode a CSV string into a cell. " - "@var{sep} (character value) changes the character used to separate two fields. " - "The default value is a comma (@code{,}). @var{prot} (character value) changes " - "the character used to protect a string. The default is a double quote (@code{\"}).\n" + "@deftypefn {Loadable Function} {@var{c} =} csvexplode (@var{str})\n" + "@deftypefnx {Loadable Function} {@var{c} =} csvexplode (@var{str}, @var{sep})\n" + "@deftypefnx {Loadable Function} {@var{c} =} csvexplode (@var{str}, @var{sep}, @var{prot})\n" + "\n" + "Explode a CSV string into a cell. " + "@var{sep} (character value) changes the character used to separate two fields. " + "The default value is a comma (@code{,}). @var{prot} (character value) changes " + "the character used to protect a string. The default is a double quote (@code{\"}).\n" "@end deftypefn") { /* Check argument */ @@ -74,8 +74,8 @@ /* Store into the cell */ retval(0, retval.columns()-1) = - ((word == "") || (err != word_str+word.length())) ? - octave_value(word) : octave_value(val); + ((word == "") || (err != word_str+word.length())) ? + octave_value(word) : octave_value(val); word = ""; } Modified: trunk/octave-forge/main/io/src/xmlread.cc =================================================================== --- trunk/octave-forge/main/io/src/xmlread.cc 2012-03-20 21:41:38 UTC (rev 9981) +++ trunk/octave-forge/main/io/src/xmlread.cc 2012-03-21 00:12:25 UTC (rev 9982) @@ -53,7 +53,7 @@ case value_complex: retval = octave_value(Complex(get_element(root->child).double_value(), - get_element(root->child->next).double_value())); + get_element(root->child->next).double_value())); break; case value_string: @@ -76,7 +76,7 @@ tmp_matrix = ComplexMatrix(rows, columns); for (int k=0; (k<rows) && (root); k++) for (int l=0; (l<columns) && (root); l++, root = root->next) - tmp_matrix(k, l) = get_element(root).complex_value(); + tmp_matrix(k, l) = get_element(root).complex_value(); if (tmp_matrix.all_elements_are_real()) retval = octave_value(real(tmp_matrix)); else @@ -87,13 +87,13 @@ root = root->child; for (int k=0; root; root = root->next) if (root->name) - tmp_structure.assign(root->name, get_element(root)); + tmp_structure.assign(root->name, get_element(root)); else { - char *name = new char[7]; - sprintf (name, "__%04d", k++); - warning ("no field name in structure."); - tmp_structure.assign(name, get_element(root)); - delete[] name; + char *name = new char[7]; + sprintf (name, "__%04d", k++); + warning ("no field name in structure."); + tmp_structure.assign(name, get_element(root)); + delete[] name; } retval = octave_value(tmp_structure); break; @@ -114,7 +114,7 @@ tmp_cell = Cell(rows, columns); for (int k=0; (k<rows) && (root); k++) for (int l=0; (l<columns) && (root); l++, root = root->next) - tmp_cell(k, l) = get_element(root); + tmp_cell(k, l) = get_element(root); retval = octave_value(tmp_cell); break; @@ -126,11 +126,10 @@ } DEFUN_DLD (xmlread, args, nargout, - "-*- texinfo -*-\n" - "@deftypefn {Loadable Function} {@var{value}} xmlread(@var{filename})\n" - "\n" - "Read a @var{value} from @var{filename} as an XML file\n" - "@end deftypefn") { + "-*- texinfo -*-\n" + "@deftypefn {Loadable Function} {@var{value} =} xmlread(@var{filename})\n" + "Read a @var{value} from @var{filename} as an XML file\n" + "@end deftypefn") { /* Check argument */ if (args.length() != 1) { Modified: trunk/octave-forge/main/io/src/xmltree.c =================================================================== --- trunk/octave-forge/main/io/src/xmltree.c 2012-03-20 21:41:38 UTC (rev 9981) +++ trunk/octave-forge/main/io/src/xmltree.c 2012-03-21 00:12:25 UTC (rev 9982) @@ -169,5 +169,3 @@ return father; } - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |