Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:27

0001 /*===- AutoConvert.h - Auto conversion between ASCII/EBCDIC -----*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file contains functions used for auto conversion between
0010 // ASCII/EBCDIC codepages specific to z/OS.
0011 //
0012 //===----------------------------------------------------------------------===*/
0013 
0014 #ifndef LLVM_SUPPORT_AUTOCONVERT_H
0015 #define LLVM_SUPPORT_AUTOCONVERT_H
0016 
0017 #ifdef __MVS__
0018 #include <_Ccsid.h>
0019 #ifdef __cplusplus
0020 #include "llvm/Support/ErrorOr.h"
0021 #include <system_error>
0022 #endif /* __cplusplus */
0023 
0024 #define CCSID_IBM_1047 1047
0025 #define CCSID_UTF_8 1208
0026 #define CCSID_ISO8859_1 819
0027 
0028 #ifdef __cplusplus
0029 extern "C" {
0030 #endif /* __cplusplus */
0031 int enablezOSAutoConversion(int FD);
0032 int disablezOSAutoConversion(int FD);
0033 int restorezOSStdHandleAutoConversion(int FD);
0034 #ifdef __cplusplus
0035 }
0036 #endif /* __cplusplus */
0037 
0038 #ifdef __cplusplus
0039 namespace llvm {
0040 
0041 /** \brief Disable the z/OS enhanced ASCII auto-conversion for the file
0042  * descriptor.
0043  */
0044 std::error_code disablezOSAutoConversion(int FD);
0045 
0046 /** \brief Query the z/OS enhanced ASCII auto-conversion status of a file
0047  * descriptor and force the conversion if the file is not tagged with a
0048  * codepage.
0049  */
0050 std::error_code enablezOSAutoConversion(int FD);
0051 
0052 /** Restore the z/OS enhanced ASCII auto-conversion for the std handle. */
0053 std::error_code restorezOSStdHandleAutoConversion(int FD);
0054 
0055 /** \brief Set the tag information for a file descriptor. */
0056 std::error_code setzOSFileTag(int FD, int CCSID, bool Text);
0057 
0058 // Get the the tag ccsid for a file name or a file descriptor.
0059 ErrorOr<__ccsid_t> getzOSFileTag(const char *FileName, const int FD = -1);
0060 
0061 // Query the file tag to determine if it needs conversion to UTF-8 codepage.
0062 ErrorOr<bool> needzOSConversion(const char *FileName, const int FD = -1);
0063 
0064 } // namespace llvm
0065 #endif // __cplusplus
0066 
0067 #endif /* __MVS__ */
0068 
0069 #endif /* LLVM_SUPPORT_AUTOCONVERT_H */