Newer
Older
monitord / lame-3.97 / libmp3lame / .svn / text-base / version.c.svn-base
  1. /*
  2. * Version numbering for LAME.
  3. *
  4. * Copyright (c) 1999 A.L. Faber
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21.  
  22. /*!
  23. \file version.c
  24. \brief Version numbering for LAME.
  25.  
  26. Contains functions which describe the version of LAME.
  27.  
  28. \author A.L. Faber
  29. \version \$Id: version.c,v 1.24 2005/08/28 17:02:11 bouvigne Exp $
  30. \ingroup libmp3lame
  31. */
  32.  
  33.  
  34. #ifdef HAVE_CONFIG_H
  35. # include <config.h>
  36. #endif
  37.  
  38.  
  39. #include <stdio.h>
  40. #include "version.h" /* macros of version numbers */
  41.  
  42. #ifdef WITH_DMALLOC
  43. #include <dmalloc.h>
  44. #endif
  45.  
  46. /*! Stringify \a x. */
  47. #define STR(x) #x
  48. /*! Stringify \a x, perform macro expansion. */
  49. #define XSTR(x) STR(x)
  50.  
  51.  
  52.  
  53. /*! Get the LAME version string. */
  54. /*!
  55. \param void
  56. \return a pointer to a string which describes the version of LAME.
  57. */
  58. const char* get_lame_version ( void ) /* primary to write screen reports */
  59. {
  60. /* Here we can also add informations about compile time configurations */
  61.  
  62. #if LAME_ALPHA_VERSION
  63. static /*@observer@*/ const char *const str =
  64. XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " "
  65. "(alpha " XSTR(LAME_PATCH_VERSION) ", " __DATE__ " " __TIME__ ")";
  66. #elif LAME_BETA_VERSION
  67. static /*@observer@*/ const char *const str =
  68. XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " "
  69. "(beta " XSTR(LAME_PATCH_VERSION) ", " __DATE__ ")";
  70. #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
  71. static /*@observer@*/ const char *const str =
  72. XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "." XSTR(LAME_PATCH_VERSION);
  73. #else
  74. static /*@observer@*/ const char *const str =
  75. XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION);
  76. #endif
  77.  
  78. return str;
  79. }
  80.  
  81.  
  82. /*! Get the short LAME version string. */
  83. /*!
  84. It's mainly for inclusion into the MP3 stream.
  85.  
  86. \param void
  87. \return a pointer to the short version of the LAME version string.
  88. */
  89. const char* get_lame_short_version ( void )
  90. {
  91. /* adding date and time to version string makes it harder for output
  92. validation */
  93.  
  94. #if LAME_ALPHA_VERSION
  95. static /*@observer@*/ const char *const str =
  96. XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " (alpha)";
  97. #elif LAME_BETA_VERSION
  98. static /*@observer@*/ const char *const str =
  99. XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " (beta)";
  100. #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
  101. static /*@observer@*/ const char *const str =
  102. XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "." XSTR(LAME_PATCH_VERSION);
  103. #else
  104. static /*@observer@*/ const char *const str =
  105. XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION);
  106. #endif
  107.  
  108. return str;
  109. }
  110.  
  111. /*! Get the _very_ short LAME version string. */
  112. /*!
  113. It's used in the LAME VBR tag only.
  114.  
  115. \param void
  116. \return a pointer to the short version of the LAME version string.
  117. */
  118. const char* get_lame_very_short_version ( void )
  119. {
  120. /* adding date and time to version string makes it harder for output
  121. validation */
  122.  
  123. #if LAME_ALPHA_VERSION
  124. static /*@observer@*/ const char *const str =
  125. "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "a";
  126. #elif LAME_BETA_VERSION
  127. static /*@observer@*/ const char *const str =
  128. "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "b";
  129. #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
  130. static /*@observer@*/ const char *const str =
  131. "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "r";
  132. #else
  133. static /*@observer@*/ const char *const str =
  134. "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " ";
  135. #endif
  136.  
  137. return str;
  138. }
  139.  
  140. /*! Get the version string for GPSYCHO. */
  141. /*!
  142. \param void
  143. \return a pointer to a string which describes the version of GPSYCHO.
  144. */
  145. const char* get_psy_version ( void )
  146. {
  147. #if PSY_ALPHA_VERSION > 0
  148. static /*@observer@*/ const char *const str =
  149. XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION)
  150. " (alpha " XSTR(PSY_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
  151. #elif PSY_BETA_VERSION > 0
  152. static /*@observer@*/ const char *const str =
  153. XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION)
  154. " (beta " XSTR(PSY_BETA_VERSION) ", " __DATE__ ")";
  155. #else
  156. static /*@observer@*/ const char *const str =
  157. XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION);
  158. #endif
  159.  
  160. return str;
  161. }
  162.  
  163.  
  164. /*! Get the URL for the LAME website. */
  165. /*!
  166. \param void
  167. \return a pointer to a string which is a URL for the LAME website.
  168. */
  169. const char* get_lame_url ( void )
  170. {
  171. static /*@observer@*/ const char *const str = LAME_URL;
  172.  
  173. return str;
  174. }
  175.  
  176.  
  177. /*! Get the numerical representation of the version. */
  178. /*!
  179. Writes the numerical representation of the version of LAME and
  180. GPSYCHO into lvp.
  181.  
  182. \param lvp
  183. */
  184. void get_lame_version_numerical ( lame_version_t *const lvp )
  185. {
  186. static /*@observer@*/ const char *const features = ""; /* obsolete */
  187.  
  188. /* generic version */
  189. lvp->major = LAME_MAJOR_VERSION;
  190. lvp->minor = LAME_MINOR_VERSION;
  191. #if LAME_ALPHA_VERSION
  192. lvp->alpha = LAME_PATCH_VERSION;
  193. lvp->beta = 0;
  194. #elif LAME_BETA_VERSION
  195. lvp->alpha = 0;
  196. lvp->beta = LAME_PATCH_VERSION;
  197. #else
  198. lvp->alpha = 0;
  199. lvp->beta = 0;
  200. #endif
  201.  
  202. /* psy version */
  203. lvp->psy_major = PSY_MAJOR_VERSION;
  204. lvp->psy_minor = PSY_MINOR_VERSION;
  205. lvp->psy_alpha = PSY_ALPHA_VERSION;
  206. lvp->psy_beta = PSY_BETA_VERSION;
  207.  
  208. /* compile time features */
  209. /*@-mustfree@*/
  210. lvp->features = features;
  211. /*@=mustfree@*/
  212. }
  213.  
  214.  
  215. const char* get_lame_os_bitness ( void )
  216. {
  217. static /*@observer@*/ const char *const strXX = "";
  218. static /*@observer@*/ const char *const str32 = "32bits";
  219. static /*@observer@*/ const char *const str64 = "64bits";
  220.  
  221. switch (sizeof(void*)){
  222. case 4:
  223. return str32;
  224. break;
  225. case 8:
  226. return str64;
  227. break;
  228. default:
  229. return strXX;
  230. }
  231. }
  232.  
  233. /* end of version.c */
  234.