aboutsummaryrefslogtreecommitdiff
path: root/examples/coroutines
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-31 18:03:05 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-31 18:03:05 -0400
commita0ac652cd1eebdc42425b34f1685f8cb20cb4eea (patch)
treeb41c99f8f0fa62eb03d1f5df44d2c501cd5f2976 /examples/coroutines
parenta571ccffd795a595e990a3405dcf977aafc33c6c (diff)
Simplify quotes by limiting to `,',"
Diffstat (limited to 'examples/coroutines')
-rw-r--r--examples/coroutines/coroutines.tm20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/coroutines/coroutines.tm b/examples/coroutines/coroutines.tm
index b530a685..c4ef1a97 100644
--- a/examples/coroutines/coroutines.tm
+++ b/examples/coroutines/coroutines.tm
@@ -37,31 +37,31 @@ struct Coroutine(co:@aco_t)
main_co := _main_co
shared_stack := _shared_stack
- aco_ptr := C_code:@aco_t(
+ aco_ptr := C_code:@aco_t `
aco_create(@main_co, @shared_stack, 0, (void*)@fn.fn, @fn.userdata)
- )
+ `
return Coroutine(aco_ptr)
func is_finished(co:Coroutine->Bool; inline)
- return C_code:Bool(((aco_t*)@co.co)->is_finished)
+ return C_code:Bool`((aco_t*)@co.co)->is_finished`
func resume(co:Coroutine->Bool)
if co.is_finished()
return no
- C_code { aco_resume(@co.co); }
+ C_code `aco_resume(@co.co);`
return yes
func _init()
- C_code {
+ C_code `
aco_set_allocator(GC_malloc, NULL);
aco_thread_init(aco_exit_fn);
- }
- _main_co = C_code:@aco_t(aco_create(NULL, NULL, 0, NULL, NULL))
+ `
+ _main_co = C_code:@aco_t`aco_create(NULL, NULL, 0, NULL, NULL)`
- _shared_stack = C_code:@aco_shared_stack_t(aco_shared_stack_new(0))
+ _shared_stack = C_code:@aco_shared_stack_t`aco_shared_stack_new(0)`
func yield(; inline)
- C_code {
+ C_code `
aco_yield();
- }
+ `