Skip to content

Commit 7f0205e

Browse files
[Remove]: remove a option -fvar-name-hex
1 parent 8398c5e commit 7f0205e

File tree

3 files changed

+18
-51
lines changed

3 files changed

+18
-51
lines changed

cobj/codegen.c

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -234,56 +234,29 @@ static void get_java_identifier_helper(struct cb_field *f, char *buf) {
234234
}
235235

236236
static void strcpy_identifier_cobol_to_java(char *buf, const char *identifier) {
237-
if (cb_flag_var_name_hex) {
238-
int all_ascii = 1;
239-
unsigned char *p = (unsigned char *)identifier;
240-
for (; *p; ++p) {
241-
unsigned char c = *p;
242-
if (c < 0x0A || 0x80 <= c) {
243-
all_ascii = 0;
244-
break;
245-
}
246-
}
247-
248-
if (all_ascii) {
249-
for (; *identifier; ++identifier, ++buf) {
250-
if (*identifier == '-') {
251-
*buf = '_';
252-
} else {
253-
*buf = *identifier;
254-
}
255-
}
237+
unsigned char *src = (unsigned char *)identifier;
238+
unsigned char *dst = (unsigned char *)buf;
239+
while (*src) {
240+
// ASCII characters
241+
if (*src < 0x80) {
242+
*dst = (*src == '-') ? '_' : *src;
243+
++dst;
244+
++src;
245+
// Shift_JIS characters
256246
} else {
257-
for (; *identifier; ++identifier) {
258-
sprintf(buf, "%02x", (unsigned char)*identifier);
259-
buf += 2;
260-
}
261-
}
262-
*buf = '\0';
263-
} else {
264-
unsigned char *src = (unsigned char *)identifier;
265-
unsigned char *dst = (unsigned char *)buf;
266-
while (*src) {
267-
// ASCII characters
268-
if (*src < 0x80) {
269-
*dst = (*src == '-') ? '_' : *src;
270-
++dst;
271-
++src;
272-
// Shift_JIS characters
247+
// convert zenkaku hyphen to zenkaku underscore
248+
if (src[0] == 0x81 && src[1] == 0x7C) {
249+
dst[0] = 0x81;
250+
dst[1] = 0x51;
273251
} else {
274-
if (src[0] == 0x81 && src[1] == 0x7C) {
275-
dst[0] = 0x81;
276-
dst[1] = 0x51;
277-
} else {
278-
dst[0] = src[0];
279-
dst[1] = src[1];
280-
}
281-
dst += 2;
282-
src += 2;
252+
dst[0] = src[0];
253+
dst[1] = src[1];
283254
}
255+
dst += 2;
256+
src += 2;
284257
}
285-
*dst = '\0';
286258
}
259+
*dst = '\0';
287260
}
288261

289262
struct cb_label_id_map {

cobj/flag-help.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,5 @@ CB_FLAG (cb_flag_functions_all, "functions-all",
5656
CB_FLAG (cb_flag_mfcomment, "mfcomment",
5757
N_("'*' or '/' in column 1 treated as comment (FIXED only)"))
5858

59-
CB_FLAG (cb_flag_var_name_hex, "var-name-hex",
60-
N_("Use hexdecimal representation for variable names that contains non-ASCII characters"))
61-
6259
//CB_FLAG (cb_flag_no_cobol_comment, "no-cobol-comment",
6360
// N_("Do not generate COBOL comments into Java programs"))

cobj/flag.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,5 @@ CB_FLAG (cb_flag_serial_variable, "serial-variable",
8181
CB_FLAG (cb_flag_short_variable, "short-variable",
8282
N_("Use short variable names in Java source code. This feature may cause compilation errors"))
8383

84-
CB_FLAG (cb_flag_var_name_hex, "var-name-hex",
85-
N_("Use hexdecimal representation for variable names that contains non-ASCII characters"))
86-
8784
//CB_FLAG (cb_flag_no_cobol_comment, "no-cobol-comment",
8885
// N_("Do not generate COBOL comments into Java programs"))

0 commit comments

Comments
 (0)