-#region License
+#region License
//
// The Open Toolkit Library License
//
sw.WriteLine("[AutoGenerated(Category = \"{0}\", Version = \"{1}\", EntryPoint = \"{2}\")]",
f.Category, f.Version, Settings.FunctionPrefix + f.WrappedDelegate.EntryPoint);
- sw.WriteLine("public static extern {0};", GetDeclarationString(f));
+ sw.WriteLine("public static extern {0};", GetDeclarationString(f, Settings.Compatibility));
}
DocProcessor processor_;
sb.Append(d.Unsafe ? "unsafe " : "");
if (is_delegate)
sb.Append("delegate ");
- sb.Append(GetDeclarationString(d.ReturnType));
+ sb.Append(GetDeclarationString(d.ReturnType, Settings.Legacy.ConstIntEnums));
sb.Append(" ");
sb.Append(Settings.FunctionPrefix);
sb.Append(d.Name);
- sb.Append(GetDeclarationString(d.Parameters));
+ sb.Append(GetDeclarationString(d.Parameters, Settings.Legacy.ConstIntEnums));
return sb.ToString();
}
return sb.ToString();
}
- string GetDeclarationString(Function f)
+ string GetDeclarationString(Function f, Settings.Legacy settings)
{
StringBuilder sb = new StringBuilder();
sb.Append(f.Unsafe ? "unsafe " : "");
- sb.Append(GetDeclarationString(f.ReturnType));
+ sb.Append(GetDeclarationString(f.ReturnType, settings));
sb.Append(" ");
if ((Settings.Compatibility & Settings.Legacy.NoTrimFunctionEnding) != Settings.Legacy.None)
{
sb.Append(">");
}
- sb.Append(GetDeclarationString(f.Parameters));
+ sb.Append(GetDeclarationString(f.Parameters, settings));
if (f.Parameters.HasGenericParameters)
{
return sb.ToString();
}
- string GetDeclarationString(Parameter p, bool override_unsafe_setting)
+ string GetDeclarationString(Parameter p, bool override_unsafe_setting, Settings.Legacy settings)
{
StringBuilder sb = new StringBuilder();
}
else
{
- sb.Append(GetDeclarationString(p as Type));
+ sb.Append(GetDeclarationString(p as Type, settings));
}
}
else
{
- sb.Append(GetDeclarationString(p as Type));
+ sb.Append(GetDeclarationString(p as Type, settings));
}
if (!String.IsNullOrEmpty(p.Name))
{
return sb.ToString();
}
- string GetDeclarationString(ParameterCollection parameters)
+ string GetDeclarationString(ParameterCollection parameters, Settings.Legacy settings)
{
StringBuilder sb = new StringBuilder();
{
foreach (Parameter p in parameters)
{
- sb.Append(GetDeclarationString(p, false));
+ sb.Append(GetDeclarationString(p, false, settings));
sb.Append(", ");
}
sb.Replace(", ", ")", sb.Length - 2, 2);
return sb.ToString();
}
- string GetDeclarationString(Type type)
+ string GetDeclarationString(Type type, Settings.Legacy settings)
{
+ var t = type.QualifiedType;
+ if ((settings & Settings.Legacy.ConstIntEnums) != 0)
+ {
+ if (type.IsEnum)
+ {
+ t = "System.Int32";
+ }
+ }
+
return String.Format("{0}{1}{2}",
- type.QualifiedType,
+ t,
pointer_levels[type.Pointer],
array_levels[type.Array]);
}