void CqParseTreeViz::Visit(IqParseNodeIlluminanceConstruct& node) { setNodeProperty(node, "label", "ILLUMINANCE"); setNodeProperty(node, "fillcolor", blockConstructColor); setNodeProperty(node, "shape", "Msquare"); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeOperator& node) { setNodeProperty(node, "label", opToString(node.Operator())); setNodeProperty(node, "shape", "box"); setNodeProperty(node, "fillcolor", operatorColor); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeGatherConstruct& node) { setNodeProperty(node, "label", "GATHER"); setNodeProperty(node, "fillcolor", blockConstructColor); setNodeProperty(node, "shape", "Msquare"); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeConditional& node) { setNodeProperty(node, "label", "IF"); setNodeProperty(node, "fillcolor", blockConstructColor); setNodeProperty(node, "shape", "Msquare"); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeUnresolvedCall& node) { setNodeProperty(node, "label", std::string("UnresolvedCall\\n") + node.strName()); setNodeProperty(node, "fillcolor", unresolvedCallColor); setNodeProperty(node, "shape", "box"); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeArrayVariable& node) { const char* varName = static_cast<IqParseNodeVariable*>( node.GetInterface(ParseNode_Variable))->strName(); setNodeProperty(node, "label", splitVarNameToLines(varName) + " []"); setNodeProperty(node, "color", variableColor); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeFunctionCall& node) { IqFuncDef* funcDef = node.pFuncDef(); setNodeProperty(node, "label", funcDef->strVMName()); setNodeProperty(node, "shape", "box"); setNodeProperty(node, "fillcolor", functionCallColor); m_calledFunctions.insert(funcDef); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeArrayVariableAssign& node) { IqParseNodeVariable* varNode = static_cast<IqParseNodeVariable*>( node.GetInterface(ParseNode_Variable)); setNodeProperty(node, "label", boost::format("%s [] := ") % splitVarNameToLines(varNode->strName())); setNodeProperty(node, "fillcolor", variableAssignColor); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeTypeCast& node) { setNodeProperty(node, "fillcolor", typeCastColor); setNodeProperty(node, "shape", "box"); IqParseNode* operand = static_cast<IqParseNode*>( node.GetInterface(ParseNode_Base))->pChild(); const char* pstrToType = gVariableTypeNames[node.CastTo() & Type_Mask]; const char* pstrFromType = gVariableTypeNames[operand->ResType() & Type_Mask]; setNodeProperty(node, "label", boost::format("%s<-\\n<-%s") % pstrToType % pstrFromType); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeLoopMod& node) { switch(node.modType()) { case LoopMod_Break: setNodeProperty(node, "label", "break"); break; case LoopMod_Continue: setNodeProperty(node, "label", "continue"); break; } setNodeProperty(node, "fillcolor", blockConstructColor); setNodeProperty(node, "shape", "box"); visitChildren(node); }
// Driver program int main(void) { char *line = NULL; size_t size; int i, j; int nb_test_cases, N, M, Ci; char army[2]; int city1, city2; struct Graph* graph; if (getline(&line, &size, stdin) == -1) DEBUG_PRINTF("No line\n"); else { sscanf(line,"%d", &nb_test_cases); DEBUG_PRINTF("There are %d test cases\n", nb_test_cases); } for(i=0;i<nb_test_cases;i++){ if (getline(&line, &size, stdin) == -1) DEBUG_PRINTF("No line\n"); else { sscanf(line,"%d %d", &N, &M); } graph = createGraph(N); DEBUG_PRINTF("\nTest case %d : Byteland has %d cities and %d roads\n", i+1, N, M); for(j=0;j<N;j++){ if (getline(&line, &size, stdin) == -1) DEBUG_PRINTF("No line\n"); else { sscanf(line,"%c %d", army, &Ci); //DEBUG_PRINTF("%s %d\n", army, Ci); setNodeProperty(graph, j, Ci, army[0]); } } for(j=0;j<M;j++){ if (getline(&line, &size, stdin) == -1) printf("No line\n"); else { sscanf(line,"%d %d", &city1, &city2); //DEBUG_PRINTF("%d %d\n", city1, city2); addEdge(graph, city1-1, city2-1); } } DEBUG_PRINTGRAPH(graph); executeTestCase(graph); } return 0; }
void CqParseTreeViz::Visit(IqParseNodeShader& node) { setNodeProperty(node, "label", boost::format( "{%s shader \\\"%s\\\" | {<args> args | <code> code } }") % node.strShaderType() % node.strName()); setNodeProperty(node, "fillcolor", functionColor); setNodeProperty(node, "shape", "record"); IqParseNode* code = static_cast<IqParseNode*>( node.GetInterface(ParseNode_Base))->pChild(); if(code) { IqParseNode* args = code->pNextSibling(); if(args) { makeEdge(node, *args, "args"); args->Accept(*this); } makeEdge(node, *code, "code"); code->Accept(*this); } }
void CqParseTreeViz::makeFunctionGraph(const IqFuncDef& funcDef) { // Only try to display graphs of user-defined functions. if(funcDef.fLocal()) { setNodeProperty(funcDef, "label", boost::format("{%s | {<args> args|<code> code}}") % funcDef.strName()); setNodeProperty(funcDef, "fillcolor", functionColor); setNodeProperty(funcDef, "shape", "record"); const IqParseNode* args = funcDef.pArgs(); if(args) { makeEdge(funcDef, *args, "args"); const_cast<IqParseNode*>(args)->Accept(*this); } const IqParseNode* code = funcDef.pDef(); if(code) { makeEdge(funcDef, *code, "code"); const_cast<IqParseNode*>(code)->Accept(*this); } } }
void CqParseTreeViz::Visit(IqParseNodeDiscardResult& node) { setNodeProperty(node, "label", "DiscardResult"); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeConditionalExpression& node) { setNodeProperty(node, "label", "t/f ? a : b"); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeVariable& node) { setNodeProperty(node, "label", splitVarNameToLines(node.strName())); setNodeProperty(node, "color", variableColor); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeSixteenTuple& node) { setNodeProperty(node, "label", "SixteenTuple"); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeMessagePassingFunction& node) { setNodeProperty(node, "label", "MessagePassingFunction"); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeConstantFloat& node) { setNodeProperty(node, "label", boost::format("%0.2f") % node.Value()); setNodeProperty(node, "color", constantColor); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeConstantString& node) { setNodeProperty(node, "label", boost::format("\\\"%s\\\"") % node.strValue()); setNodeProperty(node, "color", constantColor); visitChildren(node); }
//----------------------------------------------------------------------- // Node visitor functions void CqParseTreeViz::Visit(IqParseNode& node) { setNodeProperty(node, "label", "Base"); setNodeProperty(node, "shape", "point"); visitChildren(node); }