Bananymous
07d5d3f936
BAN: Simple iterator now contains valid flag
...
This allows iteration over empty containers
2023-12-29 14:49:57 +02:00
Bananymous
861bf27e96
BAN: Implement abs()
2023-12-26 00:54:06 +02:00
Bananymous
b833239a82
BAN: Make hashmap work with non-copy constructable values
2023-12-24 13:38:47 +02:00
Bananymous
6fec142760
BAN: Add requires clauses for vector
2023-12-24 13:38:20 +02:00
Bananymous
84b2438b3d
BAN: Add requires for copy constructor for linked list
2023-12-24 13:37:49 +02:00
Bananymous
0e714d5eb4
BAN: Implement String::operator==(const String&)
2023-12-24 13:36:46 +02:00
Bananymous
9b8e6e6629
BAN: Implement is_*constructable
2023-12-24 13:36:12 +02:00
Bananymous
2e77718f07
BAN: Implement find() for StringView
2023-12-23 18:43:52 +02:00
Bananymous
f371fabe35
BAN: HashSet is now internally Vector<LinkedList<T>>
...
It used to be Vector<Vector<T>> but this feels more proper
2023-12-23 16:37:21 +02:00
Bananymous
79a15132da
BAN: Cleanup HashSet
...
I now use BAN::Iterator as the base iterator. Also unstable version
was added.
2023-12-23 16:32:06 +02:00
Bananymous
bacc0db778
BAN: Fix unstable hash map rebucket
2023-12-23 16:31:42 +02:00
Bananymous
3963afe343
BAN: Add unstable version of hash map
...
This version differs only when doing rebucket. If rebucket fails,
the whole hash map is invalidated. This allows rebucketing to use
moving instead of copying.
2023-12-19 22:23:28 +02:00
Bananymous
951873098e
BAN: Rewrite heap sort
...
Heap sort is now more close to gnulibc++ version. This is just more
simplified version.
2023-12-08 22:45:55 +02:00
Bananymous
2b927b9729
BAN: Restructure sort functions and namespaces
2023-12-08 18:58:47 +02:00
Bananymous
be657b9b18
BAN: Add default sort. This is wrapper around sort_intro
2023-12-08 00:10:09 +02:00
Bananymous
94e6b9fa65
BAN: Implement intro sort
2023-12-07 23:56:11 +02:00
Bananymous
d8ea0eeba3
BAN: Add less than operator for iterator
2023-12-07 23:55:41 +02:00
Bananymous
6873244169
BAN: Move placement new to New.h
...
I have no idea why they were defined in Move.h
2023-12-07 23:52:57 +02:00
Bananymous
805b4096e9
BAN: Remove empty else. Builds with -Wall -Wextra
2023-12-07 23:50:35 +02:00
Bananymous
0f74e123b8
BAN: Implement ilog2 for unsigned integers
2023-12-07 23:50:04 +02:00
Bananymous
7f212106db
BAN: Implement heap sort
2023-12-07 23:18:49 +02:00
Bananymous
46c3da71b6
BAN: Cleanup sorting code
2023-12-07 23:18:49 +02:00
Bananymous
e5cab047d6
BAN: Implement more methods for iterators
2023-12-07 23:18:49 +02:00
Bananymous
bf3e9eabd5
BAN: Implement distance() for iterators
2023-12-07 23:18:49 +02:00
Bananymous
19604015de
BAN: Implement quick sort
2023-12-07 19:28:31 +02:00
Bananymous
08bc0a2815
BAN: Implement next() and prev() for iterators and use them in sorts
2023-12-07 19:28:05 +02:00
Bananymous
6caa9b6f95
BAN: implement quick sort and test for it
2023-12-07 11:55:28 +02:00
Bananymous
59ad639fa8
BAN: Fix simple iterator operator--()
2023-12-07 11:55:28 +02:00
Bananymous
43458cc74f
BAN: implement exchange sort and test for it
2023-12-07 11:55:28 +02:00
Bananymous
e935a33a4d
BAN: add value_type to iterators
2023-12-07 10:15:18 +02:00
Bananymous
a872efdef2
BAN: implement basic swap
...
This will be improved, currently just works on general type T and
moves values between arguments.
2023-12-07 09:26:17 +02:00
Bananymous
19ed0cb9bf
BAN: Add basic GUID data structure
2023-11-21 15:11:50 +02:00
Bananymous
240d57f4b4
BAN: Update bytespan -> span API
2023-11-04 18:12:46 +02:00
Bananymous
f6c312a6b3
BuildSystem: using sysroot doesn't need root privileges anymore!
...
Sysroot is now created with fakeroot. This allows root access to be
only needed for disk image creation, since it uses loopback devices.
2023-11-04 17:50:43 +02:00
Bananymous
ca34ece8ef
BAN: Update ASSERT api
...
its now much harder to mix < with <= and > with >=
2023-11-02 00:01:12 +02:00
Bananymous
3c311efb81
BAN: Implement better ASSERT macros
...
Implement macros for all basic binary ops. These macros print failed
values when the fail.
2023-10-30 16:22:02 +02:00
Bananymous
d5e0900cbb
BAN: String now uses union for its sso storage
...
This allows String to shrink by 8 bytes since Variant's 8 index is
no longer stored in here.
This required me to make Strings max size one bit less, but that
should still be fine. There should never be strings with size of
over half of the computer's address space.
2023-10-30 11:13:16 +02:00
Bananymous
229082a1b2
BAN: Rewrite String with small string optimizations
...
String now holds a 15 byte sso buffer. I'm not sure what the size
should actually be but 15 will work for now. Maybe the sso buffer
should be contained in an union with one bit flag in size instead of
variant that uses extra 8 bytes for type index.
This patch buffs sizeof(String) from 24 bytes to 32 bytes on 64 bit.
I assume this is much better version than the old which had to make
allocation even for empty strings :D.
2023-10-29 03:11:13 +03:00
Bananymous
0db17e9d39
BAN: Add variant to ForwardList
...
I should be using the forward list more
2023-10-29 02:28:55 +03:00
Bananymous
d98f84f9d3
BAN: Update ByteSpan API
...
Add ByteSpan::as_span<T> and const versions of as() and as_span()
require T to be const.
2023-10-28 22:10:47 +03:00
Bananymous
3566ddab00
BAN: ByteSpan can be sliced without specified size
...
This will give span with all remaining size after offset
2023-10-25 21:41:11 +03:00
Bananymous
fc8a000e46
BAN: Fix bug of size of splice after slice()
...
I have no idea what was I doing before :D
2023-10-24 17:23:45 +03:00
Bananymous
71cad2fc38
BAN: Implement ByteSpan
...
This is a span over exisiting containers/data types. I'm not too
happy with the constructors and assignment operators, but they will
work for now
2023-10-20 04:59:29 +03:00
Bananymous
61c7a68f4a
BAN: add helper to cast Span<T> to Span<const T>
2023-10-20 04:59:08 +03:00
Bananymous
744ff40ba0
BAN: Optional can now be constructed from another Optional
...
Also fix bug in release_value() where we did not call the
destructor.
2023-10-11 20:10:06 +03:00
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
Bananymous
5d459130a7
BAN: StringView::split(char, bool) is now thread safe
...
I had to duplicate some code, but this is better since I would like
to not use BAN::Function for something like this
2023-03-30 16:35:38 +03:00
Bananymous
10e0c90fde
BAN: String add front() and back() helpers
2023-03-29 14:10:29 +03:00
Bananymous
e5c3486826
BAN: Vector now takes optional argument for default value on resize
2023-03-28 23:10:36 +03:00
Bananymous
8e626b8d1f
BAN: Implement basic Circular Queue
2023-03-28 21:44:02 +03:00
Bananymous
6a6717cdd3
BAN: ScopeGuard can now be disabled (it wont call the function)
2023-03-28 01:15:13 +03:00
Bananymous
0cebf248a3
BAN: move placement new declaration to Move.h
2023-03-27 03:38:06 +03:00
Bananymous
666051fd34
Kernel/BAN: move unix time conversion to BAN and add stat to Shell
2023-03-27 00:49:58 +03:00
Bananymous
efe73caf1b
BAN: char* is now formatted as string and not pointer
2023-03-23 14:29:35 +02:00
Bananymous
3ef72e8a7b
BAN: Modify Span constructors to keep constness correctly
2023-03-23 14:26:03 +02:00
Bananymous
e9da63ad79
BAN: Add is_const to traits
2023-03-23 13:28:57 +02:00
Bananymous
74949401bd
Kernel: Cleanup GPT parsing code
2023-03-23 11:13:14 +02:00
Bananymous
a61cf61fd1
BAN: Add wrappers for little/big endian numbers
2023-03-20 19:48:08 +02:00
Bananymous
f9ae1f0023
Kernel: Fix PC Screen font parsing
...
I had misread the format and the parsing code was incorrect. I also
changed fonts to store unicode codepoints as 32 bit integers, so
every character can be represented
2023-03-20 14:52:42 +02:00
Bananymous
ce3f268075
BAN: Implement basic Span
...
This is wrapper over contiguous block of memory e.g. Vector
2023-03-20 13:34:26 +02:00
Bananymous
8edabaea55
BAN: Add iterators to all containers with contiguous memory
2023-03-20 13:26:42 +02:00
Bananymous
ec22b86e00
BAN: Add implementation for basic iterator for contiguous memory
2023-03-20 13:15:38 +02:00
Bananymous
1292be71b2
BAN: Add FNV hash for strings
2023-03-16 15:11:22 +02:00
Bananymous
1b7625581d
Kernel: Add basic concept of Processes
...
We now create Shell as a process that has its own threads
2023-03-16 12:17:04 +02:00
Bananymous
c012822d49
BAN: Rename StringView suffix from _sv to sv
2023-03-16 12:15:16 +02:00
Bananymous
392da37f9a
BAN: Function storage is now aligned as CallableBase and not max_align_t
...
On 32 bit architecture the alignment of 16 bytes did not seem to work
on stack variables. UBSan detected whole lot of misaligned functions
from Ext2.cpp. This patch should make function alignment be big enough?
2023-03-09 01:42:17 +02:00
Bananymous
371dfe8ef3
BAN: Formatter now uses perfect forwarding on its arguments
2023-03-08 21:31:26 +02:00
Bananymous
3ac99f1bd8
BAN: Add more traits and cleanup code
2023-03-08 21:30:21 +02:00
Bananymous
7458f68c38
BAN: Error can now be constructed from c_string or format string
...
If the resulting string would overflow, we just truncate it to fit
the error message buffer (128) bytes
2023-03-08 17:05:37 +02:00
Bananymous
23b3028e15
Kernel: Rename RefCounted -> RefPtr and implement RefCounted
2023-03-08 03:26:25 +02:00
Bananymous
e480f9c195
BAN: RefCounted<> frees count if object allocation fails
2023-03-06 13:17:04 +02:00
Bananymous
e3a71289c0
BAN: fix LinkedList back/front functions
2023-03-06 01:46:52 +02:00
Bananymous
81cb342c12
BAN: Remove #error macros
2023-03-02 22:30:32 +02:00
Bananymous
1c146ba1a5
BAN: remove aligned alloc from ban
2023-03-02 22:12:42 +02:00
Bananymous
52aa98ba25
Kernel+LibC: Add some errno codes
...
Kernel now returns ENOMEM and other errnos, so we dont have to write
error messages
2023-03-02 21:10:44 +02:00
Bananymous
90a7268e5a
BAN: Rewrite RefCounted to return ErrorOr
2023-03-02 12:30:11 +02:00
Bananymous
dc1a4614fb
BAN: Errors are now moved around with TRY()
2023-02-26 02:54:34 +02:00
Bananymous
9439582154
BAN: Add ASSERT_NOT_REACHED()
2023-02-26 02:53:58 +02:00
Bananymous
6c1f0d1dc8
BAN: Add big_endian_to_host in Math
2023-02-23 15:58:32 +02:00
Bananymous
0e77b4dc4e
BAN: You can now transform little endian data to host endian
2023-02-22 21:47:22 +02:00
Bananymous
f98f3d851c
BAN: HashMap uses LinkedList as bucket, so kmalloc_fixed can be used
2023-02-22 21:46:41 +02:00
Bananymous
a845f8696c
BAN: Add function to decode utf-8 encoded strings
...
works for 3 byte unicode characters
2023-02-22 21:45:26 +02:00
Bananymous
4afc4660a4
BAN: Basic containers have shrink_to_fit() method
...
I also chaged the default memory allocation increase from 1.5 to 2
2023-02-22 02:07:05 +02:00
Bananymous
5d31e89574
Kernel: Update ErrorOr API and add path find to VFS
...
These two are done on the same commit since Changes to Shell were
annoying to make work with only one change
2023-02-22 01:23:11 +02:00
Bananymous
9aab67fed8
BAN: make all Math functions inline constexpr
2023-02-22 01:17:56 +02:00
Bananymous
10b6d51522
BAN: implement Variant<> for two types
2023-02-22 01:17:21 +02:00
Bananymous
afd4b7a184
BAN: HashMap now copies size when copying :D
2023-02-22 01:16:07 +02:00
Bananymous
fbc17eb6dd
BAN: Implement basic HashMap
2023-02-20 16:00:51 +02:00
Bananymous
247f03c79e
BAN: Make ErrorOr<> have attribute [[nodiscard]]
...
We don't have to specify it everytime we make function return ErrorOr
2023-02-19 20:10:30 +02:00
Bananymous
66a4b69a29
BAN: Math now uses template concepts and add div_round_up
2023-02-19 00:48:56 +02:00
Bananymous
7f12a7050a
BAN: Add data() to Vector.
...
This allows you to access the underlying data in a vector
2023-02-16 20:47:49 +02:00
Bananymous
f188fea81c
BAN: Implement basic HashSet
2023-02-10 02:59:52 +02:00
Bananymous
7630df84ad
BAN: Add basic hashing functionality
2023-02-10 02:59:30 +02:00
Bananymous
4f8fcf0bd7
BAN: Add Formatter specialization for Vector
2023-02-10 02:58:14 +02:00
Bananymous
f68ae01d0c
BAN: Fix ErrorOr<void> to actually set error byte
2023-02-10 01:06:18 +02:00
Bananymous
7ee4ecd7f4
BAN: Vector's and Queue's underlying type is T* instead of uint8_t*
...
I have no idea what kind of brainfart I had to make use uint8_t*
that just complicated the code :D
2023-02-10 00:12:23 +02:00
Bananymous
e5ffc1686f
BAN: Vector::const_iterator now uses const T* as underlying type
2023-02-09 23:06:49 +02:00
Bananymous
bfc9a2377c
BAN: LinkedList now uses iterators instead of const_iterators on methods
2023-02-09 23:06:16 +02:00
Bananymous
6a133782ed
All: Move to c++20
2023-02-09 23:05:26 +02:00
Bananymous
338771c5b0
BAN: Cleanup Vector code
...
*Applies to last patch also!*
Remove duplicate code in iterators. We used to have separate iterator
and const_iterator but now they are the same class with some enable_if
magic to disable references from const_iterator
This introduces some 'bad things' you can for example call
const_iterator.operator*<false>() to obtain non const reference. I
don't think this matters since you could use const_cast or something
else to work around const if you really tried
2023-02-07 11:08:05 +02:00
Bananymous
08dfb0e1db
BAN: Cleanup LinkedList code
2023-02-06 19:01:52 +02:00