Commit Graph

79 Commits

Author SHA1 Message Date
Jeroen van Rijn
11e57fd3fd Address concerns. 2024-05-24 13:58:30 +02:00
Jeroen van Rijn
c43d189a33 Fix package line. 2024-05-24 01:43:17 +02:00
Jeroen van Rijn
410876b36a Add core:container/rbtree
Add a red-black tree with configurable $Key and $Value.
Also includes tests that verify it maintains RB invariants, doesn't leak.

Originally based on the CC0 implementation from literateprograms.org.
But reworked to the same API used by @Yawning's excellent `core:container/avl` for ease of use.
2024-05-23 23:00:00 +02:00
gingerBill
334e08c750 Update numerous package declaration names 2024-04-18 12:17:39 +01:00
Maurizio M. Gavioli
a0cff82320 Fix the format of some doc.odin files of the core library which did not made into the documentation.
`c/frontend/tokenizer`:
   add proper "Example:" header to demo example code,
   removed empty lines.
`container/bit_array`:
   moved comment before package;
   aligned narrative lines to left margin;
   converted case lines into bulleted lines ("- ");
   converted individual examples to single-tab-indented preformatted text.
`dynlib`:
   removed "//+build ignore" line;
   added newline at EOF.
`image/netpmb`:
   converted indented lines of "Reading", "Wrting" and "Some syntax..." into bulleted lists;
   "Formats" indented lines kept as they are as the preformatted text seems relevant to keep the alignments;
   doubly indented lines kept as single-indented to keep them different (as the format does not allow for two-level bulleted lists);
   removed empy lines.
`os/os2`:	WIP, not modified
`sys/info`:
   removed "//+build ignore" line;
   converted tab-indented initial description into regular left-margin comment;
   moved uncommented sample code within the doc comment as an "Example:";
   moved simple- and double-tabbed separate comments with sample Windows and macOS outputs within the doc comment as bulleted headlines with preformatted output listings;
   removed now empty comments and blank lines after the package line.
`text/i18n`:
   removed "//+build ignore" line;
   moved the pacakge line at the end;
   de-indented the tab-indented introductory narrative;
   moved sample code comments into the doc comment as tab-indented code with a proper "Example:" heading;
   removed "```" MD attempts at code formatting.
`text/table`:
   unindented the comment lines of a descriptive kind;
   headlines of major subdivisions are marked as bold;
   kept code samples as tab-indented preformatted text (as there are several of them, the standard "Example:" and "Output:" headings cannot be used) removing the "```" MD attempts at code formatting;
   removed in-between blank lines.
2024-04-14 17:18:08 +02:00
Yawning Angel
874d6ccb60 core/container/avl: Initial import 2024-02-24 14:05:15 +09:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
Jeroen van Rijn
656e62d724 Add peek to priority queue. 2024-01-08 19:33:30 +01:00
Jeroen van Rijn
04c928fb9e Clear up core:container/queue 2023-11-15 15:20:52 +01:00
flysand7
270348b112 [core]: Remove do keyword from the core library 2023-11-11 20:36:38 +11:00
gingerBill
8e9d1c7ebf Make procedures contextless where possible 2023-09-12 11:52:05 +01:00
gingerBill
53380632a1 Swap order of prev and next 2023-09-12 11:44:54 +01:00
Laytan Laats
076b20a9a5 fix queue reserve always doubling in size when there is enough space 2023-08-26 19:09:04 +02:00
gingerBill
3dec55f009 Replace x in &y Use &v in y syntax through core & vendor for switch/for statements 2023-06-26 15:42:57 +01:00
gingerBill
319a465429 Correct queue usage of runtime.Allocator_Error 2023-05-27 15:26:27 +01:00
Jon Lipstate
bcb01bdc52 added set overload, made make explicit 2023-05-02 18:21:52 -07:00
Jon Lipstate
075193af1d update docs, add unsafe_get/set, add round up to create 2023-04-30 16:56:05 -07:00
Lucas Perlind
f029b4beb1 Add more utility procedures to small array 2022-12-21 13:00:33 +11:00
gingerBill
035c75d6a9 Add contextless where appropriate 2022-11-11 11:23:59 +00:00
Colin Davidson
7a6fc3a93b Add bounds check for peeks 2022-08-29 02:03:12 -07:00
Colin Davidson
83c002c197 add peeks 2022-08-29 01:53:40 -07:00
Colin Davidson
6c2e0b09ba Add more queue helpers 2022-08-29 00:43:35 -07:00
Jeroen van Rijn
e40b3ad338 Remove unused n from PQ; add reflect.is_bit_set 2022-08-18 18:00:25 +02:00
gingerBill
79eb7b52d9 Merge pull request #1828 from JungerBoyo/patch-2
front() and back()
2022-06-12 16:17:39 +01:00
JungerBoyo
78e6cd0c60 front() and back()
based on pop_front(), pop_back()
2022-06-04 00:12:34 +02:00
JungerBoyo
ad6b3bd95f unset function
unset function, clear single bits
2022-06-03 15:53:14 +02:00
sduman
9ce64916e6 Add missing result parameter names
This adds some missing result parameters names back to pop_front_safe.

