Commit graph

137 commits

Author SHA1 Message Date
Eric Wieser
e8a2786d6d
fix: actually catch the error code from MoveFileEx (#3753)
A user on Zulip [reported seeing an error code of "no
error"](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.60lake.20update.60.20broken.20on.20Windows.20.28.3F.29/near/429134334)
here.
2024-03-26 09:00:25 +00:00
Sebastian Ullrich
6b0e7e1f46
feat: synchronous execution of task continuations (#3013)
In the new snapshot design, we have a tree of `Task`s that represents
the asynchronously processed document structure. When transforming this
tree in response to a user edit, we want to quickly run through
reusable, already computed nodes of the tree synchronously and then
spawn new tasks for the new parts. The new flag allows us to do such
mixed sync/async tree transformations uniformly. This flag exists as
e.g.
[`ExecuteSynchronously`](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskcontinuationoptions?view=net-8.0)
in other runtimes.
2024-01-25 13:54:20 +00:00
Joachim Breitner
bd89787a87
chore: fix CPP warnings about static_assert (#3005)
else I see
```
[ 69%] Building CXX object runtime/CMakeFiles/leanrt.dir/platform.cpp.o
/home/jojo/build/lean/lean4/src/runtime/io.cpp:509:75: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
    static_assert(sizeof(std::chrono::milliseconds::rep) <= sizeof(uint64));
                                                                          ^
                                                                          , ""
/home/jojo/build/lean/lean4/src/runtime/io.cpp:517:74: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
    static_assert(sizeof(std::chrono::nanoseconds::rep) <= sizeof(uint64));
                                                                         ^
                                                                         , ""
2 warnings generated.
```
when building
2023-12-01 13:00:01 +00:00
Sebastian Ullrich
f142d9f798
fix: ignore errors on IO.FS.Handle finalization (#2935) 2023-11-27 08:17:33 +00:00
tydeu
171837216a feat: IO.FS.Handle.lock/tryLock/unlock 2023-11-15 19:31:08 -05:00
tydeu
19c81a19ea feat: IO.FS.Handle.rewind/truncate 2023-11-15 19:31:08 -05:00
int-y1
ce4ae37c19 chore: fix more typos in comments 2023-10-08 14:37:34 -07:00
Sebastian Ullrich
184318fd8b fix: eliminate widestring uses 2023-10-07 12:07:19 +02:00
Alexander Bentkamp
7dc1618ca5
feat: Web Assembly Build (#2599)
Co-authored-by: Rujia Liu <rujialiu@user.noreply.github.com>
2023-10-04 09:04:20 +02:00
Mario Carneiro
f0af71a57b fix: use MoveFileEx for rename on win 2023-09-19 20:24:37 +02:00
Sebastian Ullrich
4e52283728 fix: FFI signature mismatches 2023-08-18 19:34:21 +02:00
tydeu
c79c7c89b3 feat: IO.Process.getPID & IO.FS.Mode.writeNew 2023-08-08 16:23:43 -04:00
Mario Carneiro
dd313c6894 feat: add IO.FS.rename 2023-07-22 23:21:32 +02:00
Olivier Taïbi
9aeae67708 fix: advance pointer into array when generating random bytes
otherwise if we have more than one chunk then the first one is overwritten
over and over, and the end of the array is not really random
2023-04-06 11:32:12 +02:00
Sebastian Ullrich
15c146b382 feat: proper I/O errors from getLine 2023-03-10 16:27:56 +01:00
Sebastian Ullrich
51e77d152c fix: do not inherit file handles across process creation 2023-03-10 16:27:56 +01:00
Sebastian Ullrich
113de7cca1 refactor: move from fopen to open 2023-03-10 16:27:56 +01:00
Sebastian Ullrich
b010805000 fix: Handle.read at EOF 2022-08-26 20:55:09 -07:00
Andrés Goens
fa22507e8e
feat: blocking behavior on EOF for getLine (#1479) 2022-08-21 16:27:48 +02:00
Jannis Limperg
5ff8f64255 feat: add IO.monoNanosNow 2022-04-11 12:16:20 +02:00
Jannis Limperg
6459ccc43c fix: prevent overflow in lean_io_mono_ms_now 2022-04-11 12:16:20 +02:00
Sebastian Ullrich
1221bdd3c7 fix: use redirected stderr for timeit & allocprof 2021-12-16 06:38:35 -08:00
tydeu
d518ba7f08 feat: use BaseIO more in Init.System.IO 2021-12-14 09:33:52 +01:00
Sebastian Ullrich
0a40269fcb fix: build with mingw-clang64 clang 2021-11-18 09:42:35 +01:00
Mac
eb5852448e
feat: generalize IO task functions to BaseIO := EIO Empty (#744)
* feat: generalize `asTask`/`bindTask`/`mapTask` to `EIO`

* feat: generalize task functions to the `EIO Empty` monad

* chore: fix test + correct doc

* feat: further generalize task functions to `RealM := EIO Empty`

* chore: `RealM`/Task API touch-ups

* refactor: `abbrev RealM` -> `def BaseIO`

* chore: remame args / remove `EIO.toBaseIO_` as per code review

* refactor: use `BaseIO` at `checkCanceled`/`getNumHeartbeats`

* chore: fix `lean_io_bind_task_fn` signature error
2021-11-04 15:37:55 -07:00
Sebastian Ullrich
b13d3e6ca5 fix: dllexport functions not already annotated in header 2021-09-20 18:41:46 +02:00
Sebastian Ullrich
08c2c31fcd feat: IO.FS.removeDir(All) 2021-09-16 07:01:37 -07:00
Sebastian Ullrich
cd7968ba6a chore: IO.FS.removeFile: include path in error messages 2021-09-16 07:01:37 -07:00
Leonardo de Moura
218b9c87b0 feat: expose APIs for creating IO.Error objects 2021-09-11 17:14:43 -07:00
Leonardo de Moura
f9bc4b9b3a feat: add missing APIs 2021-09-11 15:39:11 -07:00
Leonardo de Moura
c8406a301d chore: reduce src/include/lean 2021-09-07 08:24:54 -07:00
Leonardo de Moura
b986bde639 fix: IO.Error.alreadyExists may have an optional file name
We got an assertion violation yesterday at `leanpkg` at
```cpp
  case EEXIST: case EINPROGRESS: case EISCONN:
        lean_assert(fname == nullptr);   // <<<<<<< HERE
        return lean_mk_io_error_already_exists(errnum, details);
```
2021-07-27 07:00:06 -07:00
Wojciech Nawrocki
66258b012b chore: fix windows build 2021-07-24 10:45:28 +02:00
Wojciech Nawrocki
102236fdd9 chore: leftover comment 2021-07-24 10:45:28 +02:00
Wojciech Nawrocki
b3d9e90695 feat: IO.getRandomBytes 2021-07-24 10:45:28 +02:00
Sebastian Ullrich
daac376160 fix: native signature of IO.Process.exit 2021-06-23 08:53:20 +02:00
Daniel Selsam
a22bba7bbf feat: Process.exit
Closes #356
2021-06-11 17:53:51 -07:00
Reijo Jaakkola
32897440dc
fix: change IO.FS.Handle.read to return empty array at EOF
Make EOF handling in IO.FS.Handle consistent with EOF handling in
IO.FS.Handle.getLine. Previously returned error at EOF which ended up
causing segmentation fault. Remove the declaration of g_io_error_eof,
since it becomes redundant.

Closes #349
2021-06-08 13:17:53 +02:00
Wojciech Nawrocki
91d4011aa8 chore: Emscripten realpath 2021-06-06 15:34:44 +02:00
Wojciech Nawrocki
7ca87e50ce chore: Emscripten getenv 2021-06-06 15:34:44 +02:00
Wojciech Nawrocki
485f8ea2d0 feat: setup Emscripten file paths 2021-06-06 15:34:44 +02:00
Wojciech Nawrocki
8ada0ba043 feat: initial Emscripten support 2021-06-06 15:34:44 +02:00
Sebastian Ullrich
a9fa84815b feat: IO.createDir, IO.createDirAll 2021-05-30 17:29:54 +02:00
Sebastian Ullrich
94aea76922 feat: FilePath.metadata 2021-05-30 17:29:54 +02:00
Wojciech Nawrocki
e5182fe4af fix: exported symbol arities 2021-05-29 07:56:54 +02:00
Sebastian Ullrich
f81abe158c fix: memleak in release build 2021-05-26 10:24:45 +02:00
Sebastian Ullrich
2988897cac feat: IO.FS.readDir 2021-05-26 09:47:43 +02:00
Sebastian Ullrich
46ec999a71 fix: don't leak thread-local stream objects
Fixes #245
2021-04-03 10:00:17 +02:00
Leonardo de Moura
acfac85ac0 feat: add IO.getNumHeartbeats 2021-01-24 17:45:50 -08:00
Wojciech Nawrocki
d5ba10a316 feat: IO API for retrieving monotonic time 2021-01-22 18:02:31 +01:00