Commit Graph

12598 Commits

Author SHA1 Message Date
AnotherTest
9cc996b1e5 AK: Add Stream::offset_of(ReadonlyBytes) 2020-08-21 16:00:42 +02:00
AnotherTest
67f7f6840d AK+LibC+Kernel: Move the implementation of memmem to AK 2020-08-21 16:00:42 +02:00
Andreas Kling
779b643855 Meta: Add Tom (tomuta) to the contributors list :^) 2020-08-21 15:04:27 +02:00
Andreas Kling
23813d9bc9 LibChess: Shrink Chess::Piece from 8 bytes to 1 byte
This makes the engine footprint a lot smaller.
2020-08-21 13:46:07 +02:00
Peter Elliott
1e57e32a93 ChessEngine: Add ChessEngine
This engine is pretty bad, but doesn't let itself get checkmated
2020-08-21 12:26:30 +02:00
Peter Elliott
fb62eed058 Chess: Add support for UCI engines 2020-08-21 12:26:30 +02:00
Peter Elliott
7331b2b2f6 LibChess: Add UCIEndpoint for writing UCI chess engines 2020-08-21 12:26:30 +02:00
Peter Elliott
e80d0abb2c LibChess: Fix the ability to counter check with another check
fixes #3187,#3171
2020-08-21 12:26:30 +02:00
Peter Elliott
d2cb5e0f48 Chess: Refactor game logic into LibChess for use in engines
In the future UCI protocol stuff will also go into LibChess.
2020-08-21 12:26:30 +02:00
Peter Elliott
ffece9cfba Chess: Add serialization of moves and squares 2020-08-21 12:26:30 +02:00
Peter Elliott
f69b419c05 LibCore: Add File::{stdin, stdout, stderr}()
This should make it easier to get a Core::File for standard streams.
2020-08-21 12:26:30 +02:00
Peter Elliott
6c2d0dea91 Chess: Fix generation of promotion moves 2020-08-21 12:26:30 +02:00
Nico Weber
a6b68451dc LibJS: Implement Date.prototype.toISOString() 2020-08-21 12:11:48 +02:00
Nico Weber
1eac1b360b LibJS: Implement Date.UTC() 2020-08-21 12:11:48 +02:00
Nico Weber
221b412210 LibCore: Make DateTime::create() not fill in tm_wday and tm_yday for calling mktime() 2020-08-21 12:11:48 +02:00
Nico Weber
459e4ace93 LibC: Add timegm()
timegm() is like mktime() in that it converts a struct tm to
a timestamp, but it treats the struct tm as UTC instead of as
local time.

timegm() is nonstandard, but availabe in both Linux and BSD,
and it's a useful function to have.
2020-08-21 12:11:48 +02:00
Tom
cf8ce839da Kernel: Fix assertion when releasing contiguous memory region
There is no guarantee that the memory manager lock is held when
physical pages are released, so just acquire the memory manager
lock.
2020-08-21 12:03:20 +02:00
Luke
4dfe797263 SystemMonitor: Add a Processors tab 2020-08-21 12:01:36 +02:00
Tom
5c60a6a8fb WindowServer: Fix MenuApplets painting
We need to clip painting to the actual size to prevent corrupting
the area outside of the applet as the backing store is not
guaranteed to be perfectly in sync.

Fixes #3107
2020-08-21 12:00:24 +02:00
Luke
7902d215b3 LibWeb: Implement <template> parsing
Note that there is currently no way to display them as we can't
currently clone nodes.

Adds special case for templates for dumping to console.
Doesn't add it to the DOM inspector as I'm not sure how to do it.
2020-08-21 11:57:11 +02:00
Tom
f48feae0b2 Kernel: Switch singletons to use new Singleton class
Fixes #3226
2020-08-21 11:47:35 +02:00
Tom
527c8047fe Kernel: Add an atomic Singleton class
This allows easier one-time thread-safe atomic initialization
of the various singletons in the Kernel.
2020-08-21 11:47:35 +02:00
AnotherTest
5619ed1dc6 2048: Make board size and target tile configurable
This adds a "settings" option that allows the user to configure the
board size and target tile, and optionally save them to a config file.
Closes #3219.
2020-08-21 11:45:46 +02:00
AnotherTest
40c16b3ce5 2048: Do not allow the creation of games with invalid board sizes
The logic only works with nxn grids, so no need to take separate
row_size/column_size arguments.
2020-08-21 11:45:46 +02:00
Muhammad Zahalqa
16e86a3dda
SystemServer: Minor #include cleanup in Service.cpp (#3227) 2020-08-20 20:57:39 +02:00
Nico Weber
d4d9222eea LibJS: Basic implementation of most of Date's constructor arguments
The constructor with a string argument isn't implemented yet, but
this implements the other variants.

The timestamp constructor doens't handle negative timestamps correctly.

Out-of-bound and invalid arguments aren't handled correctly.
2020-08-20 20:53:43 +02:00
Nico Weber
45827cace9 LibCore: Comment that DateTime is in local time.
The timestamp is always in UTC, but hours/minutes are in local time.
2020-08-20 20:53:43 +02:00
Nico Weber
49d6405164 Kernel: Log time in addition to date in RTC startup 2020-08-20 20:53:43 +02:00
Andreas Kling
7903cfa5e4 LibGfx: Support loading GIF local color maps if present :^) 2020-08-20 19:42:06 +02:00
Andreas Kling
28e34ffe38 LibGfx: Initialize some uninitialized things in GIFLoader 2020-08-20 19:41:29 +02:00
Andreas Kling
079d2fe088 Kernel: Pack arguments, environment and auxiliary values better
Previously we were putting strings at the bottom of the allocated stack
region, and pointer arrays (argv, env, auxv) at the top. There was no
reason for this other than "it seemed easier to do it that way at the
time I wrote it."

This patch packs the strings and pointer vectors into the same area at
the top of the stack.

This reduces the memory footprint of all programs by 4 KiB. :^)
2020-08-20 16:34:44 +02:00
Luke
65afb40fc5 LibWeb: Crash instead of spinning if parse_drawto fails to match
If parse_drawto fails to match anything, it will spin forever.
Instead, print out the character that failed to match and assert
false.
2020-08-20 16:31:13 +02:00
asynts
8bbb7e25e6 LibCompress: Turn the DEFLATE implementation into a stream.
Previously, the implementation would produce one Vector<u8> which
would contain the whole decompressed data. That can be a lot and
even exhaust memory.

With these changes it is still necessary to store the whole input data
in one piece (I am working on this next,) but the output can be read
block by block. (That's not optimal either because blocks can be
arbitrarily large, but it's good for now.)
2020-08-20 16:28:31 +02:00
asynts
30abadcff9 AK: Add DuplexMemoryStream class.
This class is similar to BufferStream because it is possible to both
read and write to it. However, it differs in the following ways:

  - DuplexMemoryStream keeps a history of 64KiB and discards the rest,
    BufferStream always keeps everything around.

  - DuplexMemoryStream tracks reading and writing seperately, the
    following is valid:

        DuplexMemoryStream stream;
        stream << 42;
        int value;
        stream >> value;

    For BufferStream it would read:

        BufferStream stream;
        stream << 42;
        int value;
        stream.seek(0);
        stream >> value;

In the future I would like to replace all usages of BufferStream with
InputMemoryStream, OutputMemoryStream (doesn't exist yet) and
DuplexMemoryStream. For now I just add DuplexMemoryStream though.
2020-08-20 16:28:31 +02:00
asynts
a15556638d AK: Remove unnecessary FIXME comments from Stream.h. 2020-08-20 16:28:31 +02:00
asynts
bc332aca33 AK: Rename error() to has_error() for streams. 2020-08-20 16:28:31 +02:00
asynts
6d15318560 AK: Remove fatal() from InputStream.
Fatal errors can not be handeled and lead to an assertion error when the
stream is destroyed. It makes no sense to delay the assertion failure,
instead of setting m_fatal, an assertion should be done directly.
2020-08-20 16:28:31 +02:00
asynts
31e7f435cb AK: Rename TestMemoryStream.cpp to TestStream.cpp. 2020-08-20 16:28:31 +02:00
asynts
ebce4ead40 AK: Add StringView(ReadonlyBytes) constructor. 2020-08-20 16:28:31 +02:00
asynts
b1fc8d2b38 AK: Span: Fix signature of copy_to() and copy_trimmed_to().
Two changes were made

 1. copy_to() and copy_trimmed_to() now return how many bytes were
    copied.

 2. The argument was changed to Span<typename RemoveConst<T>::Type>
    because the following would not work:

        ReadonlyBytes bytes0;
        Bytes bytes1;

        // Won't work because this calls Span<const u8>::copy_to(Span<u8>)
        // but the method was defined as Span<const u8>::copy_to(Span<const u8>)
        bytes0.copy_to(bytes1);
2020-08-20 16:28:31 +02:00
asynts
df21487794 AK: Span: Allow slicing with zero length.
Previously, the following would not work:

    Bytes{}.slice(0);

because it was asserted that `start < size()`.
2020-08-20 16:28:31 +02:00
Andreas Kling
413db2d6d5 LibELF: Ignore PT_GNU_STACK headers
We always map stacks R/W (never X), so we can just ignore this header
as far as I understand.
2020-08-20 10:12:45 +02:00
AnotherTest
2c5cc189c5 LibLine: Initialize the search editor when entering search
Prior to this, no keybinding were installed on the search editor, and so
editing wasn't really possible.
Also fixes <C-r> making infinite search editors.
2020-08-20 09:34:55 +02:00
AnotherTest
688e54eac7 Kernel: Distinguish between new and old process groups with equal pgids
This does not add any behaviour change to the processes, but it ties a
TTY to an active process group via TIOCSPGRP, and returns the TTY to the
kernel when all processes in the process group die.
Also makes the TTY keep a link to the original controlling process' parent (for
SIGCHLD) instead of the process itself.
2020-08-19 21:21:34 +02:00
AnotherTest
cf18bff72a Shell: Do not attempt to yank the TTY from background processes
They don't own the TTY anyway!
2020-08-19 21:21:34 +02:00
AnotherTest
217eca3d3f Shell: Name the pipe ends correctly 2020-08-19 21:21:34 +02:00
AnotherTest
20d4287eaf Shell: Fix outdated debug log code 2020-08-19 21:21:34 +02:00
Andreas Kling
6d4016dd01 LibGUI: Use StringBuilder::join() in Shortcut::to_string() 2020-08-19 21:17:02 +02:00
Andreas Kling
a188e6e7d6 Base: Tweak the "new" icon to be slightly flatter
This way it fits in better with its neighbors. :^)
2020-08-19 21:17:02 +02:00
Andreas Kling
607e085823 Ext2FS: Fix inode link leak on all new inodes
The initial inode link count was wrong in Ext2FS, as the act of adding
new inodes to their new parent bumps the count.

This regressed in df66c28479.
2020-08-19 21:17:02 +02:00