Commit Graph

177 Commits

Author SHA1 Message Date
Bananymous 0b93fce923 BAN: Remove endianness functions from Math
There is now a Endianness.h for these. The functions were super slow.
2023-09-29 19:38:07 +03:00
Bananymous a8d74f604e BAN: Update Endiannes API
Add functions to swap endiannes or convert host to big/little endian

This code should be very compiler friendly and should be optimized to
single bswap instruction on x86.
2023-09-28 01:22:14 +03:00
Bananymous ef68e12125 BAN: Implement basic WeakPtr
This can be constructed from classes that inherit from Weakable
2023-09-25 19:43:10 +03:00
Bananymous 2a469241b2 BAN: Fix LinkedList::pop_back() 2023-09-22 17:20:35 +03:00
Bananymous 921d95d18f All: Clear lines with only whitspace in them 2023-09-10 00:31:42 +03:00
Bananymous 250789aa20 Kernel: better handle kernel errors 2023-08-29 00:13:21 +03:00
Bananymous 8032824054 BuildSystem: use -a with rsync
This allows cmake to not rebuild whole project every time
2023-08-28 11:38:17 +03:00
Bananymous 80e7a89f67 BuildSystem: Base sysroot is now distributed as a tar ball
This allows file and directory permissions work as intended.

cmake is now filled with 'sudo' but with sudo timeout this should be
fine.
2023-08-23 10:38:21 +03:00
Bananymous e33bf62bba BAN: increase function size to 5 * sizeof(void*) 2023-08-22 14:52:03 +03:00
Bananymous 642929f071 BAN: Add enum class Iteration for for_each loops 2023-08-22 11:30:53 +03:00
Bananymous 2746419c8c BAN: Function call is now const 2023-08-22 11:30:40 +03:00
Bananymous 453a5387cb BAN: UniqPtr can now be constructed from other convertible UniqPtr 2023-08-04 10:29:42 +03:00
Bananymous 21c6135ae2 BAN: Fix function call in Optional 2023-07-21 10:57:46 +03:00
Bananymous 16acd50559 BAN: Iterators are now single general type with CONST template
This allows us to use the same base class for iterator and
const_iterator which were practically the same code.
2023-07-12 13:35:21 +03:00
Bananymous 5df48804e1 BAN: add either_or and either_or_t
This allows you to select type depending on constexpr evaluatable
boolean
2023-07-12 13:34:31 +03:00
Bananymous 9eab6710ce BAN: Implement ConstIteratorDouble and add it to HashMap
This is same as IteratorDouble except it uses const_iterator and does
not return non-const references.
2023-07-12 11:41:05 +03:00
Bananymous 65424a6769 BAN: Generalize HashMapIterator to IteratorDouble
This iterator should be able to iterate any container within container
with type iterator defined.

This also fixed bug if first entry in outer container is empty container.
2023-07-12 09:29:05 +03:00
Bananymous f88b9ae4f2 BAN: Add iterators to HashMap 2023-07-10 23:16:41 +03:00
Bananymous fabbb9f531 BAN: RefPtr can be constructed from other types 2023-07-10 11:48:11 +03:00
Bananymous b9603d9d23 BAN: Optional can be constructed inplace 2023-06-12 23:45:36 +03:00
Bananymous 16e5f96b1d BAN: Add operator-> and operator* to Optional 2023-06-12 22:25:14 +03:00
Bananymous cce2f3e19a BAN: Add basic Optional 2023-06-11 21:00:25 +03:00
Bananymous 290b81dedc BAN: add StringView::contains(char) 2023-06-05 22:51:02 +03:00
Bananymous 9fd3111011 BAN: Add UniqPtr 2023-06-04 00:39:20 +03:00
Bananymous 1e075c248f BAN: Errors now includes assert.h 2023-06-03 18:53:05 +03:00
Bananymous efb3271588 BAN: Fix function call in Vector 2023-06-01 00:50:04 +03:00
Bananymous a378e59432 BuildSystem: link libraries when they change
This also fixed the need for manual linkin on firt build
2023-05-31 23:01:40 +03:00
Bananymous faf14b880e LibC: Rewrite all the headers.
We now have more or less posix issue 2018 conforming libc headers.

This was a really time consuming and boring operation but it had to
be done.

Now we get to actually start implementing libc :)
2023-05-26 22:31:21 +03:00
Bananymous faa7bc6043 BAN: libban is now build into library dir 2023-05-26 22:31:21 +03:00
Bananymous 03c64b950b BAN: Errors.h can be included from userspace 2023-05-26 22:31:21 +03:00
Bananymous 591d03de95 BAN: add is_arithmetic and is_signed to Traits.h 2023-05-15 20:26:29 +03:00
Bananymous 0d9422ead8 BAN: add pow, log2, log10, log in math
These are implemented using x86 floating point assembly
2023-05-10 19:03:33 +03:00
Bananymous 05046d6e93 BAN: Error uses 64 bit error codes 2023-05-07 02:09:52 +03:00
Bananymous 9cf09165b5 BAN: Add is_power_of_two to Math functions 2023-04-28 14:42:49 +03:00
Bananymous 3ca623349a BAN: Add {TRY,MUST}_REF for references
It is annoying that we have to have separate macros for these but
I can't find a way to cleanly return lvalue reference from statement
expression. Currently we cast the reference to pointer and return
unreference the pointer outside of the expression.

This feature will probably not be used any time soon, but atleas
it is implemented if I need it one day
2023-04-19 00:31:15 +03:00
Bananymous 121f4bc1dd BAN: TRY and MUST macros use rvalue references 2023-04-19 00:11:15 +03:00
Bananymous 8e31ef9905 BAN: Add specialization for ErrorOr<LValueReference>
ErrorOr can now return a reference :)
2023-04-18 22:02:47 +03:00
Bananymous 2c52e0aad8 BAN: Variant with reference now supports copy/assign 2023-04-18 20:21:23 +03:00
Bananymous 06916f56be BAN: Variant now works with references
References can be assigned with the set() method. Construction nor
assigment operators cannot be used with references to avoid ambiguity
with what assignment to reference does.

You can set the underlying reference with the set() method and access
it with the get() method.

The references are stored as pointers to the object under the hood
which means that size of a reference is sizeof pointer.
2023-04-18 19:53:34 +03:00
Bananymous c3df0bd15e BAN: Variant::set now copy/move assigns when possible 2023-04-18 19:10:22 +03:00
Bananymous b41a8e2829 BAN: Variant now has variadic template types 2023-04-18 18:29:48 +03:00
Bananymous fdb4eb6042 Kernel: Move kmalloc and MMU to Memory directory 2023-04-18 10:18:15 +03:00
Bananymous c35e7368f2 BAN: Variant now aligns its data properly 2023-04-12 00:17:45 +03:00
Bananymous aa2aee684b Kernel: remove message from BAN::Error
We don't store the error message anymore in BAN::Error.
Instead we store a error code that can be mapped into a string.
This allows BAN::Error to only take 4 bytes instead of 128.

We should also make some kernel initialization just panic instead
of returning errors since they are required for succesfull boot
anyway.
2023-04-11 23:25:21 +03:00
Bananymous cfa025acae BAN: Move RefPtr to its own file and create New.h
New.h contains definitions for placement new operators and
BAN::allocator and BAN::dealloctor
2023-04-10 21:07:25 +03:00
Bananymous 781cc78a1f BuildSystem: Fix header copying to sysroot
We used to copy all headers everytime to sysroot which caused
rebuild of the whole os. Now we use the cmake command
'copy_directory_if_different' which seemed to fix this issue :)
2023-04-10 21:07:25 +03:00
Bananymous 8a8793fd2d BuildSystem: you can now build the toolchain with cmake 2023-04-06 00:23:02 +03:00
Bananymous daa35aaf7d BAN: Add data() member function to Array 2023-04-03 17:00:52 +03:00
Bananymous 4c5176f751 BuildSystem: We are now using cmake instead of plain make
I have been annoyed for a while since I had to build everything
when running the os since the buildsystem was really bad.

I wanted to rewrite the whole build system and changed to using cmake

:)
2023-04-02 04:07:27 +03:00
Bananymous 7b7f4eb141 BAN: LinkedList::remove now returns iterator to the element after 2023-03-30 18:46:19 +03:00