Reorganize the luna/ directory so that headers aren't in the top level include path

This commit is contained in:
apio 2022-12-04 12:42:43 +01:00
parent cdbed6970a
commit c7ab6bc2d3
Signed by: apio
GPG Key ID: B8A7D06E42258954
46 changed files with 75 additions and 71 deletions

View File

@ -3,7 +3,7 @@
#include "arch/Serial.h"
#include "arch/Timer.h"
#include "video/TextConsole.h"
#include <Format.h>
#include <luna/Format.h>
static bool g_debug_enabled = true;
static bool g_serial_enabled = true;

View File

@ -1,6 +1,6 @@
#pragma once
#include <Attributes.h>
#include <Result.h>
#include <luna/Attributes.h>
#include <luna/Result.h>
#include <stdarg.h>
enum class LogLevel

View File

@ -1,5 +1,5 @@
#pragma once
#include <Result.h>
#include <luna/Result.h>
struct Registers;

View File

@ -1,5 +1,5 @@
#pragma once
#include <Result.h>
#include <luna/Result.h>
struct PageDirectory;

View File

@ -1,6 +1,6 @@
#include "arch/Serial.h"
#include "arch/CPU.h"
#include <Format.h>
#include <luna/Format.h>
namespace Serial
{

View File

@ -1,6 +1,6 @@
#pragma once
#include <Attributes.h>
#include <Types.h>
#include <luna/Attributes.h>
#include <luna/Types.h>
template <typename T> class Result;

View File

@ -2,7 +2,7 @@
#include "Log.h"
#include "arch/Serial.h"
#include "boot/bootboot.h"
#include <Result.h>
#include <luna/Result.h>
static u64 timer_ticks = 0;
static u64 boot_timestamp;

View File

@ -1,5 +1,5 @@
#pragma once
#include <Types.h>
#include <luna/Types.h>
extern const usize ARCH_TIMER_FREQ; // How many timer ticks in one millisecond?

View File

@ -3,10 +3,10 @@
#include "arch/Serial.h"
#include "arch/Timer.h"
#include "arch/x86_64/IO.h"
#include <String.h>
#include <SystemError.h>
#include <Types.h>
#include <cpuid.h>
#include <luna/String.h>
#include <luna/SystemError.h>
#include <luna/Types.h>
extern "C" void enable_sse();
extern "C" void enable_write_protect();

View File

@ -1,5 +1,5 @@
#include "arch/CPU.h"
#include <Types.h>
#include <luna/Types.h>
struct Registers // Saved CPU registers for x86-64
{

View File

@ -1,5 +1,5 @@
#pragma once
#include <Types.h>
#include <luna/Types.h>
namespace IO
{

View File

@ -1,7 +1,7 @@
#include "arch/MMU.h"
#include "memory/MemoryManager.h"
#include <String.h>
#include <SystemError.h>
#include <luna/String.h>
#include <luna/SystemError.h>
#define PAGE_SIZE 4096

View File

@ -5,7 +5,7 @@
#include "boot/bootboot.h"
#include "memory/MemoryManager.h"
#include "video/Framebuffer.h"
#include <String.h>
#include <luna/String.h>
extern BOOTBOOT bootboot;

View File

@ -8,7 +8,7 @@
#include "memory/Heap.h"
#include "memory/MemoryManager.h"
#include "video/TextConsole.h"
#include <Units.h>
#include <luna/Units.h>
Result<void> init()
{

View File

@ -3,9 +3,9 @@
#include "arch/MMU.h"
#include "arch/Serial.h"
#include "memory/MemoryManager.h"
#include <Alignment.h>
#include <String.h>
#include <SystemError.h>
#include <luna/Alignment.h>
#include <luna/String.h>
#include <luna/SystemError.h>
static constexpr int BLOCK_USED = 1 << 0;
static constexpr int BLOCK_START_MEM = 1 << 1;

View File

@ -1,6 +1,6 @@
#pragma once
#include <PlacementNew.h>
#include <Result.h>
#include <luna/PlacementNew.h>
#include <luna/Result.h>
Result<void*> kmalloc(usize size);
Result<void*> kcalloc(usize nmemb, usize size);

View File

@ -2,10 +2,10 @@
#include "Log.h"
#include "arch/MMU.h"
#include "boot/bootboot.h"
#include <Alignment.h>
#include <String.h>
#include <SystemError.h>
#include <Types.h>
#include <luna/Alignment.h>
#include <luna/String.h>
#include <luna/SystemError.h>
#include <luna/Types.h>
extern BOOTBOOT bootboot;

View File

@ -1,6 +1,6 @@
#pragma once
#include <Result.h>
#include <Types.h>
#include <luna/Result.h>
#include <luna/Types.h>
namespace MemoryManager
{

View File

@ -1,5 +1,5 @@
#pragma once
#include <Types.h>
#include <luna/Types.h>
// FIXME: Load a font from disk/initrd.

View File

@ -1,5 +1,5 @@
#pragma once
#include <Types.h>
#include <luna/Types.h>
namespace Framebuffer
{

View File

@ -1,8 +1,8 @@
#include "video/TextConsole.h"
#include "boot/bootboot.h"
#include "video/Framebuffer.h"
#include <Format.h>
#include <String.h>
#include <luna/Format.h>
#include <luna/String.h>
extern BOOTBOOT bootboot;

View File

@ -1,7 +1,7 @@
#pragma once
#include <Attributes.h>
#include <Result.h>
#include <Types.h>
#include <luna/Attributes.h>
#include <luna/Result.h>
#include <luna/Types.h>
namespace TextConsole
{

View File

@ -1,14 +1,14 @@
set(FREESTANDING_SOURCES
Format.cpp
NumberParsing.cpp
String.cpp
Units.cpp
SystemError.cpp
src/Format.cpp
src/NumberParsing.cpp
src/String.cpp
src/Units.cpp
src/SystemError.cpp
)
set(SOURCES
${FREESTANDING_SOURCES}
Check.cpp
src/Check.cpp
)
add_library(luna-freestanding ${FREESTANDING_SOURCES})
@ -26,7 +26,7 @@ target_compile_options(luna-freestanding PRIVATE -mno-red-zone)
target_compile_options(luna-freestanding PRIVATE -mno-80387 -mno-mmx -mno-sse -mno-sse2)
endif()
target_include_directories(luna-freestanding PUBLIC ${LUNA_ROOT}/luna)
target_include_directories(luna-freestanding PUBLIC include/)
set_target_properties(luna-freestanding PROPERTIES CXX_STANDARD 20)
add_library(luna ${SOURCES})
@ -35,5 +35,5 @@ target_compile_options(luna PRIVATE -Wdisabled-optimization -Wformat=2 -Winit-se
target_compile_options(luna PRIVATE -Wmissing-include-dirs -Wswitch-default -Wcast-qual -Wundef)
target_compile_options(luna PRIVATE -Wcast-align -Wwrite-strings -Wlogical-op -Wredundant-decls -Wshadow -Wconversion)
target_compile_options(luna PRIVATE -fno-asynchronous-unwind-tables -fno-omit-frame-pointer)
target_include_directories(luna PUBLIC ${LUNA_ROOT}/luna)
target_include_directories(luna PUBLIC include/)
set_target_properties(luna PROPERTIES CXX_STANDARD 20)

View File

@ -1,5 +1,5 @@
#pragma once
#include <Attributes.h>
#include <luna/Attributes.h>
extern _noreturn bool __check_failed(const char* file, const char* line, const char* func, const char* expr);

View File

@ -1,6 +1,6 @@
#pragma once
#include <Attributes.h>
#include <Result.h>
#include <luna/Attributes.h>
#include <luna/Result.h>
#include <stdarg.h>
typedef Result<void> (*callback_t)(char, void*);

View File

@ -1,6 +1,5 @@
#pragma once
#include <CType.h>
#include <Types.h>
#include <luna/Types.h>
usize _atou(const char** str);
isize _atos(const char** str);

View File

@ -1,5 +1,5 @@
#pragma once
#include <Types.h>
#include <luna/Types.h>
inline void* operator new(usize, void* p) noexcept
{

View File

@ -1,9 +1,9 @@
#pragma once
#include <Check.h>
#include <Move.h>
#include <PlacementNew.h>
#include <SystemError.h>
#include <Types.h>
#include <luna/Check.h>
#include <luna/Move.h>
#include <luna/PlacementNew.h>
#include <luna/SystemError.h>
#include <luna/Types.h>
struct Error
{

View File

@ -1,5 +1,5 @@
#pragma once
#include <Types.h>
#include <luna/Types.h>
extern "C"
{

View File

@ -1,4 +1,4 @@
#pragma once
#include <Result.h>
#include <luna/Result.h>
Result<usize> to_dynamic_unit(usize value, char* buffer, usize max);

View File

@ -1,4 +1,4 @@
#include <Attributes.h>
#include <luna/Attributes.h>
_weak _noreturn bool __check_failed(const char*, const char*, const char*, const char*)
{

View File

@ -1,6 +1,6 @@
#include <CType.h>
#include <Format.h>
#include <NumberParsing.h>
#include <luna/CType.h>
#include <luna/Format.h>
#include <luna/NumberParsing.h>
extern "C" usize strlen(const char*);

View File

@ -1,4 +1,5 @@
#include <NumberParsing.h>
#include <luna/CType.h>
#include <luna/NumberParsing.h>
// This function assumes you have called is_valid_digit_for_base() to validate the digit first.
static isize parse_digit_unchecked(char c)

View File

@ -1,4 +1,4 @@
#include <String.h>
#include <luna/String.h>
extern "C"
{

View File

@ -1,4 +1,4 @@
#include <SystemError.h>
#include <luna/SystemError.h>
const char* error_string(int error)
{

View File

@ -1,5 +1,5 @@
#include <Format.h>
#include <Units.h>
#include <luna/Format.h>
#include <luna/Units.h>
Result<usize> to_dynamic_unit(usize value, char* buffer, size_t max)
{

View File

@ -5,7 +5,8 @@ source $(dirname $0)/env.sh
cd $LUNA_ROOT
SOURCES=($(find kernel/src -type f | grep -v "\.asm"))
SOURCES+=($(find luna -type f | grep -v "CMakeLists.txt"))
SOURCES+=($(find luna/src -type f))
SOURCES+=($(find luna/include/luna -type f))
ALL_OK=1

View File

@ -6,7 +6,8 @@ source $(dirname $0)/env.sh
cd $LUNA_ROOT
SOURCES=($(find kernel/src -type f | grep -v "\.asm" | grep -v "bootboot.h"))
SOURCES+=($(find luna -type f | grep -v "CMakeLists.txt" | grep -v "Types.h"))
SOURCES+=($(find luna/src -type f))
SOURCES+=($(find luna/include/luna -type f | grep -v "Types.h"))
SUCCESS=1

View File

@ -6,7 +6,8 @@ source $(dirname $0)/env.sh
cd $LUNA_ROOT
SOURCES=($(find kernel/src -type f | grep -v "\.asm" | grep -v "bootboot.h"))
SOURCES+=($(find luna -type f | grep -v "CMakeLists.txt" | grep -v "Types.h"))
SOURCES+=($(find luna/src -type f))
SOURCES+=($(find luna/include/luna -type f | grep -v "Types.h"))
for f in ${SOURCES[@]}
do

View File

@ -6,7 +6,8 @@ source $(dirname $0)/env.sh
cd $LUNA_ROOT
SOURCES=($(find kernel/src -type f | grep -v "\.asm"))
SOURCES+=($(find luna -type f | grep -v "CMakeLists.txt"))
SOURCES+=($(find luna/src -type f))
SOURCES+=($(find luna/include/luna -type f))
for f in ${SOURCES[@]}
do