changeset 5679:297b82335c7b

[project @ 2006-03-16 16:44:12 by jwe]
author jwe
date Thu, 16 Mar 2006 16:44:12 +0000
parents 52323f13c86b
children cc6a965ae4ca
files doc/interpreter/expr.txi src/ChangeLog src/ls-oct-ascii.cc src/ls-oct-ascii.h
diffstat 4 files changed, 31 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/expr.txi	Thu Mar 16 06:45:25 2006 +0000
+++ b/doc/interpreter/expr.txi	Thu Mar 16 16:44:12 2006 +0000
@@ -40,10 +40,27 @@
 Indices may be scalars, vectors, ranges, or the special operator
 @samp{:}, which may be used to select entire rows or columns.
 
-Vectors are indexed using a single expression.  Matrices may be
-indexed using one or two indices (a warning is issued if a single
-index is used unless the value of the built-in variable
-@code{warn_fortran_indexing} is zero).
+Vectors are indexed using a single index expression.  Matrices may be
+indexed using one or two indices.  When using a single index
+expression, the elements of the matrix are taken in column-first order;
+the dimensions of the output match those of the index expression.  For
+example,
+@example
+a (2)       # a scalar
+a (1:2)     # a row vector
+a ([1; 2])  # a column vector
+@end example
+
+As a special case, when a colon is used as a single index, the output
+is a column vector containing all the elements of the vector or matrix.
+For example
+@example
+a (:)       # a column vector
+@end example
+
+A warning is issued when using a single expression to index a matrix,
+unless the value of the built-in variable @code{warn_fortran_indexing}
+is zero.
 
 @DOCSTRING(warn_fortran_indexing)
 
--- a/src/ChangeLog	Thu Mar 16 06:45:25 2006 +0000
+++ b/src/ChangeLog	Thu Mar 16 16:44:12 2006 +0000
@@ -1,3 +1,9 @@
+2006-03-16  John W. Eaton  <jwe@octave.org>
+
+	* ls-oct-ascii.h (extract_keyword): Use std::string compare method
+	instead of strncmp.
+	* ls-oct-ascii.cc (extract_keyword): Likewise. 
+
 2006-03-15  William Poetra Yoga Hadisoeseno  <williampoetra@gmail.com>
 
 	* src/data.cc (Frows, Fcolumns): New functions.
--- a/src/ls-oct-ascii.cc	Thu Mar 16 06:45:25 2006 +0000
+++ b/src/ls-oct-ascii.cc	Thu Mar 16 16:44:12 2006 +0000
@@ -132,9 +132,9 @@
 	    buf << c;
 
 	  buf << OSSTREAM_ENDS;
-	  const char *tmp = OSSTREAM_C_STR (buf);
+	  std::string tmp = OSSTREAM_STR (buf);
+	  bool match = (tmp.compare (0, strlen (keyword), keyword) == 0);
 	  OSSTREAM_FREEZE (buf);
-	  int match = (strncmp (tmp, keyword, strlen (keyword)) == 0);
 
 	  if (match)
 	    {
--- a/src/ls-oct-ascii.h	Thu Mar 16 06:45:25 2006 +0000
+++ b/src/ls-oct-ascii.h	Thu Mar 16 16:44:12 2006 +0000
@@ -90,8 +90,8 @@
 	    buf << c;
 
 	  buf << OSSTREAM_ENDS;
-	  const char *tmp = OSSTREAM_C_STR (buf);
-	  int match = (strncmp (tmp, keyword, strlen (keyword)) == 0);
+	  std::string tmp = OSSTREAM_STR (buf);
+	  bool match = (tmp.compare (0, strlen (keyword), keyword) == 0);
 	  OSSTREAM_FREEZE (buf);
 
 	  if (match)