Exemplo n.º 1
0
 public void ReplaceDependant(string toReplace, DependencyGraphNode newNode)
 {
     DependencyGraphNode replacing = SearchDependant(toReplace);
     for (int i=0; i<CountDependants(); i++) {
         ((DependencyGraphNode)dependants[i]).ReplaceCalledBy(replacing, newNode);
     }
     RemoveDependant(replacing);
 }
Exemplo n.º 2
0
        public void AddCallsBy(DependencyGraphNode func)
        {
            if (func == null)
                return;

            for (int i=0; i<calledBy.Count; i++) {
                if (func == calledBy[i]) return;
            }

            calledBy.Add(func);
        }
Exemplo n.º 3
0
        public void ReplaceCalledBy(DependencyGraphNode toReplace, DependencyGraphNode newOne)
        {
            for (int i=0; i<calledBy.Count; i++) {
                if (toReplace == calledBy[i]) {
                    calledBy.Remove(toReplace);

                    if (newOne != null)
                        calledBy.Add(newOne);
                    return;
                }
            }
        }
Exemplo n.º 4
0
 public DependencyGraphNode SearchDependant(string dependantName)
 {
     DependencyGraphNode tmp;
     for (int i=0; i<dependants.Count; i++) {
         tmp = (DependencyGraphNode) dependants[i];
         if (tmp.GetDependencyName().Equals(dependantName))
             return tmp;
     }
     DependencyGraphNode novo = new DependencyGraphNode(dependantName);
     dependants.Add(novo);
     return novo;
 }
Exemplo n.º 5
0
        public override Node ExitFunctionOrVariableDeclaration(Production node)
        {
            DependencyGraphNode antiga = dependencyGraph.SearchDependant(((Token)GrammaticaNodeUtils.FindChildOf(node, "IDENTIFIER")).GetImage());
            // se a função já existir
            if (antiga != null) {
                // trocar a nova pela n em todo o grafo.
                dependencyGraph.ReplaceDependant("Nova Função", antiga);
            } else {
                dependencyGraph.SearchDependant("Nova Função").SetDependencyName(((Token)GrammaticaNodeUtils.FindChildOf(node, "IDENTIFIER")).GetImage());
            }
            functionScope = null;

            if (((Token)GrammaticaNodeUtils.FindChildOf(node, "IDENTIFIER")).GetImage().Equals(activeMainFunction))
            {
                RemoveTypeFromMain(node);
            }
            scopeVars = new ArrayList();
            replaceIdentifier = new Hashtable();

            return node;
        }
Exemplo n.º 6
0
        /**
         * Creates a Graph of function calls to decide to what file goes each
         * function when the HLSL have more than one main function.
         */
        public override void EnterFunctionOrVariableDeclaration(Production node)
        {
            functionScope = new DependencyGraphNode("Nova Função");
            dependencyGraph.AddDependant(functionScope);

            scopeVars = new ArrayList();
            replaceIdentifier = new Hashtable();
        }
Exemplo n.º 7
0
 public void RemoveDependant(DependencyGraphNode dep)
 {
     dependants.Remove(dep);
 }
Exemplo n.º 8
0
 public void AddDependant(DependencyGraphNode dep)
 {
     dependants.Add(dep);
 }
Exemplo n.º 9
0
 public void RemoveDependant(DependencyGraphNode dep)
 {
     dependants.Remove(dep);
 }
Exemplo n.º 10
0
 public void AddDependant(DependencyGraphNode dep)
 {
     dependants.Add(dep);
 }