提交 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
......@@ -35,9 +35,15 @@
#ifndef SWITCH_H
#define SWITCH_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
#define BEGIN_EXTERN_C extern "C" {
#define END_EXTERN_C }
#else
#define BEGIN_EXTERN_C
#define END_EXTERN_C
#endif
BEGIN_EXTERN_C
//Need to include this before any other includes (MSVC Bug)
#include <switch_platform.h>
......@@ -69,9 +75,8 @@ extern "C" {
#include <switch_stun.h>
#include <switch_stun.h>
#include <switch_log.h>
#ifdef __cplusplus
}
#endif
END_EXTERN_C
/** \mainpage FreeSWITCH
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
......
......@@ -39,12 +39,7 @@
#ifndef SWITCH_APR_H
#define SWITCH_APR_H
#ifdef __cplusplus
extern "C" {
#ifdef __FORMATBUG
}
#endif
#endif
BEGIN_EXTERN_C
#include <apr.h>
#include <apr_network_io.h>
......@@ -1435,8 +1430,6 @@ SWITCH_DECLARE(switch_status) switch_mutex_init(switch_mutex_t **lock,
/** @} */
/** @} */
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -38,12 +38,10 @@
#ifndef SWITCH_BUFFER_H
#define SWITCH_BUFFER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h>
BEGIN_EXTERN_C
/**
* @defgroup switch_buffer Buffer Routines
* @ingroup core1
......@@ -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);
/** @} */
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -53,15 +53,10 @@
#ifndef SWITCH_CALLER_H
#define SWITCH_CALLER_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _FORMATBUG
}
#endif
#include <switch.h>
BEGIN_EXTERN_C
/*! \brief Call Specific Data
*/
struct switch_caller_profile {
......@@ -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);
#ifdef __cplusplus
}
#endif
END_EXTERN_C
/** @} */
......
......@@ -38,15 +38,10 @@
#ifndef SWITCH_CHANNEL_H
#define SWITCH_CHANNEL_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __FORMATBUG
}
#endif
#include <switch.h>
BEGIN_EXTERN_C
struct switch_channel_timetable {
switch_time_t created;
switch_time_t answered;
......@@ -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);
/** @} */
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -56,12 +56,10 @@
#ifndef SWITCH_CONFIG_H
#define SWITCH_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h>
BEGIN_EXTERN_C
/*! \brief A simple file handle representing an open configuration file **/
struct switch_config {
/*! FILE stream buffer to the opened file */
......@@ -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);
#ifdef __cplusplus
}
#endif
END_EXTERN_C
/** @} */
#endif
......@@ -39,12 +39,10 @@
#ifndef SWITCH_CONSOLE_H
#define SWITCH_CONSOLE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h>
BEGIN_EXTERN_C
/*!
\brief A simple comand loop that reads input from the terminal
*/
......@@ -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, ...);
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -38,15 +38,10 @@
#ifndef SWITCH_CORE_H
#define SWITCH_CORE_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _FORMATBUG
}
#endif
#include <switch.h>
BEGIN_EXTERN_C
#define SWITCH_MAX_CORE_THREAD_SESSION_OBJS 128
#define SWITCH_MAX_STREAMS 128
......@@ -984,10 +979,6 @@ SWITCH_DECLARE(void) switch_core_set_globals(void);
\}
*/
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -58,12 +58,10 @@
#ifndef SWITCH_EVENT_H
#define SWITCH_EVENT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h>
BEGIN_EXTERN_C
/*! \brief An event Header */
struct switch_event_header {
/*! the header name */
......@@ -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)
///\}
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -36,12 +36,10 @@
#ifndef SWITCH_FRAME_H
#define SWITCH_FRAME_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h>
BEGIN_EXTERN_C
/*! \brief An abstraction of a data frame */
struct switch_frame {
/*! a pointer to the codec information */
......@@ -70,8 +68,6 @@ struct switch_frame {
switch_frame_flag flags;
};
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -38,12 +38,10 @@
#ifndef SWITCH_IVR_H
#define SWITCH_IVR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h>
BEGIN_EXTERN_C
/**
* @defgroup switch_ivr IVR Library
* @ingroup core1
......@@ -179,9 +177,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_session_transfer(switch_core_session *s
/** @} */
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......
......@@ -41,12 +41,10 @@
#ifndef SWITCH_LOADABLE_MODULE_H
#define SWITCH_LOADABLE_MODULE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h>
BEGIN_EXTERN_C
/*!
\defgroup mods Loadable Module Functions
\ingroup core1
......@@ -240,8 +238,6 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void);
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void);
///\}
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -38,15 +38,10 @@
#ifndef SWITCH_LOG_H
#define SWITCH_LOG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _FORMATBUG
}
#endif
#include <switch.h>
BEGIN_EXTERN_C
///\defgroup log Logger Routines
///\ingroup core1
///\{
......@@ -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);
///\}
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -39,12 +39,10 @@
#ifndef SWITCH_MODULE_INTERFACES_H
#define SWITCH_MODULE_INTERFACES_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h>
BEGIN_EXTERN_C
/*! \brief A table of functions to execute at various states
*/
struct switch_state_handler_table {
......@@ -513,8 +511,6 @@ struct switch_api_interface {
const struct switch_api_interface *next;
};
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -34,9 +34,7 @@
#ifndef SWITCH_PLATFORM_H
#define SWITCH_PLATFORM_H
#ifdef __cplusplus
extern "C" {
#endif
BEGIN_EXTERN_C
#ifdef __ICC
#pragma warning (disable:810 869 981 279 1469 188)
......@@ -153,8 +151,6 @@ typedef unsigned long in_addr_t;
#define DoxyDefine(x)
#endif
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -42,11 +42,9 @@
#ifndef SWITCH_RESAMPLE_H
#define SWITCH_RESAMPLE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <switch.h>
BEGIN_EXTERN_C
#include <stdlib.h>
/*!
\defgroup resamp Audio Resample Functions
......@@ -158,10 +156,7 @@ SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len);
///\}
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......
......@@ -38,12 +38,7 @@
#ifndef SWITCH_RTP_H
#define SWITCH_RTP_H
#ifdef __cplusplus
extern "C" {
#ifdef _FORMATBUG
}
#endif
#endif
BEGIN_EXTERN_C
#define SWITCH_RTP_MAX_BUF_LEN 16384
......@@ -328,8 +323,6 @@ SWITCH_DECLARE(void *)switch_rtp_get_private(switch_rtp *rtp_session);
\}
*/
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -35,9 +35,7 @@
#ifndef SWITCH_SQLITE_H
#define SWITCH_SQLITE_H
#ifdef __cplusplus
extern "C" {
#endif
BEGIN_EXTERN_C
#include <sqlite3.h>
......@@ -1806,10 +1804,6 @@ DoxyDefine(void switch_core_db_free(char *z);)
/** @} */
/** @} */
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -36,6 +36,9 @@
*/
#ifndef _SWITCH_STUN_PARSER_H
#define _SWITCH_STUN_PARSER_H
BEGIN_EXTERN_C
#define SWITCH_STUN_DEFAULT_PORT 3478
#define SWITCH_STUN_PACKET_MIN_LEN 20
......@@ -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)
///\}
END_EXTERN_C
#endif
......@@ -34,15 +34,9 @@
#ifndef SWITCH_TYPES_H
#define SWITCH_TYPES_H
#ifdef __cplusplus
extern "C" {
#ifdef _FORMATBUG
}
#endif
#endif
#include <switch.h>
#include <switch_platform.h>
BEGIN_EXTERN_C
#ifdef WIN32
#define SWITCH_PATH_SEPARATOR "\\"
......@@ -681,9 +675,6 @@ struct switch_channel;
/*! \brief A core session representing a call and all of it's resources */
struct switch_core_session;
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -38,13 +38,9 @@
#ifndef SWITCH_UTILS_H
#define SWITCH_UTILS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <switch.h>
BEGIN_EXTERN_C
#ifndef snprintf
#define snprintf apr_snprintf
......@@ -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
#ifdef __cplusplus
}
#endif
END_EXTERN_C
#endif
......@@ -454,11 +454,11 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session,
}
} else { /* time off the channel (if you must) */
switch_frame *read_frame;
switch_status status;
while (switch_channel_test_flag(channel, CF_HOLD)) {
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)) {
break;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论