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.17 2001/02/20 18:17:59 aleidinger Exp $
30 \ingroup libmp3lame
31
32 \todo The mp3x version should be located in the mp3x source,
33 not in the libmp3lame source.
34 */
35
36
37 #ifdef HAVE_CONFIG_H
38 # include <config.h>
39 #endif
40
41
42 #include <stdio.h>
43 #include <lame.h>
44 #include "version.h" /* macros of version numbers */
45
46 #ifdef WITH_DMALLOC
47 #include <dmalloc.h>
48 #endif
49
50 //! Stringify \a x.
51 #define STR(x) #x
52 //! Stringify \a x, perform macro expansion.
53 #define XSTR(x) STR(x)
54
55 #if defined(MMX_choose_table)
56 # define V1 "MMX "
57 #else
58 # define V1 ""
59 #endif
60
61 #if defined(KLEMM)
62 # define V2 "KLM "
63 #else
64 # define V2 ""
65 #endif
66
67 #if defined(RH)
68 # define V3 "RH "
69 #else
70 # define V3 ""
71 #endif
72
73 //! Compile time features.
74 #define V V1 V2 V3
75
76 //! Get the LAME version string.
77 /*!
78 \param void
79 \return a pointer to a string which describes the version of LAME.
80 */
get_lame_version(void)81 const char* get_lame_version ( void ) /* primary to write screen reports */
82 {
83 /* Here we can also add informations about compile time configurations */
84
85 #if LAME_ALPHA_VERSION > 0
86 static /*@observer@*/ const char *const str =
87 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " " V
88 "(alpha " XSTR(LAME_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
89 #elif LAME_BETA_VERSION > 0
90 static /*@observer@*/ const char *const str =
91 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " " V
92 "(beta " XSTR(LAME_BETA_VERSION) ", " __DATE__ ")";
93 #else
94 static /*@observer@*/ const char *const str =
95 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " " V;
96 #endif
97
98 return str;
99 }
100
101
102 //! Get the short LAME version string.
103 /*!
104 It's mainly for inclusion into the MP3 stream.
105
106 \param void
107 \return a pointer to the short version of the LAME version string.
108 */
get_lame_short_version(void)109 const char* get_lame_short_version ( void )
110 {
111 /* adding date and time to version string makes it harder for output
112 validation */
113
114 #if LAME_ALPHA_VERSION > 0
115 static /*@observer@*/ const char *const str =
116 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " (alpha)";
117 #elif LAME_BETA_VERSION > 0
118 static /*@observer@*/ const char *const str =
119 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION) " (beta)";
120 #else
121 static /*@observer@*/ const char *const str =
122 XSTR(LAME_MAJOR_VERSION) "." XSTR(LAME_MINOR_VERSION)
123 #endif
124
125 return str;
126 }
127
128
129 //! Get the version string for GPSYCHO.
130 /*!
131 \param void
132 \return a pointer to a string which describes the version of GPSYCHO.
133 */
get_psy_version(void)134 const char* get_psy_version ( void )
135 {
136 #if PSY_ALPHA_VERSION > 0
137 static /*@observer@*/ const char *const str =
138 XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION)
139 " (alpha " XSTR(PSY_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
140 #elif PSY_BETA_VERSION > 0
141 static /*@observer@*/ const char *const str =
142 XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION)
143 " (beta " XSTR(PSY_BETA_VERSION) ", " __DATE__ ")";
144 #else
145 static /*@observer@*/ const char *const str =
146 XSTR(PSY_MAJOR_VERSION) "." XSTR(PSY_MINOR_VERSION);
147 #endif
148
149 return str;
150 }
151
152
153 //! Get the mp3x version string.
154 /*!
155 \param void
156 \return a pointer to a string which describes the version of mp3x.
157 */
get_mp3x_version(void)158 const char* get_mp3x_version ( void )
159 {
160 #if MP3X_ALPHA_VERSION > 0
161 static /*@observer@*/ const char *const str =
162 XSTR(MP3X_MAJOR_VERSION) "." XSTR(MP3X_MINOR_VERSION)
163 " (alpha " XSTR(MP3X_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
164 #elif MP3X_BETA_VERSION > 0
165 static /*@observer@*/ const char *const str =
166 XSTR(MP3X_MAJOR_VERSION) "." XSTR(MP3X_MINOR_VERSION)
167 " (beta " XSTR(MP3X_BETA_VERSION) ", " __DATE__ ")";
168 #else
169 static /*@observer@*/ const char *const str =
170 XSTR(MP3X_MAJOR_VERSION) "." XSTR(MP3X_MINOR_VERSION);
171 #endif
172
173 return str;
174 }
175
176
177 //! Get the URL for the LAME website.
178 /*!
179 \param void
180 \return a pointer to a string which is a URL for the LAME website.
181 */
get_lame_url(void)182 const char* get_lame_url ( void )
183 {
184 static /*@observer@*/ const char *const str = LAME_URL;
185
186 return str;
187 }
188
189
190 //! Get the numerical representation of the version.
191 /*!
192 Writes the numerical representation of the version of LAME and
193 GPSYCHO into lvp.
194
195 \param lvp
196 */
get_lame_version_numerical(lame_version_t * const lvp)197 void get_lame_version_numerical ( lame_version_t *const lvp )
198 {
199 static /*@observer@*/ const char *const features = V;
200
201 /* generic version */
202 lvp->major = LAME_MAJOR_VERSION;
203 lvp->minor = LAME_MINOR_VERSION;
204 lvp->alpha = LAME_ALPHA_VERSION;
205 lvp->beta = LAME_BETA_VERSION;
206
207 /* psy version */
208 lvp->psy_major = PSY_MAJOR_VERSION;
209 lvp->psy_minor = PSY_MINOR_VERSION;
210 lvp->psy_alpha = PSY_ALPHA_VERSION;
211 lvp->psy_beta = PSY_BETA_VERSION;
212
213 /* compile time features */
214 /*@-mustfree@*/
215 lvp->features = features;
216 /*@=mustfree@*/
217 }
218
219 /* end of version.c */
220