mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 06:52:43 +01:00
* Use a proper namespace.
* Optimise header file usage a bit. * Compile the parser as C++.
This commit is contained in:
parent
aab8812732
commit
75068e7d75
61 changed files with 650 additions and 268 deletions
|
|
@ -1,7 +1,9 @@
|
|||
#include "aterm.hh"
|
||||
|
||||
using std::string;
|
||||
|
||||
string atPrint(ATerm t)
|
||||
|
||||
string nix::atPrint(ATerm t)
|
||||
{
|
||||
if (!t) throw Error("attempt to print null aterm");
|
||||
char * s = ATwriteToString(t);
|
||||
|
|
@ -10,13 +12,13 @@ string atPrint(ATerm t)
|
|||
}
|
||||
|
||||
|
||||
ostream & operator << (ostream & stream, ATerm e)
|
||||
std::ostream & operator << (std::ostream & stream, ATerm e)
|
||||
{
|
||||
return stream << atPrint(e);
|
||||
return stream << nix::atPrint(e);
|
||||
}
|
||||
|
||||
|
||||
Error badTerm(const format & f, ATerm t)
|
||||
nix::Error nix::badTerm(const format & f, ATerm t)
|
||||
{
|
||||
char * s = ATwriteToString(t);
|
||||
if (!s) throw Error("cannot print term");
|
||||
|
|
@ -29,13 +31,13 @@ Error badTerm(const format & f, ATerm t)
|
|||
}
|
||||
|
||||
|
||||
ATerm toATerm(const char * s)
|
||||
ATerm nix::toATerm(const char * s)
|
||||
{
|
||||
return (ATerm) ATmakeAppl0(ATmakeAFun((char *) s, 0, ATtrue));
|
||||
}
|
||||
|
||||
|
||||
ATerm toATerm(const string & s)
|
||||
ATerm nix::toATerm(const string & s)
|
||||
{
|
||||
return toATerm(s.c_str());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue