Commit graph

83 commits

Author SHA1 Message Date
Leonardo de Moura
0de92b069f chore: move function 2020-09-21 08:58:41 -07:00
Sebastian Ullrich
a93a53b4b5 feat: more IO Task functions 2020-09-14 17:57:33 +02:00
Sebastian Ullrich
77cbaa752c fix: Task: make reference and -j0 semantics eager, simplify 2020-09-14 17:57:33 +02:00
Sebastian Ullrich
5b83ceb1b5 feat: IO.mapTask, IO.bindTask 2020-09-14 17:57:33 +02:00
Sebastian Ullrich
307a833798 feat: implement IO.asTask as primitive using always-run tasks 2020-09-14 17:57:33 +02:00
Sebastian Ullrich
4bce9eb9a5 doc: document lean_st_ref_get peculiarity 2020-08-31 15:55:21 +02:00
Sebastian Ullrich
c88784ef9d refactor: consistent io_result_mk* naming
/cc @leodemoura
2020-08-31 11:08:57 +02:00
Sebastian Ullrich
1fb1a6f913 fix: do not expose invalid process handles when not redirected 2020-08-30 14:28:56 -07:00
Sebastian Ullrich
cc909e20e1 fix: handle SIGPIPE 2020-08-30 14:28:56 -07:00
Sebastian Ullrich
9f40e46043 feat: basic process API 2020-08-30 14:28:56 -07:00
Sebastian Ullrich
110ae4b571 feat: replace OS-specific stream redirection with pure-Lean Stream redirection
This avoids the temporary files workaround on macOS and Windows, and makes sure
we can process a `#eval` command and write messages to stdout at the same time.
2020-08-28 10:04:32 -07:00
Sebastian Ullrich
efa119bc94 feat: make std streams Streams 2020-08-28 10:04:32 -07:00
Sebastian Ullrich
1b0ffbb74d feat: make std IO streams settable
Co-authored-by: Simon Hudon <simon.hudon@gmail.com>
2020-08-28 10:04:32 -07:00
Leonardo de Moura
6180ba6d7d chore: rename ST.Ref primitives 2020-08-23 12:28:14 -07:00
Leonardo de Moura
c0dbf60830 feat: remove IO.ref.reset
`reset` was used to implement a "buggy" `IO.ref.modify`.
```lean
@[inline] def Ref.modify {α : Type} (r : Ref α) (f : α → α) : m Unit := do
v ← r.get;
r.reset;
r.set (f v)
```
`IO.Ref.reset` will store a nullptr in `r`.
Now, suppose another thread tries to read this reference,
it will get an `IO.error`.
It is not a crash, but it is really weird behavior.
2020-08-20 10:07:15 -07:00
Wojciech Nawrocki
55655869b7 feat: default to binary file mode on Windows 2020-08-13 09:21:35 -07:00
Sebastian Ullrich
6404af6983 feat: IO.Prim.withIsolatedStreams 2020-06-16 10:41:42 -07:00
Sebastian Ullrich
f4c28fbe5f chore: remove unnecessary getByte/putByte IO primitives 2020-06-16 12:06:53 +02:00
Simon Hudon
a64e78b90b feat: add std streams
Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
2020-06-16 12:06:53 +02:00
Leonardo de Moura
2f1ec93289 chore: move runtime implementation to src/runtime 2020-05-22 14:35:16 -07:00
Leonardo de Moura
1a77ee4f89 chore: delete old runtime directory 2020-05-18 11:33:18 -07:00
Leonardo de Moura
8bdca35282 chore: use #include <lean/runtime/...> for runtime .h files 2020-05-18 11:30:07 -07:00
Sebastian Ullrich
5d260c396f fix: macOS build 2020-05-14 14:47:54 +02:00
Sebastian Ullrich
be79820a47 feat: add IO.currentDir 2020-05-14 14:38:52 +02:00
Leonardo de Moura
098b0edbcb chore: remove dead code 2020-03-23 15:56:29 -07:00
Leonardo de Moura
2cc0f25bf5 feat: getLine at EOF should return empty string
This is the same approach used in Rust, and it simplifies the code.
2020-03-23 15:44:47 -07:00
Leonardo de Moura
b2bddb5606 chore: style 2020-03-23 14:06:02 -07:00
Leonardo de Moura
db914052ce fix: IO.getLine 2020-03-23 12:26:09 -07:00
Leonardo de Moura
d6a7e9a308 chore: remove mutquot primitives 2020-02-24 14:28:32 -08:00
Leonardo de Moura
660571ab38 fix: closes #109
Fixed myself after wasting time wondering whether a segfault was
coming from today.

cc @cipher1024
2020-02-05 09:16:33 -08:00
Leonardo de Moura
38e6961003 feat: MutQuot by implementedBy 2020-02-04 16:51:08 -08:00
Leonardo de Moura
ac88b46299 feat: MutQuot primitives 2020-02-04 15:56:20 -08:00
Sebastian Ullrich
2509b3913a Revert "feat: add std streams"
This reverts commit 7575a32035.
2020-01-25 16:32:06 +01:00
Sebastian Ullrich
0be2424910 Revert "feat: override standard streams"
This reverts commit bd87ea5d5e.
2020-01-25 16:32:06 +01:00
Sebastian Ullrich
b760692a26 Revert "fix: thread local storage of std streams"
This reverts commit 961861ceab.
2020-01-25 16:32:06 +01:00
Sebastian Ullrich
58313a050a Revert "fix: #eval redirection of stdout"
This reverts commit 123577126c.
2020-01-25 16:32:06 +01:00
Sebastian Ullrich
ad29568051 Revert "fix: redirect"
This reverts commit addbb8dd67.
2020-01-25 16:32:06 +01:00
Leonardo de Moura
addbb8dd67 fix: redirect
@cipher1024 I modified your fix. It would produce memory leaks if the
code executed by #eval modifies the stdout.
Here is the problem.
- Your replaces the handler with some new handler `H` and stores the
  old handler `O` in a `flet`.
- Code is executed and replaces the stdout handler with `H'`. The `H`s RC is
  decremented and `H'`s RC is incremeneted. So far, so good.
- Now, the destructor of your `flet` is executed, and it replaces `H'`
  with `O`, but `H'` RC is not decremented.
2020-01-23 15:58:34 -08:00
Simon Hudon
123577126c fix: #eval redirection of stdout 2020-01-23 15:44:49 -08:00
Simon Hudon
961861ceab fix: thread local storage of std streams 2020-01-19 17:23:24 -08:00
Simon Hudon
bd87ea5d5e feat: override standard streams 2020-01-19 17:23:12 -08:00
Simon Hudon
7575a32035 feat: add std streams
This reverts commit 021ce21d5f70c2efcc58a0588ed6dc4999be6a33.
2020-01-19 17:22:58 -08:00
Simon Hudon
6d8927da10 fix: little details 2020-01-12 08:02:48 -08:00
Simon Hudon
92c8773137 feat: file IO using handles 2020-01-12 08:02:48 -08:00
Leonardo de Moura
48578c9743 chore: remove hacks 2020-01-08 21:09:17 -08:00
Leonardo de Moura
981e35b6da chore: style 2020-01-08 21:09:17 -08:00
Leonardo de Moura
4550e75dcb chore: temporary hack for solving staging issue 2020-01-08 21:09:17 -08:00
Leonardo de Moura
01c5b0710c feat: pointer equality for IO.ref 2020-01-08 21:09:17 -08:00
Sebastian Ullrich
ae3b3bb825 chore: remove cygwin support 2019-11-12 08:28:58 -08:00
Sebastian Ullrich
d8bb4df96f chore: revert "chore: add std::cout.flush"
This reverts commit a43a225013.
2019-11-06 10:13:39 -08:00