Jeroen van Rijn
5422a3b17e
Merge pull request #1743 from Tetralux/filepath-stems
...
[path/filepath] Add file stem and long-extension procedures
2022-04-23 22:33:31 +02:00
Tetralux
b44b6e7e50
[path/filepath] Add file stem and long-extension procedures
...
Adds stem(), short_stem(), and long_ext(); also adds doc-comments to base() and ext().
The 'stem' is usually 'the name' of the file; the basename without the file extension.
To this end, this adds stem(), which is such that:
stem(path) + ext(path) = base(path)
However, 'file extension' has two different meanings to what constitutes it!
> What is the extension of: 'name.tar.gz' ?
Colloquially, you would likely think of it as 'a tarball' - which you might think is '.tar.gz'.
But, if you're writing code to process a file of this type, you would first treat it
as a Gzip file, and then treat the result as a TAR file - i.e: '.gz' ... _followed by_ '.tar'.
ext() returns '.gz' here, since that is the most-immediate format that you would need to use
to decode it; it would be a Gzip stream.
Sometimes though, you do actually want to consider these longer file extensions.
Perhaps you're extracting a tarball, and what to know what to call the intermediate tar file;
perhaps you want to check to see if this file is a tarball, or just a Gzip file;
or maybe you just want 'the name' of the file, and not this "strange 'name-and-part-of-the-extension' thing".
So, this also adds short_stem() and long_ext(), such that:
short_stem(path) + long_ext(path) = base(path)
Thus, we can use either, but the most immediately-useful one is the easiest to reach for:
stem('name.tar.gz') -> 'name.tar'
ext('name.tar.gz') -> '.gz'
short_stem('name.tar.gz') -> 'name'
long_ext('name.tar.gz') -> '.tar.gz'
These procedures are identical to their counterparts when the path only has a simple extension:
stem('name.txt') -> 'name'
ext('name.txt') -> '.txt'
short_stem('name.txt') -> 'name'
long_ext('name.txt') -> '.txt'
2022-04-23 20:25:59 +00:00
Jeroen van Rijn
849efff070
Merge pull request #1741 from Kelimion/shoco
...
Add Shoco short string compression.
2022-04-22 18:06:31 +02:00
Jeroen van Rijn
b022167df1
Remove unused fmt.
2022-04-22 17:56:34 +02:00
Jeroen van Rijn
ac9a358c65
[shoco] Replace 2D slices in model with 1D slices.
2022-04-22 17:52:38 +02:00
Jeroen van Rijn
e799476f90
[compress/shoco] Add short string compressor.
2022-04-22 16:55:47 +02:00
Jeroen van Rijn
b4f8efcbe6
Merge pull request #1739 from ftphikari/master
...
strings: add levenshtein_distance procedure
2022-04-21 20:31:11 +02:00
hikari
f026753692
strings: levenshtein_distance: remove do
2022-04-21 21:19:43 +03:00
hikari
71b1cce517
strings: levenshtein_distance: 64 is actually faster than 256
2022-04-21 21:19:11 +03:00
hikari
d8f0da164b
strings: levenshtein_distance: improve potential caching
2022-04-21 21:15:11 +03:00
hikari
591732f347
strings: levenshtein_distance: remove costs calculation for default array
2022-04-21 20:58:50 +03:00
hikari
eee97f7f62
strings: add levenshtein_distance procedure
2022-04-21 20:49:32 +03:00
Jeroen van Rijn
3dd9da1b66
Merge pull request #1733 from ftphikari/master
...
sys/windows: add some procedures
2022-04-19 20:41:32 +02:00
Jeroen van Rijn
e8c0be23f2
Merge pull request #1737 from Kelimion/fix_json_unmarshal
...
[json/unmarshal] Fix quoted strings.
2022-04-19 20:40:40 +02:00
Jeroen van Rijn
a30b9b17b3
[json/unmarshal] Fix quoted strings.
2022-04-19 20:32:22 +02:00
Jeroen van Rijn
29b2c04766
Revert "Fix unmarshal for escaped strings."
...
This reverts commit 581255bf23 .
2022-04-19 20:11:02 +02:00
Jeroen van Rijn
d869ba7bcd
Merge pull request #1736 from Kelimion/fix_json_unmarshal
...
Fix unmarshal for escaped strings.
2022-04-19 20:05:04 +02:00
Jeroen van Rijn
581255bf23
Fix unmarshal for escaped strings.
2022-04-19 20:04:38 +02:00
Jeroen van Rijn
b51358a01c
Merge pull request #1734 from hanabi1224/lru-alloc-fix
...
[core:container/lru] Avoid unnecessary allocations
2022-04-19 15:04:49 +02:00
Jeroen van Rijn
323e7a2d02
Add JSON unmarshal test.
2022-04-19 15:03:09 +02:00
Jeroen van Rijn
7654afc2db
Revert "Update mem.nil_allocator to match the same in runtime"
...
The change broke JSON unmarshaling.
This reverts commit 4484a3433d .
2022-04-19 15:01:54 +02:00
hanabi1224
ded8342f3f
Reduce allocations
2022-04-19 20:46:33 +08:00
ftphikari
240fb9b953
Merge branch 'odin-lang:master' into master
2022-04-19 06:00:30 +03:00
hikari
4997a43763
Merge remote-tracking branch 'origin/master'
2022-04-19 05:59:42 +03:00
hikari
aa4eb35671
sys/windows: add some procedures
2022-04-19 05:58:22 +03:00
Jeroen van Rijn
d99ba9c073
Merge pull request #1731 from Kelimion/targa
...
[image/tga] Writer for RGB(A) 8-bit images.
2022-04-18 23:36:45 +02:00
Jeroen van Rijn
fdd24f787f
[image/tga] Writer for RGB(A) 8-bit images.
2022-04-18 23:28:34 +02:00
WalterPlinge
b6abd691f4
Image: Fix implicit enum error
2022-04-18 20:42:50 +01:00
WalterPlinge
8d370fabdd
Added initial Netpbm image format support
2022-04-18 20:29:37 +01:00
Jeroen van Rijn
df4a0c62ad
Delete accidentally added test artefact.
2022-04-18 19:10:53 +02:00
Jeroen van Rijn
e3e3309a9b
Merge pull request #1728 from Tetralux/more-slice-helpers
...
Duplicate some basic slice procedures from core:mem into core:slice
2022-04-18 19:05:20 +02:00
Tetralux
7428e52264
Duplicate some basic slice procedures from core:mem into core:slice
2022-04-18 16:56:45 +00:00
Jeroen van Rijn
20b70c3b7b
Merge pull request #1727 from hanabi1224/fix-lru
...
Fix bugs in core:container/lru
2022-04-18 13:39:23 +02:00
hanabi1224
4247ba67ed
Fix bugs in core:container/lru
2022-04-18 15:24:54 +08:00
Jeroen van Rijn
e738e93da0
Merge pull request #1723 from ftphikari/master
...
sys/windows: add timeEndPeriod
2022-04-17 18:27:07 +02:00
hikari
b78f3a8069
sys/windows: add timeEndPeriod
2022-04-17 19:17:38 +03:00
Jeroen van Rijn
939973acd7
[QOI] Add to examples/all.
2022-04-17 12:35:34 +02:00
gingerBill
ed4cb72b19
Merge pull request #1696 from Despacito696969/master
...
Fix for `slice_to_components` compilation error
2022-04-16 21:56:13 +01:00
Jeroen van Rijn
70cbffd58b
Merge pull request #1722 from Kelimion/varint_streamed
...
[LEB128] Add byte-at-a-time ILEB decoder.
2022-04-16 18:19:38 +02:00
Jeroen van Rijn
6d0ba8d189
[LEB128] Add byte-at-a-time ILEB decoder.
2022-04-16 18:14:01 +02:00
Jeroen van Rijn
b6f3fa6ee1
Merge pull request #1719 from ftphikari/precise_sleep
...
time: add accurate sleep procedure
2022-04-16 16:52:46 +02:00
Jeroen van Rijn
91037766d2
Update time.odin
...
Add caveats.
2022-04-16 16:48:08 +02:00
hikari
8bf73950fa
time: remove unnecessary yield
2022-04-16 14:36:48 +03:00
hikari
4f4793817c
time: fix unix build
2022-04-16 14:35:49 +03:00
hikari
0a0440a6e8
time: yield accurate_sleep instead of relaxing the cpu
2022-04-16 14:08:37 +03:00
hikari
b9dc81d808
runtime: update comment description
2022-04-16 13:46:36 +03:00
Jeroen van Rijn
8e7ddccf00
Merge pull request #1717 from ftphikari/master
...
sys/windows: add procedures and types
2022-04-16 12:38:39 +02:00
Jeroen van Rijn
a5773f1657
Merge pull request #1718 from Kelimion/varint_streamed
...
Add uleb128 byte-at-a-time decoder.
2022-04-16 02:20:07 +02:00
Jeroen van Rijn
44316401c9
Add uleb128 byte-at-a-time decoder.
2022-04-16 02:07:57 +02:00
hikari
b05fbaacda
time: add accurate sleep procedure
2022-04-16 00:32:17 +03:00