Show
Ignore:
Timestamp:
06/29/08 08:53:10 (5 months ago)
Author:
peter
Message:

source/version.h:

Activate new version numbering scheme which includes the svn revision and branch name.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/source/version.h

    r2052 r2138  
    1212static const int CLD_PATCH = 0; 
    1313 
    14 #if 0 
    1514#ifdef SVN_REVISION 
    1615static const char* svn_revision = SVN_REVISION; 
    1716#else 
    18 static const char* svn_revision = "unknown"; 
     17static const char* svn_revision = "????"; 
    1918#endif 
    2019 
    2120static const string Url = "$HeadURL$"; 
    22 #endif 
    2321 
    2422static const char* CITATION = "Ferland, G. J., Korista, K. T., Verner, D. A., Ferguson, J. W., Kingdon, J. B., & Verner, E. M. 1998, PASP, 110, 761"; 
     
    3533                        { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; 
    3634 
    37 #if 0 
    3835                // first analyze the URL to determine where we live, the chVersion string is derived from that 
    3936                // the code below is based on the following naming scheme: 
    4037                // 
    41                 // /branches/c08_branch -- release branch, all bug fixes are submitted here  
    42                 // 
    43                 // /tags/develop/c08.01_rc1 -- release candidates go here  
    44                 // 
    45                 // /tags/release/c08.01 -- first official release 
    46                 // /tags/release/c08.02 -- first bug-fix rollup, etc...  
    47                 // 
    48                 // /tags/patch_versions/c08.01.00 -- identical to /tags/release/c08.01 
    49                 // /tags/patch_versions/c08.01.01 -- first patch update, etc...  
     38                // /branches/c09_branch -- release branch, all bug fixes are submitted here  
     39                // 
     40                // /tags/develop/c09.00_rc1 -- release candidates go here  
     41                // 
     42                // /tags/release/c09.00 -- first official release 
     43                // /tags/release/c09.01 -- first bug-fix rollup, etc...  
     44                // 
     45                // /tags/patch_versions/c09.00.00 -- identical to /tags/release/c09.00 
     46                // /tags/patch_versions/c09.00.01 -- first patch update, etc...  
    5047                // 
    5148                // /trunk -- this will be labeled as "exprimental" 
     
    5855                { 
    5956                        // the last two parts are "source" and "version.h $", we don't need them... 
    60                         // the one before is the name of the branch (e.g. "trunk", "newmole", "c08.01") 
     57                        // the one before is the relevant identifier (e.g. "trunk", "newmole", "c09.01") 
     58                        // for conciseness we will refer to it below as the "branch" 
    6159                        string Branch = Part[Part.size()-3]; 
    6260 
     
    6462                        bool lgPatchTag = ( Url.find("/tags/patch_versions/") != string::npos ); 
    6563                        bool lgDevelopTag = ( Url.find("/tags/develop/") != string::npos ); 
    66                         // this expects a branch name like "c08_branch" 
     64                        // this expects a branch name like "c09_branch" 
    6765                        bool lgReleaseBranch = ( Url.find("/branches/") != string::npos && 
    6866                                                 Branch.size() == 10 && Branch[0] == 'c' && 
     
    7472                        string::size_type ptr; 
    7573                        if( lgDevelopTag && ( ptr = Branch.find( "_rc" ) ) != string::npos ) 
    76                                 // this expects a branch name like "c08.01_rc1" 
     74                                // this expects a branch name like "c09.00_rc1" 
    7775                                sscanf( Branch.substr( ptr+3 ).c_str(), "%ld", &nBetaVer ); 
    7876                        else 
    7977                                nBetaVer = 0; 
    8078 
    81                         int nPatchLevel; 
     79                        int nMajorLevel=0, nMinorLevel=0, nPatchLevel=0; 
     80 
     81                        if( lgReleaseBranch || lgRelease || nBetaVer > 0 ) 
     82                        { 
     83                                // this expects a branch name starting with "c09" 
     84                                sscanf( Branch.substr(1,2).c_str(), "%d", &nMajorLevel ); 
     85                                if( nMajorLevel != CLD_MAJOR ) 
     86                                        fprintf( ioQQQ, "PROBLEM - CLD_MAJOR mismatch, please check version.h\n" ); 
     87                        } 
     88 
     89                        if( lgRelease || nBetaVer > 0 ) 
     90                        { 
     91                                // this expects a branch name starting with "c09.01" 
     92                                sscanf( Branch.substr(4,2).c_str(), "%d", &nMinorLevel ); 
     93                                if( nMinorLevel != CLD_MINOR ) 
     94                                        fprintf( ioQQQ, "PROBLEM - CLD_MINOR mismatch, please check version.h\n" ); 
     95                        } 
     96                         
    8297                        if( lgPatchTag ) 
    83                                 // this expects a branch name like "c08.01.02" 
    84                                 sscanf( Branch.substr( Branch.size()-2 ).c_str(), "%d", &nPatchLevel ); 
    85                         else 
    86                                 nPatchLevel = 0;         
     98                        { 
     99                                // this expects a branch name like "c09.01.02" 
     100                                sscanf( Branch.substr(7,2).c_str(), "%d", &nPatchLevel ); 
     101                                if( nPatchLevel != CLD_PATCH ) 
     102                                        fprintf( ioQQQ, "PROBLEM - CLD_PATCH mismatch, please check version.h\n" ); 
     103                                // c09.00.00 is identical to release c09.00, so pass it off as the latter... 
     104                                if( nPatchLevel == 0 ) 
     105                                        lgReleaseTag = true; 
     106                        } 
    87107 
    88108                        if( lgReleaseTag ) 
    89                                 // this expects a branch name like "c08.01" 
    90                                 strncpy( chVersion, Branch.substr(1).c_str(), INPUT_LINE_LENGTH ); 
     109                                // this expects a branch name like "c09.01" 
     110                                strncpy( chVersion, Branch.substr(1,5).c_str(), INPUT_LINE_LENGTH ); 
    91111                        else if( lgPatchTag ) 
    92                                 // this expects a branch name like "c08.01.02" 
     112                                // this expects a branch name like "c09.01.02" 
    93113                                sprintf( chVersion, "%s (patch level %d)", Branch.substr(1,5).c_str(), nPatchLevel ); 
    94114                        else if( nBetaVer > 0 ) 
    95                                 // this expects a branch name like "c08.01_rc1" 
     115                                // this expects a branch name like "c09.00_rc1" 
    96116                                sprintf( chVersion, "%s beta %ld (prerelease)", Branch.substr(1,5).c_str(), nBetaVer ); 
    97117                        else if( lgReleaseBranch ) 
    98                                 // this expects a branch name like "c08_branch" 
    99                                 sprintf( chVersion, "(prerelease, %s, ver. %s)", Branch.c_str(), svn_revision ); 
     118                                // this expects a branch name like "c09_branch" 
     119                                sprintf( chVersion, "(prerelease, %s, r%s)", Branch.c_str(), svn_revision ); 
    100120                        else 
    101121                                // the branch name can be anything except "c??_branch" 
    102                                 sprintf( chVersion, "(experimental, %s, ver. %s)", Branch.c_str(), svn_revision ); 
     122                                sprintf( chVersion, "(experimental, %s, r%s)", Branch.c_str(), svn_revision ); 
    103123                } 
    104124                else 
     
    109129                        lgRelease = false; 
    110130 
    111                         /* is this a beta version?  0 for no */ 
     131                        /* is this a beta version?  0 for no 
     132                         * if this is non-zero then lgRelease above should be false */ 
    112133                        nBetaVer = 0; 
    113134 
    114                         sprintf( chVersion, "%2.2i%2.2i%2.2i", YEAR%100, MONTH+1, DAY ); 
     135                        if( lgRelease ) 
     136                        { 
     137                                if( CLD_PATCH > 0 ) 
     138                                        sprintf( chVersion, "%2.2i.%2.2i (patch level %d)", 
     139                                                 CLD_MAJOR, CLD_MINOR, CLD_PATCH ); 
     140                                else 
     141                                        sprintf( chVersion, "%2.2i.%2.2i", CLD_MAJOR, CLD_MINOR ); 
     142                        } 
     143                        else if( nBetaVer > 0 ) 
     144                        { 
     145                                sprintf( chVersion, "%2.2i.%2.2i beta %ld (prerelease)", 
     146                                         CLD_MAJOR, CLD_MINOR, nBetaVer ); 
     147                        } 
     148                        else 
     149                        { 
     150                                sprintf( chVersion, "%2.2i.%2.2i.%2.2i", YEAR%100, MONTH+1, DAY ); 
     151                        } 
    115152                } 
    116 #else 
    117                 /* is this a release version? */ 
    118                 lgRelease = false; 
    119  
    120                 /* is this a beta version?  0 for no 
    121                  * if this is non-zero then lgRelease above should be false */ 
    122                 nBetaVer = 0; 
    123  
    124                 if( lgRelease ) 
    125                 { 
    126                         if( CLD_PATCH > 0 ) 
    127                                 sprintf( chVersion, "%2.2i.%2.2i (patch level %d)", CLD_MAJOR, CLD_MINOR, CLD_PATCH ); 
    128                         else 
    129                                 sprintf( chVersion, "%2.2i.%2.2i", CLD_MAJOR, CLD_MINOR ); 
    130                 } 
    131                 else if( nBetaVer > 0 ) 
    132                 { 
    133                         sprintf( chVersion, "%2.2i.%2.2i beta %ld (prerelease)", CLD_MAJOR, CLD_MINOR, nBetaVer ); 
    134                 } 
    135                 else 
    136                 { 
    137                         sprintf( chVersion, "%2.2i.%2.2i.%2.2i", YEAR%100, MONTH+1, DAY ); 
    138                 } 
    139 #endif 
    140153 
    141154                sprintf( chDate, "%2.2i%3.3s%2.2i", YEAR%100, chMonth[MONTH], DAY );