[SVN-NetXMS] revision 3304

From: NetXMS.org SVN Server <svn_at_DOMAIN_REMOVED>
Date: Thu, 12 Jun 2008 18:59:33 +0300

* { font-family: Consolas, Lucida Console, Courier New; font-size: 100%; }
h1 { font-size: 150%; }
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 100%; width: 100%; }
.highlight span { width: 100%; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; }
body { background: #ffffff; }
body .c { color: #999988; font-style: italic } /* Comment */
body .err { color: #a61717; background-color: #e3d2d2 } /* Error */
body .k { font-weight: bold } /* Keyword */
body .o { font-weight: bold } /* Operator */
body .cm { color: #999988; font-style: italic } /* Comment.Multiline */
body .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
body .c1 { color: #999988; font-style: italic } /* Comment.Single */
body .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
body .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #aa0000 } /* Generic.Error */
body .gh { color: #999999 } /* Generic.Heading */
body .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
body .go { color: #888888 } /* Generic.Output */
body .gp { color: #555555 } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #aaaaaa } /* Generic.Subheading */
body .gt { color: #aa0000 } /* Generic.Traceback */
body .kc { font-weight: bold } /* Keyword.Constant */
body .kd { font-weight: bold } /* Keyword.Declaration */
body .kp { font-weight: bold } /* Keyword.Pseudo */
body .kr { font-weight: bold } /* Keyword.Reserved */
body .kt { color: #445588; font-weight: bold } /* Keyword.Type */
body .m { color: #009999 } /* Literal.Number */
body .s { color: #bb8844 } /* Literal.String */
body .na { color: #008080 } /* Name.Attribute */
body .nb { color: #999999 } /* Name.Builtin */
body .nc { color: #445588; font-weight: bold } /* Name.Class */
body .no { color: #008080 } /* Name.Constant */
body .ni { color: #800080 } /* Name.Entity */
body .ne { color: #990000; font-weight: bold } /* Name.Exception */
body .nf { color: #990000; font-weight: bold } /* Name.Function */
body .nn { color: #555555 } /* Name.Namespace */
body .nt { color: #000080 } /* Name.Tag */
body .nv { color: #008080 } /* Name.Variable */
body .ow { font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #009999 } /* Literal.Number.Float */
body .mh { color: #009999 } /* Literal.Number.Hex */
body .mi { color: #009999 } /* Literal.Number.Integer */
body .mo { color: #009999 } /* Literal.Number.Oct */
body .sb { color: #bb8844 } /* Literal.String.Backtick */
body .sc { color: #bb8844 } /* Literal.String.Char */
body .sd { color: #bb8844 } /* Literal.String.Doc */
body .s2 { color: #bb8844 } /* Literal.String.Double */
body .se { color: #bb8844 } /* Literal.String.Escape */
body .sh { color: #bb8844 } /* Literal.String.Heredoc */
body .si { color: #bb8844 } /* Literal.String.Interpol */
body .sx { color: #bb8844 } /* Literal.String.Other */
body .sr { color: #808000 } /* Literal.String.Regex */
body .s1 { color: #bb8844 } /* Literal.String.Single */
body .ss { color: #bb8844 } /* Literal.String.Symbol */
body .bp { color: #999999 } /* Name.Builtin.Pseudo */
body .vc { color: #008080 } /* Name.Variable.Class */
body .vg { color: #008080 } /* Name.Variable.Global */
body .vi { color: #008080 } /* Name.Variable.Instance */
body .il { color: #009999 } /* Literal.Number.Integer.Long */

Info

Revision:3304
Author:victor

Date:2008-06-12 18:59:32 +0300 (Thu, 12 Jun 2008)

Comment:Added check for libexpat, NXCP/XML part built only if libexpat is available

Changes
U trunk/configure.ac
U trunk/include/nms_common.h
U trunk/include/nxcpapi.h
U trunk/src/Makefile.am
U trunk/src/libnetxms/message.cpp

Diff
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2008-06-12 09:13:59 UTC (rev 3303)
+++ trunk/configure.ac 2008-06-12 15:59:32 UTC (rev 3304)
@@ -233,7 +233,7 @@
 AC_ARG_WITH(dist,
 [AS_HELP_STRING(--with-dist,for maintainers only)],
         DB_DRIVERS=&quot; mysql pgsql odbc mssql sqlite oracle&quot;
- MODULES=&quot;libnxsnmp libnxsl server agent libnxmap libnxcl nxevent nxpush nxreport nxmibc client console nxhttpd nxscript&quot;
+ MODULES=&quot;libnxsnmp libnxsl server agent libnxmap libnxcl nxevent nxpush nxreport nxmibc client console nxhttpd nxscript nxcptest&quot;
         SUBAGENT_DIRS=&quot;linux freebsd openbsd sunos aix ipso hpux&quot;
         NXCONFIG=&quot;nxconfig&quot;
         TOP_LEVEL_MODULES=&quot;sql images&quot;
@@ -706,6 +706,13 @@
         AC_CHECK_LIB(z, deflate)
 fi
 
+HAVE_LIBEXPAT=yes
+AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
+AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
+if test &quot;x$HAVE_LIBEXPAT&quot; = &quot;xyes&quot;; then
+ AC_DEFINE(HAVE_LIBEXPAT,1,Define to 1 if you have working libexpat)
+ MODULES=&quot;$MODULES nxcptest&quot;
+fi
 
 #--------------------------------------------------------------------
 # Checks for header files
@@ -1603,4 +1610,8 @@
 else
         echo &quot;Build UNICODE libraries : NO&quot;
 fi
-
+if test &quot;x${HAVE_LIBEXPAT}&quot; = &quot;xyes&quot;; then
+ echo &quot;XML support in NXCP : YES&quot;
+else
+ echo &quot;XML support in NXCP : NO&quot;
+fi

Modified: trunk/include/nms_common.h
===================================================================
--- trunk/include/nms_common.h 2008-06-12 09:13:59 UTC (rev 3303)
+++ trunk/include/nms_common.h 2008-06-12 15:59:32 UTC (rev 3304)
@@ -159,6 +159,10 @@
 #define O_TRUNC 0x0800
 #endif
 
+#ifndef UNDER_CE
+#define HAVE_LIBEXPAT 1
+#endif
+
 #elif defined(_NETWARE)
 
 /********** NETWARE ********************/

Modified: trunk/include/nxcpapi.h
===================================================================
--- trunk/include/nxcpapi.h 2008-06-12 09:13:59 UTC (rev 3303)
+++ trunk/include/nxcpapi.h 2008-06-12 15:59:32 UTC (rev 3304)
@@ -73,8 +73,10 @@
 
    CSCP_MESSAGE *CreateMessage(void);
         char *CreateXML(void);
+#if HAVE_LIBEXPAT
         void ProcessXMLToken(void *state, const char **attrs);
         void ProcessXMLData(void *state);
+#endif
 
    WORD GetCode(void) { return m_wCode; }
    void SetCode(WORD wCode) { m_wCode = wCode; }

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2008-06-12 09:13:59 UTC (rev 3303)
+++ trunk/src/Makefile.am 2008-06-12 15:59:32 UTC (rev 3304)
@@ -8,6 +8,6 @@
 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
-SUBDIRS = libnetxms install nxcptest
+SUBDIRS = libnetxms install
 SUBDIRS += @MODULES@
 EXTRA_DIST = PPC_libs.vcw

Modified: trunk/src/libnetxms/message.cpp
===================================================================
--- trunk/src/libnetxms/message.cpp 2008-06-12 09:13:59 UTC (rev 3303)
+++ trunk/src/libnetxms/message.cpp 2008-06-12 15:59:32 UTC (rev 3304)
@@ -23,7 +23,10 @@
 **/
 
 #include &quot;libnetxms.h&quot;
+
+#if HAVE_LIBEXPAT
 #include &lt;expat.h&gt;
+#endif
 
 
 //
@@ -204,6 +207,8 @@
 // Create CSCPMessage object from XML document
 //
 
+#if HAVE_LIBEXPAT
+
 static void StartElement(void *userData, const char *name, const char **attrs)
 {
         if (!strcmp(name, &quot;nxcp&quot;))
@@ -267,8 +272,11 @@
         ps-&gt;value[ps-&gt;valueLen - 1] = 0;
 }
 
+#endif
+
 CSCPMessage::CSCPMessage(char *xml)
 {
+#if HAVE_LIBEXPAT
         XML_Parser parser = XML_ParserCreate(NULL);
         XML_PARSER_STATE state;
 
@@ -288,14 +296,26 @@
         XML_SetCharacterDataHandler(parser, CharData);
         if (XML_Parse(parser, xml, strlen(xml), TRUE) == XML_STATUS_ERROR)
         {
-fprintf(stderr,
+/*fprintf(stderr,
         &quot;%s at line %d\n&quot;,
         XML_ErrorString(XML_GetErrorCode(parser)),
- XML_GetCurrentLineNumber(parser));
+ XML_GetCurrentLineNumber(parser));*/
         }
         XML_ParserFree(parser);
+
+#else
+
+ // Default values
+ m_wCode = 0;
+ m_dwId = 0;
+ m_dwNumVar = 0;
+ m_ppVarList = NULL;
+ m_wFlags = 0;
+ m_nVersion = NXCP_VERSION;
+#endif
 }
 
+#if HAVE_LIBEXPAT
 static const char *GetAttr(const char **attrs, const char *name)
 {
         int i;
@@ -407,7 +427,9 @@
         }
 }
 
+#endif
 
+
 //
 // Destructor for CSCPMessage
 //
Received on Thu Jun 12 2008 - 18:59:33 EEST

This archive was generated by hypermail 2.2.0 : Thu Jun 12 2008 - 18:56:09 EEST