Changeset 1896

Show
Ignore:
Timestamp:
03/30/08 16:05:35 (9 months ago)
Author:
peter
Message:

source/punch_fits.cpp:
source/assert_results.cpp:
source/Makefile:
source/version.h:
source/parse_commands.cpp:
source/parse_print.cpp:
source/prt_comment.cpp:

Implement the new version numbering system for the C08 release.

Location:
trunk/source
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/source/assert_results.cpp

    r1891 r1896  
    22142214        if( called.lgTalk && nAsserts>0 ) 
    22152215        {  
    2216                 char chVer[10]; 
    22172216                time_t now; 
    2218                 cdVersion(chVer ); 
    22192217 
    22202218                /* First disambiguate any line identifications */ 
     
    22812279 
    22822280                /* write start of title and version number of code */ 
    2283                 fprintf( ioASSERT, "=============Results of asserts: C%s ",chVer ); 
     2281                fprintf( ioASSERT, "=============Results of asserts: Cloudy %s ", version::Inst().chVersion ); 
    22842282 
    22852283                /* usually print date and time info - do not if "no times" command entered,  
  • trunk/source/Makefile

    r1756 r1896  
    8585endif 
    8686 
     87SVNVER = ${shell which svnversion} 
     88ifneq ($(SVNVER),) 
     89  REVISION = ${shell $(SVNVER) $(SRCDIR)} 
     90else 
     91  REVISION = exported 
     92endif 
     93CXXFLAGS += -DSVN_REVISION=\"$(REVISION)\" 
     94 
    8795cloudy.exe : ${preobjects} maincl.o libcloudy.a 
    8896        ${CXX} ${LDFLAGS} -o cloudy.exe maincl.o -L. -lcloudy ${LDLIBS} 
  • trunk/source/parse_commands.cpp

    r1894 r1896  
    120120        { 
    121121                fprintf( ioQQQ,  
    122                         "\n                             This is %s (beta %ld) of Cloudy, and is intended for testing only.\n\n",  
    123                         version::Inst().chVersion, version::Inst().nBetaVer ); 
     122                         "\n                               This is a beta release of Cloudy, and is intended for testing only.\n\n" ); 
    124123        } 
    125124 
  • trunk/source/parse_print.cpp

    r1891 r1896  
    9595        { 
    9696                /* print compiler and code version information */ 
    97                 fprintf( ioQQQ, "\nThis is Cloudy, version %s\n%s\n\n" ,  
     97                fprintf( ioQQQ, "\nThis is Cloudy %s\n%s\n\n" ,  
    9898                        version::Inst().chVersion, 
    9999                        version::Inst().chInfo ); 
  • trunk/source/prt_comment.cpp

    r1891 r1896  
    163163        { 
    164164                sprintf( chLine,  
    165                         "  !This is beta test version%4ld and is intended for testing only.",  
     165                        "  !This is beta test version %ld and is intended for testing only.",  
    166166                  version::Inst().nBetaVer ); 
    167167                bangin(chLine); 
  • trunk/source/punch_fits.cpp

    r1891 r1896  
    725725STATIC void writeCloudyDetails( void ) 
    726726{ 
    727         char chVer[10]; 
    728727        char timeString[30]=""; 
    729728        char tempString[70]; 
     
    731730        long i, j, k; 
    732731 
    733         cdVersion( chVer ); 
    734  
    735732        /* usually print date and time info - do not if "no times" command entered,  
    736733         * which set this flag false */ 
     
    752749        } 
    753750 
    754         strcpy( tempString, "Generated by Cloudy version " ); 
    755         strcat( tempString, chVer ); 
     751        strcpy( tempString, "Generated by Cloudy " ); 
     752        strcat( tempString, version::Inst().chVersion ); 
    756753        bytesAdded += addComment( tempString ); 
    757754        bytesAdded += addComment( version::Inst().chInfo ); 
  • trunk/source/version.h

    r1891 r1896  
    88#include "date.h" 
    99 
     10static const int CLD_MAJOR = 8; 
     11static const int CLD_MINOR = 1; 
     12static const int CLD_PATCH = 0; 
     13 
    1014#if 0 
    11 static const int CLD_MAJOR = 8; 
    12 static const int CLD_MINOR = 0; 
    13  
    1415#ifdef SVN_REVISION 
    1516static const char* svn_revision = SVN_REVISION; 
     
    3132        version() 
    3233        { 
    33                 /* set date and version - this code will need to be modified in the year 2100 */ 
    34                 if( YEAR >= 200 ) 
    35                 { 
    36                         fprintf(ioQQQ,"must update formation of chDate in cdInit \n"); 
    37                         TotalInsanity(); 
    38                 } 
    39                  
    4034                static const char chMonth[12][4] = 
    4135                        { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; 
    42                  
     36 
     37#if 0 
     38                // first analyze the URL to determine where we live, the chVersion string is derived from that 
     39                // the code below is based on the following naming scheme: 
     40                // 
     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...  
     50                // 
     51                // /trunk -- this will be labeled as "exprimental" 
     52                // /tags/stable -- ditto 
     53                // /branches/* -- ditto, note that "*" can be anything except c??_branch 
     54 
     55                vector<string> Part; 
     56                Split( Url, "/", Part, SPM_RELAX ); 
     57                if( Part.size() >= 3 ) 
     58                { 
     59                        // 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") 
     61                        string Branch = Part[Part.size()-3]; 
     62 
     63                        bool lgReleaseTag = ( Url.find("/tags/release/") != string::npos ); 
     64                        bool lgPatchTag = ( Url.find("/tags/patch_versions/") != string::npos ); 
     65                        bool lgDevelopTag = ( Url.find("/tags/develop/") != string::npos ); 
     66                        // this expects a branch name like "c08_branch" 
     67                        bool lgReleaseBranch = ( Url.find("/branches/") != string::npos && 
     68                                                 Branch.size() == 10 && Branch[0] == 'c' && 
     69                                                 Branch.find("_branch") != string::npos ); 
     70 
     71                        lgRelease = ( lgReleaseTag || lgPatchTag ); 
     72 
     73                        // determine if this is a beta version 
     74                        string::size_type ptr; 
     75                        if( lgDevelopTag && ( ptr = Branch.find( "_rc" ) ) != string::npos ) 
     76                                // this expects a branch name like "c08.01_rc1" 
     77                                sscanf( Branch.substr( ptr+3 ).c_str(), "%ld", &nBetaVer ); 
     78                        else 
     79                                nBetaVer = 0; 
     80 
     81                        int nPatchLevel; 
     82                        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;         
     87 
     88                        if( lgReleaseTag ) 
     89                                // this expects a branch name like "c08.01" 
     90                                strncpy( chVersion, Branch.substr(1).c_str(), INPUT_LINE_LENGTH ); 
     91                        else if( lgPatchTag ) 
     92                                // this expects a branch name like "c08.01.02" 
     93                                sprintf( chVersion, "%s (patch level %d)", Branch.substr(1,5).c_str(), nPatchLevel ); 
     94                        else if( nBetaVer > 0 ) 
     95                                // this expects a branch name like "c08.01_rc1" 
     96                                sprintf( chVersion, "%s beta %ld (prerelease)", Branch.substr(1,5).c_str(), nBetaVer ); 
     97                        else if( lgReleaseBranch ) 
     98                                // this expects a branch name like "c08_branch" 
     99                                sprintf( chVersion, "(prerelease, %s, ver. %s)", Branch.c_str(), svn_revision ); 
     100                        else 
     101                                // the branch name can be anything except "c??_branch" 
     102                                sprintf( chVersion, "(experimental, %s, ver. %s)", Branch.c_str(), svn_revision ); 
     103                } 
     104                else 
     105                { 
     106                        // create a default version string in case HeadURL was not expanded 
     107 
     108                        /* is this a release version? */ 
     109                        lgRelease = false; 
     110 
     111                        /* is this a beta version?  0 for no */ 
     112                        nBetaVer = 0; 
     113 
     114                        sprintf( chVersion, "%2.2i%2.2i%2.2i", YEAR%100, MONTH+1, DAY ); 
     115                } 
     116#else 
     117                /* is this a release version? */ 
     118                lgRelease = false; 
     119 
    43120                /* is this a beta version?  0 for no */ 
    44121                nBetaVer = 0; 
    45                  
    46                 /* is this a release version? */ 
    47                 lgRelease = false; 
    48                  
    49                 sprintf( chDate, "%2.2i%3.3s%2.2i",  
    50                          YEAR-100, 
    51                          chMonth[MONTH], 
    52                          DAY ); 
    53122 
    54                 sprintf( chVersion, "%2.2i.%2.2i.%2.2i",  
    55                          YEAR-100, 
    56                          MONTH+1, 
    57                          DAY ); 
    58                  
     123                if( lgRelease ) 
     124                { 
     125                        if( CLD_PATCH > 0 ) 
     126                                sprintf( chVersion, "%2.2i.%2.2i (patch level %d)", CLD_MAJOR, CLD_MINOR, CLD_PATCH ); 
     127                        else 
     128                                sprintf( chVersion, "%2.2i.%2.2i", CLD_MAJOR, CLD_MINOR ); 
     129                } 
     130                else if( nBetaVer > 0 ) 
     131                { 
     132                        sprintf( chVersion, "%2.2i.%2.2i beta %ld (prerelease)", CLD_MAJOR, CLD_MINOR, nBetaVer ); 
     133                } 
     134                else 
     135                { 
     136                        sprintf( chVersion, "%2.2i.%2.2i.%2.2i", YEAR%100, MONTH+1, DAY ); 
     137                } 
     138#endif 
     139 
     140                sprintf( chDate, "%2.2i%3.3s%2.2i", YEAR%100, chMonth[MONTH], DAY ); 
     141 
    59142                char mode[6]; 
    60143                if( sizeof(long) == 4 ) 
     
    64147                else 
    65148                        strncpy( mode, "?????", 6 ); 
    66                  
     149 
    67150                /* now generate info on how we were compiled, including compiler version */ 
    68                 sprintf(chInfo ,  
    69                         "cdInit compiled on %s in OS %s using the %s %i compiler in %s mode." , 
    70                         __DATE__  ,__OS , __COMP , __COMP_VER, mode); 
     151                sprintf( chInfo, 
     152                         "cdInit compiled on %s in OS %s using the %s %i compiler in %s mode.", 
     153                         __DATE__, __OS, __COMP, __COMP_VER, mode ); 
    71154 
    72155                chCitation = CITATION; 
     
    75158        } 
    76159public: 
    77         /** date of this version of the code as a string, set in cdinit.c, 
    78          * where space is allocated */ 
     160        /** date of this version of the code as a string */ 
    79161        char chDate[INPUT_LINE_LENGTH]; 
    80162 
    81         /** version number of this version of the code, as a string, set in cdinit.c  
    82          * where space is allocated */ 
     163        /** version string of this version of the code */ 
    83164        char chVersion[INPUT_LINE_LENGTH]; 
    84165 
     
    86167        long int nBetaVer; 
    87168 
    88         /* is this a release version?  if so do not print some internal comments */ 
     169        /** is this a release version?  if so do not print some internal comments */ 
    89170        bool lgRelease; 
    90171 
     
    103184}; 
    104185 
    105  
    106186#endif /* _VERSION_H_ */