Commit graph

29949 commits

Author SHA1 Message Date
Timothy Flynn
be69eae651 LibUnicode: Precompute the compact scale of each number formatting rule
This will be needed for the ComputeExponentForMagnitude AO for compact
formatting, namely step 5b:

  Let exponent be an implementation- and locale-dependent (ILD) integer
  by which to scale a number of the given magnitude in compact notation
  for the current locale.
2021-11-12 09:17:08 +00:00
Timothy Flynn
230b133ee3 LibUnicode: Parse number formats into zero/positive/negative patterns
A number formatting pattern in the CLDR contains one or two entries,
delimited by a semi-colon. Previously, LibUnicode was just storing the
entire pattern as one string. This changes the generator to split the
pattern on that delimiter and generate the 3 unique patterns expected by
ECMA-402.

The rules for generating the 3 patterns are as follows:

* If the pattern contains 1 entry, it is the zero pattern. The positive
  pattern is the zero pattern prepended with {plusSign}. The negative
  pattern is the zero pattern prepended with {minusSign}.

* If the pattern contains 2 entries, the first is the zero pattern, and
  the second is the negative pattern. The positive pattern is the zero
  pattern prepended with {plusSign}.
2021-11-12 09:17:08 +00:00
Timothy Flynn
1244ebcd4f LibUnicode: Parse and generate standard accounting formatting rules
Also known as "currency-accounting" in some CLDR documentation.
2021-11-12 09:17:08 +00:00
Timothy Flynn
967afc1b84 LibUnicode: Parse and generate standard currency formatting rules 2021-11-12 09:17:08 +00:00
Timothy Flynn
bffd73e0d4 LibUnicode: Parse and generate standard decimal formatting rules 2021-11-12 09:17:08 +00:00
Timothy Flynn
feb8c22a62 LibUnicode: Parse and generate standard percentage formatting rules 2021-11-12 09:17:08 +00:00
Timothy Flynn
4317a1b552 LibUnicode: Parse and generate compact currency formatting rules 2021-11-12 09:17:08 +00:00
Timothy Flynn
604a596c90 LibUnicode: Parse and generate compact decimal formatting rules 2021-11-12 09:17:08 +00:00
Timothy Flynn
12b468a588 LibUnicode: Begin parsing and generating locale number systems
The number system data in the CLDR contains information on how to format
numbers in a locale-dependent manner. Start parsing this data, beginning
with numeric symbol strings. For example the symbol NaN maps to "NaN" in
the en-US locale, and "非數值" in the zh-Hant locale.
2021-11-12 09:17:08 +00:00
Timothy Flynn
d3e83c9934 LibUnicode: Parse alternate default numbering systems
Some locales in the CLDR have alternate default numbering systems listed
under "defaultNumberingSystem-alt-*", e.g.:

    "defaultNumberingSystem": "arab",
    "defaultNumberingSystem-alt-latn": "latn",
    "otherNumberingSystems": {
      "native": "arab"
    },

We were previously only parsing "defaultNumberingSystem" and
"otherNumberingSystems". This odd format appears to be an artifact of
converting from XML.
2021-11-12 09:17:08 +00:00
Timothy Flynn
ae66188d43 LibUnicode: Capitialize generated identifiers in lieu of full title case
This isn't particularly important because this generates code that is
quite hidden from outside callers. But when viewing the generated code,
it's a bit nicer to read e.g. enum identifiers such as "MinusSign"
rather than "Minussign".
2021-11-12 09:17:08 +00:00
Jelle Raaijmakers
86a1ff5204 Kernel: Drain I8042 PS/2 keyboard output after enabling
As soon as we enable the first PS/2 port on the I8042 controller, the
output buffer may become full. We need to drain it before attempting
any new commands with the controller (such as enabling the second PS/2
port).

Fixes #10872.
2021-11-12 07:35:18 +01:00
Luke Wilde
5e3fe52fc4 LibJS: Implement Temporal.Duration.compare 2021-11-11 21:06:54 +00:00
Luke Wilde
29072f4b09 LibJS: Implement the required AOs for Temporal.Duration.compare 2021-11-11 21:06:54 +00:00
Lady Gegga
98b9a75591 Base: Add new glyphs to font Tiny Regular
Shavian (48 glyphs)
Symbols for legacy computing (194 glyphs)
Misc (latin, symbols, greek, arrows, dingbats, etc): ~300 glyphs
Braille Patterns (128 glyphs)
Klingon (39 glyphs) F8D0–F8FF*
Braille Extended (61 glyphs) EB60-EB9F*
Aurebesh (49 glyphs) E890–E8DF*
* PUA based on Under-ConScript Unicode Registry
2021-11-11 20:42:20 +01:00
Ali Mohammad Pur
bf59d9e824 Userland: Include Vector.h in a few places to make HeaderCheck happy
This header was being transitively pulled in, but that no longer happens
after 5f7d008791.
2021-11-11 20:36:36 +01:00
Ben Wiederhake
a59fc324bd Base: Document readonly atexit mitigation 2021-11-11 12:50:18 +00:00
Ben Wiederhake
f2ce751a32 Documentation: Update Debian dependency list
Apparently, qemu-system-* changed its name.

On Debian/Ubuntu, genext2fs does not make a difference: The only user of
this command, Meta/build-image-qemu.sh, runs as root anyway, and tries
to do 'mount _disk_image mnt/' first. Debian/Ubuntu always have drivers
for ext2 available, so this command has no good reason to fail, and
trying to use genext2fs might only obscure any problems that mount
encountered.

Finally, Debian Bullseye (released 2021-08-14) contains gcc-10, so the
instructions on how to upgrade are now obsolete.
2021-11-11 12:47:39 +00:00
Timothy Flynn
7cc50d614c LibGfx: Include Vector.h in PNGLoader.cpp
This was being transitively included from Deflate.h on SerenityOS builds
but not on Lagom builds.
2021-11-11 12:46:48 +00:00
Andreas Kling
2bd0ef0c76 LibGfx: Remove now-unused load_gif_from_memory() 2021-11-11 11:45:32 +01:00
Andreas Kling
880fafd2c5 LibGfx: Use ImageDecoder in Bitmap::try_load_from_fd_and_close()
Before this patch, both Bitmap and ImageDecoder had logic for guessing
which image codec to use for a chunk of data. Bitmap now defers to
ImageDecoder so that we only have to do this in one place.

There's room for improvement in the ImageDecoder heuristic, but that's
outside the scope of this change.
2021-11-11 11:43:08 +01:00
Andreas Kling
10add3f4c2 LibGfx: Remove load_FORMAT() image codec wrappers
We had a bunch of old unused wrapper functions for each image codec that
would load a supported image with a given path. Nobody actually used
them, so let's just get rid of load_png(), load_gif(), etc.
2021-11-11 11:32:22 +01:00
Andreas Kling
09780ba7a9 Tests/LibGfx: Actually test image decoders in TestImageDecoder
We were passing raw Gfx::Bitmap objects into the various image decoders
instead of encoded image data. This made all of them fail, but the test
expectations were set up in a way that aligned with this outcome.

With this patch, we now test the codecs for real. Except ICO, since we
don't have an ICO file handy. That's a FIXME.
2021-11-11 11:20:58 +01:00
Tim Schumacher
ba29798039 Utilities: cut: Implement field-based cutting 2021-11-11 09:47:41 +01:00
Tim Schumacher
96ea4f71bd Utilities: cut: Split up into file and line processing 2021-11-11 09:47:41 +01:00
Tim Schumacher
4d18b21fb5 Utilities: cut: Work exclusively with ranges 2021-11-11 09:47:41 +01:00
Tim Schumacher
ed3a5f6b9d Utilities: cut: Move string splitting into expand_list 2021-11-11 09:47:41 +01:00
Tim Schumacher
2358f6cbda Utilities: cut: Migrate to ArgsParser 2021-11-11 09:47:41 +01:00
Andreas Kling
03ddda7979 LibWasm: Fix broken build after merging un-rebased Validator changes 2021-11-11 09:27:00 +01:00
Ben Wiederhake
fb003d71c2 LibC: Avoid unnecessary mprotect during program finalization
In particular, we track separately whether each AtExitEntry has already
been called, through a separate Bitmap. This has several side-effects:

- We now call malloc() during __cxa_finalize(). I believe this is fine,
  and at that point during program execution memory pressure should be
  low anyway.
- An attacker could prevent arbitrary entries from executing by writing
  to atexit_called_entries. However, this already was possible (by
  setting atexit_entry_count to zero), and this path is even more
  troublesome (the attacker needs to overwrite atexit_called_entries,
  and a region serving as *atexit_called_entries.m_data, and magically
  know exactly how many entries already exist.)
- This reduces the size of AtExitEntry from 16 to 12 (on i686). As such,
  we can reduce the initial memory allocation from two to one page,
  reducing the initial capacity from 512 to 341 entries (or 256 to 170,
  on x86_64). It seems that most programs only use 36-47 entries anyway.

For 'true', this shaves off about 69 syscalls, as measured by strace.
2021-11-11 09:20:35 +01:00
Ben Wiederhake
26b647f303 LibC: Track capacity in terms of AtExitEntry's, not bytes 2021-11-11 09:20:35 +01:00
Ben Wiederhake
2158e1a6b9 LibC: Avoid unnecessary mprotect during program initialization
For 'true', this shaves off about 69 syscalls, as measured by strace.
2021-11-11 09:20:35 +01:00
Ali Mohammad Pur
2801323236 LibWeb: Implement WebAssembly::validate()
...and make sure to validate the module in WebAssembly::compile()
2021-11-11 09:20:04 +01:00
Ali Mohammad Pur
3680aa253d LibWasm: Remove traps caught by validation 2021-11-11 09:20:04 +01:00
Ali Mohammad Pur
7d1142e2c8 LibWasm: Implement module validation 2021-11-11 09:20:04 +01:00
Ali Mohammad Pur
30736c39b9 LibWasm: Make opcode definitions enumerable through a macro 2021-11-11 09:20:04 +01:00
Ali Mohammad Pur
d0ad7efd9b Meta: Update WebAssembly testsuite branch name
The 'master' branch is no longer updated, they've switched to 'main'.
2021-11-11 09:20:04 +01:00
kleines Filmröllchen
c2340a1b1f LibDSP: Optimize note processing
Previously, a collection of notes (Vector or Array) would be created and
promptly deleted for every sample (at least 44 thousand times per
second!). This was measured to be one of the most significant
performance drawbacks as well as the most obvious performance
improvement I could currently find here. Although it will not cause
Piano to lag currently (at least on virtualized systems), I see an
incoming issue once we get the capability to use more processors.

Now, we use a HashMap correlating pitches to notes, and Track reuses the
data structure in order to avoid reallocations. That is the reason for
introducing the fast clear_with_capacity to HashMap.
2021-11-11 09:19:17 +01:00
kleines Filmröllchen
557be4649d LibDSP: Move to constexpr wherever possible 2021-11-11 09:19:17 +01:00
kleines Filmröllchen
3a4ec49131 LibDSP: Clean up ProcessorParameter header 2021-11-11 09:19:17 +01:00
Hendiadyoin1
f76241914c AK: Allow to clear HashTables/Maps with capacity 2021-11-11 09:19:17 +01:00
Camron
5137f96bd6 Solitaire: Fix 3 card draw from reversing after an undo
Solitaire: Fix 3 card draw from reversing after an undo
Co-Authored-By: Tim Flynn <trflynn89@pm.me>
2021-11-10 20:15:09 -08:00
Andreas Kling
68b5e6c565 LibCrypto: Pass AK::Bytes by value 2021-11-11 01:27:46 +01:00
Andreas Kling
80d4e830a0 Everywhere: Pass AK::ReadonlyBytes by value 2021-11-11 01:27:46 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Andreas Kling
ad5d217e76 Kernel/Ext2FS: Propagate HashMap errors instead of panicking 2021-11-11 01:27:46 +01:00
Andreas Kling
9d1f238450 AK: Make HashTable and HashMap try_* functions return ErrorOr<T>
This allows us to use TRY() and MUST() with them.
2021-11-11 01:27:46 +01:00
Linus Groh
4eaa95769d LibJS: Add missing (void) to handle [[nodiscard]] TRY() result 2021-11-11 00:03:07 +00:00
Linus Groh
fdffdc43fa LibJS: Implement the rest of to_temporal_month_day()
Always throws at the moment, because parse_temporal_month_day_string()
is basically a stub, and parse_iso_date_time() isn't functional either.

The spec issue has been resolved though, so I figured we might as well
get one small step further :^)
2021-11-10 22:28:27 +00:00
Linus Groh
6ef1a2793f LibJS: Rename ZonedDateTime's MatchBehavior enum members to match spec 2021-11-10 21:27:25 +00:00