summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-04-12 01:40:49 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-05-08 02:50:19 -0400
commitb45037e334ca336498217d4f54756c319c074d7b (patch)
treed0f8338df6c8adf86debcdcf236a25bbdd8d305b /util.h
parent289cc97d45bbd3a8cdfcc3371ade71715b75b000 (diff)
downloadfork-ledger-b45037e334ca336498217d4f54756c319c074d7b.tar.gz
fork-ledger-b45037e334ca336498217d4f54756c319c074d7b.tar.bz2
fork-ledger-b45037e334ca336498217d4f54756c319c074d7b.zip
Migrated over both code and build environment from was-v3.0 branch.
Diffstat (limited to 'util.h')
-rw-r--r--util.h62
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