Skip to content

Commit

Permalink
Minor updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Apr 3, 2024
1 parent 6965e39 commit 2bfddff
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
# fortran-zstd

A collection of Fortran 2018 interface bindings to selected
[Zstandard](http://www.zstd.net/) functions (zstd ⩾ 1.5.5). In comparison to
the original C API, the Fortran interfaces, types, and arguments have been
converted to snake case. See [COVERAGE](COVERAGE.md) for an overview of bound
procedures.
[Zstandard](http://www.zstd.net/) functions (zstd ≥ 1.5.5). In comparison to the
original C API, the Fortran interfaces, types, and arguments have been converted
to snake case. See [COVERAGE](COVERAGE.md) for an overview of bound procedures.

## Build Instructions

The zstd library has to be installed with development headers. Build and
install the Fortran library using the provided Makefile:
The zstd library has to be installed with development headers. On FreeBSD, run:

```
# pkg install archivers/zstd
```

On Linux, instead:

```
# apt-get install libzstd1 libzstd-dev
```

Or, to build and install the zstd library from source:

```
$ cd /tmp/
$ git clone --depth 1 https://github.com/facebook/zstd
$ cd zstd/build/cmake/
$ cmake --build . --config Release
$ sudo cmake --install . --prefix /usr/local
```

Build and install the Fortran library using the provided Makefile:

```
$ make
Expand Down
8 changes: 4 additions & 4 deletions test/test_zstd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ logical function test_stream() result(success)
last_chunk = (nbytes < to_read)

! Select the flush mode. If the read may not be finished
! (read == toRead) we use ZSTD_E_CONTINUE. If this is the last
! chunk, we use ZSTD_E_END. Zstd optimises the case where the
! first flush mode is ZSTD_E_END, since it knows it is
! (nbytes == to_read) we use ZSTD_E_CONTINUE. If this is the
! last chunk, we use ZSTD_E_END. Zstd optimises the case where
! the first flush mode is ZSTD_E_END, since it knows it is
! compressing the entire source in one pass.
if (last_chunk) then
mode = ZSTD_E_END
Expand Down Expand Up @@ -309,7 +309,7 @@ logical function test_stream() result(success)
! Given a valid frame, zstd won't consume the last byte of the frame
! until it has flushed all of the decompressed data of the frame.
! Therefore, instead of checking if the return code is 0, we can
! decompress just check if input.pos < input.size.
! decompress just check if input%pos < input%size.
do while (input%pos < input%size)
output = zstd_out_buffer_type(c_loc(buf_out), buf_out_sz, 0)

Expand Down

0 comments on commit 2bfddff

Please sign in to comment.