Added ixmldebug and UpnpGlobal.h to the 1.6.x branch.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@462 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2008-07-25 03:22:35 +00:00
parent 515233ca56
commit 3ba4e34662
7 changed files with 229 additions and 52 deletions

View File

@ -24,14 +24,23 @@ libixml_la_LDFLAGS = -version-info $(LT_VERSION_IXML) \
-export-symbols-regex '^ixml.*'
libixml_la_SOURCES = \
src/ixml.c src/node.c src/ixmlparser.c \
src/ixmlmembuf.c src/nodeList.c \
src/element.c src/attr.c src/document.c \
src/attr.c \
src/document.c \
src/element.c \
src/inc/ixmlmembuf.h \
src/inc/ixmlparser.h \
src/ixml.c \
src/ixmldebug.c \
src/ixmlparser.c \
src/ixmlmembuf.c \
src/namedNodeMap.c \
src/inc/ixmlmembuf.h src/inc/ixmlparser.h
src/node.c \
src/nodeList.c
upnpincludedir = $(includedir)/upnp
upnpinclude_HEADERS = inc/ixml.h
upnpinclude_HEADERS = \
inc/ixml.h
inc/ixmldebug.h
check_PROGRAMS = test_document

41
ixml/inc/ixmldebug.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef IXMLDEBUG_H
#define IXMLDEBUG_H
#include "UpnpGlobal.h"
/*!
* \file
*
* \brief Auxiliar routines to aid debugging.
*/
/*!
* \brief Prints the debug statement either on the standard output or log file
* along with the information from where this debug statement is coming.
*/
#ifdef DEBUG
void IxmlPrintf(
/*! [in] Printf like format specification. */
const char* FmtStr,
/*! [in] Printf like Variable number of arguments that will go in the debug
* statement. */
...)
#if (__GNUC__ >= 3)
/* This enables printf like format checking by the compiler */
__attribute__((format (__printf__, 1, 2)))
#endif
;
#else /* DEBUG */
static UPNP_INLINE void IxmlPrintf(
const char* FmtStr,
...) {}
#endif /* DEBUG */
#endif /* IXMLDEBUG_H */

31
ixml/src/ixmldebug.c Normal file
View File

@ -0,0 +1,31 @@
/*!
* \file
*/
#include "autoconfig.h"
#include "ixmldebug.h"
#include <stdarg.h>
#include <stdio.h>
#ifdef DEBUG
void IxmlPrintf(
const char *FmtStr,
...)
{
va_list ArgList;
va_start(ArgList, FmtStr);
vfprintf(stdout, FmtStr, ArgList);
fflush(stdout);
va_end(ArgList);
}
#endif

View File

@ -20,7 +20,8 @@ LDADD = \
upnpincludedir = $(includedir)/upnp
upnpinclude_HEADERS = \
inc/upnp.h \
inc/upnpdebug.h
inc/upnpdebug.h \
inc/UpnpGlobal.h
nodist_upnpinclude_HEADERS = inc/upnpconfig.h
if ENABLE_TOOLS

120
upnp/inc/UpnpGlobal.h Normal file
View File

