Commit graph

31008 commits

Author SHA1 Message Date
Timothy Flynn baf3f3bd6e LibJS: Implement Date's Week Day AO 2021-12-08 11:29:36 +00:00
Timothy Flynn e56be34148 LibJS: Implement Date's TimeClip AO 2021-12-08 11:29:36 +00:00
Timothy Flynn b76e44f66f LibUnicode: Parse and generate time zone names in long and short form 2021-12-08 11:29:36 +00:00
Timothy Flynn 2bbf8aa24c LibUnicode: Generate era, month, weekday and day period calendar symbols
The parsing in parse_calendar_symbols() might be a bit more verbose than
it really needs to be, but it is to ensure the symbols are generated in
a known order that we can control with enumerations.
2021-12-08 11:29:36 +00:00
Timothy Flynn 26f9666191 LibJS: Do not override hour, minute, and second format field lengths
This was an oversight in e42d954743.

These fields should always follow the locale preference in the CLDR.
Overriding these fields would permit formats like "h:mm:ss" to result in
strings like "1:2:3" instead of "1:02:03".
2021-12-08 11:29:36 +00:00
Timothy Flynn 9f7c727720 LibJS+LibUnicode: Generate missing patterns with fractionalSecondDigits
TR-35's Matching Skeleton algorithm dictates how user requests including
fractional second digits should be handled when the CLDR format pattern
does not include that field. When the format pattern contains {second},
but does not contain {fractionalSecondDigits}, generate a second pattern
which appends "{decimal}{fractionalSecondDigits}" to the {second} field.
2021-12-08 11:29:36 +00:00
Timothy Flynn 6ace4000bf LibJS+LibUnicode: Supply field type in CalendarPattern's for-each method
Some callers will want different behavior depending on what field is
being provided to the callback.
2021-12-08 11:29:36 +00:00
Timothy Flynn 80ea6e664d LibUnicode: Do not set day period format length for {ampm} segments
TR-35 does define lengths for {ampm}, but they are unused by ECMA-402.
To the contrary, defining the day_period length for this segment will
prevent BasicFormatMatcher from ever selecting a pattern that contains
this segment. Instead, ECMA-402 will only use the short length for
{ampm} segments.
2021-12-08 11:29:36 +00:00
Andreas Kling 78252d7777 Ports: Add SHA256 checksum to dos2unix port 2021-12-08 10:48:39 +01:00
Andreas Kling fa879168f5 LibJS: Mark Function object's private environment during GC 2021-12-08 10:29:54 +01:00
Andreas Kling f25899ca34 LibJS: Mark entire private environment chains during GC 2021-12-08 10:29:54 +01:00
Andreas Kling 4790f9a628 LibJS: Make sure private environments are marked during GC 2021-12-08 10:29:54 +01:00
Andreas Kling 212319b25e LibJS: Only allocate space for Object private elements if needed
Most JavaScript objects don't have private elements, so this reduces the
size of typical JS::Object instances by two pointers.
2021-12-08 10:29:54 +01:00
Nathan Ell 444a7eb929 dos2unix: Introduce dos2unix port
Port the ubiquitous dos2unix tool to Serenity. Dos2Unix is a suite of
tools for converting file line endings, from dos/mac to unix and unix
to dos/mac.
2021-12-08 09:20:04 +01:00
Tim Schumacher 5c511de4cc AK: Zero-pad automatically if formatting with precision 2021-12-07 20:13:59 -08:00
Lady Gegga aad9d0aa51 Base: Add some Chinese characters to Katica Regular 10
7530, 7531, 7532, 7533, 7534, 7536, 7684, 81EA, 81EB, 548C,
548B, 4E04, 4E05, 4E09, 4E0A, 4E0B, 4E0C, 7518, 754C, 753D,
753C, 753A, 6743, 4E14, 4E17, 65E5, 65E6, 65E7, 975E, 5211,
5E76, 5E75, 5E77, 5E72, 5E73
https://www.unicode.org/charts/PDF/U4E00.pdf
2021-12-07 17:05:57 -08:00
Lady Gegga d3fe5fc1b2 Base: Adjust some Chinese characters in Katica Regular 10
4E8C, 4E00
2021-12-07 17:05:57 -08:00
Lady Gegga 4d088763bd Base: Add some Enclosed CJK Letters and Months to Katica Regular 10
3220, 3221, 3222
https://www.unicode.org/charts/PDF/U3200.pdf
2021-12-07 17:05:57 -08:00
Lady Gegga 3296e54479 Base: Add some CJK Symbols and Punctuations to Katica Regular 10
3001, 3002, 303E, 303F
https://www.unicode.org/charts/PDF/U3000.pdf
2021-12-07 17:05:57 -08:00
Hendiadyoin1 67a1a9db1d WebContent: Add missing TRY on client initialization 2021-12-07 00:44:57 +01:00
Idan Horowitz 39ecb832e4 Kernel: Don't try to dispatch urgent signals for kernel crashes
If we crashed in the kernel there's no point to sending a signal to the
active process, we're going to panic soon anyway.
2021-12-06 19:36:42 +01:00
Idan Horowitz 548488f050 Kernel: Terminate current thread immediately on unhandled urgent signal
If we're sending an urgent signal (i.e. due to unexpected conditions)
and the Process did not setup any signal handler, we should immediately
terminate the Thread, to ensure the current trap frame is preserved for
the impending core dump.
2021-12-06 19:36:42 +01:00
Andreas Kling 971b3645ef LibIPC: Add IPC::take_over_accepted_client_from_system_server<Client>()
This is an encapsulation of the common work done by all of our
single-client IPC servers on startup:

    1. Create a Core::LocalSocket, taking over an accepted fd.
    2. Create an application-specific ClientConnection object,
       wrapping the socket.

