File tree Expand file tree Collapse file tree
libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/data Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3124,7 +3124,7 @@ static void joutput_call(struct cb_call *p) {
31243124 joutput ("CobolDataStorage.primitiveToDataStorage(%d)" ,
31253125 cb_get_int (x ));
31263126 } else {
3127- joutput ("CobolDataStroage .primitiveToDataStorage(%d)" ,
3127+ joutput ("CobolDataStorage .primitiveToDataStorage(%d)" ,
31283128 CB_LITERAL (x )-> data [0 ]);
31293129 }
31303130 break ;
@@ -3146,11 +3146,6 @@ static void joutput_call(struct cb_call *p) {
31463146 case CB_USAGE_DISPLAY :
31473147 sizes = CB_SIZES_INT (l );
31483148 if (sizes == CB_SIZE_AUTO ) {
3149- if (f -> pic -> have_sign ) {
3150- joutput ("(unsigned " );
3151- } else {
3152- joutput ("(" );
3153- }
31543149 if (f -> usage == CB_USAGE_PACKED || f -> usage == CB_USAGE_DISPLAY ) {
31553150 sizes = f -> pic -> digits - f -> pic -> scale ;
31563151 } else {
@@ -3185,33 +3180,34 @@ static void joutput_call(struct cb_call *p) {
31853180 sizes = CB_SIZE_8 ;
31863181 break ;
31873182 }
3188- } else {
3189- if (CB_SIZES_INT_UNSIGNED (l )) {
3190- joutput ("(unsigned " );
3191- } else {
3192- joutput ("(" );
3193- }
31943183 }
31953184 switch (sizes ) {
31963185 case CB_SIZE_1 :
3197- joutput ("char" );
3186+ joutput ("CobolDataStorage.primitiveToDataStorage((byte)(" );
3187+ joutput_integer (x );
3188+ joutput ("))" );
31983189 break ;
31993190 case CB_SIZE_2 :
3200- joutput ("short" );
3191+ joutput ("CobolDataStorage.primitiveToDataStorage((short)(" );
3192+ joutput_integer (x );
3193+ joutput ("))" );
32013194 break ;
32023195 case CB_SIZE_4 :
3203- joutput ("int" );
3196+ joutput ("CobolDataStorage.primitiveToDataStorage((int)(" );
3197+ joutput_integer (x );
3198+ joutput ("))" );
32043199 break ;
32053200 case CB_SIZE_8 :
3206- joutput ("long long" );
3201+ joutput ("CobolDataStorage.primitiveToDataStorage((long)(" );
3202+ joutput_integer (x );
3203+ joutput ("))" );
32073204 break ;
32083205 default :
3209- joutput ("int" );
3206+ joutput ("CobolDataStorage.primitiveToDataStorage((int)(" );
3207+ joutput_integer (x );
3208+ joutput ("))" );
32103209 break ;
32113210 }
3212- joutput (")(" );
3213- joutput_integer (x );
3214- joutput (")" );
32153211 break ;
32163212 case CB_USAGE_INDEX :
32173213 case CB_USAGE_LENGTH :
@@ -3224,6 +3220,9 @@ static void joutput_call(struct cb_call *p) {
32243220 joutput (")" );
32253221 break ;
32263222 default :
3223+ /* FIXME: COMP-1 / COMP-2を使うとここを通ることがある
3224+ * COMP-1 / COMP-2を実装するときにここも見直す必要がある
3225+ */
32273226 joutput ("*(" );
32283227 joutput_data (x );
32293228 joutput (")" );
Original file line number Diff line number Diff line change @@ -149,6 +149,31 @@ public void addIndex(int n) {
149149 this .index += n ;
150150 }
151151
152+ /**
153+ * TODO: 準備中
154+ *
155+ * @param n TODO: 準備中
156+ * @return TODO: 準備中
157+ */
158+ public static CobolDataStorage primitiveToDataStorage (byte n ) {
159+ byte [] bytes = new byte [1 ];
160+ bytes [0 ] = n ;
161+ return new CobolDataStorage (bytes );
162+ }
163+
164+ /**
165+ * TODO: 準備中
166+ *
167+ * @param n TODO: 準備中
168+ * @return TODO: 準備中
169+ */
170+ public static CobolDataStorage primitiveToDataStorage (short n ) {
171+ byte [] bytes = new byte [2 ];
172+ ByteBuffer buffer = ByteBuffer .wrap (bytes );
173+ buffer .putShort (n );
174+ return new CobolDataStorage (bytes );
175+ }
176+
152177 /**
153178 * TODO: 準備中
154179 *
You can’t perform that action at this time.
0 commit comments