From 879d078dc4a5a8d347de890bc2e1d2319557247d Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Sep 2023 16:17:41 +0900 Subject: [PATCH 01/16] Added FUNCTION EXCEPTION-FILE and FUNCTION EXCEPTION-FILE. --- .../libcobj/common/CobolIntrinsic.java | 86 +++++++++++++++++++ .../libcobj/common/CobolUtil.java | 23 +++++ .../exceptions/CobolRuntimeException.java | 35 ++++++++ .../libcobj/file/CobolFile.java | 12 ++- tests/run.src/functions.at | 72 +++++++++++++++- 5 files changed, 222 insertions(+), 6 deletions(-) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index a89c25c3..eb368c0f 100755 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -32,6 +32,7 @@ import jp.osscons.opensourcecobol.libcobj.exceptions.CobolExceptionId; import jp.osscons.opensourcecobol.libcobj.exceptions.CobolRuntimeException; import jp.osscons.opensourcecobol.libcobj.exceptions.CobolStopRunException; +import jp.osscons.opensourcecobol.libcobj.file.CobolFile; public class CobolIntrinsic { @@ -45,6 +46,7 @@ public class CobolIntrinsic { private static AbstractCobolField currField = null; private static AbstractCobolField[] calcField = new AbstractCobolField[DEPTH_LEVEL]; private static Random random = new Random(); + private static byte[] localeBuff; /** libcob/intrinsicのmake_double_entryの実装 */ private static void makeDoubleEntry() { @@ -1892,4 +1894,88 @@ public static AbstractCobolField funcDayToYyyyddd(int params, AbstractCobolField currField.setInt(year); return currField; } + + /** + * cob_intr_exception_fileの実装 + * + * @return + */ + public static AbstractCobolField funcExceptionFile() { + int flen; + byte[] data; + + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); + if (CobolRuntimeException.getExceptionCode() == 0 + || (CobolRuntimeException.getExceptionCode() & 0x0500) != 0x0500) { + field.setSize(2); + makeFieldEntry(field); + currField.memcpy("00", 2); + } else { + flen = CobolFile.getSelectName().length(); + field.setSize(flen + 2); + makeFieldEntry(field); + data = new byte[2 + flen]; + System.arraycopy(CobolFile.getFileStatus(), 0, data, 0, 2); + System.arraycopy(CobolFile.getSelectName().getBytes(), 0, data, 2, flen); + currField.setDataStorage(new CobolDataStorage(data)); + } + return currField; + } + + /** + * cob_intr_exception_locationの実装 + * + * @return + */ + public static AbstractCobolField funcExceptionLocation() { + String data; + String buff; + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); + currField = field; + if (CobolRuntimeException.getException() != 1 + || CobolRuntimeException.getOrigProgramId() == null) { + field.setSize(1); + makeFieldEntry(field); + data = String.valueOf(' '); + currField.memcpy(data.getBytes(), 1); + return currField; + } + if (CobolRuntimeException.getOrigSection() != null + && CobolRuntimeException.getOrigParagragh() != null) { + buff = + String.format( + "%s; %s OF %s; %d", + CobolRuntimeException.getOrigProgramId(), + CobolRuntimeException.getOrigParagragh(), + CobolRuntimeException.getOrigSection(), + CobolRuntimeException.getOrigLine()); + } else if (CobolRuntimeException.getOrigSection() != null) { + buff = + String.format( + "%s; %s; %d", + CobolRuntimeException.getOrigProgramId(), + CobolRuntimeException.getOrigSection(), + CobolRuntimeException.getOrigLine()); + } else if (CobolRuntimeException.getOrigParagragh() != null) { + buff = + String.format( + "%s; %s; %d", + CobolRuntimeException.getOrigProgramId(), + CobolRuntimeException.getOrigParagragh(), + CobolRuntimeException.getOrigLine()); + } else { + buff = + String.format( + "%s; ; %d", + CobolRuntimeException.getOrigProgramId(), CobolRuntimeException.getOrigLine()); + } + localeBuff = buff.getBytes(); + field.setSize(localeBuff.length); + currField.setDataStorage(new CobolDataStorage(localeBuff)); + return currField; + } } diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java index abfc1abc..55cbd122 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java @@ -61,6 +61,9 @@ public class CobolUtil { public static String sourceFile; public static int sourceLine; + public static String currProgramId; + public static String currSection; + public static String currParagraph; abstract class HandlerList { public HandlerList next = null; @@ -691,6 +694,10 @@ public static void setLocation( String progId, String sfile, int sline, String csect, String cpara, String cstatement) { CobolUtil.sourceFile = sfile; CobolUtil.sourceLine = sline; + currProgramId = progId; + currSection = csect; + currParagraph = cpara; + sourceLine = sline; if (CobolUtil.lineTrace) { System.err.println( String.format( @@ -741,4 +748,20 @@ public static byte[] stringToBytes(String s) { public static byte[] toBytes(byte... bytes) { return bytes; } + + public static String getCurrProgramId() { + return currProgramId; + } + + public static String getCurrSection() { + return currSection; + } + + public static String getCurrParagraph() { + return currParagraph; + } + + public static int getSourceLine() { + return sourceLine; + } } diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java index 65b7c2b5..aa49c223 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java @@ -19,10 +19,16 @@ package jp.osscons.opensourcecobol.libcobj.exceptions; import java.util.List; +import jp.osscons.opensourcecobol.libcobj.common.CobolUtil; /** 実行時エラーを示す例外 */ public class CobolRuntimeException extends RuntimeException { public static int code; + public static int cob_got_exception = 0; + public static String cob_orig_program_id; + public static String cob_orig_section; + public static String cob_orig_paragraph; + public static int cob_orig_line = 0; public static final int COBOL_FITAL_ERROR = 9000; @@ -70,6 +76,35 @@ public void printStackTrace() { public static void setException(int id) { code = CobolExceptionTabCode.code[id]; + cob_got_exception = 1; + cob_orig_program_id = CobolUtil.getCurrProgramId(); + cob_orig_section = CobolUtil.getCurrSection(); + cob_orig_paragraph = CobolUtil.getCurrParagraph(); + cob_orig_line = CobolUtil.getSourceLine(); // TODO common.c実装に残りをやる } + + public static int getExceptionCode() { + return code; + } + + public static int getException() { + return cob_got_exception; + } + + public static String getOrigProgramId() { + return cob_orig_program_id; + } + + public static String getOrigSection() { + return cob_orig_section; + } + + public static String getOrigParagragh() { + return cob_orig_paragraph; + } + + public static int getOrigLine() { + return cob_orig_line; + } } diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 9d9a7814..237d94d2 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -184,8 +184,8 @@ public class CobolFile { CobolExceptionId.COB_EC_I_O, CobolExceptionId.COB_EC_I_O_IMP }; - protected String select_name; - public byte[] file_status; + protected static String select_name; + public static byte[] file_status; protected AbstractCobolField assign; protected AbstractCobolField record; protected AbstractCobolField record_size; @@ -1519,4 +1519,12 @@ public void cob_delete_file(AbstractCobolField fnstatus) { } } } + + public static String getSelectName() { + return select_name; + } + + public static byte[] getFileStatus() { + return file_status; + } } diff --git a/tests/run.src/functions.at b/tests/run.src/functions.at index 8ae8594d..08000ffe 100644 --- a/tests/run.src/functions.at +++ b/tests/run.src/functions.at @@ -373,8 +373,7 @@ AT_CHECK([java prog], [0], AT_CLEANUP -AT_SETUP([FUNCTION EXCEPTION-FILE]) -AT_CHECK([${SKIP_TEST}]) +AT_SETUP([FUNCTION EXCEPTION-FILE (no text)]) AT_DATA([prog.cob], [ IDENTIFICATION DIVISION. @@ -404,8 +403,38 @@ AT_CHECK([java prog], [0], AT_CLEANUP -AT_SETUP([FUNCTION EXCEPTION-LOCATION]) -AT_CHECK([${SKIP_TEST}]) +AT_SETUP([FUNCTION EXCEPTION-FILE (existing text)]) + +AT_DATA([prog.cob], [ + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + INPUT-OUTPUT SECTION. + FILE-CONTROL. + SELECT TEST-FILE ASSIGN "TEXIST" + FILE STATUS IS TEST-STATUS. + DATA DIVISION. + FILE SECTION. + FD TEST-FILE. + 01 TEST-REC PIC X(4). + WORKING-STORAGE SECTION. + 01 TEST-STATUS PIC XX. + PROCEDURE DIVISION. + OPEN OUTPUT TEST-FILE. + DISPLAY FUNCTION EXCEPTION-FILE + END-DISPLAY. + CLOSE TEST-FILE. + STOP RUN. +]) + +AT_CHECK([${COMPILE} prog.cob]) +AT_CHECK([java prog], [0], +[00 +]) + +AT_CLEANUP + +AT_SETUP([FUNCTION EXCEPTION-LOCATION (no text)]) AT_DATA([prog.cob], [ IDENTIFICATION DIVISION. @@ -439,6 +468,41 @@ AT_CHECK([java prog], [0], AT_CLEANUP +AT_SETUP([FUNCTION EXCEPTION-LOCATION (existing text)]) + +AT_DATA([prog.cob], [ + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + INPUT-OUTPUT SECTION. + FILE-CONTROL. + SELECT TEST-FILE ASSIGN "TEXIST" + FILE STATUS IS TEST-STATUS. + DATA DIVISION. + FILE SECTION. + FD TEST-FILE. + 01 TEST-REC PIC X(4). + WORKING-STORAGE SECTION. + 01 TEST-STATUS PIC XX. + PROCEDURE DIVISION. + A00-MAIN SECTION. + A00. + OPEN OUTPUT TEST-FILE. + B00-MAIN SECTION. + B00. + DISPLAY FUNCTION EXCEPTION-LOCATION + NO ADVANCING + END-DISPLAY. + CLOSE TEST-FILE. + STOP RUN. +]) + +AT_CHECK([${COMPILE} -debug prog.cob]) +AT_CHECK([java prog], [0], +[ ]) + +AT_CLEANUP + AT_SETUP([FUNCTION EXCEPTION-STATEMENT]) AT_CHECK([${SKIP_TEST}]) From 7afa9fb2e5b14dd451b1d089ac003b8eb738fbe2 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Sep 2023 16:38:40 +0900 Subject: [PATCH 02/16] Fixed format --- cobj/pplex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cobj/pplex.c b/cobj/pplex.c index b681532a..afa2ec19 100644 --- a/cobj/pplex.c +++ b/cobj/pplex.c @@ -4344,4 +4344,4 @@ void pp_set_current_division(int divno) { current_division = divno; } void pp_omit_data_entry_name(int on_off) { omit_data_entry_name = on_off; } -void pp_omit_data_redef_name(int on_off) { omit_data_redef_name = on_off; } +void pp_omit_data_redef_name(int on_off) { omit_data_redef_name = on_off; } \ No newline at end of file From d4ddd2f3de1af296dd6629d5d5d5714b76abaaca Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Sep 2023 16:51:23 +0900 Subject: [PATCH 03/16] Fixed CobolFile.java --- .../src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 237d94d2..8cc6c2a0 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -257,8 +257,6 @@ public CobolFile( boolean flagNeedsTop, char fileVersion) { - this.select_name = selectName; - this.file_status = fileStatus; this.assign = assign; this.record = record; this.record_size = recordSize; From 4cbcf6a6a45eb80535426a53f2d32ec81934e11a Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Sep 2023 17:13:24 +0900 Subject: [PATCH 04/16] Fixed format --- .../libcobj/common/CobolIntrinsic.java | 7 ++++--- .../opensourcecobol/libcobj/file/CobolFile.java | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index eb368c0f..fc695801 100755 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -1903,6 +1903,7 @@ public static AbstractCobolField funcDayToYyyyddd(int params, AbstractCobolField public static AbstractCobolField funcExceptionFile() { int flen; byte[] data; + CobolFile cobolFile = new CobolFile(); CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); @@ -1913,12 +1914,12 @@ public static AbstractCobolField funcExceptionFile() { makeFieldEntry(field); currField.memcpy("00", 2); } else { - flen = CobolFile.getSelectName().length(); + flen = cobolFile.getSelectName().length(); field.setSize(flen + 2); makeFieldEntry(field); data = new byte[2 + flen]; - System.arraycopy(CobolFile.getFileStatus(), 0, data, 0, 2); - System.arraycopy(CobolFile.getSelectName().getBytes(), 0, data, 2, flen); + System.arraycopy(cobolFile.getFileStatus(), 0, data, 0, 2); + System.arraycopy(cobolFile.getSelectName().getBytes(), 0, data, 2, flen); currField.setDataStorage(new CobolDataStorage(data)); } return currField; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 8cc6c2a0..879d2783 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -184,8 +184,8 @@ public class CobolFile { CobolExceptionId.COB_EC_I_O, CobolExceptionId.COB_EC_I_O_IMP }; - protected static String select_name; - public static byte[] file_status; + protected String select_name; + public byte[] file_status; protected AbstractCobolField assign; protected AbstractCobolField record; protected AbstractCobolField record_size; @@ -257,6 +257,8 @@ public CobolFile( boolean flagNeedsTop, char fileVersion) { + this.select_name = selectName; + this.file_status = fileStatus; this.assign = assign; this.record = record; this.record_size = recordSize; @@ -1518,11 +1520,11 @@ public void cob_delete_file(AbstractCobolField fnstatus) { } } - public static String getSelectName() { - return select_name; + public String getSelectName() { + return this.select_name; } - public static byte[] getFileStatus() { - return file_status; + public byte[] getFileStatus() { + return this.file_status; } } From 4f406f60e9951ee78759caec6f02f50c65d91b01 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Sep 2023 18:09:59 +0900 Subject: [PATCH 05/16] Fixed variable definitions. --- .../libcobj/common/CobolIntrinsic.java | 7 +++---- .../libcobj/file/CobolFile.java | 20 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index fc695801..0e8983aa 100755 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -1903,7 +1903,6 @@ public static AbstractCobolField funcDayToYyyyddd(int params, AbstractCobolField public static AbstractCobolField funcExceptionFile() { int flen; byte[] data; - CobolFile cobolFile = new CobolFile(); CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); @@ -1914,12 +1913,12 @@ public static AbstractCobolField funcExceptionFile() { makeFieldEntry(field); currField.memcpy("00", 2); } else { - flen = cobolFile.getSelectName().length(); + flen = CobolFile.select_name.length(); field.setSize(flen + 2); makeFieldEntry(field); data = new byte[2 + flen]; - System.arraycopy(cobolFile.getFileStatus(), 0, data, 0, 2); - System.arraycopy(cobolFile.getSelectName().getBytes(), 0, data, 2, flen); + System.arraycopy(CobolFile.file_status, 0, data, 0, 2); + System.arraycopy(CobolFile.select_name.getBytes(), 0, data, 2, flen); currField.setDataStorage(new CobolDataStorage(data)); } return currField; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 879d2783..15137fc5 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -184,8 +184,8 @@ public class CobolFile { CobolExceptionId.COB_EC_I_O, CobolExceptionId.COB_EC_I_O_IMP }; - protected String select_name; - public byte[] file_status; + public static String select_name; + public static byte[] file_status; protected AbstractCobolField assign; protected AbstractCobolField record; protected AbstractCobolField record_size; @@ -257,8 +257,8 @@ public CobolFile( boolean flagNeedsTop, char fileVersion) { - this.select_name = selectName; - this.file_status = fileStatus; + CobolFile.select_name = selectName; + CobolFile.file_status = fileStatus; this.assign = assign; this.record = record; this.record_size = recordSize; @@ -294,8 +294,8 @@ public CobolFile( protected void saveStatus(int status, AbstractCobolField fnstatus) { CobolFile.errorFile = this; if (status == 0) { - this.file_status[0] = '0'; - this.file_status[1] = '0'; + CobolFile.file_status[0] = '0'; + CobolFile.file_status[1] = '0'; if (fnstatus != null) { fnstatus.getDataStorage().setByte(0, (byte) '0'); fnstatus.getDataStorage().setByte(1, (byte) '0'); @@ -307,8 +307,8 @@ protected void saveStatus(int status, AbstractCobolField fnstatus) { if (status != COB_STATUS_52_EOP) { CobolRuntimeException.setException(status_exception[status / 10]); } - this.file_status[0] = (byte) (status / 10 + '0'); - this.file_status[1] = (byte) (status % 10 + '0'); + CobolFile.file_status[0] = (byte) (status / 10 + '0'); + CobolFile.file_status[1] = (byte) (status % 10 + '0'); if (fnstatus != null) { fnstatus.getDataStorage().setByte(0, this.file_status[0]); fnstatus.getDataStorage().setByte(1, this.file_status[1]); @@ -1521,10 +1521,10 @@ public void cob_delete_file(AbstractCobolField fnstatus) { } public String getSelectName() { - return this.select_name; + return select_name; } public byte[] getFileStatus() { - return this.file_status; + return file_status; } } From 8fc0911664715718a853630fe2f03e876ffdf2ba Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Sep 2023 18:10:57 +0900 Subject: [PATCH 06/16] Formatted. --- .../opensourcecobol/libcobj/call/CobolResolve.java | 4 ++++ .../libcobj/data/AbstractCobolField.java | 2 ++ .../opensourcecobol/libcobj/data/CobolDataStorage.java | 1 + .../libcobj/data/CobolFieldAttribute.java | 4 ++++ .../libcobj/exceptions/CobolRuntimeException.java | 1 + .../opensourcecobol/libcobj/file/CobolFile.java | 1 + .../opensourcecobol/libcobj/file/IndexedCursor.java | 10 ++++++++++ 7 files changed, 23 insertions(+) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/call/CobolResolve.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/call/CobolResolve.java index 76f2e197..947fca5d 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/call/CobolResolve.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/call/CobolResolve.java @@ -41,13 +41,17 @@ public class CobolResolve { /** プログラム名とCobolRunnableインスタンスの対応表 */ private static Map callTable; + /** ポインタ(UUID)のCobolRunnableインスタンスの対応表 */ private static Map pointerTable; + /** 名前の変換方法(小文字か大文字)を示す変数 */ private static int name_convert; + // TODO resolve_pathsの利用方法 /** システムで設定された区切り文字で区切られた0個以上のパス 動的に読み込むクラスファイルを検索する場所を示す. */ private static List resolve_paths; + /** システムで設定された区切り文字で区切られた0個以上のパス 動的に読み込むクラスファイルを検索するパッケージ名を示す. */ private static List package_paths; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/AbstractCobolField.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/AbstractCobolField.java index 81e32732..1a73b4a4 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/AbstractCobolField.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/AbstractCobolField.java @@ -31,8 +31,10 @@ public abstract class AbstractCobolField { /** データを格納に使用するバイト配列の長さ */ protected int size; + /** データを格納するバイト配列を扱うオブジェクト */ protected CobolDataStorage dataStorage; + /** 変数に関する様々な情報を保持するオブジェクト(符号付か,COMP-3指定かなど) */ protected CobolFieldAttribute attribute; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/CobolDataStorage.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/CobolDataStorage.java index 900d3ce0..4ab8779a 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/CobolDataStorage.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/CobolDataStorage.java @@ -28,6 +28,7 @@ public class CobolDataStorage { /** データを保存するバイト配列 */ private byte[] data; + /** このクラスの扱うデータが保存する領域のバイト配列中での相対位置 */ private int index; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/CobolFieldAttribute.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/CobolFieldAttribute.java index 484fd5f2..0d30e9ef 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/CobolFieldAttribute.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/data/CobolFieldAttribute.java @@ -56,12 +56,16 @@ public class CobolFieldAttribute { /** 変数の種類 */ private int type; + /** 数値の時,桁数を示す */ private int digits; + /** 数値の時,スケールを示す */ private int scale; + /** 様々なフラグ */ private int flags; + /** PICTURE句の文字列 */ private String pic; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java index aa49c223..310794b9 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java @@ -36,6 +36,7 @@ public class CobolRuntimeException extends RuntimeException { /** エラー番号 */ private int errorCode; + /** エラーメッセージ */ private String message; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 15137fc5..054cc5c0 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -747,6 +747,7 @@ public void open(int mode, int sharing, AbstractCobolField fnstatus) { return; } } + // protected long start; // protected long end; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/IndexedCursor.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/IndexedCursor.java index 6b313632..d919bae0 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/IndexedCursor.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/IndexedCursor.java @@ -57,24 +57,34 @@ enum CursorReadOption { public final class IndexedCursor { /** a cursor to the top direction */ private Optional backwardCursor; + /** a cursor to the bottom direction */ private Optional forwardCursor; + /** a connection to the SQLite database */ private Connection conn; + /** firstFetch is true if and only if the cursor has not read any data yet */ private boolean firstFetch; + /** a position in buffers that stores the read data */ private int cursorIndex; + /** one of COB_EQ, COB_LT, COB_LE, COB_GT, COB_GE in CobolIndexedFile.java */ private int comparator; + /** isDuplicate is true if and only if the table key allows duplicates */ private boolean isDuplicate; + /** a key */ private byte[] key; + /** forwardBuffer stores data located to the bottom direction from the first read position */ List forwardBuffer; + /** bakckwardBuffer stores data located to the first direction from the first read position */ List backwardBuffer; + /** the index of the table */ private int tableIndex; From b9509d7d9c8f92de2ffa9df7dd77d74e692ec635 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Sep 2023 18:14:38 +0900 Subject: [PATCH 07/16] Fixed CobolFile.java --- .../jp/osscons/opensourcecobol/libcobj/file/CobolFile.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 054cc5c0..53e38bbe 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -257,8 +257,8 @@ public CobolFile( boolean flagNeedsTop, char fileVersion) { - CobolFile.select_name = selectName; - CobolFile.file_status = fileStatus; + select_name = selectName; + file_status = fileStatus; this.assign = assign; this.record = record; this.record_size = recordSize; From 4ae91c92569bc02bd0b9a1da8752f76def3881df Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Sep 2023 14:22:51 +0900 Subject: [PATCH 08/16] Fixed variable declaration. --- .../libcobj/common/CobolIntrinsic.java | 6 +++--- .../libcobj/file/CobolFile.java | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index 0e8983aa..eb368c0f 100755 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -1913,12 +1913,12 @@ public static AbstractCobolField funcExceptionFile() { makeFieldEntry(field); currField.memcpy("00", 2); } else { - flen = CobolFile.select_name.length(); + flen = CobolFile.getSelectName().length(); field.setSize(flen + 2); makeFieldEntry(field); data = new byte[2 + flen]; - System.arraycopy(CobolFile.file_status, 0, data, 0, 2); - System.arraycopy(CobolFile.select_name.getBytes(), 0, data, 2, flen); + System.arraycopy(CobolFile.getFileStatus(), 0, data, 0, 2); + System.arraycopy(CobolFile.getSelectName().getBytes(), 0, data, 2, flen); currField.setDataStorage(new CobolDataStorage(data)); } return currField; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 53e38bbe..c5284a8e 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -294,8 +294,8 @@ public CobolFile( protected void saveStatus(int status, AbstractCobolField fnstatus) { CobolFile.errorFile = this; if (status == 0) { - CobolFile.file_status[0] = '0'; - CobolFile.file_status[1] = '0'; + file_status[0] = '0'; + file_status[1] = '0'; if (fnstatus != null) { fnstatus.getDataStorage().setByte(0, (byte) '0'); fnstatus.getDataStorage().setByte(1, (byte) '0'); @@ -307,11 +307,11 @@ protected void saveStatus(int status, AbstractCobolField fnstatus) { if (status != COB_STATUS_52_EOP) { CobolRuntimeException.setException(status_exception[status / 10]); } - CobolFile.file_status[0] = (byte) (status / 10 + '0'); - CobolFile.file_status[1] = (byte) (status % 10 + '0'); + file_status[0] = (byte) (status / 10 + '0'); + file_status[1] = (byte) (status % 10 + '0'); if (fnstatus != null) { - fnstatus.getDataStorage().setByte(0, this.file_status[0]); - fnstatus.getDataStorage().setByte(1, this.file_status[1]); + fnstatus.getDataStorage().setByte(0, file_status[0]); + fnstatus.getDataStorage().setByte(1, file_status[1]); } } @@ -1521,11 +1521,13 @@ public void cob_delete_file(AbstractCobolField fnstatus) { } } - public String getSelectName() { + public static String getSelectName() { + // CobolFile cobolFile = new CobolFile(); return select_name; } - public byte[] getFileStatus() { + public static byte[] getFileStatus() { + // CobolFile cobolFile = new CobolFile(); return file_status; } } From 9050b495530551555cc886c924869726c34808e1 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Sep 2023 14:51:23 +0900 Subject: [PATCH 09/16] Formatted --- cobj/pplex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cobj/pplex.c b/cobj/pplex.c index afa2ec19..b681532a 100644 --- a/cobj/pplex.c +++ b/cobj/pplex.c @@ -4344,4 +4344,4 @@ void pp_set_current_division(int divno) { current_division = divno; } void pp_omit_data_entry_name(int on_off) { omit_data_entry_name = on_off; } -void pp_omit_data_redef_name(int on_off) { omit_data_redef_name = on_off; } \ No newline at end of file +void pp_omit_data_redef_name(int on_off) { omit_data_redef_name = on_off; } From 49aa7ae1296d50068229bd91419050dc7d31db08 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Sep 2023 14:56:43 +0900 Subject: [PATCH 10/16] Fixed CobolFile.java --- .../osscons/opensourcecobol/libcobj/file/CobolFile.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index c5284a8e..2f5a5252 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -184,8 +184,8 @@ public class CobolFile { CobolExceptionId.COB_EC_I_O, CobolExceptionId.COB_EC_I_O_IMP }; - public static String select_name; - public static byte[] file_status; + protected static String select_name; + protected static byte[] file_status; protected AbstractCobolField assign; protected AbstractCobolField record; protected AbstractCobolField record_size; @@ -257,8 +257,8 @@ public CobolFile( boolean flagNeedsTop, char fileVersion) { - select_name = selectName; - file_status = fileStatus; + this.select_name = selectName; + this.file_status = fileStatus; this.assign = assign; this.record = record; this.record_size = recordSize; From 6c35232bf60aa9a3911e72975be8a1e1e49da6ed Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Sep 2023 15:10:28 +0900 Subject: [PATCH 11/16] Fixed variable definition. --- .../libcobj/common/CobolIntrinsic.java | 6 +++--- .../opensourcecobol/libcobj/file/CobolFile.java | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index eb368c0f..2f37a1f0 100755 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -1913,12 +1913,12 @@ public static AbstractCobolField funcExceptionFile() { makeFieldEntry(field); currField.memcpy("00", 2); } else { - flen = CobolFile.getSelectName().length(); + flen = CobolFile.errorFile.getSelectName().length(); field.setSize(flen + 2); makeFieldEntry(field); data = new byte[2 + flen]; - System.arraycopy(CobolFile.getFileStatus(), 0, data, 0, 2); - System.arraycopy(CobolFile.getSelectName().getBytes(), 0, data, 2, flen); + System.arraycopy(CobolFile.errorFile.getFileStatus(), 0, data, 0, 2); + System.arraycopy(CobolFile.errorFile.getSelectName().getBytes(), 0, data, 2, flen); currField.setDataStorage(new CobolDataStorage(data)); } return currField; diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 2f5a5252..960614aa 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -184,8 +184,8 @@ public class CobolFile { CobolExceptionId.COB_EC_I_O, CobolExceptionId.COB_EC_I_O_IMP }; - protected static String select_name; - protected static byte[] file_status; + public String select_name; + public byte[] file_status; protected AbstractCobolField assign; protected AbstractCobolField record; protected AbstractCobolField record_size; @@ -219,6 +219,8 @@ public class CobolFile { protected char file_version; protected static String runtime_buffer; + protected static String name; + protected static byte[] status; public Linage getLinorkeyptr() { return this.linorkeyptr; @@ -1521,13 +1523,13 @@ public void cob_delete_file(AbstractCobolField fnstatus) { } } - public static String getSelectName() { + public String getSelectName() { // CobolFile cobolFile = new CobolFile(); - return select_name; + return this.select_name; } - public static byte[] getFileStatus() { + public byte[] getFileStatus() { // CobolFile cobolFile = new CobolFile(); - return file_status; + return this.file_status; } } From c238e734e2ea27b9d5018d8117b134c20ea1a7c7 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Sep 2023 15:17:19 +0900 Subject: [PATCH 12/16] Added FUNCTION EXCEPTION-FILE and FUNCTION EXCEPTION-FILE. --- cobj/pplex.c | 2 +- .../jp/osscons/opensourcecobol/libcobj/file/CobolFile.java | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/cobj/pplex.c b/cobj/pplex.c index b681532a..afa2ec19 100644 --- a/cobj/pplex.c +++ b/cobj/pplex.c @@ -4344,4 +4344,4 @@ void pp_set_current_division(int divno) { current_division = divno; } void pp_omit_data_entry_name(int on_off) { omit_data_entry_name = on_off; } -void pp_omit_data_redef_name(int on_off) { omit_data_redef_name = on_off; } +void pp_omit_data_redef_name(int on_off) { omit_data_redef_name = on_off; } \ No newline at end of file diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 960614aa..8035c0f9 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -219,8 +219,6 @@ public class CobolFile { protected char file_version; protected static String runtime_buffer; - protected static String name; - protected static byte[] status; public Linage getLinorkeyptr() { return this.linorkeyptr; @@ -1524,12 +1522,10 @@ public void cob_delete_file(AbstractCobolField fnstatus) { } public String getSelectName() { - // CobolFile cobolFile = new CobolFile(); return this.select_name; } public byte[] getFileStatus() { - // CobolFile cobolFile = new CobolFile(); return this.file_status; } } From c1eb1644376b2c7034b1d6dca6f988a38d823800 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 6 Sep 2023 15:10:14 +0900 Subject: [PATCH 13/16] Minor corrections were made. --- .../libcobj/common/CobolIntrinsic.java | 2 +- .../opensourcecobol/libcobj/file/CobolFile.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) mode change 100644 => 100755 libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index 2f37a1f0..6bed048b 100755 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -1936,7 +1936,7 @@ public static AbstractCobolField funcExceptionLocation() { new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); currField = field; - if (CobolRuntimeException.getException() != 1 + if (CobolRuntimeException.getExceptionCode() != 1 || CobolRuntimeException.getOrigProgramId() == null) { field.setSize(1); makeFieldEntry(field); diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java old mode 100644 new mode 100755 index 8035c0f9..8f173b9e --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -294,8 +294,8 @@ public CobolFile( protected void saveStatus(int status, AbstractCobolField fnstatus) { CobolFile.errorFile = this; if (status == 0) { - file_status[0] = '0'; - file_status[1] = '0'; + this.file_status[0] = '0'; + this.file_status[1] = '0'; if (fnstatus != null) { fnstatus.getDataStorage().setByte(0, (byte) '0'); fnstatus.getDataStorage().setByte(1, (byte) '0'); @@ -307,11 +307,11 @@ protected void saveStatus(int status, AbstractCobolField fnstatus) { if (status != COB_STATUS_52_EOP) { CobolRuntimeException.setException(status_exception[status / 10]); } - file_status[0] = (byte) (status / 10 + '0'); - file_status[1] = (byte) (status % 10 + '0'); + this.file_status[0] = (byte) (status / 10 + '0'); + this.file_status[1] = (byte) (status % 10 + '0'); if (fnstatus != null) { - fnstatus.getDataStorage().setByte(0, file_status[0]); - fnstatus.getDataStorage().setByte(1, file_status[1]); + fnstatus.getDataStorage().setByte(0, this.file_status[0]); + fnstatus.getDataStorage().setByte(1, this.file_status[1]); } } From c684ecbcc230b3b8a90d46a65256a8ac122707d3 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 6 Sep 2023 15:20:18 +0900 Subject: [PATCH 14/16] Revert "Added FUNCTION EXCEPTION-FILE and FUNCTION EXCEPTION-FILE." This reverts commit c238e734e2ea27b9d5018d8117b134c20ea1a7c7. --- cobj/pplex.c | 2 +- .../jp/osscons/opensourcecobol/libcobj/file/CobolFile.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cobj/pplex.c b/cobj/pplex.c index afa2ec19..b681532a 100644 --- a/cobj/pplex.c +++ b/cobj/pplex.c @@ -4344,4 +4344,4 @@ void pp_set_current_division(int divno) { current_division = divno; } void pp_omit_data_entry_name(int on_off) { omit_data_entry_name = on_off; } -void pp_omit_data_redef_name(int on_off) { omit_data_redef_name = on_off; } \ No newline at end of file +void pp_omit_data_redef_name(int on_off) { omit_data_redef_name = on_off; } diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java index 8f173b9e..3851ee49 100755 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolFile.java @@ -219,6 +219,8 @@ public class CobolFile { protected char file_version; protected static String runtime_buffer; + protected static String name; + protected static byte[] status; public Linage getLinorkeyptr() { return this.linorkeyptr; @@ -1522,10 +1524,12 @@ public void cob_delete_file(AbstractCobolField fnstatus) { } public String getSelectName() { + // CobolFile cobolFile = new CobolFile(); return this.select_name; } public byte[] getFileStatus() { + // CobolFile cobolFile = new CobolFile(); return this.file_status; } } From 2591f504eef442012de1220a345928f1b59559e8 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 6 Sep 2023 15:37:35 +0900 Subject: [PATCH 15/16] Minor corrections were made. --- .../opensourcecobol/libcobj/common/CobolIntrinsic.java | 4 ++-- .../jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java | 0 .../libcobj/exceptions/CobolRuntimeException.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java mode change 100644 => 100755 libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index 6bed048b..39f9deb2 100755 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -1907,7 +1907,7 @@ public static AbstractCobolField funcExceptionFile() { CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); - if (CobolRuntimeException.getExceptionCode() == 0 + if (CobolRuntimeException.getException() == 0 || (CobolRuntimeException.getExceptionCode() & 0x0500) != 0x0500) { field.setSize(2); makeFieldEntry(field); @@ -1936,7 +1936,7 @@ public static AbstractCobolField funcExceptionLocation() { new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); currField = field; - if (CobolRuntimeException.getExceptionCode() != 1 + if (CobolRuntimeException.getException() != 1 || CobolRuntimeException.getOrigProgramId() == null) { field.setSize(1); makeFieldEntry(field); diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java old mode 100644 new mode 100755 diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java old mode 100644 new mode 100755 index 310794b9..c42f5c0b --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/exceptions/CobolRuntimeException.java @@ -78,10 +78,10 @@ public void printStackTrace() { public static void setException(int id) { code = CobolExceptionTabCode.code[id]; cob_got_exception = 1; + cob_orig_line = CobolUtil.getSourceLine(); cob_orig_program_id = CobolUtil.getCurrProgramId(); cob_orig_section = CobolUtil.getCurrSection(); cob_orig_paragraph = CobolUtil.getCurrParagraph(); - cob_orig_line = CobolUtil.getSourceLine(); // TODO common.c実装に残りをやる } From 366c6777bedd1fe0fd470354556205aa6cc78b23 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 7 Sep 2023 13:50:05 +0900 Subject: [PATCH 16/16] Minor corrections were made. --- .../opensourcecobol/libcobj/common/CobolIntrinsic.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index 39f9deb2..b5e348fe 100755 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -47,6 +47,7 @@ public class CobolIntrinsic { private static AbstractCobolField[] calcField = new AbstractCobolField[DEPTH_LEVEL]; private static Random random = new Random(); private static byte[] localeBuff; + private static final byte[] byteArray00 = "00".getBytes(); /** libcob/intrinsicのmake_double_entryの実装 */ private static void makeDoubleEntry() { @@ -1911,7 +1912,7 @@ public static AbstractCobolField funcExceptionFile() { || (CobolRuntimeException.getExceptionCode() & 0x0500) != 0x0500) { field.setSize(2); makeFieldEntry(field); - currField.memcpy("00", 2); + currField.memcpy(byteArray00, 2); } else { flen = CobolFile.errorFile.getSelectName().length(); field.setSize(flen + 2); @@ -1930,8 +1931,8 @@ public static AbstractCobolField funcExceptionFile() { * @return */ public static AbstractCobolField funcExceptionLocation() { - String data; String buff; + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); @@ -1940,8 +1941,7 @@ public static AbstractCobolField funcExceptionLocation() { || CobolRuntimeException.getOrigProgramId() == null) { field.setSize(1); makeFieldEntry(field); - data = String.valueOf(' '); - currField.memcpy(data.getBytes(), 1); + currField.getDataStorage().setByte(0, ' '); return currField; } if (CobolRuntimeException.getOrigSection() != null