We already have a LICENSE file that covers the Zig Standard Library. We
no longer need to remind everyone that the license is MIT in every single
file.
Previously this was introduced to clarify the situation for a fork of
Zig that made Zig's LICENSE file harder to find, and replaced it with
their own license that required annual payments to their company.
However that fork now appears to be dead. So there is no need to
reinforce the copyright notice in every single file.
This reverts the most recent big changes to `std.Progress` changing the
strategy for printing. Before the changes, it would leave the cursor after
the progress line, having better behavior when a stray print happened,
and supporting sub-process progress without any coordination.
After the changes, the cursor was left at the beginning of the line,
making any prints print garbage and often interfering with stack traces
or other debug information.
This commit reverts to before the changes.
Revert "std: Use more common escape sequences in Progress"
This reverts commit 8ebb18d9da0bfbe6a974636fd36e3391d1de253b.
Revert "Handle some weird edge cases of Win32 API"
This reverts commit b0724a350f07c5e2e8fab572951ffaaa92860b2c.
Revert "Fix many thinkos"
This reverts commit b5a50a26ebac6a08dacf79f5d1db9bdd94ba33a5.
Revert "Fix Progress printing on Windows systems"
This reverts commit 3010bfb08af0b47d801d492e4f2e21a988e8399a.
Revert "std: Better handling of line-wrapping in Progress"
This reverts commit 4fc2e92876d8aafd087a5f0bdb6ea7a54f195704.
In order to update the printed progress string the code tried to move
the cursor N cells to the left, where N is the number of written bytes,
and then clear the remaining part of the line.
This strategy has two main issues:
- Is only valid if the number of characters is equal to the number of
written bytes,
- Is only valid if the line doesn't get too long.
The second point is the main motivation for this change, when the line
becomes too long the terminal wraps it to a new physical line. This
means that moving the cursor to the left won't be enough anymore as once
the left border is reached it cannot move anymore.
The wrapped line is still stored by the terminal as a single line,
despite now taking more than a single one when displayed. If you try to
resize the terminal you'll notice how the contents are reflowed and are
essentially illegible.
Querying the cursor position on non-Windows systems (plot twist,
Microsoft suggests using VT escape sequences on newer systems) is
extremely cumbersome so let's do something different.
Before printing anything let's save the cursor position and clear the
screen below the cursor, this way we ensure there's absolutely no trace
of stale data on screen, and after the message is printed we simply
restore it.
* move concurrency primitives that always operate on kernel threads to
the std.Thread namespace
* remove std.SpinLock. Nobody should use this in a non-freestanding
environment; the other primitives are always preferable. In
freestanding, it will be necessary to put custom spin logic in there,
so there are no use cases for a std lib version.
* move some std lib files to the top level fields convention
* add std.Thread.spinLoopHint
* add std.Thread.Condition
* add std.Thread.Semaphore
* new implementation of std.Thread.Mutex for Windows and non-pthreads Linux
* add std.Thread.RwLock
Implementations provided by @kprotty
We generally get away with atomic primitives, however a lock is required
around the refresh function since it traverses the Node graph, and we
need to be sure no references to Nodes remain after end() is called.