Skip to content

Commit

Permalink
everywhere: Removed ref to libsystem stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Apr 11, 2021
1 parent cfec0be commit 92457f9
Show file tree
Hide file tree
Showing 39 changed files with 77 additions and 58 deletions.
2 changes: 1 addition & 1 deletion kernel/kernel/drivers/BGA.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <libmath/MinMax.h>
#include <libsystem/Logger.h>
#include <libsystem/math/MinMax.h>

#include "kernel/drivers/BGA.h"
#include "kernel/graphics/EarlyConsole.h"
Expand Down
2 changes: 1 addition & 1 deletion kernel/kernel/graphics/Framebuffer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <abi/Paths.h>

#include <libmath/MinMax.h>
#include <libsystem/Logger.h>
#include <libsystem/math/MinMax.h>

#include "archs/VirtualMemory.h"

Expand Down
4 changes: 2 additions & 2 deletions kernel/kernel/memory/MMIO.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include <libmath/MinMax.h>
#include <libsystem/Common.h>
#include <string.h>
#include <libsystem/math/MinMax.h>
#include <libutils/RefCounted.h>
#include <string.h>

#include "kernel/memory/MemoryRange.h"

Expand Down
2 changes: 1 addition & 1 deletion kernel/kernel/node/DevicesInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <string.h>

#include <libmath/MinMax.h>
#include <libsystem/Result.h>
#include <libsystem/math/MinMax.h>
#include <libutils/json/Json.h>

#include "kernel/devices/Devices.h"
Expand Down
2 changes: 1 addition & 1 deletion kernel/kernel/node/File.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <libmath/MinMax.h>
#include <libsystem/Result.h>
#include <string.h>
#include <libsystem/math/MinMax.h>

#include "kernel/node/File.h"
#include "kernel/node/Handle.h"
Expand Down
2 changes: 1 addition & 1 deletion kernel/kernel/node/Handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <assert.h>
#include <string.h>

#include <libmath/MinMax.h>
#include <libsystem/Result.h>
#include <libsystem/math/MinMax.h>

#include "kernel/node/Connection.h"
#include "kernel/node/Handle.h"
Expand Down
4 changes: 2 additions & 2 deletions kernel/kernel/node/ProcessInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <string.h>

#include <libmath/MinMax.h>
#include <libsystem/Result.h>
#include <libsystem/math/MinMax.h>
#include <libutils/json/Json.h>

