From 85deef3a3864a212db089a1ec6608a968feec997 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Tue, 5 Nov 2024 11:03:03 +0000 Subject: [PATCH 1/2] fix: change identifiers for files --- cobj/tree.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cobj/tree.c b/cobj/tree.c index 16f0b64d..4986c90d 100644 --- a/cobj/tree.c +++ b/cobj/tree.c @@ -124,8 +124,13 @@ static char *to_cname(const char *s) { unsigned char *p; copy = strdup(s); - for (p = (unsigned char *)copy; *p; p++) { - *p = (*p == '-') ? '_' : (unsigned char)toupper(*p); + for (p = (unsigned char *)copy; *p;) { + if ((0x81 <= *p && *p <= 0x9F) || (0xE0 <= *p && *p <= 0xFC)) { + p += 2; + } else { + *p = (*p == '-') ? '_' : (unsigned char)toupper(*p); + p++; + } } return copy; } From 328cbd5e851477aa6829b8d7f08d4ef2c4a18248 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Tue, 5 Nov 2024 11:13:07 +0000 Subject: [PATCH 2/2] test: add a new test --- tests/Makefile.am | 3 ++- tests/Makefile.in | 3 ++- tests/misc.at | 1 + tests/misc.src/file-handler-japanese.at | 25 +++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tests/misc.src/file-handler-japanese.at diff --git a/tests/Makefile.am b/tests/Makefile.am index 65d1107d..9841b799 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -219,7 +219,8 @@ misc_DEPENDENCIES = \ misc.src/read_prev_after_start.at \ misc.src/japanese-char-section-var.at \ misc.src/evaluate-switch.at \ - misc.src/fserial-variable.at + misc.src/fserial-variable.at \ + misc.src/file-handler-japanese.at EXTRA_DIST = $(srcdir)/package.m4 \ $(TESTS) \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 49b5575a..dad91307 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -758,7 +758,8 @@ misc_DEPENDENCIES = \ misc.src/read_prev_after_start.at \ misc.src/japanese-char-section-var.at \ misc.src/evaluate-switch.at \ - misc.src/fserial-variable.at + misc.src/fserial-variable.at \ + misc.src/file-handler-japanese.at EXTRA_DIST = $(srcdir)/package.m4 \ $(TESTS) \ diff --git a/tests/misc.at b/tests/misc.at index 1a98d9e8..7f8a6157 100644 --- a/tests/misc.at +++ b/tests/misc.at @@ -49,3 +49,4 @@ m4_include([read_prev_after_start.at]) m4_include([japanese-char-section-var.at]) m4_include([evaluate-switch.at]) m4_include([fserial-variable.at]) +m4_include([file-handler-japanese.at]) diff --git a/tests/misc.src/file-handler-japanese.at b/tests/misc.src/file-handler-japanese.at new file mode 100644 index 00000000..6815c776 --- /dev/null +++ b/tests/misc.src/file-handler-japanese.at @@ -0,0 +1,25 @@ +AT_SETUP([file-handler-japanese]) + +# This test verifies that Issue 539 is fixed. + +AT_DATA([prog.cbl], [ + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + INPUT-OUTPUT SECTION. + FILE-CONTROL. + SELECT テストファイル + ORGANIZATION IS SEQUENTIAL. + DATA DIVISION. + FILE SECTION. + FD テストファイル. + 01 REC PIC X(10). + PROCEDURE DIVISION. + STOP RUN. +]) + +AT_CHECK([${COBJ} prog.cbl]) +AT_CHECK([grep 'h_テストファイル' prog.java > /dev/null]) +AT_CHECK([grep 'h_ウスエサァイル' prog.java], [1]) + +AT_CLEANUP \ No newline at end of file