changeset 8019:0ef13e15319b

replace NPOS with std::string::npos
author John W. Eaton <jwe@octave.org>
date Thu, 07 Aug 2008 15:15:33 -0400
parents 8487847eb092
children 1d2bcc163c4d
files ChangeLog aclocal.m4 configure.in liboctave/ChangeLog liboctave/cmd-edit.cc liboctave/file-ops.h liboctave/kpse.cc liboctave/oct-env.cc liboctave/pathsearch.cc scripts/ChangeLog scripts/gethelp.cc src/Cell.cc src/ChangeLog src/DLD-FUNCTIONS/dlmread.cc src/DLD-FUNCTIONS/regexp.cc src/debug.cc src/error.cc src/file-io.cc src/graphics.cc src/help.cc src/input.cc src/lex.l src/load-path.cc src/load-save.cc src/ls-mat-ascii.cc src/ls-oct-ascii.cc src/oct-stream.cc src/octave.cc src/ov-fcn-handle.cc src/parse.y src/pr-output.cc src/symtab.cc src/sysdep.cc src/utils.cc src/variables.cc
diffstat 35 files changed, 159 insertions(+), 161 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Aug 07 14:53:38 2008 -0400
+++ b/ChangeLog	Thu Aug 07 15:15:33 2008 -0400
@@ -1,3 +1,8 @@
+2008-08-07  John W. Eaton  <jwe@octave.org>
+
+	* aclocal.m4 (OCTAVE_STRING_NPOS): Delete.
+	* configure.in (OCTAVE_STRING_NPOS): Delete use.
+
 2008-08-04  John W. Eaton  <jwe@octave.org>
 
 	* Makeconf.in (do-subst-script-vals): Also substitute SED.
--- a/aclocal.m4	Thu Aug 07 14:53:38 2008 -0400
+++ b/aclocal.m4	Thu Aug 07 15:15:33 2008 -0400
@@ -59,21 +59,6 @@
 AC_SUBST(ARFLAGS)
 ])
 dnl
-dnl See if the standard string class has npos as a member.
-dnl
-AC_DEFUN(OCTAVE_STRING_NPOS,
-[AC_CACHE_CHECK([whether including <string> defines NPOS],
-octave_cv_string_npos,
-[AC_LANG_PUSH(C++)
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string>]],
-[[size_t foo = NPOS]])],
-octave_cv_string_npos=yes, octave_cv_string_npos=no)])
-if test $octave_cv_string_npos = no; then
-  AC_DEFINE(NPOS, [std::string::npos], [Define (to string::npos) if <string> doesn't])
-fi
-AC_LANG_POP(C++)
-])
-dnl
 dnl See if the compiler supports placement delete
 dnl
 AC_DEFUN(OCTAVE_PLACEMENT_DELETE,
--- a/configure.in	Thu Aug 07 14:53:38 2008 -0400
+++ b/configure.in	Thu Aug 07 15:15:33 2008 -0400
@@ -1366,10 +1366,6 @@
 AC_FUNC_ALLOCA
 AC_C_CONST
 
-### See if we should define NPOS.
-
-OCTAVE_STRING_NPOS
-
 ### See if we should use placement delete.
 
 OCTAVE_PLACEMENT_DELETE
--- a/liboctave/ChangeLog	Thu Aug 07 14:53:38 2008 -0400
+++ b/liboctave/ChangeLog	Thu Aug 07 15:15:33 2008 -0400
@@ -1,5 +1,8 @@
 2008-08-07  John W. Eaton  <jwe@octave.org>
 
+	* cmd-edit.cc, file-ops.h, kpse.cc, oct-env.cc, pathsearch.cc:
+	Replace all uses of NPOS with std::string::npos.
+
 	* fCmplxLU.h, CmplxLU.h: Fix typo in definition of
 	multiple-inclusion guard macro.
 
--- a/liboctave/cmd-edit.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/liboctave/cmd-edit.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -1371,7 +1371,7 @@
 		      {
 			size_t pos = temp.rfind ('/');
 
-			if (pos != NPOS && pos != 0)
+			if (pos != std::string:npos && pos != 0)
 			  temp = temp.substr (pos + 1);
 		      }
 		  }
@@ -1401,7 +1401,7 @@
 
 		size_t pos = temp.find ('.');
 
-		if (pos != NPOS)
+		if (pos != std::string:npos)
 		  temp.resize (pos);
 		
 		goto add_string;
--- a/liboctave/file-ops.h	Thu Aug 07 14:53:38 2008 -0400
+++ b/liboctave/file-ops.h	Thu Aug 07 15:15:33 2008 -0400
@@ -89,7 +89,7 @@
   static bool is_dir_sep (char c)
   {
     std::string tmp = dir_sep_chars ();
-    return tmp.find (c) != NPOS;
+    return tmp.find (c) != std::string::npos;
   }
 
   static std::string concat (const std::string&, const std::string&);
--- a/liboctave/kpse.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/liboctave/kpse.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -449,7 +449,7 @@
       if (e == len)
 	; /* OK, we have found the last element.  */
       else if (e > len)
