From 2705731775e79446507432219dc06ff1625ae6e2 Mon Sep 17 00:00:00 2001 From: Lee Thomason Date: Fri, 2 Mar 2012 09:04:53 -0800 Subject: [PATCH] add version info --- dox | 2 +- setversion.py | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++ tinyxml2.h | 3 ++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 setversion.py diff --git a/dox b/dox index ce47ff2..c9268e9 100755 --- a/dox +++ b/dox @@ -32,7 +32,7 @@ PROJECT_NAME = "TinyXML-2" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = 0.9.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/setversion.py b/setversion.py new file mode 100644 index 0000000..3455900 --- /dev/null +++ b/setversion.py @@ -0,0 +1,79 @@ +# Python program to set the version. +############################################## + +import re +import sys + +def fileProcess( name, lineFunction ): + filestream = open( name, 'r' ) + if filestream.closed: + print( "file " + name + " not open." ) + return + + output = "" + print( "--- Processing " + name + " ---------" ) + while 1: + line = filestream.readline() + if not line: break + output += lineFunction( line ) + filestream.close() + + if not output: return # basic error checking + + print( "Writing file " + name ) + filestream = open( name, "w" ); + filestream.write( output ); + filestream.close() + + +def echoInput( line ): + return line + +major = input( "Major: " ) +minor = input( "Minor: " ) +build = input( "Build: " ) + +print "Setting dox,tinyxml2.h" +print "Version: " + `major` + "." + `minor` + "." + `build` + +#### Write the tinyxml.h #### + +def engineRule( line ): + + matchMajor = "static const int TIXML2_MAJOR_VERSION" + matchMinor = "static const int TIXML2_MINOR_VERSION" + matchBuild = "static const int TIXML2_PATCH_VERSION" + + if line[0:len(matchMajor)] == matchMajor: + print "1)tinyxml2.h Major found" + return matchMajor + " = " + `major` + ";\n" + + elif line[0:len(matchMinor)] == matchMinor: + print "2)tinyxml2.h Minor found" + return matchMinor + " = " + `minor` + ";\n" + + elif line[0:len(matchBuild)] == matchBuild: + print "3)tinyxml2.h Build found" + return matchBuild + " = " + `build` + ";\n" + + else: + return line; + +fileProcess( "tinyxml2.h", engineRule ) + + +#### Write the dox #### + +def doxRule( line ): + + match = "PROJECT_NUMBER" + + if line[0:len( match )] == match: + print "dox project found" + return "PROJECT_NUMBER = " + `major` + "." + `minor` + "." + `build` + "\n" + + else: + return line; + +fileProcess( "dox", doxRule ) + diff --git a/tinyxml2.h b/tinyxml2.h index ac89e36..d1ae0d7 100644 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -84,6 +84,9 @@ distribution. #define TIXML_SSCANF sscanf #endif +static const int TIXML2_MAJOR_VERSION = 0; +static const int TIXML2_MINOR_VERSION = 9; +static const int TIXML2_PATCH_VERSION = 0; namespace tinyxml2 {