Skip to content

Commit 711b2b6

Browse files
Merge pull request #102 from opensourcecobol/develop
v1.0.11
2 parents d891895 + 761ecca commit 711b2b6

36 files changed

+502
-252
lines changed

.github/workflows/cicd.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
- name: Run NIST test
9191
run: |
9292
export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar"
93-
cd tests/cobol85/
93+
cd tests/cobol85
9494
make test
9595
9696
#- name: Run tests "i18n_utf8"

.github/workflows/codeql.yml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "develop" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "develop" ]
20+
21+
jobs:
22+
analyze:
23+
name: Analyze
24+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
25+
permissions:
26+
actions: read
27+
contents: read
28+
security-events: write
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
language: [ 'cpp', 'java' ]
34+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
35+
# Use only 'java' to analyze code written in Java, Kotlin or both
36+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
# - name: Autobuild
59+
# uses: github/codeql-action/autobuild@v2
60+
61+
- name: Install dependencies on Ubuntu 22.04
62+
run: |
63+
sudo apt-get update -y
64+
sudo apt-get install -y default-jdk build-essential bison flex gettext texinfo automake autoconf
65+
66+
- name: Install opensource COBOL 4J
67+
run: |
68+
mkdir ~/.java_lib
69+
curl -L -o ~/.java_lib/sqlite.jar https://github.com/xerial/sqlite-jdbc/releases/download/3.36.0.3/sqlite-jdbc-3.36.0.3.jar
70+
export CLASSPATH=":$HOME/.java_lib/sqlite.jar"
71+
./configure --prefix=/usr/
72+
make
73+
sudo make install
74+
export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar"
75+
76+
# ℹ️ Command-line programs to run using the OS shell.
77+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
78+
79+
# If the Autobuild fails above, remove it and uncomment the following three lines.
80+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
81+
82+
# - run: |
83+
# echo "Run, Build Application using script"
84+
# ./location_of_script_within_repo/buildscript.sh
85+
86+
- name: Perform CodeQL Analysis
87+
uses: github/codeql-action/analyze@v2
88+
with:
89+
category: "/language:${{matrix.language}}"

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2023-05-31 OSS Consortium <ws-opensource-cobol-contact@osscons.jp>
2+
3+
* opensource COBOL 4J v1.0.11 released.
4+
15
2023-04-28 OSS Consortium <ws-opensource-cobol-contact@osscons.jp>
26

37
* opensource COBOL 4J v1.0.10 released.

NEWS

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ NEWS - user visible changes -*- outline -*-
22

33
-----------------------------------------------------------------------
44

5+
* opensource COBOL 4J 1.0.11
6+
7+
** New Features
8+
(1) Add -j and -java-source-dir options to control the file paths where Java files are generated
9+
(2) Add -o and -class-file-dir options to control the file paths where class files are generated
10+
11+
** Bug fixes
12+
(1) Fix a bug related to RELATIVE files
13+
(2) Fix a minor bug
14+
15+
-----------------------------------------------------------------------
16+
517
* opensource COBOL 4J 1.0.10
618

719
** Bug fixes

cobj/cobj.c

+21-5
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ static pid_t cob_process_id = 0;
229229
static int strip_output = 0;
230230
static int gflag_set = 0;
231231

232-
static char *output_name;
232+
static char *output_name = NULL;
233+
static char *java_source_dir = NULL;
233234

234235
static const char *cob_tmpdir; /* /tmp */
235236

@@ -248,7 +249,7 @@ static cob_sighandler_t intsig = NULL;
248249
static cob_sighandler_t qutsig = NULL;
249250
#endif
250251

251-
static const char short_options[] = "hVvECbmxgwo:t:I:L:l:D:";
252+
static const char short_options[] = "hVvECbmxgwo:j:t:I:L:l:D:";
252253

