当前位置: 首页>>代码示例>>C#>>正文


C# Specification.FindFunctionEx方法代码示例

本文整理汇总了C#中Specification.FindFunctionEx方法的典型用法代码示例。如果您正苦于以下问题:C# Specification.FindFunctionEx方法的具体用法?C# Specification.FindFunctionEx怎么用?C# Specification.FindFunctionEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Specification的用法示例。


在下文中一共展示了Specification.FindFunctionEx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFunctionName

        /// <summary>
        /// Returns the name of a generated function (for example <c>gp_mv_mv</c>).
        /// If the function is not found, a DependencyException is thrown.
        /// 
        /// The function is found by looking through all G25.FGS in the specification.
        /// </summary>
        /// <param name="S">The spec.</param>
        /// <param name="functionName">Basic name of the function to be found.</param>
        /// <param name="argumentTypes">Names of the arguments types (not mangled).</param>
        /// <param name="returnTypeName">Name of the return type (can be null or "" for default return type).</param>
        /// <param name="FT">Floating point type.</param>
        /// <param name="metricName">(optional, can be null for don't care)</param>
        /// <returns>The mangled name of the function.</returns>
        public static string GetFunctionName(Specification S, string functionName, string[] argumentTypes, string returnTypeName, G25.FloatType FT, string metricName)
        {
            fgs F = S.FindFunctionEx(functionName, argumentTypes, returnTypeName, new String[] { FT.type }, metricName);

            if (F == null) // error: function not found
            {
                string exStr = "G25.CG.Shared.Util.GetFunctionName(): cannot find function " + functionName + " with arguments (";
                for (int i = 0; i < argumentTypes.Length; i++)
                {
                    if (i > 0) exStr = exStr + ", ";
                    exStr = exStr + argumentTypes[i];
                }
                exStr = exStr + ") and using floating point type " + FT.type;
                if (metricName != null)
                {
                    exStr = exStr + " and using metric " + metricName;
                }
                throw new DependencyException(exStr);
            }
            else
            {
                argumentTypes = F.ArgumentTypeNames;

                string mangledFuncName = F.OutputName;
                if (S.OutputC())
                {
                    // add mangled argument types to function name
                    string[] mangledArgumentTypes = new string[argumentTypes.Length];
                    for (int i = 0; i < argumentTypes.Length; i++)
                    {
                        if (Util.DontAppendTypename(argumentTypes[i]))
                            continue;

                        mangledArgumentTypes[i] = (S.IsFloatType(argumentTypes[i])) ? FT.type : FT.GetMangledName(S, argumentTypes[i]);
                    }
                    mangledFuncName = Util.AppendTypenameToFuncName(S, FT, F.OutputName, mangledArgumentTypes);
                    //mangledFuncName = FT.GetMangledName(S, mangledFuncName);
                }
                else if (argumentTypes.Length == 0)
                {
                    // test to apply mangling when no arguments are present.
                    mangledFuncName = FT.GetMangledName(S, mangledFuncName);
                }

                return mangledFuncName;
            }
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:60,代码来源:dependencies.cs


注:本文中的Specification.FindFunctionEx方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。