# GnuCOBOL EBCDIC/ASCII translation tables
#
# Copyright (C) 2023 Free Software Foundation, Inc.
#  Written by David Declerck, Simon Sobisch
#
# This file is part of the GnuCOBOL runtime.
#
# The GnuCOBOL runtime is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# GnuCOBOL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with GnuCOBOL.  If not, see <https://www.gnu.org/licenses/>.

# EBCDIC 500 to Latin-1 translation table
#
# Generated using the iconv library with the program below.
#
# #include <stdio.h>
# #include <iconv.h>
#
# int main(void)
# {
#   char ebcdic[256], ascii[256];
#   char *ebcdic_ptr = ebcdic, *ascii_ptr = ascii;
#   size_t ebcdic_size = 256, ascii_size = 256;
#
#   for (int i = 0; i < 256; ++i) {
#     ebcdic[i] = (unsigned char)i;
#   }
#
#   iconv_t ic = iconv_open("ISO-8859-1", "IBM500");
#
#   iconv(ic, &ebcdic_ptr, &ebcdic_size, &ascii_ptr, &ascii_size);
#
#   for (int i = 0; i < 256; ++i) {
#     printf("%02X ", (unsigned char)ascii[i]);
#     if ((i+1) % 16 == 0) printf("\n");
#   }
#
#   return 0;
# }

00 01 02 03 9C 09 86 7F 97 8D 8E 0B 0C 0D 0E 0F
10 11 12 13 9D 85 08 87 18 19 92 8F 1C 1D 1E 1F
80 81 82 83 84 0A 17 1B 88 89 8A 8B 8C 05 06 07
90 91 16 93 94 95 96 04 98 99 9A 9B 14 15 9E 1A
20 A0 E2 E4 E0 E1 E3 E5 E7 F1 5B 2E 3C 28 2B 21
26 E9 EA EB E8 ED EE EF EC DF 5D 24 2A 29 3B 5E
2D 2F C2 C4 C0 C1 C3 C5 C7 D1 A6 2C 25 5F 3E 3F
F8 C9 CA CB C8 CD CE CF CC 60 3A 23 40 27 3D 22
D8 61 62 63 64 65 66 67 68 69 AB BB F0 FD FE B1
B0 6A 6B 6C 6D 6E 6F 70 71 72 AA BA E6 B8 C6 A4
B5 7E 73 74 75 76 77 78 79 7A A1 BF D0 DD DE AE
A2 A3 A5 B7 A9 A7 B6 BC BD BE AC 7C AF A8 B4 D7
7B 41 42 43 44 45 46 47 48 49 AD F4 F6 F2 F3 F5
7D 4A 4B 4C 4D 4E 4F 50 51 52 B9 FB FC F9 FA FF
5C F7 53 54 55 56 57 58 59 5A B2 D4 D6 D2 D3 D5
30 31 32 33 34 35 36 37 38 39 B3 DB DC D9 DA 9F

# Latin-1 to EBCDIC 500 translation table
#
# This translation being symmetric, the table is built from the previous one.
