00001
00002
00003
00004 #ifndef _VERSION_H_
00005 #define _VERSION_H_
00006
00008 #include "date.h"
00009
00010 static const int CLD_MAJOR = 8;
00011 static const int CLD_MINOR = 0;
00012 static const int CLD_PATCH = 0;
00013
00014 static const string Url = "$HeadURL: https://svn.nublado.org/cloudy/branches/c08_branch/source/version.h $";
00015
00016 static 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";
00017 static const char* CITATION_LATEX = "\\bibitem[Ferland et al.(1998)]{1998PASP..110..761F} Ferland, G.~J., Korista, K.~T., Verner, D.~A., Ferguson, J.~W., Kingdon, J.~B., \\& Verner, E.~M.\\ 1998, \\pasp, 110, 761";
00018 static const char* CITATION_SHORT = "Ferland et al. (1998)";
00019
00020 class t_version : public Singleton<t_version>
00021 {
00022 friend class Singleton<t_version>;
00023 protected:
00024 t_version()
00025 {
00026 static const char chMonth[12][4] =
00027 { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
00028
00029
00030 lgRelease = true;
00031
00032
00033
00034 nBetaVer = 0;
00035
00036 if( lgRelease )
00037 {
00038 if( CLD_PATCH > 0 )
00039 sprintf( chVersion, "%2.2i.%2.2i (patch level %d)", CLD_MAJOR, CLD_MINOR, CLD_PATCH );
00040 else
00041 sprintf( chVersion, "%2.2i.%2.2i", CLD_MAJOR, CLD_MINOR );
00042 }
00043 else if( nBetaVer > 0 )
00044 {
00045 sprintf( chVersion, "%2.2i.%2.2i beta %ld (prerelease)", CLD_MAJOR, CLD_MINOR, nBetaVer );
00046 }
00047 else
00048 {
00049 sprintf( chVersion, "%2.2i.%2.2i.%2.2i", YEAR%100, MONTH+1, DAY );
00050 }
00051
00052 sprintf( chDate, "%2.2i%3.3s%2.2i", YEAR%100, chMonth[MONTH], DAY );
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 vector<string> Part;
00068 Split( Url, "/", Part, SPM_RELAX );
00069 if( Part.size() >= 3 )
00070 {
00071
00072
00073
00074 string Branch = Part[Part.size()-3];
00075
00076 bool lgReleaseTag = ( Url.find("/tags/release/") != string::npos );
00077 bool lgPatchTag = ( Url.find("/tags/patch_versions/") != string::npos );
00078 bool lgDevelopTag = ( Url.find("/tags/develop/") != string::npos );
00079
00080 bool lgReleaseBranch = ( Url.find("/branches/") != string::npos &&
00081 Branch.size() == 10 && Branch[0] == 'c' &&
00082 Branch.find("_branch") != string::npos );
00083
00084 bool lgReleaseChk = ( lgReleaseTag || lgPatchTag );
00085
00086 long nBetaVerChk;
00087
00088
00089 string::size_type ptr;
00090 if( lgDevelopTag && ( ptr = Branch.find( "_rc" ) ) != string::npos )
00091
00092 sscanf( Branch.substr( ptr+3 ).c_str(), "%ld", &nBetaVerChk );
00093 else
00094 nBetaVerChk = 0;
00095
00096 int nMajorLevel=0, nMinorLevel=0, nPatchLevel=0;
00097
00098 if( lgReleaseBranch || lgReleaseChk || nBetaVerChk > 0 )
00099 {
00100
00101 sscanf( Branch.substr(1,2).c_str(), "%d", &nMajorLevel );
00102 if( nMajorLevel != CLD_MAJOR )
00103 fprintf( ioQQQ, "PROBLEM - CLD_MAJOR mismatch, please check version.h\n" );
00104 }
00105
00106 if( lgReleaseChk || nBetaVerChk > 0 )
00107 {
00108
00109 sscanf( Branch.substr(4,2).c_str(), "%d", &nMinorLevel );
00110 if( nMinorLevel != CLD_MINOR )
00111 fprintf( ioQQQ, "PROBLEM - CLD_MINOR mismatch, please check version.h\n" );
00112 }
00113
00114 if( lgPatchTag )
00115 {
00116
00117 sscanf( Branch.substr(9,2).c_str(), "%d", &nPatchLevel );
00118 if( nPatchLevel != CLD_PATCH )
00119 fprintf( ioQQQ, "PROBLEM - CLD_PATCH mismatch, please check version.h\n" );
00120
00121 if( nPatchLevel == 0 )
00122 lgReleaseTag = true;
00123 }
00124
00125 if( nBetaVerChk > 0 )
00126 {
00127 if( nBetaVerChk != nBetaVer )
00128 fprintf( ioQQQ, "PROBLEM - nBetaVer mismatch, please check version.h\n" );
00129 }
00130
00131 if( lgReleaseChk && !lgRelease )
00132 fprintf( ioQQQ, "PROBLEM - lgRelease setting wrong, please check version.h\n" );
00133 }
00134
00135 char mode[6];
00136 if( sizeof(long) == 4 )
00137 strncpy( mode, "ILP32", 6 );
00138 else if( sizeof(long) == 8 )
00139 strncpy( mode, "LP64", 6 );
00140 else
00141 strncpy( mode, "?????", 6 );
00142
00143
00144 sprintf( chInfo,
00145 "cdInit compiled on %s in OS %s using the %s %i compiler in %s mode.",
00146 __DATE__, __OS, __COMP, __COMP_VER, mode );
00147
00148 chCitation = CITATION;
00149 chCitationLatex = CITATION_LATEX;
00150 chCitationShort = CITATION_SHORT;
00151 }
00152 public:
00154 char chDate[INPUT_LINE_LENGTH];
00155
00157 char chVersion[INPUT_LINE_LENGTH];
00158
00160 long int nBetaVer;
00161
00163 bool lgRelease;
00164
00167 char chInfo[INPUT_LINE_LENGTH];
00168
00170 const char *chCitation;
00171
00173 const char *chCitationShort;
00174
00176 const char *chCitationLatex;
00177 };
00178
00179 #endif