@@ -853,40 +853,32 @@ static void joutput_base(struct cb_field *f) {
853853 // EDIT
854854 /* Base name */
855855 strcpy_identifier_cobol_to_java (name , top -> name );
856- if (!top -> flag_external ) {
857- register_data_storage_list (f , top );
858- }
856+
857+ register_data_storage_list (f , top );
859858
860859 if (!top -> flag_base ) {
861- if (!top -> flag_external ) {
862- if (!top -> flag_local || top -> flag_is_global ) {
863- bl = cobc_malloc (sizeof (struct base_list ));
864- bl -> f = top ;
865- bl -> curr_prog = excp_current_program_id ;
866- bl -> next = base_cache ;
867- base_cache = bl ;
860+ if (!top -> flag_local || top -> flag_is_global ) {
861+ bl = cobc_malloc (sizeof (struct base_list ));
862+ bl -> f = top ;
863+ bl -> curr_prog = excp_current_program_id ;
864+ bl -> next = base_cache ;
865+ base_cache = bl ;
866+ } else {
867+ if (current_prog -> flag_global_use ) {
868+ joutput_local ("unsigned char\t\t*%s%s = NULL;" , CB_PREFIX_BASE , name );
869+ joutput_local ("\t/* %s */\n" , top -> name );
870+ joutput_local ("static unsigned char\t*save_%s%s;\n" , CB_PREFIX_BASE ,
871+ name );
868872 } else {
869- if (current_prog -> flag_global_use ) {
870- joutput_local ("unsigned char\t\t*%s%s = NULL;" , CB_PREFIX_BASE , name );
871- joutput_local ("unsigned char\t\t*%s%s = NULL;" , CB_PREFIX_BASE , name );
872- joutput_local ("\t/* %s */\n" , top -> name );
873- joutput_local ("static unsigned char\t*save_%s%s;\n" , CB_PREFIX_BASE ,
874- name );
875- } else {
876- joutput_local ("unsigned char\t*%s%s = NULL;" , CB_PREFIX_BASE , name );
877- joutput_local ("\t/* %s */\n" , top -> name );
878- }
873+ joutput_local ("unsigned char\t*%s%s = NULL;" , CB_PREFIX_BASE , name );
874+ joutput_local ("\t/* %s */\n" , top -> name );
879875 }
880876 }
881877 top -> flag_base = 1 ;
882878 }
883879
884- if (top -> flag_external ) {
885- joutput ("%s%s" , CB_PREFIX_BASE , name );
886- } else {
887- if (joutput_field_storage (f , top ) && f -> offset != 0 ) {
888- joutput (".getSubDataStorage(%d)" , f -> offset );
889- }
880+ if (joutput_field_storage (f , top ) && f -> offset != 0 ) {
881+ joutput (".getSubDataStorage(%d)" , f -> offset );
890882 }
891883
892884 if (cb_field_variable_address (f )) {
@@ -2260,14 +2252,14 @@ static void joutput_initialize_external(cb_tree x, struct cb_field *f) {
22602252 joutput_prefix ();
22612253 joutput_data (x );
22622254 if (f -> ename ) {
2263- joutput (" = CobolExternal.getStorageAddress (\"%s\", %d);\n " , f -> ename ,
2255+ joutput (" = CobolExternal.getStorageAddress (\"%s\", %d);" , f -> ename ,
22642256 f -> size );
22652257 } else if (f -> storage == CB_STORAGE_FILE ) {
22662258 file = CB_TREE (f -> file );
2267- joutput (" = CobolExternal.getStorageAddress (\"%s\", %d);\n " ,
2259+ joutput (" = CobolExternal.getStorageAddress (\"%s\", %d);" ,
22682260 CB_FILE (file )-> record -> name , f -> size );
22692261 } else {
2270- joutput (" = CobolExternal.getStorageAddress (\"%s\", %d);\n " , f -> name ,
2262+ joutput (" = CobolExternal.getStorageAddress (\"%s\", %d);" , f -> name ,
22712263 f -> size );
22722264 }
22732265}
@@ -2597,12 +2589,6 @@ static void joutput_initialize(struct cb_initialize *p) {
25972589 int c ;
25982590
25992591 f = cb_field (p -> var );
2600- if (f -> flag_external ) {
2601- joutput_initialize_external (p -> var , f );
2602- if (!p -> flag_statement ) {
2603- return ;
2604- }
2605- }
26062592 switch (initialize_type (p , f , 1 )) {
26072593 case INITIALIZE_NONE :
26082594 break ;
@@ -2622,6 +2608,7 @@ static void joutput_initialize(struct cb_initialize *p) {
26222608 break ;
26232609 }
26242610}
2611+
26252612/*
26262613 * SEARCH
26272614 */
@@ -4240,6 +4227,10 @@ static void joutput_initial_values(struct cb_field *p) {
42404227 if (p -> flag_no_init && !p -> count ) {
42414228 continue ;
42424229 }
4230+ /* EXTERNAL items */
4231+ if (p -> flag_external ) {
4232+ continue ;
4233+ }
42434234 int tmp_flag = integer_reference_flag ;
42444235 integer_reference_flag = 1 ;
42454236 joutput_stmt (cb_build_initialize (x , cb_true , NULL , def , 0 ),
@@ -5079,6 +5070,11 @@ static void joutput_init_method(struct cb_program *prog) {
50795070 joutput_prefix ();
50805071 joutput ("%s = new CobolDataStorage(%d);" , base_name ,
50815072 blp -> f -> memory_size );
5073+ }
5074+
5075+ if (blp -> f -> flag_external ) {
5076+ joutput_initialize_external (cb_build_field_reference (blp -> f , NULL ),
5077+ blp -> f );
50825078 } else {
50835079 joutput_prefix ();
50845080 joutput ("%s = new CobolDataStorage(%d);" , base_name ,
@@ -5594,27 +5590,6 @@ static void joutput_declare_member_variables(struct cb_program *prog,
55945590 joutput ("\n" );
55955591 }
55965592
5597- /* External items */
5598- for (f = prog -> working_storage ; f ; f = f -> sister ) {
5599- if (f -> flag_external ) {
5600- joutput_prefix ();
5601- joutput ("private CobolDataStorage " );
5602- joutput_base (f );
5603- joutput (" = null; /* %s */" , f -> name );
5604- joutput_newline ();
5605- }
5606- }
5607- for (l = prog -> file_list ; l ; l = CB_CHAIN (l )) {
5608- f = CB_FILE (CB_VALUE (l ))-> record ;
5609- if (f -> flag_external ) {
5610- joutput_prefix ();
5611- joutput ("private CobolDataStorage " );
5612- joutput_base (f );
5613- joutput (" = null; /* %s */" , f -> name );
5614- joutput_newline ();
5615- }
5616- }
5617-
56185593 /* AbstractCobolField型変数の宣言(非定数) */
56195594 if (field_cache ) {
56205595 joutput_line ("/* Fields */\n" );
0 commit comments