Convert ODIN_OS and ODIN_ARCH to use enums rather than use strings

This commit is contained in:
gingerBill
2022-01-20 19:56:05 +00:00
parent cfbc1a447b
commit 3d7d347192
101 changed files with 341 additions and 310 deletions
+5 -5
View File
@@ -89,7 +89,7 @@ scan_chunk :: proc(pattern: string) -> (star: bool, chunk, rest: string) {
scan_loop: for i = 0; i < len(pattern); i += 1 {
switch pattern[i] {
case '\\':
when ODIN_OS != "windows" {
when ODIN_OS != .Windows {
if i+1 < len(pattern) {
i += 1
}
@@ -161,7 +161,7 @@ match_chunk :: proc(chunk, s: string) -> (rest: string, ok: bool, err: Match_Err
chunk = chunk[1:]
case '\\':
when ODIN_OS != "windows" {
when ODIN_OS != .Windows {
chunk = chunk[1:]
if len(chunk) == 0 {
err = .Syntax_Error
@@ -188,7 +188,7 @@ get_escape :: proc(chunk: string) -> (r: rune, next_chunk: string, err: Match_Er
return
}
chunk := chunk
if chunk[0] == '\\' && ODIN_OS != "windows" {
if chunk[0] == '\\' && ODIN_OS != .Windows {
chunk = chunk[1:]
if len(chunk) == 0 {
err = .Syntax_Error
@@ -231,7 +231,7 @@ glob :: proc(pattern: string, allocator := context.allocator) -> (matches: []str
dir, file := split(pattern)
volume_len := 0
when ODIN_OS == "windows" {
when ODIN_OS == .Windows {
volume_len, dir = clean_glob_path_windows(dir, temp_buf[:])
} else {
dir = clean_glob_path(dir)
@@ -308,7 +308,7 @@ _glob :: proc(dir, pattern: string, matches: ^[dynamic]string) -> (m: [dynamic]s
@(private)
has_meta :: proc(path: string) -> bool {
when ODIN_OS == "windows" {
when ODIN_OS == .Windows {
CHARS :: `*?[`
} else {
CHARS :: `*?[\`