Commit Graph

316 Commits

Author SHA1 Message Date
Dmitry Atamanov
e72ec2f605 std::bits fixes. 2023-07-22 17:40:08 +02:00
Christoffer Lerno
c4f8d5f25e Update range. 2023-07-19 21:56:52 +02:00
Dmitry Atamanov
7fbedae604 Add has function to Range and ExclusiveRange. 2023-07-19 21:45:14 +02:00
Pierre Curto
b453186de5 lib/std/collections: add init and tinit methods to PriorityQueue
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-19 21:44:20 +02:00
Dmitry Atamanov
49ea950f78 Add is_even and is_odd to math module 2023-07-19 11:38:49 +02:00
Christoffer Lerno
5aae9f3204 Correctly apply fixup to switch macros. Addresses new issue in #862. Updates @pool. 2023-07-19 11:38:18 +02:00
Christoffer Lerno
5c2e82fc8b More use of temp allocator. 2023-07-19 02:46:43 +02:00
Christoffer Lerno
4dcfb7a675 Fix of #862 where enums declarations where not regenerated. Updated @pool implementation. 2023-07-18 23:23:53 +02:00
Pierre Curto
491c5ceec5 support for List in quicksort; add HashMap.@each (#861)
* compiler: fix typo in error message about failed name resolution

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/sort: add List support to quicksort

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/collections: add HashMap.@each

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

---------

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-18 12:18:12 +02:00
Christoffer Lerno
2e6c8721bc Fix of is_comparable. 2023-07-17 21:22:16 +02:00
Pierre Curto
fd5336c56e lib/std/io/stream: add LimitReader (#858)
* lib/std/io/stream: add LimitReader

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std: more method conversions to use new receiver notation

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

---------

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-17 20:22:29 +02:00
Pierre Curto
89e084938f cross platform socket interface (#857)
* lib/std/net: add Network, Socket and Listener

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/net: add SocketOption

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/net: fixes for win32 and wasm

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

---------

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-16 14:14:36 +02:00
Pierre Curto
35bffdadc2 improve the sort and collections libs (#853)
* lib/std/sort: unify binarysearch and binarysearch_with; add comments to quicksort

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/collections: mark List.{len, is_empty, get} with @inline

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/collections: add PriorityQueueMax; add tests for PriorityQueue and PriorityQueueMax

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

---------

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-15 19:08:54 +02:00
Christoffer Lerno
34306cbf5d Fixes missing checks to body arguments. Do not create debug declaration for value-only parameter. Bug in alignment for atomics. Macro ref parameters are pointers. 2023-07-15 15:11:44 +02:00
Christoffer Lerno
ab32e0dc9d Fix for tests & callstack. 2023-07-13 21:48:48 +02:00
Christoffer Lerno
26ee4babcf Native_fopen for Win32 had incorrect arguments. 2023-07-13 19:54:27 +02:00
Christoffer Lerno
c7d90baad1 Error message on bus error or segmentation fault. Some additional SIG… (#848)
* Error message on bus error or segmentation fault. Some additional SIG info. Full debug info by default. Trapping is now debugtrap rather than trap for LLVM. Row now initialized when entering function for stacktrace.
2023-07-13 15:25:06 +02:00
Pierre Curto
1ffe430df0 lib/std/sort: use Hoare's algorithm in quicksort
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-11 11:09:51 +02:00
Pierre Curto
0efb142c88 std/lib/sort: avoid overflow in binary search
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-11 11:09:51 +02:00
Pierre Curto
2437573a8f lib/std/io: add Stream.read_all (#843)
* lib/std/io: add Stream.read_all

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/core: use shortened receiver notation

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

---------

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-10 20:13:31 +02:00
Christoffer Lerno
e2676a5c7f Change zero terminated wide strings to use WString over Char16 2023-07-09 20:10:17 +02:00
IgneousRed
943d010dfc New Rngs (#841)
* New Rngs

* Mistake

* fix Mcg using wrong constant
2023-07-09 15:00:19 +02:00
Christoffer Lerno
38cc24af27 binarysearch is now a builtin, quicksort as well. 2023-07-09 01:49:43 +02:00
Christoffer Lerno
053f7880e5 Simplified quicksort with $switch. 2023-07-09 01:46:45 +02:00
Christoffer Lerno
9543fbbf1c Exhaustive switch on enums. This addresses #838 2023-07-09 01:18:01 +02:00
Pierre Curto
77b3214746 std/lib/sort: update quicksort to use the new generics
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-08 14:06:40 +02:00
Pierre Curto
d709c18f5f std/lib/core: rename DString.str to DString.as_str (#834)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-08 00:10:04 +02:00
Pierre Curto
7dc1eab185 std/lib/collections: make List support the []= operator (#831)
* std/lib/collections: make List support the []= operator

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* std/lib/io: rename receiver to self

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

---------

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-07 13:51:44 +02:00
Christoffer Lerno
4f7b42cdc4 New generic syntax and ad hoc invocation. 2023-07-06 23:43:36 +02:00
Pierre Curto
df9bc377dd std/lib/net/os: add bind, listen and accept for posix platforms
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-06 17:36:54 +02:00
Pierre Curto
731729cf1b std/lib/hash: rename receiver to self
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-04 21:07:20 +02:00
Christoffer Lerno
daa952d990 Update quicksort. 2023-07-04 21:03:48 +02:00
Pierre Curto
f8a3e4f6f0 add basic quicksort support (#816)
* lib/std/sort: refactor binarysearch namespace to prepare for sorting

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* std/lib/sort: add basic quicksort support

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/hash: use method first parameter inferred type

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/hash: add fnv64a support

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

---------

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-04 20:15:03 +02:00
Christoffer Lerno
c249c3f3b6 Fix of accidentally printing "prev" when using $checks. Updated binary search. 2023-07-04 02:29:02 +02:00
Pierre Curto
55d17ec990 add the std::sort::binarysearch module
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-04 01:35:10 +02:00
Christoffer Lerno
848a5212ef Fixes #811. Update some stdlib methods. Header printout correctly picks a name. #804 2023-07-03 13:17:43 +02:00
Tonis
eaf45436f8 Edit Matrix4 perspective fn 2023-07-02 20:02:59 +02:00
Christoffer Lerno
50784d4df6 Updated to use the new implicit type for method calls in some libraries. Made the grammar a little more liberal. 2023-07-02 10:55:25 +02:00
Christoffer Lerno
21d8a8b6da Fix #809 missing checks on generic types, accepting both types where constants should be and vice versa. 2023-07-01 23:58:00 +02:00
Pierre Curto
2ac213a3ce lib/std/io/stream: add ReadBuffer and WriteBuffer streams
ReadBuffer and WriterBuffer buffer stream reads and writes to a stream.
Useful in situations where the underlying stream is sensitive to the number
of read or write calls.

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-07-01 17:38:09 +02:00
Christoffer Lerno
70ea6ce04b Fix #806, and also makes sure that things like FOO.x.a is a compile time value. 2023-07-01 16:29:17 +02:00
Pierre Curto
378ea1deea Update std::io::Stream (#805)
* add missing newlines in output messages when creating libraries

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

* lib/std/io: add Stream.supports_flush; fix AvailableStreamFn

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>

---------

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-06-30 17:37:08 +02:00
Christoffer Lerno
f74e294dc2 Push stack codegen to function for cleaner binaries. Some refactoring in allocators. 2023-06-30 01:01:58 +02:00
Christoffer Lerno
57c8b5fc75 Fix on rethrow + macros. 2023-06-27 20:41:17 +02:00
Christoffer Lerno
f651a59294 Fix on rethrow + macros. 2023-06-27 13:19:28 +02:00
Christoffer Lerno
b88916214f Fix of allocator gen. 2023-06-26 21:34:36 +02:00
Christoffer Lerno
685be0981f Fix priorityqueue. 2023-06-26 17:43:03 +02:00
Christoffer Lerno
fc054dad81 Added some to_string. 2023-06-26 16:21:07 +02:00
Christoffer Lerno
83f8bbb91b Update range to have exclusive and inclusive range. 2023-06-26 10:18:09 +02:00
Christoffer Lerno
0ec64c3be8 Remove broken free check on temp allocator. 2023-06-25 22:07:44 +02:00