1 : #ifndef __ATERM_H
2 : #define __ATERM_H
3 :
4 : extern "C" {
5 : #include <aterm2.h>
6 : }
7 :
8 : #include "util.hh"
9 :
10 :
11 : /* Print an ATerm. */
12 : string atPrint(ATerm t);
13 :
14 : /* Write an ATerm to an output stream. */
15 : ostream & operator << (ostream & stream, ATerm e);
16 :
17 : class ATermIterator
18 : {
19 : ATermList t;
20 :
21 : public:
22 2528 : ATermIterator(ATermList _t) : t(_t) { }
23 : ATermIterator & operator ++ ()
24 2705 : {
25 2705 : t = ATgetNext(t);
26 2705 : return *this;
27 : }
28 : ATerm operator * ()
29 3954 : {
30 3954 : return ATgetFirst(t);
31 : }
32 : operator bool ()
33 3969 : {
34 3969 : return t != ATempty;
35 : }
36 : };
37 :
38 :
39 : /* Throw an exception with an error message containing the given
40 : aterm. */
41 : Error badTerm(const format & f, ATerm t);
42 :
43 :
44 : /* Convert strings to ATerms. */
45 : ATerm toATerm(const char * s);
46 : ATerm toATerm(const string & s);
47 :
48 :
49 : #endif /* !__ATERM_H */
|