source file of the Flower Library
- (c) '95, '96, '97 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) '95, '96, '97 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <fstream.h>
char c;
while ((c=data_get()) == ' ' ||c == '\t')
- if (eof())
- break;
+ if (eof_b())
+ return;
data_unget (c);
}
while (1)
{
char c = data_get();
+
+ if (eof_b ())
+ break;
- if (isspace (c) || eof())
+ if (isspace (c))
{
data_unget (c);
break;
rawmode= true;
while ((c = data_get()) != '\"')
- if (eof())
- error (_("EOF in a string"));
+ if (eof_b ())
+ error (_ ("EOF in a string"));
else
- s += c;
+ s += to_str (c);
rawmode= false;
}
else
- s += c;
+ s += to_str (c);
}
return s;
Only class member who uses text_file::get
*/
char
-Data_file::data_get() {
+Data_file::data_get()
+{
char c = get();
if (!rawmode && c == '#') // gobble comment
{
- while ((c = get()) != '\n' && !eof ())
+ while (!eof_b () && (c = get()) != '\n')
;
return '\n';
}
}
/// read line, gobble '\n'
-String Data_file::get_line()
+String
+Data_file::get_line()
{
char c;
String s;
- while ((c = data_get()) != '\n' && !eof ())
- s += c;
+ while (!eof_b () && (c = data_get()) != '\n')
+ s += to_str (c);
return s;
}
Data_file::gobble_leading_white()
{
// eat blank lines.
- while (!eof())
+ while (!eof_b ())
{
char c = data_get();
if (!isspace (c))
}
}
}
+
+Data_file::Data_file (String s)
+ : Text_stream (s)
+{
+ //*mlog << "(" << s << flush;
+ rawmode= false;
+}
+
+void
+Data_file::warning (String s)
+{
+ message (_ ("warning: ") + s);
+}
+
+void
+Data_file::error (String s)
+{
+ message (s);
+ exit (1);
+}
+
+String
+Data_file::gulp ()
+{
+ String s;
+
+ while (!eof_b ())
+ {
+ s += to_str (data_get ());
+ }
+ return s;
+}
+
+
+Data_file::~Data_file ()
+{
+}