private static void CompareFuncs(CppContainerList <CppFunction> functions1, CppContainerList <CppFunction> functions2) { WriteLine(Environment.NewLine); ForegroundColor = ConsoleColor.Yellow; //TODO: Add deprecated option. var f1 = functions1.Except(functions1.Where(f => f.Span.Start.File.Contains("deprecated"))); var f2 = functions2.Except(functions2.Where(f => f.Span.Start.File.Contains("deprecated"))); if (f1.Count() != f2.Count()) { System.Diagnostics.Debug.WriteLine($"function count is different. v1 has {f1.Count()}, v2 has {f2.Count()}"); } foreach (var function in f1.Where(f1 => !f2.Any(f2 => f2.Name == f1.Name))) { // functions in v1, not in v2 System.Diagnostics.Debug.WriteLine($"function {function.Name} was removed from libvlc 4"); } ForegroundColor = ConsoleColor.Green; foreach (var function in f2.Where(f2 => !f1.Any(f1 => f1.Name == f2.Name))) { // functions in v2, not in v1 System.Diagnostics.Debug.WriteLine($"function {function.Name} was added in libvlc 4"); } // functions in v2, not in v1 // for same functions, check return parameter, parameter count, parameter order, parameter type, parameter name, comment. }
private static void CompareStructFields(string structName, CppContainerList <CppField> fields1, CppContainerList <CppField> fields2) { if (fields1.Count == 0 && fields2.Count == 0) { return; } if (fields1.Count != fields2.Count) { ForegroundColor = ConsoleColor.Red; WriteLine($"{structName} {nameof(fields1)} count is {fields1.Count} in libvlc 3"); WriteLine($"{structName} {nameof(fields1)} count is {fields2.Count} in libvlc 4"); } foreach (var field in fields1.Where(f1 => !fields2.Any(f2 => f2.Name == f1.Name))) { WriteLine($"field {field.Name} is missing from v2"); // item missing in v2 } var union1 = fields1.FirstOrDefault(f1 => f1.Name == "u"); var union2 = fields2.FirstOrDefault(f2 => f2.Name == "u"); if (union1 != null && union2 != null) { CompareEventsUnion(union1, union2); } foreach (var field in fields2.Where(f2 => !fields1.Any(f1 => f1.Name == f2.Name))) { // item missing in v1 WriteLine($"field {field.Name} is missing from v1"); } //fields1.Where(s => s.Name) // type, name, visibility, comment //for (var i = 0; i < fields1.Count; i++) //{ // var f1 = fields1[i]; // var f2 = fields2[i]; //// if(f1.Type == ) // if (f1.Type.GetDisplayName() != f2.Type.GetDisplayName()) // WriteLine($"{nameof(f1.Type)} {f1.Type.GetDisplayName()} is different than {f2.Type.GetDisplayName()}"); // if(f1.Name != f2.Name) // WriteLine($"{nameof(f1.Name)} {f1.Name} is different than {f2.Name}"); // if(f1.Visibility != f2.Visibility) // WriteLine($"{nameof(f1.Visibility)} {f1.Visibility} is different than {f2.Visibility}"); // if(f1.Comment?.ChildrenToString() != f2.Comment?.ChildrenToString()) // WriteLine($"{nameof(f1.Comment)} {f1.Comment?.ChildrenToString()} is different than {f2.Comment?.ChildrenToString()}"); //} }