Commit d21912b25c4a17aabb4d0b2f507f2bb9c85ed3a2
1 parent
feb4c610
Exists in
master
and in
3 other branches
Work in progress
Showing
4 changed files
with
188 additions
and
272 deletions
Show diff stats
charset.c
| @@ -36,173 +36,195 @@ | @@ -36,173 +36,195 @@ | ||
| 36 | 36 | ||
| 37 | #include "globals.h" | 37 | #include "globals.h" |
| 38 | 38 | ||
| 39 | +/* | ||
| 40 | + * EBCDIC-to-Unicode translation tables. | ||
| 41 | + * Each table maps EBCDIC codes X'41' through X'FE' to UCS-2. | ||
| 42 | + * Other codes are mapped programmatically. | ||
| 43 | + */ | ||
| 44 | +#define UT_SIZE 190 | ||
| 45 | +#define UT_OFFSET 0x41 | ||
| 46 | + | ||
| 47 | +typedef struct | ||
| 48 | +{ | ||
| 49 | + const char * name; | ||
| 50 | + const char * host_codepage; | ||
| 51 | + const char * cgcsgid; | ||
| 52 | + const char * display_charset; | ||
| 53 | + unsigned short code[UT_SIZE]; | ||
| 54 | +} charset_table; | ||
| 55 | + | ||
| 56 | + | ||
| 39 | /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ | 57 | /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ |
| 40 | 58 | ||
| 41 | - struct lib3270_charset lib3270_default_charset = | ||
| 42 | - { | ||
| 43 | - // const char * host; | ||
| 44 | - "bracket", | 59 | +const unsigned short ebc2asc0[256] = |
| 60 | +{ | ||
| 61 | + /*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 62 | + /*08*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 63 | + /*10*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 64 | + /*18*/ 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x3b, 0x20, | ||
| 65 | + /*20*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 66 | + /*28*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 67 | + /*30*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 68 | + /*38*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 69 | + /*40*/ 0x20, 0x20, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, | ||
| 70 | + /*48*/ 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, | ||
| 71 | + /*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, | ||
| 72 | + /*58*/ 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0xac, | ||
| 73 | + /*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, | ||
| 74 | + /*68*/ 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, | ||
| 75 | + /*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, | ||
| 76 | + /*78*/ 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, | ||
| 77 | + /*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | ||
| 78 | + /*88*/ 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, | ||
| 79 | + /*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, | ||
| 80 | + /*98*/ 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, | ||
| 81 | + /*a0*/ 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, | ||
| 82 | + /*a8*/ 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, | ||
| 83 | + /*b0*/ 0x5e, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, | ||
| 84 | + /*b8*/ 0xbd, 0xbe, 0x5b, 0x5d, 0xaf, 0xa8, 0xb4, 0xd7, | ||
| 85 | + /*c0*/ 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 86 | + /*c8*/ 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, | ||
| 87 | + /*d0*/ 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, | ||
| 88 | + /*d8*/ 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, | ||
| 89 | + /*e0*/ 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, | ||
| 90 | + /*e8*/ 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, | ||
| 91 | + /*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | ||
| 92 | + /*f8*/ 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x20 | ||
| 93 | +}; | ||
| 45 | 94 | ||
| 46 | - // char * display; | ||
| 47 | - "ISO-8859-1", | 95 | +static const unsigned short asc2ebc0[256] = |
| 96 | +{ | ||
| 97 | + /*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 98 | + /*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 99 | + /*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 100 | + /*18*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 101 | + /*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, | ||
| 102 | + /*28*/ 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, | ||
| 103 | + /*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, | ||
| 104 | + /*38*/ 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, | ||
| 105 | + /*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
| 106 | + /*48*/ 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, | ||
| 107 | + /*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, | ||
| 108 | + /*58*/ 0xe7, 0xe8, 0xe9, 0xba, 0xe0, 0xbb, 0xb0, 0x6d, | ||
| 109 | + /*60*/ 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, | ||
| 110 | + /*68*/ 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, | ||
| 111 | + /*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, | ||
| 112 | + /*78*/ 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x00, | ||
| 113 | + /*80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 114 | + /*88*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 115 | + /*90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 116 | + /*98*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 117 | + /*a0*/ 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, | ||
| 118 | + /*a8*/ 0xbd, 0xb4, 0x9a, 0x8a, 0x5f, 0xca, 0xaf, 0xbc, | ||
| 119 | + /*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, | ||
| 120 | + /*b8*/ 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, | ||
| 121 | + /*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, | ||
| 122 | + /*c8*/ 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, | ||
| 123 | + /*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, | ||
| 124 | + /*d8*/ 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xad, 0xae, 0x59, | ||
| 125 | + /*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, | ||
| 126 | + /*e8*/ 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, | ||
| 127 | + /*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, | ||
| 128 | + /*f8*/ 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf | ||
| 129 | +}; | ||
| 48 | 130 | ||
| 49 | - // Translation tables | ||
| 50 | - // unsigned short ebc2asc[256]; | ||
| 51 | - { | ||
| 52 | - /*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 53 | - /*08*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 54 | - /*10*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 55 | - /*18*/ 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x3b, 0x20, | ||
| 56 | - /*20*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 57 | - /*28*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 58 | - /*30*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 59 | - /*38*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 60 | - /*40*/ 0x20, 0x20, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, | ||
| 61 | - /*48*/ 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, | ||
| 62 | - /*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, | ||
| 63 | - /*58*/ 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0xac, | ||
| 64 | - /*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, | ||
| 65 | - /*68*/ 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, | ||
| 66 | - /*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, | ||
| 67 | - /*78*/ 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, | ||
| 68 | - /*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | ||
| 69 | - /*88*/ 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, | ||
| 70 | - /*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, | ||
| 71 | - /*98*/ 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, | ||
| 72 | - /*a0*/ 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, | ||
| 73 | - /*a8*/ 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, | ||
| 74 | - /*b0*/ 0x5e, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, | ||
| 75 | - /*b8*/ 0xbd, 0xbe, 0x5b, 0x5d, 0xaf, 0xa8, 0xb4, 0xd7, | ||
| 76 | - /*c0*/ 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 77 | - /*c8*/ 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, | ||
| 78 | - /*d0*/ 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, | ||
| 79 | - /*d8*/ 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, | ||
| 80 | - /*e0*/ 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, | ||
| 81 | - /*e8*/ 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, | ||
| 82 | - /*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | ||
| 83 | - /*f8*/ 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x20 | ||
| 84 | - }, | ||
| 85 | - | ||
| 86 | - // unsigned short asc2ebc[256]; | ||
| 87 | - { | ||
| 88 | - /*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 89 | - /*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 90 | - /*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 91 | - /*18*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 92 | - /*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, | ||
| 93 | - /*28*/ 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, | ||
| 94 | - /*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, | ||
| 95 | - /*38*/ 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, | ||
| 96 | - /*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
| 97 | - /*48*/ 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, | ||
| 98 | - /*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, | ||
| 99 | - /*58*/ 0xe7, 0xe8, 0xe9, 0xba, 0xe0, 0xbb, 0xb0, 0x6d, | ||
| 100 | - /*60*/ 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, | ||
| 101 | - /*68*/ 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, | ||
| 102 | - /*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, | ||
| 103 | - /*78*/ 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x00, | ||
| 104 | - /*80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 105 | - /*88*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 106 | - /*90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 107 | - /*98*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 108 | - /*a0*/ 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, | ||
| 109 | - /*a8*/ 0xbd, 0xb4, 0x9a, 0x8a, 0x5f, 0xca, 0xaf, 0xbc, | ||
| 110 | - /*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, | ||
| 111 | - /*b8*/ 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, | ||
| 112 | - /*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, | ||
| 113 | - /*c8*/ 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, | ||
| 114 | - /*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, | ||
| 115 | - /*d8*/ 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xad, 0xae, 0x59, | ||
| 116 | - /*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, | ||
| 117 | - /*e8*/ 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, | ||
| 118 | - /*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, | ||
| 119 | - /*f8*/ 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf | ||
| 120 | - }, | ||
| 121 | - | ||
| 122 | - // unsigned short asc2ft[256]; | ||
| 123 | - { | ||
| 124 | - 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, | ||
| 125 | - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, | ||
| 126 | - 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, | ||
| 127 | - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, | ||
| 128 | - 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, | ||
| 129 | - 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0xe2,0x5c,0xe3,0xd8,0x5f, | ||
| 130 | - 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, | ||
| 131 | - 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x5d,0x7d,0x7e,0x7f, | ||
| 132 | - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, | ||
| 133 | - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x00, | ||
| 134 | - 0xa0,0xd2,0x5b,0xd9,0xd0,0xda,0x7c,0xdd,0xe5,0xdc,0xcb,0xc4,0x5e,0xe8,0xd7,0xe4, | ||
| 135 | - 0xca,0xc9,0xf4,0xfa,0xe6,0xd1,0xde,0xdb,0xce,0xee,0xcc,0xc5,0xdf,0xe0,0xe1,0xd3, | ||
| 136 | - 0xb4,0xb5,0xb2,0xb6,0xb3,0xb7,0xcf,0xb8,0xbe,0xbb,0xbc,0xbd,0xc2,0xbf,0xc0,0xc1, | ||
| 137 | - 0xd4,0xb9,0xf7,0xf8,0xf5,0xf9,0xf6,0xe7,0xc3,0xfd,0xfe,0xfb,0xfc,0xd5,0xd6,0xb1, | ||
| 138 | - 0xa3,0xa4,0xa1,0xa5,0xa2,0xa6,0xcd,0xa7,0xac,0xa9,0xaa,0xab,0xb0,0xad,0xae,0xaf, | ||
| 139 | - 0xc6,0xa8,0xeb,0xec,0xe9,0xed,0xea,0x9f,0xba,0xf1,0xf2,0xef,0xf0,0xc7,0xc8,0xf3 | ||
| 140 | - }, | ||
| 141 | - | ||
| 142 | - // unsigned short ft2asc[256]; | ||
| 143 | - { | ||
| 144 | - 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, | ||
| 145 | - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, | ||
| 146 | - 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, | ||
| 147 | - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, | ||
| 148 | - 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, | ||
| 149 | - 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0xa2,0x5c,0x7c,0xac,0x5f, | ||
| 150 | - 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, | ||
| 151 | - 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0xa6,0x7d,0x7e,0x7f, | ||
| 152 | - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, | ||
| 153 | - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0xf7, | ||
| 154 | - 0xa0,0xe2,0xe4,0xe0,0xe1,0xe3,0xe5,0xe7,0xf1,0xe9,0xea,0xeb,0xe8,0xed,0xee,0xef, | ||
| 155 | - 0xec,0xdf,0xc2,0xc4,0xc0,0xc1,0xc3,0xc5,0xc7,0xd1,0xf8,0xc9,0xca,0xcb,0xc8,0xcd, | ||
| 156 | - 0xce,0xcf,0xcc,0xd8,0xab,0xbb,0xf0,0xfd,0xfe,0xb1,0xb0,0xaa,0xba,0xe6,0xb8,0xc6, | ||
| 157 | - 0xa4,0xb5,0xa1,0xbf,0xd0,0xdd,0xde,0xae,0x5e,0xa3,0xa5,0xb7,0xa9,0xa7,0xb6,0xbc, | ||
| 158 | - 0xbd,0xbe,0x5b,0x5d,0xaf,0xa8,0xb4,0xd7,0xad,0xf4,0xf6,0xf2,0xf3,0xf5,0xb9,0xfb, | ||
| 159 | - 0xfc,0xf9,0xfa,0xff,0xb2,0xd4,0xd6,0xd2,0xd3,0xd5,0xb3,0xdb,0xdc,0xd9,0xda,0xff | ||
| 160 | - }, | ||
| 161 | - | ||
| 162 | - // unsigned short asc2uc[256]; | ||
| 163 | - { | ||
| 164 | - /*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
| 165 | - /*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | ||
| 166 | - /*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | ||
| 167 | - /*18*/ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | ||
| 168 | - /*20*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, | ||
| 169 | - /*28*/ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | ||
| 170 | - /*30*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | ||
| 171 | - /*38*/ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | ||
| 172 | - /*40*/ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 173 | - /*48*/ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | ||
| 174 | - /*50*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, | ||
| 175 | - /*58*/ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | ||
| 176 | - /*60*/ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 177 | - /*68*/ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | ||
| 178 | - /*70*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, | ||
| 179 | - /*78*/ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | ||
| 180 | - /*80*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, | ||
| 181 | - /*88*/ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | ||
| 182 | - /*90*/ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, | ||
| 183 | - /*98*/ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | ||
| 184 | - /*a0*/ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, | ||
| 185 | - /*a8*/ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | ||
| 186 | - /*b0*/ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, | ||
| 187 | - /*b8*/ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | ||
| 188 | - /*c0*/ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
| 189 | - /*c8*/ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | ||
| 190 | - /*d0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, | ||
| 191 | - /*d8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | ||
| 192 | - /*e0*/ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
| 193 | - /*e8*/ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | ||
| 194 | - /*f0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, | ||
| 195 | - /*f8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff | ||
| 196 | - } | 131 | +static const unsigned short ft2asc[256] = |
| 132 | +{ | ||
| 133 | + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, | ||
| 134 | + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, | ||
| 135 | + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, | ||
| 136 | + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, | ||
| 137 | + 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, | ||
| 138 | + 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0xa2,0x5c,0x7c,0xac,0x5f, | ||
| 139 | + 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, | ||
| 140 | + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0xa6,0x7d,0x7e,0x7f, | ||
| 141 | + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, | ||
| 142 | + 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0xf7, | ||
| 143 | + 0xa0,0xe2,0xe4,0xe0,0xe1,0xe3,0xe5,0xe7,0xf1,0xe9,0xea,0xeb,0xe8,0xed,0xee,0xef, | ||
| 144 | + 0xec,0xdf,0xc2,0xc4,0xc0,0xc1,0xc3,0xc5,0xc7,0xd1,0xf8,0xc9,0xca,0xcb,0xc8,0xcd, | ||
| 145 | + 0xce,0xcf,0xcc,0xd8,0xab,0xbb,0xf0,0xfd,0xfe,0xb1,0xb0,0xaa,0xba,0xe6,0xb8,0xc6, | ||
| 146 | + 0xa4,0xb5,0xa1,0xbf,0xd0,0xdd,0xde,0xae,0x5e,0xa3,0xa5,0xb7,0xa9,0xa7,0xb6,0xbc, | ||
| 147 | + 0xbd,0xbe,0x5b,0x5d,0xaf,0xa8,0xb4,0xd7,0xad,0xf4,0xf6,0xf2,0xf3,0xf5,0xb9,0xfb, | ||
| 148 | + 0xfc,0xf9,0xfa,0xff,0xb2,0xd4,0xd6,0xd2,0xd3,0xd5,0xb3,0xdb,0xdc,0xd9,0xda,0xff | ||
| 149 | +}; | ||
| 197 | 150 | ||
| 198 | - }; | 151 | +const unsigned short asc2ft[256] = |
| 152 | +{ | ||
| 153 | + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, | ||
| 154 | + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, | ||
| 155 | + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, | ||
| 156 | + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, | ||
| 157 | + 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, | ||
| 158 | + 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0xe2,0x5c,0xe3,0xd8,0x5f, | ||
| 159 | + 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, | ||
| 160 | + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x5d,0x7d,0x7e,0x7f, | ||
| 161 | + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, | ||
| 162 | + 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x00, | ||
| 163 | + 0xa0,0xd2,0x5b,0xd9,0xd0,0xda,0x7c,0xdd,0xe5,0xdc,0xcb,0xc4,0x5e,0xe8,0xd7,0xe4, | ||
| 164 | + 0xca,0xc9,0xf4,0xfa,0xe6,0xd1,0xde,0xdb,0xce,0xee,0xcc,0xc5,0xdf,0xe0,0xe1,0xd3, | ||
| 165 | + 0xb4,0xb5,0xb2,0xb6,0xb3,0xb7,0xcf,0xb8,0xbe,0xbb,0xbc,0xbd,0xc2,0xbf,0xc0,0xc1, | ||
| 166 | + 0xd4,0xb9,0xf7,0xf8,0xf5,0xf9,0xf6,0xe7,0xc3,0xfd,0xfe,0xfb,0xfc,0xd5,0xd6,0xb1, | ||
| 167 | + 0xa3,0xa4,0xa1,0xa5,0xa2,0xa6,0xcd,0xa7,0xac,0xa9,0xaa,0xab,0xb0,0xad,0xae,0xaf, | ||
| 168 | + 0xc6,0xa8,0xeb,0xec,0xe9,0xed,0xea,0x9f,0xba,0xf1,0xf2,0xef,0xf0,0xc7,0xc8,0xf3 | ||
| 169 | +}; | ||
| 170 | + | ||
| 171 | +static const unsigned short asc2uc[UT_SIZE] = | ||
| 172 | +{ | ||
| 173 | + /*40*/ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 174 | + /*48*/ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | ||
| 175 | + /*50*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, | ||
| 176 | + /*58*/ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | ||
| 177 | + /*60*/ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 178 | + /*68*/ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | ||
| 179 | + /*70*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, | ||
| 180 | + /*78*/ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | ||
| 181 | + /*80*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, | ||
| 182 | + /*88*/ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | ||
| 183 | + /*90*/ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, | ||
| 184 | + /*98*/ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | ||
| 185 | + /*a0*/ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, | ||
| 186 | + /*a8*/ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | ||
| 187 | + /*b0*/ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, | ||
| 188 | + /*b8*/ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | ||
| 189 | + /*c0*/ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
| 190 | + /*c8*/ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | ||
| 191 | + /*d0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, | ||
| 192 | + /*d8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | ||
| 193 | + /*e0*/ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
| 194 | + /*e8*/ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | ||
| 195 | + /*f0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, | ||
| 196 | + /*f8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde | ||
| 197 | +}; | ||
| 199 | 198 | ||
| 200 | 199 | ||
| 201 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ | 200 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ |
| 202 | 201 | ||
| 203 | -LIB3270_EXPORT struct lib3270_charset * lib3270_load_default_charset(H3270 *hSession) | 202 | +static void copy_charset(const unsigned short *from, unsigned short *to) |
| 203 | +{ | ||
| 204 | + int f; | ||
| 205 | + for(f=0;f < UT_SIZE;f++) | ||
| 206 | + to[f+UT_OFFSET] = from[f]; | ||
| 207 | +} | ||
| 208 | + | ||
| 209 | +LIB3270_EXPORT struct lib3270_charset * lib3270_load_charset(H3270 *hSession, const char *name) | ||
| 204 | { | 210 | { |
| 205 | - memcpy(&hSession->charset,&lib3270_default_charset,sizeof(struct lib3270_charset)); | 211 | + int f; |
| 212 | + | ||
| 213 | + hSession->charset.host = "bracket"; | ||
| 214 | + hSession->charset.display = "ISO-8859-1"; | ||
| 215 | + | ||
| 216 | + memcpy(hSession->charset.ebc2asc, ebc2asc0, sizeof(hSession->charset.ebc2asc)); | ||
| 217 | + memcpy(hSession->charset.asc2ebc, asc2ebc0, sizeof(hSession->charset.asc2ebc)); | ||
| 218 | + | ||
| 219 | + for(f=0;f<UT_OFFSET;f++) | ||
| 220 | + hSession->charset.asc2uc[f] = f; | ||
| 221 | + copy_charset(asc2uc,hSession->charset.asc2uc); | ||
| 222 | + | ||
| 223 | +#if defined(X3270_FT) | ||
| 224 | + memcpy(hSession->charset.ft2asc, ft2asc, sizeof(hSession->charset.ft2asc)); | ||
| 225 | + memcpy(hSession->charset.asc2ft, asc2ft, sizeof(hSession->charset.asc2ft)); | ||
| 226 | +#endif | ||
| 227 | + | ||
| 206 | return &hSession->charset; | 228 | return &hSession->charset; |
| 207 | } | 229 | } |
| 208 | 230 | ||
| @@ -218,7 +240,7 @@ LIB3270_EXPORT const char * lib3270_get_charset(H3270 *hSession) | @@ -218,7 +240,7 @@ LIB3270_EXPORT const char * lib3270_get_charset(H3270 *hSession) | ||
| 218 | return hSession->charset.display ? hSession->charset.display : "ISO-8859-1"; | 240 | return hSession->charset.display ? hSession->charset.display : "ISO-8859-1"; |
| 219 | } | 241 | } |
| 220 | 242 | ||
| 221 | -/* | 243 | +/*ISO-8859-1 |
| 222 | 244 | ||
| 223 | #include "resources.h" | 245 | #include "resources.h" |
| 224 | // #include "appres.h" | 246 | // #include "appres.h" |
charset.h
| @@ -35,6 +35,6 @@ | @@ -35,6 +35,6 @@ | ||
| 35 | 35 | ||
| 36 | const struct lib3270_charset lib3270_default_charset; | 36 | const struct lib3270_charset lib3270_default_charset; |
| 37 | 37 | ||
| 38 | - LIB3270_EXPORT struct lib3270_charset * lib3270_load_default_charset(H3270 *hSession); | 38 | + LIB3270_EXPORT struct lib3270_charset * lib3270_load_charset(H3270 *hSession, const char *name); |
| 39 | 39 | ||
| 40 | #endif // LIB3270_CHARSET_H_INCLUDED | 40 | #endif // LIB3270_CHARSET_H_INCLUDED |
session.c
| @@ -187,8 +187,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -187,8 +187,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
| 187 | memset(hSession,0,sizeof(H3270)); | 187 | memset(hSession,0,sizeof(H3270)); |
| 188 | hSession->sz = sizeof(H3270); | 188 | hSession->sz = sizeof(H3270); |
| 189 | 189 | ||
| 190 | - lib3270_load_default_charset(hSession); | ||
| 191 | -// initialize_tables(hSession); | 190 | + lib3270_load_charset(hSession,NULL); |
| 192 | 191 | ||
| 193 | // Default calls | 192 | // Default calls |
| 194 | hSession->write = lib3270_sock_send; | 193 | hSession->write = lib3270_sock_send; |
tables.c
| @@ -182,41 +182,6 @@ static const unsigned short cg2ebc0[256] = { | @@ -182,41 +182,6 @@ static const unsigned short cg2ebc0[256] = { | ||
| 182 | /*f8*/ 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 182 | /*f8*/ 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
| 183 | }; | 183 | }; |
| 184 | 184 | ||
| 185 | -const unsigned short ebc2asc0[256] = { | ||
| 186 | -/*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 187 | -/*08*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 188 | -/*10*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 189 | -/*18*/ 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x3b, 0x20, | ||
| 190 | -/*20*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 191 | -/*28*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 192 | -/*30*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 193 | -/*38*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 194 | -/*40*/ 0x20, 0x20, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, | ||
| 195 | -/*48*/ 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, | ||
| 196 | -/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, | ||
| 197 | -/*58*/ 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0xac, | ||
| 198 | -/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, | ||
| 199 | -/*68*/ 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, | ||
| 200 | -/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, | ||
| 201 | -/*78*/ 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, | ||
| 202 | -/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | ||
| 203 | -/*88*/ 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, | ||
| 204 | -/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, | ||
| 205 | -/*98*/ 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, | ||
| 206 | -/*a0*/ 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, | ||
| 207 | -/*a8*/ 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, | ||
| 208 | -/*b0*/ 0x5e, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, | ||
| 209 | -/*b8*/ 0xbd, 0xbe, 0x5b, 0x5d, 0xaf, 0xa8, 0xb4, 0xd7, | ||
| 210 | -/*c0*/ 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 211 | -/*c8*/ 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, | ||
| 212 | -/*d0*/ 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, | ||
| 213 | -/*d8*/ 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, | ||
| 214 | -/*e0*/ 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, | ||
| 215 | -/*e8*/ 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, | ||
| 216 | -/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | ||
| 217 | -/*f8*/ 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x20 | ||
| 218 | -}; | ||
| 219 | - | ||
| 220 | #ifdef EXTENDED_TABLES | 185 | #ifdef EXTENDED_TABLES |
| 221 | static const unsigned short ebc2asc70[256] = { | 186 | static const unsigned short ebc2asc70[256] = { |
| 222 | /*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | 187 | /*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, |
| @@ -326,41 +291,6 @@ static const unsigned short ge2asc[256] = { | @@ -326,41 +291,6 @@ static const unsigned short ge2asc[256] = { | ||
| 326 | }; | 291 | }; |
| 327 | #endif // EXTENDED_TABLES | 292 | #endif // EXTENDED_TABLES |
| 328 | 293 | ||
| 329 | -static const unsigned short asc2uc[256] = { | ||
| 330 | -/*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
| 331 | -/*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | ||
| 332 | -/*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | ||
| 333 | -/*18*/ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | ||
| 334 | -/*20*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, | ||
| 335 | -/*28*/ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | ||
| 336 | -/*30*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | ||
| 337 | -/*38*/ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | ||
| 338 | -/*40*/ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 339 | -/*48*/ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | ||
| 340 | -/*50*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, | ||
| 341 | -/*58*/ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | ||
| 342 | -/*60*/ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 343 | -/*68*/ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | ||
| 344 | -/*70*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, | ||
| 345 | -/*78*/ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | ||
| 346 | -/*80*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, | ||
| 347 | -/*88*/ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | ||
| 348 | -/*90*/ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, | ||
| 349 | -/*98*/ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | ||
| 350 | -/*a0*/ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, | ||
| 351 | -/*a8*/ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | ||
| 352 | -/*b0*/ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, | ||
| 353 | -/*b8*/ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | ||
| 354 | -/*c0*/ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
| 355 | -/*c8*/ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | ||
| 356 | -/*d0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, | ||
| 357 | -/*d8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | ||
| 358 | -/*e0*/ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
| 359 | -/*e8*/ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | ||
| 360 | -/*f0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, | ||
| 361 | -/*f8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff | ||
| 362 | -}; | ||
| 363 | - | ||
| 364 | static const unsigned short ebc2uc[256] = { | 294 | static const unsigned short ebc2uc[256] = { |
| 365 | /*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | 295 | /*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 366 | /*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | 296 | /*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| @@ -397,44 +327,6 @@ static const unsigned short ebc2uc[256] = { | @@ -397,44 +327,6 @@ static const unsigned short ebc2uc[256] = { | ||
| 397 | }; | 327 | }; |
| 398 | #if defined(X3270_FT) /*[*/ | 328 | #if defined(X3270_FT) /*[*/ |
| 399 | 329 | ||
| 400 | -static const unsigned short ft2asc0[256] = { | ||
| 401 | -0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, | ||
| 402 | -0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, | ||
| 403 | -0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, | ||
| 404 | -0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, | ||
| 405 | -0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, | ||
| 406 | -0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0xa2,0x5c,0x7c,0xac,0x5f, | ||
| 407 | -0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, | ||
| 408 | -0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0xa6,0x7d,0x7e,0x7f, | ||
| 409 | -0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, | ||
| 410 | -0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0xf7, | ||
| 411 | -0xa0,0xe2,0xe4,0xe0,0xe1,0xe3,0xe5,0xe7,0xf1,0xe9,0xea,0xeb,0xe8,0xed,0xee,0xef, | ||
| 412 | -0xec,0xdf,0xc2,0xc4,0xc0,0xc1,0xc3,0xc5,0xc7,0xd1,0xf8,0xc9,0xca,0xcb,0xc8,0xcd, | ||
| 413 | -0xce,0xcf,0xcc,0xd8,0xab,0xbb,0xf0,0xfd,0xfe,0xb1,0xb0,0xaa,0xba,0xe6,0xb8,0xc6, | ||
| 414 | -0xa4,0xb5,0xa1,0xbf,0xd0,0xdd,0xde,0xae,0x5e,0xa3,0xa5,0xb7,0xa9,0xa7,0xb6,0xbc, | ||
| 415 | -0xbd,0xbe,0x5b,0x5d,0xaf,0xa8,0xb4,0xd7,0xad,0xf4,0xf6,0xf2,0xf3,0xf5,0xb9,0xfb, | ||
| 416 | -0xfc,0xf9,0xfa,0xff,0xb2,0xd4,0xd6,0xd2,0xd3,0xd5,0xb3,0xdb,0xdc,0xd9,0xda,0xff | ||
| 417 | -}; | ||
| 418 | - | ||
| 419 | -const unsigned short asc2ft0[256] = { | ||
| 420 | -0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, | ||
| 421 | -0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, | ||
| 422 | -0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, | ||
| 423 | -0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, | ||
| 424 | -0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, | ||
| 425 | -0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0xe2,0x5c,0xe3,0xd8,0x5f, | ||
| 426 | -0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, | ||
| 427 | -0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x5d,0x7d,0x7e,0x7f, | ||
| 428 | -0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, | ||
| 429 | -0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x00, | ||
| 430 | -0xa0,0xd2,0x5b,0xd9,0xd0,0xda,0x7c,0xdd,0xe5,0xdc,0xcb,0xc4,0x5e,0xe8,0xd7,0xe4, | ||
| 431 | -0xca,0xc9,0xf4,0xfa,0xe6,0xd1,0xde,0xdb,0xce,0xee,0xcc,0xc5,0xdf,0xe0,0xe1,0xd3, | ||
| 432 | -0xb4,0xb5,0xb2,0xb6,0xb3,0xb7,0xcf,0xb8,0xbe,0xbb,0xbc,0xbd,0xc2,0xbf,0xc0,0xc1, | ||
| 433 | -0xd4,0xb9,0xf7,0xf8,0xf5,0xf9,0xf6,0xe7,0xc3,0xfd,0xfe,0xfb,0xfc,0xd5,0xd6,0xb1, | ||
| 434 | -0xa3,0xa4,0xa1,0xa5,0xa2,0xa6,0xcd,0xa7,0xac,0xa9,0xaa,0xab,0xb0,0xad,0xae,0xaf, | ||
| 435 | -0xc6,0xa8,0xeb,0xec,0xe9,0xed,0xea,0x9f,0xba,0xf1,0xf2,0xef,0xf0,0xc7,0xc8,0xf3 | ||
| 436 | -}; | ||
| 437 | - | ||
| 438 | #endif /*]*/ | 330 | #endif /*]*/ |
| 439 | 331 | ||
| 440 | //unsigned short ebc2cg[256]; | 332 | //unsigned short ebc2cg[256]; |
| @@ -447,9 +339,11 @@ const unsigned short asc2ft0[256] = { | @@ -447,9 +339,11 @@ const unsigned short asc2ft0[256] = { | ||
| 447 | #ifdef EXTENDED_TABLES | 339 | #ifdef EXTENDED_TABLES |
| 448 | unsigned short ebc2asc7[256]; | 340 | unsigned short ebc2asc7[256]; |
| 449 | #endif //EXTENDED_TABLES | 341 | #endif //EXTENDED_TABLES |
| 342 | + | ||
| 343 | +/* | ||
| 450 | LIB3270_INTERNAL void initialize_tables(H3270 *hSession) | 344 | LIB3270_INTERNAL void initialize_tables(H3270 *hSession) |
| 451 | { | 345 | { |
| 452 | - /* Go to defaults first. */ | 346 | + // Go to defaults first. |
| 453 | memcpy(hSession->charset.ebc2asc, ebc2asc0, sizeof(hSession->charset.ebc2asc)); | 347 | memcpy(hSession->charset.ebc2asc, ebc2asc0, sizeof(hSession->charset.ebc2asc)); |
| 454 | memcpy(hSession->charset.asc2ebc, asc2ebc0, sizeof(hSession->charset.asc2ebc)); | 348 | memcpy(hSession->charset.asc2ebc, asc2ebc0, sizeof(hSession->charset.asc2ebc)); |
| 455 | memcpy(hSession->charset.asc2uc, asc2uc, sizeof(hSession->charset.asc2uc)); | 349 | memcpy(hSession->charset.asc2uc, asc2uc, sizeof(hSession->charset.asc2uc)); |
| @@ -464,12 +358,13 @@ LIB3270_INTERNAL void initialize_tables(H3270 *hSession) | @@ -464,12 +358,13 @@ LIB3270_INTERNAL void initialize_tables(H3270 *hSession) | ||
| 464 | memcpy(ebc2asc7, ebc2asc70, sizeof(ebc2asc7)); | 358 | memcpy(ebc2asc7, ebc2asc70, sizeof(ebc2asc7)); |
| 465 | #endif // EXTENDED_TABLES | 359 | #endif // EXTENDED_TABLES |
| 466 | 360 | ||
| 467 | -#if defined(X3270_FT) /*[*/ | 361 | +#if defined(X3270_FT) |
| 468 | memcpy(hSession->charset.ft2asc, ft2asc0, sizeof(hSession->charset.ft2asc)); | 362 | memcpy(hSession->charset.ft2asc, ft2asc0, sizeof(hSession->charset.ft2asc)); |
| 469 | memcpy(hSession->charset.asc2ft, asc2ft0, sizeof(hSession->charset.asc2ft)); | 363 | memcpy(hSession->charset.asc2ft, asc2ft0, sizeof(hSession->charset.asc2ft)); |
| 470 | -#endif /*]*/ | 364 | +#endif |
| 471 | 365 | ||
| 472 | } | 366 | } |
| 367 | +*/ | ||
| 473 | 368 | ||
| 474 | /* | 369 | /* |
| 475 | void charset_defaults(H3270 *hSession) | 370 | void charset_defaults(H3270 *hSession) |