diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-18 11:22:29 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-18 11:22:29 +0000 |
commit | ce92d1bf1434562f5b80320c503768c4d06f1f8d (patch) | |
tree | 477c80de94f3c403115f80bad450003946af2889 /src/libutil/aterm.cc | |
parent | 9f0f020929c9e093405cc6193d2f227cab763912 (diff) |
* "Nix expression" -> "store expression".
* More refactoring.
Diffstat (limited to 'src/libutil/aterm.cc')
-rw-r--r-- | src/libutil/aterm.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libutil/aterm.cc b/src/libutil/aterm.cc index de7c35952..dc6abf9e7 100644 --- a/src/libutil/aterm.cc +++ b/src/libutil/aterm.cc @@ -91,3 +91,16 @@ ATMatcher & operator >> (ATMatcher & pos, ATermList & out) out = (ATermList) t; return pos; } + + +Error badTerm(const format & f, ATerm t) +{ + char * s = ATwriteToString(t); + if (!s) throw Error("cannot print term"); + if (strlen(s) > 1000) { + int len; + s = ATwriteToSharedString(t, &len); + if (!s) throw Error("cannot print term"); + } + return Error(format("%1%, in `%2%'") % f.str() % (string) s); +} |