The lower bound of the `bit_set` was only being applied *after*
searching for a matching enum value, so values wouldn't line up if the
minimum value of the enum wasn't 0.
This allows `*` to be used in C fashion, without specifying an argument
index to use. Like C, this results in the argument *preceding* the value
for the format specifier itself.
afed3ce removed the sys/unix package and moved over to sys/posix, it has
new bindings for the pthread APIs but should have been equivalent (not).
8fb7182 used `CANCEL_ENABLE :: 0`, `CANCEL_DISABLE :: 1`, `CANCEL_DEFERRED :: 0`, `CANCEL_ASYNCHRONOUS :: 1` for Darwin, while the
correct values are `1`, `0`, `2` and `0` respectively (same mistake was made for
FreeBSD in that commit).
What this meant is that the
`pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS)` was not actually
successful, but because the error wasn't checked it was assumed it was.
It also meant `pthread_setcancelstate(PTHREAD_CANCEL_ENABLE)` would
actually be setting `PTHREAD_CANCEL_DISABLE`.
The code in this PR restores the behaviour by now actually deliberately
setting `PTHREAD_CANCEL_DISABLE` and not setting
`PTHREAD_CANCEL_ASYNCHRONOUS` which was the previous behaviour that does
actually seem to work for some reason.
(I also fixed an issue in fmt where `x` would use uppercase if it was a
pointer.)
core:fmt prints pointers to structs as `&StructName{ ... }` but `bit_field`s are currently printed
the same as rawptrs (`0xAABBCCDDEEFF` only).
This commit changes that so they behave the same as structs and unions.
- Extracts common code between C and Python-like syntax into its own
sub-procedures.
- Fixes Python-like syntax from treating `}` as a verb.
- Makes C-like syntax treat ' ' as a missing verb.
- Fixes EXTRA arguments being formatted with options that were
previously set, instead using default options now.
- Makes error messaging more consistent between C and Python-like
syntax.
- Requires argument index to be specified immediately before the verb
in C-like syntax, per the documentation, instead of after `%` _or_
before the verb.
- Tracks argument usage through a `bit_set`, allowing for reporting of
unused arguments even when reordered.
- Moves exit for C-like syntax if next byte is `%` to beginning of
block instead of needlessly trying to parse through all options.
- Pops next unused argument for unspecified formatters like `%i` or
`{}`, instead of taking the argument after the last one used.
- Fixes unspecified precision `%.f` from not setting precision to zero,
per the documentation.