提交 751ca005 authored 作者: Michael Jerris's avatar Michael Jerris

use macro for EXTERN "C" begin and end lines in header files to clean up the…

use macro for EXTERN "C" begin and end lines in header files to clean up the headers, and to eliminate a format bug in emacs.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1291 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 35dc3201
...@@ -36,9 +36,15 @@ ...@@ -36,9 +36,15 @@
#define SWITCH_H #define SWITCH_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { #define BEGIN_EXTERN_C extern "C" {
#define END_EXTERN_C }
#else
#define BEGIN_EXTERN_C
#define END_EXTERN_C
#endif #endif
BEGIN_EXTERN_C
//Need to include this before any other includes (MSVC Bug) //Need to include this before any other includes (MSVC Bug)
#include <switch_platform.h> #include <switch_platform.h>
...@@ -69,9 +75,8 @@ extern "C" { ...@@ -69,9 +75,8 @@ extern "C" {
#include <switch_stun.h> #include <switch_stun.h>
#include <switch_stun.h> #include <switch_stun.h>
#include <switch_log.h> #include <switch_log.h>
#ifdef __cplusplus
} END_EXTERN_C
#endif
/** \mainpage FreeSWITCH /** \mainpage FreeSWITCH
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
......
...@@ -39,12 +39,7 @@ ...@@ -39,12 +39,7 @@
#ifndef SWITCH_APR_H #ifndef SWITCH_APR_H
#define SWITCH_APR_H #define SWITCH_APR_H
#ifdef __cplusplus BEGIN_EXTERN_C
extern "C" {
#ifdef __FORMATBUG
}
#endif
#endif
#include <apr.h> #include <apr.h>
#include <apr_network_io.h> #include <apr_network_io.h>
...@@ -1435,8 +1430,6 @@ SWITCH_DECLARE(switch_status) switch_mutex_init(switch_mutex_t **lock, ...@@ -1435,8 +1430,6 @@ SWITCH_DECLARE(switch_status) switch_mutex_init(switch_mutex_t **lock,
/** @} */ /** @} */
/** @} */ /** @} */
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -38,12 +38,10 @@ ...@@ -38,12 +38,10 @@
#ifndef SWITCH_BUFFER_H #ifndef SWITCH_BUFFER_H
#define SWITCH_BUFFER_H #define SWITCH_BUFFER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
/** /**
* @defgroup switch_buffer Buffer Routines * @defgroup switch_buffer Buffer Routines
* @ingroup core1 * @ingroup core1
...@@ -111,10 +109,6 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_toss(switch_buffer *buffer, switch_s ...@@ -111,10 +109,6 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_toss(switch_buffer *buffer, switch_s
SWITCH_DECLARE(void) switch_buffer_zero(switch_buffer *buffer); SWITCH_DECLARE(void) switch_buffer_zero(switch_buffer *buffer);
/** @} */ /** @} */
END_EXTERN_C
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -53,15 +53,10 @@ ...@@ -53,15 +53,10 @@
#ifndef SWITCH_CALLER_H #ifndef SWITCH_CALLER_H
#define SWITCH_CALLER_H #define SWITCH_CALLER_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _FORMATBUG
}
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
/*! \brief Call Specific Data /*! \brief Call Specific Data
*/ */
struct switch_caller_profile { struct switch_caller_profile {
...@@ -186,10 +181,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_ ...@@ -186,10 +181,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile *caller_profile, char *prefix, switch_event *event); SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile *caller_profile, char *prefix, switch_event *event);
END_EXTERN_C
#ifdef __cplusplus
}
#endif
/** @} */ /** @} */
......
...@@ -38,15 +38,10 @@ ...@@ -38,15 +38,10 @@
#ifndef SWITCH_CHANNEL_H #ifndef SWITCH_CHANNEL_H
#define SWITCH_CHANNEL_H #define SWITCH_CHANNEL_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __FORMATBUG
}
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
struct switch_channel_timetable { struct switch_channel_timetable {
switch_time_t created; switch_time_t created;
switch_time_t answered; switch_time_t answered;
...@@ -380,8 +375,6 @@ SWITCH_DECLARE(switch_status) switch_channel_set_raw_mode (switch_channel *chann ...@@ -380,8 +375,6 @@ SWITCH_DECLARE(switch_status) switch_channel_set_raw_mode (switch_channel *chann
SWITCH_DECLARE(switch_status) switch_channel_get_raw_mode (switch_channel *channel, int *freq, int *bits, int *channels, int *ms, int *kbps); SWITCH_DECLARE(switch_status) switch_channel_get_raw_mode (switch_channel *channel, int *freq, int *bits, int *channels, int *ms, int *kbps);
/** @} */ /** @} */
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -56,12 +56,10 @@ ...@@ -56,12 +56,10 @@
#ifndef SWITCH_CONFIG_H #ifndef SWITCH_CONFIG_H
#define SWITCH_CONFIG_H #define SWITCH_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
/*! \brief A simple file handle representing an open configuration file **/ /*! \brief A simple file handle representing an open configuration file **/
struct switch_config { struct switch_config {
/*! FILE stream buffer to the opened file */ /*! FILE stream buffer to the opened file */
...@@ -106,9 +104,8 @@ SWITCH_DECLARE(void) switch_config_close_file(switch_config *cfg); ...@@ -106,9 +104,8 @@ SWITCH_DECLARE(void) switch_config_close_file(switch_config *cfg);
*/ */
SWITCH_DECLARE(int) switch_config_next_pair(switch_config *cfg, char **var, char **val); SWITCH_DECLARE(int) switch_config_next_pair(switch_config *cfg, char **var, char **val);
#ifdef __cplusplus END_EXTERN_C
}
#endif
/** @} */ /** @} */
#endif #endif
...@@ -39,12 +39,10 @@ ...@@ -39,12 +39,10 @@
#ifndef SWITCH_CONSOLE_H #ifndef SWITCH_CONSOLE_H
#define SWITCH_CONSOLE_H #define SWITCH_CONSOLE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
/*! /*!
\brief A simple comand loop that reads input from the terminal \brief A simple comand loop that reads input from the terminal
*/ */
...@@ -55,8 +53,6 @@ SWITCH_DECLARE(void) switch_console_loop(void); ...@@ -55,8 +53,6 @@ SWITCH_DECLARE(void) switch_console_loop(void);
*/ */
SWITCH_DECLARE(void) switch_console_printf(switch_text_channel channel, char *file, const char *func, int line, char *fmt, ...); SWITCH_DECLARE(void) switch_console_printf(switch_text_channel channel, char *file, const char *func, int line, char *fmt, ...);
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -38,15 +38,10 @@ ...@@ -38,15 +38,10 @@
#ifndef SWITCH_CORE_H #ifndef SWITCH_CORE_H
#define SWITCH_CORE_H #define SWITCH_CORE_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _FORMATBUG
}
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
#define SWITCH_MAX_CORE_THREAD_SESSION_OBJS 128 #define SWITCH_MAX_CORE_THREAD_SESSION_OBJS 128
#define SWITCH_MAX_STREAMS 128 #define SWITCH_MAX_STREAMS 128
...@@ -984,10 +979,6 @@ SWITCH_DECLARE(void) switch_core_set_globals(void); ...@@ -984,10 +979,6 @@ SWITCH_DECLARE(void) switch_core_set_globals(void);
\} \}
*/ */
END_EXTERN_C
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -58,12 +58,10 @@ ...@@ -58,12 +58,10 @@
#ifndef SWITCH_EVENT_H #ifndef SWITCH_EVENT_H
#define SWITCH_EVENT_H #define SWITCH_EVENT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
/*! \brief An event Header */ /*! \brief An event Header */
struct switch_event_header { struct switch_event_header {
/*! the header name */ /*! the header name */
...@@ -288,8 +286,6 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event **event); ...@@ -288,8 +286,6 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event **event);
#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__FUNCTION__, __LINE__, event, data) #define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__FUNCTION__, __LINE__, event, data)
///\} ///\}
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -36,12 +36,10 @@ ...@@ -36,12 +36,10 @@
#ifndef SWITCH_FRAME_H #ifndef SWITCH_FRAME_H
#define SWITCH_FRAME_H #define SWITCH_FRAME_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
/*! \brief An abstraction of a data frame */ /*! \brief An abstraction of a data frame */
struct switch_frame { struct switch_frame {
/*! a pointer to the codec information */ /*! a pointer to the codec information */
...@@ -70,8 +68,6 @@ struct switch_frame { ...@@ -70,8 +68,6 @@ struct switch_frame {
switch_frame_flag flags; switch_frame_flag flags;
}; };
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -38,12 +38,10 @@ ...@@ -38,12 +38,10 @@
#ifndef SWITCH_IVR_H #ifndef SWITCH_IVR_H
#define SWITCH_IVR_H #define SWITCH_IVR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
/** /**
* @defgroup switch_ivr IVR Library * @defgroup switch_ivr IVR Library
* @ingroup core1 * @ingroup core1
...@@ -179,9 +177,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_session_transfer(switch_core_session *s ...@@ -179,9 +177,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_session_transfer(switch_core_session *s
/** @} */ /** @} */
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
......
...@@ -41,12 +41,10 @@ ...@@ -41,12 +41,10 @@
#ifndef SWITCH_LOADABLE_MODULE_H #ifndef SWITCH_LOADABLE_MODULE_H
#define SWITCH_LOADABLE_MODULE_H #define SWITCH_LOADABLE_MODULE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
/*! /*!
\defgroup mods Loadable Module Functions \defgroup mods Loadable Module Functions
\ingroup core1 \ingroup core1
...@@ -240,8 +238,6 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void); ...@@ -240,8 +238,6 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void);
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void); SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void);
///\} ///\}
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -38,15 +38,10 @@ ...@@ -38,15 +38,10 @@
#ifndef SWITCH_LOG_H #ifndef SWITCH_LOG_H
#define SWITCH_LOG_H #define SWITCH_LOG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _FORMATBUG
}
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
///\defgroup log Logger Routines ///\defgroup log Logger Routines
///\ingroup core1 ///\ingroup core1
///\{ ///\{
...@@ -122,8 +117,6 @@ SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level level); ...@@ -122,8 +117,6 @@ SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level level);
SWITCH_DECLARE(switch_log_level) switch_log_str2level(const char *str); SWITCH_DECLARE(switch_log_level) switch_log_str2level(const char *str);
///\} ///\}
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -39,12 +39,10 @@ ...@@ -39,12 +39,10 @@
#ifndef SWITCH_MODULE_INTERFACES_H #ifndef SWITCH_MODULE_INTERFACES_H
#define SWITCH_MODULE_INTERFACES_H #define SWITCH_MODULE_INTERFACES_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
/*! \brief A table of functions to execute at various states /*! \brief A table of functions to execute at various states
*/ */
struct switch_state_handler_table { struct switch_state_handler_table {
...@@ -513,8 +511,6 @@ struct switch_api_interface { ...@@ -513,8 +511,6 @@ struct switch_api_interface {
const struct switch_api_interface *next; const struct switch_api_interface *next;
}; };
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -34,9 +34,7 @@ ...@@ -34,9 +34,7 @@
#ifndef SWITCH_PLATFORM_H #ifndef SWITCH_PLATFORM_H
#define SWITCH_PLATFORM_H #define SWITCH_PLATFORM_H
#ifdef __cplusplus BEGIN_EXTERN_C
extern "C" {
#endif
#ifdef __ICC #ifdef __ICC
#pragma warning (disable:810 869 981 279 1469 188) #pragma warning (disable:810 869 981 279 1469 188)
...@@ -153,8 +151,6 @@ typedef unsigned long in_addr_t; ...@@ -153,8 +151,6 @@ typedef unsigned long in_addr_t;
#define DoxyDefine(x) #define DoxyDefine(x)
#endif #endif
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -42,11 +42,9 @@ ...@@ -42,11 +42,9 @@
#ifndef SWITCH_RESAMPLE_H #ifndef SWITCH_RESAMPLE_H
#define SWITCH_RESAMPLE_H #define SWITCH_RESAMPLE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
#include <stdlib.h>
/*! /*!
\defgroup resamp Audio Resample Functions \defgroup resamp Audio Resample Functions
...@@ -158,10 +156,7 @@ SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len); ...@@ -158,10 +156,7 @@ SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len);
///\} ///\}
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
......
...@@ -38,12 +38,7 @@ ...@@ -38,12 +38,7 @@
#ifndef SWITCH_RTP_H #ifndef SWITCH_RTP_H
#define SWITCH_RTP_H #define SWITCH_RTP_H
#ifdef __cplusplus BEGIN_EXTERN_C
extern "C" {
#ifdef _FORMATBUG
}
#endif
#endif
#define SWITCH_RTP_MAX_BUF_LEN 16384 #define SWITCH_RTP_MAX_BUF_LEN 16384
...@@ -328,8 +323,6 @@ SWITCH_DECLARE(void *)switch_rtp_get_private(switch_rtp *rtp_session); ...@@ -328,8 +323,6 @@ SWITCH_DECLARE(void *)switch_rtp_get_private(switch_rtp *rtp_session);
\} \}
*/ */
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -35,9 +35,7 @@ ...@@ -35,9 +35,7 @@
#ifndef SWITCH_SQLITE_H #ifndef SWITCH_SQLITE_H
#define SWITCH_SQLITE_H #define SWITCH_SQLITE_H
#ifdef __cplusplus BEGIN_EXTERN_C
extern "C" {
#endif
#include <sqlite3.h> #include <sqlite3.h>
...@@ -1806,10 +1804,6 @@ DoxyDefine(void switch_core_db_free(char *z);) ...@@ -1806,10 +1804,6 @@ DoxyDefine(void switch_core_db_free(char *z);)
/** @} */ /** @} */
/** @} */ /** @} */
END_EXTERN_C
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
*/ */
#ifndef _SWITCH_STUN_PARSER_H #ifndef _SWITCH_STUN_PARSER_H
#define _SWITCH_STUN_PARSER_H #define _SWITCH_STUN_PARSER_H
BEGIN_EXTERN_C
#define SWITCH_STUN_DEFAULT_PORT 3478 #define SWITCH_STUN_DEFAULT_PORT 3478
#define SWITCH_STUN_PACKET_MIN_LEN 20 #define SWITCH_STUN_PACKET_MIN_LEN 20
...@@ -236,4 +239,7 @@ SWITCH_DECLARE(switch_status) switch_stun_lookup (char **ip, ...@@ -236,4 +239,7 @@ SWITCH_DECLARE(switch_status) switch_stun_lookup (char **ip,
*/ */
#define switch_stun_packet_length(packet) ntohs(packet->header.length) + sizeof(switch_stun_packet_header_t) #define switch_stun_packet_length(packet) ntohs(packet->header.length) + sizeof(switch_stun_packet_header_t)
///\} ///\}
END_EXTERN_C
#endif #endif
...@@ -34,15 +34,9 @@ ...@@ -34,15 +34,9 @@
#ifndef SWITCH_TYPES_H #ifndef SWITCH_TYPES_H
#define SWITCH_TYPES_H #define SWITCH_TYPES_H
#ifdef __cplusplus
extern "C" {
#ifdef _FORMATBUG
}
#endif
#endif
#include <switch.h> #include <switch.h>
#include <switch_platform.h>
BEGIN_EXTERN_C
#ifdef WIN32 #ifdef WIN32
#define SWITCH_PATH_SEPARATOR "\\" #define SWITCH_PATH_SEPARATOR "\\"
...@@ -681,9 +675,6 @@ struct switch_channel; ...@@ -681,9 +675,6 @@ struct switch_channel;
/*! \brief A core session representing a call and all of it's resources */ /*! \brief A core session representing a call and all of it's resources */
struct switch_core_session; struct switch_core_session;
END_EXTERN_C
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -38,13 +38,9 @@ ...@@ -38,13 +38,9 @@
#ifndef SWITCH_UTILS_H #ifndef SWITCH_UTILS_H
#define SWITCH_UTILS_H #define SWITCH_UTILS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h> #include <switch.h>
BEGIN_EXTERN_C
#ifndef snprintf #ifndef snprintf
#define snprintf apr_snprintf #define snprintf apr_snprintf
...@@ -182,8 +178,6 @@ SWITCH_DECLARE(switch_status) switch_string_match(const char *string, size_t str ...@@ -182,8 +178,6 @@ SWITCH_DECLARE(switch_status) switch_string_match(const char *string, size_t str
#define SWITCH_READ_ACCEPTABLE(status) status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK #define SWITCH_READ_ACCEPTABLE(status) status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK
#ifdef __cplusplus END_EXTERN_C
}
#endif
#endif #endif
...@@ -454,11 +454,11 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session, ...@@ -454,11 +454,11 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session,
} }
} else { /* time off the channel (if you must) */ } else { /* time off the channel (if you must) */
switch_frame *read_frame; switch_frame *read_frame;
switch_status status;
while (switch_channel_test_flag(channel, CF_HOLD)) { while (switch_channel_test_flag(channel, CF_HOLD)) {
switch_yield(10000); switch_yield(10000);
} }
switch_status status = switch_core_session_read_frame(session, &read_frame, -1, 0); status = switch_core_session_read_frame(session, &read_frame, -1, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) { if (!SWITCH_READ_ACCEPTABLE(status)) {
break; break;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论