annotate libinterp/corefcn/ls-oct-text.h @ 23455:73ff72d3d603

maint: Eliminate <cfloat.h> header from libinterp files * __contourc__.cc, __qp__.cc, data.cc, graphics.cc, load-save.cc, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.h, mappers.cc, mex.cc, pr-output.cc, sysdep.cc, variables.h, xnorm.cc, __glpk__.cc: Remove "#include <cfloat>". Add "#include <limits>" if necessary. Remove redundant #includes. Alphabetize #includes.
author Rik <rik@octave.org>
date Fri, 28 Apr 2017 11:38:39 -0700
parents 53f5f8231c37
children a41fdb801db6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1 /*
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 2003-2017 John W. Eaton
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
4
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
6
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 GNU General Public License for more details.
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
16
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
19 <http://www.gnu.org/licenses/>.
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
20
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
21 */
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20447
diff changeset
23 #if ! defined (octave_ls_oct_text_h)
20447
c6224b4e7774 maint: Rename instances of LS_ASCII to LS_TEXT for clarity.
Rik <rik@octave.org>
parents: 20232
diff changeset
24 #define octave_ls_oct_text_h 1
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
27
23455
73ff72d3d603 maint: Eliminate <cfloat.h> header from libinterp files
Rik <rik@octave.org>
parents: 23442
diff changeset
28 #include <limits>
5765
7ba9ad1fec11 [project @ 2006-04-17 05:05:15 by jwe]
jwe
parents: 5754
diff changeset
29 #include <sstream>
5099
f7e39f977fe8 [project @ 2004-12-24 19:06:01 by jwe]
jwe
parents: 4687
diff changeset
30 #include <string>
f7e39f977fe8 [project @ 2004-12-24 19:06:01 by jwe]
jwe
parents: 4687
diff changeset
31
f7e39f977fe8 [project @ 2004-12-24 19:06:01 by jwe]
jwe
parents: 4687
diff changeset
32 #include "str-vec.h"
f7e39f977fe8 [project @ 2004-12-24 19:06:01 by jwe]
jwe
parents: 4687
diff changeset
33
8946
e7e928088e90 fix CRLF issues with text-mode reading in windows when loading ascii data
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents: 8920
diff changeset
34 #include "ls-ascii-helper.h"
e7e928088e90 fix CRLF issues with text-mode reading in windows when loading ascii data
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents: 8920
diff changeset
35
23442
53f5f8231c37 allow most header files to be compiled separately
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
36 class octave_value;
53f5f8231c37 allow most header files to be compiled separately
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
37
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4634
diff changeset
38 // Flag for cell elements
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4634
diff changeset
39 #define CELL_ELT_TAG "<cell-element>"
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4634
diff changeset
40
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4634
diff changeset
41 // Used when converting Inf to something that gnuplot can read.
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4634
diff changeset
42
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
43 #if ! defined (OCT_RBV)
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21139
diff changeset
44 # define OCT_RBV (std::numeric_limits<double>::max () / 100.0)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4634
diff changeset
45 #endif
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4634
diff changeset
46
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5958
diff changeset
47 extern OCTINTERP_API std::string
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
48 extract_keyword (std::istream& is, const char *keyword,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
49 const bool next_only = false);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4634
diff changeset
50
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5958
diff changeset
51 extern OCTINTERP_API std::string
20447
c6224b4e7774 maint: Rename instances of LS_ASCII to LS_TEXT for clarity.
Rik <rik@octave.org>
parents: 20232
diff changeset
52 read_text_data (std::istream& is, const std::string& filename, bool& global,
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
53 octave_value& tc, octave_idx_type count);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
54
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5958
diff changeset
55 extern OCTINTERP_API bool
20447
c6224b4e7774 maint: Rename instances of LS_ASCII to LS_TEXT for clarity.
Rik <rik@octave.org>
parents: 20232
diff changeset
56 save_text_data (std::ostream& os, const octave_value& val_arg,
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
57 const std::string& name, bool mark_as_global, int precision);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
58
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5958
diff changeset
59 extern OCTINTERP_API bool
20447
c6224b4e7774 maint: Rename instances of LS_ASCII to LS_TEXT for clarity.
Rik <rik@octave.org>
parents: 20232
diff changeset
60 save_text_data_for_plotting (std::ostream& os, const octave_value& t,
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
61 const std::string& name);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
62
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5958
diff changeset
63 extern OCTINTERP_API bool
5958
85c7dc4afe6b [project @ 2006-08-23 18:35:38 by jwe]
jwe
parents: 5956
diff changeset
64 save_three_d (std::ostream& os, const octave_value& t,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
65 bool parametric = false);
5958
85c7dc4afe6b [project @ 2006-08-23 18:35:38 by jwe]
jwe
parents: 5956
diff changeset
66
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
67 // Match KEYWORD on stream IS, placing the associated value in VALUE,
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
68 // returning TRUE if successful and FALSE otherwise.
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
69 //
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
70 // Input should look something like:
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
71 //
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
72 // [%#][ \t]*keyword[ \t]*int-value.*\n
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
73
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21021
diff changeset
74 template <typename T>
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
75 bool
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
76 extract_keyword (std::istream& is, const char *keyword, T& value,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
77 const bool next_only = false)
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
78 {
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
79 bool status = false;
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
80 value = T ();
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
81
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
82 char c;
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
83 while (is.get (c))
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
84 {
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
85 if (c == '%' || c == '#')
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
86 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
87 std::ostringstream buf;
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
88
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
89 while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#'))
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
90 ; // Skip whitespace and comment characters.
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
91
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
92 if (isalpha (c))
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
93 buf << c;
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
94
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
95 while (is.get (c) && isalpha (c))
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
96 buf << c;
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
97
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
98 std::string tmp = buf.str ();
21021
a5b99b09f8fd maint: Use comparison operators rather than compare() for strings.
Rik <rik@octave.org>
parents: 20791
diff changeset
99 bool match = (tmp.substr (0, strlen (keyword)) == keyword);
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
100
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
101 if (match)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
102 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
103 while (is.get (c) && (c == ' ' || c == '\t' || c == ':'))
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
104 ; // Skip whitespace and the colon.
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
105
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
106 is.putback (c);
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
107 if (c != '\n' && c != '\r')
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
108 is >> value;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
109 if (is)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
110 status = true;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
111 skip_until_newline (is, false);
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
112 break;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
113 }
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
114 else if (next_only)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
115 break;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
116 }
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
117 }
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
118 return status;
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
119 }
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
120
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21021
diff changeset
121 template <typename T>
9852
aabf7a8c2e57 implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 8946
diff changeset
122 bool
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
123 extract_keyword (std::istream& is, const std::string& kw, T& value,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
124 const bool next_only = false)
9852
aabf7a8c2e57 implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 8946
diff changeset
125 {
aabf7a8c2e57 implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 8946
diff changeset
126 return extract_keyword (is, kw.c_str (), value, next_only);
aabf7a8c2e57 implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 8946
diff changeset
127 }
aabf7a8c2e57 implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 8946
diff changeset
128
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
129 // Match one of the elements in KEYWORDS on stream IS, placing the
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
130 // matched keyword in KW and the associated value in VALUE,
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
131 // returning TRUE if successful and FALSE otherwise.
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
132 //
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
133 // Input should look something like:
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
134 //
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
135 // [%#][ \t]*keyword[ \t]*int-value.*\n
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
136
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21021
diff changeset
137 template <typename T>
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
138 bool
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
139 extract_keyword (std::istream& is, const string_vector& keywords,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
140 std::string& kw, T& value, const bool next_only = false)
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
141 {
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
142 bool status = false;
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
143 kw = "";
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
144 value = 0;
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
145
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
146 char c;
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
147 while (is.get (c))
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
148 {
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
149 if (c == '%' || c == '#')
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
150 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
151 std::ostringstream buf;
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
152
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
153 while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#'))
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
154 ; // Skip whitespace and comment characters.
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
155
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
156 if (isalpha (c))
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
157 buf << c;
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
158
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
159 while (is.get (c) && isalpha (c))
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
160 buf << c;
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
161
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
162 std::string tmp = buf.str ();
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
163
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
164 for (int i = 0; i < keywords.numel (); i++)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
165 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
166 int match = (tmp == keywords[i]);
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
167
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
168 if (match)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
169 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
170 kw = keywords[i];
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
171
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
172 while (is.get (c) && (c == ' ' || c == '\t' || c == ':'))
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
173 ; // Skip whitespace and the colon.
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
174
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
175 is.putback (c);
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
176 if (c != '\n' && c != '\r')
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
177 is >> value;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
178 if (is)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
179 status = true;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
180 skip_until_newline (is, false);
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
181 return status;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
182 }
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
183 }
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
184
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
185 if (next_only)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
186 break;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
187 }
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
188 }
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
189 return status;
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
190 }
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5099
diff changeset
191
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
192 #endif