From: uz Date: Mon, 28 Sep 2009 20:10:01 +0000 (+0000) Subject: Move the version numbers from the interface of the version module into a new X-Git-Tag: V2.13.0rc2~17 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7b847321a8020038c91df45e5e57cfd4466204c9;p=cc65 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 --- diff --git a/src/ar65/main.c b/src/ar65/main.c index 13c54c642..5877520de 100644 --- a/src/ar65/main.c +++ b/src/ar65/main.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstraße 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (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 */ @@ -121,8 +121,8 @@ int main (int argc, char* argv []) case 'V': fprintf (stderr, - "ar65 V%u.%u.%u - (C) Copyright 1998-2003 Ullrich von Bassewitz\n", - VER_MAJOR, VER_MINOR, VER_PATCH); + "ar65 V%s - (C) Copyright 1998-2009 Ullrich von Bassewitz\n", + GetVersionAsString ()); break; default: diff --git a/src/ca65/expr.c b/src/ca65/expr.c index bb2aac50a..cbca98ee3 100644 --- a/src/ca65/expr.c +++ b/src/ca65/expr.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998-2008 Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (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 */ @@ -945,7 +945,7 @@ static ExprNode* Factor (void) break; case TOK_VERSION: - N = GenLiteralExpr (VERSION); + N = GenLiteralExpr (GetVersionAsNumber ()); NextTok (); break; diff --git a/src/ca65/listing.c b/src/ca65/listing.c index 37dbcd2c9..425bf91d7 100644 --- a/src/ca65/listing.c +++ b/src/ca65/listing.c @@ -224,12 +224,11 @@ static void PrintPageHeader (FILE* F, const ListLine* L) /* Print the header on the new page */ fprintf (F, - "ca65 V%u.%u.%u - %s\n" + "ca65 V%s - %s\n" "Main file : %s\n" "Current file: %.*s\n" "\n", - VER_MAJOR, VER_MINOR, VER_PATCH, - Copyright, + GetVersionAsString (), Copyright, InFile, (int) SB_GetLen (CurFile), SB_GetConstBuf (CurFile)); diff --git a/src/ca65/main.c b/src/ca65/main.c index 3ec6c16a3..911be7315 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -132,7 +132,7 @@ static void SetOptions (void) StrBuf Buf = STATIC_STRBUF_INITIALIZER; /* Set the translator */ - SB_Printf (&Buf, "ca65 V%u.%u.%u", VER_MAJOR, VER_MINOR, VER_PATCH); + SB_Printf (&Buf, "ca65 V%s", GetVersionAsString ()); OptTranslator (&Buf); /* Set date and time */ @@ -521,9 +521,7 @@ static void OptVersion (const char* Opt attribute ((unused)), const char* Arg attribute ((unused))) /* Print the assembler version */ { - fprintf (stderr, - "ca65 V%u.%u.%u - %s\n", - VER_MAJOR, VER_MINOR, VER_PATCH, Copyright); + fprintf (stderr, "ca65 V%s - %s\n", GetVersionAsString (), Copyright); } diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index abb8a6ec4..2feb273f4 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998-2009 Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (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 */ @@ -151,13 +151,12 @@ void g_preamble (void) /* Identify the compiler version */ AddTextLine (";"); - AddTextLine ("; File generated by cc65 v %u.%u.%u", - VER_MAJOR, VER_MINOR, VER_PATCH); + AddTextLine ("; File generated by cc65 v %s", GetVersionAsString ()); AddTextLine (";"); /* Insert some object file options */ - AddTextLine ("\t.fopt\t\tcompiler,\"cc65 v %u.%u.%u\"", - VER_MAJOR, VER_MINOR, VER_PATCH); + AddTextLine ("\t.fopt\t\tcompiler,\"cc65 v %s\"", + GetVersionAsString ()); /* If we're producing code for some other CPU, switch the command set */ switch (CPU) { diff --git a/src/cc65/compile.c b/src/cc65/compile.c index 9e2f23fce..6429e09f7 100644 --- a/src/cc65/compile.c +++ b/src/cc65/compile.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000-2009 Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2000-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -300,7 +300,7 @@ void Compile (const char* FileName) }; /* Add macros that are always defined */ - DefineNumericMacro ("__CC65__", VERSION); + DefineNumericMacro ("__CC65__", GetVersionAsNumber ()); /* Language standard that is supported */ DefineNumericMacro ("__CC65_STD_C89__", STD_C89); diff --git a/src/cc65/main.c b/src/cc65/main.c index dc51736e5..343e2a4c6 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -667,9 +667,8 @@ static void OptVersion (const char* Opt attribute ((unused)), /* Print the compiler version */ { fprintf (stderr, - "cc65 V%u.%u.%u\n" - "SVN version: %s\n", - VER_MAJOR, VER_MINOR, VER_PATCH, SVNVersion); + "cc65 V%s\nSVN version: %s\n", + GetVersionAsString (), SVNVersion); exit (EXIT_SUCCESS); } diff --git a/src/cl65/main.c b/src/cl65/main.c index 78dcea63f..bd3a3064b 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -1128,8 +1128,8 @@ static void OptVersion (const char* Opt attribute ((unused)), /* Print version number */ { fprintf (stderr, - "cl65 V%u.%u.%u - (C) Copyright 1998-2005 Ullrich von Bassewitz\n", - VER_MAJOR, VER_MINOR, VER_PATCH); + "cl65 V%s - (C) Copyright 1998-2009 Ullrich von Bassewitz\n", + GetVersionAsString ()); } diff --git a/src/co65/convert.c b/src/co65/convert.c index ef05b6ba0..6b60f86de 100644 --- a/src/co65/convert.c +++ b/src/co65/convert.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2003-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -454,8 +454,8 @@ void Convert (const O65Data* D) } /* Create a header */ - fprintf (F, ";\n; File generated by co65 v %u.%u.%u using model `%s'\n;\n", - VER_MAJOR, VER_MINOR, VER_PATCH, GetModelName (Model)); + fprintf (F, ";\n; File generated by co65 v %s using model `%s'\n;\n", + GetVersionAsString (), GetModelName (Model)); /* Select the CPU */ if ((D->Header.mode & O65_CPU_MASK) == O65_CPU_65816) { @@ -463,8 +463,7 @@ void Convert (const O65Data* D) } /* Object file options */ - fprintf (F, ".fopt\t\tcompiler,\"co65 v %u.%u.%u\"\n", - VER_MAJOR, VER_MINOR, VER_PATCH); + fprintf (F, ".fopt\t\tcompiler,\"co65 v %s\"\n", GetVersionAsString ()); if (Author) { fprintf (F, ".fopt\t\tauthor, \"%s\"\n", Author); xfree (Author); diff --git a/src/co65/main.c b/src/co65/main.c index b565c526e..fe7ba8c7a 100644 --- a/src/co65/main.c +++ b/src/co65/main.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2003-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -264,8 +264,8 @@ static void OptVersion (const char* Opt attribute ((unused)), /* Print the assembler version */ { fprintf (stderr, - "co65 V%u.%u.%u - (C) Copyright 1998-2003 Ullrich von Bassewitz\n", - VER_MAJOR, VER_MINOR, VER_PATCH); + "co65 V%s - (C) Copyright 1998-2009 Ullrich von Bassewitz\n", + GetVersionAsString ()); } diff --git a/src/common/make/gcc.mak b/src/common/make/gcc.mak index f2118253e..4c4064087 100644 --- a/src/common/make/gcc.mak +++ b/src/common/make/gcc.mak @@ -39,6 +39,7 @@ OBJS = abend.o \ strutil.o \ target.o \ tgttrans.o \ + version.o \ xmalloc.o \ xsprintf.o diff --git a/src/common/make/watcom.mak b/src/common/make/watcom.mak index f4d5b3b90..f7a195f80 100644 --- a/src/common/make/watcom.mak +++ b/src/common/make/watcom.mak @@ -85,6 +85,7 @@ OBJS = abend.obj \ strutil.obj \ target.obj \ tgttrans.obj \ + version.obj \ wildargv.obj \ xmalloc.obj \ xsprintf.obj diff --git a/src/common/version.c b/src/common/version.c new file mode 100644 index 000000000..da5060e5e --- /dev/null +++ b/src/common/version.c @@ -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); +} + + + diff --git a/src/common/version.h b/src/common/version.h index 0ab0becd2..0039b2a60 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -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 */ diff --git a/src/da65/main.c b/src/da65/main.c index 6cc5e459f..aa48629ba 100644 --- a/src/da65/main.c +++ b/src/da65/main.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998-2007 Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (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 */ @@ -340,8 +340,8 @@ static void OptVersion (const char* Opt attribute ((unused)), /* Print the disassembler version */ { fprintf (stderr, - "da65 V%u.%u.%u - (C) Copyright 2000-2006, Ullrich von Bassewitz\n", - VER_MAJOR, VER_MINOR, VER_PATCH); + "da65 V%s - (C) Copyright 2000-2009, Ullrich von Bassewitz\n", + GetVersionAsString ()); } diff --git a/src/da65/output.c b/src/da65/output.c index 851157405..9a20b55f8 100644 --- a/src/da65/output.c +++ b/src/da65/output.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000-2007 Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2000-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -75,11 +75,11 @@ static void PageHeader (void) /* Print a page header */ { fprintf (F, - "; da65 V%u.%u.%u - (C) Copyright 2000-2005, Ullrich von Bassewitz\n" + "; da65 V%s - (C) Copyright 2000-2009, Ullrich von Bassewitz\n" "; Created: %s\n" "; Input file: %s\n" "; Page: %u\n\n", - VER_MAJOR, VER_MINOR, VER_PATCH, + GetVersionAsString (), Now, InFile, Page); @@ -188,7 +188,7 @@ void DefForward (const char* Name, const char* Comment, unsigned Offs) LineFeed (); } - /* Output the forward definition */ + /* Output the forward definition */ Output ("%s", Name); Indent (ACol); if (UseHexOffs) { diff --git a/src/ld65/main.c b/src/ld65/main.c index 0567e4bd9..4b7a5353f 100644 --- a/src/ld65/main.c +++ b/src/ld65/main.c @@ -490,8 +490,8 @@ static void OptVersion (const char* Opt attribute ((unused)), /* Print the assembler version */ { fprintf (stderr, - "ld65 V%u.%u.%u - (C) Copyright 1998-2005 Ullrich von Bassewitz\n", - VER_MAJOR, VER_MINOR, VER_PATCH); + "ld65 V%s - (C) Copyright 1998-2009, Ullrich von Bassewitz\n", + GetVersionAsString ()); } diff --git a/src/ld65/o65.c b/src/ld65/o65.c index 3fd610357..6f31909e4 100644 --- a/src/ld65/o65.c +++ b/src/ld65/o65.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1999-2007 Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 1999-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -1385,7 +1385,7 @@ void O65WriteTarget (O65Desc* D, File* F) } OptBuf[OptLen] = '\0'; O65SetOption (D, O65OPT_TIMESTAMP, OptBuf, OptLen + 1); - sprintf (OptBuf, "ld65 V%u.%u.%u", VER_MAJOR, VER_MINOR, VER_PATCH); + sprintf (OptBuf, "ld65 V%s", GetVersionAsString ()); O65SetOption (D, O65OPT_ASM, OptBuf, strlen (OptBuf) + 1); /* Write the header */ diff --git a/src/od65/main.c b/src/od65/main.c index 6e4c413bf..e8bea3cba 100644 --- a/src/od65/main.c +++ b/src/od65/main.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000-2002 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@cc65.org */ +/* (C) 2000-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -201,8 +201,8 @@ static void OptVersion (const char* Opt attribute ((unused)), /* Print the assembler version */ { fprintf (stderr, - "%s V%u.%u.%u - (C) Copyright 2000-2002 Ullrich von Bassewitz\n", - ProgName, VER_MAJOR, VER_MINOR, VER_PATCH); + "%s V%s - (C) Copyright 2000-2009, Ullrich von Bassewitz\n", + ProgName, GetVersionAsString ()); } diff --git a/src/sim65/main.c b/src/sim65/main.c index 7f53895d4..fe8fa2994 100644 --- a/src/sim65/main.c +++ b/src/sim65/main.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2002-2005 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2002-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -207,9 +207,7 @@ static void OptVersion (const char* Opt attribute ((unused)), const char* Arg attribute ((unused))) /* Print the assembler version */ { - fprintf (stderr, - "sim65 V%u.%u.%u\n", - VER_MAJOR, VER_MINOR, VER_PATCH); + fprintf (stderr, "sim65 V%s\n", GetVersionAsString ()); }