#include "kernel/interrupts/Interupts.h"
Expand All @@ -17,7 +17,7 @@ FsProcessInfo::FsProcessInfo() : FsNode(FILE_TYPE_DEVICE)
static Iteration serialize_task(Json::Value::Array *list, Task *task)
{
if (task->id == 0)
{
{
return Iteration::CONTINUE;
}

Expand Down
2 changes: 1 addition & 1 deletion meta/hosted/plugs/Syscall.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <abi/Syscalls.h>
#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>

#include <errno.h>
#include <fcntl.h>
Expand Down
2 changes: 1 addition & 1 deletion userspace/apps/paint/PaintTool.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <assert.h>
#include <libutils/Vector.h>

#include <libsystem/math/Bresenham.h>
#include <libmath/Bresenham.h>

#include "paint/PaintDocument.h"
#include "paint/PaintTool.h"
Expand Down
10 changes: 5 additions & 5 deletions userspace/libraries/libgraphic/Color.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <libgraphic/ColorsNames.h>
#include <libmath/Lerp.h>
#include <libsystem/Common.h>
#include <libsystem/math/Lerp.h>
#include <libutils/String.h>

namespace Graphic
Expand Down Expand Up @@ -191,10 +191,10 @@ struct Color
static constexpr Color lerp(Color from, Color to, float transition)
{
return from_rgba(
::lerp(from.redf(), to.redf(), transition),
::lerp(from.greenf(), to.greenf(), transition),
::lerp(from.bluef(), to.bluef(), transition),
::lerp(from.alphaf(), to.alphaf(), transition));
Math::lerp(from.redf(), to.redf(), transition),
Math::lerp(from.greenf(), to.greenf(), transition),
Math::lerp(from.bluef(), to.bluef(), transition),
Math::lerp(from.alphaf(), to.alphaf(), transition));
}

static constexpr Color blerp(Color c00, Color c10, Color c01, Color c11, float transitionx, float transitiony)
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libio/BufReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string.h>

#include <libio/Reader.h>
#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>

namespace IO
{
Expand Down
5 changes: 2 additions & 3 deletions userspace/libraries/libio/MemoryReader.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <libio/Reader.h>
#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>
#include <libutils/Slice.h>

namespace IO
Expand Down Expand Up @@ -31,10 +31,9 @@ class MemoryReader final :
{
}

MemoryReader(RawStorage& raw)
MemoryReader(RawStorage &raw)
: _memory(raw.storage())
{

}

ResultOr<size_t> read(void *buffer, size_t size) override
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libio/MemoryWriter.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <libio/Writer.h>
#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>
#include <libutils/SliceStorage.h>
#include <libutils/StringStorage.h>

Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libio/ScopedReader.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <libio/Reader.h>
#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>

namespace IO
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include <math.h>

#include <libmath/Vec2.h>
#include <libutils/Vector.h>

#include <math.h>
namespace Math
{

template <typename TCallback>
void bresenhamLow(int x0, int y0, int x1, int y1, int size, TCallback callback)
void bresenham_low(int x0, int y0, int x1, int y1, int size, TCallback callback)
{
int dx, dy, i, p, x, y = 0;
dx = x1 - x0;
Expand Down Expand Up @@ -37,7 +39,7 @@ void bresenhamLow(int x0, int y0, int x1, int y1, int size, TCallback callback)
}

template <typename TCallback>
void bresenhamHigh(int x0, int y0, int x1, int y1, int size, TCallback callback)
void bresenham_high(int x0, int y0, int x1, int y1, int size, TCallback callback)
{
int dx, dy, i, p, x, y = 0;
dx = x1 - x0;
Expand Down Expand Up @@ -81,22 +83,24 @@ void bresenham(Math::Vec2i start, Math::Vec2i end, int size, TCallback callback)
{
if (x0 > x1)
{
bresenhamLow(x1, y1, x0, y0, size, callback);
bresenham_low(x1, y1, x0, y0, size, callback);
}
else
{
bresenhamLow(x0, y0, x1, y1, size, callback);
bresenham_low(x0, y0, x1, y1, size, callback);
}
}
else
{
if (y0 > y1)
{
bresenhamHigh(x1, y1, x0, y0, size, callback);
bresenham_high(x1, y1, x0, y0, size, callback);
}
else
{
bresenhamHigh(x0, y0, x1, y1, size, callback);
bresenham_high(x0, y0, x1, y1, size, callback);
}
}
}

} // namespace Math
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#pragma once

namespace Math
{

template <typename T>
static constexpr T lerp(T from, T to, double transition)
{
return from + (to - from) * transition;
}

} // namespace Math
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#pragma once

namespace Math
{

#define clamp(__v, __lower, __upper) (MAX(MIN((__v), (__upper)), (__lower)))

#define MIN(__x, __y) ((__x) < (__y) ? (__x) : (__y))

#define MAX(__x, __y) ((__x) > (__y) ? (__x) : (__y))

} // namespace Math
2 changes: 1 addition & 1 deletion userspace/libraries/libmath/Rect.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <libmath/Vec2.h>
#include <libutils/Anchor.h>

#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>

namespace Math
{
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libmath/Vec2.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <assert.h>
#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>
#include <math.h>

namespace Math
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libmath/Vec3.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <assert.h>
#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>
#include <math.h>

namespace Math
Expand Down
6 changes: 3 additions & 3 deletions userspace/libraries/libsystem/cmdline/History.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <libutils/Assert.h>

#include <libsystem/cmdline/History.h>
#include <libsystem/utils/List.h>
#include <libutils/Assert.h>

static List *history = nullptr;

Expand All @@ -23,8 +24,7 @@ void history_commit(UnicodeString *text)

initialize_history_if_not_already();

if (history->any() &&
unicode_string_equals(history_peek(0), text))
if (history->any() && unicode_string_equals(history_peek(0), text))
{
// We don't want duplicated entry in our history!
return;
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libsystem/eventloop/EventLoop.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <libmath/MinMax.h>
#include <libsystem/eventloop/EventLoop.h>
#include <libsystem/eventloop/Invoker.h>
#include <libsystem/eventloop/Notifier.h>
#include <libsystem/eventloop/Timer.h>
#include <libsystem/math/MinMax.h>
#include <libsystem/system/System.h>
#include <libsystem/utils/List.h>
#include <libutils/Assert.h>
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libsystem/io/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#include <skift/Printf.h>
#include <string.h>

#include <libmath/MinMax.h>
#include <libsystem/core/Plugs.h>
#include <libsystem/io/Stream.h>
#include <libsystem/io/Stream_internal.h>
#include <libsystem/math/MinMax.h>

Stream *_in_stream = nullptr;
Stream *_out_stream = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libsystem/system/Memory.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>
#include <libsystem/system/Memory.h>

void memory_zero(void *where, size_t how_many)
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libsystem/unicode/UnicodeString.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <string.h>

#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>
#include <libsystem/unicode/UnicodeString.h>
#include <libsystem/utils/BufferBuilder.h>

Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libsystem/utils/BufferBuilder.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <assert.h>
#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>
#include <libsystem/utils/BufferBuilder.h>

struct BufferBuilder
Expand Down
1 change: 1 addition & 0 deletions userspace/libraries/libterminal/Cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Terminal
{

struct Cell
{
Codepoint codepoint = U' ';
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libterminal/Terminal.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <assert.h>

#include <libmath/MinMax.h>
#include <libsystem/Logger.h>
#include <libsystem/math/MinMax.h>
#include <libterminal/Terminal.h>

namespace Terminal
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libutils/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <initializer_list>

#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>
#include <libutils/Assert.h>

template <typename T, size_t N>
Expand Down
1 change: 1 addition & 0 deletions userspace/libraries/libutils/Assert.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <assert.h>

#include <libio/Format.h>
#include <libutils/SourceLocation.h>

Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libutils/StringBuilder.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <assert.h>
#include <libmath/MinMax.h>
#include <libsystem/Common.h>
#include <libsystem/math/MinMax.h>
#include <libutils/String.h>
#include <libutils/Vector.h>
#include <libutils/unicode/Codepoint.h>
Expand Down
2 changes: 1 addition & 1 deletion userspace/libraries/libutils/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <string.h>

#include <libsystem/math/MinMax.h>
#include <libmath/MinMax.h>

#include <libutils/Iteration.h>
#include <libutils/New.h>
Expand Down
Loading

0 comments on commit 92457f9

Please sign in to comment.