From 454e397eb7dd0fe219fa681eeadfaf2a64a3aeec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Michaut?= Date: Mon, 28 Aug 2017 14:30:43 +0200 Subject: [PATCH] Porting libxml2 on zOS encoding of code First set of patches for zOS - entities.c parser.c tree.c xmlschemas.c xmlschemastypes.c xpath.c xpointer.c: ask conversion of code to ISO Latin 1 to avoid having the compiler assume EBCDIC codepoint for characters. - xmlmodule.c: make sure we have support for modules - xmlIO.c: zOS path names are special avoid dsome of the expectstions from Unix/Windows --- entities.c | 5 +++++ parser.c | 5 +++++ tree.c | 5 +++++ xmlIO.c | 9 +++++++-- xmlmodule.c | 5 +++++ xmlschemas.c | 6 ++++++ xmlschemastypes.c | 5 +++++ xpath.c | 5 +++++ xpointer.c | 5 +++++ 9 files changed, 48 insertions(+), 2 deletions(-) diff --git a/entities.c b/entities.c index 64808ff6..c8193376 100644 --- a/entities.c +++ b/entities.c @@ -6,6 +6,11 @@ * 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" diff --git a/parser.c b/parser.c index 51452a25..9a7135fd 100644 --- a/parser.c +++ b/parser.c @@ -30,6 +30,11 @@ * 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" diff --git a/tree.c b/tree.c index 572185ee..cf81cc67 100644 --- a/tree.c +++ b/tree.c @@ -10,6 +10,11 @@ * */ +/* To avoid EBCDIC trouble when parsing on zOS */ +#if defined(__MVS__) +#pragma convert("ISO8859-1") +#endif + #define IN_LIBXML #include "libxml.h" diff --git a/xmlIO.c b/xmlIO.c index c699d52c..6891ff9a 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -926,8 +926,11 @@ xmlFileOpen_real (const char *filename) { #endif } + /* Do not check DDNAME on zOS ! */ +#if !defined(__MVS__) if (!xmlCheckFilename(path)) return(NULL); +#endif #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) fd = xmlWrapOpen(path, 0); @@ -1004,11 +1007,13 @@ xmlFileOpenW (const char *filename) { #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) fd = xmlWrapOpen(path, 1); +#elif(__MVS__) + fd = fopen(path, "w"); #else - fd = fopen(path, "wb"); + fd = fopen(path, "wb"); #endif /* WIN32 */ - if (fd == NULL) xmlIOErr(0, path); + if (fd == NULL) xmlIOErr(0, path); return((void *) fd); } #endif /* LIBXML_OUTPUT_ENABLED */ diff --git a/xmlmodule.c b/xmlmodule.c index 50ed666a..7f70f9cb 100644 --- a/xmlmodule.c +++ b/xmlmodule.c @@ -8,6 +8,11 @@ * http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html */ +/* In order RTLD_GLOBAL and RTLD_NOW to be defined on zOS */ +#if defined(__MVS__) +#define _UNIX03_SOURCE +#endif + #define IN_LIBXML #include "libxml.h" diff --git a/xmlschemas.c b/xmlschemas.c index 46bddd32..1938d7ea 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -44,6 +44,12 @@ * 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" diff --git a/xmlschemastypes.c b/xmlschemastypes.c index 5f385990..c9674ba9 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -7,6 +7,11 @@ * Daniel Veillard */ +/* To avoid EBCDIC trouble when parsing on zOS */ +#if defined(__MVS__) +#pragma convert("ISO8859-1") +#endif + #define IN_LIBXML #include "libxml.h" diff --git a/xpath.c b/xpath.c index 318b5b4a..1a0bbc94 100644 --- a/xpath.c +++ b/xpath.c @@ -14,6 +14,11 @@ * */ +/* To avoid EBCDIC trouble when parsing on zOS */ +#if defined(__MVS__) +#pragma convert("ISO8859-1") +#endif + #define IN_LIBXML #include "libxml.h" diff --git a/xpointer.c b/xpointer.c index 1413868e..c8ebff3c 100644 --- a/xpointer.c +++ b/xpointer.c @@ -14,6 +14,11 @@ * 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"