return ~~output_time;
}
-sleep :: (milliseconds: u32) {
- tagged: SubscriptionTagged;
- tagged.tag = .Clock;
- tagged.clock = .{
- id = .Realtime,
- timeout = cast(u64) milliseconds * 1000000,
- precision = 1000,
- flags = .ClockAbsTime,
- };
-
- subscription := Subscription.{
- userdata = 0,
- u = tagged,
- };
-
- event: Event;
- number_of_events: u32;
-
- error_code := poll_oneoff(^subscription, ^event, 1, ^number_of_events);
+sleep :: proc {
+ (seconds: u64) { sleep(nanoseconds=seconds * 1000000000); },
+ (milliseconds: u64) { sleep(nanoseconds=milliseconds * 1000000); },
+
+ (nanoseconds: u64) {
+ tagged: SubscriptionTagged;
+ tagged.tag = .Clock;
+ tagged.clock = .{
+ id = .Realtime,
+ timeout = cast(u64) nanoseconds,
+ precision = 1,
+ flags = ~~0,
+ };
+
+ subscription := Subscription.{
+ userdata = 0,
+ u = tagged,
+ };
+
+ event: Event;
+ number_of_events: u32;
+
+ error_code := poll_oneoff(^subscription, ^event, 1, ^number_of_events);
+ }
}
\ No newline at end of file
static AstFunction* parse_function_definition(OnyxParser* parser, OnyxToken* token);
static AstTyped* parse_global_declaration(OnyxParser* parser);
static AstEnumType* parse_enum_declaration(OnyxParser* parser);
+static AstStaticIf* parse_static_if_stmt(OnyxParser* parser);
static AstTyped* parse_top_level_expression(OnyxParser* parser);
static AstBinding* parse_top_level_binding(OnyxParser* parser, OnyxToken* symbol);
static void parse_top_level_statement(OnyxParser* parser);
retval = (AstNode *) context_tmp;
break;
}
+
+ /*
+ This is in theory where the static if in procedures will be parsed. However,
+ this breaks many things because static if statements currently only parse top
+ level expressions in them, not general statements.
+
+ if (next_tokens_are(parser, 2, '#', Token_Type_Keyword_If)) {
+ AstStaticIf* static_if = parse_static_if_stmt(parser);
+ ENTITY_SUBMIT(static_if);
+
+ needs_semicolon = 0;
+ retval = (AstNode *) static_if;
+ break;
+ }
+ */
}
default: