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
6 changes: 5 additions & 1 deletion .github/workflows/test-other.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ jobs:
- name: Run tests ${{ inputs.test-name }}
working-directory: tests/
run:
./${{ inputs.test-name }}
./${{ inputs.test-name }}

- name: Run tests cobj-api
run:
make test-cobj-api
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [1.0.22] - 2024-04-30
### Added
* Add cobj-api command (#370)
* Implement a -Wstrict-typing (#369)
### Miscellaneous
* Simplify generated Java code based on SonarQube analysis (#366)
* Improve the error message for record keys with duplicates (#368)
## [1.0.21] - 2024-03-29
### Added
* Implement a new option `-info-json-dir` (#362)
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-04-30 OSS Consortium <[email protected]>

* opensource COBOL 4J v1.0.22 released.

2024-03-29 OSS Consortium <[email protected]>

* opensource COBOL 4J v1.0.21 released.
Expand Down
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ defaults.h: Makefile.am $(top_builddir)/config.status
echo "#define COB_MODULE_EXT \"$(COB_MODULE_EXT)\""; \
echo "#define LOCALEDIR \"$(datadir)/locale\""; \
} > defaults.h

test-cobj-api:
$(MAKE) -C libcobj test
3 changes: 3 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,9 @@ defaults.h: Makefile.am $(top_builddir)/config.status
echo "#define LOCALEDIR \"$(datadir)/locale\""; \
} > defaults.h

test-cobj-api:
$(MAKE) -C libcobj test

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
11 changes: 11 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ NEWS - user visible changes -*- outline -*-

-----------------------------------------------------------------------

* opensource COBOL 4J 1.0.22

** New Features
(1) Add cobj-api command
(2) Implement `-Wstrict-typing`
** Miscellaneous
(1) Simplify generated Java code based on SonarQube analysis
(2) Improve the error message for record keys with duplicates

-----------------------------------------------------------------------

* opensource COBOL 4J 1.0.21

** New Features
Expand Down
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ dnf install -y java-21-amazon-corretto-devel gcc make bison flex automake autoco

### Install opensource COBOL 4J
```
curl -L -o opensourcecobol4j-v1.0.21.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.0.21.tar.gz
tar zxvf opensourcecobol4j-v1.0.21.tar.gz
cd opensourcecobol4j-1.0.21
curl -L -o opensourcecobol4j-v1.0.22.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.0.22.tar.gz
tar zxvf opensourcecobol4j-v1.0.22.tar.gz
cd opensourcecobol4j-1.0.22
./configure --prefix=/usr/
make
sudo make install
Expand All @@ -72,7 +72,7 @@ In order to check installations of older versions,
The docker container for opensource COBOL 4J is available.

```bash
docker pull opensourcecobol/opensourcecobol4j:1.0.21
docker pull opensourcecobol/opensourcecobol4j:1.0.22
```

Execute the following commands in order to run the "Hello World" COBOL program.
Expand Down Expand Up @@ -201,6 +201,23 @@ Options:
-v, --version
Print the version of cobj-idx.
```

## cobj-api
With `cobj-api`, you can easily generate an Spring boot Java file that calls the program generated by `cobj`.

```
Usage: cobj-api [options] <json-file>

Arguments:
<json-file>: a json file generated by cobj with `-info-json-dir` option

Options:
-h, --help Display this message
-java-package=<package name> Specify the package name of the generated source code
-o=<dir>, --output-dir=<dir> Set the output destination of the java file to an arbitrary destination
-v, --version Prints the version of the cobj-api
```

## Contributing

Guidelines for contributing to opensource COBOL 4J can be found in [CONTRIBUTING.md](./CONTRIBUTING.md).
Expand Down
28 changes: 22 additions & 6 deletions README_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ opensource COBOL 4J は下記の環境でテストされています.

## インストール

opensource COBOL 4J v1.0.21はUbuntuとAlmaLinuxで動作を確認しています.
opensource COBOL 4J v1.0.22はUbuntuとAlmaLinuxで動作を確認しています.

## 手動インストール

Expand Down Expand Up @@ -57,9 +57,9 @@ dnf install -y java-21-amazon-corretto-devel gcc make bison flex automake autoco
下記のコマンドを実行する

```
curl -L -o opensourcecobol4j-v1.0.21.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.0.21.tar.gz
tar zxvf opensourcecobol4j-v1.0.21.tar.gz
cd opensourcecobol4j-1.0.21
curl -L -o opensourcecobol4j-v1.0.22.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.0.22.tar.gz
tar zxvf opensourcecobol4j-v1.0.22.tar.gz
cd opensourcecobol4j-1.0.22
./configure --prefix=/usr/
make
sudo make install
Expand All @@ -73,10 +73,10 @@ sudo make install

## Dockerによるインストール

opensource COBOL 4J v1.0.21をインストールしたDockerイメージを利用できます.
opensource COBOL 4J v1.0.22をインストールしたDockerイメージを利用できます.

```bash
docker pull opensourcecobol/opensourcecobol4j:1.0.21
docker pull opensourcecobol/opensourcecobol4j:1.0.22
```

コンテナ内で下記のコマンドを実行すると、Hello Worldプログラムをコンパイル&実行できる。
Expand Down Expand Up @@ -208,6 +208,22 @@ Options:
Print the version of cobj-idx.
```

## cobj-api
cobj-apiコマンドを使用することで、`cobj`で生成されたプログラムを呼び出すSpring boot向けのJavaファイルを簡単に生成できます。

```
Usage: cobj-api [options] <json-file>

Arguments:
<json-file>: a json file generated by cobj with `-info-json-dir` option

Options:
-h, --help Display this message
-java-package=<package name> Specify the package name of the generated source code
-o=<dir>, --output-dir=<dir> Set the output destination of the java file to an arbitrary destination
-v, --version Prints the version of the cobj-api
```

## コントリビューㇳ

コントリビュータの一覧は https://github.com/opensourcecobol/opensourcecobol4j/graphs/contributors に掲載されています。
Expand Down
11 changes: 8 additions & 3 deletions cobj/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2696,14 +2696,19 @@ static void joutput_search_all(cb_tree table, cb_tree stmt, cb_tree cond,

p = cb_field(table);
idx = CB_VALUE(p->index_list);

/* Header */
joutput_indent("{");
joutput_line("int ret;");
joutput_line("int head = %d - 1;", p->occurs_min);
joutput_line("int head = %d;", p->occurs_min - 1);
joutput_prefix();
joutput("int tail = ");
joutput_occurs(p);
joutput(" + 1;\n");
if (p->occurs_depending) {
joutput_integer(p->occurs_depending);
joutput(" + 1;\n");
} else {
joutput("%d;\n", p->occurs_max + 1);
}

/* Start loop */
joutput_line("for (;;)");
Expand Down
Loading