[Freeswitch-svn] [commit] r12547 - in freeswitch/trunk/libs/libteletone: . src

FreeSWITCH SVN mikej at freeswitch.org
Tue Mar 10 08:45:30 PDT 2009


Author: mikej
Date: Tue Mar 10 10:45:29 2009
New Revision: 12547

Log:
update api visibility macros for windows

Modified:
   freeswitch/trunk/libs/libteletone/libteletone.2008.vcproj
   freeswitch/trunk/libs/libteletone/libteletone.vcproj
   freeswitch/trunk/libs/libteletone/src/libteletone.h
   freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
   freeswitch/trunk/libs/libteletone/src/libteletone_detect.h
   freeswitch/trunk/libs/libteletone/src/libteletone_generate.c
   freeswitch/trunk/libs/libteletone/src/libteletone_generate.h

Modified: freeswitch/trunk/libs/libteletone/libteletone.2008.vcproj
==============================================================================
--- freeswitch/trunk/libs/libteletone/libteletone.2008.vcproj	(original)
+++ freeswitch/trunk/libs/libteletone/libteletone.2008.vcproj	Tue Mar 10 10:45:29 2009
@@ -45,7 +45,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -122,7 +122,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -199,7 +199,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="4"
@@ -272,7 +272,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="4"

Modified: freeswitch/trunk/libs/libteletone/libteletone.vcproj
==============================================================================
--- freeswitch/trunk/libs/libteletone/libteletone.vcproj	(original)
+++ freeswitch/trunk/libs/libteletone/libteletone.vcproj	Tue Mar 10 10:45:29 2009
@@ -41,7 +41,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -119,7 +119,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="4"

Modified: freeswitch/trunk/libs/libteletone/src/libteletone.h
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone.h	(original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone.h	Tue Mar 10 10:45:29 2009
@@ -110,10 +110,30 @@
 #define teletone_assert(expr) assert(expr)
 #endif
 
+#ifdef _MSC_VER
+#if defined(TT_DECLARE_STATIC)
+#define TELETONE_API(type)			type __stdcall
+#define TELETONE_API_NONSTD(type)		type __cdecl
+#define TELETONE_API_DATA
+#elif defined(TELETONE_EXPORTS)
+#define TELETONE_API(type)			__declspec(dllexport) type __stdcall
+#define TELETONE_API_NONSTD(type)		__declspec(dllexport) type __cdecl
+#define TELETONE_API_DATA				__declspec(dllexport)
+#else
+#define TELETONE_API(type)			__declspec(dllimport) type __stdcall
+#define TELETONE_API_NONSTD(type)		__declspec(dllimport) type __cdecl
+#define TELETONE_API_DATA				__declspec(dllimport)
+#endif
+#else
 #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
-#define TELETONE_API __attribute__((visibility("default")))
+#define TELETONE_API(type)		__attribute__((visibility("default"))) type
+#define TELETONE_API_NONSTD(type)	__attribute__((visibility("default"))) type
+#define TELETONE_API_DATA		__attribute__((visibility("default")))
 #else
-#define TELETONE_API
+#define TELETONE_API(type)		type
+#define TELETONE_API_NONSTD(type)	type
+#define TELETONE_API_DATA
+#endif
 #endif
 
 #include <libteletone_generate.h>

Modified: freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_detect.c	(original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_detect.c	Tue Mar 10 10:45:29 2009
@@ -116,7 +116,7 @@
 	goertzel_state->fac = tdesc->fac;
 }
 
-TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
 							  int16_t sample_buffer[],
 							  int samples)
 {
@@ -135,7 +135,7 @@
 
 #define teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac))
 
-TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
+TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
 {
 	int i;
 	float theta;
@@ -169,7 +169,7 @@
 	dtmf_detect_state->mhit = 0;
 }
 
-TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
+TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
 {
 	float theta = 0;
 	int x = 0;
@@ -209,7 +209,7 @@
 
 }
 
-TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
+TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt,
 								int16_t sample_buffer[],
 								int samples)
 {
@@ -299,7 +299,7 @@
 }
 
 
-TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
 						  int16_t sample_buffer[],
 						  int samples)
 {
@@ -430,7 +430,7 @@
 }
 
 
-TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
 					   char *buf,
 					   int max)
 {

Modified: freeswitch/trunk/libs/libteletone/src/libteletone_detect.h
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_detect.h	(original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_detect.h	Tue Mar 10 10:45:29 2009
@@ -202,7 +202,7 @@
 	  \param mt the multi-frequency tone descriptor
 	  \param map a representation of the multi-frequency tone
 	*/
-TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
+TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
 
 	/*! 
 	  \brief Check a sample buffer for the presence of the mulit-frequency tone described by mt
@@ -211,7 +211,7 @@
 	  \param samples the number of samples present in sample_buffer
 	  \return true when the tone was detected or false when it is not
 	*/
-TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
+TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt,
 									int16_t sample_buffer[],
 									int samples);
 
@@ -220,7 +220,7 @@
 	  \param dtmf_detect_state the DTMF detection state to initilize
 	  \param sample_rate the desired sample rate
 	*/
-TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
+TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
 
 	/*! 
 	  \brief Check a sample buffer for the presence of DTMF digits
@@ -229,7 +229,7 @@
 	  \param samples the number of samples present in sample_buffer
 	  \return true when DTMF was detected or false when it is not
 	*/
-TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
 							  int16_t sample_buffer[],
 							  int samples);
 	/*! 
@@ -239,7 +239,7 @@
 	  \param max the maximum length of buf
 	  \return the number of characters written to buf
 	*/
-TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
 						   char *buf,
 						   int max);
 
@@ -249,7 +249,7 @@
 	  \param sample_buffer an array aof 16 bit signed linear samples
 	  \param samples the number of samples present in sample_buffer
 	*/
-TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
 								  int16_t sample_buffer[],
 								  int samples);
 

Modified: freeswitch/trunk/libs/libteletone/src/libteletone_generate.c
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_generate.c	(original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_generate.c	Tue Mar 10 10:45:29 2009
@@ -79,7 +79,7 @@
 #pragma warning(disable:4706)
 #endif
 
-TELETONE_API int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
+TELETONE_API_DATA int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
 	0x00c9, 0x025b, 0x03ed, 0x057f, 0x0711, 0x08a2, 0x0a33, 0x0bc4,
 	0x0d54, 0x0ee4, 0x1073, 0x1201, 0x138f, 0x151c, 0x16a8, 0x1833,
 	0x19be, 0x1b47, 0x1cd0, 0x1e57, 0x1fdd, 0x2162, 0x22e5, 0x2467,
@@ -99,7 +99,7 @@
 };
 
 
-TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
+TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
 {
 	va_list ap;
 	int i = 0;
@@ -115,7 +115,7 @@
 	
 }
 
-TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...)
+TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...)
 {
 	va_list ap;
 	int i = 0;
@@ -131,7 +131,7 @@
 	
 }
 
-TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
+TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
 {
 	memset(ts, 0, sizeof(*ts));
 	ts->rate = 8000;
@@ -174,7 +174,7 @@
 	return 0;
 }
 
-TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts)
+TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts)
 {
 	if (ts->buffer) {
 		free(ts->buffer);
@@ -203,7 +203,7 @@
 	return 0;
 }
 
-TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
+TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
 {
 	/*teletone_process_t period = (1.0 / ts->rate) / ts->channels;*/
 	int i, c;
@@ -318,7 +318,7 @@
 	return (char *) memcpy (new, s, len);
 }
 
-TELETONE_API int teletone_run(teletone_generation_session_t *ts, const char *cmd)
+TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd)
 {
 	char *data = NULL, *cur = NULL, *end = NULL;
 	int var = 0, LOOPING = 0;

Modified: freeswitch/trunk/libs/libteletone/src/libteletone_generate.h
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_generate.h	(original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_generate.h	Tue Mar 10 10:45:29 2009
@@ -137,7 +137,7 @@
 /* 3.02 represents twice the power */
 #define DBM0_MAX_POWER (3.14f + 3.02f)
 
-TELETONE_API extern int16_t TELETONE_SINES[SINE_TABLE_MAX];
+TELETONE_API_DATA extern int16_t TELETONE_SINES[SINE_TABLE_MAX];
 
 static __inline__ int32_t teletone_dds_phase_rate(teletone_process_t tone, uint32_t rate)
 {
@@ -255,7 +255,7 @@
   \param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
   \return 0
 */
-TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index, ...);
+TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...);
 
 /*! 
   \brief Assign a set of tones to a single tone map
@@ -263,7 +263,7 @@
   \param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
   \return 0
 */
-TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...);
+TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...);
 
 /*! 
   \brief Initilize a tone generation session
@@ -273,14 +273,14 @@
   \param user_data optional user data to send
   \return 0
 */
-TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data);
+TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data);
 
 /*! 
   \brief Free the buffer allocated by a tone generation session
   \param ts the tone generation session to destroy
   \return 0
 */
-TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts);
+TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts);
 
 /*! 
   \brief Execute a single tone generation instruction
@@ -288,7 +288,7 @@
   \param map the tone mapping to use for the frequencies
   \return 0
 */
-TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map);
+TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map);
 
 /*! 
   \brief Execute a tone generation script and call callbacks after each instruction
@@ -296,7 +296,7 @@
   \param cmd the script to execute
   \return 0
 */
-TELETONE_API int teletone_run(teletone_generation_session_t *ts, const char *cmd);
+TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd);
 
 #ifdef __cplusplus
 }



More information about the Freeswitch-svn mailing list