It's not a huge change in terms of lines saved, but I do feel that it
improves expressiveness. :^)
2021-12-06 19:22:16 +01:00
Andreas Kling 6d0f504822 LibIPC: Add IPC::MultiServer convenience class
This encapsulates what our multi-client IPC servers typically do on
startup:

    1. Create a Core::LocalServer
    2. Take over a listening socket file descriptor from SystemServer
    3. Set up an accept handler for incoming connections

IPC::MultiServer does all this for you! All you have to do is provide
the relevant client connection type as a template argument.
2021-12-06 19:22:16 +01:00
Andreas Kling 81047d8f9c LibCore: Make LocalServer::take_over_from_system_server() return ErrorOr
This allows us to use TRY() or MUST() when calling it.
2021-12-06 19:22:16 +01:00
Andreas Kling 229a45ab14 SQLServer: Port to LibMain :^) 2021-12-06 19:22:16 +01:00
Andreas Kling 69ea1ff743 LaunchServer: Port to LibMain :^) 2021-12-06 19:22:16 +01:00
Andreas Kling 58b99df16d LibWeb: Make StyleSheet::m_parent_style_sheet a WeakPtr
It's not safe for this to be a raw pointer, as the child can outlive the
parent.
2021-12-06 19:22:16 +01:00
Andreas Kling e8b85b13e2 LibWeb: Make CSSStyleSheet::m_owner_css_rule a WeakPtr
It's not safe for this to be a raw pointer, as the imported style sheet
can outlive the rule.
2021-12-06 19:22:16 +01:00
Andreas Kling f47c658275 LibWeb: Make CSSImportRule::m_document a WeakPtr
It's not safe for this to be a raw reference, as CSSImportRule can
outlive the document.
2021-12-06 19:22:16 +01:00
Andreas Kling 0f9ca51c76 Kernel: Remove unused Inode::preopen_fd() 2021-12-06 19:22:16 +01:00
Timothy Flynn 20b6ffef4f LibJS: Add tests for calendar fields of DateTimeFormat's resolvedOptions
These are (mostly) testable now that LibUnicode parses format patterns.
2021-12-06 15:46:34 +01:00
Timothy Flynn e42d954743 LibJS: Always respect user-provided format field lengths
ECMA-402 doesn't explicitly handle a note in the TR-35 spec related to
expanding field lengths based on user-provided options. Instead, it
assumes the "implementation defined" locale data includes the possible
values.

LibUnicode does not generate every possible combination of field lengths
in its implementation of TR-35's "Missing Skeleton Fields", because the
number of generated patterns would grow out of control. Instead, it's
much simpler to handle this difference at runtime.
2021-12-06 15:46:34 +01:00
Timothy Flynn 9dc9700e3b LibJS: Fallback to [[pattern]] when [[pattern12]] is unavailable
Other implementations unconditionally initialize [[pattern12]] from
[[pattern]] regardless of whether [[pattern]] has an hour pattern of h11
or h12. LibUnicode does not do this. So when InitializeDateTimeFormat
defaults the hour cycle to the locale's preferred hour cycle, if the
best format didn't have an equivalent hour pattern, [[pattern12]] will
be empty.
2021-12-06 15:46:34 +01:00
Timothy Flynn dfe8d02482 LibUnicode: Generate missing format patterns
TR-35 describes how to combine date, time, and available formats with
date-time format patterns to generate more available format patterns:
https://unicode.org/reports/tr35/tr35-dates.html#Missing_Skeleton_Fields

Use these steps to generate ~400 new patterns for each calendar. These
are required for ECMA-402's BasicFormatMatcher to produce reasonable
results.
2021-12-06 15:46:34 +01:00
Timothy Flynn 439b06bf0f LibUnicode: Fully parse date-time formatting patterns
Similar to NumberFormat, replace the segments of date-time patterns with
partitions that can be split at runtime. Also generate the pattern style
fields for e.g. era, day, hour, etc.
2021-12-06 15:46:34 +01:00
Timothy Flynn 2772606527 LibUnicode: Generate unique calendar pattern structures
Add unique storage for parsed CalendarPattern structures to ensure only
one copy of each structure is generated.

This doesn't have any impact on libunicode.so with the current generated
data. Rather, this prevents the amount of generated data from needlessly
growing astronomically once date-time patterns are fully parsed. There
will be 173,459 patterns parsed, of which only 22,495 (about 12%) are
unique. This change will save a few MB, and will also help compilation
times.
2021-12-06 15:46:34 +01:00
Timothy Flynn 1d735105c3 LibUnicode: Generate per-locale, per-calendar formats out of line
Currently, there's only a handful of entries in these arrays, so it is
not a huge deal to generate them inline with the struct that holds them.
But they will each soon contain a few hundred entries. Generate them out
of line for easier viewing in the generated code.
2021-12-06 15:46:34 +01:00
Timothy Flynn 945ca81dd7 LibUnicode: Generate unique number format structures
Add unique storage for parsed NumberFormat structures to ensure only one
copy of each structure is generated. Reduces libunicode.so on x86 from
13.2 MB to 11.4 MB.
2021-12-06 15:46:34 +01:00
Timothy Flynn d8e6beb14f LibUnicode: Generalize the generators' unique string storage
UniqueStringStorage is used to ensure only one copy of a string will be
generated, and interested parties store just an index into the generated
storage. Generalize this class to allow any* type to be stored uniquely.

* To actually be storable, the type must have both an AK::Format and an
AK::Traits overload available.
2021-12-06 15:46:34 +01:00
Ben Wiederhake 152d455143 strace: Handle strings more gracefully
In particular, strace can now stomach memory errors while copying
invalid strings.

Example with a valid string:
    dbgputstr("95.976 traceme(38:38) Well, Hello Friends!") = 55
Example with an invalid string:
    dbgputstr(Error(errno=14){0x00012345, 678b}) = -14 EFAULT
(ANSI escapes removed for readability.)
2021-12-05 22:59:09 +01:00
Ben Wiederhake 0e6e1092f0 Kernel: Make ptrace return an error on error
Returning 'result.error().code()' erroneously creates an
ErrorOr<FlatPtr> of the positive errno code, which breaks our
error-returning convention.

This seems to be due to a forgotten minus-sign during the refactoring in
9e51e295cf. This latent bug was never
discovered, because currently the error-handling paths are rarely
exercised.
2021-12-05 22:59:09 +01:00
Ben Wiederhake 49adebf0fc strace: Use new PT_PEEKBUF function
This necessarily introduces some usages (and benefits!) of the new
ErrorOr<> pattern. To keep commits atomic, I do not yet rewrite the
entire program to use ErrorOr<> correctly.
2021-12-05 22:59:09 +01:00
Ben Wiederhake 70e96fb917 LibCore: Implement new ptrace_peekbuf wrapper for PT_PEEKBUF syscall 2021-12-05 22:59:09 +01:00
Ben Wiederhake 0f8483f09c Kernel: Implement new ptrace function PT_PEEKBUF
This enables the tracer to copy large amounts of data in a much saner
way.
2021-12-05 22:59:09 +01:00
Ben Wiederhake 3e223185b3 Kernel+strace: Remove unnecessary indirection for PEEK
Also, remove incomplete, superfluous check.
Incomplete, because only the byte at the provided address was checked;
this misses the last bytes of the "jerk page".
Superfluous, because it is already correctly checked by peek_user_data
(which calls copy_from_user).

The caller/tracer should not typically attempt to read non-userspace
addresses, we don't need to "hot-path" it either.
2021-12-05 22:59:09 +01:00
Ben Wiederhake 6f37510a71 AK: Implement missing const getters in AK::Error, fix typo
Note that the return type for the non-const method error() changed. This
is most likely an accident, hidden by the fact that ErrorType typically
is Error.
2021-12-05 22:59:09 +01:00
Ben Wiederhake dbd60f9ff4 AK: Implement Formatter for ErrorOr<>
As the Formatter for Error already exists, this apparently was just
accidentally omitted.
2021-12-05 22:59:09 +01:00
Lady Gegga cf315635a8 Base: Add 1F9AC to font Katica Regular 10
1F9AC https://www.unicode.org/charts/PDF/U1F900.pdf
2021-12-05 11:07:26 -08:00
Lady Gegga edf96ef15d Base: Add some Vai characters to font Katica Regular 10
A578–A5A7 https://www.unicode.org/charts/PDF/UA500.pdf
2021-12-05 11:07:26 -08:00