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