Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] (PR#4712) future CVS versioning
Home

[Freeciv-Dev] (PR#4712) future CVS versioning

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#4712) future CVS versioning
From: "John Wheeler" <jdwheeler42@xxxxxxxxx>
Date: Mon, 22 Sep 2003 21:10:15 -0700
Reply-to: rt@xxxxxxxxxxxxxx

[jdorje - Mon Sep 22 02:00:18 2003]:

> John Wheeler wrote:
> >  Also, maybe should all the #defines be taken out
> > of version.h, and use wrapper functions to access the values
> elsewhere
> > in the program?  I would think doing this first would make it easier
> to
> > change how the version is determined.
> 
> No doubt, and I would approve of a patch to do this.  Note that the
> version.h #defines are not generally used; the ones generated in
> config.h are used instead.  So removing the #defines from the header
> isn't really the goal, but rather removing their usage from .c files
> (other than version.c) (and replacing it with appropriate functions)
> would be.

Okay it appears that MAJOR_VERSION et al are just used 3 ways:

In server/savegame.c#L2237, as an integer XXYYZZ
In connection packets, as seperate fields X, Y, Z, and s.
Everywhere else as a string "X.Y.Zs"

where X=MAJOR_VERSION, Y=MINOR_VERSION, Z=PATCH_VERSION, and s=VERSION_LABEL

It seems like the connection packets could use the "X.Y.Zs" form also,
but I wouldn't want to change that unless someone who really understands
the packet code can confirm that.

I'm envisioning the following functions to replace these defines:

const int major_version(void) {return(1);} /* instead of MAJOR_VERSION */
const int minor_version(void) {return(14);} /* instead of MINOR_VERSION */
const int patch_version(void) {return(99);} /* instead of PATCH_VERSION */
const char *version_label(void) {return("-devel");} /* instead of
VERSION_LABEL */
char *version_string(void); /* instead of VERSION_STRING */
const int version_int(void) {
return(major_version() * 10000 + minor_version() * 100 + patch_version()
); } /* for savegame.c */
bool is_devel_version(void) {return(TRUE);} /* instead of
IS_DEVEL_VERSION */
bool is_beta_version(void) {return(FALSE);} /* instead of IS_BETA_VERSION */

(I'm actually not sure if those last two really need to be functions.
And, I have several ideas for how version_string() could be done, but I
have no idea how to do that most efficiently.)

Comments?

-- 

++JohnWheeler


[Prev in Thread] Current Thread [Next in Thread]