@@ -163,6 +163,7 @@ int cb_saveargc;
163
163
char * * cb_saveargv ;
164
164
165
165
const char * cob_config_dir ;
166
+ extern char * cb_java_package_name = NULL ;
166
167
167
168
#define PROGRAM_ID_LIST_MAX_LEN 1024
168
169
char * program_id_list [PROGRAM_ID_LIST_MAX_LEN ];
@@ -296,6 +297,7 @@ static const struct option long_options[] = {
296
297
{"list-intrinsics" , no_argument , NULL , '6' },
297
298
{"list-mnemonics" , no_argument , NULL , 'q' },
298
299
{"save-temps" , optional_argument , NULL , '_' },
300
+ {"java-package" , optional_argument , NULL , 'P' },
299
301
{"std" , required_argument , NULL , '$' },
300
302
{"conf" , required_argument , NULL , '&' },
301
303
{"debug" , no_argument , NULL , 'd' },
@@ -834,19 +836,20 @@ cobc_print_usage (void)
834
836
{
835
837
puts (_ ("Usage: cobj [options] file..." ));
836
838
puts (_ ("Options:" ));
837
- puts (_ (" --help Display this message" ));
838
- puts (_ (" --version, -V Display compiler version" ));
839
- puts (_ (" -m Create jar files instead of class files (an experimental feature)" ));
840
- puts (_ (" -free Use free source format" ));
841
- puts (_ (" -free_1col_aster Use free(1col_aster) source format" ));
842
- puts (_ (" -g Enable Java compiler debug" ));
843
- puts (_ (" -E Preprocess only; do not compile or link" ));
844
- puts (_ (" -C Translation only; convert COBOL to Java" ));
845
- puts (_ (" -t <file> Generate and place a program listing into <file>" ));
846
- puts (_ (" -I <directory> Add <directory> to copy files search path" ));
847
- puts (_ (" -B <options> Add <options> to the Java compiler" ));
848
- puts (_ (" --list-reserved Display reserved words" ));
849
- puts (_ (" -assign_external Set the file assign to external" ));
839
+ puts (_ (" --help Display this message" ));
840
+ puts (_ (" --version, -V Display compiler version" ));
841
+ puts (_ (" -m Create jar files instead of class files (an experimental feature)" ));
842
+ puts (_ (" -free Use free source format" ));
843
+ puts (_ (" -free_1col_aster Use free(1col_aster) source format" ));
844
+ puts (_ (" -g Enable Java compiler debug" ));
845
+ puts (_ (" -E Preprocess only; do not compile or link" ));
846
+ puts (_ (" -C Translation only; convert COBOL to Java" ));
847
+ puts (_ (" -t <file> Generate and place a program listing into <file>" ));
848
+ puts (_ (" -I <directory> Add <directory> to copy files search path" ));
849
+ puts (_ (" -B <options> Add <options> to the Java compiler" ));
850
+ puts (_ (" --list-reserved Display reserved words" ));
851
+ puts (_ (" -assign_external Set the file assign to external" ));
852
+ puts (_ (" -java-package(=<package name>) Specify the package name of the generated source code" ));
850
853
putchar ('\n' );
851
854
852
855
#undef CB_WARNDEF
@@ -1036,6 +1039,11 @@ process_command_line (const int argc, char *argv[])
1036
1039
}
1037
1040
}
1038
1041
break ;
1042
+ case 'P' :
1043
+ /* --java-package : Java package name to be written in the head of generated source code */
1044
+ if (optarg ) {
1045
+ cb_java_package_name = optarg ;
1046
+ }
1039
1047
1040
1048
case '3' : /* --constant */
1041
1049
if (optarg ) {
@@ -1723,7 +1731,7 @@ process_compile (struct filename *fn)
1723
1731
}
1724
1732
1725
1733
for (char * * program_id = program_id_list ; * program_id ; ++ program_id ) {
1726
- sprintf (buff , "javac %s -encoding SJIS %s.java" ,
1734
+ sprintf (buff , "javac %s -encoding SJIS -d . %s.java" ,
1727
1735
cob_java_flags ,
1728
1736
* program_id );
1729
1737
ret = process (buff );
0 commit comments