@@ -7121,169 +7121,62 @@ output_java_call (struct cb_call *p)
7121
7121
class_name = class_and_method_name ;
7122
7122
7123
7123
for (int i = 0 ; (ptr = ((struct cb_tree_common * * )p -> args )[i ]) != NULL ; i ++ ) {
7124
- switch (CB_TREE_TAG (ptr )) {
7125
- case CB_TAG_INTEGER : {
7126
- struct cb_picture * pic = CB_FIELD (ptr )-> pic ;
7127
- if (pic ) {
7128
- int n = pic -> digits ;
7129
- if (CB_FIELD (ptr )-> usage == CB_USAGE_COMP_5 ) {
7130
- if (n >= 1 && n <= 4 ) {
7131
- strncat (method_signature , "S" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7132
- } else if (n >= 5 && n <= 9 ) {
7133
- strncat (method_signature , "I" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7134
- } else if (n >= 10 && n <= 18 ) {
7135
- strncat (method_signature , "J" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7136
- }
7137
- } else if (CB_FIELD (ptr )-> usage == CB_USAGE_PACKED || CB_FIELD (ptr )-> usage == CB_USAGE_DISPLAY ) {
7138
- strncat (method_signature , "Ljava/math/BigDecimal;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7124
+ if (CB_TREE_TAG (ptr ) == CB_TAG_INTEGER ) {
7125
+ struct cb_picture * pic = CB_FIELD (ptr )-> pic ;
7126
+ if (pic ) {
7127
+ int n = pic -> digits ;
7128
+ if (CB_FIELD (ptr )-> usage == CB_USAGE_COMP_5 ) {
7129
+ if (n >= 1 && n <= 4 ) {
7130
+ strncat (method_signature , "S" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7131
+ } else if (n >= 5 && n <= 9 ) {
7132
+ strncat (method_signature , "I" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7133
+ } else if (n >= 10 && n <= 18 ) {
7134
+ strncat (method_signature , "J" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7139
7135
}
7136
+ } else if (CB_FIELD (ptr )-> usage == CB_USAGE_PACKED || CB_FIELD (ptr )-> usage == CB_USAGE_DISPLAY ) {
7137
+ strncat (method_signature , "Ljava/math/BigDecimal;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7140
7138
}
7141
- break ;
7142
- }
7143
- case CB_USAGE_FLOAT :
7144
- strncat (method_signature , "F" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7145
- break ;
7146
- case CB_USAGE_DOUBLE :
7147
- strncat (method_signature , "D" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7148
- break ;
7149
- case CB_CLASS_BOOLEAN :
7150
- strncat (method_signature , "Z" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7151
- break ;
7152
- case CB_TAG_STRING :
7153
- strncat (method_signature , "Ljava/lang/String;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7154
- break ;
7155
- case CB_USAGE_OBJECT :
7156
- strncat (method_signature , "Ljava/lang/Object;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7157
- break ;
7158
- case CB_TAG_LITERAL :
7159
- if (CB_TREE_CATEGORY (ptr ) == CB_CATEGORY_NUMERIC ) {
7160
- strncat (method_signature , "I" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7161
- } else if (CB_TREE_CATEGORY (ptr ) == CB_CATEGORY_ALPHANUMERIC ) {
7162
- strncat (method_signature , "Ljava/lang/String;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7163
- }
7164
- break ;
7165
- case CB_TAG_LIST :
7166
- {
7167
- struct cb_tree_common * * list_elements = (struct cb_tree_common * * ) ptr ;
7168
- int array_dimension = 1 ;
7169
-
7170
- while (list_elements != NULL ) {
7171
- struct cb_tree_common * * inner_list = NULL ;
7172
- for (int j = 0 ; list_elements [j ] != NULL ; j ++ ) {
7173
- if (CB_TREE_TAG (list_elements [j ]) == CB_TAG_LIST ) {
7174
- array_dimension ++ ;
7175
- inner_list = (struct cb_tree_common * * ) list_elements [j ];
7176
- } else {
7177
- switch (CB_TREE_TAG (list_elements [j ])) {
7178
- case CB_TAG_INTEGER : {
7179
- struct cb_picture * pic = CB_FIELD (list_elements [j ])-> pic ;
7180
- if (pic ) {
7181
- int n = pic -> digits ;
7182
- if (CB_FIELD (list_elements [j ])-> usage == CB_USAGE_COMP_5 ) {
7183
- if (n >= 1 && n <= 4 ) {
7184
- strncat (method_signature , "[S" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7185
- } else if (n >= 5 && n <= 9 ) {
7186
- strncat (method_signature , "[I" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7187
- } else if (n >= 10 && n <= 18 ) {
7188
- strncat (method_signature , "[J" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7189
- }
7190
- } else if (CB_FIELD (list_elements [j ])-> usage == CB_USAGE_PACKED || CB_FIELD (list_elements [j ])-> usage == CB_USAGE_DISPLAY ) {
7191
- strncat (method_signature , "[Ljava/math/BigDecimal;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7192
- }
7193
- }
7194
- break ;
7195
- }
7196
- case CB_USAGE_FLOAT :
7197
- strncat (method_signature , "[F" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7198
- break ;
7199
- case CB_USAGE_DOUBLE :
7200
- strncat (method_signature , "[D" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7201
- break ;
7202
- case CB_CLASS_BOOLEAN :
7203
- strncat (method_signature , "[Z" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7204
- break ;
7205
- case CB_TAG_STRING :
7206
- strncat (method_signature , "[Ljava/lang/String;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7207
- break ;
7208
- case CB_USAGE_OBJECT :
7209
- strncat (method_signature , "[Ljava/lang/Object;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7210
- break ;
7211
- default :
7212
- cobc_err_msg (_ ("Unsupported array element type in Java method call" ));
7213
- COBC_ABORT ();
7214
- }
7215
- }
7216
- }
7217
- list_elements = inner_list ;
7218
- }
7219
- }
7220
- break ;
7221
- default :
7222
- COBC_ABORT ();
7139
+ }
7223
7140
}
7224
7141
}
7225
7142
7226
7143
if (p -> call_returning == NULL ) {
7227
7144
strncat (method_signature , ")V" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7228
7145
strcpy (return_type_signature , "void" );
7229
- } else {
7230
- switch (CB_TREE_TAG (p -> call_returning )) {
7231
- case CB_TAG_INTEGER : {
7232
- struct cb_picture * pic = CB_FIELD (p -> call_returning )-> pic ;
7233
- if (pic ) {
7234
- int n = pic -> digits ;
7235
- if (CB_FIELD (p -> call_returning )-> usage == CB_USAGE_COMP_5 ) {
7236
- if (n >= 1 && n <= 4 ) {
7237
- strncat (method_signature , ")S" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7238
- strcpy (return_type_signature , "jshort" );
7239
- } else if (n >= 5 && n <= 9 ) {
7240
- strncat (method_signature , ")I" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7241
- strcpy (return_type_signature , "jint" );
7242
- } else if (n >= 10 && n <= 18 ) {
7243
- strncat (method_signature , ")J" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7244
- strcpy (return_type_signature , "jlong" );
7245
- }
7246
- } else if (CB_FIELD (p -> call_returning )-> usage == CB_USAGE_PACKED || CB_FIELD (p -> call_returning )-> usage == CB_USAGE_DISPLAY ) {
7247
- strncat (method_signature , ")Ljava/math/BigDecimal;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7248
- strcpy (return_type_signature , "jobject" );
7249
- }
7250
- }
7251
- break ;
7146
+ } else if (CB_TREE_TAG (p -> call_returning ) == CB_TAG_INTEGER ) {
7147
+ struct cb_picture * pic = CB_FIELD (p -> call_returning )-> pic ;
7148
+ if (pic ) {
7149
+ int n = pic -> digits ;
7150
+ if (CB_FIELD (p -> call_returning )-> usage == CB_USAGE_COMP_5 ) {
7151
+ if (n >= 1 && n <= 4 ) {
7152
+ strncat (method_signature , ")S" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7153
+ strcpy (return_type_signature , "jshort" );
7154
+ } else if (n >= 5 && n <= 9 ) {
7155
+ strncat (method_signature , ")I" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7156
+ strcpy (return_type_signature , "jint" );
7157
+ } else if (n >= 10 && n <= 18 ) {
7158
+ strncat (method_signature , ")J" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7159
+ strcpy (return_type_signature , "jlong" );
7160
+ }
7161
+ } else if (CB_FIELD (p -> call_returning )-> usage == CB_USAGE_PACKED || CB_FIELD (p -> call_returning )-> usage == CB_USAGE_DISPLAY ) {
7162
+ strncat (method_signature , ")Ljava/math/BigDecimal;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7163
+ strcpy (return_type_signature , "jobject" );
7252
7164
}
7253
- case CB_TAG_STRING :
7254
- strncat (method_signature , ")Ljava/lang/String;" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7255
- strcpy (return_type_signature , "jstring" );
7256
- break ;
7257
- case CB_USAGE_FLOAT :
7258
- strncat (method_signature , ")F" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7259
- strcpy (return_type_signature , "jfloat" );
7260
- break ;
7261
- case CB_USAGE_DOUBLE :
7262
- strncat (method_signature , ")D" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7263
- strcpy (return_type_signature , "jdouble" );
7264
- break ;
7265
- case CB_CLASS_BOOLEAN :
7266
- strncat (method_signature , ")Z" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7267
- strcpy (return_type_signature , "jboolean" );
7268
- break ;
7269
- default :
7270
- strncat (method_signature , ")V" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7271
- strcpy (return_type_signature , "void" );
7272
- break ;
7273
7165
}
7166
+ } else {
7167
+ strncat (method_signature , ")V" , COB_NORMAL_BUFF - strlen (method_signature ) - 1 );
7168
+ strcpy (return_type_signature , "void" );
7274
7169
}
7275
7170
7276
- strcat (method_signature , ")V" );
7277
-
7278
7171
lookup_java_call (mangled , method_signature );
7279
7172
output_line ("if (call_java_%s == NULL)" , mangled );
7280
7173
output_block_open ();
7281
7174
7282
7175
output_prefix ();
7283
7176
output_line ("call_java_%s = " , mangled );
7284
7177
output ("cob_resolve_java(\"%s\", \"%s\", \"%s\", \"()V\");" , class_name , method_name , method_signature );
7285
- output_newline ();
7286
- output_prefix ();
7178
+ output_newline ();
7179
+ output_prefix ();
7287
7180
output_line ("cob_call_java(call_java_%s);\n" , mangled );
7288
7181
output_newline ();
7289
7182
output_block_close ();
0 commit comments