Commit 8e9041a4 authored by jehan's avatar jehan
Browse files

re-enable support of libantlr3c version 3.2

parent dc04f9f9
......@@ -79,16 +79,19 @@ dnl check antlr headers
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $ANTLR_CFLAGS"
AC_CHECK_HEADERS([antlr3.h], [found_antlr3=yes])
AC_CHECK_DECL([antlr3StringStreamNew], [found_antlr3=yes], [found_antlr3=no],[#include <antlr3.h>])
AC_CHECK_DECL([res_ndestroy]
,[AC_DEFINE(HAVE_RESINIT,1,[Defined when res_ninit api is available]) LIBS="$LIBS -lresolv"]
,[foo=bar]
,[#include <resolv.h>])
AC_CHECK_DECL( [antlr3StringStreamNew]
,[AC_DEFINE(HAVE_ANTLR_STRING_STREAM_NEW,1,[Defined when antlr 3.4 api is detected])]
,[foo=bar]
,[#include <antlr3.h>])
AC_CHECK_DECL( [res_ndestroy]
,[AC_DEFINE(HAVE_RESINIT,1,[Defined when res_ninit api is available]) LIBS="$LIBS -lresolv"]
,[foo=bar]
,[#include <resolv.h>])
CPPFLAGS=$CPPFLAGS_save
if test "$found_antlr3" != "yes" ; then
AC_MSG_ERROR([Could not find antlr3 development files. Please install antlr3 version > 3.4 (libantlr3c-dev on debian/ubuntu systems)])
AC_MSG_ERROR([Could not find antlr3 development files. Please install antlr3 version > 3.2 (libantlr3c-dev on debian/ubuntu systems)])
ANTLR_CFLAGS=
ANTLR_LIBS=
fi
......
......@@ -454,7 +454,7 @@ belle_sdp_media_description_t* belle_sdp_media_description_create(const char* me
}
BELLE_SDP_PARSE(media_description)
void belle_sdp_media_description_add_dynamic_payloads(belle_sdp_media_description_t* media_description, belle_sip_list_t* payloadNames, belle_sip_list_t* payloadValues) {
belle_sip_error("belle_sdp_media_description_add_dynamic_payloads not implemented yet");
}
const belle_sdp_attribute_t* belle_sdp_media_description_get_attribute(const belle_sdp_media_description_t* media_description, const char* name) {
return belle_sdp_base_description_get_attribute(BELLE_SIP_CAST(media_description,belle_sdp_base_description_t),name);
......
......@@ -879,11 +879,7 @@ belle_sip_header_extension_t* belle_sip_header_extension_parse (const char* valu
pANTLR3_COMMON_TOKEN_STREAM tokens;
pbelle_sip_messageParser parser;
belle_sip_messageParser_header_extension_return l_parsed_object;
input = antlr3StringStreamNew (
(pANTLR3_UINT8)value,
ANTLR3_ENC_8BIT,
(ANTLR3_UINT32)strlen(value),
(pANTLR3_UINT8)"header_extension");
input = ANTLR_STREAM_NEW("header_extension",value,strlen(value));
lex = belle_sip_messageLexerNew (input);
tokens = antlr3CommonTokenStreamSourceNew (1025, lex->pLexer->rec->state->tokSource);
parser = belle_sip_messageParserNew (tokens);
......
......@@ -351,6 +351,15 @@ BELLESIP_INTERNAL_EXPORT unsigned int belle_sip_random(void);
belle_sip_parameters_set_parameter(BELLE_SIP_PARAMETERS(obj),#attribute,NULL);\
}
#if HAVE_ANTLR_STRING_STREAM_NEW
#define ANTLR_STREAM_NEW(object_type, value,length) \
antlr3StringStreamNew((pANTLR3_UINT8)value,ANTLR3_ENC_8BIT,(ANTLR3_UINT32)length,(pANTLR3_UINT8)#object_type)
#else
#define ANTLR_STREAM_NEW(object_type, value, length) \
antlr3NewAsciiStringCopyStream((pANTLR3_UINT8)value,(ANTLR3_UINT32)length,NULL)
#endif /*HAVE_ANTLR_STRING_STREAM_NEW*/
#define BELLE_SIP_PARSE(object_type) \
belle_sip_##object_type##_t* belle_sip_##object_type##_parse (const char* value) { \
pANTLR3_INPUT_STREAM input; \
......@@ -358,11 +367,7 @@ belle_sip_##object_type##_t* belle_sip_##object_type##_parse (const char* value)
pANTLR3_COMMON_TOKEN_STREAM tokens; \
pbelle_sip_messageParser parser; \
belle_sip_##object_type##_t* l_parsed_object; \
input = antlr3StringStreamNew(\
(pANTLR3_UINT8)value,\
ANTLR3_ENC_8BIT,\
(ANTLR3_UINT32)strlen(value),\
(pANTLR3_UINT8)#object_type);\
input = ANTLR_STREAM_NEW(object_type,value,strlen(value));\
lex = belle_sip_messageLexerNew (input);\
tokens = antlr3CommonTokenStreamSourceNew (ANTLR3_SIZE_HINT, TOKENSOURCE(lex));\
parser = belle_sip_messageParserNew (tokens);\
......@@ -743,11 +748,7 @@ belle_sdp_##object_type##_t* belle_sdp_##object_type##_parse (const char* value)
pANTLR3_COMMON_TOKEN_STREAM tokens; \
pbelle_sdpParser parser; \
belle_sdp_##object_type##_t* l_parsed_object; \
input = antlr3StringStreamNew (\
(pANTLR3_UINT8)value,\
ANTLR3_ENC_8BIT,\
(ANTLR3_UINT32)strlen(value),\
(pANTLR3_UINT8)#object_type);\
input = ANTLR_STREAM_NEW(object_type, value,strlen(value));\
lex = belle_sdpLexerNew (input);\
tokens = antlr3CommonTokenStreamSourceNew (ANTLR3_SIZE_HINT, TOKENSOURCE(lex));\
parser = belle_sdpParserNew (tokens);\
......
......@@ -79,11 +79,7 @@ belle_sip_message_t* belle_sip_message_parse_raw (const char* buff, size_t buff_
pANTLR3_COMMON_TOKEN_STREAM tokens;
pbelle_sip_messageParser parser;
belle_sip_message_t* l_parsed_object;
input = antlr3StringStreamNew (
(pANTLR3_UINT8)buff,
ANTLR3_ENC_8BIT,
(ANTLR3_UINT32)buff_length,
(pANTLR3_UINT8)"message");
input = ANTLR_STREAM_NEW("message",buff,buff_length);
lex = belle_sip_messageLexerNew (input);
tokens = antlr3CommonTokenStreamSourceNew (1025, lex->pLexer->rec->state->tokSource);
parser = belle_sip_messageParserNew (tokens);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment