本文整理汇总了C++中OutputTreeText函数的典型用法代码示例。如果您正苦于以下问题:C++ OutputTreeText函数的具体用法?C++ OutputTreeText怎么用?C++ OutputTreeText使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OutputTreeText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OutputConstantUnion
void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const TConstUnionArray& constUnion, int depth)
{
int size = node->getType().computeNumComponents();
for (int i = 0; i < size; i++) {
OutputTreeText(out, node, depth);
switch (constUnion[i].getType()) {
case EbtBool:
if (constUnion[i].getBConst())
out.debug << "true";
else
out.debug << "false";
out.debug << " (" << "const bool" << ")";
out.debug << "\n";
break;
case EbtFloat:
case EbtDouble:
{
const double value = constUnion[i].getDConst();
// Print infinity in a portable way, for test stability.
// Other cases may be needed in the future: negative infinity,
// and NaNs.
if (is_positive_infinity(value))
out.debug << "inf\n";
else {
const int maxSize = 300;
char buf[maxSize];
snprintf(buf, maxSize, "%f", value);
out.debug << buf << "\n";
}
}
break;
case EbtInt:
{
const int maxSize = 300;
char buf[maxSize];
snprintf(buf, maxSize, "%d (%s)", constUnion[i].getIConst(), "const int");
out.debug << buf << "\n";
}
break;
case EbtUint:
{
const int maxSize = 300;
char buf[maxSize];
snprintf(buf, maxSize, "%u (%s)", constUnion[i].getUConst(), "const uint");
out.debug << buf << "\n";
}
break;
default:
out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc());
break;
}
}
}
示例2: OutputTreeText
bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop *node)
{
TInfoSinkBase &out = sink;
OutputTreeText(out, node, mDepth);
out << "Loop with condition ";
if (node->getType() == ELoopDoWhile)
out << "not ";
out << "tested first\n";
++mDepth;
OutputTreeText(sink, node, mDepth);
if (node->getCondition())
{
out << "Loop Condition\n";
node->getCondition()->traverse(this);
}
else
{
out << "No loop condition\n";
}
OutputTreeText(sink, node, mDepth);
if (node->getBody())
{
out << "Loop Body\n";
node->getBody()->traverse(this);
}
else
{
out << "No loop body\n";
}
if (node->getExpression())
{
OutputTreeText(sink, node, mDepth);
out << "Loop Terminal Expression\n";
node->getExpression()->traverse(this);
}
--mDepth;
return false;
}
示例3: OutputCase
bool OutputCase(bool /* preVisit */, TIntermCase* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputExtensionText(out, node);
OutputTreeText(out, node, oit->depth);
out.debug << "Case";
out.debug << " (" << node->getCompleteString() << ")";
OutputDebugText(out, node);
out.debug << "\n";
#if DEBUG_SCOPE == 1
OutputScopeText(oit->infoSink, node, oit->depth);
#endif
#if DEBUG_CHANGEABLE == 1
OutputChangeableText(oit->infoSink, node, oit->depth, 0);
#endif
++oit->depth;
if (node->getExpression()) {
node->getExpression()->traverse(it);
} else {
OutputExtensionText(out, node);
OutputTreeText(out, node, oit->depth);
out.debug << "Default Case\n" ;
}
OutputExtensionText(out, node);
OutputTreeText(out, node, oit->depth);
out.debug << "Body\n";
++oit->depth;
if (node->getCaseBody()) {
node->getCaseBody()->traverse(it);
}
--oit->depth;
--oit->depth;
return false;
}
示例4: OutputTreeText
void TOutputTraverser::visitSymbol(TIntermSymbol* node)
{
OutputTreeText(infoSink, node, depth);
infoSink.debug << "'" << node->getName() << "' (" << node->getCompleteString() << ")\n";
if (! node->getConstArray().empty())
OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1);
}
示例5: OutputSwitch
bool OutputSwitch(bool /* preVisit */, TIntermSwitch* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputExtensionText(out, node);
OutputTreeText(out, node, oit->depth);
out.debug << "Test condition and switch";
out.debug << " (" << node->getCompleteString() << ")";
OutputDebugText(out, node);
out.debug << " <<";
out.debug << getDbgSelectionStatus(node->getDbgInternalState());
out.debug << ">>\n";
#if DEBUG_SCOPE == 1
OutputScopeText(oit->infoSink, node, oit->depth);
#endif
#if DEBUG_CHANGEABLE == 1
OutputChangeableText(oit->infoSink, node, oit->depth, 0);
#endif
++oit->depth;
OutputExtensionText(out, node);
OutputTreeText(oit->infoSink, node, oit->depth);
out.debug << "Condition\n";
++oit->depth;
node->getCondition()->traverse(it);
--oit->depth;
OutputExtensionText(out, node);
OutputTreeText(oit->infoSink, node, oit->depth);
out.debug << "Case List\n";
++oit->depth;
if (node->getCaseList()) {
node->getCaseList()->traverse(it);
}
--oit->depth;
--oit->depth;
return false;
}
示例6: OutputLoop
bool OutputLoop(bool, /* preVisit */ TIntermLoop* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputTreeText(out, node, oit->depth);
out.debug << "Loop with condition ";
if (! node->testFirst())
out.debug << "not ";
out.debug << "tested first\n";
++oit->depth;
OutputTreeText(oit->infoSink, node, oit->depth);
if (node->getTest())
{
out.debug << "Loop Condition\n";
node->getTest()->traverse(it);
}
else
out.debug << "No loop condition\n";
OutputTreeText(oit->infoSink, node, oit->depth);
if (node->getBody())
{
out.debug << "Loop Body\n";
node->getBody()->traverse(it);
}
else
out.debug << "No loop body\n";
if (node->getTerminal())
{
OutputTreeText(oit->infoSink, node, oit->depth);
out.debug << "Loop Terminal Expression\n";
node->getTerminal()->traverse(it);
}
--oit->depth;
return false;
}
示例7: OutputFuncDeclaration
void OutputFuncDeclaration(TIntermFuncDeclaration* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputExtensionText(out, node);
OutputTreeText(out, node, oit->depth);
out.debug << "Function Declaration: " <<
node->getFunction()->getMangledName() << "\n" ;
}
示例8: OutputSymbol
void OutputSymbol(TIntermSymbol* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
OutputTreeText(oit->infoSink, node, oit->depth);
char buf[100];
sprintf(buf, "'%s' (%s)\n",
node->getSymbol().c_str(),
node->getCompleteString().c_str());
oit->infoSink.debug << buf;
}
示例9: OutputConstantUnion
void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const TConstUnionArray& constUnion, int depth)
{
int size = node->getType().computeNumComponents();
for (int i = 0; i < size; i++) {
OutputTreeText(out, node, depth);
switch (constUnion[i].getType()) {
case EbtBool:
if (constUnion[i].getBConst())
out.debug << "true";
else
out.debug << "false";
out.debug << " (" << "const bool" << ")";
out.debug << "\n";
break;
case EbtFloat:
case EbtDouble:
{
const int maxSize = 300;
char buf[maxSize];
snprintf(buf, maxSize, "%f", constUnion[i].getDConst());
out.debug << buf << "\n";
}
break;
case EbtInt:
{
const int maxSize = 300;
char buf[maxSize];
snprintf(buf, maxSize, "%d (%s)", constUnion[i].getIConst(), "const int");
out.debug << buf << "\n";
}
break;
case EbtUint:
{
const int maxSize = 300;
char buf[maxSize];
snprintf(buf, maxSize, "%u (%s)", constUnion[i].getUConst(), "const uint");
out.debug << buf << "\n";
}
break;
default:
out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc());
break;
}
}
}
示例10: OutputTreeText
bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
{
TInfoSinkBase& out = sink;
OutputTreeText(out, node, depth);
switch (node->getOp()) {
case EOpAssign: out << "move second child to first child"; break;
case EOpInitialize: out << "initialize first child with second child"; break;
case EOpAddAssign: out << "add second child into first child"; break;
case EOpSubAssign: out << "subtract second child into first child"; break;
case EOpMulAssign: out << "multiply second child into first child"; break;
case EOpVectorTimesMatrixAssign: out << "matrix mult second child into first child"; break;
case EOpVectorTimesScalarAssign: out << "vector scale second child into first child"; break;
case EOpMatrixTimesScalarAssign: out << "matrix scale second child into first child"; break;
case EOpMatrixTimesMatrixAssign: out << "matrix mult second child into first child"; break;
case EOpDivAssign: out << "divide second child into first child"; break;
case EOpIndexDirect: out << "direct index"; break;
case EOpIndexIndirect: out << "indirect index"; break;
case EOpIndexDirectStruct: out << "direct index for structure"; break;
case EOpVectorSwizzle: out << "vector swizzle"; break;
case EOpAdd: out << "add"; break;
case EOpSub: out << "subtract"; break;
case EOpMul: out << "component-wise multiply"; break;
case EOpDiv: out << "divide"; break;
case EOpEqual: out << "Compare Equal"; break;
case EOpNotEqual: out << "Compare Not Equal"; break;
case EOpLessThan: out << "Compare Less Than"; break;
case EOpGreaterThan: out << "Compare Greater Than"; break;
case EOpLessThanEqual: out << "Compare Less Than or Equal"; break;
case EOpGreaterThanEqual: out << "Compare Greater Than or Equal"; break;
case EOpVectorTimesScalar: out << "vector-scale"; break;
case EOpVectorTimesMatrix: out << "vector-times-matrix"; break;
case EOpMatrixTimesVector: out << "matrix-times-vector"; break;
case EOpMatrixTimesScalar: out << "matrix-scale"; break;
case EOpMatrixTimesMatrix: out << "matrix-multiply"; break;
case EOpLogicalOr: out << "logical-or"; break;
case EOpLogicalXor: out << "logical-xor"; break;
case EOpLogicalAnd: out << "logical-and"; break;
default: out << "<unknown op>";
}
out << " (" << node->getCompleteString() << ")";
out << "\n";
return true;
}
示例11: OutputTreeText
void TOutputTraverser::visitSymbol(TIntermSymbol* node)
{
OutputTreeText(infoSink, node, depth);
infoSink.debug << "'" << node->getName() << "' (" << node->getCompleteString() << ")\n";
if (! node->getConstArray().empty())
OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1);
else if (node->getConstSubtree()) {
incrementDepth(node);
node->getConstSubtree()->traverse(this);
decrementDepth();
}
}
示例12: OutputTreeText
void TOutputTraverser::visitSymbol(TIntermSymbol* node)
{
OutputTreeText(infoSink, node, depth);
const int maxSize = GlslangMaxTypeLength + GlslangMaxTokenLength;
char buf[maxSize];
snprintf(buf, maxSize, "'%s' (%s)\n",
node->getName().c_str(),
node->getCompleteString().c_str());
infoSink.debug << buf;
if (! node->getConstArray().empty())
OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1);
}
示例13: OutputSelection
bool OutputSelection(bool, /* preVisit */ TIntermSelection* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputTreeText(out, node, oit->depth);
out.debug << "ternary ?:";
out.debug << " (" << node->getCompleteString() << ")\n";
++oit->depth;
OutputTreeText(oit->infoSink, node, oit->depth);
out.debug << "Condition\n";
node->getCondition()->traverse(it);
OutputTreeText(oit->infoSink, node, oit->depth);
if (node->getTrueBlock())
{
out.debug << "true case\n";
node->getTrueBlock()->traverse(it);
}
else
out.debug << "true case is null\n";
if (node->getFalseBlock())
{
OutputTreeText(oit->infoSink, node, oit->depth);
out.debug << "false case\n";
node->getFalseBlock()->traverse(it);
}
--oit->depth;
return false;
}
示例14: OutputTreeText
bool TOutputTraverser::visitIfElse(Visit visit, TIntermIfElse *node)
{
TInfoSinkBase &out = sink;
OutputTreeText(out, node, mDepth);
out << "If test\n";
++mDepth;
OutputTreeText(sink, node, mDepth);
out << "Condition\n";
node->getCondition()->traverse(this);
OutputTreeText(sink, node, mDepth);
if (node->getTrueBlock())
{
out << "true case\n";
node->getTrueBlock()->traverse(this);
}
else
{
out << "true case is null\n";
}
if (node->getFalseBlock())
{
OutputTreeText(sink, node, mDepth);
out << "false case\n";
node->getFalseBlock()->traverse(this);
}
--mDepth;
return false;
}
示例15: OutputDummy
void OutputDummy(TIntermDummy* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputExtensionText(out, node);
OutputTreeText(out, node, oit->depth);
out.debug << "dummy ";
OutputDebugText(out, node);
out.debug << "\n";
#if DEBUG_CHANGEABLE == 1
OutputChangeableText(oit->infoSink, node, oit->depth, 0);
#endif
}