Exemplo n.º 1
0
        public void AddFunctionEndPointer(int classIndex, string functionName, FunctionEndPoint fep)
        {
            if (functionName == null)
            {
                throw new System.ArgumentNullException("functionName");
            }

            if (fep == null)
            {
                throw new System.ArgumentNullException("fep");
            }

            Dictionary <string, FunctionGroup> funcGroupMap;

            if (!GlobalFuncTable.TryGetValue(classIndex, out funcGroupMap))
            {
                funcGroupMap = new Dictionary <string, FunctionGroup>();
                GlobalFuncTable[classIndex] = funcGroupMap;
            }

            FunctionGroup funcGroup;

            if (!funcGroupMap.TryGetValue(functionName, out funcGroup))
            {
                funcGroup = new FunctionGroup();
                funcGroupMap[functionName] = funcGroup;
            }

            funcGroup.FunctionEndPoints.Add(fep);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initialize the global function table entry for a class
 /// The argument is the index of the class of functions to initialize + 1, which is the index expected at callsite
 /// </summary>
 /// <param name="classIndexAtCallsite"></param>
 public void InitGlobalFunctionEntry(int classIndexAtCallsite)
 {
     Validity.Assert(null != GlobalFuncTable);
     Validity.Assert(ProtoCore.DSASM.Constants.kInvalidIndex != classIndexAtCallsite);
     if (!GlobalFuncTable.ContainsKey(classIndexAtCallsite))
     {
         Dictionary <string, FunctionGroup> funcList = new Dictionary <string, FunctionGroup>();
         GlobalFuncTable.Add(classIndexAtCallsite, funcList);
     }
 }
Exemplo n.º 3
0
        public void CopyVisibleFunctionEndPointFromBase(int classIndex, int baseClassIndex)
        {
            if (classIndex == ProtoCore.DSASM.Constants.kInvalidIndex)
            {
                throw new System.ArgumentException("classIndex");
            }

            if (baseClassIndex == ProtoCore.DSASM.Constants.kInvalidIndex)
            {
                throw new System.ArgumentException("classIndex");
            }

            Dictionary <string, FunctionGroup> thisFunctionGroupMap;
            Dictionary <string, FunctionGroup> baseFunctionGroupMap;

            if (!GlobalFuncTable.TryGetValue(classIndex, out thisFunctionGroupMap) ||
                !GlobalFuncTable.TryGetValue(baseClassIndex, out baseFunctionGroupMap))
            {
                return;
            }

            foreach (KeyValuePair <string, FunctionGroup> baseGroup in baseFunctionGroupMap)
            {
                FunctionGroup functionGroup;
                if (thisFunctionGroupMap.TryGetValue(baseGroup.Key, out functionGroup))
                {
                    functionGroup.CopyVisible(baseGroup.Value.FunctionEndPoints);
                }
                else
                {
                    // If this class doesnt have basegroup, create a new group and append the visible feps from the basegoup
                    functionGroup = new FunctionGroup();
                    functionGroup.CopyVisible(baseGroup.Value.FunctionEndPoints);
                    if (functionGroup.FunctionEndPoints.Count > 0)
                    {
                        thisFunctionGroupMap[baseGroup.Key] = functionGroup;
                    }
                }
            }
        }
Exemplo n.º 4
0
        public FunctionGroup GetFunctionGroup(int classIndex, string functionName)
        {
            if (functionName == null)
            {
                throw new System.ArgumentNullException("functionName");
            }

            Dictionary <string, FunctionGroup> funcGroupMap;

            if (!GlobalFuncTable.TryGetValue(classIndex, out funcGroupMap))
            {
                return(null);
            }

            FunctionGroup funcGroup;

            if (!funcGroupMap.TryGetValue(functionName, out funcGroup))
            {
                return(null);
            }

            return(funcGroup);
        }