Add error message if code is compiled with a C++ compiler.

This commit is contained in:
Erik de Castro Lopo 2005-02-01 10:46:28 +00:00
parent 6b1948a329
commit f22b1f7aa7
3 changed files with 34 additions and 23 deletions

View File

@ -27,14 +27,17 @@
#ifndef G72X_PRIVATE_H
#define G72X_PRIVATE_H
#ifdef __cplusplus
#error "This code is not designed to be compiled with a C++ compiler."
#endif
/*
** The following is the definition of the state structure used by the
** G.721/G.723 encoder and decoder to preserve their internal state
** between successive calls. The meanings of the majority of the state
** structure fields are explained in detail in the CCITT Recommendation
** G.721. The field names are essentially identical to variable names
** in the bit level description of the coding algorithm included in this
** between successive calls. The meanings of the majority of the state
** structure fields are explained in detail in the CCITT Recommendation
** G.721. The field names are essentially identical to variable names
** in the bit level description of the coding algorithm included in this
** Recommendation.
*/
@ -62,19 +65,19 @@ typedef struct private_g72x
** format.
*/
char td; /* delayed tone detect, new in 1988 version */
/* The following struct members were added for libsndfile. The original
** code worked by calling a set of functions on a sample by sample basis
** which is slow on architectures like Intel x86. For libsndfile, this
/* The following struct members were added for libsndfile. The original
** code worked by calling a set of functions on a sample by sample basis
** which is slow on architectures like Intel x86. For libsndfile, this
** was changed so that the encoding and decoding routines could work on
** a block of samples at a time to reduce the function call overhead.
*/
int (*encoder) (int, struct private_g72x* state) ;
int (*decoder) (int, struct private_g72x* state) ;
int codec_bits ;
int byte_index, sample_index ;
} G72x_STATE ;
@ -111,7 +114,7 @@ void private_init_state (G72x_STATE *state_ptr) ;
#endif /* G72X_PRIVATE_H */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b

View File

@ -10,7 +10,11 @@
/* Added by Erik de Castro Lopo */
#define USE_FLOAT_MUL
#define FAST
#define WAV49
#define WAV49
#ifdef __cplusplus
#error "This code is not designed to be compiled with a C++ compiler."
#endif
/* Added by Erik de Castro Lopo */
@ -21,7 +25,7 @@ typedef int longword; /* 32 bit signed int */
typedef unsigned short uword; /* unsigned word */
typedef unsigned int ulongword; /* unsigned longword */
struct gsm_state
struct gsm_state
{ word dp0[ 280 ] ;
word z1; /* preprocessing.c, Offset_com. */
@ -93,7 +97,7 @@ longword gsm_L_asr (longword a, int n) ;
word gsm_asr (word a, int n) ;
/*
* Inlined functions from add.h
* Inlined functions from add.h
*/
static inline longword
@ -114,17 +118,17 @@ GSM_L_MULT (word a, word b)
static inline longword
GSM_L_ADD (longword a, longword b)
{ ulongword utmp ;
if (a < 0 && b < 0)
{ utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1) ;
return (utmp >= (ulongword) MAX_LONGWORD) ? MIN_LONGWORD : -(longword)utmp-2 ;
} ;
if (a > 0 && b > 0)
{ utmp = (ulongword) a + (ulongword) b ;
return (utmp >= (ulongword) MAX_LONGWORD) ? MAX_LONGWORD : utmp ;
} ;
return a + b ;
} /* GSM_L_ADD */
@ -147,12 +151,12 @@ GSM_SUB (word a, word b)
{ longword ltmp ;
ltmp = ((longword) a) - ((longword) b) ;
if (ltmp >= MAX_WORD)
ltmp = MAX_WORD ;
else if (ltmp <= MIN_WORD)
ltmp = MIN_WORD ;
return ltmp ;
} /* GSM_SUB */
@ -200,10 +204,10 @@ void Gsm_Preprocess (
void Gsm_Encoding (
struct gsm_state * S,
word * e,
word * ep,
word * e,
word * ep,
word * xmaxc,
word * Mc,
word * Mc,
word * xMc) ;
void Gsm_Short_Term_Analysis_Filter (
@ -296,7 +300,7 @@ extern word gsm_FAC [8] ;
#endif /* PRIVATE_H */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 8bc5fdf2-e8c8-4686-9bd7-a30b512bef0c

View File

@ -29,6 +29,10 @@
#include <stdint.h>
#endif
#ifdef __cplusplus
#error "This code is not designed to be compiled with a C++ compiler."
#endif
#ifdef UNUSED
#elif defined (__GNUC__)
# define UNUSED(x) UNUSED_ ## x __attribute__ ((unused))