protected override void EmitApiDeclarations(CodeBuilder b) { b.AppendComment("static {0}* {1}_ctor()", OriginalSymbol, CfxName); b.AppendLine("public static cfx_ctor_delegate {0}_ctor;", CfxName); b.AppendComment("static void {1}_dtor({0}* ptr)", OriginalSymbol, CfxName); b.AppendLine("public static cfx_dtor_delegate {0}_dtor;", CfxName); b.AppendLine(); foreach (var sm in StructMembers) { b.AppendComment("static void {0}_set_{1}({2} *self, {3})", CfxName, sm.Name, CefStruct.OriginalSymbol, sm.MemberType.NativeCallParameter(sm.Name, false)); b.AppendLine("[UnmanagedFunctionPointer(CallingConvention.Cdecl, SetLastError = false)]"); b.AppendLine("public delegate void {0}_set_{1}_delegate(IntPtr self, {2});", CfxName, sm.Name, sm.MemberType.PInvokeCallParameter(sm.Name)); b.AppendLine("public static {0}_set_{1}_delegate {0}_set_{1};", CfxName, sm.Name); b.AppendComment("static void {0}_get_{1}({2} *self, {3})", CfxName, sm.Name, CefStruct.OriginalSymbol, sm.MemberType.NativeOutSignature(sm.Name)); b.AppendLine("[UnmanagedFunctionPointer(CallingConvention.Cdecl, SetLastError = false)]"); b.AppendLine("public delegate void {0}_get_{1}_delegate(IntPtr self, {2});", CfxName, sm.Name, sm.MemberType.PInvokeOutSignature(sm.Name)); b.AppendLine("public static {0}_get_{1}_delegate {0}_get_{1};", CfxName, sm.Name); b.AppendLine(); } }
public void EmitNativeFunction(CodeBuilder b) { b.AppendComment(this.ToString()); if (Platform != CefPlatform.Independent) { b.AppendLine("#ifdef CFX_" + Platform.ToString().ToUpperInvariant()); } b.BeginBlock(Signature.NativeFunctionHeader(CfxName)); Signature.EmitNativeCall(b, Name); b.EndBlock(); if (Platform != CefPlatform.Independent) { b.AppendLine("#else"); b.AppendLine("#define {0} 0", CfxName); b.AppendLine("#endif"); } }
protected override void EmitApiDeclarations(CodeBuilder b) { if (ExportFunctions.Length > 0) { foreach (var f in this.ExportFunctions) { f.EmitPInvokeDeclaration(b); } b.AppendLine(); } foreach (var cb in CallbackFunctions) { b.AppendComment(cb.Signature.NativeFunctionHeader(CfxName + "_" + cb.Name)); CodeSnippets.EmitPInvokeDelegate(b, CfxName + "_" + cb.Name, cb.Signature); b.AppendLine(); } }
public override void EmitNativeWrapper(CodeBuilder b) { b.AppendComment(CefStruct.Name); b.AppendLine(); foreach (var f in ExportFunctions) { f.EmitNativeFunction(b); } foreach (var cb in CallbackFunctions) { b.AppendLine("// {0}", cb); b.BeginBlock(cb.Signature.NativeFunctionHeader(CfxName + "_" + cb.Name)); cb.Signature.EmitNativeCall(b, "self->" + cb.Name); b.EndBlock(); b.AppendLine(); } b.AppendLine(); }
public void WriteFileIfContentChanged(string filename, string content) { if (directoryPath == null) { return; } var filepath = Path.Combine(directoryPath, filename); if (newFiles.Contains(filepath)) { System.Diagnostics.Debugger.Break(); } var b = new CodeBuilder(); b.AppendLine(licenseStub); b.AppendComment("Generated file. Do not edit."); b.AppendLine(); b.AppendLine(); b.Append(content); content = b.ToString(); var oldcontent = string.Empty; if (oldFiles.Contains(filepath)) { oldcontent = File.ReadAllText(filepath); oldFiles.Remove(filepath); } if (!content.Equals(oldcontent)) { File.WriteAllText(filepath, content); } newFiles.Add(filepath); }
public void EmitRemoteClient(CodeBuilder b) { b.BeginClass(ClassName + "RemoteClient", "internal static"); b.AppendLine(); b.BeginBlock("static {0}RemoteClient()", ClassName); foreach (var sm in RemoteCallbackFunctions) { b.AppendLine("{0}_native = {0};", sm.Name); } foreach (var sm in RemoteCallbackFunctions) { b.AppendLine("{0}_native_ptr = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate({0}_native);", sm.Name); } b.EndBlock(); b.AppendLine(); b.BeginBlock("internal static void SetCallback(IntPtr self, int index, bool active)"); b.BeginBlock("switch(index)"); foreach (var cb in RemoteCallbackFunctions) { b.AppendLine("case {0}:", cb.ClientCallbackIndex); b.IncreaseIndent(); b.AppendLine("CfxApi.{0}.{1}_set_callback(self, index, active ? {2}_native_ptr : IntPtr.Zero);", ApiClassName, CfxName, cb.Name); b.AppendLine("break;"); b.DecreaseIndent(); } b.EndBlock(); b.EndBlock(); b.AppendLine(); foreach (var cb in RemoteCallbackFunctions) { var sig = cb.Signature; b.AppendComment(cb.ToString()); CodeSnippets.EmitPInvokeCallbackDelegate(b, cb.Name, cb.Signature); b.AppendLine("private static {0}_delegate {0}_native;", cb.Name); b.AppendLine("private static IntPtr {0}_native_ptr;", cb.Name); b.AppendLine(); var inArgumentList = new List <string>(); foreach (var arg in sig.Parameters) { if (!arg.IsThisArgument) { foreach (var pm in arg.ParameterType.RemoteCallbackParameterList(arg.VarName)) { if (!pm.StartsWith("out ")) { inArgumentList.Add(pm.Substring(pm.LastIndexOf(' ') + 1)); } } } } b.BeginFunction(cb.Name, "void", sig.PInvokeParameterList, "internal static"); b.AppendLine("var call = new {0}RemoteEventCall();", cb.RemoteCallName); b.AppendLine("call.gcHandlePtr = gcHandlePtr;"); foreach (var pm in inArgumentList) { b.AppendLine("call.{0} = {0};", pm); } b.AppendLine("call.RequestExecution();"); foreach (var arg in sig.Parameters) { if (!arg.IsThisArgument) { arg.ParameterType.EmitPostRemoteCallbackStatements(b, arg.VarName); } } if (!sig.ReturnType.IsVoid) { b.AppendLine("__retval = call.__retval;"); } //sig.EmitPostPublicEventHandlerCallStatements(b); b.EndBlock(); b.AppendLine(); } b.EndBlock(); }
public override void EmitNativeWrapper(CodeBuilder b) { b.AppendComment(CefStruct.Name); b.AppendLine(); b.BeginBlock("typedef struct _{0}", CfxNativeSymbol); b.AppendLine("{0} {1};", OriginalSymbol, CefStruct.Name); b.AppendLine("unsigned int ref_count;"); b.AppendLine("gc_handle_t gc_handle;"); b.AppendLine("int wrapper_kind;"); b.AppendLine("// managed callbacks"); foreach (var cb in CallbackFunctions) { b.AppendLine("void (CEF_CALLBACK *{0})({1});", cb.Name, cb.Signature.NativeParameterList); } b.EndBlock("{0};", CfxNativeSymbol); b.AppendLine(); b.BeginBlock("void CEF_CALLBACK _{0}_add_ref(struct _cef_base_ref_counted_t* base)", CfxName); if (GeneratorConfig.UseStrongHandleFor(CefStruct.Name)) { b.AppendLine("int count = InterlockedIncrement(&(({0}*)base)->ref_count);", CfxNativeSymbol); b.BeginIf("count == 2"); b.BeginIf("(({0}*)base)->wrapper_kind == 0", CfxNativeSymbol); b.AppendLine("cfx_gc_handle_switch(&(({0}*)base)->gc_handle, GC_HANDLE_UPGRADE);", CfxNativeSymbol); b.BeginElse(); b.AppendLine("cfx_gc_handle_switch(&(({0}*)base)->gc_handle, GC_HANDLE_UPGRADE | GC_HANDLE_REMOTE);", CfxNativeSymbol); b.EndBlock(); b.EndBlock(); } else { b.AppendLine("InterlockedIncrement(&(({0}*)base)->ref_count);", CfxNativeSymbol); } b.EndBlock(); b.BeginBlock("int CEF_CALLBACK _{0}_release(struct _cef_base_ref_counted_t* base)", CfxName); b.AppendLine("int count = InterlockedDecrement(&(({0}*)base)->ref_count);", CfxNativeSymbol); b.BeginIf("count == 0"); b.BeginIf("(({0}*)base)->wrapper_kind == 0", CfxNativeSymbol); b.AppendLine("cfx_gc_handle_switch(&(({0}*)base)->gc_handle, GC_HANDLE_FREE);", CfxNativeSymbol); b.BeginElse(); b.AppendLine("cfx_gc_handle_switch(&(({0}*)base)->gc_handle, GC_HANDLE_FREE | GC_HANDLE_REMOTE);", CfxNativeSymbol); b.EndBlock(); b.AppendLine("free(base);"); b.AppendLine("return 1;"); b.EndBlock(); if (GeneratorConfig.UseStrongHandleFor(CefStruct.Name)) { b.BeginIf("count == 1"); b.BeginIf("(({0}*)base)->wrapper_kind == 0", CfxNativeSymbol); b.AppendLine("cfx_gc_handle_switch(&(({0}*)base)->gc_handle, GC_HANDLE_DOWNGRADE);", CfxNativeSymbol); b.BeginElse(); b.AppendLine("cfx_gc_handle_switch(&(({0}*)base)->gc_handle, GC_HANDLE_DOWNGRADE | GC_HANDLE_REMOTE);", CfxNativeSymbol); b.EndBlock(); b.EndBlock(); } b.AppendLine("return 0;"); b.EndBlock(); b.BeginBlock("int CEF_CALLBACK _{0}_has_one_ref(struct _cef_base_ref_counted_t* base)", CfxName); b.AppendLine("return (({0}*)base)->ref_count == 1 ? 1 : 0;", CfxNativeSymbol); b.EndBlock(); b.AppendLine(); b.BeginBlock("static {0}* {1}_ctor(gc_handle_t gc_handle, int wrapper_kind)", CfxNativeSymbol, CfxName); b.AppendLine("{0}* ptr = ({0}*)calloc(1, sizeof({0}));", CfxNativeSymbol); b.AppendLine("if(!ptr) return 0;"); b.AppendLine("ptr->{0}.base.size = sizeof({1});", CefStruct.Name, OriginalSymbol); b.AppendLine("ptr->{0}.base.add_ref = _{1}_add_ref;", CefStruct.Name, CfxName); b.AppendLine("ptr->{0}.base.release = _{1}_release;", CefStruct.Name, CfxName); b.AppendLine("ptr->{0}.base.has_one_ref = _{1}_has_one_ref;", CefStruct.Name, CfxName); b.AppendLine("ptr->ref_count = 1;"); b.AppendLine("ptr->gc_handle = gc_handle;"); b.AppendLine("ptr->wrapper_kind = wrapper_kind;"); b.AppendLine("return ptr;"); b.EndBlock(); b.AppendLine(); if (NeedsWrapFunction) { b.BeginBlock("static gc_handle_t {0}_get_gc_handle({1}* self)", CfxName, CfxNativeSymbol); b.AppendLine("return self->gc_handle;"); b.EndBlock(); b.AppendLine(); } foreach (var cb in CallbackFunctions) { b.AppendLine("// {0}", cb); b.AppendLine(); b.BeginBlock("{0} CEF_CALLBACK {1}({2})", cb.NativeReturnType.OriginalSymbol, cb.NativeCallbackName, cb.Signature.OriginalParameterList); if (!cb.NativeReturnType.IsVoid) { cb.NativeReturnType.EmitNativeCallbackReturnValueFields(b); } foreach (var arg in cb.Signature.Parameters) { arg.EmitPreNativeCallbackStatements(b); } b.AppendLine("(({0}_t*)self)->{1}({2});", CfxName, cb.Name, cb.Signature.NativeArgumentList); foreach (var arg in cb.Signature.Parameters) { arg.EmitPostNativeCallbackStatements(b); } cb.NativeReturnType.EmitNativeCallbackReturnStatements(b); b.EndBlock(); b.AppendLine(); } b.BeginBlock("static void {0}_set_callback({1}* self, int index, void* callback)", CfxName, OriginalSymbol); b.BeginBlock("switch(index)"); var index = 0; foreach (var cb in CallbackFunctions) { b.DecreaseIndent(); b.AppendLine("case {0}:", index); b.IncreaseIndent(); b.AppendLine("(({0}_t*)self)->{1} = (void (CEF_CALLBACK *)({2}))callback;", CfxName, cb.Name, cb.Signature.NativeParameterList); b.AppendLine("self->{0} = callback ? {1} : 0;", cb.Name, cb.NativeCallbackName); b.AppendLine("break;"); cb.ClientCallbackIndex = index; index += 1; } b.EndBlock(); b.EndBlock(); b.AppendLine(); }
public override void EmitPublicClass(CodeBuilder b) { b.AppendLine("using Event;"); b.AppendLine(); b.AppendSummaryAndRemarks(Comments, false, true); b.BeginClass(ClassName + " : CfxBaseClient", GeneratorConfig.ClassModifiers(ClassName)); b.AppendLine(); if (NeedsWrapFunction) { b.BeginFunction("Wrap", ClassName, "IntPtr nativePtr", "internal static"); b.AppendLine("if(nativePtr == IntPtr.Zero) return null;"); b.AppendLine("var handlePtr = CfxApi.{0}.{1}_get_gc_handle(nativePtr);", ApiClassName, CfxName); b.AppendLine("return ({0})System.Runtime.InteropServices.GCHandle.FromIntPtr(handlePtr).Target;", ClassName); b.EndBlock(); b.AppendLine(); b.AppendLine(); } b.AppendLine("private static object eventLock = new object();"); b.AppendLine(); b.BeginBlock("internal static void SetNativeCallbacks()"); foreach (var sm in CallbackFunctions) { b.AppendLine("{0}_native = {0};", sm.Name); } b.AppendLine(); foreach (var sm in CallbackFunctions) { b.AppendLine("{0}_native_ptr = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate({0}_native);", sm.Name); } b.EndBlock(); b.AppendLine(); foreach (var cb in CallbackFunctions) { var sig = cb.Signature; b.AppendComment(cb.ToString()); CodeSnippets.EmitPInvokeCallbackDelegate(b, cb.Name, cb.Signature); b.AppendLine("private static {0}_delegate {0}_native;", cb.Name); b.AppendLine("private static IntPtr {0}_native_ptr;", cb.Name); b.AppendLine(); b.BeginFunction(cb.Name, "void", sig.PInvokeParameterList, "internal static"); //b.AppendLine("var handle = System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr);") b.AppendLine("var self = ({0})System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target;", ClassName); b.BeginIf("self == null || self.CallbacksDisabled"); if (!sig.ReturnType.IsVoid) { sig.ReturnType.EmitSetCallbackReturnValueToDefaultStatements(b); } foreach (var arg in sig.Parameters) { if (!arg.IsThisArgument) { arg.ParameterType.EmitSetCallbackArgumentToDefaultStatements(b, arg.VarName); } } b.AppendLine("return;"); b.EndBlock(); b.AppendLine("var e = new {0}();", cb.PublicEventArgsClassName); for (var i = 1; i <= sig.ManagedParameters.Count() - 1; i++) { if (sig.ManagedParameters[i].ParameterType.IsIn) { sig.ManagedParameters[i].EmitPublicEventFieldInitializers(b); } } b.AppendLine("self.m_{0}?.Invoke(self, e);", cb.PublicName); b.AppendLine("e.m_isInvalid = true;"); for (var i = 1; i <= sig.ManagedParameters.Count() - 1; i++) { sig.ManagedParameters[i].EmitPostPublicRaiseEventStatements(b); } sig.EmitPostPublicEventHandlerReturnValueStatements(b); b.EndBlock(); b.AppendLine(); } if (NeedsWrapFunction) { b.AppendLine("internal {0}(IntPtr nativePtr) : base(nativePtr) {{}}", ClassName); } b.AppendLine("public {0}() : base(CfxApi.{1}.{2}_ctor) {{}}", ClassName, ApiClassName, CfxName); b.AppendLine(); var cbIndex = 0; foreach (var cb in CallbackFunctions) { EmitPublicEvent(b, cbIndex, cb); b.AppendLine(); cbIndex += 1; } var onlyBasicEvents = true; b.BeginFunction("OnDispose", "void", "IntPtr nativePtr", "internal override"); cbIndex = 0; foreach (var cb in CallbackFunctions) { onlyBasicEvents &= cb.IsBasicEvent; b.BeginIf("m_{0} != null", cb.PublicName); b.AppendLine("m_{0} = null;", cb.PublicName); b.AppendLine("CfxApi.{0}.{1}_set_callback(NativePtr, {2}, IntPtr.Zero);", ApiClassName, CfxName, cbIndex); b.EndBlock(); cbIndex += 1; } b.AppendLine("base.OnDispose(nativePtr);"); b.EndBlock(); b.EndBlock(); if (!onlyBasicEvents) { b.AppendLine(); b.AppendLine(); b.BeginBlock("namespace Event"); b.AppendLine(); foreach (var cb in CallbackFunctions) { EmitPublicEventArgsAndHandler(b, cb); b.AppendLine(); } b.EndBlock(); } }
public override void EmitNativeCallbackReturnStatements(CodeBuilder b, string var) { b.AppendComment("TODO: possible race with managed GC?"); base.EmitNativeCallbackReturnStatements(b, var); }
private void BuildPInvokeApi(GeneratedFileManager fileManager) { var b = new CodeBuilder(); b.AppendLine("using System.Runtime.InteropServices;"); b.AppendLine(); b.BeginCfxNamespace(); b.BeginClass("CfxApi", "internal partial"); b.AppendLine(); b.AppendComment("global cef export functions"); b.AppendLine(); foreach (var f in decls.ExportFunctions) { f.EmitPInvokeDeclaration(b); } b.AppendLine(); foreach (var f in decls.StringCollectionFunctions) { f.EmitPInvokeDeclaration(b); } b.AppendLine(); b.AppendLine(); foreach (var t in decls.CefStructTypes) { t.ClassBuilder.EmitApiDeclarations(b); b.AppendLine(); } b.EndBlock(); b.EndBlock(); fileManager.WriteFileIfContentChanged("CfxApi.cs", b.ToString()); b.Clear(); var cfxfuncs = decls.GetCfxApiFunctionNames(); b.BeginCfxNamespace(); b.BeginClass("CfxApiLoader", "internal partial"); b.BeginBlock("internal enum FunctionIndex"); foreach (var f in cfxfuncs) { b.AppendLine(f + ","); } b.EndBlock(); b.AppendLine(); b.BeginFunction("void LoadCfxRuntimeApi()", "internal static"); foreach (var f in decls.ExportFunctions) { if (f.Platform != CefPlatform.Independent) { b.BeginIf("CfxApi.PlatformOS == CfxPlatformOS.{0}", f.Platform.ToString()); } CodeSnippets.EmitPInvokeDelegateInitialization(b, f.CfxName); if (f.Platform != CefPlatform.Independent) { b.EndBlock(); } } b.EndBlock(); b.AppendLine(); b.BeginFunction("void LoadStringCollectionApi()", "internal static"); b.AppendLine("CfxApi.Probe();"); foreach (var f in decls.StringCollectionFunctions) { CodeSnippets.EmitPInvokeDelegateInitialization(b, f.CfxName); } b.EndBlock(); b.AppendLine(); foreach (var cefStruct in decls.CefStructTypes) { b.AppendLine("private static bool {0}ApiLoaded;", cefStruct.ClassName); b.BeginBlock("internal static void Load{0}Api()", cefStruct.ClassName); b.AppendLine("if({0}ApiLoaded) return;", cefStruct.ClassName); b.AppendLine("{0}ApiLoaded = true;", cefStruct.ClassName); b.AppendLine("CfxApi.Probe();"); switch (cefStruct.ClassBuilder.Category) { case StructCategory.ApiCalls: if (cefStruct.ClassBuilder.ExportFunctions.Count() > 0) { foreach (var f in cefStruct.ClassBuilder.ExportFunctions) { CodeSnippets.EmitPInvokeDelegateInitialization(b, f.CfxName); } } foreach (var sm in cefStruct.ClassBuilder.StructMembers) { if (sm.MemberType.IsCefCallbackType) { CodeSnippets.EmitPInvokeDelegateInitialization(b, cefStruct.CfxName + "_" + sm.Name); } } break; case StructCategory.ApiCallbacks: b.AppendLine("CfxApi.{0}_ctor = (CfxApi.cfx_ctor_with_gc_handle_delegate)CfxApi.GetDelegate(FunctionIndex.{0}_ctor, typeof(CfxApi.cfx_ctor_with_gc_handle_delegate));", cefStruct.CfxName); b.AppendLine("CfxApi.{0}_get_gc_handle = (CfxApi.cfx_get_gc_handle_delegate)CfxApi.GetDelegate(FunctionIndex.{0}_get_gc_handle, typeof(CfxApi.cfx_get_gc_handle_delegate));", cefStruct.CfxName); b.AppendLine("CfxApi.{0}_set_managed_callback = (CfxApi.cfx_set_callback_delegate)CfxApi.GetDelegate(FunctionIndex.{0}_set_managed_callback, typeof(CfxApi.cfx_set_callback_delegate));", cefStruct.CfxName); if (cefStruct.ClassBuilder.ExportFunctions.Count() > 0) { System.Diagnostics.Debugger.Break(); } break; case StructCategory.Values: b.AppendLine("CfxApi.{0}_ctor = (CfxApi.cfx_ctor_delegate)CfxApi.GetDelegate(FunctionIndex.{0}_ctor, typeof(CfxApi.cfx_ctor_delegate));", cefStruct.CfxName); b.AppendLine("CfxApi.{0}_dtor = (CfxApi.cfx_dtor_delegate)CfxApi.GetDelegate(FunctionIndex.{0}_dtor, typeof(CfxApi.cfx_dtor_delegate));", cefStruct.CfxName); foreach (var sm in cefStruct.ClassBuilder.StructMembers) { if (sm.Name != "size") { CodeSnippets.EmitPInvokeDelegateInitialization(b, cefStruct.CfxName + "_set_" + sm.Name); CodeSnippets.EmitPInvokeDelegateInitialization(b, cefStruct.CfxName + "_get_" + sm.Name); } } if (cefStruct.ClassBuilder.ExportFunctions.Count() > 0) { System.Diagnostics.Debugger.Break(); } break; } b.EndBlock(); b.AppendLine(); } b.EndBlock(); b.EndBlock(); fileManager.WriteFileIfContentChanged("CfxApiLoader.cs", b.ToString()); }
public void EmitPInvokeDeclaration(CodeBuilder b) { b.AppendComment(this.ToString()); CodeSnippets.EmitPInvokeDelegate(b, CfxName, Signature); }
public override void EmitNativeWrapper(CodeBuilder b) { b.AppendComment(CefStruct.Name); b.AppendLine(); if (CefStruct.IsCefPlatformStructType) { b.AppendLine("#ifdef CFX_" + CefStruct.AsCefPlatformStructType.Platform.ToString().ToUpper()); b.AppendLine(); } b.BeginBlock("static {0}* {1}_ctor()", OriginalSymbol, CfxName); if (hasSizeMember) { b.AppendLine("{0}* self = ({0}*)calloc(1, sizeof({0}));", OriginalSymbol); b.AppendLine("if(!self) return 0;"); b.AppendLine("self->size = sizeof({0});", OriginalSymbol); b.AppendLine("return self;"); } else { b.AppendLine("return ({0}*)calloc(1, sizeof({0}));", OriginalSymbol); } b.EndBlock(); b.AppendLine(); b.BeginBlock("static void {1}_dtor({0}* self)", OriginalSymbol, CfxName); foreach (var sm in StructMembers) { sm.MemberType.EmitNativeValueStructDtorStatements(b, sm.Name); } b.AppendLine("free(self);", OriginalSymbol); b.EndBlock(); b.AppendLine(); foreach (var sm in StructMembers) { b.AppendComment("{0}->{1}", CefStruct.OriginalSymbol, sm.Name); b.BeginBlock("static void {0}_set_{1}({2} *self, {3})", CfxName, sm.Name, CefStruct.OriginalSymbol, sm.MemberType.NativeCallParameter(sm.Name, false)); sm.MemberType.EmitAssignToNativeStructMember(b, sm.Name); b.EndBlock(); b.BeginBlock("static void {0}_get_{1}({2} *self, {3})", CfxName, sm.Name, CefStruct.OriginalSymbol, sm.MemberType.NativeOutSignature(sm.Name)); sm.MemberType.EmitAssignFromNativeStructMember(b, sm.Name); b.EndBlock(); b.AppendLine(); } if (CefStruct.IsCefPlatformStructType) { b.AppendLine("#else //ifdef CFX_" + CefStruct.AsCefPlatformStructType.Platform.ToString().ToUpper()); b.AppendLine("#define {0}_ctor 0", CfxName); b.AppendLine("#define {0}_dtor 0", CfxName); foreach (var sm in StructMembers) { b.AppendLine("#define {0}_set_{1} 0", CfxName, sm.Name, CefStruct.OriginalSymbol, sm.MemberType.NativeCallParameter(sm.Name, false)); b.AppendLine("#define {0}_get_{1} 0", CfxName, sm.Name, CefStruct.OriginalSymbol, sm.MemberType.NativeOutSignature(sm.Name)); } b.AppendLine("#endif //ifdef CFX_" + CefStruct.AsCefPlatformStructType.Platform.ToString().ToUpper()); b.AppendLine(); } b.AppendLine(); }