#rune "" to ''; Remove infix and postfix call notation

This commit is contained in:
Ginger Bill
2016-11-28 20:39:43 +00:00
parent cbb70c7873
commit 598dab5bc4
19 changed files with 367 additions and 320 deletions

View File

@@ -1,5 +1,34 @@
#import "fmt.odin"
#import "utf8.odin"
main :: proc() {
fmt.println("Hellope, World!")
MAX :: 64
buf: [MAX]rune
backing: [MAX]byte
offset: int
msg := "Hello"
count := utf8.rune_count(msg)
assert(count <= MAX)
runes := buf[:count]
offset = 0
for i := 0; i < count; i++ {
s := msg[offset:]
r, len := utf8.decode_rune(s)
runes[count-i-1] = r
offset += len
}
offset = 0
for i := 0; i < count; i++ {
data, len := utf8.encode_rune(runes[i])
for j := 0; j < len; j++ {
backing[offset+j] = data[j]
}
offset += len
}
reverse := backing[:count] as string
fmt.println(reverse)
}

View File

@@ -4,7 +4,7 @@
#import "os.odin"
#import "opengl.odin" as gl
TWO_HEARTS :: #rune "💕"
TWO_HEARTS :: '💕'
win32_perf_count_freq := win32.GetQueryPerformanceFrequency()
time_now :: proc() -> f64 {