Move the version numbers from the interface of the version module into a new

implementation. Allow for release candidates to be specified and disinguished.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4260 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2009-09-28 20:10:01 +00:00
parent 3c6e8087f1
commit 7b847321a8
20 changed files with 165 additions and 89 deletions

View File

@@ -39,6 +39,7 @@ OBJS = abend.o \
strutil.o \
target.o \
tgttrans.o \
version.o \
xmalloc.o \
xsprintf.o

View File

@@ -85,6 +85,7 @@ OBJS = abend.obj \
strutil.obj \
target.obj \
tgttrans.obj \
version.obj \
wildargv.obj \
xmalloc.obj \
xsprintf.obj

82
src/common/version.c Normal file
View File

@@ -0,0 +1,82 @@
/*****************************************************************************/
/* */
/* version.c */
/* */
/* Version information for the cc65 compiler package */
/* */
/* */
/* */
/* (C) 1998-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#include "version.h"
#include "xsprintf.h"
/*****************************************************************************/
/* Data */
/*****************************************************************************/
#define VER_MAJOR 2U
#define VER_MINOR 13U
#define VER_PATCH 0U
#define VER_RC 0U
/*****************************************************************************/
/* Code */
/*****************************************************************************/
const char* GetVersionAsString (void)
/* Returns the version number as a string in a static buffer */
{
static char Buf[20];
#if defined(VER_RC) && (VER_RC > 0U)
xsnprintf (Buf, sizeof (Buf), "%u.%u.%u-rc%u", VER_MAJOR, VER_MINOR, VER_PATCH, VER_RC);
#else
xsnprintf (Buf, sizeof (Buf), "%u.%u.%u", VER_MAJOR, VER_MINOR, VER_PATCH);
#endif
return Buf;
}
unsigned GetVersionAsNumber (void)
/* Returns the version number as a combined unsigned for use in a #define */
{
return ((VER_MAJOR * 0x100) + (VER_MINOR * 0x10) + VER_PATCH);
}

View File

@@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2008, Ullrich von Bassewitz */
/* (C) 1998-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
@@ -39,16 +39,16 @@
/*****************************************************************************/
/* Data */
/* Code */
/*****************************************************************************/
#define VER_MAJOR 2U
#define VER_MINOR 12U
#define VER_PATCH 9U
const char* GetVersionAsString (void);
/* Returns the version number as a string in a static buffer */
#define VERSION ((VER_MAJOR * 0x100) + (VER_MINOR * 0x10) + VER_PATCH)
unsigned GetVersionAsNumber (void);
/* Returns the version number as a combined unsigned for use in a #define */