Browse Source

Context.SupportBefore and Context.SupportAfter are not printed with a newline at the end anymore

pull/1/head
marcos henrich 13 years ago
parent
commit
a388d96b28
  1. 4
      src/Generator/Generators/CLI/CLIMarshal.cs
  2. 14
      src/Generator/Generators/CLI/CLISourcesTemplate.cs

4
src/Generator/Generators/CLI/CLIMarshal.cs

@ -380,7 +380,7 @@ namespace Cxxi.Generators.CLI
if (pointee.IsPrimitiveType(PrimitiveType.Char)) if (pointee.IsPrimitiveType(PrimitiveType.Char))
{ {
Context.SupportBefore.Write( Context.SupportBefore.WriteLine(
"auto _{0} = clix::marshalString<clix::E_UTF8>({1});", "auto _{0} = clix::marshalString<clix::E_UTF8>({1});",
Context.ArgName, Context.Parameter.Name); Context.ArgName, Context.Parameter.Name);
@ -592,7 +592,7 @@ namespace Cxxi.Generators.CLI
Context.ParameterIndex = marshalCtx.ParameterIndex; Context.ParameterIndex = marshalCtx.ParameterIndex;
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore))
Context.SupportBefore.WriteLine(marshal.Context.SupportBefore); Context.SupportBefore.Write(marshal.Context.SupportBefore);
if(field.Type.IsPointer()) if(field.Type.IsPointer())
{ {

14
src/Generator/Generators/CLI/CLISourcesTemplate.cs

@ -193,12 +193,12 @@ namespace Cxxi.Generators.CLI
@class.QualifiedOriginalName, field.OriginalName); @class.QualifiedOriginalName, field.OriginalName);
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore))
WriteLine(marshal.Context.SupportBefore); Write(marshal.Context.SupportBefore);
WriteLine("{0} = {1};", variable, marshal.Context.Return); WriteLine("{0} = {1};", variable, marshal.Context.Return);
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportAfter)) if (!string.IsNullOrWhiteSpace(marshal.Context.SupportAfter))
WriteLine(marshal.Context.SupportAfter); Write(marshal.Context.SupportAfter);
WriteCloseBraceIndent(); WriteCloseBraceIndent();
NewLine(); NewLine();
@ -414,12 +414,12 @@ namespace Cxxi.Generators.CLI
field.Visit(marshal); field.Visit(marshal);
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore))
WriteLine(marshal.Context.SupportBefore); Write(marshal.Context.SupportBefore);
WriteLine("{0} = {1};", field.Name, marshal.Context.Return); WriteLine("{0} = {1};", field.Name, marshal.Context.Return);
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportAfter)) if (!string.IsNullOrWhiteSpace(marshal.Context.SupportAfter))
WriteLine(marshal.Context.SupportAfter); Write(marshal.Context.SupportAfter);
} }
} }
@ -507,7 +507,7 @@ namespace Cxxi.Generators.CLI
param.Visit(marshal); param.Visit(marshal);
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore))
WriteLine(marshal.Context.SupportBefore); Write(marshal.Context.SupportBefore);
names.Add(marshal.Context.Return); names.Add(marshal.Context.Return);
} }
@ -689,12 +689,12 @@ namespace Cxxi.Generators.CLI
throw new Exception("Cannot marshal argument of function"); throw new Exception("Cannot marshal argument of function");
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore))
WriteLine(marshal.Context.SupportBefore); Write(marshal.Context.SupportBefore);
WriteLine("auto {0}{1} = {2};", marshal.VarPrefix, argName, marshal.Context.Return); WriteLine("auto {0}{1} = {2};", marshal.VarPrefix, argName, marshal.Context.Return);
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportAfter)) if (!string.IsNullOrWhiteSpace(marshal.Context.SupportAfter))
WriteLine(marshal.Context.SupportAfter); Write(marshal.Context.SupportAfter);
var argText = marshal.ArgumentPrefix + argName; var argText = marshal.ArgumentPrefix + argName;
return new ParamMarshal {Name = argText, Param = param}; return new ParamMarshal {Name = argText, Param = param};

Loading…
Cancel
Save