# HG changeset patch # User jwe # Date 1142527452 0 # Node ID 297b82335c7b8169b0b80b8e757f02a5cc0d9a49 # Parent 52323f13c86b5c877f64834e9e0ffd0c98595664 [project @ 2006-03-16 16:44:12 by jwe] diff --git a/doc/interpreter/expr.txi b/doc/interpreter/expr.txi --- a/doc/interpreter/expr.txi +++ b/doc/interpreter/expr.txi @@ -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) diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2006-03-16 John W. Eaton + + * 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 * src/data.cc (Frows, Fcolumns): New functions. diff --git a/src/ls-oct-ascii.cc b/src/ls-oct-ascii.cc --- a/src/ls-oct-ascii.cc +++ b/src/ls-oct-ascii.cc @@ -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) { diff --git a/src/ls-oct-ascii.h b/src/ls-oct-ascii.h --- a/src/ls-oct-ascii.h +++ b/src/ls-oct-ascii.h @@ -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)