private void AddRemoteStruct(CefStructType s) { if (remoteStructs.ContainsKey(s.Name)) { return; } remoteStructs.Add(s.Name, s); foreach (var f in s.ClassBuilder.ExportFunctions) { if (!GeneratorConfig.IsBrowserProcessOnly(f.Name)) { AnalyzeSignature(f.Signature); } } foreach (var sm in s.ClassBuilder.StructMembers) { if (!GeneratorConfig.IsBrowserProcessOnly(s.Name + "::" + sm.Name)) { if (sm.MemberType.IsCefStructType) { AddRemoteStruct(sm.MemberType.AsCefStructType); } else if (sm.MemberType.IsCefStructPtrType) { AddRemoteStruct(sm.MemberType.AsCefStructPtrType.Struct); } else if (sm.MemberType.IsCefCallbackType) { AnalyzeSignature(sm.MemberType.AsCefCallbackType.Signature); } } } }
public CefCallbackType(CefStructType parent, StructCategory category, string name, CefConfigData cefConfig, Parser.SignatureData sd, ApiTypeBuilder api, CommentData comments) : base(name) { this.Parent = parent; this.Comments = comments; if (cefConfig == null) { CefConfig = new CefConfigData(); } else { CefConfig = cefConfig; } if (category == StructCategory.ApiCallbacks) { m_callMode = CfxCallMode.Callback; this.Signature = Signature.Create(SignatureType.ClientCallback, this, sd, api); } else { m_callMode = CfxCallMode.FunctionCall; this.Signature = Signature.Create(SignatureType.LibraryCall, this, sd, api); } }
public CefStructPtrPtrType(CefStructPtrType structPtr, string Indirection) : base(AddIndirection(structPtr.Name, Indirection)) { this.StructPtr = structPtr; this.Struct = structPtr.Struct; this.Indirection = Indirection; }
public CefCallbackFunction(CefStructType parent, StructCategory category, string name, CefConfigNode cefConfig, Parser.SignatureNode sd, ApiTypeBuilder api, CommentNode comments) { Name = name; this.Parent = parent; this.Comments = comments; if (cefConfig == null) { CefConfig = new CefConfigNode(); } else { CefConfig = cefConfig; } if (category == StructCategory.Client) { m_callMode = CfxCallMode.Callback; this.Signature = Signature.Create(SignatureType.ClientCallback, CefName, CefConfig, CallMode, sd, api); } else { m_callMode = CfxCallMode.FunctionCall; this.Signature = Signature.Create(SignatureType.LibraryCall, CefName, CefConfig, CallMode, sd, api); } }
protected CfxClass(CefStructType cefStruct, CommentNode comments) { CefStruct = cefStruct; OriginalSymbol = cefStruct.OriginalSymbol; CfxNativeSymbol = cefStruct.CfxNativeSymbol; CfxName = cefStruct.CfxName; ClassName = cefStruct.ClassName; ApiClassName = ClassName.Substring(3); RemoteClassName = cefStruct.RemoteClassName; Comments = comments; }
public static CfxClass Create(CefStructType cefStruct, Parser.CallbackStructNode s, ApiTypeBuilder api) { switch (cefStruct.Category) { case StructCategory.Client: return(new CfxClientClass(cefStruct, s, api)); case StructCategory.Library: return(new CfxLibraryClass(cefStruct, s, api)); default: Debug.Assert(false); throw new Exception(); } }
private void AddRemoteStruct(CefStructType s) { if (remoteStructs.ContainsKey(s.Name)) { return; } remoteStructs.Add(s.Name, s); switch (s.ClassBuilder.Category) { case StructCategory.Values: foreach (var sm in s.ClassBuilder.StructMembers) { if (!GeneratorConfig.IsBrowserProcessOnly(s.Name + "::" + sm.Name)) { if (sm.MemberType.IsCefStructType) { AddRemoteStruct(sm.MemberType.AsCefStructType); } else if (sm.MemberType.IsCefStructPtrType) { AddRemoteStruct(sm.MemberType.AsCefStructPtrType.Struct); } } } break; case StructCategory.Library: foreach (var f in s.ClassBuilder.ExportFunctions) { if (!GeneratorConfig.IsBrowserProcessOnly(f.Name)) { AnalyzeSignature(f.Signature); } } goto case StructCategory.Client; case StructCategory.Client: foreach (var cb in s.ClassBuilder.CallbackFunctions) { if (!GeneratorConfig.IsBrowserProcessOnly(s.Name + "::" + cb.Name)) { AnalyzeSignature(cb.Signature); } } break; } }
public CfxValueClass(CefStructType cefStruct, Parser.ValueStructNode sd, ApiTypeBuilder api) : base(cefStruct, sd.Comments) { var smlist = new List <StructMember>(); foreach (var smd in sd.StructMembers) { smlist.Add(new StructMember(cefStruct, Category, smd, api)); } var sm0 = smlist[0]; if (sm0.Name == "size" && sm0.MemberType.OriginalSymbol == "size_t") { smlist.RemoveAt(0); hasSizeMember = true; } StructMembers = smlist.ToArray(); }
public CfxLibraryClass(CefStructType cefStruct, Parser.StructData sd, ApiTypeBuilder api) : base(cefStruct, sd, api) { var flist = new List <CefExportFunction>(); foreach (var fd in sd.CefFunctions) { flist.Add(new CefExportFunction(cefStruct, fd, api)); } ExportFunctions = flist.ToArray(); GetCallbackFunctions(sd, api); foreach (var cb in CallbackFunctions) { var isBoolean = false; if (cb.IsPropertyGetter(ref isBoolean)) { CefCallbackFunction setter = null; foreach (var cb2 in CallbackFunctions) { if (cb2.IsPropertySetterFor(cb)) { setter = cb2; setter.Signature.ManagedArguments[1].IsPropertySetterArgument = true; break; } } var prop = new StructProperty(cb, setter, isBoolean); m_structProperties.Add(prop); } } foreach (var sm in CallbackFunctions) { if (!sm.IsProperty) { m_structFunctions.Add(sm); } } NeedsWrapFunction = true; }
public StructMember(CefStructType parent, StructCategory structCategory, Parser.StructMemberData smd, ApiTypeBuilder api) { Debug.Assert(structCategory == StructCategory.Values); Debug.Assert(smd.MemberType != null); Name = smd.Name; Comments = smd.Comments; cefConfig = smd.CefConfig; MemberType = api.GetApiType(smd.MemberType, false); if (MemberType.Name == "int" && Comments != null) { foreach (var c in Comments.Lines) { if (c.Contains("true") || c.Contains("false")) { MemberType = BooleanInteger.Convert(MemberType); } } } }
public static CfxClass Create(CefStructType cefStruct, Parser.StructData sd, ApiTypeBuilder api) { if (sd.CefConfig != null) { switch (sd.CefConfig.Source) { case "client": return(new CfxClientClass(cefStruct, sd, api)); case "library": return(new CfxLibraryClass(cefStruct, sd, api)); default: Debug.Assert(false); throw new Exception(); } } else { Debug.Assert(sd.StructMembers.Count == 1 || sd.StructMembers[1].CallbackSignature == null); return(new CfxValueClass(cefStruct, sd, api)); } }
protected CfxClass(CefStructType cefStruct, Parser.StructData sd, ApiTypeBuilder api) { CefStruct = cefStruct; OriginalSymbol = cefStruct.OriginalSymbol; CfxNativeSymbol = cefStruct.CfxNativeSymbol; CfxName = cefStruct.CfxName; ClassName = cefStruct.ClassName; ApiClassName = ClassName.Substring(3); RemoteClassName = cefStruct.RemoteClassName; Comments = sd.Comments; if (sd.CefConfig != null) { switch (sd.CefConfig.Source) { case "client": Category = StructCategory.ApiCallbacks; break; case "library": Category = StructCategory.ApiCalls; break; default: Debug.Assert(false); break; } } else { Debug.Assert(sd.StructMembers.Count == 1 || sd.StructMembers[1].CallbackSignature == null); Category = StructCategory.Values; } Debug.Assert(sd.CefFunctions.Count == 0 || Category == StructCategory.ApiCalls); }
public CfxClientClass(CefStructType cefStruct, Parser.CallbackStructNode s, ApiTypeBuilder api) : base(cefStruct, s.Comments) { GetCallbackFunctions(s, api); }
private CefApiDeclarations BuildTypes() { var structs = new List <CefStructType>(); var enums = new List <CefEnumType>(); var stringCollectionTypes = new List <StringCollectionType>(); List <CefExportFunction> stringCollectionFunctions = new List <CefExportFunction>(); List <CefExportFunction> functions = new List <CefExportFunction>(); apiTypes = new SortedDictionary <string, ApiType>(); AddType(new ApiType("void")); AddType(new CefBaseType()); AddType(new CefBasePtrType()); AddType(new CefColorType()); AddType(new CefColorRefType()); AddType(new BooleanInteger()); AddType(new BooleanIntegerOutType()); AddType(new OpaquePtrType("XDisplay")); AddType(new CefPlatformBasePtrType("cef_window_info_t*")); AddType(new CefPlatformBasePtrType("cef_main_args_t*")); AddType(new CefStringType()); AddType(new CefStringPtrType()); AddType(new CefStringUserFreeType()); NumericType.CreateAll(this); var bTypes = AssemblyResources.GetLines("BlittableTypes.txt"); foreach (var bt in bTypes) { var def = bt.Split('|'); if (def.Length == 2 && def[0].Length > 0 && def[1].Length > 0) { AddType(new BlittableType(def[0], def[1])); } } AddType(new VoidPtrPtrType()); foreach (var ed in apiData.CefEnums) { var t = new CefEnumType(ed); AddType(t); enums.Add(t); } foreach (var sd in apiData.CefStructs) { if (!apiTypes.Keys.Contains(sd.Name)) { var structName = sd.Name.Substring(0, sd.Name.Length - 2); var t = new CefStructType(structName, sd.Comments); AddType(t); structs.Add(t); } } foreach (var sd in apiData.CefStructsWindows) { var structName = sd.Name.Substring(0, sd.Name.Length - 2); var t = new CefPlatformStructType(structName, sd.Comments, CefPlatform.Windows); AddType(t); structs.Add(t); } foreach (var sd in apiData.CefStructsLinux) { var structName = sd.Name.Substring(0, sd.Name.Length - 2); var t = new CefPlatformStructType(structName, sd.Comments, CefPlatform.Linux); AddType(t); structs.Add(t); } stringCollectionTypes.Add(new CefStringListType()); stringCollectionTypes.Add(new CefStringMapType()); stringCollectionTypes.Add(new CefStringMultimapType()); foreach (var t in stringCollectionTypes) { AddType(t); } foreach (var sd in apiData.CefStructs) { var t = apiTypes[sd.Name]; if (t.IsCefStructType) { t.AsCefStructType.SetMembers(sd, this); } } foreach (var sd in apiData.CefStructsWindows) { var t = apiTypes[sd.Name.Substring(0, sd.Name.Length - 2) + "_windows"]; t.AsCefStructType.SetMembers(sd, this); } foreach (var sd in apiData.CefStructsLinux) { var t = apiTypes[sd.Name.Substring(0, sd.Name.Length - 2) + "_linux"]; t.AsCefStructType.SetMembers(sd, this); } foreach (var fd in apiData.CefStringCollectionFunctions) { stringCollectionFunctions.Add(new CefExportFunction(null, fd, this)); } foreach (var fd in apiData.CefFunctions) { var f = new CefExportFunction(null, fd, this); functions.Add(f); } if (apiData.CefFunctionsWindows.Count > 0) { System.Diagnostics.Debugger.Break(); } foreach (var fd in apiData.CefFunctionsLinux) { var f = new CefExportFunction(null, fd, this, CefPlatform.Linux); functions.Add(f); } functions.Sort(new CefExportFunction.Comparer()); structs.Sort(new ApiType.Comparer()); enums.Sort(new ApiType.Comparer()); var decl = new CefApiDeclarations(functions.ToArray(), structs.ToArray(), enums.ToArray(), stringCollectionTypes.ToArray(), stringCollectionFunctions.ToArray()); return(decl); }
public CefStructPtrType(CefStructType cefStruct, string Indirection) : base(AddIndirection(cefStruct.Name, Indirection)) { this.Struct = cefStruct; this.Indirection = Indirection; }
public CfxClientClass(CefStructType cefStruct, Parser.StructData sd, ApiTypeBuilder api) : base(cefStruct, sd, api) { GetCallbackFunctions(sd, api); }
public static CfxClass Create(CefStructType cefStruct, Parser.ValueStructNode s, ApiTypeBuilder api) { return(new CfxValueClass(cefStruct, s, api)); }