From 76d41e16a12cef0166144d832150d30669655229 Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sun, 14 Apr 2024 17:14:02 +0900 Subject: [PATCH] Improved stability on mips generation. --- FlashCap.V4L2Generator/Program.cs | 16 +++++++++------- FlashCap.V4L2Generator/dumper.sh | 8 +++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/FlashCap.V4L2Generator/Program.cs b/FlashCap.V4L2Generator/Program.cs index f1eab89..99a4940 100644 --- a/FlashCap.V4L2Generator/Program.cs +++ b/FlashCap.V4L2Generator/Program.cs @@ -174,7 +174,8 @@ private static void GenerateStructureDumper( string dumperFileName, string architecture, string clangVersion, - string gccVersion) + string gccVersion, + string dateTime) { var versionLabel = LoadVersionLabel(); @@ -224,7 +225,7 @@ private static void GenerateStructureDumper( tw.WriteLine($"// {versionLabel}"); tw.WriteLine($"// {clangVersion.Replace("\r", "").Replace("\n", "")}"); tw.WriteLine($"// {gccVersion.Replace("\r", "").Replace("\n", "")}"); - tw.WriteLine($"// {DateTimeOffset.Now:R}"); + tw.WriteLine($"// {dateTime}"); tw.WriteLine(); tw.WriteLine("#include "); @@ -389,7 +390,8 @@ private enum FieldTypes private static void GenerateInteropCode( string structureDumperJsonFileName, string basePath, - bool isBase) + bool isBase, + string dateTime) { var root = LoadMembersJson(structureDumperJsonFileName); if (root == null) @@ -408,7 +410,7 @@ private static void GenerateInteropCode( tw.WriteLine($"// {root.Label}"); tw.WriteLine($"// {root.ClangVersion}"); tw.WriteLine($"// {root.GccVersion}"); - tw.WriteLine($"// {DateTimeOffset.Now:R}"); + tw.WriteLine($"// {dateTime}"); tw.WriteLine(); tw.WriteLine("using System;"); @@ -668,17 +670,17 @@ public static void Main(string[] args) { case 1: Console.Write(" Generating dumper source code ..."); - GenerateStructureDumper(args[1], args[2], args[3], args[4], args[5], args[6]); + GenerateStructureDumper(args[1], args[2], args[3], args[4], args[5], args[6], args[7]); Console.WriteLine(" done."); break; case 2: Console.Write(" Generating C# source code ..."); - GenerateInteropCode(args[1], args[2], false); + GenerateInteropCode(args[1], args[2], false, args[3]); Console.WriteLine(" done."); break; case 3: Console.Write(" Generating C# base class source code ..."); - GenerateInteropCode(args[1], args[2], true); + GenerateInteropCode(args[1], args[2], true, args[3]); Console.WriteLine(" done."); break; } diff --git a/FlashCap.V4L2Generator/dumper.sh b/FlashCap.V4L2Generator/dumper.sh index 5fe6b55..2fe4a5c 100755 --- a/FlashCap.V4L2Generator/dumper.sh +++ b/FlashCap.V4L2Generator/dumper.sh @@ -11,6 +11,8 @@ Configuration=Debug; export Configuration #=============================================================== +Timestamp=`date`; export Timestamp + $Clang -v |& head -n 1 > clang_version.txt gcc -v |& tail -n 1 > gcc_version.txt @@ -18,17 +20,17 @@ echo "Step 1: Dump video2dev.h AST by Clang." $Clang -Xclang -ast-dump=json -fsyntax-only /usr/include/linux/videodev2.h > videodev2.h.ast.json echo "Step 2: Generate members dumper." -mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 1 /usr/include/linux/videodev2.h videodev2.h.ast.json videodev2.dumper.cpp `uname -m` "`cat clang_version.txt`" "`cat gcc_version.txt`" +mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 1 /usr/include/linux/videodev2.h videodev2.h.ast.json videodev2.dumper.cpp `uname -m` "`cat clang_version.txt`" "`cat gcc_version.txt`" "$Timestamp" echo "Step 3: Execute members dumper." gcc -o videodev2.dumper videodev2.dumper.cpp ./videodev2.dumper > videodev2.h.members.json echo "Step 4: Generate interop code." -mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 2 videodev2.h.members.json ../FlashCap.Core/Internal/V4L2/ +mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 2 videodev2.h.members.json ../FlashCap.Core/Internal/V4L2/ "$Timestamp" echo "Step 5: Generate base interop code." -mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 3 videodev2.h.members.json . +mono bin/$Configuration/mono/FlashCap.V4L2Generator.exe 3 videodev2.h.members.json . "$Timestamp" echo "" echo "Done, you have to check './NativeMethods_V4L2_Interop.cs' to merge manually some symbols into '../FlashCap.Core/Internal/V4L2/NativeMethods_V4L2_Interop.cs'."