feat: odin setup

This commit is contained in:
2026-12-04 00:45:26 +01:00
parent a1d6905648
commit e2f8b4e9c3
3 changed files with 36 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
**/part[12]

6
ols.json Normal file
View File

@@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/DanielGavin/ols/master/misc/ols.schema.json",
"enable_document_symbols": true,
"enable_hover": true,
"enable_snippets": true
}

29
utils/utils.odin Normal file
View File

@@ -0,0 +1,29 @@
package utils
import "core:bufio"
import "core:fmt"
import "core:os"
import "core:strings"
read_input_lines :: proc(allocator := context.allocator) -> []string {
lines := make([dynamic]string, allocator)
scanner: bufio.Scanner
bufio.scanner_init(&scanner, os.to_stream(os.stdin))
defer bufio.scanner_destroy(&scanner)
for bufio.scanner_scan(&scanner) {
line := strings.clone(bufio.scanner_text(&scanner), allocator)
append(&lines, line)
}
if err := bufio.scanner_error(&scanner); err != nil {
fmt.eprintfln("ERROR: Scanning input: %v", err)
}
for len(lines) > 0 && len(lines[len(lines) - 1]) == 0 {
pop(&lines)
}
return lines[:]
}