Exemplo n.º 1
0
void CqParseTreeViz::Visit(IqParseNodeIlluminanceConstruct& node)
{
	setNodeProperty(node, "label", "ILLUMINANCE");
	setNodeProperty(node, "fillcolor", blockConstructColor);
	setNodeProperty(node, "shape", "Msquare");
	visitChildren(node);
}
Exemplo n.º 2
0
void CqParseTreeViz::Visit(IqParseNodeOperator& node)
{
	setNodeProperty(node, "label", opToString(node.Operator()));
	setNodeProperty(node, "shape", "box");
	setNodeProperty(node, "fillcolor", operatorColor);
	visitChildren(node);
}
Exemplo n.º 3
0
void CqParseTreeViz::Visit(IqParseNodeGatherConstruct& node)
{
	setNodeProperty(node, "label", "GATHER");
	setNodeProperty(node, "fillcolor", blockConstructColor);
	setNodeProperty(node, "shape", "Msquare");
	visitChildren(node);
}
Exemplo n.º 4
0
void CqParseTreeViz::Visit(IqParseNodeConditional& node)
{
	setNodeProperty(node, "label", "IF");
	setNodeProperty(node, "fillcolor", blockConstructColor);
	setNodeProperty(node, "shape", "Msquare");
	visitChildren(node);
}
Exemplo n.º 5
0
void CqParseTreeViz::Visit(IqParseNodeUnresolvedCall& node)
{
	setNodeProperty(node, "label", std::string("UnresolvedCall\\n") + node.strName());
	setNodeProperty(node, "fillcolor", unresolvedCallColor);
	setNodeProperty(node, "shape", "box");
	visitChildren(node);
}
Exemplo n.º 6
0
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);
}
Exemplo n.º 7
0
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);
}
Exemplo n.º 8
0
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);
}
Exemplo n.º 9
0
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);
}
Exemplo n.º 10
0
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);
}
Exemplo n.º 11
0
// 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;
}
Exemplo n.º 12
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);
	}
}
Exemplo n.º 13
0
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);
		}
	}
}
Exemplo n.º 14
0
void CqParseTreeViz::Visit(IqParseNodeDiscardResult& node)
{
	setNodeProperty(node, "label", "DiscardResult");
	visitChildren(node);
}
Exemplo n.º 15
0
void CqParseTreeViz::Visit(IqParseNodeConditionalExpression& node)
{
	setNodeProperty(node, "label", "t/f ? a : b");
	visitChildren(node);
}
Exemplo n.º 16
0
void CqParseTreeViz::Visit(IqParseNodeVariable& node)
{
	setNodeProperty(node, "label", splitVarNameToLines(node.strName()));
	setNodeProperty(node, "color", variableColor);
	visitChildren(node);
}
Exemplo n.º 17
0
void CqParseTreeViz::Visit(IqParseNodeSixteenTuple& node)
{
	setNodeProperty(node, "label", "SixteenTuple");
	visitChildren(node);
}
Exemplo n.º 18
0
void CqParseTreeViz::Visit(IqParseNodeMessagePassingFunction& node)
{
	setNodeProperty(node, "label", "MessagePassingFunction");
	visitChildren(node);
}
Exemplo n.º 19
0
void CqParseTreeViz::Visit(IqParseNodeConstantFloat& node)
{
	setNodeProperty(node, "label", boost::format("%0.2f") % node.Value());
	setNodeProperty(node, "color", constantColor);
	visitChildren(node);
}
Exemplo n.º 20
0
void CqParseTreeViz::Visit(IqParseNodeConstantString& node)
{
	setNodeProperty(node, "label", boost::format("\\\"%s\\\"") % node.strValue());
	setNodeProperty(node, "color", constantColor);
	visitChildren(node);
}
Exemplo n.º 21
0
//-----------------------------------------------------------------------
// Node visitor functions
void CqParseTreeViz::Visit(IqParseNode& node)
{
	setNodeProperty(node, "label", "Base");
	setNodeProperty(node, "shape", "point");
	visitChildren(node);
}