[xml] [Patch] - Porting Libxml on zOS



Hi all,

 

Here are a few patch that I had to make on libxml2.2.9.4 to build on zOS and parse some XML (I worked on USS partition with configure, make …).

 

First of all since testapi.c file is huge (over 52000 lines), it’s compilation fails:

CC testapi.o
CEE3204S The system detected a protection exception (System Completion Code=0C4).
From entry point ddpi_table_add_symlocinfo_entry at statement 4347 at compile unit offset +0000009C at entry
offset +0000009C at address 223D5AF4.
FSUM3065 The COMPILE step ended with return code 3000.

I skipped the problem by removing all references to testapi in the Makefile.in, but it would be neat if one can build without test files (I didn’t find an option in configure…)

 

Here are the fix needed to compile and successfully parse XML on zOS:

--- parser.c 2016-07-18 16:13:29.000000000 +0200

+++ parser-fix.c 2016-07-21 11:04:33.000000000 +0200

@@ -30,6 +30,8 @@

  * daniel veillard com

  */

+/* To avoid EBCDIC trouble when parsing on zOS */

+#pragma convert("ISO8859-1")

#define IN_LIBXML

#include "libxml.h"

 

--- tree.c 2016-07-21 11:05:19.000000000 +0200

+++ tree-fix.c 2016-07-21 11:02:10.000000000 +0200

@@ -10,8 +10,6 @@

  *

  */

-/* To avoid EBCDIC trouble when parsing on zOS */

-#pragma convert("ISO8859-1")

#define IN_LIBXML

#include "libxml.h"

 

--- entities.c 2016-05-23 12:01:08.000000000 +0200

+++ entities-fix.c 2016-07-21 11:05:12.000000000 +0200

@@ -6,6 +6,8 @@

  * daniel veillard com

  */

+/* To avoid EBCDIC trouble when parsing on zOS */

+#pragma convert("ISO8859-1")

#define IN_LIBXML

#include "libxml.h"

 

 

--- xmlschemas.c 2016-05-23 12:01:08.000000000 +0200

+++ xmlschemas-fix.c 2016-07-21 11:05:49.000000000 +0200

@@ -44,6 +44,9 @@

  *     but is done here due to performance. Move it to an other layer

  *     is schema construction via an API is implemented.

  */

+

+/* To avoid EBCDIC trouble when parsing on zOS */

+#pragma convert("ISO8859-1")

#define IN_LIBXML

#include "libxml.h"

@@ -3168,8 +3171,8 @@

   "valid.");

  }

  if (expected) {

-     msg = xmlStrcat(msg, BAD_CAST " Expected is '");

      xmlChar *expectedEscaped = xmlCharStrdup(expected);

+     msg = xmlStrcat(msg, BAD_CAST " Expected is '");

      msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped));

      FREE_AND_NULL(expectedEscaped);

      msg = xmlStrcat(msg, BAD_CAST "'.\n");

 

--- xmlschemastypes.c 2016-05-06 18:28:04.000000000 +0200

+++ xmlschemastypes-fix.c 2016-07-21 11:05:00.000000000 +0200

@@ -7,6 +7,8 @@

  * Daniel Veillard <veillard redhat com>

  */

+/* To avoid EBCDIC trouble when parsing on zOS */

+#pragma convert("ISO8859-1")

#define IN_LIBXML

#include "libxml.h"

 --- relaxng.c 2016-05-23 12:01:08.000000000 +0200

+++ relaxng-fix.c 2016-07-21 11:06:28.000000000 +0200

@@ -2088,6 +2088,7 @@

                          const xmlChar * arg2)

{

     char msg[1000];

+    xmlChar *result;

     if (arg1 == NULL)

         arg1 = BAD_CAST "";

@@ -2215,7 +2216,7 @@

         snprintf(msg, 1000, "Unknown error code %d\n", err);

     }

     msg[1000 - 1] = 0;

-    xmlChar *result = xmlCharStrdup(msg);

+    result = xmlCharStrdup(msg);

     return (xmlEscapeFormatString(&result));

}

 

--- xmlIO.c 2016-07-15 13:42:07.000000000 +0200

+++ xmlIO-fix.c 2016-07-21 11:09:14.000000000 +0200

@@ -926,8 +926,11 @@

#endif

     }

-    if (!xmlCheckFilename(path))

+    /* Do not check DDNAME on zOS ! */

+    if(!__MVS__) {

+      if (!xmlCheckFilename(path))

         return(NULL);

+    }

 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)

     fd = xmlWrapOpen(path, 0);

 

Please let me know what you think about it,

 

Best regards,

 

Stéphane



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]