Commit Graph

4689 Commits

Author SHA1 Message Date
Timothy Flynn
86b99fd9a6 LibJS: Extend Intl.DisplayNames.of to support currency tags 2021-08-27 12:32:24 +01:00
Timothy Flynn
8b93d51212 LibUnicode: Parse Unicode CLDR currencies and generate locale mappings 2021-08-27 12:32:24 +01:00
Timothy Flynn
297db925fc LibUnicode: Extract cldr-numbers dataset from CLDR database
This dataset holds the values needed to handle DisplayNames.prototype.of
with a type option of "currency".
2021-08-27 12:32:24 +01:00
Timothy Flynn
a029e3d38a LibJS: Extend Intl.DisplayNames.of to support script tags 2021-08-27 12:32:24 +01:00
Timothy Flynn
0f02def3c2 LibUnicode: Parse Unicode CLDR scripts and generate locale mappings 2021-08-27 12:32:24 +01:00
Timothy Flynn
ca77a7c573 LibJS: Extend Intl.DisplayNames.of to support language tags 2021-08-27 12:32:24 +01:00
Timothy Flynn
ab7a1dd89e LibUnicode: Parse Unicode CLDR languages and generate locale mappings 2021-08-27 12:32:24 +01:00
Timothy Flynn
6719e5cb17 LibUnicode: Generate locale subtag data as multiple smaller tables
This commit is preemptive to upcoming commits which add more subtags to
the CLDR generator. Rather than generating a giant HashMap containing
all data, generate more (smaller) Array-based tables. This mimics the
UCD generator. This also allows simpler lookups at runtime since we can
generate index-based lookups into the smaller tables rather easily.

Without this change, adding the remaining locale subtags would result
in the generation and compilation of UnicodeLocale.cpp taking about 30s
on my machine. With this change, it takes about half that. Additionally,
the size of the generated file reduces by about 1.5MB.
2021-08-27 12:32:24 +01:00
Timothy Flynn
b8ad4d302e LibUnicode: Move Locale enumeration from generated UCD data to CLDR data
The UCD set of data contained a very small subset of all locales just to
handle some special casing rules. This enumeration will be needed within
the CLDR generator as well. So rather than duplicate the enum, remove it
from the UCD generator in favor of the full list of locales known by the
CLDR generator.
2021-08-27 12:32:24 +01:00
Andreas Kling
edf7843409 ConfigServer+LibConfig: Add way for clients to listen for config changes
This patch adds a Config::Listener abstract class that anyone can
inherit from and receive notifications when configuration values change.

We don't yet monitor file system changes, so these only work for changes
made by ConfigServer itself.

In order to receive these notifications, clients must monitor the domain
by calling monitor_domain(). Only pledged domains can be monitored.

Note that the client initiating the change does not get notified.
2021-08-26 23:41:38 +02:00
Andreas Kling
9509f2ff87 LibWeb: Remove outdated FIXME about ACID2
I should have removed this in 1fa5fba432.
2021-08-26 23:41:37 +02:00
Timothy Flynn
a57615c2b4 Meta: Ensure cmake fails if we are unable to unzip the CLDR database 2021-08-26 23:40:23 +02:00
Timothy Flynn
a061d874c9 LibJS: Implement Intl.DisplayNames.prototype.resolvedOptions 2021-08-26 22:04:09 +01:00
Timothy Flynn
17bb652775 LibJS: Implement Intl.DisplayNames.prototype.of
Note that only option type=region is really implemented. Other types
will resort to the fallback option. This prototype method will be able
to implement other type options once LibUnicode supports more.
2021-08-26 22:04:09 +01:00
Timothy Flynn
38d29a40dc LibJS: Implement Intl.getCanonicalLocales 2021-08-26 22:04:09 +01:00
Timothy Flynn
e8dd2eea74 LibJS: Implement the Intl.DisplayNames constructor
There is notably FIXME notations in this commit regarding Unicode locale
extensions. We are not parsing extensions (or private use extensions) at
all yet.
2021-08-26 22:04:09 +01:00
Timothy Flynn
0fb4e8b749 LibJS: Implement a nearly empty Intl.DisplayNames object
This adds plumbing for the Intl.DisplayNames object, constructor, and
prototype.
2021-08-26 22:04:09 +01:00
Timothy Flynn
137e98cb6f LibUnicode: Add public accessors to generated locale data 2021-08-26 22:04:09 +01:00
Timothy Flynn
b7a95cba65 LibUnicode: Implement grammar validators for Unicode TR-35
ECMA-402 requires validating user input against the EBNF grammar for
Unicode locales described in TR-35: https://www.unicode.org/reports/tr35

