Commit graph

17449 commits

Author SHA1 Message Date
AnotherTest
1496b02203 Meta: Use the new Shell features to improve run-tests-and-shutdown
Fixes two TODOs in that file :^)
2021-03-07 10:59:51 +01:00
AnotherTest
13b65b632a Shell: Add support for enumerating lists in for loops
With some odd syntax to boot:
```sh
$ for index i x in $whatever {}
```
2021-03-07 10:59:51 +01:00
AnotherTest
a45b2ea6fb Shell: Add support for 'immediate' expressions as variable substitutions
This commit adds a few basic variable substitution operations:
- length
    Find the length of a string or a list
- length_across
    Find the lengths of things inside a list
- remove_{suffix,prefix}
    Remove a suffix or a prefix from all the passed values
- regex_replace
    Replace all matches of a given regex with a given template
- split
    Split the given string with the given delimiter (or to its
    code points if the delimiter is empty)
- concat_lists
    concatenates any given lists into one

Closes #4316 (the ancient version of this same feature)
2021-03-07 10:59:51 +01:00
AnotherTest
a303b69caa Shell: Do not parse history events in scripts
That makes no sense!
2021-03-07 10:59:51 +01:00
AnotherTest
cad7865ad1 LibLine: Clear the buffer after invalidating prior written data
Otherwise this would set m_chars_touched_in_the_middle to zero, which is
exactly the wrong thing to do.
2021-03-07 10:59:51 +01:00
AnotherTest
c580348ebd Shell: Add functions to the PATH cache when rebuilding the cache
Otherwise functions would be highlighted as missing.
2021-03-07 10:58:42 +01:00
AnotherTest
4f6bf2931c Shell: Make the 'not' builtin return the correct exit code for functions 2021-03-07 10:58:42 +01:00
AnotherTest
fec8d7d699 Shell: Corrently indent offset newlines when formatting
Previously, formatting the following would incorrectly skip the indents:
```
{
    foo

    bar
}
```
to create:
```
{

foo

bar
}
```
2021-03-07 10:58:42 +01:00
AnotherTest
e1512d5968 Shell: Skip caching PATH and history load/save when not interactive
Non-interactive shells (i.e. when running scripts) do not need this
functionality, so they are a boatload of wasted time.
This significantly reduces the script startup and shutdown times when
there are lots of executables in PATH or lots of entries in the history.
2021-03-07 10:58:42 +01:00
Andreas Kling
48347fb1c7 LibGfx: Make most of Gfx::Color constexpr 2021-03-06 19:57:35 +01:00
Luke
ed139bee7f LibWeb: Add a couple child node operations to Node and add node types 2021-03-06 19:57:12 +01:00
Linus Groh
a013a38e24 Meta: Make 'run.sh qgrub' work via SERENITY_RUN
It is possible to set the run.sh mode via the SERENITY_RUN environment
variable, but the SERENITY_DISK_IMAGE="grub_disk_image" override for
qgrub mode was only checking $1. This makes qgrub mode work via 'ninja
run' without explicitly setting SERENITY_DISK_IMAGE:

    SERENITY_RUN=qgrub ninja run
2021-03-06 19:55:53 +01:00
Liav A
b807e725e0 Kernel: Address all 32 HPET comparators correctly
Instead of declaring a reserved area from byte 0x160 to 0x400, we
change the declaration of TimerStructure array to be 32 units.

Also, a static_assert was added, to ensure that the calculation is
right.
2021-03-06 15:58:24 +01:00
Liav A
bbe1d7e239 Revert "Kernel: Fix HPET timer structure layout"
This reverts commit af22204488.

According to the HPET specification, each theoretical comparator takes
32 bytes in the MMIO space.

Although I hardly believe that any system will implement all 32
comparators, in practice if a machine happens to have more than 3
comparators, we need to address the comparators correctly if we want to
use them.
2021-03-06 15:58:24 +01:00
Brendan Coles
4ae3bfa40d WebServer: Serve X-Frame-Options and X-Content-Type-Options HTTP headers 2021-03-06 15:04:16 +01:00
Stephan Unverwerth
87d19273bc LibGfx: Fix draw_triangle() precision issues
This fixes some precision issues in Painter::draw_triangle()
that caused the Cube demo to leave pixels empty between triangles
under certain angles.

Also adds some extra comments for clarity and early returns when
parts of the triangle do not need to be drawn.
2021-03-06 15:03:44 +01:00
Jorropo
25e4a3467d Ports/git: Forcing NO_IPV6 option.
This fixes the build, how ever I don't know why the auto detection
broke in the first place.
2021-03-06 14:57:44 +01:00
Luke
89846b5b7c Ports: Add bzip2 port
Saw that it can be included with the freetype port, so I added it.
2021-03-06 14:56:51 +01:00
Mihai Parparita
c2f3d3afe1 LibWeb: Make CSS background image painting respect destination origin and transparency
It was previously using draw_tiled_bitmap, which always aligns the
tiles with the global origin and does not respect the alpha of the
source. Switch to a new Painter::blit_tiled helper which uses
Painter::blit under the hood, which has more correct behavior.
2021-03-06 14:56:31 +01:00
speles
e97865e982 WebContent: Set correct scroll offset for PageHost painting 2021-03-06 14:54:12 +01:00
Luke
3f969286d7 Ports: Add zlib dependency to libpng
I didn't have zlib installed when I was trying to compile libpng.
It said it was missing, so add a dependency to zlib.
2021-03-06 14:53:46 +01:00
Brendan Coles
6ac2d3e1bd Base: Add egrep and rgrep aliases to /etc/shellrc 2021-03-06 09:43:13 +01:00
Nick Wanninger
c3f417aa1e LibM: optimized (branchless) copysign 2021-03-06 09:42:06 +01:00
Itamar
cfa100cb65 HackStudio: Restart LanguageServer if it crashes
We now restart the language server transparently if it crashes.
If the language server crashes too frequently (current threshold is
twice within 3 seconds), we give up and will not attempt to restart it
again. HackStudio will still work fine, but features that depend on the
language server will not function.

To support this change we use a new class, 'ServerConnectionWrapper',
that holds the actual ServerConnection and is responsible for restarting
the language-server if it crashes.

Closes #5574.
2021-03-06 09:40:33 +01:00
Itamar
4223f03b2b LanguageServers: Support calling SetFileContent with not-yet open files
Also, use dbgln_if
2021-03-06 09:40:33 +01:00
Itamar
6f7ef4ec65 LanguageServers: Tweak FileDB API
- FileDB::get() now returns nullptr if the file is not in the FileDB
- Added FileDB::get_or_create_from_filesystem()
- Added FileDB::add() version that receives that file's content as a
parameter
2021-03-06 09:40:33 +01:00
Itamar
684cc5f027 HackStudio: Add ProjectFile::create_if_needed 2021-03-06 09:40:33 +01:00
Itamar
ba6cbf160b HackStudio: Create Language enum from file extension or language name 2021-03-06 09:40:33 +01:00
Itamar
1edaefca3a HackStudio: Remove redundant null check when creating a new project file
Project::get_file returns a NonNullRefPtr
2021-03-06 09:40:33 +01:00
Itamar
fa4d9da237 HackStudio: Make sure project files are created with an absolute path
This fixes an issue were "Find in Files" would not use the up-to-date
content of a file with unsaved changes.

The issue existed because 'FindInFilesWidget' uses
Project::for_each_text_file, which retrieves files by their absolute
path. However, when a file is opened in an Editor, it is created with
a relative path.

This caused us to store two ProjectFile objects that refer to the same
file - one with a relative path and one with an absolute path.
2021-03-06 09:40:33 +01:00
Itamar
74070ef74d HackStudio: Map connections to langauge-servers by language name
HackStudio keeps a map that stores the different ServerConnection
instances we have open.

Previously, that map was indexed by a project's root path.
This did not make much sense because we only support opening a single
project with each instance of the HackStudio program.

We now index the different ServerConnections by the language name, which
allows us to support talking to multiple language-servers in the same
project (e.g C++ and Shell).

This also fixes an issue where if you first opened a Shell file, and
then a C++ file in the same project, then C++ language-server features
would not work.
2021-03-06 09:40:33 +01:00
Itamar
289c466fef LibCpp: Don't crash on an empty '#' line
Closes #5634
2021-03-06 09:40:33 +01:00
Itamar
3f0ace6670 LanguageServers/Cpp: Allow the creation of DocumentData objects to fail
This fixes langauge-server crashes when trying to parse non-existant
header files, such as #include <new>.
Closes #5569.
2021-03-06 09:40:33 +01:00
Itamar
a2ac86f5e1 LibCpp: Check if type is null in VariableDeclaration::dump 2021-03-06 09:40:33 +01:00
Andreas Kling
e0e8c6f70e Ports: Add FreeType 2.10.4 2021-03-05 21:58:52 +01:00
Andreas Kling
9f8a9dba0b LibM: Add naive implementation of copysign() 2021-03-05 20:46:25 +01:00
Brian Gianforcaro
fc5b252010 AK: Implement IsEnum<T> and UnderlyingType<T> type traits
I needed these meta-programming type traits while working on something else.
Add basic support for these two type traits as well as some tests.
2021-03-05 11:30:13 +01:00
Liav A
17e7cdc6cc Kernel: Implement ScatterList for handling scattered DMA pages
This class is used in the AHCI code to handle a big request of
read/write to the disk. If we happen to encounter such request,
we will get the needed amount of physical pages from the
already-allocated physical pages in AHCIPort, and with that we
will create a ScatterList that will create a Region that maps
all of these pages in a contiguous virtual memory range.

Then, we could easily copy to/from this range, before and after
calling the operation on the StorageDevice as needed with
read or write operations.
2021-03-05 11:29:34 +01:00
Liav A
ecb169b61e Kernel: Add AnonymousVMObject constructor for a Vector of physical pages
This will be used later on by the AHCI code to create a Region
that spans over scattered DMA pages.
2021-03-05 11:29:34 +01:00
Liav A
e65fd83e23 Meta: Boot Q35 machine with SATA drive instead of using IDE drive 2021-03-05 11:29:34 +01:00
Liav A
c4463cb5df Kernel: Add basic AHCI functionality
The hierarchy is AHCIController, AHCIPortHandler, AHCIPort and
SATADiskDevice. Each AHCIController has at least one AHCIPortHandler.

An AHCIPortHandler is an interrupt handler that takes care of
enumeration of handled AHCI ports when an interrupt occurs. Each
AHCIPort takes care of one SATADiskDevice, and later on we can add
support for Port multiplier.

When we implement support of Message signalled interrupts, we can spawn
many AHCIPortHandlers, and allow each one of them to be responsible for
a set of AHCIPorts.
2021-03-05 11:29:34 +01:00
Liav A
4a5cf8c789 AK: Add a full memory barrier function based on atomic operations
We use atomic_signal_fence and atomic_thread_fence together to prevent
reordering of memory accesses by the CPU and the compiler.

The usage of these functions was suggested by @tomuta so we can be sure
that important memory accesses happen in the expected order :)
2021-03-05 11:29:34 +01:00
Liav A
b59e45e65c Kernel: Use global mechanism to determine minor number of Storage Device 2021-03-05 11:29:34 +01:00
Liav A
566c10b8b8 Kernel: Make ATA macros to be public 2021-03-05 11:29:34 +01:00
Liav A
0e9a2345f9 Kernel: Add enum values for later implementation of AHCI 2021-03-05 11:29:34 +01:00
Liav A
4f32dc2043 Kernel: Add Declaration of IDEChannel class in PATADiskDevice.h 2021-03-05 11:29:34 +01:00
Linus Groh
50ea0c3500 Profiler: Get perfcore file from ArgsParser
Fixes #5641.
2021-03-05 09:52:22 +01:00
Ben Wiederhake
15b675a804 Shell: Document all supported PROMPT flags 2021-03-04 22:17:18 +01:00
Ben Wiederhake
06debb1832 Meta: Search for the correct ccache cache key
"Hmm, 'toolchain' is a better name here!" I said, and changed the key name.
And then I promptly forgot to update the restore-key value. D'oh!
2021-03-04 19:40:49 +01:00
Mițca Dumitru
a13e8d49cf LibC: Fix typo in fenv.h
`FE_TOWARDSZERO` is actually spelled `FE_TOWARDZERO` (without the 'S')
2021-03-04 19:40:40 +01:00