From d9cc53f6bad48abbb277508070e8cd17e10709b1 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Mon, 30 Jun 2025 21:00:31 -0300 Subject: [PATCH 1/2] deprecate rewind in favor of seekstart --- CHANGELOG.md | 2 +- README.md | 2 +- docs/src/files.md | 2 +- src/FortranFiles.jl | 2 +- src/file.jl | 4 ++-- test/runtests.jl | 5 ++++- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 650f099..9dda0eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ FortranFiles.jl Changelog Version 0.6.2-DEV ------------- - +- ![BREAKING][badge-breaking] deprecrate `rewind` in favor of `seekstart` (`rewind` is still exported here) Version 0.6.1 ------------- diff --git a/README.md b/README.md index 681dff6..b43847f 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ i, strings, zmatrix = read(f, Int32, (FString{20},10), (ComplexF64,10,10)) read(f) # go back to the beginning of the file -rewind(f) +seekstart(f) ``` Example usage for writing files: diff --git a/docs/src/files.md b/docs/src/files.md index d8bbbb9..7450932 100644 --- a/docs/src/files.md +++ b/docs/src/files.md @@ -60,7 +60,7 @@ To test for EOF, use the standard Julia `eof` function. The following functions are provided to emulate certain Fortran I/O statements: ```@docs -rewind +seekstart ``` diff --git a/src/FortranFiles.jl b/src/FortranFiles.jl index f001a2b..4f24cfc 100644 --- a/src/FortranFiles.jl +++ b/src/FortranFiles.jl @@ -2,7 +2,7 @@ __precompile__() module FortranFiles - export FortranFile, rewind + export FortranFile export RECMRK4B, RECMRK8B export FString, trimstring, trimlen, trim export FortranFilesError diff --git a/src/file.jl b/src/file.jl index 4098e22..2a7cf40 100644 --- a/src/file.jl +++ b/src/file.jl @@ -76,8 +76,8 @@ end "Re-position a `FortranFile` at its beginning." -rewind(f::FortranFile) = seek(f.io, 0) - +Base.seekstart(f::FortranFile) = seekstart(f.io) +@deprecate rewind seekstart Base.close(f::FortranFile) = close(f.io) diff --git a/test/runtests.jl b/test/runtests.jl index 90017d9..4aa8f7e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -346,10 +346,13 @@ Sys.islinux() && @testset "Testing records with $(rectest.desc), $(botest.name) rewind(infile) data2 = freaddata(infile) @test data == data2 + seekstart(infile) + data2 = freaddata(infile) + @test data == data2 end @time @testset "Reading data with skipping" begin - rewind(infile) + seekstart(infile) skipdata(infile) close(infile) end From b9ae5c3478b0c333d70cdca80251d930dfc5cfd7 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Tue, 1 Jul 2025 13:46:08 -0300 Subject: [PATCH 2/2] adjust changelog message --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dda0eb..3f1ae19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ FortranFiles.jl Changelog Version 0.6.2-DEV ------------- -- ![BREAKING][badge-breaking] deprecrate `rewind` in favor of `seekstart` (`rewind` is still exported here) +- ![INFO][badge-info] `seekstart` is used instead of `rewind` (which will be deprecated in future version). Version 0.6.1 -------------