本文整理汇总了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;
}
}