aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-11-29 23:57:06 +0000
committerGinger Bill <bill@gingerbill.org>2016-11-29 23:57:06 +0000
commitd9c686b53d63023c432293fa906d96224cc36a23 (patch)
treeb454abb47a57cb320ebb343a955c813389339693 /code
parentb232b9d5ea23fdd4d53f8e93cdfeb1f962811331 (diff)
`when` statement; Better entity collection system (for both local and global); Better parsing for record declarations
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin29
1 files changed, 9 insertions, 20 deletions
diff --git a/code/demo.odin b/code/demo.odin
index 303c3b448..455dadb46 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -1,29 +1,18 @@
-// #import "fmt.odin"
+#import "fmt.odin"
#import "utf8.odin"
-when ODIN_OS == "window" {
- when ODIN_OS != "window" {
- } else {
- MAX :: 64
- }
- #import "fmt.odin"
-} else {
-
-}
-
-
main :: proc() {
- when true {
- OffsetType :: type int
- }
- // MAX :: 64
buf: [MAX]rune
backing: [MAX]byte
- offset: OffsetType
+ offset: int
+
+ when MAX > 0 {
+ msg := "Hello"
+ }
+ MAX :: 64
- msg := "Hello"
count := utf8.rune_count(msg)
assert(count <= MAX)
runes := buf[:count]
@@ -33,14 +22,14 @@ main :: proc() {
s := msg[offset:]
r, len := utf8.decode_rune(s)
runes[count-i-1] = r
- offset += len as OffsetType
+ offset += len
}
offset = 0
for i := 0; i < count; i++ {
data, len := utf8.encode_rune(runes[i])
copy(backing[offset:], data[:len])
- offset += len as OffsetType
+ offset += len
}
reverse := backing[:offset] as string