refactor(lang): rename the str type (and stringify builtin) to string
Expand the abbreviated string type and its conversion builtin to the full
word everywhere:
str -> string (the immutable-string type)
str(x) -> str -> string(x) -> string (the stringify builtin;
what `{…}` interpolation calls)
Types are recognized by identifier, and llty maps both spellings to LLVM
`ptr`, so this is an atomic source rewrite: type annotations, the Ludic
type tags, the builtin name/dispatch, and the interpolation desugar, plus
the grammars, LSP, docs (type-str -> type-string, fn-str -> fn-string), and
inventory. int/bool stay (universally accepted, like Math).
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
4c48077d68
commit
b7745a4600
70 changed files with 207 additions and 207 deletions
|
|
@ -29,7 +29,7 @@ var rt_alive: int = 1 # platform still running?
|
|||
|
||||
# 5x7 glyphs for ASCII 32..90, 7 rows per glyph, each row a 5-bit mask stored
|
||||
# biased by '0' so the whole font is one printable string literal.
|
||||
function rt_font() -> str {
|
||||
function rt_font() -> string {
|
||||
return "00000004444404000000000000000000000IJ4:FC000000000000000000000000000000E>O>E0044O4400000448000O000000004012448@@>ACEIA>4<4444>>A168@ON11>11N26:BO22O@N11A>>@@NAA>O124888>AA>AA>>AA?11>04004000000000024842000O0O000842480>A164040000000>AAOAAANAANAAN>A@@@A>LBAAABLO@@L@@OO@@L@@@>A@GAA>AAAOAAA>44444>7222BB<ABDHDBA@@@@@@OAKEEAAAAIEECAA>AAAAA>NAAN@@@>AAAEB=NAANDBA>A@>1A>O444444AAAAAA>AAAAA:4AAAEEKAAA:4:AAAA:4444O1248@O"
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ function rt_glyph(x: int, y: int, ch: int, colour: int, sc: int) -> void {
|
|||
}
|
||||
}
|
||||
|
||||
function rt_text(x: int, y: int, s: str, colour: int, sc: int) -> void {
|
||||
function rt_text(x: int, y: int, s: string, colour: int, sc: int) -> void {
|
||||
var i = 0
|
||||
var cx = x
|
||||
var ch = s[0]
|
||||
|
|
@ -329,7 +329,7 @@ function rt_running() -> bool {
|
|||
}
|
||||
|
||||
# ---- writing the frame out ------------------------------------------------
|
||||
function rt_put_str(buf: ptr, at: int, s: str) -> int {
|
||||
function rt_put_str(buf: ptr, at: int, s: string) -> int {
|
||||
var i = 0
|
||||
var n = at
|
||||
var ch = s[0]
|
||||
|
|
@ -367,7 +367,7 @@ function rt_put_int(buf: ptr, at: int, v: int) -> int {
|
|||
return n
|
||||
}
|
||||
|
||||
function rt_dump_ppm(path: str) -> void {
|
||||
function rt_dump_ppm(path: string) -> void {
|
||||
let f = file_open(path, "wb")
|
||||
if (f == null) { return }
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ function rt_map_size(w: int, h: int) -> void {
|
|||
fill(rt_map, 32, 96 * 64)
|
||||
}
|
||||
|
||||
function rt_map_row(y: int, s: str) -> void {
|
||||
function rt_map_row(y: int, s: string) -> void {
|
||||
if y < 0 { return }
|
||||
if y >= 64 { return }
|
||||
var x = 0
|
||||
|
|
@ -438,7 +438,7 @@ function rt_tile(x: int, y: int) -> int {
|
|||
# so it survives whatever the caller does with the original.
|
||||
var rt_statusbuf: ptr = null
|
||||
|
||||
function rt_status(s: str) -> void {
|
||||
function rt_status(s: string) -> void {
|
||||
var i = 0
|
||||
var ch = s[0]
|
||||
while ch != 0 {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ function png_tag(b: ptr, at: int, a: int, c: int, d: int, e: int) -> bool {
|
|||
return true
|
||||
}
|
||||
|
||||
function rt_read_file(path: str) -> ptr {
|
||||
function rt_read_file(path: string) -> ptr {
|
||||
let f = file_open(path, "rb")
|
||||
if (f == null) { return null }
|
||||
file_seek(f, 0, 2)
|
||||
|
|
@ -62,7 +62,7 @@ var png_w: int = 0
|
|||
var png_h: int = 0
|
||||
var png_px: words = null
|
||||
|
||||
function rt_decode_png(path: str) -> bool {
|
||||
function rt_decode_png(path: string) -> bool {
|
||||
png_w = 0
|
||||
png_h = 0
|
||||
png_px = null
|
||||
|
|
@ -227,7 +227,7 @@ function rt_decode_png(path: str) -> bool {
|
|||
}
|
||||
|
||||
# ---- images ---------------------------------------------------------------
|
||||
function rt_image_load(path: str) -> int {
|
||||
function rt_image_load(path: string) -> int {
|
||||
if img_n >= IMG_MAX { return 0 - 1 }
|
||||
if rt_decode_png(path) == false { return 0 - 1 }
|
||||
let id = img_n
|
||||
|
|
@ -315,7 +315,7 @@ function rt_draw_9slice(id: int, dx: int, dy: int, dw: int, dh: int, inset: int)
|
|||
}
|
||||
|
||||
# ---- sprites (16x16 art) --------------------------------------------------
|
||||
function rt_png_load(path: str) -> int {
|
||||
function rt_png_load(path: string) -> int {
|
||||
if spr_n >= SPR_MAX { return 0 - 1 }
|
||||
if rt_decode_png(path) == false { return 0 - 1 }
|
||||
let id = spr_n
|
||||
|
|
@ -375,7 +375,7 @@ function rt_hexval(c: int) -> int {
|
|||
return 0 - 1
|
||||
}
|
||||
|
||||
function rt_sprites_load(path: str) -> void {
|
||||
function rt_sprites_load(path: string) -> void {
|
||||
let d = rt_read_file(path)
|
||||
if (d == null) { spr_n = 0; return }
|
||||
let size = rt_file_len
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ function tt_pick_cmap(id: int, d: ptr, co: int) -> void {
|
|||
tt_cfmt[id] = tt_u16(d, best)
|
||||
}
|
||||
|
||||
function rt_font_load(path: str) -> int {
|
||||
function rt_font_load(path: string) -> int {
|
||||
if tt_n >= TT_MAX { return 0 - 1 }
|
||||
let d = rt_read_file(path)
|
||||
if (d == null) { return 0 - 1 }
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ function tt_glyph_get(font: int, cp: int, px: int) -> int {
|
|||
# ---- UTF-8 ----------------------------------------------------------------
|
||||
var u8_next: int = 0 # byte index just past the codepoint last decoded
|
||||
|
||||
function tt_utf8(s: str, at: int) -> int {
|
||||
function tt_utf8(s: string, at: int) -> int {
|
||||
let c = s[at]
|
||||
var extra = 0 - 1
|
||||
if c < 128 { extra = 0 }
|
||||
|
|
@ -327,7 +327,7 @@ function tt_blit(bmp: ptr, w: int, h: int, dx: int, dy: int, colour: int) -> voi
|
|||
}
|
||||
}
|
||||
|
||||
function rt_text_ttf(font: int, x: int, y: int, s: str, colour: int, px: int) -> void {
|
||||
function rt_text_ttf(font: int, x: int, y: int, s: string, colour: int, px: int) -> void {
|
||||
if font < 0 { return }
|
||||
if font >= tt_n { return }
|
||||
if px <= 0 { return }
|
||||
|
|
@ -351,7 +351,7 @@ function rt_text_ttf(font: int, x: int, y: int, s: str, colour: int, px: int) ->
|
|||
}
|
||||
}
|
||||
|
||||
function rt_text_w(font: int, s: str, px: int) -> int {
|
||||
function rt_text_w(font: int, s: string, px: int) -> int {
|
||||
if font < 0 { return 0 }
|
||||
if font >= tt_n { return 0 }
|
||||
if px <= 0 { return 0 }
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ function rt_ui_set(i: int, k: int, v: int) -> void {
|
|||
if k == K_SKIN { ui_skin[i] = v }
|
||||
}
|
||||
|
||||
function rt_ui_static_text(i: int, s: str) -> void {
|
||||
function rt_ui_static_text(i: int, s: string) -> void {
|
||||
if i < 0 { return }
|
||||
if i >= UI_MAX { return }
|
||||
ui_text[i] = s
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ function rt_ui_clicked(id: int) -> bool {
|
|||
return ui_fired[id] == 1
|
||||
}
|
||||
|
||||
function rt_ui_set_text(id: int, s: str) -> void {
|
||||
function rt_ui_set_text(id: int, s: string) -> void {
|
||||
if id < 0 { return }
|
||||
if id >= ui_n { return }
|
||||
let base = id * 96
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue