]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update api visibility macros for windows
authorMichael Jerris <mike@jerris.com>
Tue, 10 Mar 2009 15:45:29 +0000 (15:45 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 10 Mar 2009 15:45:29 +0000 (15:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12547 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/libteletone/libteletone.2008.vcproj
libs/libteletone/libteletone.vcproj
libs/libteletone/src/libteletone.h
libs/libteletone/src/libteletone_detect.c
libs/libteletone/src/libteletone_detect.h
libs/libteletone/src/libteletone_generate.c
libs/libteletone/src/libteletone_generate.h

index f738b22126c74eda946ea58e5bd52dd9348835fd..35a39c740674ca5a84cad7c32880c213292b17b1 100644 (file)
@@ -45,7 +45,7 @@
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
                                AdditionalIncludeDirectories="src"\r
-                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
                                MinimalRebuild="true"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="3"\r
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
                                AdditionalIncludeDirectories="src"\r
-                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
                                MinimalRebuild="true"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="3"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                AdditionalIncludeDirectories="src"\r
-                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
                                RuntimeLibrary="2"\r
                                UsePrecompiledHeader="0"\r
                                WarningLevel="4"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                AdditionalIncludeDirectories="src"\r
-                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
                                RuntimeLibrary="2"\r
                                UsePrecompiledHeader="0"\r
                                WarningLevel="4"\r
index 01763221015430fda9016d85328184b773070e51..94cf2470490d25451cf3a25866dcc4f93caaeda0 100644 (file)
@@ -41,7 +41,7 @@
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
                                AdditionalIncludeDirectories="src"\r
-                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
                                MinimalRebuild="true"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="3"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                AdditionalIncludeDirectories="src"\r
-                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
                                RuntimeLibrary="2"\r
                                UsePrecompiledHeader="0"\r
                                WarningLevel="4"\r
index aa5f840a0440673de62cdd1de846c3b5866cf156..4029facce84fefa25e8570a7aa3d88203de04fa6 100644 (file)
@@ -110,10 +110,30 @@ typedef __int16 int16_t;
 #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>
index 1274e3e059957e6cf7cb248b8f5b9cbe14d698de..1ff26e3e436343f4aac444695810d0d8ab95cb8c 100644 (file)
@@ -116,7 +116,7 @@ static void goertzel_init(teletone_goertzel_state_t *goertzel_state, teletone_de
        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 @@ TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_s
 
 #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 @@ TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_
        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 void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_t
 
 }
 
-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_multi_tone_detect (teletone_multi_tone_t *mt,
 }
 
 
-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_detect (teletone_dtmf_detect_state_t *dtmf_detect
 }
 
 
-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)
 {
index d8c47136ba431b96513cc2aced432109eafebcf5..a9fee6cfbd973d159fe3ea92a8be41d556c9fa9b 100644 (file)
@@ -202,7 +202,7 @@ extern "C" {
          \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 @@ TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_t
          \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 @@ TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
          \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 @@ TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_
          \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 @@ TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect
          \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 @@ TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_st
          \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);
 
index 268faa317a8ae596d1533eb04994793c1ac8a102..911e3c27971320f6a48257542eaa33ed615b49c2 100644 (file)
@@ -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 int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
 };
 
 
-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_tone(teletone_generation_session_t *ts, int index,
        
 }
 
-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_set_map(teletone_tone_map_t *map, ...)
        
 }
 
-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 @@ TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int bu
        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 @@ static int ensure_buffer(teletone_generation_session_t *ts, int need)
        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 @@ static char *my_strdup (const char *s)
        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;
index 818c60f74776ed3ea8702ff9936e20bd3e1f0560..a6addc4eb88ef29e0f6f10be3389e65ee2c01011 100644 (file)
@@ -137,7 +137,7 @@ typedef struct teletone_dds_state teletone_dds_state_t;
 /* 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 @@ typedef struct teletone_generation_session teletone_generation_session_t;
   \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 @@ TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index,
   \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 @@ TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...);
   \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 @@ TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts);
   \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 @@ TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_
   \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
 }