Skip to content

Commit

Permalink
Merge pull request #619 from bhavik-goplani/dev
Browse files Browse the repository at this point in the history
#598 Add file IO flush function
  • Loading branch information
developedby authored Jul 5, 2024
2 parents 57d6798 + b9e294f commit 29f2098
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ and this project does not currently adhere to a particular versioning scheme.
- Add local definitions to functional syntax.
- Add repeated field name error message.
- Add `Math` builtin functions. ([#570][gh-570])
- Add primitive file IO function `IO/FS/flush`. ([#598][gh-598])

## [0.2.35] - 2024-06-06

Expand Down Expand Up @@ -387,3 +388,4 @@ and this project does not currently adhere to a particular versioning scheme.
[gh-514]: https://github.com/HigherOrderCO/Bend/issues/514
[gh-544]: https://github.com/HigherOrderCO/Bend/pull/544
[Unreleased]: https://github.com/HigherOrderCO/Bend/compare/0.2.36...HEAD
[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 @@ -429,6 +429,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

0 comments on commit 29f2098

Please sign in to comment.