@ -0,0 +1,120 @@
#ifndef UPNPGLOBAL_H
#define UPNPGLOBAL_H
/*!
* \file
*
* \brief Defines constants that for some reason are not defined on some systems.
*/
#if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64
#if defined __GNUC__
#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE
#else
#error libupnp requires largefile mode - use AC_SYS_LARGEFILE
#endif
#endif
#ifdef WIN32
/*
* EXPORT_SPEC
*/
#ifdef UPNP_STATIC_LIB
#define EXPORT_SPEC
#else /* UPNP_STATIC_LIB */
#ifdef LIBUPNP_EXPORTS
/*! set up declspec for dll export to make functions
* visible to library users */
#define EXPORT_SPEC __declspec(dllexport)
#else /* LIBUPNP_EXPORTS */
#define EXPORT_SPEC __declspec(dllimport)
#endif /* LIBUPNP_EXPORTS */
#endif /* UPNP_STATIC_LIB */
/*
* UPNP_INLINE
* PRId64
* PRIzu
*/
#ifdef UPNP_USE_MSVCPP
/* define some things the M$ VC++ doesn't know */
#define UPNP_INLINE
typedef __int64 int64_t;
#define PRId64 "I64d"
#define PRIzu "lu"
#endif /* UPNP_USE_MSVCPP */
#ifdef UPNP_USE_BCBPP
/* define some things Borland Builder doesn't know */
#define UPNP_INLINE inline
typedef __int64 int64_t;
#warning The Borland C compiler is probably broken on PRId64,
#warning please someone provide a proper fix here
#define PRId64 "I64d"
#define PRIzu "zu"
#endif /* UPNP_USE_BCBPP */
#ifdef __GNUC__
#define UPNP_INLINE inline
/* Note with PRIzu that in the case of Mingw32, it's the MS C
* runtime printf which ends up getting called, not the glibc
* printf, so it genuinely doesn't have "zu"
*/
#define PRIzu "lu"
#endif /* __GNUC__ */
#else
/*!
* \brief Export functions on WIN32 DLLs.
*
* Every funtion that belongs to the library API must use this
* definition upon declaration or it will not be exported on WIN32
* DLLs.
*/
#define EXPORT_SPEC
/*!
* \brief Declares an inline function.
*
* Surprisingly, there are some compilers that do not understand the
* inline keyword. This definition makes the use of this keyword
* portable to these systems.
*/
#define UPNP_INLINE inline
/*!
* \brief Supply the PRId64 printf() macro.
*
* MSVC still does not know about this.
*/
#define PRId64 PRId64
/*!
* \brief Supply the PRIzu printf() macro.
*
* This macro was invented so that we can live a little longer with
* MSVC lack of C99. "z" is the correct printf() size specifier for
* the size_t type.
*/
#define PRIzu "zu"
#endif
/*
* Defining this macro here gives some interesting information about unused
* functions in the code. Of course, this should never go uncommented on a
* release.
*/
/*#define inline*/
#endif /* UPNPGLOBAL_H */

View File

@ -55,41 +55,9 @@
#endif
#include "ixml.h"
#include "upnpconfig.h"
#include "UpnpGlobal.h"
#ifdef WIN32
#ifndef UPNP_STATIC_LIB
#ifdef LIBUPNP_EXPORTS
/* set up declspec for dll export to make functions visible to library users */
#define EXPORT_SPEC __declspec(dllexport)
#else
#define EXPORT_SPEC __declspec(dllimport)
#endif
#else
#define EXPORT_SPEC
#endif
#ifdef UPNP_USE_MSVCPP
/* define some things the M$ VC++ doesn't know */
#define UPNP_INLINE
typedef __int64 int64_t;
#define PRId64 "I64d"
#define PRIzu "lu"
#endif
#ifdef UPNP_USE_BCBPP
/* define some things Borland Builder doesn't know */
#define UPNP_INLINE inline
typedef __int64 int64_t;
#warning The Borland C compiler is probably broken on PRId64, please someone provide a proper fix here
#define PRId64 "I64d"
#define PRIzu "zu"
#endif
#else
#define EXPORT_SPEC
#define UPNP_INLINE inline
/* Invented this macro so that we can live a little longer with MSVC lack of C99. */
#define PRIzu "zu"
#endif
/*
* Defining this macro here gives some interesting information about unused
* functions in the code. Of course, this should never go uncommented on a

View File

@ -34,30 +34,37 @@
* operations of the Web Server.
******************************************************************************/
#include "config.h"
#include "webserver.h"
#include "httpparser.h"
#include "httpreadwrite.h"
#include "ithread.h"
#include "membuffer.h"
#include "ssdplib.h"
#include "statcodes.h"
#include "strintmap.h"
#include "unixutil.h"
#include "upnp.h"
#include "upnpapi.h"
#include "util.h"
#include <assert.h>
#include <fcntl.h>
#ifndef UPNP_USE_BCBPP
#include <inttypes.h>
#include <stdint.h>
#endif
#include "util.h"
#include "strintmap.h"
#include "membuffer.h"
#include "httpparser.h"
#include "httpreadwrite.h"
#include "statcodes.h"
#include "webserver.h"
#include "upnp.h"
#include "upnpapi.h"
#include "ssdplib.h"
#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/stat.h>
#include "ithread.h"
#include "unixutil.h"
/*
Response Types