00001 /* 00002 * Version numbering for LAME. 00003 * 00004 * Copyright (c) 1999 A.L. Faber 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the 00018 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 * Boston, MA 02111-1307, USA. 00020 */ 00021 00034 #ifdef HAVE_CONFIG_H 00035 # include <config.h> 00036 #endif 00037 00038 00039 #include "lame.h" 00040 #include "machine.h" 00041 00042 #include "version.h" /* macros of version numbers */ 00043 00044 00046 #define STR(x) #x 00047 00048 #define XSTR(x) STR(x) 00049 00050 00051 00057 const char * 00058 get_lame_version(void) 00059 { /* primary to write screen reports */ 00060 /* Here we can also add informations about compile time configurations */ 00061 00062 #if LAME_ALPHA_VERSION 00063 static /*@observer@ */ const char *const str = 00064 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " " 00065 "(alpha " XSTR(LAME_PATCH_VERSION) ", " __DATE__ " " __TIME__ ")"; 00066 #elif LAME_BETA_VERSION 00067 static /*@observer@ */ const char *const str = 00068 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " " 00069 "(beta " XSTR(LAME_PATCH_VERSION) ", " __DATE__ ")"; 00070 #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0) 00071 static /*@observer@ */ const char *const str = 00072 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "." XSTR(LAME_PATCH_VERSION); 00073 #else 00074 static /*@observer@ */ const char *const str = 00075 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION); 00076 #endif 00077 00078 return str; 00079 } 00080 00081 00089 const char * 00090 get_lame_short_version(void) 00091 { 00092 /* adding date and time to version string makes it harder for output 00093 validation */ 00094 00095 #if LAME_ALPHA_VERSION 00096 static /*@observer@ */ const char *const str = 00097 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " (alpha)"; 00098 #elif LAME_BETA_VERSION 00099 static /*@observer@ */ const char *const str = 00100 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " (beta)"; 00101 #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0) 00102 static /*@observer@ */ const char *const str = 00103 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "." XSTR(LAME_PATCH_VERSION); 00104 #else 00105 static /*@observer@ */ const char *const str = 00106 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION); 00107 #endif 00108 00109 return str; 00110 } 00111 00119 const char * 00120 get_lame_very_short_version(void) 00121 { 00122 /* adding date and time to version string makes it harder for output 00123 validation */ 00124 00125 #if LAME_ALPHA_VERSION 00126 static /*@observer@ */ const char *const str = 00127 "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "a"; 00128 #elif LAME_BETA_VERSION 00129 static /*@observer@ */ const char *const str = 00130 "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "b"; 00131 #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0) 00132 static /*@observer@ */ const char *const str = 00133 "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "r"; 00134 #else 00135 static /*@observer@ */ const char *const str = 00136 "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " "; 00137 #endif 00138 00139 return str; 00140 } 00141 00147 const char * 00148 get_psy_version(void) 00149 { 00150 #if PSY_ALPHA_VERSION > 0 00151 static /*@observer@ */ const char *const str = 00152 XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION) 00153 " (alpha " XSTR(PSY_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")"; 00154 #elif PSY_BETA_VERSION > 0 00155 static /*@observer@ */ const char *const str = 00156 XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION) 00157 " (beta " XSTR(PSY_BETA_VERSION) ", " __DATE__ ")"; 00158 #else 00159 static /*@observer@ */ const char *const str = 00160 XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION); 00161 #endif 00162 00163 return str; 00164 } 00165 00166 00172 const char * 00173 get_lame_url(void) 00174 { 00175 static /*@observer@ */ const char *const str = LAME_URL; 00176 00177 return str; 00178 } 00179 00180 00188 void 00189 get_lame_version_numerical(lame_version_t * const lvp) 00190 { 00191 static /*@observer@ */ const char *const features = ""; /* obsolete */ 00192 00193 /* generic version */ 00194 lvp->major = LAME_MAJOR_VERSION; 00195 lvp->minor = LAME_MINOR_VERSION; 00196 #if LAME_ALPHA_VERSION 00197 lvp->alpha = LAME_PATCH_VERSION; 00198 lvp->beta = 0; 00199 #elif LAME_BETA_VERSION 00200 lvp->alpha = 0; 00201 lvp->beta = LAME_PATCH_VERSION; 00202 #else 00203 lvp->alpha = 0; 00204 lvp->beta = 0; 00205 #endif 00206 00207 /* psy version */ 00208 lvp->psy_major = PSY_MAJOR_VERSION; 00209 lvp->psy_minor = PSY_MINOR_VERSION; 00210 lvp->psy_alpha = PSY_ALPHA_VERSION; 00211 lvp->psy_beta = PSY_BETA_VERSION; 00212 00213 /* compile time features */ 00214 /*@-mustfree@ */ 00215 lvp->features = features; 00216 /*@=mustfree@ */ 00217 } 00218 00219 00220 const char * 00221 get_lame_os_bitness(void) 00222 { 00223 static /*@observer@ */ const char *const strXX = ""; 00224 static /*@observer@ */ const char *const str32 = "32bits"; 00225 static /*@observer@ */ const char *const str64 = "64bits"; 00226 00227 switch (sizeof(void *)) { 00228 case 4: 00229 return str32; 00230 00231 case 8: 00232 return str64; 00233 00234 default: 00235 return strXX; 00236 } 00237 } 00238 00239 /* end of version.c */