Currently it the procedure won't compile since it's referencing missing variable names.
2022-04-28 17:08:48 -06:00
gingerBill
3a9b0a22e7 Add core:container/intrusive/list 2022-04-27 14:27:33 +01:00
hanabi1224
ded8342f3f Reduce allocations 2022-04-19 20:46:33 +08:00
hanabi1224
4247ba67ed Fix bugs in core:container/lru 2022-04-18 15:24:54 +08:00
gingerBill
2289b7a33d Remove #caller_location from certain calls in core:container/small_array 2022-04-04 17:04:05 +01:00
Jeroen van Rijn
ce057ff755 [bit_array] Really fix the leak. 2022-03-06 12:29:17 +01:00
Andrea Piseri
bff3426d25 Fix leak in core:container/bit_array
calling `clear` on a `bit_array` no longer leaks the previous
allocation, instead it sets all bits to `false` preserving the same
backing dynamic array.
2022-03-06 10:21:46 +01:00
ap29600
697f8c7ee6 replace a branch with max in core:container/bit_array.set 2022-02-05 18:46:25 +01:00
Andrea Piseri
b6ebfe4b2c rename iterator procedures 2022-02-05 18:11:48 +01:00
Andrea Piseri
bccbdefde9 Update interface to allow more modes of iteration
It's now possible to iterate over:
- all keys in the range min_value ..= max_value, with `iterate_all`
- all set keys in the bit array, with `iterate_set`
- all unset keys in the range min_value ..= max_value, with `iterate_unset`

`Bit_Array` now stores the `max_value` provided during construction, and
updates it when a key that was previously out of range is set.
2022-02-05 18:00:59 +01:00
ap29600
b54fc96b1e rename iterator proc to next, add named return values 2022-02-04 22:39:47 +01:00
Andrea Piseri
48af78e469 add iterator to core:container/bit_array 2022-02-04 22:12:07 +01:00
gingerBill
76edfae0e0 core:container/topological_sort 2022-02-04 12:08:20 +00:00
gingerBill
35533a7baa Update core:container/lru to support clear and take a boolean to indicate whether or not to call the on_remove procedure on clear or destroy 2022-02-02 23:38:32 +00:00
gingerBill
a04d849e30 core:container/lru 2022-02-01 15:24:37 +00:00
gingerBill
fb86c23dbd Keep -vet happy 2022-01-25 16:41:31 +00:00
Jeroen van Rijn
515fd2a228 bit_array: Fix initial size. 2022-01-25 17:08:32 +01:00
CiD-
6cf5371d7d fix push_back and pop_front 2022-01-14 10:17:49 -05:00
gingerBill
a60b9735a2 Add core:container/queue 2022-01-01 15:46:22 +00:00
gingerBill
43763ddfda Correct _shift_down logic 2022-01-01 13:44:37 +00:00
gingerBill
70ed280c5a Fix typo in priority_queue.odin and add default_swap_proc 2022-01-01 13:11:53 +00:00
gingerBill
c7ff296bef Change the implementation of Priority_Queue to have a better interface that allows for a less and swap procedure 2021-12-30 13:42:10 +00:00
gingerBill
ed8b20da78 Add core:container/priority_queue 2021-12-29 14:38:39 +00:00
gingerBill
a66f859fb4 Minor improvements to core:container/small_array 2021-12-29 11:58:27 +00:00