Skip to content

Commit 5e9dc7b

Browse files
authored
Merge pull request #24 from opensourcecobol/dev/y-sakamoto
CALL呼び出しの引数の変換処理を追加した
2 parents 9a4ef70 + 829588c commit 5e9dc7b

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

cobc/codegen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,9 +2739,9 @@ joutput_call (struct cb_call *p)
27392739
break;
27402740
case CB_TAG_LITERAL:
27412741
if (CB_TREE_CLASS (x) == CB_CLASS_NUMERIC) {
2742-
joutput ("%d", cb_get_int (x));
2742+
joutput ("CobolDataStorage.primitiveToDataStorage(%d)", cb_get_int (x));
27432743
} else {
2744-
joutput ("%d", CB_LITERAL (x)->data[0]);
2744+
joutput ("CobolDataStroage.primitiveToDataStorage(%d)", CB_LITERAL (x)->data[0]);
27452745
}
27462746
break;
27472747
default:

libcobj/src/jp/osscons/opensourcecobol/libcobj/data/CobolDataStorage.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ public ByteBuffer getByteBuffer(int size) {
8989
public void addIndex(int n) {
9090
this.index += n;
9191
}
92+
93+
static public CobolDataStorage primitiveToDataStorage(int n) {
94+
byte[] bytes = new byte[4];
95+
ByteBuffer buffer = ByteBuffer.wrap(bytes);
96+
buffer.putInt(n);
97+
return new CobolDataStorage(bytes);
98+
}
99+
100+
static public CobolDataStorage primitiveToDataStorage(String s) {
101+
return new CobolDataStorage(s);
102+
}
92103

93104
/**
94105
* コンストラクタ.文字列からバイト配列を構成する.

tests/i18n_sjis.at

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ AT_INIT([I18n Shift_JIS Tests])
2222

2323
AT_TESTED([cobc])
2424

25-
#m4_include([user-defined-word.at])
26-
m4_include([pic-x.at])
27-
m4_include([pic-n.at])
28-
#m4_include([program-id.at])
29-
#m4_include([error-print.at])
30-
#m4_include([limits.at])
31-
m4_include([national.at])
32-
#m4_include([mb-space.at])
25+
m4_include([user-defined-word.at])
26+
#m4_include([pic-x.at])
27+
#m4_include([pic-n.at])
28+
m4_include([program-id.at])
29+
m4_include([error-print.at])
30+
m4_include([limits.at])
31+
#m4_include([national.at])
32+
m4_include([mb-space.at])

0 commit comments

Comments
 (0)