1 | //===- AutoConvert.h - Auto conversion between ASCII/EBCDIC -----*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // This file contains functions used for auto conversion between |
10 | // ASCII/EBCDIC codepages specific to z/OS. |
11 | // |
12 | //===----------------------------------------------------------------------===// |
13 | |
14 | #ifndef LLVM_SUPPORT_AUTOCONVERT_H |
15 | #define LLVM_SUPPORT_AUTOCONVERT_H |
16 | |
17 | #ifdef __MVS__ |
18 | #include <_Ccsid.h> |
19 | #ifdef __cplusplus |
20 | #include <system_error> |
21 | #endif // __cplusplus |
22 | |
23 | #define CCSID_IBM_1047 1047 |
24 | #define CCSID_UTF_8 1208 |
25 | #define CCSID_ISO8859_1 819 |
26 | |
27 | #ifdef __cplusplus |
28 | extern "C" { |
29 | #endif // __cplusplus |
30 | int enableAutoConversion(int FD); |
31 | int disableAutoConversion(int FD); |
32 | int restoreStdHandleAutoConversion(int FD); |
33 | #ifdef __cplusplus |
34 | } |
35 | #endif // __cplusplus |
36 | |
37 | #ifdef __cplusplus |
38 | namespace llvm { |
39 | |
40 | /// \brief Disable the z/OS enhanced ASCII auto-conversion for the file |
41 | /// descriptor. |
42 | std::error_code disableAutoConversion(int FD); |
43 | |
44 | /// \brief Query the z/OS enhanced ASCII auto-conversion status of a file |
45 | /// descriptor and force the conversion if the file is not tagged with a |
46 | /// codepage. |
47 | std::error_code enableAutoConversion(int FD); |
48 | |
49 | /// Restore the z/OS enhanced ASCII auto-conversion for the std handle. |
50 | std::error_code restoreStdHandleAutoConversion(int FD); |
51 | |
52 | /// \brief Set the tag information for a file descriptor. |
53 | std::error_code setFileTag(int FD, int CCSID, bool Text); |
54 | |
55 | } // namespace llvm |
56 | #endif // __cplusplus |
57 | |
58 | #endif // __MVS__ |
59 | |
60 | #endif // LLVM_SUPPORT_AUTOCONVERT_H |
61 | |