wip(0.S2): migrate - a var nothing writes becomes a let; a state is keyed by its module, directory or program, so every program's plan agrees; paths normalized; program states named SceneDemoState / scene_demo_st; the LSP reads state, mut and entry/handler parameters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 15:31:34 +03:00
parent 3eda72e8c2
commit 5ffe50ed02
463 changed files with 72045 additions and 67421 deletions

View file

@ -12,44 +12,13 @@ function i18n__no_code() -> string { return "" }
function i18n__no() -> bool { return false }
function i18n__no_font(dir: string) -> bool { return false }
export state I18nState {
lang_dir: string = "assets/lang"
font_default: string = "assets/kit/font"
on: bool = false # a language other than English is drawing
cur: string = "en"
codes: []string = null # every language found, "en" first
names: []string = null
paths: []string = null
fonts: []string = null # a font atlas directory, "" for the game's own
font_now: string = ""
exact: Dict = null # msgid -> index into out
out: []string = null
lits: []string = null # every pattern's literal pieces, one run per pattern
pat_out: []string = null
pat_l0: words = null # where a pattern's pieces start in lits
pat_nl: words = null # how many pieces (holes + 1)
pat_sc: words = null # bytes of English it pins down: more is a better match
pat_ph: words = null # by piece: the hole number that follows it
pat_n: int = 0
pfx: Dict = null # a pattern's first four bytes -> its chain head + 1
sfx: Dict = null # else its last four
gen_head: int = 0 # else the short list, tried on short strings only
nx_p: words = null
nx_s: words = null
nx_g: words = null
cache: Dict = null # English as drawn -> index into cache_out
cache_out: []string = null
caps: []string = null
hit: bool = false
plural: Dict = null # a plural msgid (the singular) -> index into forms / 3
forms: []string = null # three forms per entry, "" where the file has fewer
plural_rule: int = 0 # PL_*
}
var lang_dir: string = "assets/lang"
var font_default: string = "assets/kit/font"
# where the shipped languages are (a directory with languages.txt and <code>.po), and the atlas a
# language with no X-Font draws in
export function i18n_config(i18n_st: mut I18nState, dir: string, default_font: string) -> void {
i18n_st.lang_dir = dir
i18n_st.font_default = default_font
i18n_st.codes = null
export function i18n_config(dir: string, default_font: string) -> void {
lang_dir = dir
font_default = default_font
codes = null
}