Commit Graph

190 Commits

Author SHA1 Message Date
Damian Tarnawski
413b44d05c Add missing caller location param to append in strings builder 2025-09-10 13:23:56 +02:00
Jeroen van Rijn
4b36306674 Deprecate old @(deprecated) things. 2025-06-06 10:42:34 +02:00
Feoramund
b7de15caa3 Clarify strconv.append_* to strconv.write_* 2025-06-05 16:56:00 -04:00
Jeroen van Rijn
c705756389 Fix doctest 2025-05-31 20:35:25 +02:00
Jeroen van Rijn
890e923051 Vectorize strings.prefix_length.
Also add `strings.common_prefix`.
2025-05-31 20:24:21 +02:00
Jeroen van Rijn
39789bc6cb Make strings.to_cstring adhere to #optional_allocator_error 2025-05-12 01:17:34 +02:00
mtarik34b
f4212b60e7 Remove redundant calls to builder_init 2025-04-16 13:16:51 +02:00
Jeroen van Rijn
f7c4c80ef3 Fix broken examples in documentation tester.
No more:
```
We could not find the procedure "pkg_foo_example :: proc()" needed to test the example created for "pkg.foo"
The following procedures were found:
   bar()
```
2025-04-05 16:36:26 +02:00
Feoramund
fef5f526f3 Remove unneeded slicing in strings.clone 2025-03-05 13:54:31 -05:00
Feoramund
b2e3b34ce0 Fix #4890
`strings.to_cstring` previously would not check if the buffer could
handle the extra null byte and could lead to segmentation violations
when using the resulting string in an API expecting the terminator.
2025-02-27 18:54:38 -05:00
Jacob Friedman
385f5f5014 Small optimization 2025-02-04 19:51:48 +01:00
Jacob Friedman
4c0b145bad Fix unicode handling 2025-02-04 15:49:23 +01:00
Jacob Friedman
239c511ce9 Fix strings.split_iterator when separator is empty 2025-02-04 15:09:12 +01:00
Laytan Laats
16e3abfe82 strings: use map_entry 2025-01-08 22:20:43 +01:00
Adam Zadrożny
5dfc24882f improve strings.index_multi
There's no point searching for substrings after lowest_index,
so let's not.

This significantly improves performance on long strings.
2024-12-04 14:29:49 +01:00
Jeroen van Rijn
6f23b5bb60 Fix #4359
Fixes #4359
2024-10-09 14:31:01 +02:00
Laytan Laats
5ae27c6ebc wasm: support more vendor libraries
Adds support for:
- box2d
- cgltf
- stb image
- stb rect pack
2024-09-09 18:49:13 +02:00
Jeroen van Rijn
645207b8b0 Merge pull request #4192 from laytan/strings-substring-rune-wise
strings: add `substring`, `substring_to` and `substring_from`
2024-09-03 22:47:56 +02:00
Laytan Laats
597ba796b7 strings: add substring, substring_to and substring_from 2024-09-03 21:13:35 +02:00
Jeroen van Rijn
996175753c strings.cut without allocation. 2024-09-03 19:02:40 +02:00
gingerBill
2999c02f65 Fix random typo 2024-08-19 16:33:17 +01:00
gingerBill
9d7ab8d5ca Add strings.contains_space 2024-08-19 16:31:03 +01:00
gingerBill
31bb3dc4f0 Merge pull request #3971 from jasonKercher/os2-process-linux
os2 process linux implementation
2024-08-16 12:38:27 +01:00
jason
07a9c69714 update core:filepath's clean, join and split_list to return optional Allocator_Errors 2024-08-16 01:48:27 -04:00
gingerBill
62911539cd Minor style change 2024-08-13 14:27:25 +01:00
Feoramund
c69fa87d53 Merge core:simd/util into core:bytes 2024-08-10 07:17:03 -04:00
Feoramund
c8a62ee4ec Make simd_util index procs contextless where applicable 2024-08-09 18:54:04 -04:00
Feoramund
12dd0cb72a Simplify and make simd_util cross-platform
This new algorithm uses a Scalar->Vector->Scalar iteration loop which
requires no masking off of any incomplete data chunks.

