Skip to content

Commit d75ae34

Browse files
Change the schema of json files of -info-json-dir (#363)
1 parent a790f00 commit d75ae34

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

cobj/codegen.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,7 +4312,6 @@ static void write_json_info(struct cb_program *prog) {
43124312
}
43134313

43144314
fprintf(fp, "{\n");
4315-
fprintf(fp, " \"json_format_version\": \"1.0.0\",\n");
43164315
fprintf(fp, " \"opensourcecobol4j_version\": \"%s\",\n", PACKAGE_VERSION);
43174316
fprintf(fp, " \"program_id\": \"%s\",\n", prog->program_id);
43184317
fprintf(fp, " \"procedure_division_using_parameters\": [\n");
@@ -4321,8 +4320,8 @@ static void write_json_info(struct cb_program *prog) {
43214320
struct cb_field *arg_field = cb_field(CB_VALUE(l));
43224321
int type = cb_tree_type(CB_TREE(arg_field));
43234322
fprintf(fp, " {\n");
4324-
fprintf(fp, " \"name\": \"%s\",\n", arg_field->name);
4325-
fprintf(fp, " \"type\": ");
4323+
fprintf(fp, " \"variable_name\": \"%s\",\n", arg_field->name);
4324+
fprintf(fp, " \"java_type\": ");
43264325
if (type & COB_TYPE_NUMERIC) {
43274326
if (arg_field->pic->scale > 0) {
43284327
fprintf(fp, "\"double\"");

tests/command-line-options.src/info-java-dir.at

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,23 @@ AT_DATA([prog.cbl], [
2828
AT_CHECK([${COBJ} -info-json-dir=./ callee.cbl prog.cbl])
2929
AT_CHECK([cat info_callee.json], [0],
3030
[{
31-
"json_format_version": "1.0.0",
3231
"opensourcecobol4j_version": "1.0.20",
3332
"program_id": "callee",
3433
"procedure_division_using_parameters": @<:@
3534
{
36-
"name": "P1",
37-
"type": "String"
35+
"variable_name": "P1",
36+
"java_type": "String"
3837
},
3938
{
40-
"name": "P2",
41-
"type": "int"
39+
"variable_name": "P2",
40+
"java_type": "int"
4241
}
4342
@:>@
4443
}
4544
])
4645

4746
AT_CHECK([cat info_prog.json], [0],
4847
[{
49-
"json_format_version": "1.0.0",
5048
"opensourcecobol4j_version": "1.0.20",
5149
"program_id": "prog",
5250
"procedure_division_using_parameters": @<:@
@@ -66,25 +64,23 @@ AT_CHECK([${COBJ} -info-json-dir=bbb callee.cbl prog.cbl])
6664

6765
AT_CHECK([cat bbb/info_callee.json], [0],
6866
[{
69-
"json_format_version": "1.0.0",
7067
"opensourcecobol4j_version": "1.0.20",
7168
"program_id": "callee",
7269
"procedure_division_using_parameters": @<:@
7370
{
74-
"name": "P1",
75-
"type": "String"
71+
"variable_name": "P1",
72+
"java_type": "String"
7673
},
7774
{
78-
"name": "P2",
79-
"type": "int"
75+
"variable_name": "P2",
76+
"java_type": "int"
8077
}
8178
@:>@
8279
}
8380
])
8481

8582
AT_CHECK([cat bbb/info_prog.json], [0],
8683
[{
87-
"json_format_version": "1.0.0",
8884
"opensourcecobol4j_version": "1.0.20",
8985
"program_id": "prog",
9086
"procedure_division_using_parameters": @<:@

0 commit comments

Comments
 (0)