mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Merge branch 'master' into objc-intrinsics
This commit is contained in:
+11
-35
@@ -218,61 +218,37 @@ split_after_n :: proc(s, sep: []byte, n: int, allocator := context.allocator) ->
|
|||||||
|
|
||||||
|
|
||||||
@private
|
@private
|
||||||
_split_iterator :: proc(s: ^[]byte, sep: []byte, sep_save, n: int) -> (res: []byte, ok: bool) {
|
_split_iterator :: proc(s: ^[]byte, sep: []byte, sep_save: int) -> (res: []byte, ok: bool) {
|
||||||
s, n := s, n
|
if len(sep) == 0 {
|
||||||
|
|
||||||
if n == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if sep == nil {
|
|
||||||
res = s[:]
|
res = s[:]
|
||||||
ok = true
|
ok = true
|
||||||
s^ = s[len(s):]
|
s^ = s[len(s):]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if n < 0 {
|
m := index(s^, sep)
|
||||||
n = count(s^, sep) + 1
|
if m < 0 {
|
||||||
}
|
// not found
|
||||||
|
res = s[:]
|
||||||
n -= 1
|
ok = len(res) != 0
|
||||||
|
s^ = s[len(s):]
|
||||||
i := 0
|
} else {
|
||||||
for ; i < n; i += 1 {
|
|
||||||
m := index(s^, sep)
|
|
||||||
if m < 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
res = s[:m+sep_save]
|
res = s[:m+sep_save]
|
||||||
ok = true
|
ok = true
|
||||||
s^ = s[m+len(sep):]
|
s^ = s[m+len(sep):]
|
||||||
return
|
|
||||||
}
|
}
|
||||||
res = s[:]
|
|
||||||
ok = res != nil
|
|
||||||
s^ = s[len(s):]
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
split_iterator :: proc(s: ^[]byte, sep: []byte) -> ([]byte, bool) {
|
split_iterator :: proc(s: ^[]byte, sep: []byte) -> ([]byte, bool) {
|
||||||
return _split_iterator(s, sep, 0, -1)
|
return _split_iterator(s, sep, 0)
|
||||||
}
|
|
||||||
|
|
||||||
split_n_iterator :: proc(s: ^[]byte, sep: []byte, n: int) -> ([]byte, bool) {
|
|
||||||
return _split_iterator(s, sep, 0, n)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
split_after_iterator :: proc(s: ^[]byte, sep: []byte) -> ([]byte, bool) {
|
split_after_iterator :: proc(s: ^[]byte, sep: []byte) -> ([]byte, bool) {
|
||||||
return _split_iterator(s, sep, len(sep), -1)
|
return _split_iterator(s, sep, len(sep))
|
||||||
}
|
}
|
||||||
|
|
||||||
split_after_n_iterator :: proc(s: ^[]byte, sep: []byte, n: int) -> ([]byte, bool) {
|
|
||||||
return _split_iterator(s, sep, len(sep), n)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
index_byte :: proc(s: []byte, c: byte) -> int {
|
index_byte :: proc(s: []byte, c: byte) -> int {
|
||||||
for i := 0; i < len(s); i += 1 {
|
for i := 0; i < len(s); i += 1 {
|
||||||
|
|||||||
+12
-47
@@ -298,13 +298,7 @@ split_after_n :: proc(s, sep: string, n: int, allocator := context.allocator) ->
|
|||||||
|
|
||||||
|
|
||||||
@private
|
@private
|
||||||
_split_iterator :: proc(s: ^string, sep: string, sep_save, n: int) -> (res: string, ok: bool) {
|
_split_iterator :: proc(s: ^string, sep: string, sep_save: int) -> (res: string, ok: bool) {
|
||||||
s, n := s, n
|
|
||||||
|
|
||||||
if n == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if sep == "" {
|
if sep == "" {
|
||||||
res = s[:]
|
res = s[:]
|
||||||
ok = true
|
ok = true
|
||||||
@@ -312,44 +306,27 @@ _split_iterator :: proc(s: ^string, sep: string, sep_save, n: int) -> (res: stri
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if n < 0 {
|
m := index(s^, sep)
|
||||||
n = count(s^, sep) + 1
|
if m < 0 {
|
||||||
}
|
// not found
|
||||||
|
res = s[:]
|
||||||
n -= 1
|
ok = res != ""
|
||||||
|
s^ = s[len(s):]
|
||||||
i := 0
|
} else {
|
||||||
for ; i < n; i += 1 {
|
|
||||||
m := index(s^, sep)
|
|
||||||
if m < 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
res = s[:m+sep_save]
|
res = s[:m+sep_save]
|
||||||
ok = true
|
ok = true
|
||||||
s^ = s[m+len(sep):]
|
s^ = s[m+len(sep):]
|
||||||
return
|
|
||||||
}
|
}
|
||||||
res = s[:]
|
|
||||||
ok = res != ""
|
|
||||||
s^ = s[len(s):]
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
split_iterator :: proc(s: ^string, sep: string) -> (string, bool) {
|
split_iterator :: proc(s: ^string, sep: string) -> (string, bool) {
|
||||||
return _split_iterator(s, sep, 0, -1)
|
return _split_iterator(s, sep, 0)
|
||||||
}
|
|
||||||
|
|
||||||
split_n_iterator :: proc(s: ^string, sep: string, n: int) -> (string, bool) {
|
|
||||||
return _split_iterator(s, sep, 0, n)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
split_after_iterator :: proc(s: ^string, sep: string) -> (string, bool) {
|
split_after_iterator :: proc(s: ^string, sep: string) -> (string, bool) {
|
||||||
return _split_iterator(s, sep, len(sep), -1)
|
return _split_iterator(s, sep, len(sep))
|
||||||
}
|
|
||||||
|
|
||||||
split_after_n_iterator :: proc(s: ^string, sep: string, n: int) -> (string, bool) {
|
|
||||||
return _split_iterator(s, sep, len(sep), n)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -402,25 +379,13 @@ split_lines_after_n :: proc(s: string, n: int, allocator := context.allocator) -
|
|||||||
|
|
||||||
split_lines_iterator :: proc(s: ^string) -> (line: string, ok: bool) {
|
split_lines_iterator :: proc(s: ^string) -> (line: string, ok: bool) {
|
||||||
sep :: "\n"
|
sep :: "\n"
|
||||||
line = _split_iterator(s, sep, 0, -1) or_return
|
line = _split_iterator(s, sep, 0) or_return
|
||||||
return _trim_cr(line), true
|
|
||||||
}
|
|
||||||
|
|
||||||
split_lines_n_iterator :: proc(s: ^string, n: int) -> (line: string, ok: bool) {
|
|
||||||
sep :: "\n"
|
|
||||||
line = _split_iterator(s, sep, 0, n) or_return
|
|
||||||
return _trim_cr(line), true
|
return _trim_cr(line), true
|
||||||
}
|
}
|
||||||
|
|
||||||
split_lines_after_iterator :: proc(s: ^string) -> (line: string, ok: bool) {
|
split_lines_after_iterator :: proc(s: ^string) -> (line: string, ok: bool) {
|
||||||
sep :: "\n"
|
sep :: "\n"
|
||||||
line = _split_iterator(s, sep, len(sep), -1) or_return
|
line = _split_iterator(s, sep, len(sep)) or_return
|
||||||
return _trim_cr(line), true
|
|
||||||
}
|
|
||||||
|
|
||||||
split_lines_after_n_iterator :: proc(s: ^string, n: int) -> (line: string, ok: bool) {
|
|
||||||
sep :: "\n"
|
|
||||||
line = _split_iterator(s, sep, len(sep), n) or_return
|
|
||||||
return _trim_cr(line), true
|
return _trim_cr(line), true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -485,7 +485,7 @@ i32 linker_stage(lbGenerator *gen) {
|
|||||||
// NOTE: If you change this (although this minimum is as low as you can go with Odin working)
|
// NOTE: If you change this (although this minimum is as low as you can go with Odin working)
|
||||||
// make sure to also change the 'mtriple' param passed to 'opt'
|
// make sure to also change the 'mtriple' param passed to 'opt'
|
||||||
#if defined(GB_CPU_ARM)
|
#if defined(GB_CPU_ARM)
|
||||||
" -mmacosx-version-min=11.0.0 "
|
" -mmacosx-version-min=12.0.0 "
|
||||||
#else
|
#else
|
||||||
" -mmacosx-version-min=10.8.0 "
|
" -mmacosx-version-min=10.8.0 "
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
+1
-1
@@ -14,7 +14,7 @@ bool :: SDL.bool
|
|||||||
|
|
||||||
MAJOR_VERSION :: 2
|
MAJOR_VERSION :: 2
|
||||||
MINOR_VERSION :: 0
|
MINOR_VERSION :: 0
|
||||||
PATCHLEVEL :: 15
|
PATCHLEVEL :: 18
|
||||||
|
|
||||||
UNICODE_BOM_NATIVE :: 0xFEFF
|
UNICODE_BOM_NATIVE :: 0xFEFF
|
||||||
UNICODE_BOM_SWAPPED :: 0xFFFE
|
UNICODE_BOM_SWAPPED :: 0xFFFE
|
||||||
|
|||||||
Reference in New Issue
Block a user