Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (C) 2002-2009 Keisuke Nishida
* Copyright (C) 2007-2009 Roger While
* Copyright (C) 2020 TOKYO SYSTEM HOUSE Co., Ltd.
*
g
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
Expand Down Expand Up @@ -1996,9 +1996,9 @@ joutput_initialize_one (struct cb_initialize *p, cb_tree x)
CB_REFERENCE (tmpx)->offset = cb_build_numeric_literal (0, (unsigned char *)"1", 1);
CB_REFERENCE (tmpx)->subs = CB_REFERENCE (x)->subs;

joutput_param (value, 1);
joutput (".moveFrom(");
joutput_param ((cb_tree)tmpx, 2);
joutput (".moveFrom(");
joutput_param (value, 1);
joutput (");\n");

return;
Expand Down Expand Up @@ -3434,7 +3434,7 @@ joutput_stmt (cb_tree x)
if (x->source_file && last_line != x->source_line) {
if (cb_flag_source_location) {
joutput_prefix ();
joutput ("cob_set_location (\"%s\", \"%s\", %d, ",
joutput ("CobolUtil.setLocation (\"%s\", \"%s\", %d, ",
excp_current_program_id, x->source_file,
x->source_line);
if (excp_current_section) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class CobolConstant {
public static final CobolFieldAttribute oneAttr = new CobolFieldAttribute(
CobolFieldAttribute.COB_TYPE_NUMERIC, 1, 0, 0, null);

public static final byte[] SJZERO = {(byte)0x81, (byte)0x4f};
public static final byte[] SJZERO = {(byte)0x82, (byte)0x4f};
public static final byte[] SJSPC = {(byte)0x81, (byte)0x40};
public static final byte[] SJBLK = {(byte)0x81, (byte)0x40};
public static final byte[] SJQUOT = {(byte)0x81, (byte)0x68};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private static void common(AbstractCobolField f1, AbstractCobolField f2, int typ
int type1 = f1.getAttribute().getType();
int type2 = f2.getAttribute().getType();

if(type2 == CobolFieldAttribute.COB_TYPE_NATIONAL || type2 == CobolFieldAttribute.COB_TYPE_NATIONAL_ALL) {
if(type2 == CobolFieldAttribute.COB_TYPE_NATIONAL || type2 == CobolFieldAttribute.COB_TYPE_NATIONAL_EDITED) {
if(f1 == CobolConstant.quote) {
f1 = CobolConstant.zenQuote;
} else if(f1 == CobolConstant.space) {
Expand All @@ -61,7 +61,7 @@ private static void common(AbstractCobolField f1, AbstractCobolField f2, int typ
f1 = CobolConstant.zenZero;
}
}
if(type1 == CobolFieldAttribute.COB_TYPE_NATIONAL || type1 == CobolFieldAttribute.COB_TYPE_NATIONAL_ALL) {
if(type1 == CobolFieldAttribute.COB_TYPE_NATIONAL || type1 == CobolFieldAttribute.COB_TYPE_NATIONAL_EDITED) {
if(f2 == CobolConstant.quote) {
f2 = CobolConstant.zenQuote;
} else if(f2 == CobolConstant.space) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import jp.osscons.opensourcecobol.libcobj.data.CobolDecimal;
import jp.osscons.opensourcecobol.libcobj.data.CobolFieldAttribute;
import jp.osscons.opensourcecobol.libcobj.data.CobolFieldFactory;
import jp.osscons.opensourcecobol.libcobj.data.CobolNationalField;
import jp.osscons.opensourcecobol.libcobj.exceptions.CobolExceptionId;
import jp.osscons.opensourcecobol.libcobj.exceptions.CobolRuntimeException;
import jp.osscons.opensourcecobol.libcobj.exceptions.CobolStopRunException;
Expand Down Expand Up @@ -1491,4 +1492,22 @@ public static AbstractCobolField funcPresentValue(int prams, AbstractCobolField.
d4.getField(currField, 0);
return currField;
}

/**
* libcob/intrinsicのcob_intr_present_valueの実装
* @param prams
* @param fields
* @return
* @throws CobolStopRunException
*/
public static AbstractCobolField funcNational(AbstractCobolField srcfield) {
int size = srcfield.getSize();
byte[] pdata = CobolNationalField.han2zen(srcfield.getDataStorage().getByteBuffer(size).array(), size);
int ndata = CobolNationalField.workReturnSize;
CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NATIONAL, 0, 0, 0, null);
AbstractCobolField field = CobolFieldFactory.makeCobolField(ndata, (CobolDataStorage)null, attr);
makeFieldEntry(field);
currField.getDataStorage().memcpy(pdata, ndata);
return currField;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -623,4 +623,8 @@ public static void fatalError(int fatalError) throws CobolStopRunException {
}
CobolStopRunException.stopRunAndThrow(1);
}

public static void setLocation(String progid, String sfile, int sline, String csert, String cpara, String cstatement) {
//TODO implement
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,13 @@ protected AbstractCobolField preprocessOfMoving(AbstractCobolField src) {
return src;
}

private class TmpTuple {
public static class TmpTuple {
public CobolDataStorage storage;
public int size;
TmpTuple(CobolDataStorage storage, int size) {
this.storage = storage;
this.size = size;
}
}

protected void moveFromAll(AbstractCobolField src) {
Expand All @@ -506,12 +510,12 @@ protected void moveFromAll(AbstractCobolField src) {
CobolFieldAttribute attr;
int digcount;

if((!src.getAttribute().isTypeNational() || src.getAttribute().isTypeNationalEdited()) &&
if(!(src.getAttribute().isTypeNational() || src.getAttribute().isTypeNationalEdited()) &&
(this.attribute.isTypeNational() || this.attribute.isTypeNationalEdited())) {
CobolDataStorage pTmp;
TmpTuple tuple = this.judgeHankakujpnExist(src, size);
pTmp = tuple.storage;
size = tuple.size;
byte[] pBytes = CobolNationalField.judge_hankakujpn_exist(src);
pTmp = new CobolDataStorage(pBytes);
size = CobolNationalField.workReturnSize;
if(pTmp != null) {
tmpSrcStorage = pTmp;
tmpSrcSize = size;
Expand Down Expand Up @@ -553,20 +557,16 @@ protected void moveFromAll(AbstractCobolField src) {
lastdata.setByte(i, src.getDataStorage().getByte(i % src.getSize()));
}

if((0x81 <= lastdata.getByte(i - 1) && lastdata.getByte(i - 1) <= 0x9F) ||
(0xE0 <= lastdata.getByte(i - 1) && lastdata.getByte(i - 1) <= 0xFC)) {
int b = Byte.toUnsignedInt(lastdata.getByte(i - 1));
if((0x81 <= b && b <= 0x9F) ||
(0xE0 <= b && b <= 0xFC)) {
lastdata.setByte(i - 1, (byte)' ');
}
}
}
this.moveFrom(temp);
}

private TmpTuple judgeHankakujpnExist(AbstractCobolField src, int size) {
TmpTuple ret = new TmpTuple();
return ret;
}

/**
* 引数で与えらえられたデータからthisへの代入を行う
* @param field 代入元のデータ(AbstractCobolField型)
Expand Down
Loading