This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ][z/OS] Add the functions needed for handling EBCDIC I/O
ClosedPublic

Authored by abhina.sreeskantharajan on Apr 14 2021, 7:55 AM.

Details

Summary

This patch adds the basic functions needed for controlling auto conversion on z/OS.
Auto conversion is enabled on untagged input file to ASCII by making the assumption that all untagged files are EBCDIC encoded. Output files are auto converted to EBCDIC IBM-1047.
This change also enables conversion for stdin/stdout/stderr.

For more information on how fcntl controls codepage https://www.ibm.com/docs/en/zos/2.4.0?topic=descriptions-fcntl-bpx1fct-bpx4fct-control-open-file-descriptors

Diff Detail

Event Timeline

abhina.sreeskantharajan requested review of this revision.Apr 14 2021, 7:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2021, 7:55 AM
anirudhp accepted this revision.Apr 20 2021, 8:16 AM

Looks good to me. Minor nits noted inline. It would be nice if we had a bit more testing coverage.

llvm/lib/Support/AutoConvert.cpp
63

minor nit: #endif __MVS__

This revision is now accepted and ready to land.Apr 20 2021, 8:16 AM

Address comments, fix bug in lit test

abhina.sreeskantharajan marked an inline comment as done.Apr 20 2021, 10:06 AM

rebase + removing call to enableAutoConversion in getSTDIN anymore because changeStdinToBinary is no longer called because we are passing the OF_Text flag now

SeanP added inline comments.Apr 21 2021, 8:44 PM
llvm/lib/Support/Unix/Path.inc
1011

Some places use #ifdef and others #if defined(__MVS__). We should be consistent.

llvm/test/Support/encoding.ll
7

minor nit. Rather than using the short names 819 & 1047 we should use the full names iso8859-1 & ibm-1047.

Changes in this new diff:

  • changed 819,1047 to full names in encoding.ll
  • use #ifdef MVS for consistency
abhina.sreeskantharajan marked 2 inline comments as done.Apr 22 2021, 5:44 AM
abhina.sreeskantharajan added inline comments.
llvm/lib/Support/Unix/Path.inc
1011

Thanks Sean. There's seems to be mixed use in this file, so I just updated all uses of MVS in this patch to be #ifdef for consistency.

abhina.sreeskantharajan marked an inline comment as done.Apr 22 2021, 5:44 AM

Remove unnecessary include

Hi Sean @SeanP, are there any more comments on this patch?

This revision was landed with ongoing or failed builds.May 3 2021, 5:52 AM
This revision was automatically updated to reflect the committed changes.