Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#598 Add file IO flush function #619

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ and this project does not currently adhere to a particular versioning scheme.
- Add local definitions to imperative syntax. ([#562][gh-562])
- Add local definitions to functional syntax.
- Add repeated field name error message.
- Add primitive file IO function `IO/FS/flush`. ([#598][gh-598])

## [0.2.35] - 2024-06-06

Expand Down Expand Up @@ -369,3 +370,4 @@ and this project does not currently adhere to a particular versioning scheme.
[gh-583]: https://github.com/HigherOrderCO/Bend/issues/583
[gh-586]: https://github.com/HigherOrderCO/Bend/issues/586
[gh-596]: https://github.com/HigherOrderCO/Bend/issues/596
[gh-598]: https://github.com/HigherOrderCO/Bend/issues/598
10 changes: 10 additions & 0 deletions docs/builtins.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,16 @@ Moves the current position of the file with the given `file` descriptor to the g

Returns nothing (`*`).

#### File flush

```python
def IO/FS/flush(file)
```

Flushes the file with the given `file` descriptor.

Returns nothing (`*`).

## Numeric operations

### log
Expand Down
1 change: 1 addition & 0 deletions src/fun/builtins.bend
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ IO/FS/close file = (IO/Call IO/MAGIC "CLOSE" file @x (IO/Done IO/MAGIC x))
IO/FS/read file num_bytes = (IO/Call IO/MAGIC "READ" (file, num_bytes) @x (IO/Done IO/MAGIC x))
IO/FS/write file bytes = (IO/Call IO/MAGIC "WRITE" (file, bytes) @x (IO/Done IO/MAGIC x))
IO/FS/seek file offset mode = (IO/Call IO/MAGIC "SEEK" (file, (offset, mode)) @x (IO/Done IO/MAGIC x))
IO/FS/flush file = (IO/Call IO/MAGIC "FLUSH" file @x (IO/Done IO/MAGIC x))

### Always available files
IO/FS/STDIN = 0
Expand Down
Loading