Skip to content

Commit 05c6eeb

Browse files
authored
Merge pull request #20 from opensourcecobol/dev/y-sakamoto
PIC N項目のテストに対応した.漏れていたファイルを追加した
2 parents eafbf14 + 6ee77b8 commit 05c6eeb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4093
-6291
lines changed

cobc/codegen.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (C) 2002-2009 Keisuke Nishida
33
* Copyright (C) 2007-2009 Roger While
44
* Copyright (C) 2020 TOKYO SYSTEM HOUSE Co., Ltd.
5-
*
5+
g
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
88
* the Free Software Foundation; either version 2, or (at your option)
@@ -1996,9 +1996,9 @@ joutput_initialize_one (struct cb_initialize *p, cb_tree x)
19961996
CB_REFERENCE (tmpx)->offset = cb_build_numeric_literal (0, (unsigned char *)"1", 1);
19971997
CB_REFERENCE (tmpx)->subs = CB_REFERENCE (x)->subs;
19981998

1999-
joutput_param (value, 1);
2000-
joutput (".moveFrom(");
20011999
joutput_param ((cb_tree)tmpx, 2);
2000+
joutput (".moveFrom(");
2001+
joutput_param (value, 1);
20022002
joutput (");\n");
20032003

20042004
return;
@@ -3434,7 +3434,7 @@ joutput_stmt (cb_tree x)
34343434
if (x->source_file && last_line != x->source_line) {
34353435
if (cb_flag_source_location) {
34363436
joutput_prefix ();
3437-
joutput ("cob_set_location (\"%s\", \"%s\", %d, ",
3437+
joutput ("CobolUtil.setLocation (\"%s\", \"%s\", %d, ",
34383438
excp_current_program_id, x->source_file,
34393439
x->source_line);
34403440
if (excp_current_section) {

libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolConstant.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class CobolConstant {
1111
public static final CobolFieldAttribute oneAttr = new CobolFieldAttribute(
1212
CobolFieldAttribute.COB_TYPE_NUMERIC, 1, 0, 0, null);
1313

14-
public static final byte[] SJZERO = {(byte)0x81, (byte)0x4f};
14+
public static final byte[] SJZERO = {(byte)0x82, (byte)0x4f};
1515
public static final byte[] SJSPC = {(byte)0x81, (byte)0x40};
1616
public static final byte[] SJBLK = {(byte)0x81, (byte)0x40};
1717
public static final byte[] SJQUOT = {(byte)0x81, (byte)0x68};

libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolInspect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private static void common(AbstractCobolField f1, AbstractCobolField f2, int typ
5252
int type1 = f1.getAttribute().getType();
5353
int type2 = f2.getAttribute().getType();
5454

55-
if(type2 == CobolFieldAttribute.COB_TYPE_NATIONAL || type2 == CobolFieldAttribute.COB_TYPE_NATIONAL_ALL) {
55+
if(type2 == CobolFieldAttribute.COB_TYPE_NATIONAL || type2 == CobolFieldAttribute.COB_TYPE_NATIONAL_EDITED) {
5656
if(f1 == CobolConstant.quote) {
5757
f1 = CobolConstant.zenQuote;
5858
} else if(f1 == CobolConstant.space) {
@@ -61,7 +61,7 @@ private static void common(AbstractCobolField f1, AbstractCobolField f2, int typ
6161
f1 = CobolConstant.zenZero;
6262
}
6363
}
64-
if(type1 == CobolFieldAttribute.COB_TYPE_NATIONAL || type1 == CobolFieldAttribute.COB_TYPE_NATIONAL_ALL) {
64+
if(type1 == CobolFieldAttribute.COB_TYPE_NATIONAL || type1 == CobolFieldAttribute.COB_TYPE_NATIONAL_EDITED) {
6565
if(f2 == CobolConstant.quote) {
6666
f2 = CobolConstant.zenQuote;
6767
} else if(f2 == CobolConstant.space) {

libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import jp.osscons.opensourcecobol.libcobj.data.CobolDecimal;
1212
import jp.osscons.opensourcecobol.libcobj.data.CobolFieldAttribute;
1313
import jp.osscons.opensourcecobol.libcobj.data.CobolFieldFactory;
14+
import jp.osscons.opensourcecobol.libcobj.data.CobolNationalField;
1415
import jp.osscons.opensourcecobol.libcobj.exceptions.CobolExceptionId;
1516
import jp.osscons.opensourcecobol.libcobj.exceptions.CobolRuntimeException;
1617
import jp.osscons.opensourcecobol.libcobj.exceptions.CobolStopRunException;
@@ -1491,4 +1492,22 @@ public static AbstractCobolField funcPresentValue(int prams, AbstractCobolField.
14911492
d4.getField(currField, 0);
14921493
return currField;
14931494
}
1495+
1496+
/**
1497+
* libcob/intrinsicのcob_intr_present_valueの実装
1498+
* @param prams
1499+
* @param fields
1500+
* @return
1501+
* @throws CobolStopRunException
1502+
*/
1503+
public static AbstractCobolField funcNational(AbstractCobolField srcfield) {
1504+
int size = srcfield.getSize();
1505+
byte[] pdata = CobolNationalField.han2zen(srcfield.getDataStorage().getByteBuffer(size).array(), size);
1506+
int ndata = CobolNationalField.workReturnSize;
1507+
CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NATIONAL, 0, 0, 0, null);
1508+
AbstractCobolField field = CobolFieldFactory.makeCobolField(ndata, (CobolDataStorage)null, attr);
1509+
makeFieldEntry(field);
1510+
currField.getDataStorage().memcpy(pdata, ndata);
1511+
return currField;
1512+
}
14941513
}

libcobj/src/jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,4 +623,8 @@ public static void fatalError(int fatalError) throws CobolStopRunException {
623623
}
624624
CobolStopRunException.stopRunAndThrow(1);
625625
}
626+
627+
public static void setLocation(String progid, String sfile, int sline, String csert, String cpara, String cstatement) {
628+
//TODO implement
629+
}
626630
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,13 @@ protected AbstractCobolField preprocessOfMoving(AbstractCobolField src) {
493493
return src;
494494
}
495495

496-
private class TmpTuple {
496+
public static class TmpTuple {
497497
public CobolDataStorage storage;
498498
public int size;
499+
TmpTuple(CobolDataStorage storage, int size) {
500+
this.storage = storage;
501+
this.size = size;
502+
}
499503
}
500504

501505
protected void moveFromAll(AbstractCobolField src) {
@@ -506,12 +510,12 @@ protected void moveFromAll(AbstractCobolField src) {
506510
CobolFieldAttribute attr;
507511
int digcount;
508512

509-
if((!src.getAttribute().isTypeNational() || src.getAttribute().isTypeNationalEdited()) &&
513+
if(!(src.getAttribute().isTypeNational() || src.getAttribute().isTypeNationalEdited()) &&
510514
(this.attribute.isTypeNational() || this.attribute.isTypeNationalEdited())) {
511515
CobolDataStorage pTmp;
512-
TmpTuple tuple = this.judgeHankakujpnExist(src, size);
513-
pTmp = tuple.storage;
514-
size = tuple.size;
516+
byte[] pBytes = CobolNationalField.judge_hankakujpn_exist(src);
517+
pTmp = new CobolDataStorage(pBytes);
518+
size = CobolNationalField.workReturnSize;
515519
if(pTmp != null) {
516520
tmpSrcStorage = pTmp;
517521
tmpSrcSize = size;
@@ -553,20 +557,16 @@ protected void moveFromAll(AbstractCobolField src) {
553557
lastdata.setByte(i, src.getDataStorage().getByte(i % src.getSize()));
554558
}
555559

556-
if((0x81 <= lastdata.getByte(i - 1) && lastdata.getByte(i - 1) <= 0x9F) ||
557-
(0xE0 <= lastdata.getByte(i - 1) && lastdata.getByte(i - 1) <= 0xFC)) {
560+
int b = Byte.toUnsignedInt(lastdata.getByte(i - 1));
561+
if((0x81 <= b && b <= 0x9F) ||
562+
(0xE0 <= b && b <= 0xFC)) {
558563
lastdata.setByte(i - 1, (byte)' ');
559564
}
560565
}
561566
}
562567
this.moveFrom(temp);
563568
}
564569

565-
private TmpTuple judgeHankakujpnExist(AbstractCobolField src, int size) {
566-
TmpTuple ret = new TmpTuple();
567-
return ret;
568-
}
569-
570570
/**
571571
* 引数で与えらえられたデータからthisへの代入を行う
572572
* @param field 代入元のデータ(AbstractCobolField型)

0 commit comments

Comments
 (0)