Commit graph

9332 commits

Author SHA1 Message Date
AnotherTest
6b742c69bd LibCrypto: Add ::import_data() and ::export_data() to UnsignedBigInteger
These functions allow conversion to-and-from big-endian buffers
This commit also adds a ""_bigint operator for easy bigint use
2020-05-02 12:24:10 +02:00
Itamar
c52d3e65b9 LibCrypto: Cleanup UnsignedBigInteger a bit
- Add missing 'explicit' to the constructor
- Remove unneeded 'AK::' in AK::Vector
- Avoid copying 'words' in constructor
2020-05-02 12:24:10 +02:00
Itamar
2125a4debb LibCrypto: Add base-10 string de/serialization methods for bigint 2020-05-02 12:24:10 +02:00
Itamar
709c691f38 LibCrypto: Fix bug in big int subtraction
A regression test was added to the suite.

This commit also generally simplifies the subtraction method.
2020-05-02 12:24:10 +02:00
Itamar
0d2777752e LibCrypto: Add UnsignedBigInteger division
The division operation returns both the quotient and the remainder.
2020-05-02 12:24:10 +02:00
Itamar
2959c4a5e9 LibCrypto: Add UnsignedBigInteger multiplication
Also added documentation for the runtime complexity of some operations.
2020-05-02 12:24:10 +02:00
Itamar
2843dce498 LibCrypto: Fix a bug in big int addition
There was a bug when dealing with a carry when the addition
result for the current word was UINT32_MAX.

This commit also adds a regression test for the bug.
2020-05-02 12:24:10 +02:00
Itamar
e0cf40518c LibCrypto: Add UnsignedBigInteger subtraction and comparison 2020-05-02 12:24:10 +02:00
Itamar
6201f741d4 LibCrypto: Add UnsignedBigInteger and implement addition
UnsignedBigInteger stores an unsigned ainteger of arbitrary length.

A big integer is represented  as a vector of word. Each
word is an unsigned int.
2020-05-02 12:24:10 +02:00
AnotherTest
8c645916b4 LibCrypto: Add SHA512
There is quite a bit of avoidable duplication, however, I could not get
the compiler to be happy about SHA2<Size> (see FIXMEs)
2020-05-02 12:24:10 +02:00
AnotherTest
ca097b093b LibCrypto: Add SHA256 hash function 2020-05-02 12:24:10 +02:00
AnotherTest
f2cd004d11 LibCrypto: Implement HMAC 2020-05-02 12:24:10 +02:00
AnotherTest
4f89a377a4 LibCrypto: Move each subsection into its own namespace 2020-05-02 12:24:10 +02:00
AnotherTest
96dd7c2996 Userland: Add MD5 tests to test-crypto
This commit also reworks the test program to have a better interface:
`test-crypto <mode> [options]`
where each mode has its own default suite
2020-05-02 12:24:10 +02:00
AnotherTest
bffb2c7542 LibCrypto: Add HashFunction and implement MD5 2020-05-02 12:24:10 +02:00
AnotherTest
899ca245ae LibCrypto: Implement Cipher and AES_CBC
Also adds a test program to userland
2020-05-02 12:24:10 +02:00
AnotherTest
cf5941c972 AK: Correct ByteBuffer::{overwrite,slice*} bounds check 2020-05-02 12:24:10 +02:00
AnotherTest
7f1d3f6d62 LibLine: Handle ^L while in search mode
This commit fixes the following misbehaviour:
```
> <- search prompt moves here
>
> ^R^L <- actual prompt stays here
```
2020-05-02 11:57:21 +02:00
Brendan Coles
905de7df58 Fire: Add app-fire.png 16x16 icon 2020-05-02 11:42:29 +02:00
Brendan Coles
6c1e842a7e Cube: Add app-cube.png 16x16 icon 2020-05-02 11:42:21 +02:00
Emanuele Torre
e861af2a5c js: Print ConsoleMessages and color the output based on their kind :^) 2020-05-02 11:41:35 +02:00
Emanuele Torre
be1a5bf3f7 LibJS: Add ConsoleMessage concept
A ConsoleMessage is a struct cointaining:
 * AK::String text;         represents the text of the message sent
                             to the console.
 * ConsoleMessageKind kind; represents the kind of JS `console` function
                             from which the message was sent.

Now, Javascript `console` functions only send a ConsoleMessage to the
Interpreter's Console instead of printing text directly to stdout.
The Console then stores the recived ConsoleMessage in
Console::m_messages; the Console does not print to stdout by default.

You can set Console::on_new_message to a void(ConsoleMessage&); this
function will get call everytime a new message is added to the Console's
messages and can be used, for example, to print ConsoleMessages to
stdout or to color the output based on the kind of ConsoleMessage.

In this patch, I also:
  * Re-implement all the previously implemented functions in the
     JavaScript ConsoleObject, as wrappers around Console functions
     that add new message to the Console.
  * Implement console.clear() like so:
    - m_messages get cleared;
    - a new_message with kind set ConsoleMessageKind::Clear gets added
       to m_messages, its text is an empty AK::String;
  * Give credit to linusg in Console.cpp since I used his
     console.trace() algorithm in Console::trace().

I think that having this abstration will help us in the implementation
of a browser console or a JS debugger. We could also add more MetaData
to ConsoleMessage, e.g. Object IDs of the arguments passed to console
functions in order to make hyperlinks, Timestamps, ecc.; which could be
interesting to see.