253254
static const struct option long_options[] = {
254255
{"help", no_argument, NULL, 'h'},
@@ -264,6 +265,8 @@ static const struct option long_options[] = {
264265
{"std", required_argument, NULL, '$'},
265266
{"conf", required_argument, NULL, '&'},
266267
{"debug", no_argument, NULL, 'd'},
268+
{"class-file-dir", optional_argument, NULL, 'o'},
269+
{"java-source-dir", optional_argument, NULL, 'j'},
267270
{"ext", required_argument, NULL, 'e'},
268271
{"free", no_argument, &cb_source_format, CB_FORMAT_FREE},
269272
{"free_1col_aster", no_argument, &cb_source_format,
@@ -762,6 +765,8 @@ static void cobc_print_usage(void) {
762765
puts(_(" -free_1col_aster Use free(1col_aster) source "
763766
"format"));
764767
puts(_(" -g Enable Java compiler debug"));
768+
puts(_(" -o <dir>, -class-file-dir=<dir> Place class files into <dir>"));
769+
puts(_(" -j <dir>, -java-source-dir=<dir> Place Java files into <dir>"));
765770
puts(_(" -E Preprocess only; do not compile "
766771
"or link"));
767772
puts(_(" -C Translation only; convert COBOL "
@@ -916,10 +921,17 @@ static int process_command_line(const int argc, char *argv[]) {
916921
break;
917922

918923
case 'o':
919-
/* -o : Output file */
924+
/* -o : the directory where class files are stored */
925+
/* -class-file-dir : the directory where class files are stored */
920926
output_name = strdup(optarg);
921927
break;
922928

929+
case 'j':
930+
/* -j : the directory where java files are stored */
931+
/* -java-source-dir : the directory where java files are stored */
932+
java_source_dir = strdup(optarg);
933+
break;
934+
923935
case 'g':
924936
/* -g : Generate C debug code */
925937
save_csrc = 1;
@@ -1593,7 +1605,8 @@ static int process_translate(struct filename *fn) {
15931605
for (int i = 0; i < PROGRAM_ID_LIST_MAX_LEN; ++i) {
15941606
program_id_list[i] = NULL;
15951607
}
1596-
codegen(p, 0, program_id_list);
1608+
codegen(p, 0, program_id_list,
1609+
java_source_dir == NULL ? "./" : java_source_dir);
15971610

15981611
return 0;
15991612
}
@@ -1616,7 +1629,10 @@ static int process_compile(struct filename *fn) {
16161629
}
16171630

16181631
for (char **program_id = program_id_list; *program_id; ++program_id) {
1619-
sprintf(buff, "javac %s -encoding SJIS -d . %s.java", cob_java_flags,
1632+
char *java_source_dir_a = java_source_dir == NULL ? "./" : java_source_dir;
1633+
char *output_name_a = output_name == NULL ? "./" : output_name;
1634+
sprintf(buff, "javac %s -encoding SJIS -sourcepath %s -d %s %s/%s.java",
1635+
cob_java_flags, java_source_dir_a, output_name_a, java_source_dir_a,
16201636
*program_id);
16211637
ret = process(buff);
16221638
}

cobj/codegen.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -5512,8 +5512,8 @@ void joutput_execution_entry_func() {
55125512
joutput_line("}");
55135513
}
55145514

5515-
void codegen(struct cb_program *prog, const int nested,
5516-
char **program_id_list) {
5515+
void codegen(struct cb_program *prog, const int nested, char **program_id_list,
5516+
char *java_source_dir) {
55175517
int i;
55185518
cb_tree l;
55195519
struct field_list *k;
@@ -5545,8 +5545,8 @@ void codegen(struct cb_program *prog, const int nested,
55455545

55465546
// modify 8/29 11:00
55475547
joutput_target = yyout;
5548-
char java_file_name[64];
5549-
sprintf(java_file_name, "%s.java", prog->program_id);
5548+
char java_file_name[1024];
5549+
sprintf(java_file_name, "%s/%s.java", java_source_dir, prog->program_id);
55505550
*program_id_list = (char *)prog->program_id;
55515551
joutput_target = fopen(java_file_name, "w");
55525552

@@ -5834,7 +5834,7 @@ void codegen(struct cb_program *prog, const int nested,
58345834
joutput_line("}");
58355835
fclose(joutput_target);
58365836
++program_id_list;
5837-
codegen(prog->next_program, 1, program_id_list);
5837+
codegen(prog->next_program, 1, program_id_list, java_source_dir);
58385838
return;
58395839
}
58405840

cobj/tree.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ extern void cobc_tree_cast_error(cb_tree x, const char *filen,
15681568

15691569
/* codegen.c */
15701570
extern void codegen(struct cb_program *prog, const int nested,
1571-
char **program_id_list);
1571+
char **program_id_list, char *java_source_dir);
15721572

15731573
/* scanner.l */
15741574
extern void cb_set_in_procedure(void);

configure

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for opensource COBOL 4J 1.0.10.
3+
# Generated by GNU Autoconf 2.71 for opensource COBOL 4J 1.0.11.
44
#
55
# Report bugs to <ws-opensource-cobol-contact@osscons.jp>.
66
#
@@ -620,9 +620,9 @@ MAKEFLAGS=
620620

621621
# Identity of this package.
622622
PACKAGE_NAME='opensource COBOL 4J'
623-
PACKAGE_TARNAME='opensource-cobol-4j-1.0.10'
624-
PACKAGE_VERSION='1.0.10'
625-
PACKAGE_STRING='opensource COBOL 4J 1.0.10'
623+
PACKAGE_TARNAME='opensource-cobol-4j-1.0.11'
624+
PACKAGE_VERSION='1.0.11'
625+
PACKAGE_STRING='opensource COBOL 4J 1.0.11'
626626
PACKAGE_BUGREPORT='ws-opensource-cobol-contact@osscons.jp'
627627
PACKAGE_URL=''
628628

@@ -1414,7 +1414,7 @@ if test "$ac_init_help" = "long"; then
14141414
# Omit some internal or obsolete options to make the list less imposing.
14151415
# This message is too long to be a string in the A/UX 3.1 sh.
14161416
cat <<_ACEOF
1417-
\`configure' configures opensource COBOL 4J 1.0.10 to adapt to many kinds of systems.
1417+
\`configure' configures opensource COBOL 4J 1.0.11 to adapt to many kinds of systems.
14181418

14191419
Usage: $0 [OPTION]... [VAR=VALUE]...
14201420

@@ -1464,7 +1464,7 @@ Fine tuning of the installation directories:
14641464
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
14651465
--mandir=DIR man documentation [DATAROOTDIR/man]
14661466
--docdir=DIR documentation root
1467-
[DATAROOTDIR/doc/opensource-cobol-4j-1.0.10]
1467+
[DATAROOTDIR/doc/opensource-cobol-4j-1.0.11]
14681468
--htmldir=DIR html documentation [DOCDIR]
14691469
--dvidir=DIR dvi documentation [DOCDIR]
14701470
--pdfdir=DIR pdf documentation [DOCDIR]
@@ -1486,7 +1486,7 @@ fi
14861486

14871487
if test -n "$ac_init_help"; then
14881488
case $ac_init_help in
1489-
short | recursive ) echo "Configuration of opensource COBOL 4J 1.0.10:";;
1489+
short | recursive ) echo "Configuration of opensource COBOL 4J 1.0.11:";;
14901490
esac
14911491
cat <<\_ACEOF
14921492

@@ -1617,7 +1617,7 @@ fi
16171617
test -n "$ac_init_help" && exit $ac_status
16181618
if $ac_init_version; then
16191619
cat <<\_ACEOF
1620-
opensource COBOL 4J configure 1.0.10
1620+
opensource COBOL 4J configure 1.0.11
16211621
generated by GNU Autoconf 2.71
16221622

16231623
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2105,7 +2105,7 @@ cat >config.log <<_ACEOF
21052105
This file contains any messages produced by compilers while
21062106
running configure, to aid debugging if configure makes a mistake.
21072107

2108-
It was created by opensource COBOL 4J $as_me 1.0.10, which was
2108+
It was created by opensource COBOL 4J $as_me 1.0.11, which was
21092109
generated by GNU Autoconf 2.71. Invocation command line was
21102110

21112111
$ $0$ac_configure_args_raw
@@ -3403,8 +3403,8 @@ fi
34033403

34043404

34053405
# Define the identity of the package.
3406-
PACKAGE='opensource-cobol-4j-1.0.10'
3407-
VERSION='1.0.10'
3406+
PACKAGE='opensource-cobol-4j-1.0.11'
3407+
VERSION='1.0.11'
34083408

34093409

34103410
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -25367,7 +25367,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2536725367
# report actual input values of CONFIG_FILES etc. instead of their
2536825368
# values after options handling.
2536925369
ac_log="
25370-
This file was extended by opensource COBOL 4J $as_me 1.0.10, which was
25370+
This file was extended by opensource COBOL 4J $as_me 1.0.11, which was
2537125371
generated by GNU Autoconf 2.71. Invocation command line was
2537225372

2537325373
CONFIG_FILES = $CONFIG_FILES
@@ -25435,7 +25435,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
2543525435
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2543625436
ac_cs_config='$ac_cs_config_escaped'
2543725437
ac_cs_version="\\
25438-
opensource COBOL 4J config.status 1.0.10
25438+
opensource COBOL 4J config.status 1.0.11
2543925439
configured by $0, generated by GNU Autoconf 2.71,
2544025440
with options \\"\$ac_cs_config\\"
2544125441

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
AC_PREREQ(2.59)
2121

22-
AC_INIT([opensource COBOL 4J],[1.0.10],[ws-opensource-cobol-contact@osscons.jp],[opensource-cobol-4j-1.0.10])
22+
AC_INIT([opensource COBOL 4J],[1.0.11],[ws-opensource-cobol-contact@osscons.jp],[opensource-cobol-4j-1.0.11])
2323
AC_CONFIG_SRCDIR([libcob.h])
2424
AC_CONFIG_HEADERS([config.h])
2525
AC_CONFIG_TESTDIR([tests])

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

+1
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ public void realPutSign(int sign) {
14541454
} else if (sign < 0) {
14551455
p.setByte(0, (byte) (b + 0x40));
14561456
}
1457+
return;
14571458
case CobolFieldAttribute.COB_TYPE_NUMERIC_PACKED:
14581459
p = this.getDataStorage().getSubDataStorage(this.size - 1);
14591460
if (sign < 0) {

libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolRelativeFile.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package jp.osscons.opensourcecobol.libcobj.file;
2020

2121
import java.io.*;
22+
import java.nio.ByteBuffer;
2223
import java.nio.channels.*;
2324
import java.nio.file.Files;
2425
import java.nio.file.Path;
@@ -283,7 +284,7 @@ public int read_(AbstractCobolField key, int readOpts) {
283284
return COB_STATUS_23_KEY_NOT_EXISTS;
284285
}
285286

286-
if (this.record.getSize() == 0) {
287+
if (ByteBuffer.wrap(size).getLong() == 0) {
287288
this.fp.seek(this.fp.getFilePointer() - size.length);
288289
return COB_STATUS_23_KEY_NOT_EXISTS;
289290
}

tests/Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ command_line_options_DEPENDENCIES = \
153153
command-line-options.src/fserial-variable.at \
154154
command-line-options.src/fshort-variable.at \
155155
command-line-options.src/java-package.at \
156-
command-line-options.src/edit-code-command.at
156+
command-line-options.src/edit-code-command.at \
157+
command-line-options.src/file-path.at
157158

158159
misc_DEPENDENCIES = \
159160
misc.src/signed-comp3.at \

tests/Makefile.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,8 @@ command_line_options_DEPENDENCIES = \
694694
command-line-options.src/fserial-variable.at \
695695
command-line-options.src/fshort-variable.at \
696696
command-line-options.src/java-package.at \
697-
command-line-options.src/edit-code-command.at
697+
command-line-options.src/edit-code-command.at \
698+
command-line-options.src/file-path.at
698699

699700
misc_DEPENDENCIES = \
700701
misc.src/signed-comp3.at \

0 commit comments

Comments
 (0)