#include "prettyprint.hh"
#include "funcdata.hh"
const char *EmitXml::highlight[] = { "color=\"keyword\"",
"color=\"comment\"",
"color=\"type\"",
"color=\"funcname\"",
"color=\"var\"",
"color=\"const\"",
"color=\"param\"",
"color=\"global\"",
"" };
int4 EmitXml::beginDocument(void) {
*s << "<clang_document " << highlight[(int4)no_color] << '>';
return 0;
}
void EmitXml::endDocument(int4 id) {
*s << "</clang_document>";
}
int4 EmitXml::beginFunction(const Funcdata *fd) {
*s << "<function " << highlight[(int4)no_color];
*s << '>';
return 0;
}
void EmitXml::endFunction(int4 id) {
*s << "</function>";
}
int4 EmitXml::beginBlock(const FlowBlock *bl) {
*s << "<block " << highlight[(int4)no_color] << " blockref=\"0x" << hex <<
bl->getIndex() << "\">";
return 0;
}
void EmitXml::endBlock(int4 id) {
*s << "</block>";
}
void EmitXml::tagLine(void) {
emitPending();
*s << "<break " << highlight[(int4)no_color] << " indent=\"0x" << hex <<
indentlevel << "\"/>";
}
void EmitXml::tagLine(int4 indent) {
emitPending();
*s << "<break " << highlight[(int4)no_color] << " indent=\"0x" << hex <<
indent << "\"/>";
}
int4 EmitXml::beginReturnType(const Varnode *vn) {
*s << "<return_type " << highlight[(int4)no_color];
if (vn != (const Varnode *)0)
*s << " varref=\"0x" << hex << vn->getCreateIndex() << "\">";
else
*s << '>';
return 0;
}
void EmitXml::endReturnType(int4 id) {
*s << "</return_type>";
}
int4 EmitXml::beginVarDecl(const Symbol *sym) {
*s << "<vardecl " << highlight[(int4)no_color];
*s << " symref=\"0x" << hex << sym->getId() << "\">";
return 0;
}
void EmitXml::endVarDecl(int4 id) {
*s << "</vardecl>";
}
int4 EmitXml::beginStatement(const PcodeOp *op) {
*s << "<statement " << highlight[(int4)no_color];
if (op != (const PcodeOp *)0)
*s << " opref=\"0x" << hex << op->getTime() << "\">";
else
*s << '>';
return 0;
}
void EmitXml::endStatement(int4 id) {
*s << "</statement>";
}
int4 EmitXml::beginFuncProto(void) {
*s << "<funcproto " << highlight[(int4)no_color] << '>';
return 0;
}
void EmitXml::endFuncProto(int4 id) {
*s << "</funcproto>";
}
void EmitXml::tagVariable(const char *ptr,syntax_highlight hl,
const Varnode *vn,const PcodeOp *op)
{
*s << "<variable " << highlight[(int4)hl];
if (vn != (const Varnode *)0)
*s << " varref=\"0x" << hex << vn->getCreateIndex() << '\"';
if (op != (const PcodeOp *)0)
*s << " opref=\"0x" << hex << op->getTime() << '\"';
*s << '>';
xml_escape(*s,ptr);
*s << "</variable>";
}
void EmitXml::tagOp(const char *ptr,syntax_highlight hl,
const PcodeOp *op)
{
*s << "<op " << highlight[(int4)hl];
if (op != (const PcodeOp *)0)
*s << " opref=\"0x" << hex << op->getTime() << "\">";
else
*s << '>';
xml_escape(*s,ptr);
*s << "</op>";
}
void EmitXml::tagFuncName(const char *ptr,syntax_highlight hl,
const Funcdata *fd,const PcodeOp *op)
{
*s << "<funcname " << highlight[(int4)hl];
if (op != (const PcodeOp *)0)
*s << " opref=\"0x" << hex << op->getTime() << "\">";
else
*s << '>';
xml_escape(*s,ptr);
*s << "</funcname>";
}
void EmitXml::tagType(const char *ptr,syntax_highlight hl,const Datatype *ct) {
*s << "<type " << highlight[(int4)hl];
if (ct->getId() != 0) {
*s << " id=\"0x" << hex << ct->getId() << '\"';
}
*s << '>';
xml_escape(*s,ptr);
*s << "</type>";
}
void EmitXml::tagField(const char *ptr,syntax_highlight hl,const Datatype *ct,int4 o) {
*s << "<field " << highlight[(int4)hl];
if (ct != (const Datatype *)0) {
*s << " name=\"";
xml_escape(*s,ct->getName().c_str());
if (ct->getId() != 0) {
*s << "\" id=\"0x" << hex << ct->getId();
}
*s << "\" off=\"" << dec << o << '\"';
}
*s << '>';
xml_escape(*s,ptr);
*s << "</field>";
}
void EmitXml::tagComment(const char *ptr,syntax_highlight hl,
const AddrSpace *spc,uintb off) {
*s << "<comment " << highlight[(int4)hl];
a_v(*s,"space",spc->getName());
a_v_u(*s,"off",off);
*s << '>';
xml_escape(*s,ptr);
*s << "</comment>";
}
void EmitXml::tagLabel(const char *ptr,syntax_highlight hl,
const AddrSpace *spc,uintb off) {
*s << "<label " << highlight[(int4)hl];
a_v(*s,"space",spc->getName());
a_v_u(*s,"off",off);
*s << '>';
xml_escape(*s,ptr);
*s << "</label>";
}
void EmitXml::print(const char *str,syntax_highlight hl)
{
*s << "<syntax " << highlight[(int4)hl] << '>';
xml_escape(*s,str);
*s << "</syntax>";
}
int4 EmitXml::openParen(char o,int4 id)
{
*s << "<syntax " << highlight[(int4)no_color];
*s << " open=\"" << dec << id << "\">";
*s << o;
*s << "</syntax>";
parenlevel += 1;
return 0;
}
void EmitXml::closeParen(char c,int4 id)
{
*s << "<syntax " << highlight[(int4)no_color];
*s << " close=\"" << dec << id << "\">";
*s << c;
*s << "</syntax>";
parenlevel -= 1;
}
void EmitXml::spaces(int4 num,int4 bump)
{
const char *tenspaces = " ";
if (num <= 10)
print(tenspaces+(10-num));
else {
string spc;
for(int4 i=0;i<num;++i)
spc += ' ';
print(spc.c_str());
}
}
void EmitXml::resetDefaults(void)
{
resetDefaultsInternal();
}
int4 TokenSplit::countbase = 0;
void TokenSplit::print(EmitXml *emit) const
{
switch(tagtype) {
case docu_b: emit->beginDocument();
break;
case docu_e: emit->endDocument(count);
break;
case func_b: emit->beginFunction(ptr_second.fd);
break;
case func_e: emit->endFunction(count);
break;
case bloc_b: emit->beginBlock(ptr_second.bl);
break;
case bloc_e: emit->endBlock(count);
break;
case rtyp_b: emit->beginReturnType(ptr_second.vn);
break;
case rtyp_e: emit->endReturnType(count);
break;
case vard_b: emit->beginVarDecl(ptr_second.symbol);
break;
case vard_e: emit->endVarDecl(count);
break;
case stat_b: emit->beginStatement(op);
break;
case stat_e: emit->endStatement(count);
break;
case prot_b: emit->beginFuncProto();
break;
case prot_e: emit->endFuncProto(count);
break;
case vari_t: emit->tagVariable(tok.c_str(),hl,ptr_second.vn,op);
break;
case op_t: emit->tagOp(tok.c_str(),hl,op);
break;
case fnam_t: emit->tagFuncName(tok.c_str(),hl,ptr_second.fd,op);
break;
case type_t: emit->tagType(tok.c_str(),hl,ptr_second.ct);
break;
case field_t: emit->tagField(tok.c_str(),hl,ptr_second.ct,(int4)off);
break;
case comm_t: emit->tagComment(tok.c_str(),hl,ptr_second.spc,off);
break;
case label_t: emit->tagLabel(tok.c_str(),hl,ptr_second.spc,off);
break;
case synt_t: emit->print(tok.c_str(),hl);
break;
case opar_t: emit->openParen(tok[0],count);
break;
case cpar_t: emit->closeParen(tok[0],count);
break;
case oinv_t: break;
case cinv_t: break;
case spac_t: emit->spaces(numspaces);
break;
case line_t: case bump_t:
throw LowlevelError("Should never get called");
break;
}
}
#ifdef PRETTY_DEBUG
void TokenSplit::printDebug(ostream &s) const
{
switch(tagtype) {
case docu_b: s << "docu_b";
break;
case docu_e: s << "docu_e";
break;
case func_b: s << "func_b";
break;
case func_e: s << "func_e";
break;
case bloc_b: s << "bloc_b";
break;
case bloc_e: s << "bloc_e";
break;
case rtyp_b: s << "rtyp_b";
break;
case rtyp_e: s << "rtyp_e";
break;
case vard_b: s << "vard_b";
break;
case vard_e: s << "vard_e";
break;
case stat_b: s << "stat_b";
break;
case stat_e: s << "stat_e";
break;
case prot_b: s << "prot_b";
break;
case prot_e: s << "prot_e";
break;
case vari_t: s << "vari_t";
break;
case op_t: s << "op_t";
break;
case fnam_t: s << "fnam_t";
break;
case type_t: s << "type_t";
break;
case field_t: s << "field_t";
break;
case comm_t: s << "comm_t";
break;
case label_t: s << "label_t";
break;
case synt_t: s << "synt_t";
break;
case opar_t: s << "opar_t";
break;
case cpar_t: s << "cpar_t";
break;
case oinv_t: s << "oinv_t";
break;
case cinv_t: s << "cinv_t";
break;
case spac_t: s << "spac_t";
break;
case line_t: s << "line_t";
break;
case bump_t:
s << "bump_t";
break;
}
}
#endif
EmitPrettyPrint::EmitPrettyPrint(void)
: EmitXml(), scanqueue( 3*100 ), tokqueue( 3*100 )
{
lowlevel = new EmitNoXml(); spaceremain = maxlinesize;
needbreak = false;
commentmode = false;
resetDefaultsPrettyPrint();
}
EmitPrettyPrint::~EmitPrettyPrint(void)
{
delete lowlevel;
}
void EmitPrettyPrint::expand(void)
{
int4 max = tokqueue.getMax();
int4 left = tokqueue.bottomref();
tokqueue.expand(200);
for(int4 i=0;i<max;++i)
scanqueue.ref(i) = (scanqueue.ref(i) + max - left) % max;
scanqueue.expand(200);
}
void EmitPrettyPrint::overflow(void)
{
int4 half = maxlinesize / 2;
for(int4 i=indentstack.size()-1;i>=0;--i) {
if (indentstack[i] < half)
indentstack[i] = half;
else
break;
}
int4 newspaceremain;
if (!indentstack.empty())
newspaceremain = indentstack.back();
else
newspaceremain = maxlinesize;
if (newspaceremain == spaceremain)
return; if (commentmode && (newspaceremain == spaceremain + commentfill.size()))
return; spaceremain = newspaceremain;
lowlevel->tagLine(maxlinesize-spaceremain);
if (commentmode &&(commentfill.size() != 0)) {
lowlevel->print(commentfill.c_str(),EmitXml::comment_color);
spaceremain -= commentfill.size();
}
}
void EmitPrettyPrint::print(const TokenSplit &tok)
{
int4 val = 0;
switch(tok.getClass()) {
case TokenSplit::ignore:
tok.print(lowlevel); break;
case TokenSplit::begin_indent:
val = indentstack.back() - tok.getIndentBump();
indentstack.push_back(val);
#ifdef PRETTY_DEBUG
checkid.push_back(tok.getCount());
#endif
break;
case TokenSplit::begin_comment:
commentmode = true;
case TokenSplit::begin:
tok.print(lowlevel);
indentstack.push_back(spaceremain);
#ifdef PRETTY_DEBUG
checkid.push_back(tok.getCount());
#endif
break;
case TokenSplit::end_indent:
if (indentstack.empty())
throw LowlevelError("indent error");
#ifdef PRETTY_DEBUG
if (checkid.empty() || (checkid.back() != tok.getCount()))
throw LowlevelError("mismatch1");
checkid.pop_back();
if (indentstack.empty())
throw LowlevelError("Empty indent stack");
#endif
indentstack.pop_back();
break;
case TokenSplit::end_comment:
commentmode = false;
case TokenSplit::end:
tok.print(lowlevel);
#ifdef PRETTY_DEBUG
if (checkid.empty() || (checkid.back() != tok.getCount()))
throw LowlevelError("mismatch2");
checkid.pop_back();
if (indentstack.empty())
throw LowlevelError("indent error");
#endif
indentstack.pop_back();
break;
case TokenSplit::tokenstring:
if (tok.getSize() > spaceremain)
overflow();
tok.print(lowlevel);
spaceremain -= tok.getSize();
break;
case TokenSplit::tokenbreak:
if (tok.getSize() > spaceremain) {
if (tok.getTag() == TokenSplit::line_t) spaceremain = maxlinesize - tok.getIndentBump();
else { val = indentstack.back() - tok.getIndentBump();
if ((tok.getNumSpaces() <= spaceremain)&&
(val-spaceremain < 10)) {
lowlevel->spaces(tok.getNumSpaces());
spaceremain -= tok.getNumSpaces();
return;
}
indentstack.back() = val;
spaceremain = val;
}
lowlevel->tagLine(maxlinesize-spaceremain);
if (commentmode &&(commentfill.size() != 0)) {
lowlevel->print(commentfill.c_str(),EmitXml::comment_color);
spaceremain -= commentfill.size();
}
}
else {
lowlevel->spaces(tok.getNumSpaces());
spaceremain -= tok.getNumSpaces();
}
break;
}
}
void EmitPrettyPrint::advanceleft(void)
{
int4 l = tokqueue.bottom().getSize();
while(l >= 0) {
const TokenSplit &tok( tokqueue.bottom() );
print(tok);
switch(tok.getClass()) {
case TokenSplit::tokenbreak:
leftotal += tok.getNumSpaces();
break;
case TokenSplit::tokenstring:
leftotal += l;
break;
default:
break;
}
tokqueue.popbottom();
if (tokqueue.empty()) break;
l = tokqueue.bottom().getSize();
}
}
void EmitPrettyPrint::scan(void)
{
if (tokqueue.empty()) expand(); TokenSplit &tok( tokqueue.top() );
switch(tok.getClass()) {
case TokenSplit::begin_comment:
case TokenSplit::begin:
if (scanqueue.empty()) {
leftotal = rightotal = 1;
}
tok.setSize( -rightotal );
scanqueue.push() = tokqueue.topref();
break;
case TokenSplit::end_comment:
case TokenSplit::end:
tok.setSize(0);
if (!scanqueue.empty()) {
TokenSplit &ref( tokqueue.ref( scanqueue.pop() ) );
ref.setSize( ref.getSize() + rightotal );
if ((ref.getClass() == TokenSplit::tokenbreak)&&(!scanqueue.empty())) {
TokenSplit &ref2( tokqueue.ref( scanqueue.pop() ) );
ref2.setSize( ref2.getSize() + rightotal );
}
if (scanqueue.empty())
advanceleft();
}
break;
case TokenSplit::tokenbreak:
if (scanqueue.empty()) {
leftotal = rightotal = 1;
}
else {
TokenSplit &ref( tokqueue.ref( scanqueue.top() ) );
if (ref.getClass() == TokenSplit::tokenbreak) {
scanqueue.pop();
ref.setSize( ref.getSize() + rightotal );
}
}
tok.setSize( -rightotal );
scanqueue.push() = tokqueue.topref();
rightotal += tok.getNumSpaces();
break;
case TokenSplit::begin_indent:
case TokenSplit::end_indent:
case TokenSplit::ignore:
tok.setSize(0);
break;
case TokenSplit::tokenstring:
if (!scanqueue.empty()) {
rightotal += tok.getSize();
while(rightotal-leftotal > spaceremain) {
TokenSplit &ref( tokqueue.ref( scanqueue.popbottom() ) );
ref.setSize(999999);
advanceleft();
if (scanqueue.empty()) break;
}
}
}
}
void EmitPrettyPrint::checkstart(void)
{
if (needbreak) {
TokenSplit &tok( tokqueue.push() );
tok.spaces(0,0);
scan();
}
needbreak = false;
}
void EmitPrettyPrint::checkstring(void)
{
if (needbreak) {
TokenSplit &tok( tokqueue.push() );
tok.spaces(0,0);
scan();
}
needbreak = true;
}
void EmitPrettyPrint::checkend(void)
{
if (!needbreak) {
TokenSplit &tok( tokqueue.push() );
tok.print("",EmitXml::no_color); scan();
}
needbreak = true;
}
void EmitPrettyPrint::checkbreak(void)
{
if (!needbreak) {
TokenSplit &tok( tokqueue.push() );
tok.print("",EmitXml::no_color); scan();
}
needbreak = false;
}
int4 EmitPrettyPrint::beginDocument(void)
{
checkstart();
TokenSplit &tok( tokqueue.push() );
int4 id = tok.beginDocument();
scan();
return id;
}
void EmitPrettyPrint::endDocument(int4 id)
{
checkend();
TokenSplit &tok( tokqueue.push() );
tok.endDocument(id);
scan();
}
int4 EmitPrettyPrint::beginFunction(const Funcdata *fd)
{
#ifdef PRETTY_DEBUG
if (!tokqueue.empty())
throw LowlevelError("Starting with non-empty token queue");
#endif
checkstart();
TokenSplit &tok( tokqueue.push() );
int4 id = tok.beginFunction(fd);
scan();
return id;
}
void EmitPrettyPrint::endFunction(int4 id)
{
checkend();
TokenSplit &tok( tokqueue.push() );
tok.endFunction(id);
scan();
}
int4 EmitPrettyPrint::beginBlock(const FlowBlock *bl)
{
TokenSplit &tok( tokqueue.push() );
int4 id = tok.beginBlock(bl);
scan();
return id;
}
void EmitPrettyPrint::endBlock(int4 id)
{
TokenSplit &tok( tokqueue.push() );
tok.endBlock(id);
scan();
}
void EmitPrettyPrint::tagLine(void)
{
emitPending();
checkbreak();
TokenSplit &tok( tokqueue.push() );
tok.tagLine();
scan();
}
void EmitPrettyPrint::tagLine(int4 indent)
{
emitPending();
checkbreak();
TokenSplit &tok( tokqueue.push() );
tok.tagLine(indent);
scan();
}
int4 EmitPrettyPrint::beginReturnType(const Varnode *vn)
{
checkstart();
TokenSplit &tok( tokqueue.push() );
int4 id = tok.beginReturnType(vn);
scan();
return id;
}
void EmitPrettyPrint::endReturnType(int4 id)
{
checkend();
TokenSplit &tok( tokqueue.push() );
tok.endReturnType(id);
scan();
}
int4 EmitPrettyPrint::beginVarDecl(const Symbol *sym)
{
checkstart();
TokenSplit &tok( tokqueue.push() );
int4 id = tok.beginVarDecl(sym);
scan();
return id;
}
void EmitPrettyPrint::endVarDecl(int4 id)
{
checkend();
TokenSplit &tok( tokqueue.push() );
tok.endVarDecl(id);
scan();
}
int4 EmitPrettyPrint::beginStatement(const PcodeOp *op)
{
checkstart();
TokenSplit &tok( tokqueue.push() );
int4 id = tok.beginStatement(op);
scan();
return id;
}
void EmitPrettyPrint::endStatement(int4 id)
{
checkend();
TokenSplit &tok( tokqueue.push() );
tok.endStatement(id);
scan();
}
int4 EmitPrettyPrint::beginFuncProto(void)
{
checkstart();
TokenSplit &tok( tokqueue.push() );
int4 id = tok.beginFuncProto();
scan();
return id;
}
void EmitPrettyPrint::endFuncProto(int4 id)
{
checkend();
TokenSplit &tok( tokqueue.push() );
tok.endFuncProto(id);
scan();
}
void EmitPrettyPrint::tagVariable(const char *ptr,syntax_highlight hl,
const Varnode *vn,const PcodeOp *op)
{
checkstring();
TokenSplit &tok( tokqueue.push() );
tok.tagVariable(ptr,hl,vn,op);
scan();
}
void EmitPrettyPrint::tagOp(const char *ptr,syntax_highlight hl,const PcodeOp *op)
{
checkstring();
TokenSplit &tok( tokqueue.push() );
tok.tagOp(ptr,hl,op);
scan();
}
void EmitPrettyPrint::tagFuncName(const char *ptr,syntax_highlight hl,const Funcdata *fd,const PcodeOp *op)
{
checkstring();
TokenSplit &tok( tokqueue.push() );
tok.tagFuncName(ptr,hl,fd,op);
scan();
}
void EmitPrettyPrint::tagType(const char *ptr,syntax_highlight hl,const Datatype *ct)
{
checkstring();
TokenSplit &tok( tokqueue.push() );
tok.tagType(ptr,hl,ct);
scan();
}
void EmitPrettyPrint::tagField(const char *ptr,syntax_highlight hl,const Datatype *ct,int4 o)
{
checkstring();
TokenSplit &tok( tokqueue.push() );
tok.tagField(ptr,hl,ct,o);
scan();
}
void EmitPrettyPrint::tagComment(const char *ptr,syntax_highlight hl,
const AddrSpace *spc,uintb off)
{
checkstring();
TokenSplit &tok( tokqueue.push() );
tok.tagComment(ptr,hl,spc,off);
scan();
}
void EmitPrettyPrint::tagLabel(const char *ptr,syntax_highlight hl,
const AddrSpace *spc,uintb off)
{
checkstring();
TokenSplit &tok( tokqueue.push() );
tok.tagLabel(ptr,hl,spc,off);
scan();
}
void EmitPrettyPrint::print(const char *str,syntax_highlight hl)
{
checkstring();
TokenSplit &tok( tokqueue.push() );
tok.print(str,hl);
scan();
}
int4 EmitPrettyPrint::openParen(char o,int4 id)
{
id = openGroup(); TokenSplit &tok( tokqueue.push() );
tok.openParen(o,id);
scan();
needbreak = true;
return id;
}
void EmitPrettyPrint::closeParen(char c,int4 id)
{
checkstring();
TokenSplit &tok( tokqueue.push() );
tok.closeParen(c,id);
scan();
closeGroup(id);
}
int4 EmitPrettyPrint::openGroup(void)
{
checkstart();
TokenSplit &tok( tokqueue.push() );
int4 id = tok.openGroup();
scan();
return id;
}
void EmitPrettyPrint::closeGroup(int4 id)
{
checkend();
TokenSplit &tok( tokqueue.push() );
tok.closeGroup(id);
scan();
}
int4 EmitPrettyPrint::startComment(void)
{
checkstart();
TokenSplit &tok( tokqueue.push() );
int4 id = tok.startComment();
scan();
return id;
}
void EmitPrettyPrint::stopComment(int4 id)
{
checkend();
TokenSplit &tok( tokqueue.push() );
tok.stopComment(id);
scan();
}
void EmitPrettyPrint::clear(void)
{
EmitXml::clear();
lowlevel->clear();
indentstack.clear();
scanqueue.clear();
tokqueue.clear();
leftotal = 1;
rightotal = 1;
needbreak = false;
commentmode = false;
spaceremain = maxlinesize;
}
void EmitPrettyPrint::spaces(int4 num,int4 bump)
{
checkbreak();
TokenSplit &tok( tokqueue.push() );
tok.spaces(num,bump);
scan();
}
int4 EmitPrettyPrint::startIndent(void)
{
TokenSplit &tok( tokqueue.push() );
int4 id = tok.startIndent(indentincrement);
scan();
return id;
}
void EmitPrettyPrint::stopIndent(int4 id)
{
TokenSplit &tok( tokqueue.push() );
tok.stopIndent(id);
scan();
}
void EmitPrettyPrint::flush(void)
{
while(!tokqueue.empty()) {
TokenSplit &tok( tokqueue.popbottom() );
if (tok.getSize() < 0)
throw LowlevelError("Cannot flush pretty printer. Missing group end");
print(tok);
}
needbreak = false;
#ifdef PRETTY_DEBUG
if (!scanqueue.empty())
throw LowlevelError("prettyprint scanqueue did not flush");
if (!indentstack.empty())
throw LowlevelError("prettyprint indentstack did not flush");
#endif
lowlevel->flush();
}
void EmitPrettyPrint::setXML(bool val)
{
ostream *t = lowlevel->getOutputStream();
delete lowlevel;
if (val)
lowlevel = new EmitXml;
else
lowlevel = new EmitNoXml;
lowlevel->setOutputStream(t);
}
void EmitPrettyPrint::setMaxLineSize(int4 val)
{
if ((val<20)||(val>10000))
throw LowlevelError("Bad maximum line size");
maxlinesize = val;
scanqueue.setMax(3*val);
tokqueue.setMax(3*val);
spaceremain = maxlinesize;
clear();
}
void EmitPrettyPrint::resetDefaults(void)
{
lowlevel->resetDefaults();
resetDefaultsInternal();
resetDefaultsPrettyPrint();
}