Mercurial > octave
diff src/ls-oct-ascii.cc @ 5103:e2ed74b9bfa0 after-gnuplot-split
[project @ 2004-12-28 02:43:01 by jwe]
author | jwe |
---|---|
date | Tue, 28 Dec 2004 02:43:01 +0000 |
parents | 5a92c3177fc6 |
children | 23b37da9fd5b |
line wrap: on
line diff
--- a/src/ls-oct-ascii.cc Tue Dec 28 01:59:05 2004 +0000 +++ b/src/ls-oct-ascii.cc Tue Dec 28 02:43:01 2004 +0000 @@ -299,71 +299,6 @@ return status; } -// Match one of the elements in KEYWORDS on stream IS, placing the -// matched keyword in KW and the associated value in VALUE, -// returning TRUE if successful and FALSE otherwise. -// -// Input should look something like: -// -// [%#][ \t]*keyword[ \t]*int-value.*\n - -bool -extract_keyword (std::istream& is, const string_vector& keywords, - std::string& kw, int& value, const bool next_only) -{ - bool status = false; - kw = ""; - value = 0; - - char c; - while (is.get (c)) - { - if (c == '%' || c == '#') - { - OSSTREAM buf; - - while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#')) - ; // Skip whitespace and comment characters. - - if (isalpha (c)) - buf << c; - - while (is.get (c) && isalpha (c)) - buf << c; - - buf << OSSTREAM_ENDS; - std::string tmp = OSSTREAM_STR (buf); - OSSTREAM_FREEZE (buf); - - for (int i = 0; i < keywords.length (); i++) - { - int match = (tmp == keywords[i]); - - if (match) - { - kw = keywords[i]; - - while (is.get (c) && (c == ' ' || c == '\t' || c == ':')) - ; // Skip whitespace and the colon. - - is.putback (c); - if (c != '\n') - is >> value; - if (is) - status = true; - while (is.get (c) && c != '\n') - ; // Skip to beginning of next line; - return status; - } - } - - if (next_only) - break; - } - } - return status; -} - // Extract one value (scalar, matrix, string, etc.) from stream IS and // place it in TC, returning the name of the variable. If the value // is tagged as global in the file, return TRUE in GLOBAL.