Ticket #59: patch
| File patch, 14.6 kB (added by rjrw, 6 months ago) |
|---|
-
service.cpp
254 254 255 255 256 256 fprintf( ioQQQ, " Cloudy version number is %s\n", 257 version .chVersion );258 fprintf( ioQQQ, " %s\n\n", version .chInfo );257 version::Inst().chVersion ); 258 fprintf( ioQQQ, " %s\n\n", version::Inst().chInfo ); 259 259 260 260 fprintf( ioQQQ, "%5ld warnings,%3ld cautions,%3ld temperature failures. Messages follow.\n", 261 261 warnings.nwarn, warnings.ncaun, conv.nTeFail ); -
punch_fits.cpp
754 754 strcpy( tempString, "Generated by Cloudy version " ); 755 755 strcat( tempString, chVer ); 756 756 bytesAdded += addComment( tempString ); 757 bytesAdded += addComment( version .chInfo );757 bytesAdded += addComment( version::Inst().chInfo ); 758 758 strcpy( tempString, "--- " ); 759 759 strcat( tempString, timeString ); 760 760 bytesAdded += addComment( tempString ); -
init_coreload.cpp
10 10 #include "dense.h" 11 11 #include "hcmap.h" 12 12 #include "h2.h" 13 #include "date.h"14 13 #include "version.h" 15 14 #include "hextra.h" 16 15 #include "mole.h" … … 158 157 hcmap.nmap = 0; 159 158 hcmap.lgMapBeingDone = false; 160 159 161 /* set the date saved in date.h into version.chDate162 * this is the decade part of the year counted after 2000 */163 int nDecade = (YEAR-100)/10;164 char chDecade[2];165 166 /* create space for these strings */167 version.chDate = (char *)MALLOC( sizeof(char)*INPUT_LINE_LENGTH );168 version.chVersion = (char *)MALLOC( sizeof(char)*INPUT_LINE_LENGTH );169 170 static char chMonth[12][4] ={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" };171 static char chMonthInt[12][3] ={"01","02","03","04","05","06","07","08","09","10","11","12" };172 173 sprintf(chDecade,"%i", nDecade );174 /* set date and version - this code will need to be modified in the year 2110 */175 if( nDecade > 9 )176 {177 fprintf(ioQQQ,"must update formation of chDate in cdInit \n");178 TotalInsanity();179 }180 if( DAY < 10 )181 {182 sprintf( version.chDate , "%s%1i%s0%1i",183 chDecade,184 YEAR-100-nDecade*10,185 chMonth[MONTH],186 DAY );187 sprintf( version.chVersion , "%s%1i.%s.0%1i",188 chDecade,189 YEAR-100-nDecade*10,190 chMonthInt[MONTH],191 DAY );192 }193 else194 {195 sprintf( version.chDate , "%s%1i%s%2i",196 chDecade,197 YEAR-100-nDecade*10,198 chMonth[MONTH],199 DAY );200 sprintf( version.chVersion , "%s%1i.%s.%2i",201 chDecade,202 YEAR-100-nDecade*10,203 chMonthInt[MONTH],204 DAY );205 }206 207 version.chCitation = CITATION;208 version.chCitationLatex = CITATION_LATEX;209 version.chCitationShort = CITATION_SHORT;210 211 /* is this a release version? */212 version.lgRelease = false;213 214 /* is this a beta version? 0 for no */215 version.nBetaVer = 0;216 217 /* optional letter could come here for updates to branched version */218 /*strcat( version.chVersion , "a" );*/219 /* change following from * to letter when letters are used */220 strcat( version.chDate , "*" );221 222 char mode[6];223 if( sizeof(long) == 4 )224 strncpy( mode, "ILP32", 6 );225 else if( sizeof(long) == 8 )226 strncpy( mode, "LP64", 6 );227 else228 strncpy( mode, "?????", 6 );229 230 /* now generate info on how we were compiled, including compiler version */231 sprintf(version.chInfo ,232 "cdInit compiled on %s in OS %s using the %s %i compiler in %s mode." ,233 __DATE__ ,__OS , __COMP , __COMP_VER, mode);234 235 160 /* name of output file from optimization run */ 236 161 strncpy( chOptimFileName , "optimal.in" , sizeof( chOptimFileName ) ); 237 162 -
grains_mie.cpp
376 376 377 377 (void)time(&timer); 378 378 lgErr = lgErr || ( fprintf(fdes,"# this file was created by Cloudy %s (%s) on %s", 379 version.chVersion,version.chDate,ctime(&timer)) < 0 );379 version::Inst().chVersion,version::Inst().chDate,ctime(&timer)) < 0 ); 380 380 lgErr = lgErr || ( fprintf(fdes,"# ===========================================\n#\n") < 0 ); 381 381 lgErr = lgErr || ( fprintf(fdes,"%12ld # magic number opacity file\n",MAGIC_OPC) < 0 ); 382 382 lgErr = lgErr || ( fprintf(fdes,"%12ld # magic number rfi/mix file\n",gd.magic) < 0 ); -
assert_results.cpp
2471 2471 /* explain how we were compiled, but only if printing time */ 2472 2472 if( prt.lgPrintTime ) 2473 2473 { 2474 fprintf( ioQQQ, " %s\n\n", version .chInfo );2474 fprintf( ioQQQ, " %s\n\n", version::Inst().chInfo ); 2475 2475 } 2476 2476 } 2477 2477 return lgAssertsOK; -
parse_punch.cpp
202 202 { 203 203 sprintf( chHeader, 204 204 "# %s %s\n", 205 version .chVersion, input.chTitle );205 version::Inst().chVersion, input.chTitle ); 206 206 } 207 207 208 208 /* usually results for each iteration are followed by a series of -
optimize_phymir.cpp
227 227 } 228 228 else 229 229 { 230 strcpy(chDum1,version .chDate);231 strcpy(chDum2,version .chVersion);230 strcpy(chDum1,version::Inst().chDate); 231 strcpy(chDum2,version::Inst().chVersion); 232 232 strcpy(chDum3,cpu.host_name()); 233 233 wr_continue(VRSNEW,LIMPAR,a2,c1,c2,xc,xcold,dmax,dold,*ymin,nvarPhymir,optimize.nOptimiz, 234 234 optimize.varmax,optimize.varmin,chDum1,chDum2,chDum3,CNTFILE); -
version.h
5 5 #define _VERSION_H_ 6 6 7 7 /** version.h */ 8 8 #include "date.h" 9 9 #define CITATION "Ferland, G. J., Korista, K. T., Verner, D. A., Ferguson, J. W., Kingdon, J. B., & Verner, E. M. 1998, PASP, 110, 761" 10 10 #define 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" 11 11 #define CITATION_SHORT "Ferland et al. (1998)" 12 12 13 EXTERN struct t_version { 14 13 class version : public Singleton<version> 14 { 15 friend class Singleton<version>; 16 protected: 17 version() 18 { 19 /* set the date saved in date.h into version.chDate 20 * this is the decade part of the year counted after 2000 */ 21 int nDecade = (YEAR-100)/10; 22 char chDecade[2]; 23 24 /* create space for these strings */ 25 chDate = (char *)MALLOC( sizeof(char)*INPUT_LINE_LENGTH ); 26 chVersion = (char *)MALLOC( sizeof(char)*INPUT_LINE_LENGTH ); 27 28 static char chMonth[12][4] ={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" }; 29 static char chMonthInt[12][3] ={"01","02","03","04","05","06","07","08","09","10","11","12" }; 30 31 sprintf(chDecade,"%i", nDecade ); 32 /* set date and version - this code will need to be modified in the year 2110 */ 33 if( nDecade > 9 ) 34 { 35 fprintf(ioQQQ,"must update formation of chDate in cdInit \n"); 36 TotalInsanity(); 37 } 38 if( DAY < 10 ) 39 { 40 sprintf( chDate , "%s%1i%s0%1i", 41 chDecade, 42 YEAR-100-nDecade*10, 43 chMonth[MONTH], 44 DAY ); 45 sprintf( chVersion , "%s%1i.%s.0%1i", 46 chDecade, 47 YEAR-100-nDecade*10, 48 chMonthInt[MONTH], 49 DAY ); 50 } 51 else 52 { 53 sprintf( chDate , "%s%1i%s%2i", 54 chDecade, 55 YEAR-100-nDecade*10, 56 chMonth[MONTH], 57 DAY ); 58 sprintf( chVersion , "%s%1i.%s.%2i", 59 chDecade, 60 YEAR-100-nDecade*10, 61 chMonthInt[MONTH], 62 DAY ); 63 } 64 65 chCitation = CITATION; 66 chCitationLatex = CITATION_LATEX; 67 chCitationShort = CITATION_SHORT; 68 69 /* is this a release version? */ 70 lgRelease = false; 71 72 /* is this a beta version? 0 for no */ 73 nBetaVer = 0; 74 75 /* optional letter could come here for updates to branched version */ 76 /*strcat( chVersion , "a" );*/ 77 /* change following from * to letter when letters are used */ 78 strcat( chDate , "*" ); 79 char mode[6]; 80 if( sizeof(long) == 4 ) 81 strncpy( mode, "ILP32", 6 ); 82 else if( sizeof(long) == 8 ) 83 strncpy( mode, "LP64", 6 ); 84 else 85 strncpy( mode, "?????", 6 ); 86 87 /* now generate info on how we were compiled, including compiler version */ 88 sprintf(chInfo , 89 "cdInit compiled on %s in OS %s using the %s %i compiler in %s mode." , 90 __DATE__ ,__OS , __COMP , __COMP_VER, mode); 91 } 92 public: 15 93 /** date of this version of the code as a string, set in cdinit.c, 16 94 * where space is allocated */ 17 95 char *chDate; … … 39 117 /** string to print latex bibitem with print citation command */ 40 118 const char *chCitationLatex; 41 119 42 } version;120 }; 43 121 44 122 45 123 #endif /* _VERSION_H_ */ -
parse_commands.cpp
116 116 } 117 117 118 118 /* say this is a beta version if we are talking and it is the truth */ 119 if( version .nBetaVer > 0 && called.lgTalk )119 if( version::Inst().nBetaVer > 0 && called.lgTalk ) 120 120 { 121 121 fprintf( ioQQQ, 122 122 "\n This is %s (beta %ld) of Cloudy, and is intended for testing only.\n\n", 123 version .chVersion, version.nBetaVer );123 version::Inst().chVersion, version::Inst().nBetaVer ); 124 124 } 125 125 126 126 if( called.lgTalk ) … … 130 130 { 131 131 fprintf(ioQQQ,"%c",' '); 132 132 } 133 fprintf( ioQQQ, "Cloudy %s\n", version .chVersion);133 fprintf( ioQQQ, "Cloudy %s\n", version::Inst().chVersion); 134 134 135 135 for( i=0; i<57; i++ ) 136 136 { … … 145 145 146 146 /* now print box and date of version, before printing commands */ 147 147 fprintf( ioQQQ, "**************************************"); 148 fprintf( ioQQQ, "%8.8s", version .chDate);148 fprintf( ioQQQ, "%8.8s", version::Inst().chDate); 149 149 fprintf( ioQQQ, "*************************************\n"); 150 150 151 151 for( i=0; i<23; i++ ) -
prt_final.cpp
144 144 for(i=0; i<31; ++i ) 145 145 fprintf( ioQQQ, "*"); 146 146 fprintf( ioQQQ, "*"); 147 fprintf( ioQQQ, "> Cloudy %s <", version .chVersion);147 fprintf( ioQQQ, "> Cloudy %s <", version::Inst().chVersion); 148 148 for(i=0; i<32; ++i ) 149 149 fprintf( ioQQQ, "*"); 150 150 fprintf( ioQQQ, "\n" ); … … 201 201 " *********************************> Log(U):%6.2f <*********************************\n", 202 202 a ); 203 203 204 if( version .nBetaVer > 0 )204 if( version::Inst().nBetaVer > 0 ) 205 205 { 206 206 fprintf( ioQQQ, 207 207 "\n This is a beta test version of the code, and is intended for testing only.\n\n" ); -
grid_do.cpp
172 172 { 173 173 fprintf( ioQQQ, " Optimization Driver\n" ); 174 174 } 175 fprintf( ioQQQ, " Cloudy %s\n\n",version .chVersion);176 fprintf( ioQQQ, " **************************************%8.87s*************************************\n", version .chDate);175 fprintf( ioQQQ, " Cloudy %s\n\n",version::Inst().chVersion); 176 fprintf( ioQQQ, " **************************************%8.87s*************************************\n", version::Inst().chDate); 177 177 fprintf( ioQQQ, " * *\n"); 178 178 179 179 -
parse_print.cpp
71 71 " efforts of many people. It should be cited as follows:\n" ); 72 72 fprintf( ioQQQ, "Calculations were performed with version %s of Cloudy," 73 73 " last described by %s.\n\n", 74 version .chVersion,75 version .chCitationShort);76 fprintf( ioQQQ, "The reference is:\n%s\n\n", version .chCitation );77 fprintf( ioQQQ, "In Latex this is:\n%s\n\n", version .chCitationLatex );74 version::Inst().chVersion, 75 version::Inst().chCitationShort); 76 fprintf( ioQQQ, "The reference is:\n%s\n\n", version::Inst().chCitation ); 77 fprintf( ioQQQ, "In Latex this is:\n%s\n\n", version::Inst().chCitationLatex ); 78 78 } 79 79 80 80 else if( nMatch("COLU",chCARD_CAPS) && nMatch("DENS",chCARD_CAPS) ) … … 95 95 { 96 96 /* print compiler and code version information */ 97 97 fprintf( ioQQQ, "\nThis is Cloudy, version %s\n%s\n\n" , 98 version .chVersion,99 version .chInfo );98 version::Inst().chVersion, 99 version::Inst().chInfo ); 100 100 } 101 101 102 102 /* option to print departure coefficients in addition to level pops -
cddrive.cpp
367 367 } 368 368 369 369 /* version was set by cdInit */ 370 strcpy( chString , version .chVersion );370 strcpy( chString , version::Inst().chVersion ); 371 371 return; 372 372 } 373 373 … … 383 383 void cdDate(char chString[] ) 384 384 { 385 385 /* date was set by cdInit */ 386 strcpy( chString , version .chDate );386 strcpy( chString , version::Inst().chDate ); 387 387 return; 388 388 } 389 389 -
prt_comment.cpp
159 159 /* initialize the line saver */ 160 160 wcnint(); 161 161 162 if( version .nBetaVer > 0 )162 if( version::Inst().nBetaVer > 0 ) 163 163 { 164 164 sprintf( chLine, 165 165 " !This is beta test version%4ld and is intended for testing only.", 166 version .nBetaVer );166 version::Inst().nBetaVer ); 167 167 bangin(chLine); 168 168 } 169 169 170 170 /* this flag set by call to fixit routine, 171 171 * to show that parts of the code need repair. 172 172 * lgRelease is true if this is release version */ 173 if( broke.lgFixit && !version .lgRelease )173 if( broke.lgFixit && !version::Inst().lgRelease ) 174 174 { 175 175 sprintf( chLine, " !The code needs to be fixed - search for fixit()." ); 176 176 bangin(chLine); … … 179 179 /* this flag set by call to CodeReview routine, 180 180 * to show that parts of the code need to be reviewed. 181 181 * lgRelease is true if this is release version */ 182 if( broke.lgCheckit && !version .lgRelease )182 if( broke.lgCheckit && !version::Inst().lgRelease ) 183 183 { 184 184 sprintf( chLine, " !New code needs to be reviewed - search for CodeReview()." ); 185 185 bangin(chLine);
