diff options
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/util.h b/util.h deleted file mode 100644 index 21008a22..00000000 --- a/util.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef _UTIL_H -#define _UTIL_H - -#include <iostream> - -#if defined __FreeBSD__ && __FreeBSD__ <=4 -// FreeBSD has a broken isspace macro, so dont use it -#undef isspace(c) -#endif - -#if defined(__GNUG__) && __GNUG__ < 3 -namespace std { - inline ostream & right (ostream & i) { - i.setf(i.right, i.adjustfield); - return i; - } - inline ostream & left (ostream & i) { - i.setf(i.left, i.adjustfield); - return i; - } -} -typedef unsigned long istream_pos_type; -typedef unsigned long ostream_pos_type; -#else -typedef std::istream::pos_type istream_pos_type; -typedef std::ostream::pos_type ostream_pos_type; -#endif - -inline char * skip_ws(char * ptr) { - while (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') - ptr++; - return ptr; -} - -inline char peek_next_nonws(std::istream& in) { - char c = in.peek(); - while (! in.eof() && std::isspace(c)) { - in.get(c); - c = in.peek(); - } - return c; -} - -#define READ_INTO(str, targ, size, var, cond) { \ - char * _p = targ; \ - var = str.peek(); \ - while (! str.eof() && var != '\n' && (cond) && _p - targ < size) { \ - str.get(var); \ - if (str.eof()) \ - break; \ - if (var == '\\') { \ - str.get(var); \ - if (in.eof()) \ - break; \ - } \ - *_p++ = var; \ - var = str.peek(); \ - } \ - *_p = '\0'; \ -} - -#endif // _UTIL_H |