Esempio 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);
 }
        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);
        }
        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;
                }
            }
        }
Esempio 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;
 }
Esempio 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;
        }
Esempio 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();
        }
Esempio n. 7
0
 public void RemoveDependant(DependencyGraphNode dep)
 {
     dependants.Remove(dep);
 }
Esempio n. 8
0
 public void AddDependant(DependencyGraphNode dep)
 {
     dependants.Add(dep);
 }
Esempio n. 9
0
 public void RemoveDependant(DependencyGraphNode dep)
 {
     dependants.Remove(dep);
 }
Esempio n. 10
0
 public void AddDependant(DependencyGraphNode dep)
 {
     dependants.Add(dep);
 }