refactor(lang): rename builtins flr->floor and fx->fixed
De-abbreviate the two bare fixed-point conversion builtins:
flr(f) -> int -> floor(f) -> int (fixed -> int, flooring)
fx(i) -> fixed -> fixed(i) -> fixed (int -> fixed; mirrors how the
stringify builtin is `string`)
Updates the compiler dispatch, all call sites, the grammars/LSP/JetBrains
tokens, and the docs (fn-flr -> fn-floor, fn-fx -> fn-fixed). Reseeded;
C-free fixpoint holds; all suites green (45/24/29); site + check.py OK.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
effb3f637f
commit
2e0047514b
19 changed files with 80 additions and 80 deletions
|
|
@ -35,8 +35,8 @@
|
|||
"fn-max",
|
||||
"fn-abs",
|
||||
"fn-clamp",
|
||||
"fn-fx",
|
||||
"fn-flr",
|
||||
"fn-fixed",
|
||||
"fn-floor",
|
||||
"fn-bytes",
|
||||
"fn-words",
|
||||
"fn-ui_build",
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ object LudicVocabulary {
|
|||
val WIDGETS = setOf("panel", "col", "row", "label", "button", "image", "spacer")
|
||||
|
||||
val BUILTINS = setOf(
|
||||
"min", "max", "abs", "clamp", "seed", "rng_range", "rng_chance", "fx", "flr",
|
||||
"min", "max", "abs", "clamp", "seed", "rng_range", "rng_chance", "fixed", "floor",
|
||||
"map_size", "map_row", "tile", "clear", "present", "fill_rect", "frame_rect",
|
||||
"put_px", "text", "text_int", "font_load", "text_ttf", "text_w", "text_h",
|
||||
"image_load", "draw_image", "draw_image_scaled", "draw_9slice", "png_load",
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@
|
|||
{
|
||||
"comment": "the runtime surface — every name here resolves to rt_<name> in runtime/native",
|
||||
"name": "support.function.builtin.ludic",
|
||||
"match": "\\b(min|max|abs|clamp|seed|rng_range|rng_chance|fx|flr|map_size|map_row|tile|clear|present|fill_rect|frame_rect|put_px|text|text_int|font_load|text_ttf|text_w|text_h|image_load|draw_image|draw_image_scaled|draw_9slice|png_load|sprites_load|draw_sprite|draw_sprite_scaled|ui_build|ui_open|ui_tick|ui_render|ui_clicked|ui_set_text|ui_set_int|ui_focus|ui_focused|ui_visible|key|reg|set_reg|self|save|load|status|print|string|quit)\\b(?=\\s*\\()"
|
||||
"match": "\\b(min|max|abs|clamp|seed|rng_range|rng_chance|fixed|floor|map_size|map_row|tile|clear|present|fill_rect|frame_rect|put_px|text|text_int|font_load|text_ttf|text_w|text_h|image_load|draw_image|draw_image_scaled|draw_9slice|png_load|sprites_load|draw_sprite|draw_sprite_scaled|ui_build|ui_open|ui_tick|ui_render|ui_clicked|ui_set_text|ui_set_int|ui_focus|ui_focused|ui_visible|key|reg|set_reg|self|save|load|status|print|string|quit)\\b(?=\\s*\\()"
|
||||
},
|
||||
{
|
||||
"comment": "compiler intrinsics — these lower straight to libc or the OS",
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@
|
|||
{
|
||||
"comment": "the runtime surface — every name here resolves to rt_<name> in runtime/native",
|
||||
"name": "support.function.builtin.ludic",
|
||||
"match": "\\b(min|max|abs|clamp|seed|rng_range|rng_chance|fx|flr|map_size|map_row|tile|clear|present|fill_rect|frame_rect|put_px|text|text_int|font_load|text_ttf|text_w|text_h|image_load|draw_image|draw_image_scaled|draw_9slice|png_load|sprites_load|draw_sprite|draw_sprite_scaled|ui_build|ui_open|ui_tick|ui_render|ui_clicked|ui_set_text|ui_set_int|ui_focus|ui_focused|ui_visible|key|reg|set_reg|self|save|load|status|print|string|quit)\\b(?=\\s*\\()"
|
||||
"match": "\\b(min|max|abs|clamp|seed|rng_range|rng_chance|fixed|floor|map_size|map_row|tile|clear|present|fill_rect|frame_rect|put_px|text|text_int|font_load|text_ttf|text_w|text_h|image_load|draw_image|draw_image_scaled|draw_9slice|png_load|sprites_load|draw_sprite|draw_sprite_scaled|ui_build|ui_open|ui_tick|ui_render|ui_clicked|ui_set_text|ui_set_int|ui_focus|ui_focused|ui_visible|key|reg|set_reg|self|save|load|status|print|string|quit)\\b(?=\\s*\\()"
|
||||
},
|
||||
{
|
||||
"comment": "compiler intrinsics — these lower straight to libc or the OS",
|
||||
|
|
|
|||
|
|
@ -1404,8 +1404,8 @@ program LudicLsp {
|
|||
badd("seed", "seed(i: int)")
|
||||
badd("rng_range", "rng_range(lo: int, hi: int) -> int")
|
||||
badd("rng_chance", "rng_chance(pct: int) -> bool")
|
||||
badd("fx", "fx(i: int) -> fixed")
|
||||
badd("flr", "flr(f: fixed) -> int")
|
||||
badd("fx", "fixed(i: int) -> fixed")
|
||||
badd("flr", "floor(f: fixed) -> int")
|
||||
badd("map_size", "map_size(w: int, h: int)")
|
||||
badd("map_row", "map_row(y: int, row: string)")
|
||||
badd("tile", "tile(x: int, y: int) -> int")
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ static const LBuiltin LUDIC_BUILTINS[] = {
|
|||
{"seed","seed(i: int)","Seed the deterministic RNG."},
|
||||
{"rng_range","rng_range(lo: int, hi: int) -> int","Deterministic integer in [lo, hi]."},
|
||||
{"rng_chance","rng_chance(pct: int) -> bool","True pct% of the time, deterministically."},
|
||||
{"fx","fx(i: int) -> fixed","Widen an int to Q16.16 fixed-point."},
|
||||
{"flr","flr(f: fixed) -> int","Truncate a fixed-point value toward zero."},
|
||||
{"fixed","fixed(i: int) -> fixed","Widen an int to Q16.16 fixed-point."},
|
||||
{"floor","floor(f: fixed) -> int","Truncate a fixed-point value toward zero."},
|
||||
{"map_size","map_size(w: int, h: int)","Set the tilemap dimensions."},
|
||||
{"map_row","map_row(y: int, row: string)","Fill one tilemap row from a string."},
|
||||
{"tile","tile(x: int, y: int) -> int","Tile code at a map cell."},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue