[pcre-dev] requested changes in anticipation of z/OS port

Top Page
Delete this message
Author: Ze'ev Atlas
Date:  
To: pcre exim
Subject: [pcre-dev] requested changes in anticipation of z/OS port
Hi all
I am very close to releasing the first version (0.1b) of a PCRE port to z/OS.  I have designed Perl scripts that automatically handle most issues:
1. Source module names changed in controlled manner to reflect z/OS' 8 character member name limitation.
2. All #include are changed to refer to the above transformed names
3. All references to external module source names are changed as well.
4. Internal function names (such as pcre_copy_substring) are automatically resolved in linkage time (next release will handle these names in similar manner as well, for usage in the anticipated COBOL/PLI API)
5. All fopen are changed to avoid binary files (i.e. "r" or "w" instead of "rw" or "rb"
6. The character 'ÿ' is changed to \xFF to prevent z/OS' FTP failure
7. The character ^ is changed to ¬ because this is what the mainframe likes (apparently ^ was not available in the 3270 terminals)
8. Some code is added to enforce usage of config.h.  The supplied z/OS compatible config.h was manually adjusted.  One important definition in that config.h is the line
#define NATIVE_ZOS 1

However, in very few places, there is a need to change the core code.
1. In dftables.c


  "be supplied to the linker. */\n\n"  <=== After this line, replace the source code with:
 /* ZA - force config.h in z/OS */
 #if defined NATIVE_ZOS
  "#ifndef HAVE_CONFIG_H\n"
  "#define HAVE_CONFIG_H 1\n"
  "#endif\n"
 #endif
  "#ifdef HAVE_CONFIG_H\n"
  "#include \"config.h\"\n"
  "#endif\n\n"
  "#include \"pcre_internal.h\"\n\n"); <=== Until this line

2. in pcretest.c
2.1
See the line that deals with _WIN32:
/* ZA - z/OS behaves like windows in that case*/
#if defined(_WIN32) || defined(WIN32) || defined(__minix) || defined(NATIVE_ZOS)
2.2
#include <sys/resource.h>      /* for setrlimit(). */   <=== After this line, replace the source code with:
/* ZA - z/OS use simple w and r*/
#if defined NATIVE_ZOS
#define INPUT_MODE   "r"
#define OUTPUT_MODE  "w"
#else
#define INPUT_MODE   "rb"
#define OUTPUT_MODE  "wb"
#endif
#endif

#define PRIV(name) name  <=== Until this line


I have not yet tested pcregrep.c, or any other module that is outside the core PCRE functionality and will not turn my attention to those before the core functionality is tested and COBOL/PLI API is developed and tested.  I assume that I will need some more minimal changes as we go.
 
Ze'ev Atlas