aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-11 13:18:30 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-11 13:18:30 -0400
commit294b712e6dabc722772f86aaa9d0faaa08c14717 (patch)
treef24ab45434d5bf2d5ebd64b0d533d4d361e9daff /examples
parentd254b440f8359b42a097edfeb2db1585fd20c695 (diff)
Don't use '$' prefix for field names
Diffstat (limited to 'examples')
-rw-r--r--examples/game/color.tm10
-rw-r--r--examples/threads/threads.tm16
2 files changed, 13 insertions, 13 deletions
diff --git a/examples/game/color.tm b/examples/game/color.tm
index f8702570..fef12e60 100644
--- a/examples/game/color.tm
+++ b/examples/game/color.tm
@@ -12,12 +12,12 @@ struct Color(r,g,b:Num,a=1.0):
func draw_rectangle(c:Color, pos:Vec2, size:Vec2):
inline C {
DrawRectangle(
- (int)(_$pos.$x), (int)(_$pos.$y), (int)(_$size.$x), (int)(_$size.$y),
+ (int)(_$pos.x), (int)(_$pos.y), (int)(_$size.x), (int)(_$size.y),
((Color){
- (int8_t)(uint8_t)(255.*_$c.$r),
- (int8_t)(uint8_t)(255.*_$c.$g),
- (int8_t)(uint8_t)(255.*_$c.$b),
- (int8_t)(uint8_t)(255.*_$c.$a),
+ (int8_t)(uint8_t)(255.*_$c.r),
+ (int8_t)(uint8_t)(255.*_$c.g),
+ (int8_t)(uint8_t)(255.*_$c.b),
+ (int8_t)(uint8_t)(255.*_$c.a),
})
);
}
diff --git a/examples/threads/threads.tm b/examples/threads/threads.tm
index 99bb83b4..5949a5cc 100644
--- a/examples/threads/threads.tm
+++ b/examples/threads/threads.tm
@@ -13,11 +13,11 @@ struct Mutex(_mutex:@Memory):
func do_locked(m:Mutex, fn:func(); inline):
inline C {
- pthread_mutex_lock((pthread_mutex_t*)_$m.$_mutex);
+ pthread_mutex_lock((pthread_mutex_t*)_$m._mutex);
}
fn()
inline C {
- pthread_mutex_unlock((pthread_mutex_t*)_$m.$_mutex);
+ pthread_mutex_unlock((pthread_mutex_t*)_$m._mutex);
}
struct ThreadCondition(_cond:@Memory):
@@ -33,17 +33,17 @@ struct ThreadCondition(_cond:@Memory):
func wait(c:ThreadCondition, m:Mutex; inline):
inline C {
- pthread_cond_wait((pthread_cond_t*)_$c.$_cond, (pthread_mutex_t*)_$m.$_mutex);
+ pthread_cond_wait((pthread_cond_t*)_$c._cond, (pthread_mutex_t*)_$m._mutex);
}
func signal(c:ThreadCondition; inline):
inline C {
- pthread_cond_signal((pthread_cond_t*)_$c.$_cond);
+ pthread_cond_signal((pthread_cond_t*)_$c._cond);
}
func broadcast(c:ThreadCondition; inline):
inline C {
- pthread_cond_broadcast((pthread_cond_t*)_$c.$_cond);
+ pthread_cond_broadcast((pthread_cond_t*)_$c._cond);
}
struct Guard(mutex=Mutex.new(), cond=ThreadCondition.new()):
@@ -66,17 +66,17 @@ struct PThread(_thread:@Memory):
func join(t:PThread):
inline C {
- pthread_join(*(pthread_t*)_$t.$_thread, NULL);
+ pthread_join(*(pthread_t*)_$t._thread, NULL);
}
func cancel(t:PThread):
inline C {
- pthread_cancel(*(pthread_t*)_$t.$_thread);
+ pthread_cancel(*(pthread_t*)_$t._thread);
}
func detatch(t:PThread):
inline C {
- pthread_detach(*(pthread_t*)_$t.$_thread);
+ pthread_detach(*(pthread_t*)_$t._thread);
}
func main():