Skip to content

Commit 59b4d2b

Browse files
committed
Optimize the EBCDIC table sizes.
* lib/converters.h (DEDUPLICATE_TABLES): New macro. * lib/ebcdic1025.h: Deduplicate tables with ebcdic880.h. * lib/ebcdic1123.h: Deduplicate tables with ebcdic1025.h. * lib/ebcdic1132.h: Deduplicate tables with ebcdic838.h. * lib/ebcdic1153.h: Deduplicate tables with ebcdic870.h. * lib/ebcdic1154.h: Deduplicate tables with ebcdic880.h. * lib/ebcdic1155.h: Deduplicate tables with ebcdic1026.h. * lib/ebcdic1156.h: Deduplicate tables with ebcdic1112.h. * lib/ebcdic1157.h: Deduplicate tables with ebcdic1122.h. * lib/ebcdic1158.h: Deduplicate tables with ebcdic1154.h, ebcdic1123.h. * lib/ebcdic1160.h: Deduplicate tables with ebcdic838.h. * lib/ebcdic1164.h: Deduplicate tables with ebcdic1130.h. * lib/ebcdic1165.h: Deduplicate tables with ebcdic870.h. * lib/ebcdic1166.h: Deduplicate tables with ebcdic1154.h. * lib/ebcdic4971.h: Deduplicate tables with ebcdic875.h. * lib/ebcdic12712.h: Deduplicate tables with ebcdic424.h.
1 parent 68ac8a9 commit 59b4d2b

17 files changed

+101
-0
lines changed

ChangeLog

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2022-01-23 Bruno Haible <bruno@clisp.org>
2+
3+
Optimize the EBCDIC table sizes.
4+
* lib/converters.h (DEDUPLICATE_TABLES): New macro.
5+
* lib/ebcdic1025.h: Deduplicate tables with ebcdic880.h.
6+
* lib/ebcdic1123.h: Deduplicate tables with ebcdic1025.h.
7+
* lib/ebcdic1132.h: Deduplicate tables with ebcdic838.h.
8+
* lib/ebcdic1153.h: Deduplicate tables with ebcdic870.h.
9+
* lib/ebcdic1154.h: Deduplicate tables with ebcdic880.h.
10+
* lib/ebcdic1155.h: Deduplicate tables with ebcdic1026.h.
11+
* lib/ebcdic1156.h: Deduplicate tables with ebcdic1112.h.
12+
* lib/ebcdic1157.h: Deduplicate tables with ebcdic1122.h.
13+
* lib/ebcdic1158.h: Deduplicate tables with ebcdic1154.h, ebcdic1123.h.
14+
* lib/ebcdic1160.h: Deduplicate tables with ebcdic838.h.
15+
* lib/ebcdic1164.h: Deduplicate tables with ebcdic1130.h.
16+
* lib/ebcdic1165.h: Deduplicate tables with ebcdic870.h.
17+
* lib/ebcdic1166.h: Deduplicate tables with ebcdic1154.h.
18+
* lib/ebcdic4971.h: Deduplicate tables with ebcdic875.h.
19+
* lib/ebcdic12712.h: Deduplicate tables with ebcdic424.h.
20+
121
2022-01-23 Bruno Haible <bruno@clisp.org>
222

323
New EBCDIC encodings.

lib/converters.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ typedef struct {
291291
#endif
292292

293293
#ifdef USE_ZOS
294+
#define DEDUPLICATE_TABLES 1
294295
#include "ebcdic037.h"
295296
#include "ebcdic273.h"
296297
#include "ebcdic277.h"

lib/ebcdic1025.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ static const unsigned char ebcdic1025_page00[176] = {
104104
0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, /* 0xa0-0xa7 */
105105
0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, /* 0xa8-0xaf */
106106
};
107+
#if DEDUPLICATE_TABLES
108+
#define ebcdic1025_page04 ebcdic880_page04
109+
#else /* Unoptimized */
107110
static const unsigned char ebcdic1025_page04[96] = {
108111
0x00, 0x63, 0x59, 0x62, 0x64, 0x65, 0x66, 0x67, /* 0x00-0x07 */
109112
0x68, 0x69, 0x70, 0x71, 0x72, 0x00, 0x74, 0x75, /* 0x08-0x0f */
@@ -118,6 +121,7 @@ static const unsigned char ebcdic1025_page04[96] = {
118121
0x00, 0x44, 0x42, 0x43, 0x45, 0x46, 0x47, 0x48, /* 0x50-0x57 */
119122
0x49, 0x51, 0x52, 0x53, 0x54, 0x00, 0x55, 0x56, /* 0x58-0x5f */
120123
};
124+
#endif
121125

122126
static int
123127
ebcdic1025_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)

lib/ebcdic1123.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ ebcdic1123_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
8080
return 1;
8181
}
8282

83+
#if DEDUPLICATE_TABLES
84+
#define ebcdic1123_page00 ebcdic1025_page00
85+
#else /* Unoptimized */
8386
static const unsigned char ebcdic1123_page00[176] = {
8487
0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 0x00-0x07 */
8588
0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -104,6 +107,7 @@ static const unsigned char ebcdic1123_page00[176] = {
104107
0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, /* 0xa0-0xa7 */
105108
0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, /* 0xa8-0xaf */
106109
};
110+
#endif
107111
static const unsigned char ebcdic1123_page04[152] = {
108112
0x00, 0x63, 0x59, 0x00, 0x64, 0x65, 0x66, 0x67, /* 0x00-0x07 */
109113
0x68, 0x69, 0x70, 0x71, 0x72, 0x00, 0x74, 0x75, /* 0x08-0x0f */

lib/ebcdic1132.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ ebcdic1132_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
8484
return RET_ILSEQ;
8585
}
8686

87+
#if DEDUPLICATE_TABLES
88+
#define ebcdic1132_page00 ebcdic838_page00
89+
#else /* Unoptimized */
8790
static const unsigned char ebcdic1132_page00[176] = {
8891
0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 0x00-0x07 */
8992
0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -108,6 +111,7 @@ static const unsigned char ebcdic1132_page00[176] = {
108111
0x41, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x6a, 0x00, /* 0xa0-0xa7 */
109112
0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
110113
};
114+
#endif
111115
static const unsigned char ebcdic1132_page0e[96] = {
112116
0x00, 0x42, 0x43, 0x00, 0x44, 0x00, 0x00, 0x45, /* 0x80-0x87 */
113117
0x46, 0x00, 0x48, 0x00, 0x00, 0x52, 0x00, 0x00, /* 0x88-0x8f */

lib/ebcdic1153.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,16 @@ static const unsigned char ebcdic1153_page00[384] = {
131131
0xfb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
132132
0x00, 0xb9, 0xb7, 0xb4, 0xb2, 0xb8, 0xb6, 0x00, /* 0x78-0x7f */
133133
};
134+
#if DEDUPLICATE_TABLES
135+
#define ebcdic1153_page02 ebcdic870_page02
136+
#else /* Unoptimized */
134137
static const unsigned char ebcdic1153_page02[32] = {
135138
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, /* 0xc0-0xc7 */
136139
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
137140
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
138141
0x80, 0xb0, 0x00, 0x9e, 0x00, 0x64, 0x00, 0x00, /* 0xd8-0xdf */
139142
};
143+
#endif
140144

141145
static int
142146
ebcdic1153_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)

lib/ebcdic1154.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ static const unsigned char ebcdic1154_page00[176] = {
104104
0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
105105
0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, /* 0xa8-0xaf */
106106
};
107+
#if DEDUPLICATE_TABLES
108+
#define ebcdic1154_page04 ebcdic880_page04
109+
#else /* Unoptimized */
107110
static const unsigned char ebcdic1154_page04[96] = {
108111
0x00, 0x63, 0x59, 0x62, 0x64, 0x65, 0x66, 0x67, /* 0x00-0x07 */
109112
0x68, 0x69, 0x70, 0x71, 0x72, 0x00, 0x74, 0x75, /* 0x08-0x0f */
@@ -118,6 +121,7 @@ static const unsigned char ebcdic1154_page04[96] = {
118121
0x00, 0x44, 0x42, 0x43, 0x45, 0x46, 0x47, 0x48, /* 0x50-0x57 */
119122
0x49, 0x51, 0x52, 0x53, 0x54, 0x00, 0x55, 0x56, /* 0x58-0x5f */
120123
};
124+
#endif
121125

122126
static int
123127
ebcdic1154_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)

lib/ebcdic1155.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ static const unsigned char ebcdic1155_page00[256] = {
114114
0x00, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xa1, 0xe1, /* 0xf0-0xf7 */
115115
0x70, 0xdd, 0xde, 0xdb, 0xe0, 0x00, 0x00, 0xdf, /* 0xf8-0xff */
116116
};
117+
#if DEDUPLICATE_TABLES
118+
#define ebcdic1155_page01 ebcdic1026_page01
119+
#else /* Unoptimized */
117120
static const unsigned char ebcdic1155_page01[72] = {
118121
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xd0, /* 0x18-0x1f */
119122
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
@@ -125,6 +128,7 @@ static const unsigned char ebcdic1155_page01[72] = {
125128
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
126129
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x6a, /* 0x58-0x5f */
127130
};
131+
#endif
128132

129133
static int
130134
ebcdic1155_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)

lib/ebcdic1156.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,13 @@ static const unsigned char ebcdic1156_page00[384] = {
131131
0x00, 0x00, 0x75, 0x55, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
132132
0x00, 0xbc, 0xab, 0xad, 0x8d, 0x69, 0x49, 0x00, /* 0x78-0x7f */
133133
};
134+
#if DEDUPLICATE_TABLES
135+
#define ebcdic1156_page20 ebcdic1112_page20
136+
#else /* Unoptimized */
134137
static const unsigned char ebcdic1156_page20[8] = {
135138
0x00, 0xdf, 0x00, 0x00, 0x57, 0xaa, 0x56, 0x00, /* 0x18-0x1f */
136139
};
140+
#endif
137141

138142
static int
139143
ebcdic1156_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)

lib/ebcdic1157.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,16 @@ static const unsigned char ebcdic1157_page00[256] = {
114114
0x00, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0x6a, 0xe1, /* 0xf0-0xf7 */
115115
0x70, 0xdd, 0xde, 0xdb, 0xa1, 0x8d, 0x00, 0xdf, /* 0xf8-0xff */
116116
};
117+
#if DEDUPLICATE_TABLES
118+
#define ebcdic1157_page01 ebcdic1122_page01
119+
#else /* Unoptimized */
117120
static const unsigned char ebcdic1157_page01[32] = {
118121
0xac, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
119122
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
120123
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
121124
0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x8e, 0x00, /* 0x78-0x7f */
122125
};
126+
#endif
123127

124128
static int
125129
ebcdic1157_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)

0 commit comments

Comments
 (0)