aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-01-05 22:32:19 +0000
committerGinger Bill <bill@gingerbill.org>2017-01-05 22:32:19 +0000
commit207b252f2393735376d9e4b6ddc992808923bff8 (patch)
tree609c36b8d28f8c0691e87c9c648a9458b2b9619a /code
parent1356dfeec28a143b53dc23d8f8440ac419832816 (diff)
Fix checking termination of a procedure
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin69
1 files changed, 67 insertions, 2 deletions
diff --git a/code/demo.odin b/code/demo.odin
index 25ca072cb..4beb0b2a4 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -1,5 +1,70 @@
+#foreign_system_library "winmm" when ODIN_OS == "windows";
+#import win32 "sys/windows.odin" when ODIN_OS == "windows";
#import "fmt.odin";
-main :: proc() {
- fmt.println("Hellope!");
+timeGetTime :: proc() -> u32 #foreign #dll_import
+GetSystemTimeAsFileTime :: proc(SystemTimeAsFileTime : ^win32.FILETIME) #foreign #dll_import
+
+GetCommandLineArguments :: proc() -> []string {
+ argString := win32.GetCommandLineA();
+ fullArgString := to_odin_string(argString);
+ // Count Spaces
+ for r : fullArgString {
+ fmt.println(r);
+ }
+}
+
+to_odin_string :: proc(c: ^byte) -> string {
+ s: string;
+ s.data = c;
+ while (c + s.count)^ != 0 {
+ s.count += 1;
+ }
+ return s;
+}
+//("Hellope!\x00" as string).data
+
+MAGIC_VALUE :: 0xCA5E713F;
+
+timing_file_header :: struct #ordered {
+ MagicValue : u32;
+}
+
+timing_file_date :: struct #ordered {
+ E : [2]u32;
+}
+
+timing_file_entry_flag :: enum {
+ Complete = 0x1,
+ NoErrors = 0x2,
+}
+
+timing_file_entry :: struct #ordered {
+ StarDate : timing_file_date;
+ Flags : u32;
+ MillisecondsElapsed : u32;
+}
+
+timing_entry_array :: struct #ordered {
+ Entries : []timing_file_entry;
+}
+
+GetClock :: proc () -> u32 {
+ return timeGetTime();
+}
+
+GetDate :: proc() -> timing_file_date {
+ Result : timing_file_date;
+ FileTime : win32.FILETIME;
+ GetSystemTimeAsFileTime(^FileTime);
+
+ Result.E[0] = FileTime.lo;
+ Result.E[1] = FileTime.hi;
+
+ return Result;
+}
+
+main :: proc () {
+ EntryClock := GetClock();
+ GetCommandLineArguments();
}