提交 6c1e0688 authored 作者: Michael Jerris's avatar Michael Jerris

add macros for api visibility to openzap

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@688 a93c3328-9c30-0410-af19-c9cd2b2d52af
上级 36d330d3
......@@ -19,7 +19,7 @@
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
ConfigurationType="2"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
>
......@@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......@@ -52,7 +52,7 @@
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
......@@ -65,11 +65,14 @@
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
......@@ -79,6 +82,12 @@
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
......@@ -87,7 +96,7 @@
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
......@@ -110,7 +119,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
RuntimeLibrary="2"
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
......@@ -131,11 +140,14 @@
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
......@@ -145,6 +157,12 @@
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
......
......@@ -20,7 +20,7 @@
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
ConfigurationType="2"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
>
......@@ -43,7 +43,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......@@ -53,7 +53,7 @@
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
......@@ -66,11 +66,14 @@
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
......@@ -80,6 +83,9 @@
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
......@@ -88,7 +94,7 @@
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
......@@ -111,7 +117,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
RuntimeLibrary="2"
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
......@@ -132,11 +138,14 @@
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
......@@ -146,6 +155,9 @@
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
......
......@@ -110,6 +110,32 @@ 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(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(type) type
#define TELETONE_API_NONSTD(type) type
#define TELETONE_API_DATA
#endif
#endif
#include <libteletone_generate.h>
#include <libteletone_detect.h>
......@@ -131,5 +157,5 @@ typedef __int16 int16_t;
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
......@@ -169,7 +169,7 @@ extern "C" {
\param mt the multi-frequency tone descriptor
\param map a representation of the multi-frequency tone
*/
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
......@@ -178,7 +178,7 @@ extern "C" {
\param samples the number of samples present in sample_buffer
\return true when the tone was detected or false when it is not
*/
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);
......@@ -187,7 +187,7 @@ extern "C" {
\param dtmf_detect_state the DTMF detection state to initilize
\param sample_rate the desired sample rate
*/
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
......@@ -196,7 +196,7 @@ extern "C" {
\param samples the number of samples present in sample_buffer
\return true when DTMF was detected or false when it is not
*/
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);
/*!
......@@ -206,7 +206,7 @@ extern "C" {
\param max the maximum length of buf
\return the number of characters written to buf
*/
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);
......@@ -216,7 +216,7 @@ extern "C" {
\param sample_buffer an array aof 16 bit signed linear samples
\param samples the number of samples present in sample_buffer
*/
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);
......@@ -236,5 +236,5 @@ extern "C" {
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
......@@ -71,7 +71,7 @@ typedef __int8 int8_t;
#include <sys/stat.h>
#include <fcntl.h>
#include <math.h>
#if !defined(powf)
#if !defined(powf) && !defined(_WIN64)
extern float powf (float, float);
#endif
#include <string.h>
......@@ -102,7 +102,7 @@ typedef struct teletone_dds_state teletone_dds_state_t;
/* 3.02 represents twice the power */
#define DBM0_MAX_POWER (3.14f + 3.02f)
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)
{
......@@ -220,7 +220,7 @@ typedef struct teletone_generation_session teletone_generation_session_t;
\param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
\return 0
*/
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
......@@ -228,7 +228,7 @@ int teletone_set_tone(teletone_generation_session_t *ts, int index, ...);
\param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
\return 0
*/
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
......@@ -238,14 +238,14 @@ int teletone_set_map(teletone_tone_map_t *map, ...);
\param user_data optional user data to send
\return 0
*/
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
*/
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
......@@ -253,7 +253,7 @@ int teletone_destroy_session(teletone_generation_session_t *ts);
\param map the tone mapping to use for the frequencies
\return 0
*/
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
......@@ -261,7 +261,7 @@ int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *m
\param cmd the script to execute
\return 0
*/
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
}
......@@ -277,5 +277,5 @@ int teletone_run(teletone_generation_session_t *ts, const char *cmd);
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
......@@ -53,25 +53,25 @@ typedef struct zap_buffer zap_buffer_t;
* \param max_len length the buffer is allowed to grow to
* \return status
*/
zap_status_t zap_buffer_create(zap_buffer_t **buffer, zap_size_t blocksize, zap_size_t start_len, zap_size_t max_len);
OZ_DECLARE(zap_status_t) zap_buffer_create(zap_buffer_t **buffer, zap_size_t blocksize, zap_size_t start_len, zap_size_t max_len);
/*! \brief Get the length of a zap_buffer_t
* \param buffer any buffer of type zap_buffer_t
* \return int size of the buffer.
*/
zap_size_t zap_buffer_len(zap_buffer_t *buffer);
OZ_DECLARE(zap_size_t) zap_buffer_len(zap_buffer_t *buffer);
/*! \brief Get the freespace of a zap_buffer_t
* \param buffer any buffer of type zap_buffer_t
* \return int freespace in the buffer.
*/
zap_size_t zap_buffer_freespace(zap_buffer_t *buffer);
OZ_DECLARE(zap_size_t) zap_buffer_freespace(zap_buffer_t *buffer);
/*! \brief Get the in use amount of a zap_buffer_t
* \param buffer any buffer of type zap_buffer_t
* \return int ammount of buffer curently in use
*/
zap_size_t zap_buffer_inuse(zap_buffer_t *buffer);
OZ_DECLARE(zap_size_t) zap_buffer_inuse(zap_buffer_t *buffer);
/*! \brief Read data from a zap_buffer_t up to the ammount of datalen if it is available. Remove read data from buffer.
* \param buffer any buffer of type zap_buffer_t
......@@ -79,7 +79,7 @@ zap_size_t zap_buffer_inuse(zap_buffer_t *buffer);
* \param datalen amount of data to be returned
* \return int ammount of data actually read
*/
zap_size_t zap_buffer_read(zap_buffer_t *buffer, void *data, zap_size_t datalen);
OZ_DECLARE(zap_size_t) zap_buffer_read(zap_buffer_t *buffer, void *data, zap_size_t datalen);
/*! \brief Read data endlessly from a zap_buffer_t
* \param buffer any buffer of type zap_buffer_t
......@@ -88,13 +88,13 @@ zap_size_t zap_buffer_read(zap_buffer_t *buffer, void *data, zap_size_t datalen)
* \return int ammount of data actually read
* \note Once you have read all the data from the buffer it will loop around.
*/
zap_size_t zap_buffer_read_loop(zap_buffer_t *buffer, void *data, zap_size_t datalen);
OZ_DECLARE(zap_size_t) zap_buffer_read_loop(zap_buffer_t *buffer, void *data, zap_size_t datalen);
/*! \brief Assign a number of loops to read
* \param buffer any buffer of type zap_buffer_t
* \param loops the number of loops (-1 for infinite)
*/
void zap_buffer_set_loops(zap_buffer_t *buffer, int32_t loops);
OZ_DECLARE(void) zap_buffer_set_loops(zap_buffer_t *buffer, int32_t loops);
/*! \brief Write data into a zap_buffer_t up to the length of datalen
* \param buffer any buffer of type zap_buffer_t
......@@ -102,36 +102,36 @@ void zap_buffer_set_loops(zap_buffer_t *buffer, int32_t loops);
* \param datalen amount of data to be written
* \return int amount of buffer used after the write, or 0 if no space available
*/
zap_size_t zap_buffer_write(zap_buffer_t *buffer, const void *data, zap_size_t datalen);
OZ_DECLARE(zap_size_t) zap_buffer_write(zap_buffer_t *buffer, const void *data, zap_size_t datalen);
/*! \brief Remove data from the buffer
* \param buffer any buffer of type zap_buffer_t
* \param datalen amount of data to be removed
* \return int size of buffer, or 0 if unable to toss that much data
*/
zap_size_t zap_buffer_toss(zap_buffer_t *buffer, zap_size_t datalen);
OZ_DECLARE(zap_size_t) zap_buffer_toss(zap_buffer_t *buffer, zap_size_t datalen);
/*! \brief Remove all data from the buffer
* \param buffer any buffer of type zap_buffer_t
*/
void zap_buffer_zero(zap_buffer_t *buffer);
OZ_DECLARE(void) zap_buffer_zero(zap_buffer_t *buffer);
/*! \brief Destroy the buffer
* \param buffer buffer to destroy
* \note only neccessary on dynamic buffers (noop on pooled ones)
*/
void zap_buffer_destroy(zap_buffer_t **buffer);
OZ_DECLARE(void) zap_buffer_destroy(zap_buffer_t **buffer);
/*! \brief Seek to offset from the beginning of the buffer
* \param buffer buffer to seek
* \param datalen offset in bytes
* \return new position
*/
zap_size_t zap_buffer_seek(zap_buffer_t *buffer, zap_size_t datalen);
OZ_DECLARE(zap_size_t) zap_buffer_seek(zap_buffer_t *buffer, zap_size_t datalen);
/** @} */
zap_size_t zap_buffer_zwrite(zap_buffer_t *buffer, const void *data, zap_size_t datalen);
OZ_DECLARE(zap_size_t) zap_buffer_zwrite(zap_buffer_t *buffer, const void *data, zap_size_t datalen);
#endif
/* For Emacs:
......
......@@ -27,14 +27,14 @@ typedef struct zap_mutex zap_mutex_t;
typedef struct zap_thread zap_thread_t;
typedef void *(*zap_thread_function_t) (zap_thread_t *, void *);
zap_status_t zap_thread_create_detached(zap_thread_function_t func, void *data);
zap_status_t zap_thread_create_detached_ex(zap_thread_function_t func, void *data, zap_size_t stack_size);
void zap_thread_override_default_stacksize(zap_size_t size);
zap_status_t zap_mutex_create(zap_mutex_t **mutex);
zap_status_t zap_mutex_destroy(zap_mutex_t **mutex);
zap_status_t _zap_mutex_lock(zap_mutex_t *mutex);
zap_status_t _zap_mutex_trylock(zap_mutex_t *mutex);
zap_status_t _zap_mutex_unlock(zap_mutex_t *mutex);
OZ_DECLARE(zap_status_t) zap_thread_create_detached(zap_thread_function_t func, void *data);
OZ_DECLARE(zap_status_t) zap_thread_create_detached_ex(zap_thread_function_t func, void *data, zap_size_t stack_size);
OZ_DECLARE(void) zap_thread_override_default_stacksize(zap_size_t size);
OZ_DECLARE(zap_status_t) zap_mutex_create(zap_mutex_t **mutex);
OZ_DECLARE(zap_status_t) zap_mutex_destroy(zap_mutex_t **mutex);
OZ_DECLARE(zap_status_t) _zap_mutex_lock(zap_mutex_t *mutex);
OZ_DECLARE(zap_status_t) _zap_mutex_trylock(zap_mutex_t *mutex);
OZ_DECLARE(zap_status_t) _zap_mutex_unlock(zap_mutex_t *mutex);
#endif
......
......@@ -461,7 +461,7 @@ typedef zap_status_t (*zio_api_t) ZIO_API_ARGS ;
#define ZIO_SPAN_NEXT_EVENT_FUNCTION(name) zap_status_t name ZIO_SPAN_NEXT_EVENT_ARGS
#define ZIO_SIGNAL_CB_FUNCTION(name) zap_status_t name ZIO_SIGNAL_CB_ARGS
#define ZIO_EVENT_CB_FUNCTION(name) zap_status_t name ZIO_EVENT_CB_ARGS
#define ZIO_CODEC_FUNCTION(name) zap_status_t name ZIO_CODEC_ARGS
#define ZIO_CODEC_FUNCTION(name) OZ_DECLARE_NONSTD(zap_status_t) name ZIO_CODEC_ARGS
#define ZIO_CONFIGURE_SPAN_FUNCTION(name) zap_status_t name ZIO_CONFIGURE_SPAN_ARGS
#define ZIO_CONFIGURE_FUNCTION(name) zap_status_t name ZIO_CONFIGURE_ARGS
#define ZIO_OPEN_FUNCTION(name) zap_status_t name ZIO_OPEN_ARGS
......
......@@ -83,7 +83,7 @@ static void goertzel_init(teletone_goertzel_state_t *goertzel_state, teletone_de
goertzel_state->fac = tdesc->fac;
}
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)
{
......@@ -102,7 +102,7 @@ void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
#define teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac))
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;
......@@ -136,7 +136,7 @@ void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state,
dtmf_detect_state->mhit = 0;
}
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;
......@@ -145,7 +145,7 @@ void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *ma
mt->sample_rate = 8000;
}
if(!mt->min_samples) {
if (!mt->min_samples) {
mt->min_samples = 102;
}
......@@ -176,7 +176,7 @@ void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *ma
}
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)
{
......@@ -266,7 +266,7 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
}
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)
{
......@@ -397,7 +397,7 @@ int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
}
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)
{
......@@ -423,5 +423,5 @@ int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
......@@ -43,7 +43,7 @@
#pragma warning(disable:4706)
#endif
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,
......@@ -63,7 +63,7 @@ int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
};
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;
......@@ -79,7 +79,7 @@ int teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
}
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;
......@@ -95,7 +95,7 @@ int teletone_set_map(teletone_tone_map_t *map, ...)
}
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;
......@@ -138,7 +138,7 @@ int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_ha
return 0;
}
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);
......@@ -167,7 +167,7 @@ static int ensure_buffer(teletone_generation_session_t *ts, int need)
return 0;
}
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;
......@@ -185,7 +185,7 @@ int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *m
wait = (ts->tmp_wait > -1) ? ts->tmp_wait : ts->wait;
if (map->freqs[0] > 0) {
for (freqlen = 0; map->freqs[freqlen] && freqlen < TELETONE_MAX_TONES; freqlen++) {
for (freqlen = 0; freqlen < TELETONE_MAX_TONES && map->freqs[freqlen]; freqlen++) {
teletone_dds_state_set_tone(&tones[freqlen], map->freqs[freqlen], ts->rate, 0);
teletone_dds_state_set_tx_level(&tones[freqlen], vol);
}
......@@ -207,7 +207,7 @@ int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *m
if (nvol <= TELETONE_VOL_DB_MAX && nvol >= TELETONE_VOL_DB_MIN) {
vol = nvol;
for (j = 0; map->freqs[j] && j < TELETONE_MAX_TONES; j++) {
for (j = 0; j < TELETONE_MAX_TONES && map->freqs[j]; j++) {
teletone_dds_state_set_tx_level(&tones[j], vol);
}
dc = 0;
......@@ -282,7 +282,7 @@ static char *my_strdup (const char *s)
return (char *) memcpy (new, s, len);
}
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;
......@@ -460,5 +460,5 @@ int teletone_run(teletone_generation_session_t *ts, const char *cmd)
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
......@@ -49,7 +49,7 @@ struct zap_buffer {
};
zap_status_t zap_buffer_create(zap_buffer_t **buffer, zap_size_t blocksize, zap_size_t start_len, zap_size_t max_len)
OZ_DECLARE(zap_status_t) zap_buffer_create(zap_buffer_t **buffer, zap_size_t blocksize, zap_size_t start_len, zap_size_t max_len)
{
zap_buffer_t *new_buffer;
......@@ -79,7 +79,7 @@ zap_status_t zap_buffer_create(zap_buffer_t **buffer, zap_size_t blocksize, zap_
return ZAP_MEMERR;
}
zap_size_t zap_buffer_len(zap_buffer_t *buffer)
OZ_DECLARE(zap_size_t) zap_buffer_len(zap_buffer_t *buffer)
{
assert(buffer != NULL);
......@@ -89,7 +89,7 @@ zap_size_t zap_buffer_len(zap_buffer_t *buffer)
}
zap_size_t zap_buffer_freespace(zap_buffer_t *buffer)
OZ_DECLARE(zap_size_t) zap_buffer_freespace(zap_buffer_t *buffer)
{
assert(buffer != NULL);
......@@ -101,14 +101,14 @@ zap_size_t zap_buffer_freespace(zap_buffer_t *buffer)
}
zap_size_t zap_buffer_inuse(zap_buffer_t *buffer)
OZ_DECLARE(zap_size_t) zap_buffer_inuse(zap_buffer_t *buffer)
{
assert(buffer != NULL);
return buffer->used;
}
zap_size_t zap_buffer_seek(zap_buffer_t *buffer, zap_size_t datalen)
OZ_DECLARE(zap_size_t) zap_buffer_seek(zap_buffer_t *buffer, zap_size_t datalen)
{
zap_size_t reading = 0;
......@@ -129,7 +129,7 @@ zap_size_t zap_buffer_seek(zap_buffer_t *buffer, zap_size_t datalen)
return reading;
}
zap_size_t zap_buffer_toss(zap_buffer_t *buffer, zap_size_t datalen)
OZ_DECLARE(zap_size_t) zap_buffer_toss(zap_buffer_t *buffer, zap_size_t datalen)
{
zap_size_t reading = 0;
......@@ -150,12 +150,12 @@ zap_size_t zap_buffer_toss(zap_buffer_t *buffer, zap_size_t datalen)
return buffer->used;
}
void zap_buffer_set_loops(zap_buffer_t *buffer, int loops)
OZ_DECLARE(void) zap_buffer_set_loops(zap_buffer_t *buffer, int loops)
{
buffer->loops = loops;
}
zap_size_t zap_buffer_read_loop(zap_buffer_t *buffer, void *data, zap_size_t datalen)
OZ_DECLARE(zap_size_t) zap_buffer_read_loop(zap_buffer_t *buffer, void *data, zap_size_t datalen)
{
zap_size_t len;
if ((len = zap_buffer_read(buffer, data, datalen)) < datalen) {
......@@ -170,7 +170,7 @@ zap_size_t zap_buffer_read_loop(zap_buffer_t *buffer, void *data, zap_size_t dat
return len;
}
zap_size_t zap_buffer_read(zap_buffer_t *buffer, void *data, zap_size_t datalen)
OZ_DECLARE(zap_size_t) zap_buffer_read(zap_buffer_t *buffer, void *data, zap_size_t datalen)
{
zap_size_t reading = 0;
......@@ -195,7 +195,7 @@ zap_size_t zap_buffer_read(zap_buffer_t *buffer, void *data, zap_size_t datalen)
return reading;
}
zap_size_t zap_buffer_write(zap_buffer_t *buffer, const void *data, zap_size_t datalen)
OZ_DECLARE(zap_size_t) zap_buffer_write(zap_buffer_t *buffer, const void *data, zap_size_t datalen)
{
zap_size_t freespace, actual_freespace;
......@@ -258,7 +258,7 @@ zap_size_t zap_buffer_write(zap_buffer_t *buffer, const void *data, zap_size_t d
return buffer->used;
}
void zap_buffer_zero(zap_buffer_t *buffer)
OZ_DECLARE(void) zap_buffer_zero(zap_buffer_t *buffer)
{
assert(buffer != NULL);
assert(buffer->data != NULL);
......@@ -268,7 +268,7 @@ void zap_buffer_zero(zap_buffer_t *buffer)
buffer->head = buffer->data;
}
zap_size_t zap_buffer_zwrite(zap_buffer_t *buffer, const void *data, zap_size_t datalen)
OZ_DECLARE(zap_size_t) zap_buffer_zwrite(zap_buffer_t *buffer, const void *data, zap_size_t datalen)
{
zap_size_t w;
......@@ -280,7 +280,7 @@ zap_size_t zap_buffer_zwrite(zap_buffer_t *buffer, const void *data, zap_size_t
return w;
}
void zap_buffer_destroy(zap_buffer_t **buffer)
OZ_DECLARE(void) zap_buffer_destroy(zap_buffer_t **buffer)
{
if (*buffer) {
free((*buffer)->data);
......
......@@ -37,7 +37,7 @@ static void fsk_byte_handler (void *x, int data)
}
}
zap_status_t zap_fsk_data_init(zap_fsk_data_state_t *state, uint8_t *data, uint32_t datalen)
OZ_DECLARE(zap_status_t) zap_fsk_data_init(zap_fsk_data_state_t *state, uint8_t *data, uint32_t datalen)
{
memset(state, 0, sizeof(*state));
state->buf = data;
......@@ -47,7 +47,7 @@ zap_status_t zap_fsk_data_init(zap_fsk_data_state_t *state, uint8_t *data, uint3
return ZAP_SUCCESS;
}
zap_status_t zap_fsk_data_add_sdmf(zap_fsk_data_state_t *state, const char *date, char *number)
OZ_DECLARE(zap_status_t) zap_fsk_data_add_sdmf(zap_fsk_data_state_t *state, const char *date, char *number)
{
size_t dlen = strlen(date);
size_t nlen = strlen(number);
......@@ -61,7 +61,7 @@ zap_status_t zap_fsk_data_add_sdmf(zap_fsk_data_state_t *state, const char *date
return ZAP_SUCCESS;
}
zap_status_t zap_fsk_data_add_mdmf(zap_fsk_data_state_t *state, zap_mdmf_type_t type, const uint8_t *data, uint32_t datalen)
OZ_DECLARE(zap_status_t) zap_fsk_data_add_mdmf(zap_fsk_data_state_t *state, zap_mdmf_type_t type, const uint8_t *data, uint32_t datalen)
{
state->buf[0] = ZAP_CID_TYPE_MDMF;
state->buf[state->bpos++] = type;
......@@ -72,7 +72,7 @@ zap_status_t zap_fsk_data_add_mdmf(zap_fsk_data_state_t *state, zap_mdmf_type_t
}
zap_status_t zap_fsk_data_add_checksum(zap_fsk_data_state_t *state)
OZ_DECLARE(zap_status_t) zap_fsk_data_add_checksum(zap_fsk_data_state_t *state)
{
uint32_t i;
uint8_t check = 0;
......@@ -93,7 +93,7 @@ zap_status_t zap_fsk_data_add_checksum(zap_fsk_data_state_t *state)
}
zap_status_t zap_fsk_data_parse(zap_fsk_data_state_t *state, zap_size_t *type, char **data, zap_size_t *len)
OZ_DECLARE(zap_status_t) zap_fsk_data_parse(zap_fsk_data_state_t *state, zap_size_t *type, char **data, zap_size_t *len)
{
zap_size_t i;
......@@ -146,7 +146,7 @@ zap_status_t zap_fsk_data_parse(zap_fsk_data_state_t *state, zap_size_t *type, c
return ZAP_FAIL;
}
zap_status_t zap_fsk_demod_feed(zap_fsk_data_state_t *state, int16_t *data, zap_size_t samples)
OZ_DECLARE(zap_status_t) zap_fsk_demod_feed(zap_fsk_data_state_t *state, int16_t *data, zap_size_t samples)
{
uint32_t x;
int16_t *sp = data;
......@@ -166,14 +166,14 @@ zap_status_t zap_fsk_demod_feed(zap_fsk_data_state_t *state, int16_t *data, zap_
return ZAP_SUCCESS;
}
zap_status_t zap_fsk_demod_destroy(zap_fsk_data_state_t *state)
OZ_DECLARE(zap_status_t) zap_fsk_demod_destroy(zap_fsk_data_state_t *state)
{
dsp_fsk_destroy(&state->fsk1200_handle);
memset(state, 0, sizeof(*state));
return ZAP_SUCCESS;
}
int zap_fsk_demod_init(zap_fsk_data_state_t *state, int rate, uint8_t *buf, zap_size_t bufsize)
OZ_DECLARE(int) zap_fsk_demod_init(zap_fsk_data_state_t *state, int rate, uint8_t *buf, zap_size_t bufsize)
{
dsp_fsk_attr_t fsk1200_attr;
......@@ -199,7 +199,7 @@ int zap_fsk_demod_init(zap_fsk_data_state_t *state, int rate, uint8_t *buf, zap_
return ZAP_SUCCESS;
}
zap_size_t zap_fsk_modulator_generate_bit(zap_fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, zap_size_t buflen)
OZ_DECLARE(zap_size_t) zap_fsk_modulator_generate_bit(zap_fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, zap_size_t buflen)
{
zap_size_t i;
......@@ -217,7 +217,7 @@ zap_size_t zap_fsk_modulator_generate_bit(zap_fsk_modulator_t *fsk_trans, int8_t
}
int32_t zap_fsk_modulator_generate_carrier_bits(zap_fsk_modulator_t *fsk_trans, uint32_t bits)
OZ_DECLARE(int32_t) zap_fsk_modulator_generate_carrier_bits(zap_fsk_modulator_t *fsk_trans, uint32_t bits)
{
uint32_t i = 0;
zap_size_t r = 0;
......@@ -237,7 +237,7 @@ int32_t zap_fsk_modulator_generate_carrier_bits(zap_fsk_modulator_t *fsk_trans,
}
void zap_fsk_modulator_generate_chan_sieze(zap_fsk_modulator_t *fsk_trans)
OZ_DECLARE(void) zap_fsk_modulator_generate_chan_sieze(zap_fsk_modulator_t *fsk_trans)
{
uint32_t i = 0;
zap_size_t r = 0;
......@@ -258,7 +258,7 @@ void zap_fsk_modulator_generate_chan_sieze(zap_fsk_modulator_t *fsk_trans)
}
void zap_fsk_modulator_send_data(zap_fsk_modulator_t *fsk_trans)
OZ_DECLARE(void) zap_fsk_modulator_send_data(zap_fsk_modulator_t *fsk_trans)
{
zap_size_t r = 0;
int8_t bit = 0;
......@@ -275,7 +275,7 @@ void zap_fsk_modulator_send_data(zap_fsk_modulator_t *fsk_trans)
}
zap_status_t zap_fsk_modulator_init(zap_fsk_modulator_t *fsk_trans,
OZ_DECLARE(zap_status_t) zap_fsk_modulator_init(zap_fsk_modulator_t *fsk_trans,
fsk_modem_types_t modem_type,
uint32_t sample_rate,
zap_fsk_data_state_t *fsk_data,
......
差异被折叠。
......@@ -62,7 +62,7 @@ struct zap_thread {
zap_size_t thread_default_stacksize = 0;
void zap_thread_override_default_stacksize(zap_size_t size)
OZ_DECLARE(void) zap_thread_override_default_stacksize(zap_size_t size)
{
thread_default_stacksize = size;
}
......@@ -80,12 +80,12 @@ static void * ZAP_THREAD_CALLING_CONVENTION thread_launch(void *args)
return exit_val;
}
zap_status_t zap_thread_create_detached(zap_thread_function_t func, void *data)
OZ_DECLARE(zap_status_t) zap_thread_create_detached(zap_thread_function_t func, void *data)
{
return zap_thread_create_detached_ex(func, data, thread_default_stacksize);
}
zap_status_t zap_thread_create_detached_ex(zap_thread_function_t func, void *data, zap_size_t stack_size)
OZ_DECLARE(zap_status_t) zap_thread_create_detached_ex(zap_thread_function_t func, void *data, zap_size_t stack_size)
{
zap_thread_t *thread = NULL;
zap_status_t status = ZAP_FAIL;
......@@ -132,7 +132,7 @@ zap_status_t zap_thread_create_detached_ex(zap_thread_function_t func, void *dat
}
zap_status_t zap_mutex_create(zap_mutex_t **mutex)
OZ_DECLARE(zap_status_t) zap_mutex_create(zap_mutex_t **mutex)
{
zap_status_t status = ZAP_FAIL;
#ifndef WIN32
......@@ -170,7 +170,7 @@ zap_status_t zap_mutex_create(zap_mutex_t **mutex)
return status;
}
zap_status_t zap_mutex_destroy(zap_mutex_t **mutex)
OZ_DECLARE(zap_status_t) zap_mutex_destroy(zap_mutex_t **mutex)
{
zap_mutex_t *mp = *mutex;
*mutex = NULL;
......@@ -187,7 +187,7 @@ zap_status_t zap_mutex_destroy(zap_mutex_t **mutex)
return ZAP_SUCCESS;
}
zap_status_t _zap_mutex_lock(zap_mutex_t *mutex)
OZ_DECLARE(zap_status_t) _zap_mutex_lock(zap_mutex_t *mutex)
{
#ifdef WIN32
EnterCriticalSection(&mutex->mutex);
......@@ -198,7 +198,7 @@ zap_status_t _zap_mutex_lock(zap_mutex_t *mutex)
return ZAP_SUCCESS;
}
zap_status_t _zap_mutex_trylock(zap_mutex_t *mutex)
OZ_DECLARE(zap_status_t) _zap_mutex_trylock(zap_mutex_t *mutex)
{
#ifdef WIN32
if (!TryEnterCriticalSection(&mutex->mutex))
......@@ -210,7 +210,7 @@ zap_status_t _zap_mutex_trylock(zap_mutex_t *mutex)
return ZAP_SUCCESS;
}
zap_status_t _zap_mutex_unlock(zap_mutex_t *mutex)
OZ_DECLARE(zap_status_t) _zap_mutex_unlock(zap_mutex_t *mutex)
{
#ifdef WIN32
LeaveCriticalSection(&mutex->mutex);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论