diff --git a/project/msvc/generateversion.vbs b/project/msvc/generateversion.vbs
new file mode 100644
index 00000000..d5d334a3
--- /dev/null
+++ b/project/msvc/generateversion.vbs
@@ -0,0 +1,64 @@
+' VBScript to retrieve GIT "revision" and generate version.c
+' Copyright 2018 Thomas Bernard
+Set WshShell = CreateObject("WScript.Shell")
+Set FSO = CreateObject("Scripting.FileSystemObject")
+versionfile = "..\..\src\version.c"
+
+On Error Resume Next
+
+Function GetRevision()
+ GetRevision = "unknown"
+ Err.Clear
+ Set oExec = WshShell.Exec("git rev-list --count 1af8c74f53110e349d8f0d19b14599281913f71f..")
+ If Err.Number = 0 Then
+ ' Wait till the application is finished ...
+ Do While oExec.Status = 0
+ Loop
+ If oExec.ExitCode = 0 Then
+ GetRevision = oExec.StdOut.ReadLine()
+ End If
+ End If
+End Function
+
+Function GetBranch()
+ GetBranch = "unknown"
+ Err.Clear
+ Set oExec = WshShell.Exec("git rev-parse --abbrev-ref HEAD")
+ If Err.Number = 0 Then
+ ' Wait till the application is finished ...
+ Do While oExec.Status = 0
+ Loop
+ If oExec.ExitCode = 0 Then
+ GetBranch = oExec.StdOut.ReadLine()
+ End If
+ End If
+End Function
+
+GIT_REVISION = GetRevision()
+GIT_BRANCH = GetBranch()
+'Wscript.Echo "GIT_REVISION=" & GIT_REVISION & Chr(13) & Chr(10) & "GIT_BRANCH=" & GIT_BRANCH
+revision = GIT_REVISION
+If GIT_BRANCH <> "unknown" And GIT_BRANCH <> "master" Then
+ revision = revision & "-" & GIT_BRANCH
+End If
+'Wscript.Echo revision
+
+NeedWrite = True
+Err.Clear
+Set f = FSO.OpenTextFile(versionfile, 1, False) ' 1 = Read
+If Err.Number = 0 Then
+ line = f.ReadLine
+ i = InStr(line, Chr(34)) + 1
+ j = InStr(i, line, Chr(34))
+ oldrevision = Mid(line, i, j - i)
+ If revision = oldrevision Then
+ NeedWrite = False
+ End If
+ f.Close
+End If
+
+If NeedWrite Then
+ Set f = FSO.OpenTextFile(versionfile, 2, True) ' 2 = Write
+ f.WriteLine "char SVN_revision[]=" & Chr(34) & revision & Chr(34) & ";"
+ f.Close
+End If
\ No newline at end of file
diff --git a/project/msvc/generateversion.vcxproj b/project/msvc/generateversion.vcxproj
new file mode 100644
index 00000000..6596fc62
--- /dev/null
+++ b/project/msvc/generateversion.vcxproj
@@ -0,0 +1,53 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}
+ MakeFileProj
+
+
+
+ Makefile
+ true
+
+
+ Makefile
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ generateversion.vbs
+ ..\..\src\version.c
+ del ..\..\src\version.c
+ WIN32;_DEBUG;$(NMakePreprocessorDefinitions)
+
+
+ generateversion.vbs
+ ..\..\src\version.c
+ del ..\..\src\version.c
+ WIN32;NDEBUG;$(NMakePreprocessorDefinitions)
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/msvc/generateversion.vcxproj.filters b/project/msvc/generateversion.vcxproj.filters
new file mode 100644
index 00000000..e31ef889
--- /dev/null
+++ b/project/msvc/generateversion.vcxproj.filters
@@ -0,0 +1,17 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
\ No newline at end of file
diff --git a/project/msvc/grafx2.sln b/project/msvc/grafx2.sln
index c8f8c739..7694094a 100644
--- a/project/msvc/grafx2.sln
+++ b/project/msvc/grafx2.sln
@@ -2,6 +2,11 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grafx2", "grafx2.vcxproj", "{2C23F950-9403-4871-848E-7E98BE9BD565}"
+ ProjectSection(ProjectDependencies) = postProject
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552} = {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "generateversion", "generateversion.vcxproj", "{056D84A3-08C5-4A2A-A24B-D2E6D00D9552}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -13,6 +18,10 @@ Global
{2C23F950-9403-4871-848E-7E98BE9BD565}.Debug|Win32.Build.0 = Debug|Win32
{2C23F950-9403-4871-848E-7E98BE9BD565}.Release|Win32.ActiveCfg = Release|Win32
{2C23F950-9403-4871-848E-7E98BE9BD565}.Release|Win32.Build.0 = Release|Win32
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Debug|Win32.ActiveCfg = Debug|Win32
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Debug|Win32.Build.0 = Debug|Win32
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Release|Win32.ActiveCfg = Release|Win32
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/project/msvc/grafx2.vcxproj b/project/msvc/grafx2.vcxproj
index 2d2562db..8c7f29f3 100644
--- a/project/msvc/grafx2.vcxproj
+++ b/project/msvc/grafx2.vcxproj
@@ -194,6 +194,7 @@
+
diff --git a/project/msvc/grafx2.vcxproj.filters b/project/msvc/grafx2.vcxproj.filters
index f2f08cec..59d0f0cd 100644
--- a/project/msvc/grafx2.vcxproj.filters
+++ b/project/msvc/grafx2.vcxproj.filters
@@ -337,5 +337,8 @@
Fichiers sources
+
+ Fichiers sources
+
\ No newline at end of file
diff --git a/src/help.c b/src/help.c
index 486093bf..06451ded 100644
--- a/src/help.c
+++ b/src/help.c
@@ -63,10 +63,7 @@
#include "factory.h"
extern char Program_version[]; // generated in pversion.c
-extern char SVN_revision[]; // generated in pversion.c
-#ifdef _MSC_VER//TODO TEMP
-#define SVN_revision "MSC_0000"
-#endif
+extern char SVN_revision[]; // generated in version.c
// Recherche un raccourci clavier:
word * Shortcut(word shortcut_number)