diff --git a/cobj/cobj.c b/cobj/cobj.c index 293524f9..6b0e2a36 100644 --- a/cobj/cobj.c +++ b/cobj/cobj.c @@ -194,9 +194,6 @@ char *cb_single_jar_name = NULL; int cb_flag_info_json = 0; char *cb_info_json_dir = NULL; -char edit_code_command[512]; -char edit_code_command_is_set = 0; - #define PROGRAM_ID_LIST_MAX_LEN 1024 char *program_id_list[PROGRAM_ID_LIST_MAX_LEN]; @@ -314,7 +311,6 @@ static const struct option long_options[] = { {"reference_check", no_argument, NULL, 'K'}, {"constant", optional_argument, NULL, '3'}, {"fdefaultbyte", required_argument, NULL, OPTION_ID_DEFAULT_BYTE}, - {"edit-code-command", optional_argument, NULL, '['}, #undef CB_FLAG #define CB_FLAG(var, name, doc) \ {"f" name, no_argument, &var, 1}, {"fno-" name, no_argument, &var, 0}, @@ -1206,10 +1202,6 @@ static int process_command_line(const int argc, char *argv[]) { perror(optarg); } break; - case '[': - strcpy(edit_code_command, optarg); - edit_code_command_is_set = 1; - break; case 'I': #ifdef _MSC_VER diff --git a/cobj/cobj.h b/cobj/cobj.h index 5c91309c..eb6f815f 100644 --- a/cobj/cobj.h +++ b/cobj/cobj.h @@ -175,9 +175,6 @@ DECLNORET extern void cobc_abort(const char *filename, extern size_t cobc_check_valid_name(char *name); -extern char edit_code_command[512]; -extern char edit_code_command_is_set; - #ifdef I18N_UTF8 #define COB_U8CSIZ 3 diff --git a/cobj/codegen.c b/cobj/codegen.c index dc90d557..f0242a74 100644 --- a/cobj/codegen.c +++ b/cobj/codegen.c @@ -187,7 +187,6 @@ static char *convert_byte_value_format(char value); static void append_label_id_map(struct cb_label *label); static void create_label_id_map(struct cb_program *prog); static void destroy_label_id_map(void); -static void joutput_edit_code_command(const char *target); static void joutput_label_variable(struct cb_label *label); static void joutput_label_variable_name(char *s, int key, @@ -675,35 +674,6 @@ static void joutput_local(const char *fmt, ...) { } } -static void joutput_edit_code_command(const char *target) { - if (!edit_code_command_is_set) { - return; - } - - char command[BUF_SIZE]; - char buf[BUF_SIZE]; - sprintf(command, "%s --target=%s", edit_code_command, target); - -#ifdef _WIN32 - FILE *fp = _popen(command, "r"); -#else - FILE *fp = popen(command, "r"); -#endif - if (fp == NULL) { - return; - } - memset(buf, 0, BUF_SIZE); - - while (fgets(buf, BUF_SIZE, fp) != NULL) { - joutput("%s", buf); - } -#ifdef _WIN32 - _pclose(fp); -#else - pclose(fp); -#endif -} - /* * Field */ @@ -6082,9 +6052,6 @@ void codegen(struct cb_program *prog, const int nested, char **program_id_list, if (cb_java_package_name) { joutput_line("package %s;\n", cb_java_package_name); } - if (edit_code_command_is_set) { - joutput_edit_code_command("file-header"); - } joutput_line("import java.io.UnsupportedEncodingException;"); joutput_line("import jp.osscons.opensourcecobol.libcobj.*;"); @@ -6113,17 +6080,7 @@ void codegen(struct cb_program *prog, const int nested, char **program_id_list, } }*/ - if (edit_code_command_is_set) { - joutput_edit_code_command("main-class-annotation"); - } - if (edit_code_command_is_set) { - joutput("public class %s implements CobolRunnable, ", prog->program_id); - joutput_edit_code_command("main-class-implements"); - joutput(" {\n"); - } else { - joutput_line("public class %s implements CobolRunnable {", - prog->program_id); - } + joutput_line("public class %s implements CobolRunnable {", prog->program_id); joutput_indent_level += 2; joutput("\n"); @@ -6135,9 +6092,6 @@ void codegen(struct cb_program *prog, const int nested, char **program_id_list, // output_storage ("union cob_call_union\tcob_unifunc;\n\n"); joutput_line("private CobolRunnable cob_unifunc;\n"); - if (edit_code_command_is_set) { - joutput_edit_code_command("main-class-contents"); - } joutput("\n"); joutput_line("@Override"); diff --git a/tests/Makefile.am b/tests/Makefile.am index e9deb5e1..3f4306c0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -185,7 +185,6 @@ command_line_options_DEPENDENCIES = \ command-line-options.src/ffold-copy.at \ command-line-options.src/info-java-dir.at \ command-line-options.src/java-package.at \ - command-line-options.src/edit-code-command.at \ command-line-options.src/file-path.at \ command-line-options.src/fdefaultbyte.at \ command-line-options.src/ffunctions-all.at \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 68820e48..3e13f2b5 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -724,7 +724,6 @@ command_line_options_DEPENDENCIES = \ command-line-options.src/ffold-copy.at \ command-line-options.src/info-java-dir.at \ command-line-options.src/java-package.at \ - command-line-options.src/edit-code-command.at \ command-line-options.src/file-path.at \ command-line-options.src/fdefaultbyte.at \ command-line-options.src/ffunctions-all.at \ diff --git a/tests/command-line-options.at b/tests/command-line-options.at index b057fd5b..bf321222 100644 --- a/tests/command-line-options.at +++ b/tests/command-line-options.at @@ -36,5 +36,3 @@ m4_include([jar.at]) m4_include([std.at]) m4_include([conf.at]) m4_include([Wimplicit-define.at]) - -# m4_include([edit-code-command.at]) diff --git a/tests/command-line-options.src/edit-code-command.at b/tests/command-line-options.src/edit-code-command.at deleted file mode 100644 index 7985cbb2..00000000 --- a/tests/command-line-options.src/edit-code-command.at +++ /dev/null @@ -1,94 +0,0 @@ -AT_SETUP([-edit-code-command]) - -AT_DATA([prog.cbl], [ - identification division. - program-id. prog. - procedure division. - display "hello". -]) - -AT_DATA([SampleInterface.java], [ - public interface SampleInterface { - public void sampleInterfaceRun(); - } -]) - -AT_DATA([CallSampleInterface.java], [ - public class CallSampleInterface { - public static void main(String@<:@@:>@ args) { - SampleInterface s = new prog(); - s.sampleInterfaceRun(); - } - } -]) - -AT_DATA([edit.sh], [ -#!/bin/bash - -while getopts c:t-: opt; do - optarg="$OPTARG" - if @<:@@<:@ "$opt" = - @:>@@:>@; then - opt="-${OPTARG%%=*}" - optarg="${OPTARG/${OPTARG%%=*}/}" - optarg="${optarg#=}" - - if @<:@@<:@ -z "$optarg" @:>@@:>@ && @<:@@<:@ ! "${!OPTIND}" = -* @:>@@:>@; then - optarg="${!OPTIND}" - shift - fi - fi - - case "-$opt" in - --target) - target="$optarg" - ;; - --class-name) - class_name="$optarg" - ;; - --) - break - ;; - esac -done -shift $((OPTIND - 1)) - - -case "$target" in - # when `--target=main-class` is specified - main-class-annotation) - echo "//annotation here" - exit 0 - ;; - # when `--target=file-header` is specified - file-header) - echo '//file-header here' - exit 0 - ;; - # when `--target=main-class` is specified - main-class-implements) - echo -n 'SampleInterface' - exit 0 - ;; - # when `--target=main-class` is specified - main-class-contents) - echo ' @Override' - echo ' public void sampleInterfaceRun() { System.out.println("COBOL"); }' - exit 0 - ;; -esac - -exit 1 - -]) - -AT_CHECK([${COBJ} -edit-code-command="bash edit.sh" prog.cbl], [0]) -AT_CHECK([java prog], [0], [hello -]) -AT_CHECK([javac CallSampleInterface.java]) -AT_CHECK([java CallSampleInterface], [0], [COBOL -]) -AT_CHECK([cat prog.java | grep 'annotation here' > /dev/null], [0]) -AT_CHECK([cat prog.java | grep 'file-header here' > /dev/null], [0]) -AT_CHECK([cobj --help | grep 'edit-code-command' > /dev/null], [0]) - -AT_CLEANUP \ No newline at end of file