This commit adds validators for that grammar, as well as other helper to
e.g. canonicalize a locale string.
2021-08-26 22:04:09 +01:00
Timothy Flynn
ea21573ed8 LibUnicode: Download Unicode's CLDR database and generate locale data
The Unicode standard publishes a database known as the Common Locale
Data Repository (CLDR). This is a massive set of data from which anyone
implementing Unicode's Technical Standard #35 may generate their
implementation: https://www.unicode.org/reports/tr35/

This commit updates LibUnicode to download the compressed database and
extract a small subset. That subset is used to generate a list of
available locales and the territories (AKA regions) associated with each
locale.
2021-08-26 22:04:09 +01:00
Stephan Unverwerth
b54573739c LibGL: Implement glTexEnvf
This controls how fetched texels are combined with the color that was
produced by a preceding texture unit or with the vertex color if it is
the first texture unit.

Currently only a small subset of possible combine modes is implemented
as required by glquake.
2021-08-26 19:54:31 +02:00
Stephan Unverwerth
19a08ff187 LibGL: Implement glPixelStorei
This sets the length of a row for the image to be transferred. This
value is measured in pixels. When a rectangle with a width less than
this value is transferred the remaining pixels of this row are skipped.
2021-08-26 19:53:57 +02:00
Andreas Kling
1fa5fba432 LibWeb: Make the base StyleValue::to_length() return an undefined length
Previously it was returning an "auto" length. This caused all the new
"initial" values to effectively turn into auto values long before layout
had a chance to resolve them.

This broke replaced elements with intrinsic size but no specified width
or height, and is the reason that Mr. ACID2 temporarily lost his eyes.
2021-08-26 13:25:52 +02:00
Andreas Kling
243e9a8b4a LibWeb: Correct CSS initial values for min-width and min-height
The initial value for these is auto, not 0.
2021-08-26 13:25:52 +02:00
Andreas Kling
cf8f1c5a5f LibWeb: Remove unused CSS::StyleProperties::string_or_fallback() 2021-08-26 13:25:52 +02:00
Andreas Kling
eeddaa988a ConfigServer+LibConfig: Add pledge_domains() API
This API lets applications specify which configuration domains they
will be accessing throughout their lifetime. It works similarly in
spirit to the kernel's pledge().

You cannot pledge_domains() more than once, and once you have used it,
it's no longer possible to access any other configuration domain.

This is obviously just a first cut of this mechanism, and we may need
to tweak it further as we go.
2021-08-26 00:54:28 +02:00
Andreas Kling
870ecd5190 LibConfig: VERIFY that a Core::EventLoop exists before connecting
It's not possible to connect to ConfigServer without having an event
loop available. This VERIFY makes it much easier to understand why
things are not working. :^)
2021-08-26 00:54:28 +02:00
Andreas Kling
67a0fa2b78 LibCore: Add Core::EventLoop::has_been_instantiated()
This static bool getter can be used to VERIFY that an event loop exists,
in situations where one is expected.

This is helpful if the absence of an event loop would generate strange
and/or loud errors that don't immediately point to this as a cause.
2021-08-26 00:54:27 +02:00
Andreas Kling
82d8cd2b87 Terminal+LibVT: Use LibConfig instead of Core::ConfigFile 2021-08-26 00:54:27 +02:00
Andreas Kling
bdcd0abf9d Userland: Introduce ConfigServer and LibConfig
ConfigServer is an IPC service that provides access to application
configuration and settings. The idea is to replace all uses of
Core::ConfigFile with IPC requests to ConfigServer.

This first cut of the API is pretty similar to Core::ConfigFile.

The old:

    auto config = Core::ConfigFile::open_for_app("App");
    auto value = config->read_entry("Group", "Key");

The new:

    auto value = Config::read_string("App", "Group", "Key");

ConfigServer uses the ~/.config directory as its backing store
and all the files remain human-editable. :^)
2021-08-26 00:54:27 +02:00
Jean-Baptiste Boric
0248e6ae27 LibC: Check for expected size of struct __jmp_buf
This structure is accessed through assembly code inside setjmp.S, make
some effort to ensure both header and assembly files are in sync.
2021-08-26 00:54:23 +02:00
Jean-Baptiste Boric
295e89af04 LibC: Fix sigsetjmp on x86_64
Registers were clobbered, offset values into __jmp_buf were wrong...
2021-08-26 00:54:23 +02:00
Jean-Baptiste Boric
c87aa6d908 LibC: Fix sigsetjmp on i686
Calling sigprocmask() through the PLT requires setting the ebx register
to the address of the global offset table, otherwise chaos ensues. Also
the value of the ecx register was assumed to be preserved across that
function call despite the fact that it is caller-saved in the x86
calling convention.
2021-08-26 00:54:23 +02:00
Ali Mohammad Pur
04e3965b09 LibWasm: Use Operators::BitShiftRight for i64.shru
Using a left-shift operator for a right shift operation is not exactly
the most correct action :P
2021-08-26 00:51:30 +02:00
Jesse Buhagiar
924d890bfe LibGL: Implement fog effect in Software Rasterizer
We support three of the possible fog modes, EXP, EXP2 and LINEAR.
2021-08-25 23:50:54 +04:30
Jesse Buhagiar
d73cc3d0eb LibGL: Implement glFogi 2021-08-25 23:50:54 +04:30
Jesse Buhagiar
f55d2a22af LibGL: Implement glFogf 2021-08-25 23:50:54 +04:30
Jesse Buhagiar
7f1cd54b80 LibGL: Implement glFogfv
This currently just sets the fog colour in the rasterizer.
2021-08-25 23:50:54 +04:30
Karol Kosek
ffa7da0ca5 LibWeb: Handle CSS "ch" length unit (mostly)
This isn't 100% spec complaint, as it should use glyph_height()
depending on what the value of the writing-mode is, but we haven't
implemented it yet, so I think it'll be good enough for now.

This can be tested in https://wpt.live/css/css-values/ch-unit-008.html
Other css-unit tests fail as:
- 001 shows an issue related to a renderer (looks to me like you can't
  pass a width and height property to a span -- adding `display: block`
  to it passes the test),
- 002-004 and 009-012 use mentioned writing-mode,
- 016-017 loads custom fonts, which we also don't support (yet).
2021-08-25 17:55:53 +02:00
Sam Atkins
b92a6d6542 LibWeb: Implement CSS unset builtin value
This is equivalent to `initial` or `inherit`, depending on if the
property is inherited by default.
2021-08-25 12:14:34 +02:00
Sam Atkins
3296fd70b3 LibWeb: Intercept CSS initial/inherit values in StyleProperties
When property() previously would have returned an InitialStyleValue, we
now look up what the initial value would be, and return that instead.

We also intercep 'inherit', but inheritance is not implemented yet so we
just return nothing.

This does cause a regression on Acid2: The eyes no longer appear, and I
am not sure why. :^(
2021-08-25 12:14:34 +02:00
Sam Atkins
8995839e3f LibWeb: Generate property_initial_value() function from Properties.json
Since we have initial-value data in Properties.json already, it makes
sense to use that instead of needing to duplicate the same information
in ComputedValues.h

However, converting a StyleValue to the kind of types used in
InitialValues is non-trivial. So this may or may not actually be useful.
2021-08-25 12:14:34 +02:00
Sam Atkins
38ee69adfa LibWeb: Add StyleValue to Forward.h 2021-08-25 12:14:34 +02:00
Sam Atkins
543550d1df LibWeb: Quote all initial values in Properties.json
This is in preparation for parsing these into StyleValues automatically.
Having them all be Strings makes the generation code simpler.
2021-08-25 12:14:34 +02:00
Sam Atkins
6d39f4342d LibWeb: Use single shared instance of Inherit/InitialStyleValue
These are always the same, so we can avoid allocating them repeatedly
and just use a single instance of each. :^)
2021-08-25 12:14:34 +02:00
Sam Atkins
d2342caf42 LibWeb: Parse CSS builtins before other values
These are straightforward to parse, so doing them first saves
potentially expensive calculations inside parse_foo_value() functions.
2021-08-25 12:14:34 +02:00
Brian Gianforcaro
77d8a65498 LibJS: Fix incorrect Lexer VERIFY when parsing Unicode characters
This bug was discovered via OSS fuzz, it's possible to fall through
to this assert with a char_size == 1, so we need to account for that
in the VERIFY(..).

Repro test case can be found in the OSS fuzz bug:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37296
2021-08-25 09:21:23 +01:00
Ralf Donau
a501b903b5 LibCore: Set file offset in ConfigFile::sync 2021-08-24 18:17:09 +02:00
Andreas Kling
fd922cf92f LibWeb+WebContent: Add a simple API for running arbitrary JavaScript
This patch adds OutOfProcessWebView::run_javascript(StringView).
This can be used by the OOPWV embedder to execute arbitrary JavaScript
in the top-level browsing context on the WebContent process side.
2021-08-24 16:56:42 +02:00
Andreas Kling
dfa9dcca98 LibWeb+Browser: Remove unnecessary InProcessWebView.h includes 2021-08-24 16:37:28 +02:00
davidot
c108c8ff24 LibJS: Disallow yield expression correctly in formal parameters
And add ZERO WIDTH NO BREAK SPACE to valid whitespace.
2021-08-24 07:42:37 +01:00
davidot
7bcffd1b6a LibJS: Fix some small remaining issues with parsing unicode escapes
Added a test to ensure the behavior stays the same.
We now throw on a direct usage of an escaped keywords with a specific
error to make it more clear to the user.
2021-08-24 07:42:37 +01:00
Linus Groh
6ce05026b4 LibJS: Implement Temporal.ZonedDateTime.prototype.toPlainMonthDay() 2021-08-24 01:53:30 +02:00
Linus Groh
ef581be4ec LibJS: Implement Temporal.ZonedDateTime.prototype.toPlainYearMonth() 2021-08-24 01:53:30 +02:00
Linus Groh
fc58f93734 LibJS: Implement Temporal.PlainDateTime.prototype.toPlainMonthDay() 2021-08-24 01:53:30 +02:00
Linus Groh
5573efa3bd LibJS: Implement Temporal.PlainDateTime.prototype.toPlainYearMonth() 2021-08-24 01:53:30 +02:00
Linus Groh
ad427f85ca LibJS: Implement Temporal.PlainDateTime.from() 2021-08-23 20:54:52 +01:00
Linus Groh
573587b83a LibJS: Fix logic error in RegulateISODate 2021-08-23 20:54:52 +01:00
Sam Atkins
226fe4b57d LibWeb: Paint inspection outline for InlineNodes :^)
This iterates the fragments of the containing block, and paints their
outlines if they are descendants of the InlineNode.

If multiple fragments are adjacent, eg:

```html
<span><b>Well</b> hello <i>friends!</i></span>
```

...then we get a double-thick outline between "Well", " hello " and
"friends!", but we can come back to this after we implement
non-rectangular outlines for the `outline` CSS property.
2021-08-23 15:59:29 +02:00
Sam Atkins
8eef509c1b LibWeb: Add DOMTreeModel::index_for_node()
This is needed for telling the DOM Inspector to select a given Node.
2021-08-23 15:59:29 +02:00
Maciej Zygmanowski
3597b6eb9d WindowServer+LibGfx: Move CursorParams to LibGfx
They will be used by MouseSettings in the next commit.
2021-08-23 01:41:53 +02:00
Timothy Flynn
4f186a9a1f LibJS: Implement Promise.race on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
949f294444 LibJS: Implement Promise.allSettled on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
4dffa40a8d LibJS: Implement Promise.any on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
98d8a858cd LibJS: Set the function names for the resolve, reject, and executor
These should all have a name with an empty string. Not only does test262
verify this, but it also verifies that (for the executor) the name
property is defined after the length property.
2021-08-23 00:01:46 +01:00
Timothy Flynn
5b303721e0 LibJS: Generalize PerformPromiseAll common functionality
PerformPromiseAll, PerformPromiseAny, PerformPromiseAllSettled, etc, all
have very similar iteration loops. To avoid duplicating this rather
large block of code, extract the common functionality into a separate
method.
2021-08-23 00:01:46 +01:00
Timothy Flynn
417523507e LibJS: Generalize PromiseAllResolveElementFunction common functionality
The element-resolving functions on the Promise constructor are all very
similar. To prepare for more of these functions to be implemented, break
out common parts into a base class.
2021-08-23 00:01:46 +01:00
Andreas Kling
bcd2025311 Everywhere: Core dump => Coredump
We all know what a coredump is, and it feels more natural to refer to
it as a coredump (most code already does), so let's be consistent.
2021-08-23 00:02:09 +02:00
Linus Groh
969aee2022 LibJS: Add missing builtin calendar check to ParseTemporalCalendarString
See: https://github.com/tc39/proposal-temporal/commit/48b11d6
2021-08-22 21:20:00 +01:00
Andrew January
9a4c1c019a LibGUI: Make Ctrl+Shift+Right select text
Ctrl+Shift+Left would add the word before the cursor to the selection,
but for some reason Ctrl+Shift+Right didn't add the word after the
cursor to the selection.
2021-08-22 15:31:27 +02:00
Maciej Zygmanowski
7237972022 LibC: Support getsignalbyname() with full signal name
This allows e.g. to use `kill` with names like -SIGKILL, not only -KILL.
2021-08-22 15:23:25 +02:00
Karol Kosek
219206725b LibGUI: Always resize the mapping rows when sorting
Prior this change, creating a file or directory
on Desktop crashed the desktop instance of FileManager.

Closes: #9560
2021-08-22 10:29:17 +02:00
Peter Elliott
ee0c6e1b6d LibC: Add <sys/poll.h> as an alias for <poll.h>
<poll.h> was originally <sys/poll.h> and some old software like X11
still uses the old path.
2021-08-22 10:29:06 +02:00
Peter Elliott
39a77559f1 Kernel+LibC: Implement FIONREAD ioctl
FIONREAD gets the number of bytes availible to read from a file
descriptor without blocking. I only implemented it for regular files and
sockets
2021-08-22 10:29:06 +02:00
Peter Elliott
db92e66902 LibC: Make <netinet/in.h> more POSIX compliant
1. Move htonl() etc. from <arpa/inet.h> to <netinet/in.h> (which
   <arpa/inet.h> includes).

   The htonl(), htons(), ntohl(), and ntohs() functions shall be
   available as described in <arpa/inet.h>.  Inclusion of the
   <netinet/in.h> header may also make visible all symbols from
   <arpa/inet.h>.

   - POSIX

2. Define IN6_IS_ADDR_LOOPBACK() and IN6_IS_ADDR_V4MAPPED()
2021-08-22 10:29:06 +02:00
Peter Elliott
f16aba405f LibC: Add LINK_MAX and _PC_LINK_MAX
LINK_MAX was set arbitrarily to 4096, this is not an actual system
limit.
2021-08-22 10:29:06 +02:00
Peter Elliott
d9ecb3ecfa LibC: Modify fd_set to be compatible with X/OPEN
For some reason X/OPEN requires that fd_set has a field fds_bits. Xproto
requires either fds_bits or _fds_bits to be present, so the field 'bits'
was renamed 'fds_bits'
2021-08-22 10:29:06 +02:00
networkException
acde7d12b0 Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to open
This patch brings the ConfigFile helpers for opening lib, app and system
configs more inline with the regular ConfigFile::open functions.
2021-08-22 01:32:25 +02:00
networkException
938051feb8 Everywhere: Use Core::ConfigFile::AllowWriting::Yes to allow writing 2021-08-22 01:32:25 +02:00
networkException
54bbe52b51 LibCore: Convert ConfigFile to east const 2021-08-22 01:32:25 +02:00
networkException
2ea2d026c2 LibCore: Support using a file descriptor for opening ConfigFile
This patch adds support for opening a ConfigFile using a file
descriptor rather than trying to open a the file by name directly.

In contrast to the previous implementation, ConfigFile now always keeps
a reference to an open File and does not reopen it for writing.

This requires providing an additional argument to open functions if a
file gets opened based on its name and the user of the api intends to
write to the file in the future.
2021-08-22 01:32:25 +02:00
Timothy Flynn
dee3b7b8c9 LibJS: Implement Promise.all on the Promise constructor 2021-08-21 23:08:49 +01:00
Timothy Flynn
cdf2854fdf LibJS: Fix copy-paste mistake in GetCapabilitiesExecutor 2021-08-21 23:08:49 +01:00
Itamar
f91974677c LibCpp: Use lex_iterable() where applicable 2021-08-21 22:09:56 +02:00
Itamar
606e05852f LibCpp: Add lex_iterable() method to the Lexer
This allows us to collect the tokens iteratively instead of having to
lex the whole program and then get a tokens vector.
2021-08-21 22:09:56 +02:00
Itamar
7a4a32b112 LibCpp: Lex before processing the source in the Preprocessor
Previously, the preprocessor first split the source into lines, and then
processed and lexed each line separately.

This patch makes the preprocessor first lex the source, and then do the
processing on the tokenized representation.

This generally simplifies the code, and also fixes an issue we
previously had with multiline comments (we did not recognize them
correctly when processing each line separately).
2021-08-21 22:09:56 +02:00
Itamar
165a0082c4 LibCpp: Allow whitespace between # and preprocessor directive
For example, '#    include <stdio.h>' is now supported by the Lexer.
2021-08-21 22:09:56 +02:00
Jan de Visser
85a84b0794 LibSQL: Introduce Serializer as a mediator between Heap and client code
Classes reading and writing to the data heap would communicate directly
with the Heap object, and transfer ByteBuffers back and forth with it.
This makes things like caching and locking hard. Therefore all data
persistence activity will be funneled through a Serializer object which
in turn submits it to the Heap.

Introducing this unfortunately resulted in a huge amount of churn, in
which a number of smaller refactorings got caught up as well.
2021-08-21 22:03:30 +02:00
Jan de Visser
d074a601df LibSQL+SQLServer: Bare bones INSERT and SELECT statements
This patch provides very basic, bare bones implementations of the
INSERT and SELECT statements. They are *very* limited:
- The only variant of the INSERT statement that currently works is
   SELECT INTO schema.table (column1, column2, ....) VALUES
      (value11, value21, ...), (value12, value22, ...), ...
   where the values are literals.
- The SELECT statement is even more limited, and is only provided to
  allow verification of the INSERT statement. The only form implemented
  is: SELECT * FROM schema.table

These statements required a bit of change in the Statement::execute
API. Originally execute only received a Database object as parameter.
This is not enough; we now pass an ExecutionContext object which
contains the Database, the current result set, and the last Tuple read
from the database. This object will undoubtedly evolve over time.

This API change dragged SQLServer::SQLStatement into the patch.

Another API addition is Expression::evaluate. This method is,
unsurprisingly, used to evaluate expressions, like the values in the
INSERT statement.

Finally, a new test file is added: TestSqlStatementExecution, which
tests the currently implemented statements. As the number and flavour of
implemented statements grows, this test file will probably have to be
restructured.
2021-08-21 22:03:30 +02:00
Jan de Visser
230118c4b2 LibSQL: Added 'nullable' and 'default value' option to ColumnDef
These are standard SQL concepts which columns should be aware of.
2021-08-21 22:03:30 +02:00
Jan de Visser
b74721e604 LibSQL: Redesign Value implementation and add new types
The implemtation of the Value class was based on lambda member variables
implementing type-dependent behaviour. This was done to ensure that
Values can be used as stack-only objects; the simplest alternative,
virtual methods, forces them onto the heap. The problem with the the
lambda approach is that it bloats the Values (which are supposed to be
lightweight objects) quite considerably, because every object contains
more than a dozen function pointers.

The solution to address both problems (we want Values to be able to live
on the stack and be as lightweight as possible) chosen here is to
encapsulate type-dependent behaviour and state in an implementation
class, and let the Value be an AK::Variant of those implementation
classes. All methods of Value are now basically straight delegates to
the implementation object using the Variant::visit method.

One issue complicating matters is the addition of two aggregate types,
Tuple and Array, which each contain a Vector of Values. At this point
Tuples and Arrays (and potential future aggregate types) can't contain
these aggregate types. This is limiting and needs to be addressed.

Another area that needs attention is the nomenclature of things; it's
a bit of a tangle of 'ValueBlahBlah' and 'ImplBlahBlah'. It makes sense
right now I think but admit we probably can do better.

Other things included here:
- Added the Boolean and Null types (and Tuple and Array, see above).
- to_string now always succeeds and returns a String instead of an
  Optional. This had some impact on other sources.
- Added a lot of tests.
- Started moving the serialization mechanism more towards where I want
  it to be, i.e. a 'DataSerializer' object which just takes
  serialization and deserialization requests and knows for example how
  to store long strings out-of-line.

One last remark: There is obviously a naming clash between the Tuple
class and the Tuple Value type. This is intentional; I plan to make the
Tuple class a subclass of Value (and hence Key and Row as well).
2021-08-21 22:03:30 +02:00
Jan de Visser
a5e28f2897 LibSQL: Make TupleDescriptor a shared pointer instead of a stack object
Tuple descriptors are basically the same for for example all rows in
a table. Makes sense to share them instead of copying them for every
single row.
2021-08-21 22:03:30 +02:00
Jesse Buhagiar
0152f1924b LibGL: Use integer comparison for GL_EQUAL and GL_NOTEQUAL
This is an interesting quirk that occurs due to us using the x87 FPU
when Serenity is compiled for the i386 target. When we calculate our
depth value to be stored in the buffer, it is an 80-bit x87
floating point number, however, when stored into the DepthBuffer,
this is truncated to 32 bits. This 38 bit loss of precision means
that when x87 `FCOMP` is eventually used here the comparison fails.

This could be solved by using a `long double` for the depth buffer,
however this would take up significantly more space and is completely
overkill for a depth buffer. As such, comparing the first 32-bits of
this depth value is "good enough" that if we get a hit on it being
equal, we can pretty much guarantee that it's actually equal.
2021-08-21 13:48:59 +04:30
TheFightingCatfish
9721b7b2dd LibCore: Show version and help before parsing positional arguments
This allows `--version` and `--help` to work properly even if we do not
supply the required positional arguments to a command.
2021-08-20 20:13:12 +02:00
Timothy Flynn
6337eb52d8 LibJS: Implement RegExp.prototype.compile
This is an Annex B extension to RegExp.prototype.
2021-08-20 19:16:33 +02:00
Timothy Flynn
562d4e497b LibRegex: Treat pattern string characters as unsigned
For example, consider the following pattern:

    new RegExp('\ud834\udf06', 'u')

With this pattern, the regex parser should insert the UTF-8 encoded
bytes 0xf0, 0x9d, 0x8c, and 0x86. However, because these characters are
currently treated as normal char types, they have a negative value since
they are all > 0x7f. Then, due to sign extension, when these characters
are cast to u64, the sign bit is preserved. The result is that these
bytes are inserted as 0xfffffffffffffff0, 0xffffffffffffff9d, etc.

Fortunately, there are only a few places where we insert bytecode with
the raw characters. In these places, be sure to treat the bytes as u8
before they are cast to u64.
2021-08-20 19:16:33 +02:00
Timothy Flynn
7c54b6bd45 LibJS: Separate RegExpCreate into RegExpAlloc and RegExpInitialize
RegExp.prototype.compile will require invoking RegExpInitialize on an
already-existing RegExpObject. Break up RegExpCreate into RegExpAlloc
and RegExpInitialize to support this.
2021-08-20 19:16:33 +02:00
Sam Atkins
8f2ab524fa LibWeb: Fix inverted-if typo in flex_shrink_factor()
I messed this up when I changed it before, which was causing a crash.
2021-08-20 19:15:32 +02:00
Linus Groh
5d116372a8 LibJS: Implement Temporal.PlainMonthDay.prototype.toJSON() 2021-08-20 18:12:15 +01:00
Linus Groh
5904c6bf18 LibJS: Implement Temporal.PlainMonthDay.prototype.toLocaleString() 2021-08-20 18:12:15 +01:00