fix crashes reported by Debian Cylab Mayhem Team
[swftools.git] / lib / lame / version.c
blob8eed6e408e87f809621e914953f77097b81d1615
1 /*
2 * Version numbering for LAME.
4 * Copyright (c) 1999 A.L. Faber
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.
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.
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.
22 /*!
23 \file version.c
24 \brief Version numbering for LAME.
26 Contains functions which describe the version of LAME.
28 \author A.L. Faber
29 \version \$Id: version.c,v 1.2 2006/02/09 16:56:23 kramm Exp $
30 \ingroup libmp3lame
34 #include <stdlib.h>
35 #include "config_static.h"
38 #include <stdio.h>
39 #include "version.h" /* macros of version numbers */
41 #ifdef WITH_DMALLOC
42 #include <dmalloc.h>
43 #endif
45 //! Stringify \a x.
46 #define STR(x) #x
47 //! Stringify \a x, perform macro expansion.
48 #define XSTR(x) STR(x)
50 #if defined(MMX_choose_table)
51 # define V1 "MMX "
52 #else
53 # define V1 ""
54 #endif
56 #if defined(KLEMM)
57 # define V2 "KLM "
58 #else
59 # define V2 ""
60 #endif
62 #if defined(RH)
63 # define V3 "RH "
64 #else
65 # define V3 ""
66 #endif
68 //! Compile time features.
69 #define V V1 V2 V3
71 //! Get the LAME version string.
72 /*!
73 \param void
74 \return a pointer to a string which describes the version of LAME.
76 const char* get_lame_version ( void ) /* primary to write screen reports */
78 /* Here we can also add informations about compile time configurations */
80 #if LAME_ALPHA_VERSION > 0
81 static /*@observer@*/ const char *const str =
82 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " " V
83 "(alpha " XSTR(LAME_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
84 #elif LAME_BETA_VERSION > 0
85 static /*@observer@*/ const char *const str =
86 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " " V
87 "(beta " XSTR(LAME_BETA_VERSION) ", " __DATE__ ")";
88 #else
89 static /*@observer@*/ const char *const str =
90 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " " V;
91 #endif
93 return str;
97 //! Get the short LAME version string.
98 /*!
99 It's mainly for inclusion into the MP3 stream.
101 \param void
102 \return a pointer to the short version of the LAME version string.
104 const char* get_lame_short_version ( void )
106 /* adding date and time to version string makes it harder for output
107 validation */
109 #if LAME_ALPHA_VERSION > 0
110 static /*@observer@*/ const char *const str =
111 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " (alpha)";
112 #elif LAME_BETA_VERSION > 0
113 static /*@observer@*/ const char *const str =
114 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " (beta)";
115 #else
116 static /*@observer@*/ const char *const str =
117 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION);
118 #endif
120 return str;
123 //! Get the _very_ short LAME version string.
125 It's used in the LAME VBR tag only.
127 \param void
128 \return a pointer to the short version of the LAME version string.
130 const char* get_lame_very_short_version ( void )
132 /* adding date and time to version string makes it harder for output
133 validation */
135 #if LAME_ALPHA_VERSION > 0
136 static /*@observer@*/ const char *const str =
137 "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "a";
138 #elif LAME_BETA_VERSION > 0
139 static /*@observer@*/ const char *const str =
140 "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) "b";
141 #else
142 static /*@observer@*/ const char *const str =
143 "LAME" XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " ";
144 #endif
146 return str;
149 //! Get the version string for GPSYCHO.
151 \param void
152 \return a pointer to a string which describes the version of GPSYCHO.
154 const char* get_psy_version ( void )
156 #if PSY_ALPHA_VERSION > 0
157 static /*@observer@*/ const char *const str =
158 XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION)
159 " (alpha " XSTR(PSY_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
160 #elif PSY_BETA_VERSION > 0
161 static /*@observer@*/ const char *const str =
162 XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION)
163 " (beta " XSTR(PSY_BETA_VERSION) ", " __DATE__ ")";
164 #else
165 static /*@observer@*/ const char *const str =
166 XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION);
167 #endif
169 return str;
173 //! Get the URL for the LAME website.
175 \param void
176 \return a pointer to a string which is a URL for the LAME website.
178 const char* get_lame_url ( void )
180 static /*@observer@*/ const char *const str = LAME_URL;
182 return str;
186 //! Get the numerical representation of the version.
188 Writes the numerical representation of the version of LAME and
189 GPSYCHO into lvp.
191 \param lvp
193 void get_lame_version_numerical ( lame_version_t *const lvp )
195 static /*@observer@*/ const char *const features = V;
197 /* generic version */
198 lvp->major = LAME_MAJOR_VERSION;
199 lvp->minor = LAME_MINOR_VERSION;
200 lvp->alpha = LAME_ALPHA_VERSION;
201 lvp->beta = LAME_BETA_VERSION;
203 /* psy version */
204 lvp->psy_major = PSY_MAJOR_VERSION;
205 lvp->psy_minor = PSY_MINOR_VERSION;
206 lvp->psy_alpha = PSY_ALPHA_VERSION;
207 lvp->psy_beta = PSY_BETA_VERSION;
209 /* compile time features */
210 /*@-mustfree@*/
211 lvp->features = features;
212 /*@=mustfree@*/
215 /* end of version.c */