-	b = e = NPOS;
+	b = e = std::string:npos;
       else
 	{
 	  /* Find the next colon not enclosed by braces (or the end of
@@ -470,7 +470,7 @@
 	b++;
 
       if (b >= len)
-	b = e = NPOS;
+	b = e = std::string:npos;
       else
 	set_end ();
     }
@@ -758,7 +758,7 @@
   string_vector ret_list;
   bool done = false;
 
-  for (kpse_path_iterator pi (path); ! done && pi != NPOS; pi++)
+  for (kpse_path_iterator pi (path); ! done && pi != std::string:npos; pi++)
     {
       std::string elt = *pi;
 
@@ -935,7 +935,7 @@
   string_vector ret_list;
   bool done = false;
 
-  for (kpse_path_iterator pi (path); ! done && pi != NPOS; pi++)
+  for (kpse_path_iterator pi (path); ! done && pi != std::string:npos; pi++)
     {
       std::string elt = *pi;
 
@@ -1267,7 +1267,7 @@
   if (kpse_dot.empty ())
     return path;
 
-  for (kpse_path_iterator pi (path); pi != NPOS; pi++)
+  for (kpse_path_iterator pi (path); pi != std::string:npos; pi++)
     {
       std::string elt = *pi;
 
@@ -1347,7 +1347,7 @@
 
   std::string ret;
 
-  for (kpse_path_iterator pi (tmp); pi != NPOS; pi++)
+  for (kpse_path_iterator pi (tmp); pi != std::string:npos; pi++)
     {
       std::string elt = *pi;
 
@@ -1383,7 +1383,7 @@
   std::string tmp = kpse_brace_expand (path);
 
   /* Now expand each of the path elements, printing the results */
-  for (kpse_path_iterator pi (tmp); pi != NPOS; pi++)
+  for (kpse_path_iterator pi (tmp); pi != std::string:npos; pi++)
     {
       std::string elt = *pi;
 
@@ -1846,7 +1846,7 @@
      should never happen.  */
   std::string path_elt;
   size_t last_slash = name.rfind ('/');
-  if (last_slash != NPOS && last_slash != 0)
+  if (last_slash != std::string:npos && last_slash != 0)
     {
       std::string dir_part = name.substr (0, last_slash);
       name = name.substr (last_slash + 1);
--- a/liboctave/oct-env.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/liboctave/oct-env.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -221,7 +221,7 @@
   size_t pos
     = program_invocation_name.find_last_of (file_ops::dir_sep_chars ());
 
-  program_name = (pos == NPOS)
+  program_name = (pos == std::string:npos)
     ? program_invocation_name : program_invocation_name.substr (pos+1);
 }
 
@@ -305,7 +305,7 @@
 
   size_t pos = s.find_last_of (file_ops::dir_sep_chars ());
 
-  if (pos == NPOS)
+  if (pos == std::string:npos)
     return s;
   else
     return s.substr (pos+1);
@@ -370,7 +370,7 @@
 
       size_t tmp = s.find_first_of (file_ops::dir_sep_chars (), i);
 
-      if (tmp == NPOS)
+      if (tmp == std::string:npos)
 	{
 	  current_dir.append (s, i, tmp-i);
 	  break;
--- a/liboctave/pathsearch.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/liboctave/pathsearch.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -157,7 +157,7 @@
 			? p_orig : kpse_expand_default (p_orig, p_default));
 
   int count = 0;
-  for (kpse_path_iterator pi (p); pi != NPOS; pi++)
+  for (kpse_path_iterator pi (p); pi != std::string:npos; pi++)
     count++;
 
   pv.resize (count);
--- a/scripts/ChangeLog	Thu Aug 07 14:53:38 2008 -0400
+++ b/scripts/ChangeLog	Thu Aug 07 15:15:33 2008 -0400
@@ -1,3 +1,7 @@
+2008-08-07  John W. Eaton  <jwe@octave.org>
+
+	* gethelp.cc: Delete definition of NPOS.
+
 2008-08-04  John W. Eaton  <jwe@octave.org>
 
 	* strings/strtok.m: Include TAB, LF, VT, FF, and CR in default
--- a/scripts/gethelp.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/scripts/gethelp.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -27,10 +27,6 @@
 #include <string>
 #include <iostream>
 
-#ifndef NPOS
-#define NPOS std::string::npos
-#endif
-
 static bool
 looks_like_octave_copyright (const std::string& s)
 {
--- a/src/Cell.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/Cell.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -47,7 +47,7 @@
 	    {
 	      size_t pos = s.find_last_not_of (' ');
 
-	      s = (pos == NPOS) ? "" : s.substr (0, pos+1);
+	      s = (pos == std::string:npos) ? "" : s.substr (0, pos+1);
 	    }
 
 	  elem(i,0) = s;
@@ -77,7 +77,7 @@
 	    {
 	      size_t pos = s.find_last_not_of (' ');
 
-	      s = (pos == NPOS) ? "" : s.substr (0, pos+1);
+	      s = (pos == std::string:npos) ? "" : s.substr (0, pos+1);
 	    }
 
 	  elem(i) = s;
--- a/src/ChangeLog	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/ChangeLog	Thu Aug 07 15:15:33 2008 -0400
@@ -1,5 +1,12 @@
 2008-08-07  John W. Eaton  <jwe@octave.org>
 
+	* Cell.cc, DLD-FUNCTIONS/regexp.cc, DLD-FUNCTIONS/dlmread.cc,
+	debug.cc, error.cc, file-io.cc, graphics.cc, help.cc, input.cc,
+	lex.l, load-path.cc, load-save.cc, ls-mat-ascii.cc,
+	ls-oct-ascii.cc, oct-stream.cc, octave.cc, variables.cc,
+	ov-fcn-handle.cc, parse.y, pr-output.cc, symtab.cc, sysdep.cc,
+	utils.cc: Replace all uses of NPOS with std::string::npos.
+
 	* ov.cc (octave_value::idx_type_value): Move definition here.
 	* ov.h: From here.
 
--- a/src/DLD-FUNCTIONS/dlmread.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/DLD-FUNCTIONS/dlmread.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -250,7 +250,7 @@
       while (getline (file, line))
 	{
 	  // Skip blank lines for compatibility.
-	  if (line.find_first_not_of (" \t") == NPOS)
+	  if (line.find_first_not_of (" \t") == std::string:npos)
 	    continue;
 
 	  // To be compatible with matlab, blank separator should
@@ -259,7 +259,7 @@
 	    {
 	      size_t n = line.find_first_of (",:; \t", 
 					     line.find_first_of ("0123456789"));
-	      if (n == NPOS)
+	      if (n == std::string:npos)
 		{
 		  sep = " \t";
 		  sepflag = true;
@@ -291,7 +291,7 @@
 	      size_t pos2 = line.find_first_of (sep, pos1);
 	      std::string str = line.substr (pos1, pos2 - pos1);
 
-	      if (sepflag && pos2 != NPOS)
+	      if (sepflag && pos2 != std::string:npos)
 		// Treat consecutive separators as one.
 		pos2 = line.find_first_not_of (sep, pos2) - 1;
 
@@ -338,13 +338,13 @@
 	      else
 		rdata(i,j++) = 0.;
 
-	      if (pos2 != NPOS)
+	      if (pos2 != std::string:npos)
 		pos1 = pos2 + 1;
 	      else
-		pos1 = NPOS;
+		pos1 = std::string:npos;
 
 	    }
-	  while (pos1 != NPOS);
+	  while (pos1 != std::string:npos);
 
 	  if (nargin == 3 && i == maxrows)
 	    break;
--- a/src/DLD-FUNCTIONS/regexp.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/DLD-FUNCTIONS/regexp.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -204,11 +204,11 @@
       std::ostringstream buf;
       Array<int> named_idx;
 
-      while ((new_pos = pattern.find ("(?<",pos)) != NPOS)
+      while ((new_pos = pattern.find ("(?<",pos)) != std::string:npos)
 	{
 	  size_t tmp_pos = pattern.find_first_of ('>',new_pos);
 
-	  if (tmp_pos == NPOS)
+	  if (tmp_pos == std::string:npos)
 	    {
 	      error ("syntax error in pattern");
 	      break;
--- a/src/debug.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/debug.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -630,7 +630,7 @@
 
 		  size_t ind = arg.find (':');
 
-		  if (ind != NPOS)
+		  if (ind != std::string:npos)
 		    {
 		      std::string start_str = arg.substr (0, ind);
 		      std::string end_str = arg.substr (ind + 1);
@@ -662,7 +662,7 @@
 	      int end = 0;
 	      size_t ind = arg.find (':');
 
-	      if (ind != NPOS)
+	      if (ind != std::string:npos)
 		{
 		  std::string start_str = arg.substr (0, ind);
 		  std::string end_str = arg.substr (ind + 1);
--- a/src/error.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/error.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -1014,7 +1014,7 @@
 
       if (! error_state)
 	{
-	  if (arg1.find ('%') == NPOS)
+	  if (arg1.find ('%') == std::string:npos)
 	    {
 	      id = arg1;
 
@@ -1338,7 +1338,7 @@
 
 	  if (! error_state)
 	    {
-	      if (arg1.find ('%') == NPOS)
+	      if (arg1.find ('%') == std::string:npos)
 		{
 		  id = arg1;
 
--- a/src/file-io.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/file-io.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -150,7 +150,7 @@
 
       size_t pos = mode.find ('W');
 
-      if (pos != NPOS)
+      if (pos != std::string:npos)
 	{
 	  warning ("fopen: treating mode \"W\" as equivalent to \"w\"");
 	  mode[pos] = 'w';
@@ -158,7 +158,7 @@
 
       pos = mode.find ('R');
 
-      if (pos != NPOS)
+      if (pos != std::string:npos)
 	{
 	  warning ("fopen: treating mode \"R\" as equivalent to \"r\"");
 	  mode[pos] = 'r';
@@ -166,7 +166,7 @@
 
       pos = mode.find ('z');
 
-      if (pos != NPOS)
+      if (pos != std::string:npos)
 	{
 #if defined (HAVE_ZLIB)
 	  mode.erase (pos, 1);
@@ -444,13 +444,13 @@
 	      size_t bpos = tmode.find ('b');
 	      size_t tpos = tmode.find ('t');
 
-	      if (bpos == NPOS && tpos == NPOS)
+	      if (bpos == std::string:npos && tpos == std::string:npos)
 		tmode += 'b';
 
 #if defined (HAVE_ZLIB)
 	      size_t pos = tmode.find ('z');
 
-	      if (pos != NPOS)
+	      if (pos != std::string:npos)
 		{
 		  tmode.erase (pos, 1);
 
--- a/src/graphics.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/graphics.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -4576,7 +4576,7 @@
 		{
 		  size_t pos = file.find_last_of (file_ops::dir_sep_chars ());
 
-		  if (pos != NPOS)
+		  if (pos != std::string:npos)
 		    {
 		      file_stat fs (file.substr (0, pos));
 
--- a/src/help.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/help.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -743,12 +743,12 @@
 
   std::string t = msg.substr (0, p1);
 
-  if (p1 == NPOS)
+  if (p1 == std::string:npos)
     p1 = 0;
 
   size_t p2 = t.find ("-*- texinfo -*-");
 
-  return (p2 != NPOS);
+  return (p2 != std::string:npos);
 }
 
 void
@@ -855,7 +855,7 @@
 	{
 	  size_t new_pos = msg.find_first_of ('\n', pos);
 
-	  if (new_pos == NPOS)
+	  if (new_pos == std::string:npos)
 	    new_pos = msg_len-1;
 
 	  std::string line = msg.substr (pos, new_pos-pos+1);
@@ -1425,7 +1425,7 @@
 	  // Skip leading whitespace and get new line
 	  pos = h2.find_first_not_of ("\n\t ", pos);
 
-	  if (pos == NPOS)
+	  if (pos == std::string:npos)
 	    break;
 
 	  size_t new_pos = h2.find_first_of ('\n', pos);
@@ -1441,7 +1441,7 @@
 	  break;
 	}
 
-      if (pos == NPOS)
+      if (pos == std::string:npos)
 	return retval;
 
       // At start of real text. Get first line with the sentence
@@ -1449,14 +1449,14 @@
       std::string line = h2.substr (pos, new_pos-pos);
       size_t dot_pos;
 
-      while ((dot_pos = line.find_first_of ('.')) == NPOS)
+      while ((dot_pos = line.find_first_of ('.')) == std::string:npos)
 	{
 	  // Trim trailing blanks on line
 	  line.substr (0, line.find_last_not_of ("\n\t ") + 1);
 
 	  // Append next line
 	  size_t tmp_pos = h2.find_first_not_of ("\n\t ", new_pos + 1);
-	  if (tmp_pos == NPOS || h2.substr (tmp_pos, 1) == "\n")
+	  if (tmp_pos == std::string:npos || h2.substr (tmp_pos, 1) == "\n")
 	    break;
 
 	  new_pos = h2.find_first_of ('\n', tmp_pos);
@@ -1464,7 +1464,7 @@
 
 	  if (short_sentence)
 	    {
-	      if ((tmp_pos = next.find_first_of ('.')) != NPOS)
+	      if ((tmp_pos = next.find_first_of ('.')) != std::string:npos)
 		{
 		  line = line + " " + next;
 		  dot_pos = line.find_first_of ('.');
@@ -1475,7 +1475,7 @@
 	    line = line + " " + next;
 	}
 
-      if (dot_pos == NPOS)
+      if (dot_pos == std::string:npos)
 	retval = line;
       else
 	retval = line.substr (0, dot_pos + 1);
@@ -1493,7 +1493,7 @@
 	  // Skip leading whitespace and get new line
 	  pos = h.find_first_not_of ("\n\t ", pos);
 
-	  if (pos == NPOS)
+	  if (pos == std::string:npos)
 	    break;
 
 	  size_t new_pos = h.find_first_of ('\n', pos);
@@ -1507,7 +1507,7 @@
 	  if (lower.find_first_of ('-') == 0
 	      || lower.substr (0, 5) == "usage")
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1517,12 +1517,12 @@
 	  // chop " blah : "
 	  tmp_pos = line.find_first_not_of ("\t ", line.find_first_not_of 
 					     (_alphanum, line_pos));
-	  if (tmp_pos != NPOS && line.substr (tmp_pos, 1) == ":")
+	  if (tmp_pos != std::string:npos && line.substr (tmp_pos, 1) == ":")
 	    line_pos = line.find_first_not_of ("\t ", tmp_pos + 1);
 
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1530,9 +1530,9 @@
 	  if (lower.substr (line_pos, 8) == "function")
 	    line_pos =  line.find_first_not_of ("\t ", line_pos + 8);
 	  
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1542,13 +1542,13 @@
 	      tmp_pos = line.find_first_not_of 
 		("\t ", line.find_first_of ("]", line_pos) + 1);
 
-	      if (tmp_pos != NPOS && line.substr (tmp_pos, 1) == "=")
+	      if (tmp_pos != std::string:npos && line.substr (tmp_pos, 1) == "=")
 		line_pos = line.find_first_not_of ("\t ",tmp_pos + 1);
 	    }
 
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1557,11 +1557,11 @@
 	    {
 	      tmp_pos = line.find_first_not_of ("\t ", line.find_first_not_of 
 						(_alphanum, line_pos));
-	      if (tmp_pos != NPOS && line.substr (tmp_pos, 1) == "=")
+	      if (tmp_pos != std::string:npos && line.substr (tmp_pos, 1) == "=")
 		line_pos = line.find_first_not_of ("\t ", tmp_pos + 1);
 	    }
 
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
 	      pos = new_pos + 1;
 	      continue;
@@ -1572,14 +1572,14 @@
 	    {
 	      tmp_pos = line.find_first_not_of ("\t ", line.find_first_not_of 
 						(_alphanum, line_pos));
-	      if (tmp_pos != NPOS && line.substr (tmp_pos, 1) == "(")
+	      if (tmp_pos != std::string:npos && line.substr (tmp_pos, 1) == "(")
 		line_pos = line.find_first_not_of ("\t ", line.find_first_of 
 						   (")", tmp_pos) + 1);
 	    }
 
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1588,9 +1588,9 @@
 	      || line.substr (line_pos, 1) == ";")
 	    line_pos = line.find_first_not_of ("\t ", line_pos + 1);
 
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1601,16 +1601,16 @@
 	    line_pos = line.find_first_not_of ("\t ", line.find_first_not_of 
 			(_upper + "0123456789_", line_pos));
 
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
 	  // chop " blah --- "
 	  tmp_pos = line.find_first_not_of ("\t ", line.find_first_not_of 
 					     (_alphanum, line_pos));
-	  if (tmp_pos != NPOS && line.substr (tmp_pos, 1) == "-")
+	  if (tmp_pos != std::string:npos && line.substr (tmp_pos, 1) == "-")
 	    {
 	      tmp_pos = line.find_first_not_of ("-", tmp_pos);
 	      if (line.substr (tmp_pos, 1) == " "
@@ -1618,9 +1618,9 @@
 		line_pos = line.find_first_not_of ("\t ", tmp_pos);
 	    }
 
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1629,14 +1629,14 @@
 	    {
 	      tmp_pos = line.find_first_not_of (" ", line.find_first_not_of 
 						(_alphanum, line_pos));
-	      if (tmp_pos != NPOS && line.substr (tmp_pos, 1) == "\t")
+	      if (tmp_pos != std::string:npos && line.substr (tmp_pos, 1) == "\t")
 		line_pos = line.find_first_not_of ("\t ", line.find_first_of 
 						   (")", tmp_pos) + 1);
 	    }
 
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1645,7 +1645,7 @@
 	    {
 	      tmp_pos = line.find_first_not_of (_alphanum, line_pos);
 
-	      if (tmp_pos != NPOS
+	      if (tmp_pos != std::string:npos
 		  && (line.substr (tmp_pos, 2) == "\t\t"
 		      || line.substr (tmp_pos, 2) == "\t "
 		      || line.substr (tmp_pos, 2) == " \t"
@@ -1653,9 +1653,9 @@
 		line_pos = line.find_first_not_of ("\t ", tmp_pos);
 	    }
 
-	  if (line_pos == NPOS)
+	  if (line_pos == std::string:npos)
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1663,11 +1663,11 @@
 	  // skip blank line
 	  // skip "# !/usr/bin/octave"
 	  if ((line.substr (line_pos , 2) == "or"
-	       && line.find_first_not_of ("\n\t ", line_pos + 2) == NPOS)
-	      || line.find_first_not_of ("\n\t ", line_pos) == NPOS
+	       && line.find_first_not_of ("\n\t ", line_pos + 2) == std::string:npos)
+	      || line.find_first_not_of ("\n\t ", line_pos) == std::string:npos
 	      || line.substr (line_pos, 2) == "!/")
 	    {
-	      pos = (new_pos == NPOS ? NPOS : new_pos + 1);
+	      pos = (new_pos == std::string:npos ? std::string:npos : new_pos + 1);
 	      continue;
 	    }
 
@@ -1676,7 +1676,7 @@
 	  break;
 	}
 
-      if (pos == NPOS)
+      if (pos == std::string:npos)
 	return retval;
 
       // At start of real text. Get first line with the sentence
@@ -1684,14 +1684,14 @@
       std::string line = h.substr (pos, new_pos-pos);
       size_t dot_pos;
 
-      while ((dot_pos = line.find_first_of ('.')) == NPOS)
+      while ((dot_pos = line.find_first_of ('.')) == std::string:npos)
 	{
 	  // Trim trailing blanks on line
 	  line = line.substr (0, line.find_last_not_of ("\n\t ") + 1);
 
 	  // Append next line
 	  size_t tmp_pos = h.find_first_not_of ("\t ", new_pos + 1);
-	  if (tmp_pos == NPOS || h.substr (tmp_pos, 1) == "\n")
+	  if (tmp_pos == std::string:npos || h.substr (tmp_pos, 1) == "\n")
 	    break;
 
 	  new_pos = h.find_first_of ('\n', tmp_pos);
@@ -1700,7 +1700,7 @@
 	  if (short_sentence)
 	    {
 	      // Only add the next line if it terminates the sentence, then break
-	      if ((tmp_pos = next.find_first_of ('.')) != NPOS)
+	      if ((tmp_pos = next.find_first_of ('.')) != std::string:npos)
 		{
 		  line = line + " " + next;
 		  dot_pos = line.find_first_of ('.');
@@ -1711,7 +1711,7 @@
 	    line = line + " " + next;
 	}
 
-      if (dot_pos == NPOS)
+      if (dot_pos == std::string:npos)
 	retval = line;
       else
 	retval = line.substr (0, dot_pos + 1);
@@ -1750,9 +1750,9 @@
       size_t end_pos = new_pos;
 
       if (line.length () - pos < width)
-	new_pos = end_pos = NPOS;
+	new_pos = end_pos = std::string:npos;
       else
-	while (new_pos != NPOS && new_pos - pos < width)
+	while (new_pos != std::string:npos && new_pos - pos < width)
 	  {
 	    end_pos = new_pos;
 	    new_pos = line.find_first_of ("\n\t ", new_pos + 1);
@@ -1760,7 +1760,7 @@
 
       octave_stdout << line.substr (pos, end_pos-pos) << std::endl;
 		  
-      if (end_pos == NPOS)
+      if (end_pos == std::string:npos)
 	break;
 
       pos = end_pos + 1;
@@ -1849,7 +1849,7 @@
 	  std::string name = ptr->name;
 	  std::string h = ptr->help;
 
-	  if (name.find (txt) != NPOS)
+	  if (name.find (txt) != std::string:npos)
 	    {
 	      if (nargout)
 		{
@@ -1870,7 +1870,7 @@
 	      
 	      std::transform (s.begin (), s.end (), s.begin (), tolower);
 
-	      if (s.length () > 0 && s.find (txt) != NPOS)
+	      if (s.length () > 0 && s.find (txt) != std::string:npos)
 		{
 		  if (nargout)
 		    {
@@ -1893,7 +1893,7 @@
 	  std::string name = ptr->name;
 	  std::string h = ptr->help;
 
-	  if (name.find (txt) != NPOS)
+	  if (name.find (txt) != std::string:npos)
 	    {
 	      if (nargout)
 		{
@@ -1913,7 +1913,7 @@
 	      
 	      std::transform (s.begin (), s.end (), s.begin (), tolower);
 
-	      if (s.length () > 0 && s.find (txt) != NPOS)
+	      if (s.length () > 0 && s.find (txt) != std::string:npos)
 		{
 		  if (nargout)
 		    {
@@ -1948,7 +1948,7 @@
 	    {
 	      std::string h = sr->help ();
 
-	      if (name.find (txt) != NPOS)
+	      if (name.find (txt) != std::string:npos)
 		{
 		  if (nargout)
 		    {
@@ -1969,7 +1969,7 @@
 	      
 		  std::transform (s.begin (), s.end (), s.begin (), tolower);
 
-		  if (s.length () > 0 && s.find (txt) != NPOS)
+		  if (s.length () > 0 && s.find (txt) != std::string:npos)
 		    {
 		      if (nargout)
 			{
@@ -2041,7 +2041,7 @@
 			  else
 			    h = get_help_from_file (file_name, symbol_found);
 
-			  if (name.find (txt) != NPOS)
+			  if (name.find (txt) != std::string:npos)
 			    {
 			      if (nargout)
 				{
@@ -2061,7 +2061,7 @@
 
 			      std::transform (s.begin (), s.end (), s.begin (), tolower);
 
-			      if (s.length () > 0 && s.find (txt) != NPOS)
+			      if (s.length () > 0 && s.find (txt) != std::string:npos)
 				{
 				  if (nargout)
 				    {
@@ -2100,7 +2100,7 @@
 			      if (sr && sr->is_defined ())
 				h = sr->help ();
 
-			      if (aname.find (txt) != NPOS)
+			      if (aname.find (txt) != std::string:npos)
 				{
 				  if (nargout)
 				    {
@@ -2121,7 +2121,7 @@
 				  std::transform (s.begin (), s.end (), s.begin (), 
 					     tolower);
 
-				  if (s.length () > 0 && s.find (txt) != NPOS)
+				  if (s.length () > 0 && s.find (txt) != std::string:npos)
 				    {
 				      if (nargout)
 					{
--- a/src/input.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/input.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -272,7 +272,8 @@
 
       // There is no need to update the load_path cache if there is no
       // user input.
-      if (! retval.empty () && retval.find_first_not_of (" \t\n\r") != NPOS)
+      if (! retval.empty ()
+	  && retval.find_first_not_of (" \t\n\r") != std::string:npos)
 	load_path::update ();
     }
   else
--- a/src/lex.l	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/lex.l	Thu Aug 07 15:15:33 2008 -0400
@@ -1716,7 +1716,7 @@
 
   size_t pos = retval.find_first_of (" \t");
 
-  if (pos != NPOS)
+  if (pos != std::string:npos)
     retval.resize (pos);
 
   return retval;
--- a/src/load-path.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/load-path.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -130,7 +130,7 @@
 
 		  size_t pos = fname.rfind ('.');
 
-		  if (pos != NPOS)
+		  if (pos != std::string:npos)
 		    {
 		      std::string ext = fname.substr (pos);
 
@@ -178,7 +178,7 @@
 
 	  size_t pos = fname.rfind ('.');
 
-	  if (pos != NPOS)
+	  if (pos != std::string:npos)
 	    {
 	      base = fname.substr (0, pos);
 	      ext = fname.substr (pos);
@@ -306,7 +306,7 @@
 
       size_t pos = fname.rfind ('.');
 
-      if (pos != NPOS)
+      if (pos != std::string:npos)
 	{
 	  base = fname.substr (0, pos);
 	  ext = fname.substr (pos);
@@ -477,7 +477,7 @@
 
   size_t len = p.length ();
 
-  while (end != NPOS)
+  while (end != std::string:npos)
     {
       std::string elt = p.substr (beg, end-beg);
 
@@ -622,7 +622,7 @@
 
       size_t pos = fname.rfind ('.');
 
-      if (pos != NPOS)
+      if (pos != std::string:npos)
 	{
 	  base = fname.substr (0, pos);
 	  ext = fname.substr (pos);
@@ -1007,7 +1007,7 @@
 {
   std::string retval;
 
-  if (file.find_first_of (file_ops::dir_sep_chars ()) != NPOS)
+  if (file.find_first_of (file_ops::dir_sep_chars ()) != std::string:npos)
     {
       if (octave_env::absolute_pathname (file)
 	  || octave_env::rooted_relative_pathname (file))
@@ -1445,7 +1445,7 @@
 
       size_t pos = fname.rfind ('.');
 
-      if (pos != NPOS)
+      if (pos != std::string:npos)
 	{
 	  base = fname.substr (0, pos);
 	  ext = fname.substr (pos);
--- a/src/load-save.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/load-save.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -507,7 +507,8 @@
   size_t dot_pos = fname.rfind (".");
   size_t sep_pos = fname.find_last_of (file_ops::dir_sep_chars ());
     
-  if (dot_pos == NPOS || (sep_pos != NPOS && dot_pos < sep_pos))
+  if (dot_pos == std::string:npos
+      || (sep_pos != std::string:npos && dot_pos < sep_pos))
     {
       // Either no '.' in name or no '.' appears after last directory
       // separator.
--- a/src/ls-mat-ascii.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/ls-mat-ascii.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -130,26 +130,26 @@
       // CRLF pair as the line separator.  Any other CR in the text
       // will not be considered as whitespace.
 
-      if (beg != NPOS && buf[beg] == '\r' && beg == buf.length () - 1)
+      if (beg != std::string:npos && buf[beg] == '\r' && beg == buf.length () - 1)
 	{
 	  // We had a blank line ending with a CRLF.  Handle it the
 	  // same as an empty line.
-	  beg = NPOS;
+	  beg = std::string:npos;
 	}
 
       octave_idx_type tmp_nc = 0;
 
-      while (beg != NPOS)
+      while (beg != std::string:npos)
 	{
 	  tmp_nc++;
 
 	  size_t end = buf.find_first_of (", \t", beg);
 
-	  if (end != NPOS)
+	  if (end != std::string:npos)
 	    {
 	      beg = buf.find_first_not_of (", \t", end);
 
-	      if (beg == NPOS || (buf[beg] == '\r' && 
+	      if (beg == std::string:npos || (buf[beg] == '\r' && 
 				  beg == buf.length () - 1))
 		{
 		  // We had a line with trailing spaces and
@@ -205,14 +205,14 @@
 
   size_t pos = filename.rfind ('/');
 
-  if (pos != NPOS)
+  if (pos != std::string:npos)
     varname = filename.substr (pos+1);
   else
     varname = filename;
 
   pos = varname.rfind ('.');
 
-  if (pos != NPOS)
+  if (pos != std::string:npos)
     varname = varname.substr (0, pos);
 
   size_t len = varname.length ();
--- a/src/ls-oct-ascii.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/ls-oct-ascii.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -276,7 +276,7 @@
       std::string typ;
       size_t pos = tag.rfind (' ');
 
-      if (pos != NPOS)
+      if (pos != std::string:npos)
 	{
 	  global = SUBSTRING_COMPARE_EQ (tag, 0, 6, "global");
 
--- a/src/oct-stream.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/oct-stream.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -1558,14 +1558,14 @@
         { \
 	  int chars_read = 0; \
 	  while (is && chars_read++ < width && (c = is.get ()) != EOF \
-	         && char_class.find (c) != NPOS) \
+	         && char_class.find (c) != std::string:npos) \
 	    buf << static_cast<char> (c); \
 	} \
       else \
 	{ \
 	  int chars_read = 0; \
 	  while (is && chars_read++ < width && (c = is.get ()) != EOF \
-	         && char_class.find (c) == NPOS) \
+	         && char_class.find (c) == std::string:npos) \
 	    buf << static_cast<char> (c); \
 	} \
  \
@@ -2602,7 +2602,7 @@
 			  tfmt.replace ((i1 = tfmt.rfind (elt->type)),
 					1, 1, 's');
 
-			  if ((i2 = tfmt.rfind ('.')) != NPOS && i2 < i1)
+			  if ((i2 = tfmt.rfind ('.')) != std::string:npos && i2 < i1)
 			    {
 			      tfmt.erase (i2, i1-i2);
 			      if (elt->prec < 0)
--- a/src/octave.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/octave.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -446,7 +446,7 @@
 
   size_t pos = curr_fcn_file_name.find_last_of (file_ops::dir_sep_chars ());
   
-  std::string tmp = (pos != NPOS)
+  std::string tmp = (pos != std::string:npos)
     ? curr_fcn_file_name.substr (pos+1) : curr_fcn_file_name;
 
   octave_program_name = tmp;
--- a/src/ov-fcn-handle.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/ov-fcn-handle.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -563,7 +563,7 @@
       std::string octaveroot;
       std::string fpath;
 
-      if (nm.find_first_of ("\n") != NPOS)
+      if (nm.find_first_of ("\n") != std::string:npos)
 	{
 	  size_t pos1 = nm.find_first_of ("\n");
 	  size_t pos2 = nm.find_first_of ("\n", pos1 + 1);
--- a/src/parse.y	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/parse.y	Thu Aug 07 15:15:33 2008 -0400
@@ -2486,7 +2486,7 @@
 
 	  size_t pos = nm.find_last_of (file_ops::dir_sep_chars ());
 
-	  if (pos != NPOS)
+	  if (pos != std::string:npos)
 	    nm = curr_fcn_file_name.substr (pos+1);
 
 	  if (nm != id_name)
@@ -3518,14 +3518,14 @@
       size_t epos = fname.rfind ('.');
 
       if (epos <= dpos)
-        epos = NPOS;
-
-      fname = (epos != NPOS) ? fname.substr (0, epos) : fname;
+        epos = std::string:npos;
+
+      fname = (epos != std::string:npos) ? fname.substr (0, epos) : fname;
 
       if (arg == "fullpath")
 	retval = fname;
       else
-        retval = (dpos != NPOS) ? fname.substr (dpos+1) : fname;
+        retval = (dpos != std::string:npos) ? fname.substr (dpos+1) : fname;
     }
 
   return retval;
--- a/src/pr-output.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/pr-output.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -2802,7 +2802,7 @@
 		{
 		  size_t m = s.find ('\n',  n);
 
-		  if (m == NPOS)
+		  if (m == std::string:npos)
 		    {
 		      lst.push_back (s.substr (n));
 		      break;
--- a/src/symtab.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/symtab.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -909,7 +909,7 @@
   octave_value retval;
   size_t pos = name.find_first_of (Vfilemarker);
 
-  if (pos == NPOS)
+  if (pos == std::string:npos)
     retval = find (name, args, arg_names, evaluated_args, args_evaluated, true);
   else
     {
--- a/src/sysdep.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/sysdep.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -138,7 +138,7 @@
     {
       size_t pos = bin_dir.rfind ("\\bin\\");
 
-      if (pos != NPOS)
+      if (pos != std::string:npos)
 	octave_env::putenv ("OCTAVE_HOME", bin_dir.substr (0, pos));
     }
 }
--- a/src/utils.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/utils.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -438,7 +438,7 @@
 	{
 	  std::string fname = name;
 	  size_t pos = name.find_first_of (Vfilemarker);
-	  if (pos != NPOS)
+	  if (pos != std::string:npos)
 	    fname = name.substr (0, pos);
 
 	  retval = load_path::find_fcn_file (fname);
--- a/src/variables.cc	Thu Aug 07 14:53:38 2008 -0400
+++ b/src/variables.cc	Thu Aug 07 15:15:33 2008 -0400
@@ -468,7 +468,7 @@
 
   size_t len = text.length ();
 
-  while ((pos = text.find ('.', pos)) != NPOS)
+  while ((pos = text.find ('.', pos)) != std::string:npos)
     {
       if (++pos == len)
 	break;
@@ -484,12 +484,12 @@
     {
       len = text.find ('.', pos);
 
-      if (len != NPOS)
+      if (len != std::string:npos)
 	len -= pos;
 
       retval[i] = text.substr (pos, len);
 
-      if (len != NPOS)
+      if (len != std::string:npos)
 	pos += len + 1;
     }
 
@@ -519,7 +519,7 @@
 
   size_t pos = text.rfind ('.');
 
-  if (pos != NPOS)
+  if (pos != std::string:npos)
     {
       if (pos == text.length ())
 	hint = "";
@@ -532,7 +532,7 @@
 
       pos = base_name.find_first_of ("{(.");
 
-      if (pos != NPOS)
+      if (pos != std::string:npos)
 	base_name = base_name.substr (0, pos);
 
       if (is_variable (base_name))
@@ -570,9 +570,9 @@
 {
   bool retval = (! text.empty ()
 		 && text != "."
-		 && text.find_first_of (file_ops::dir_sep_chars ()) == NPOS
-		 && text.find ("..") == NPOS
-		 && text.rfind ('.') != NPOS);
+		 && text.find_first_of (file_ops::dir_sep_chars ()) == std::string:npos
+		 && text.find ("..") == std::string:npos
+		 && text.rfind ('.') != std::string:npos);
 
 #if 0
   symbol_record *sr = curr_sym_tab->lookup (text);
@@ -660,7 +660,7 @@
 
   size_t pos = name.find ('.');
 
-  if (pos != NPOS && pos > 0)
+  if (pos != std::string:npos && pos > 0)
     {
       struct_elts = name.substr (pos+1);
       symbol_name = name.substr (0, pos);
@@ -1493,7 +1493,7 @@
 	    // Parse one command from whos_line_format
 	    cmd = Vwhos_line_format.substr (idx, Vwhos_line_format.length ());
 	    pos = cmd.find (';');
-	    if (pos != NPOS)
+	    if (pos != std::string:npos)
 	      cmd = cmd.substr (0, pos+1);
 	    else
 	      error ("parameter without ; in whos_line_format");
@@ -1519,7 +1519,7 @@
 	    // Insert data into parameter
 	    param.first_parameter_length = 0;
 	    pos = param_string.find (param.command);
-	    if (pos != NPOS)
+	    if (pos != std::string:npos)
 	      {
 		param.parameter_length = param_length(pos);
 		param.text = param_names(pos);
@@ -1610,7 +1610,7 @@
 	    size_t pos;
 	    text = Vwhos_line_format.substr (idx, Vwhos_line_format.length ());
 	    pos = text.find ('%');
-	    if (pos != NPOS)
+	    if (pos != std::string:npos)
 	      text = text.substr (0, pos);
 
 	    // Push parameter into list ...
@@ -1696,7 +1696,7 @@
 	{
 	  size_t pos = pat.find_first_of (".({");
 
-	  if (pos != NPOS && pos > 0)
+	  if (pos != std::string:npos && pos > 0)
 	    {
 	      if (verbose)
 		{