Browse Source

Renaming and mechanical changes to CLIHeadersTemplate.cs. No behavior change intended.

pull/1/head
triton 13 years ago
parent
commit
2c9999d95c
  1. 33
      src/Generator/Generators/CLI/CLIHeadersTemplate.cs

33
src/Generator/Generators/CLI/CLIHeadersTemplate.cs

@ -84,10 +84,10 @@ namespace Cxxi.Generators.CLI
// Generate all the enum declarations for the module. // Generate all the enum declarations for the module.
for (int i = 0; i < Module.Enums.Count; ++i) for (int i = 0; i < Module.Enums.Count; ++i)
{ {
var E = Module.Enums[i]; var @enum = Module.Enums[i];
if (E.Ignore) continue; if (@enum.Ignore) continue;
GenerateEnum(E); GenerateEnum(@enum);
NeedsNewline = true; NeedsNewline = true;
if (i < Module.Enums.Count - 1) if (i < Module.Enums.Count - 1)
NewLine(); NewLine();
@ -99,21 +99,17 @@ namespace Cxxi.Generators.CLI
NeedsNewline = false; NeedsNewline = false;
// Generate all the typedef declarations for the module. // Generate all the typedef declarations for the module.
for (var i = 0; i < Module.Typedefs.Count; ++i) foreach (var typedef in Module.Typedefs)
{ {
var T = Module.Typedefs[i]; if (typedef.Ignore)
if (T.Ignore) continue; continue;
GenerateTypedef(T); if (!GenerateTypedef(typedef))
NeedsNewline = true; continue;
if (i < Module.Typedefs.Count - 1)
NewLine(); NewLine();
} }
if (NeedsNewline)
NewLine();
NeedsNewline = false; NeedsNewline = false;
// Generate all the struct/class declarations for the module. // Generate all the struct/class declarations for the module.
@ -252,7 +248,7 @@ namespace Cxxi.Generators.CLI
else else
Write("{0} {1}(", method.ReturnType, SafeIdentifier(method.Name)); Write("{0} {1}(", method.ReturnType, SafeIdentifier(method.Name));
for (int i = 0; i < method.Parameters.Count; ++i) for (var i = 0; i < method.Parameters.Count; ++i)
{ {
var param = method.Parameters[i]; var param = method.Parameters[i];
Write("{0}", TypeSig.GetArgumentString(param)); Write("{0}", TypeSig.GetArgumentString(param));
@ -263,9 +259,11 @@ namespace Cxxi.Generators.CLI
WriteLine(");"); WriteLine(");");
} }
public void GenerateTypedef(TypedefDecl typedef) public bool GenerateTypedef(TypedefDecl typedef)
{ {
if (typedef.Ignore) return; if (typedef.Ignore)
return false;
GenerateDeclarationCommon(typedef); GenerateDeclarationCommon(typedef);
FunctionType func; FunctionType func;
@ -281,8 +279,9 @@ namespace Cxxi.Generators.CLI
if (typedef.Type.IsPointerTo<FunctionType>(out func)) if (typedef.Type.IsPointerTo<FunctionType>(out func))
{ {
WriteLine("public {0};", WriteLine("public {0};",
string.Format(TypeSig.ToDelegateString(func), string.Format(TypeSig.ToDelegateString(function),
SafeIdentifier(typedef.Name))); SafeIdentifier(typedef.Name)));
return true;
} }
else if (typedef.Type.IsEnumType()) else if (typedef.Type.IsEnumType())
{ {
@ -292,6 +291,8 @@ namespace Cxxi.Generators.CLI
{ {
Console.WriteLine("Unhandled typedef type: {0}", typedef); Console.WriteLine("Unhandled typedef type: {0}", typedef);
} }
return false;
} }
public void GenerateFunction(Function function) public void GenerateFunction(Function function)

Loading…
Cancel
Save