@@ -163,6 +163,7 @@ int cb_saveargc;
163163char * * cb_saveargv ;
164164
165165const char * cob_config_dir ;
166+ extern char * cb_java_package_name = NULL ;
166167
167168#define PROGRAM_ID_LIST_MAX_LEN 1024
168169char * program_id_list [PROGRAM_ID_LIST_MAX_LEN ];
@@ -296,6 +297,7 @@ static const struct option long_options[] = {
296297 {"list-intrinsics" , no_argument , NULL , '6' },
297298 {"list-mnemonics" , no_argument , NULL , 'q' },
298299 {"save-temps" , optional_argument , NULL , '_' },
300+ {"java-package" , optional_argument , NULL , 'P' },
299301 {"std" , required_argument , NULL , '$' },
300302 {"conf" , required_argument , NULL , '&' },
301303 {"debug" , no_argument , NULL , 'd' },
@@ -834,19 +836,20 @@ cobc_print_usage (void)
834836{
835837 puts (_ ("Usage: cobj [options] file..." ));
836838 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" ));
850853 putchar ('\n' );
851854
852855#undef CB_WARNDEF
@@ -1036,6 +1039,11 @@ process_command_line (const int argc, char *argv[])
10361039 }
10371040 }
10381041 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+ }
10391047
10401048 case '3' : /* --constant */
10411049 if (optarg ) {
@@ -1723,7 +1731,7 @@ process_compile (struct filename *fn)
17231731 }
17241732
17251733 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" ,
17271735 cob_java_flags ,
17281736 * program_id );
17291737 ret = process (buff );
0 commit comments