Also, the width was reduced to 32 bytes instead of 64, as I found this
to be about as fast as the previous 64-byte x86 version.
2024-08-09 18:54:04 -04:00
Feoramund
f66fcd9acb Use vectorized index_* procs in core 2024-08-06 15:19:05 -04:00
gingerBill
f75a45c3fa Add aliases starts_with and ends_with 2024-07-10 16:34:15 +01:00
Jeroen van Rijn
258f120d52 Remove nil checks.
The caller should really not pass `foo: ^string = nil`. A `for ch, in foo` would also crash,
so let's not introduce new semantics for iteration.

A caller shouldn't pass garbage if they can help it, and a `nil` ^string is not a useful ZII usage here.
2024-07-06 18:34:52 +02:00
gingerBill
e296d6fb90 Fix loads of indentation issues with mixing spaces and tabs 2024-06-29 19:50:51 +01:00
Karl Zylinski
679f9b4e41 Made default capacity of dynamic arrays more consistent.
Before this if you do `arr: [dynamic]int` and then append to arr, then it will have capacity 8.
But if you did `arr := make([dynamic]int, context.temp_allocator)` then arr would have capacity 16.

Now both `arr: [dynamic]int` and `arr := make([dynamic]int, context.temp_allocator)` will resut in arr having zero 0. The only reason to use `make` without an explicit len or cap now is because you want to set it up for a non-default allocator. After the first call to `append` it will now in both cases have capacity 8.

I also updated the documentation on the strings builder, both to reflect this, and also to fix it incorrectly saying that len would be 'max(16,len)', which wasn't true even before these changes.
2024-06-29 08:57:21 +02:00
gingerBill
853173a11b Merge pull request #3517 from timosperisen/patch-1
Update builder.odin
2024-06-28 12:00:23 +01:00
Justin Snyder
1a6bb59125 drop unnecessary defer 2024-06-19 18:25:42 -06:00
Justin Snyder
271782d2f4 fix typo
apparently i had a moment of dyslexia
2024-06-19 17:53:34 -06:00
Justin Snyder
1b7c4c2efe trim added null byte 2024-06-19 17:35:16 -06:00
Justin Snyder
8f2c4a7ecf Add builder to_cstring 2024-06-19 11:55:19 -06:00
Jeroen van Rijn
a27b167218 Update tests\core\encoding\cbor to use new test runner.
It was leaky and required a substantial number of `loc := #caller_location` additions to parts of the core library to make it easier to track down how and where it leaked.

The tests now run fine multi-threaded.
2024-06-02 14:47:07 -04:00
gingerBill
7cf62f00c3 Correct #soa RTTI usage 2024-05-16 16:30:45 +01:00
Timo
2918baa3e8 Update builder.odin
Modify documentation-text for procedure write_f64 :

change type f32 to f64
2024-04-29 20:22:53 +02:00
Laytan Laats
3a0df80066 correct newly found vets 2024-04-03 00:52:58 +02:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
Walther Chen
031b0cc534 fix strings.last_index_any for single char 2023-12-18 11:55:45 -05:00
flysand7
2e1b2dc3ba strings: Fix up documentation of split_n 2023-12-05 23:17:19 +11:00
FourteenBrush
e0ac454ed0 Expose strings.ascii_set_* functions 2023-11-12 17:33:33 +01:00
Pix
2ab5eb7213 Strings makes added caller function 2023-08-15 12:31:06 +08:00
Pix
5ce541e9ef Intern add location to init. 2023-08-15 12:30:50 +08:00
Pix
0cf9c22033 Builder makes added caller location 2023-08-15 12:30:40 +08: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