Hi,

I made a previous post last July, about porting Libxml2-2.9.4  code in order to 
be able to compile and run it on zOS, but I had no return...
I build on the USS partition of the zOs server and build successfully using 
configure and make as I would on Linux... I attached the difference in order to 
patch libxml...

I also had to make some (mandatory) modifications to the Makefile.in file: 
therefore I also attach a file describing the problems I ran into and how I 
solved it and what could be made in order
to make it simplier to use :)

Don't hesitate to ask me if it is not clear or if you have any suggestions.

Best regards,
--- 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 @@
  * dan...@veillard.com
  */
 
+/* To avoid EBCDIC trouble when parsing on zOS */
+#pragma convert("ISO8859-1")
 #define IN_LIBXML
 #include "libxml.h"
 
--- 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 @@
  * dan...@veillard.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));
 }
 
--- 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"
 
--- xmlIO.c     2016-07-15 13:42:07.000000000 +0200
+++ xmlIO-fix.c 2017-03-07 07:33:52.000000000 +0100
@@ -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);
@@ -1004,6 +1007,8 @@
 
 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
     fd = xmlWrapOpen(path, 1);
+#elif(__MVS__) {
+    fd = fopen(path, "w");
 #else
           fd = fopen(path, "wb");
 #endif /* WIN32 */
--- xmlmodule.c 2016-05-06 18:28:04.000000000 +0200
+++ xmlmodule-fix.c     2016-07-21 11:08:24.000000000 +0200
@@ -8,6 +8,9 @@
  * http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html
  */
 
+/* In order RTLD_GLOBAL and RTLD_NOW to be defined on zOS */
+#define _UNIX03_SOURCE
+
 #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 <veill...@redhat.com>
  */
 
+/* To avoid EBCDIC trouble when parsing on zOS */
+#pragma convert("ISO8859-1")
 #define IN_LIBXML
 #include "libxml.h"
 
- since testapi.c file is huge (over 52000 lines), it's compilation fails: I 
skipped the problem by removing all references to testapi in the Makefile.in, 
  but it would be neater if one can build without test files (I didn't find an 
option in configure...)

- since the name of files (or qualifier) in PDS are limited to 8 I had to 
rename xmlschemas.c and xmlschemastypes.c in (resp.) xmlsche.c xmlschet.c 
  (and I had to modify all occurences of these files accordingly in the rest of 
the Makefile !!!). 

- in order to copy objects to PDS, I had the cp command at line 860 of 
Makefile.in

libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES)
        $(AM_V_CCLD)$(libxml2_la_LINK) -rpath $(libdir) $(libxml2_la_OBJECTS) 
$(libxml2_la_LIBADD) $(LIBS)
        # Copy objects to PDS
        @list='$(libxml2_OBJECTS)' ; for p in $$list; do \
          cp -ACMv $$p "//'<PDS NAME>'"; \
        done

        with <PDS NAME> stands for the name of my PDS and
        
libxml2_OBJECTS = SAX.o entities.o encoding.o error.o \
        parserInternals.o parser.o tree.o hash.o list.o xmlIO.o \
        xmlmemory.o uri.o valid.o xlink.o HTMLparser.o \
        HTMLtree.o debugXML.o xpath.o xpointer.o xinclude.o \
        nanohttp.o nanoftp.o triostr.o trio.o catalog.o globals.o \
        threads.o c14n.o xmlstring.o buf.o xmlregexp.o \
        xmlsche.o xmlschet.o xmlunicode.o \
        xmlreader.o relaxng.o dict.o SAX2.o \
        xmlwriter.o legacy.o chvalid.o pattern.o xmlsave.o \
        xmlmodule.o schematron.o xzlib.o 

In order to handle the support of zOS without breaking the existing Makefile 
maybe a new option/flag zOs would copy xmlschemas.c and xmlschemastypes.c files 
and use specifics 
targets rather than existing ones with the longer names... A variable to handle 
the PDS name has to be provided also...
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to