Hi all,
I added some macros in util.h.
------
#define LAME_STD_PRINT
#ifdef LAME_STD_PRINT
extern void lame_errorf(const char *, ...);
#define DEBUGF printf
#define ERRORF lame_errorf
#define MSGF lame_errorf
#define FLUSH_DEBUG() fflush(stdout)
#define FLUSH_ERROR() fflush(stderr)
#define FLUSH_MSG() fflush(stderr)
#endif
#define LAME_ASSERT(x) assert(x)
#define LAME_EXIT(n) exit(n)
#define LAME_NORMAL_EXIT() exit(0)
#define LAME_ERROR_EXIT() exit(1)
#define LAME_FATAL_EXIT() exit(2)
------
lame_errorf() was added in util.c.
I intend to replace fprintf(),printf(),assert() and exit()
with these macros.
These macros will be used like this:
DEBUGF("%d: r = %f\n", i, r); // debugging message
MSGF("multiple pipeline mode was selected.\n");
// information for users
LAME_ASSERT(ee >= 0); // assertion
if (len == 0) {
ERRORF("illegal length\n"); // error message
LAME_ERROR_EXIT(); // program will quit
// with result code = 1
}
These macros would be helpful when using LAME as a library.
The messages might be omitted, or output with alternative
methods.
Iwasa Kazmi
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )