diff options
author | Sam Lantinga <slouken@libsdl.org> | 2011-02-20 10:42:51 -0800 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2011-02-20 10:42:51 -0800 |
commit | e7aaeec596f0d7115fef09d81a284def52583433 (patch) | |
tree | 951078e512a10984a8a70a84da8613377698b003 | |
parent | d5af47a5c776abeefe2c41053af22f739e75b171 (diff) |
Added a revision number for easy compile-time tests.
-rwxr-xr-x | build-scripts/updaterev.sh | 2 | ||||
-rw-r--r-- | include/SDL_revision.h | 1 | ||||
-rw-r--r-- | include/SDL_version.h | 10 | ||||
-rw-r--r-- | src/SDL.c | 7 | ||||
-rw-r--r-- | test/testver.c | 10 |
5 files changed, 26 insertions, 4 deletions
diff --git a/build-scripts/updaterev.sh b/build-scripts/updaterev.sh index a01b3343..61ae9b02 100755 --- a/build-scripts/updaterev.sh +++ b/build-scripts/updaterev.sh @@ -9,7 +9,9 @@ header=$outdir/include/SDL_revision.h rev=`sh showrev.sh 2>/dev/null` if [ "$rev" != "" -a "$rev" != "hg-0:baadf00d" ]; then + revnum=`echo $rev | sed 's,hg-\([0-9]*\).*,\1,'` echo "#define SDL_REVISION \"$rev\"" >$header.new + echo "#define SDL_REVISION_NUMBER $revnum" >>$header.new if diff $header $header.new >/dev/null 2>&1; then rm $header.new else diff --git a/include/SDL_revision.h b/include/SDL_revision.h index 5eb56f99..d70fd694 100644 --- a/include/SDL_revision.h +++ b/include/SDL_revision.h @@ -1 +1,2 @@ #define SDL_REVISION "hg-0:aaaaaaaaaaah" +#define SDL_REVISION_NUMBER 0 diff --git a/include/SDL_version.h b/include/SDL_version.h index d19f5f5c..92b55e99 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -144,6 +144,16 @@ extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); */ extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); +/** + * \brief Get the revision number of SDL that is linked against your program. + * + * Returns a number uniquely identifying the exact revision of the SDL + * library in use. It is an incrementing number based on commits to + * hg.libsdl.org. + */ +extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); + + /* Ends C function definitions when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ @@ -236,6 +236,13 @@ SDL_GetRevision(void) return SDL_REVISION; } +/* Get the library source revision number */ +int +SDL_GetRevisionNumber(void) +{ + return SDL_REVISION_NUMBER; +} + /* Get the name of the platform */ const char * SDL_GetPlatform() diff --git a/test/testver.c b/test/testver.c index 8fb098e9..aaabc546 100644 --- a/test/testver.c +++ b/test/testver.c @@ -21,11 +21,13 @@ main(int argc, char *argv[]) printf("Compiled with SDL older than 1.3\n"); #endif SDL_VERSION(&compiled); - printf("Compiled version: %d.%d.%d (%s)\n", - compiled.major, compiled.minor, compiled.patch, SDL_REVISION); + printf("Compiled version: %d.%d.%d.%d (%s)\n", + compiled.major, compiled.minor, compiled.patch, + SDL_REVISION_NUMBER, SDL_REVISION); SDL_GetVersion(&linked); - printf("Linked version: %d.%d.%d (%s)\n", - linked.major, linked.minor, linked.patch, SDL_GetRevision()); + printf("Linked version: %d.%d.%d.%d (%s)\n", + linked.major, linked.minor, linked.patch, + SDL_GetRevisionNumber(), SDL_GetRevision()); SDL_Quit(); return (0); } |