Commit graph

31483 commits

Author SHA1 Message Date
Ali Mohammad Pur
49cbd4dcca AK: Make DisjointChunks not query size() when there are no chunks 2021-12-21 22:10:07 +01:00
Ali Mohammad Pur
2df54a7b56 AK: Add Disjoint(Chunks Spans)::find(index)
For when the may or may not be out of bounds.
2021-12-21 22:10:07 +01:00
Timothy Flynn
c417374dd6 LibUnicode: Remove linkage from LibUnicode to LibUnicodeData
LibUnicodeData can now be loaded dynamically at runtime.
2021-12-21 13:09:49 -08:00
Timothy Flynn
52394deece LibUnicode: Remove now unused value-from-string generator overload
The generate_value_from_string_for_dynamic_loading() overload was just
temporary until all generates were switched over to dynamic loading.
2021-12-21 13:09:49 -08:00
Timothy Flynn
15e1498419 LibUnicode: Dynamically load the generated UnicodeDateTimeFormat symbols 2021-12-21 13:09:49 -08:00
Timothy Flynn
a1f0ca59ae LibUnicode: Dynamically load the generated UnicodeNumberFormat symbols 2021-12-21 13:09:49 -08:00
Timothy Flynn
09be26b5d2 LibUnicode: Dynamically load the generated UnicodeLocale symbols 2021-12-21 13:09:49 -08:00
Timothy Flynn
3fd53baa25 LibUnicode: Dynamically load the generated UnicodeData symbols
The generated data for libunicodedata.so is quite large, and loading it
is a price paid by nearly every application by way of depending on
LibRegex. In order to defer this cost until an application actually uses
one of the surrounding APIs, dynamically load the generated symbols.

To be able to load the symbols dynamically, the generated methods must
have demangled names. Typically, this is accomplished with `extern "C"`
blocks. The clang toolchain complains about this here because the types
returned from the generators are strictly C++ types. So to demangle the
names, we use the asm() compiler directive to manually define a symbol
name; the caveat is that we *must* be sure the symbols are unique. As an
extra precaution, we prefix each symbol name with "unicode_". For more
details, see: https://gcc.gnu.org/onlinedocs/gcc/Asm-Labels.html

This symbol loader used in this implementation provides the additional
benefit of removing many [[maybe_unused]] attributes from the LibUnicode
methods. Internally, if ENABLE_UNICODE_DATABASE_DOWNLOAD is OFF, the
loader is able to stub out the function pointers it returns.

Note that as of this commit, LibUnicode is still directly linked against
LibUnicodeData. This commit is just a first step towards removing that.
2021-12-21 13:09:49 -08:00
Timothy Flynn
749d5ebd68 LibUnicode: Add missing forward declarations to forwarding header 2021-12-21 13:09:49 -08:00
Timothy Flynn
97508b74eb LibUnicode: Remove declaration of function which moved to another header
Unicode::get_number_system_symbol is declared in UnicodeNumberFormat and
defined in UnicodeNumberFormat.cpp.
2021-12-21 13:09:49 -08:00
Timothy Flynn
10a8b6d411 Userland: Add unveil/pledge requisites for dynamic Unicode data loading
Loading libunicodedata.so will require dlopen(), which in turn requires
mmap(). The 'prot_exec' pledge is needed for this.

Further, the .so itself must be unveiled for reading. The "real" path is
unveiled (libunicodedata.so.serenity) as the symlink (libunicodedata.so)
itself cannot be unveiled.
2021-12-21 13:09:49 -08:00
alexmajor
35e5cbe3b3 Documentation: Update VSCode configuration
Remove note about CMake Tools as version 1.9.0 has shipped and no longer
needed. Update details for files to latest versions and allow easier
copy and paste into an empty file.
2021-12-21 22:09:06 +01:00
Jelle Raaijmakers
7fa2e792a8 LibGL: Simplify glDrawPixels checks and reduce debug spam 2021-12-21 12:58:58 -08:00
Jelle Raaijmakers
a1fb16e89c LibGL: Implement GL_POLYGON rendering
This is a deprecated feature that is still in use in some older games,
most notably Grim Fandango in ScummVM makes heavy use of it.

Luckily, since you can only draw convex polygons, the end result is
exactly the same as when you would have used `glBegin(GL_TRIANGLE_FAN)`
- so we just reuse that code as-is.
2021-12-21 12:58:58 -08:00
Jelle Raaijmakers
604eea5827 LibGL: Allow querying maximum matrix stack depths 2021-12-21 12:58:58 -08:00
Jelle Raaijmakers
18399d00fa LibGL: Implement matrix mode GL_TEXTURE
Implement support for the `GL_TEXTURE` matrix mode, the texture matrix
stack and texture coordinate matrix transformation.

Also, an unused `m_current_matrix` was removed to make room for
`m_texture_matrix`.
2021-12-21 12:58:58 -08:00
Jelle Raaijmakers
4703e8cbcf LibGL: Make texture coordinates a FloatVector4
In OpenGL, texture coordinates can have up to 4 values. This change
will help with easy application of texture coordinate matrix
transformations in the future.

Additionally, correct the initial value for texture coordinates to
`{ 0.f, 0.f, 0.f, 1.f}`.
2021-12-21 12:58:58 -08:00
Martin Bříza
86b249f02f Kernel: Implement sysconf(_SC_SYMLOOP_MAX)
Not much to say here, this is an implementation of this call that
accesses the actual limit constant that's used by the VirtualFileSystem
class.

As a side note, this is required for my eventual Qt port.
2021-12-21 12:54:11 -08:00
Martin Bříza
f75bab2a25 Kernel: Move symlink recursion limit to .h, increase it to 8
As pointed out by BertalanD on Discord, POSIX specifies that
_SC_SYMLOOP_MAX (implemented in the following commit) always needs to be
equal or more than _POSIX_SYMLOOP_MAX (8, defined in
LibC/bits/posix1_lim.h), hence I've increased it to that value to
comply with the standard.

The move to header is required for the following commit - to make this
constant accessible outside of the VFS class, namely in sysconf.
2021-12-21 12:54:11 -08:00
Ali Mohammad Pur
ccb9cae8e9 LibC: Make WEOF a signed value on clang
The actual value is unchanged, but the previous `0xffffffff` was an
unsigned value, which lead to clang getting mad at `foowc() == WEOF`.
This commit makes it a signed int on clang, which *should* serve
the same purpose and not lead to clang getting mad at us.
2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
0d7d2b825e LibC: Add POSIX spec links to all applicable wide character functions 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
0fdf52f6dd LibC: Define WCHAR_{MIN,MAX} 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
687a3351c2 LibC: Stub out wcsftime() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
e717ca32d1 LibC: Implement ungetwc() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
14b91a3fe9 LibC: Stub out some wscanf variants 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
f0709c7a24 LibC+AK: Implement all sorts of wprintf variants 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
db7a6d6e74 LibC: Implement f{get,put}ws() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
bd9a22e7e7 LibC: Stub out fwide()
This is a mess, and I'd rather not perform checks on every single stdio
operation, so just make it a noop.
2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
cb90856756 LibC: Implement {f,}putwc() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
a4e8a09188 LibC: Implement getwchar() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
cf17677206 LibC: Implement {f,}getwc() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
3b281baf75 LibC: Implement wcs{,c}spn() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
4f8d095f5a LibC: Sort the SOURCES entries in CMakeLists.txt 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
cacc3ee857 LibC: Switch to using east const in wchar.cpp 2021-12-21 21:24:36 +03:30
Linus Groh
a00a3fa1ef LibGfx: Remove 'QOIImageDecoderPlugin: ' prefix from error messages
What the component which did the actual decoding is called is not
relevant for the error, and would be rather distracting once we show
decoding error messages e.g. in ImageViewer (instead of just silently
failing).
Also makes them more consistent as many already don't include it - a
mistake which is now turned into a feature :^)
2021-12-21 17:37:10 +01:00
Luke Wilde
6d5531112f LibJS: Add TypedArray.prototype.@@iterator 2021-12-21 15:40:41 +01:00
Timothy Flynn
4fe47ed86e LibJS: Update spec link for InstallErrorCause AO 2021-12-21 14:56:28 +01:00
Timothy Flynn
d69f5ca128 LibJS: Update spec numbers for Operations on Objects AOs
The error cause proposal was merged, so some spec numbers were bumped.
2021-12-21 14:56:28 +01:00
Timothy Flynn
968f6e2432 LibJS: Define RegExp.prototype methods in spec order 2021-12-21 14:56:00 +01:00
Timothy Flynn
7ea85ed10b LibJS: Add spec comments to RegExp.prototype AOs
This also replaces an instance of TRY with MUST as the spec indicates
that step 35b of RegExpBuiltinExec cannot throw. Further, this moves
some lines of code around to align with the spec as best as we can,
though the end effect is the same.
2021-12-21 14:56:00 +01:00
Timothy Flynn
179ca9d058 LibJS: Add spec comments to RegExp.prototype.[flags, source, exec, test] 2021-12-21 14:56:00 +01:00
Timothy Flynn
4a915fc9fa LibJS: Add spec comments to RegExp.prototype.compile 2021-12-21 14:56:00 +01:00
Timothy Flynn
c6e2b03073 LibJS: Add spec comments to RegExp.prototype [ @@split ]
In doing so, this caught another erroneous ToObject invocation.
2021-12-21 14:56:00 +01:00
Timothy Flynn
cb901f70af LibJS: Add spec comments to RegExp.prototype [ @@search ] 2021-12-21 14:56:00 +01:00
Timothy Flynn
25b6e79238 LibJS: Add spec comments to RegExp.prototype [ @@replace ]
In doing so, this caught an erroneous ToObject invocation. In the one
spot that requires the value to be an object (the invocation to
LengthOfArrayLike), we know by then the value is an object because all
other possibilities have been handled.
2021-12-21 14:56:00 +01:00
Timothy Flynn
9f7c3e6cad LibJS: Add spec comments to RegExp.prototype [ @@matchAll ] 2021-12-21 14:56:00 +01:00
Timothy Flynn
5eb4d2e96e LibJS: Add spec comments to RegExp.prototype [ @@match ]
In doing so, this fixes a few minor issues:

1. We were accessing the "unicode" and "lastIndex" properties out of
   order. This is somewhat frequently tested by test262, but not in
   this case.

2. We were doing a Value::to_object() followed by Object::get(), rather
   than just Value::get() as the spec dictates.

3. We were TRYing a step (CreateDataPropertyOrThrow) that should never
   fail, and should have been a MUST.
2021-12-21 14:56:00 +01:00
Timothy Flynn
26294a2d27 LibJS: Convert a RegExp throw_exception to throw_completion
RegExpExec already returns a ThrowCompletionOr so this potentional error
should be a completion. RegExp.prototype [ @@replace ] is tripped up by
this mistake when implemented closer to the spec.
2021-12-21 14:56:00 +01:00
davidot
154ed3994c LibRegex: Parse capture group names according to the ECMA262 spec 2021-12-21 14:04:23 +01:00
davidot
733a70671b LibRegex: Disallow duplicate named capture groups in ECMA262 parser 2021-12-21 14:04:23 +01:00