Prettyprint to a string

From Verific Design Automation FAQ
Revision as of 13:09, 28 February 2019 by Hoa (Talk | contribs)

Jump to: navigation, search

Q: How do I prettyprint a Verilog parsetree node to a string?

Simple APIs:

   VeriTreeNode::GetPrettyPrintedString()
   VhdlTreeNode::GetPrettyPrintedString()


This example code is included here for historical reason:

       VeriExpression *init_value = param_id -> GetInitialValue();
       if (init_value) {
           ostringstream os;
           init_value->PrettyPrint(os, 0);
           char *to_string = Strings::save(os.str().c_str()) ;
           cout << "*** initial value: " << to_string << " ***\n";
           Strings::free(to_string);
       }