Commit graph

44161 commits

Author SHA1 Message Date
Andrew Kaster
232b40fefc Ports: Update CMake port to 3.25.1 2022-12-13 11:36:14 +01:00
Andrew Kaster
d9e76254a8 CMake: Bump cmake_minimum_required to 3.25
The SerenityOS platform files we upstreamed were first released in
version 3.25.0
2022-12-13 11:36:14 +01:00
Andrew Kaster
d2f78a9411 Toolchain: Remove upstreamed CMake platform files :^) 2022-12-13 11:36:14 +01:00
Andrew Kaster
e28bc77778 Ports: Find cmake in Toolchain/Local/cmake if built
If a developer built cmake (or we built it for them) from source, make
sure that port builds can find that version of CMake that has the
SerenityOS platform files included.
2022-12-13 11:36:14 +01:00
Andrew Kaster
3ca661314f Meta: Build CMake from source if version is too old in serenity.sh 2022-12-13 11:36:14 +01:00
Andrew Kaster
e4a59f664b Toolchain+Meta: Add script to build CMake from source
Since we upstreamed CMake support for Serenity, we can use the Platform
files from upstream instead of keeping our local copy. While not added
in this commit, we can add patching capabilities for the platform files
similar to what we do for gdb, llvm, gcc, and binutils later.
2022-12-13 11:36:14 +01:00
Cody Hein
8855334fcc PixelPaint: Use source alpha for CloneTool drawing
Prior to this change when using CloneTool on a transparent background
the output was a solid black brush stroke. Now it is based on the
source content alpha as well as it's color blended with the target.
2022-12-13 11:35:25 +01:00
Tim Schumacher
ceb118e1fa Base: Reenable the disabled LibCore::Stream tests 2022-12-13 11:34:38 +01:00
Daniel Bertalan
24d2c90a28 BindingsGenerator+CMake: Keep track of IDL dependencies
This commit teaches BindingsGenerator to generate depfiles, which can be
used by CMake to ensure that bindings are properly regenerated when
imported IDL files change.

Two new options, `--depfile` and `--depfile-target` are added.
- `--depfile` sets the path for the dependency file.
- `--depfile-target` lets us set a target name different than the output
  file in the depfile. This option is needed because generated files are
  first written to a temporary file, but depfiles have to refer to the
  final location.
These are analogous to GCC's `-MF` and `-MT` options respectively. The
depfile's syntax matches the ones generated by GCC.

Note: This changes the minimal required CMake version to 3.20 if the
Make generator is used, and to 3.21 for the Xcode generator. Ninja is
not affected.
2022-12-13 11:31:24 +01:00
Daniel Bertalan
8d1ad592a1 BindingsGenerator: Write generated code to disk instead of stdout
This commit adds the `-o` option for specifying an output path to
BindingsGenerator.
2022-12-13 11:31:24 +01:00
Andreas Kling
30d3f2789e Kernel: Propagate errors during network adapter detection/initialization
When scanning for network adapters, we give each driver a chance to
claim the PCI device and whoever claims it first gets to keep it.
Before this patch, the driver API returned a LockRefPtr<AdapterType>,
which made it impossible to propagate errors that occurred during
detection and/or initialization.

This patch changes the API so that errors can bubble all the way out
the PCI enumeration in NetworkingManagement::initialize() where we
perform all the network adapter auto-detection on boot.

When we eventually start to support hot-plugging network adapter in the
future, it will be even more important to propagate errors instead of
swallowing them.

Importantly, before this patch, some errors were "handled" by panicking
the kernel. This is no longer the case.

7 FIXMEs were killed in the making of this commit. :^)
2022-12-13 11:20:11 +01:00
EWouters
9a849c10ae Ports/git: Update git to version 2.39.0 2022-12-13 11:20:03 +01:00
Ali Mohammad Pur
ad120606fd AK: Fix build with !USING_AK_GLOBALLY
A couple headers expected names to be in the global namespace, qualify
those names to make sure they're resolved even when the names are not
exported.
One header placed its functions in the global namespace, move those to
the AK namespace to make the concepts resolve.
2022-12-13 08:09:56 +03:30
Jan200101
483c18437b Meta: Detect ccache being passed as the compiler
This prevents ccache from being invoking itself.
Icecc fails to ran this way because of recursion detection.
2022-12-12 21:34:09 -07:00
Jan200101
10d40af167 Meta: Separate ccache setup into its own component 2022-12-12 21:34:09 -07:00
Tim Schumacher
0bd9a94bea LibHTTP: Don't read and drop data if status line can't be read
The idea of reading some amount of data presumably was to check if the
stream is still operable. However, this permanently breaks the request
format, as those 64 bytes are just lost forever.

Instead, just let the request fail instantly for now and think about
making it retry some time in the future. Since `can_read_line` updates
the read buffer beforehand, this should only happen in the rarest of
cases anyways.
2022-12-12 20:59:03 -07:00
Linus Groh
3b64610834 LibJS: Add spec comments to AggregateErrorConstructor 2022-12-12 21:26:12 +00:00
Linus Groh
172738222c LibJS: Update get_substitution() section number & parameter name 2022-12-12 21:26:12 +00:00
Linus Groh
19ea0d8dcf LibJS: Add spec comments to get_this_environment() 2022-12-12 21:26:12 +00:00
Linus Groh
c6638f53c0 LibJS: Add spec comments to new_object_environment() 2022-12-12 21:26:12 +00:00
Linus Groh
1cd46af7b0 LibJS: Add spec comments to new_declarative_environment() 2022-12-12 21:26:12 +00:00
Linus Groh
d51ab20aaa LibJS: Add spec comment to length_of_array_like() 2022-12-12 21:26:12 +00:00
Linus Groh
e4b388ea5a LibJS: Use modulo() for modulo operations in Value.cpp 2022-12-12 21:26:12 +00:00
Cody Hein
074ba104c8 PixelPaint: Single-clicking the BrushTool now adds to undo_stack
Simple change, prior to this BrushTool and EraseTool would not
have update the undo_stack for the ImageEditor unless you were
clicking and dragging.
2022-12-12 17:34:35 +00:00
Oleg Kosenkov
28bb3367cb Games: Add ColorLines 2022-12-12 17:30:04 +00:00
Ali Mohammad Pur
d987ddc0ee AK: Actually don't include <unistd.h> for windows in Platform.h
I got the conditions wrong last time, oops :^)
2022-12-12 17:01:16 +00:00
Andrea Giancola
21647b9a4e Games: Add help entries for Solitaire and Spider 2022-12-12 16:25:46 +00:00
Arda Cinar
a559e26f68 shuf: Use the newly introduced AK::shuffle function 2022-12-12 16:23:03 +00:00
Arda Cinar
352048ce0e Minesweeper: Revise the maximum mine limit in custom game settings
After improving the mine field generation method, fields with greater
than 50% mines no longer take too long to generate. So, the mine limit
for a given size can be increased to its maximum possible value.
2022-12-12 16:23:03 +00:00
Arda Cinar
71537f4903 Minesweeper: Make sure icons of cells are set after generating field
In reset() function, the icons of labels in the game area were initially
set as mine icon or null. And then, after generation, only the number
icon was set. In the old field generation algorithm, this did not cause
a very visible issue (The displayed mine icons in the game over screen
were from a previously generated game field, which was only slightly
wrong).

However, the newer field generation caused a "no mine icons are shown in
the game over screen" issue. To fix that, the label icon is set to null
initially, and then it is set to a mine or number bitmap.
2022-12-12 16:23:03 +00:00
Arda Cinar
5562ef6cc5 Minesweeper: Use a faster method to generate game field
The existing method was simply using a "randomly generate until it fits
our criteria" method to generate a game field. While this worked OK in
most cases, the run time was increasing seriously in boards whose
mine count / board size ratio was too big.

The new approach simply generates every possible mine location, shuffles
the array and picks its head. This uses more memory (shouldn't be a big
deal since minesweeper boards are generally miniscule) but runs much
quicker. The generation could still use some improvement (regarding
error handling), though :^)
2022-12-12 16:23:03 +00:00
Arda Cinar
1cdd3bb74f AK: Add a shuffle utility function
This implements a shuffle function in AK/Random.h which works on any
container with size() and curly brace operators. It uses fisher-yates
shuffle.
2022-12-12 16:23:03 +00:00
Tim Schumacher
30abd47099 LibCompress: Port DeflateDecompressor to Core::Stream 2022-12-12 16:21:39 +00:00
Tim Schumacher
f909cfbe75 LibCore: Use the new Handle type for the BitStream types
This allows us to either pass a reference, which keeps compatibility
with old code, or to pass a NonnullOwnPtr, which allows us to
comfortably chain streams as usual.
2022-12-12 16:21:39 +00:00
Tim Schumacher
8b5df161af LibCore: Add Stream::Handle
This essentially wraps a `NonnullOwnPtr` or a reference, allowing us to
either have a stream own a dependent stream that it uses or to just hold
a reference if a stream is already owned by somebody else and we just
want to use it temporarily.
2022-12-12 16:21:39 +00:00
Lucas CHOLLET
6c83bd8fd4 AK: Introduce the DerivedFrom concept 2022-12-12 16:21:39 +00:00
Lucas CHOLLET
3750687821 LibCore: Use Core::System::poll() in PosixSocketHelper 2022-12-12 16:14:11 +00:00
Lucas CHOLLET
5532640b71 LibCore: Add a wrapper for poll() 2022-12-12 16:14:11 +00:00
Snow
0049dfd717 LibGUI+TextEditor: Add a relative line number option for TextEditor
This adds an option for displaying relative line numbers in the ruler,
the line numbers are still absolute by default.
2022-12-12 16:02:06 +00:00
Tim Schumacher
1ca0898b1c Kernel: Use size_t to keep track of the number of pages in a region
We were previously using a 32-bit unsigned integer for this, which
caused us to start truncating region sizes when multiplied with
`PAGE_SIZE` on hardware with a lot of memory.
2022-12-12 15:14:07 +00:00
Ali Mohammad Pur
4aa70a07ca AK: Don't use <random> on windows for ::rand()
This is the same as the libc function, just use the libc function.
2022-12-12 15:05:48 +00:00
Ali Mohammad Pur
06816deb78 AK: Don't try to include <unistd.h> on windows for PAGE_SIZE 2022-12-12 15:05:48 +00:00
kleines Filmröllchen
b81a457de5 AK: Change quicksort comments to standard // style 2022-12-12 15:03:57 +00:00
Marc Luqué
22f472249d AK: Introduce cutoff to insertion sort for Quicksort
Implement insertion sort in AK. The cutoff value 7 is a magic number
here, values [5, 15] should work well. Main idea of the cutoff is to
reduce recursion performed by quicksort to speed up sorting
of small partitions.
2022-12-12 15:03:57 +00:00
kleines Filmröllchen
bbb256e8b5 AK: Introduce Indexable concept
This was dearly missing and can be used in many existing templates.
2022-12-12 15:03:57 +00:00
Baitinq
af1c26f05b Browser: Go back/forward when pressing back/forward mouse buttons
This currently doesn't work when running Serenity through QEMU, as it
doesn't pass the side button events over to Serenity due to some bug or
missing feature.
2022-12-12 15:00:08 +00:00
Luke Wilde
2f3ebce7c8 LibJS: Keep GeneratorObject's stored execution context's internals alive
This would previously crash with a heap UAF when storing the result of
`yield 1` into `e` on the second `next` call:
```js
function* a() { const e = yield 1; }
b = a();
b.next();
gc();
b.next();
```
2022-12-12 13:58:32 +00:00
Luke Wilde
6431dd7904 LibJS: Make it possible to visit the edges of an ExecutionContext 2022-12-12 13:58:32 +00:00
Luke Wilde
40cc38869e LibJS: Move ExecutionContext function implementations out of line 2022-12-12 13:58:32 +00:00
Ali Mohammad Pur
4311c2164e Shell: Disable interactive mode on '-c'
This also disables the full suite of interactive stuff in LibLine.
2022-12-12 13:57:06 +00:00