Re: [xml] [Patch] - Porting Libxml2-2.9.4 on zOS



  Hi Stéphane,

 I had to work around issues in the patch, but I think I pushed all the
modifications still needed (some of the non ANSI changes were already
corrected in git head)

https://git.gnome.org/browse/libxml2/commit/?id=454e397eb7dd0fe219fa681eeadfaf2a64a3aeec

 for the description of changes made to Makefiles, I'm saving that as a
separated patch

  thanks !

Daniel

On Thu, Jul 27, 2017 at 12:31:00PM +0000, Stéphane Michaut wrote:
After discussions with Daniel I (re)post my patch for zOs porting with some updates...
(see first post on that topic https://mail.gnome.org/archives/xml/2016-July/msg00005.html)

Thanks,

Stephane


--- 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 */
+#if defined(__MVS__)
+#pragma convert("ISO8859-1")
+#endif
 #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 @@
  * daniel veillard com
  */
 
+/* To avoid EBCDIC trouble when parsing on zOS */
+#if defined(__MVS__)
+#pragma convert("ISO8859-1")
+#endif
 #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")
+#endif
 #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 */
+#if defined(__MVS__)
+#pragma convert("ISO8859-1")
+#endif
 #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 */
+#if defined(__MVS__)
+#pragma convert("ISO8859-1")
+#endif
 #define IN_LIBXML
 #include "libxml.h"

--- xpath.c     2017-07-27 13:12:01.000000000 +0200
+++ xpath-fix.c 2017-07-27 14:13:44.000000000 +0200
@@ -14,6 +14,10 @@
  *
  */
 
+#if defined(__MVS__) 
+#pragma convert("ISO8859-1")
+#endif
+
 #define IN_LIBXML
 #include "libxml.h"

--- xpointer.c  2016-05-23 12:01:08.000000000 +0200
+++ xpointer-fix.c      2017-07-27 14:17:04.000000000 +0200
@@ -14,6 +14,10 @@
  * daniel veillard com
  */
 
+#if defined(__MVS__) 
+#pragma convert("ISO8859-1")
+#endif
+
 #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


-- 
Daniel Veillard      | Red Hat Developers Tools http://developer.redhat.com/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/


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