private void CheckForStringOutParameters() { foreach (var f in decls.AllExportFunctions()) { CheckForStringOutParameters(f.Signature, f.Name, f.Comments.Lines); } foreach (var f in decls.StringCollectionFunctions) { CheckForStringOutParameters(f.Signature, f.Name, null); } foreach (var st in decls.CefStructTypes) { if (st.ClassBuilder.CallbackFunctions != null) { foreach (var cb in st.ClassBuilder.CallbackFunctions) { CheckForStringOutParameters(cb.Signature, st.Name + "::" + cb.Name, cb.Comments.Lines); } } } }
private void BuildFunctionPointers(GeneratedFileManager fileManager) { var b = new CodeBuilder(); var ff = new List <CefExportFunction>(decls.AllExportFunctions()); ff.AddRange(decls.StringCollectionFunctions); foreach (var f in ff) { var retSymbol = f.ReturnType.OriginalSymbol; if (f.Signature.ReturnValueIsConst) { retSymbol = "const " + retSymbol; } if (f.Platform != CefPlatform.Independent) { b.AppendLine("#ifdef CFX_" + f.Platform.ToString().ToUpperInvariant()); } b.AppendLine("static {0} (*{1}_ptr)({2});", retSymbol, f.Name, f.Signature.OriginalParameterList); if (f.Platform != CefPlatform.Independent) { b.AppendLine("#endif"); } } b.AppendLine(); b.BeginBlock("static void cfx_load_cef_function_pointers(void *libcef)"); foreach (var f in ff) { if ((f.Name != "cef_api_hash")) { if (f.Platform != CefPlatform.Independent) { b.AppendLine("#ifdef CFX_" + f.Platform.ToString().ToUpperInvariant()); } b.AppendLine("{0}_ptr = ({1} (*)({2}))cfx_platform_get_fptr(libcef, \"{0}\");", f.Name, f.ReturnType.OriginalSymbol, f.Signature.OriginalParameterListUnnamed); if (f.Platform != CefPlatform.Independent) { b.AppendLine("#endif"); } } } b.EndBlock(); b.AppendLine(); foreach (var f in ff) { if (f.Platform != CefPlatform.Independent) { b.AppendLine("#ifdef CFX_" + f.Platform.ToString().ToUpperInvariant()); } b.AppendLine("#define {0} {0}_ptr", f.Name); if (f.Platform != CefPlatform.Independent) { b.AppendLine("#endif"); } } b.AppendLine(); fileManager.WriteFileIfContentChanged("cef_function_pointers.c", b.ToString()); b.Clear(); var cfxfuncs = decls.GetCfxApiFunctionNames(); b.BeginBlock("static void* cfx_function_pointers[{0}] = ", cfxfuncs.Count()); for (var i = 0; i <= cfxfuncs.Length - 1; i++) { b.AppendLine("(void*){0},", cfxfuncs[i]); } b.EndBlock(";"); fileManager.WriteFileIfContentChanged("cfx_function_pointers.c", b.ToString()); }