LTP GCOV extension - code coverage report
Current view: directory - src/libutil - aterm.cc
Test: app.info
Date: 2006-10-11 Instrumented lines: 19
Code covered: 57.9 % Executed lines: 11

       1                 : #include "aterm.hh"
       2                 : 
       3                 : using std::string;
       4                 : 
       5                 : 
       6                 : string nix::atPrint(ATerm t)
       7             290 : {
       8             290 :     if (!t) throw Error("attempt to print null aterm");
       9             290 :     char * s = ATwriteToString(t);
      10             290 :     if (!s) throw Error("cannot print term");
      11             290 :     return s;
      12                 : }
      13                 : 
      14                 : 
      15                 : std::ostream & operator << (std::ostream & stream, ATerm e)
      16              29 : {
      17              29 :     return stream << nix::atPrint(e);
      18                 : }
      19                 : 
      20                 : 
      21                 : nix::Error nix::badTerm(const format & f, ATerm t)
      22               0 : {
      23               0 :     char * s = ATwriteToString(t);
      24               0 :     if (!s) throw Error("cannot print term");
      25               0 :     if (strlen(s) > 1000) {
      26               0 :         int len;
      27               0 :         s = ATwriteToSharedString(t, &len);
      28               0 :         if (!s) throw Error("cannot print term");
      29                 :     }
      30               0 :     return Error(format("%1%, in `%2%'") % f.str() % (string) s);
      31                 : }
      32                 : 
      33                 : 
      34                 : ATerm nix::toATerm(const char * s)
      35           15122 : {
      36           15122 :     return (ATerm) ATmakeAppl0(ATmakeAFun((char *) s, 0, ATtrue));
      37                 : }
      38                 : 
      39                 : 
      40                 : ATerm nix::toATerm(const string & s)
      41           11578 : {
      42           11578 :     return toATerm(s.c_str());
      43                 : }

Generated by: LTP GCOV extension version 1.1