This will also help in implementing a `/bin/js` option to make, for
example, return a ConsoleMessageWrapper to console functions instead of
undefined. This will be useful to make tests for functions like
console.count() and console.countClear(). :^)
2020-05-02 11:41:35 +02:00
Emanuele Torre
e9c7d4524a LibJS: Implement ConsoleObject::count() as a Console::count() wrapper
Also implement ConsoleObject::count_clear() as a wrapper for
Console::count_clear()
2020-05-02 11:41:35 +02:00
Emanuele Torre
2e92c2e5e1 LibJS: Start implementing a Console class for the interpreter
The goal is to start factoring out core ConsoleObject functionality and
to make ConsoleObject only a JS wrapper around Console.
2020-05-02 11:41:35 +02:00
Andreas Kling
745b0b27fd WindowServer+LibGUI: Automatically close child windows with parent
If a window has child windows when it's destroyed, WindowServer will
now automatically tear down all of its children as well.

This is communicated to the client program through a vector of window
ID's included with the response to WindowServer::DestroyWindow.

This does feel a little bit awkward, but managing it on the client side
also seems a bit awkward.
2020-05-02 01:29:55 +02:00
Andreas Kling
a726fda546 IPCCompiler: Add support for Vector<i32>
It would be a lot nicer to support arbitrary Vector<T> but for now I'm
only adding Vector<i32> since I need it for something..
2020-05-02 01:29:55 +02:00
Andreas Kling
828aee9932 LibGUI: Make ComboBox list pop-up windows frameless
This is much better than the hack we had of making them Tooltip windows
since frameless windows end up at the right layer in the window stack
automatically, and always get yanked above the parent window simply by
being child windows.
2020-05-02 01:29:55 +02:00
Andreas Kling
d847304cb9 WindowServer+LibGUI: Add "frameless" window flag
This allows you to create windows with no title bar or window frame.
2020-05-02 01:29:55 +02:00
Andreas Kling
bb7eb3e104 WindowServer+LibGUI: Remove unused Window::show_titlebar() flag
Nobody was using this flag, so let's stop maintaining it. It's easy to
add it back if we ever want the behavior.
2020-05-02 01:29:55 +02:00
Andreas Kling
2ac1fbef4f WindowServer: Don't allow parent windows to go above their children
Whenever a parent window is moved to front, we now follow up by
immediately moving its children to front as well.
2020-05-02 01:29:55 +02:00
Andreas Kling
c6899b0910 WindowServer: Move child windows together with their parents
When moving a window, we will now move any child windows by the same
position delta as the parent. This makes ComboBox popup list windows
follow the window they were opened by, which looks nice. :^)
2020-05-02 01:29:55 +02:00
Andreas Kling
6228f72b87 LibGUI+WindowServer: Inform WindowServer about parent/child windows
If a window has another window in its Core::Object ancestor chain,
we now communicate that relationship to WindowServer so that it can
act with awareness of parent/child windows.
2020-05-02 01:29:55 +02:00
Andreas Kling
e9b7a51a9a Base: Tweak MessageBox icons a tiny bit 2020-05-02 01:29:55 +02:00
LepkoQQ
c7f0de14b5 LibGfx: Decode paletted and grayscale images with 1/2/4 bit depth
When dealing with png data that has less than 8 bits per pixel, round
up to the next byte when allocating per row buffers and streamers. This
fixes decoding odd sized PNGs with less than 8 bits per pixel.

Also added a test page with some odd sized palleted PNGs.
2020-05-02 01:28:18 +02:00
Linus Groh
e37065cc8b Base: Update js(1) manpage
Syntax highlighting is now enabled by default!
2020-05-02 01:23:50 +02:00
Valtteri Koskivuori
61cea6a29d LibM: Implement fmodf() 2020-05-02 01:23:30 +02:00
Linus Groh
43c1fa9965 LibJS: Implement (no-op) debugger statement 2020-05-01 22:07:13 +02:00
Andreas Kling
ea839861e5 AK: Make Checked.h work with Clang
Apparently Clang does not have __builtin_foo_overflow_p()

Fixes #2044.
2020-05-01 17:30:47 +02:00
Andreas Kling
b5039a047f Base: Adjust filetype icons to be right-aligned for consistency
Established convention is for the flavor icon to go on the right side.
2020-05-01 17:23:41 +02:00
Andres Vieira
15aedc6866 Userland: "touch" can now handle multiple paths as arguments
You can now do:
  touch a.txt b.txt c.txt d.txt

Also now you can't do:
  touch --test  # This created a "./--test" file

Also adds ArgsParser to the mix to better handle arguments :)
2020-05-01 17:08:46 +02:00
Hüseyin ASLITÜRK
8551c10918 Applications: TextEditor INI file syntax highlighter 2020-05-01 16:58:18 +02:00
Hüseyin ASLITÜRK
5c022ac939 LibGUI: INI file syntax highlighter 2020-05-01 16:58:18 +02:00
Hüseyin ASLITÜRK
5267ccbc22 LibGUI: Icon for INI file type 2020-05-01 16:58:18 +02:00
Hüseyin ASLITÜRK
d8477074b9 Base: Icons for INI, Object and Library file types 2020-05-01 16:58:18 +02:00
Linus Groh
79b829637e LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Linus Groh
1ba2e6768d LibJS: Implement indexed access for StringObject 2020-05-01 16:54:01 +02:00
Linus Groh
a81bce8c2a LibJS: Make Array.length non-configurable
This was incorrect, it's only writable.
2020-05-01 16:54:01 +02:00
Linus Groh
65dbe17dd7 LibJS: Add Value::to_size_t() 2020-05-01 16:54:01 +02:00
Linus Groh
62671bea68 LibJS: Add Object::has_property()
Like Object::has_own_property() but going down the prototype chain.
2020-05-01 16:54:01 +02:00
Linus Groh
4cdd802927 LibJS: Return a bool from Object::put* to indicate success 2020-05-01 16:54:01 +02:00