Files
strans/fn.h
Hojun-Cho c7718ece52 data: one trie for maps and dictionaries, one loader
The hash map served a single exact-match lookup that the trie already
answers, at the price of a second container, a second file loader with
its own drift, and a Str-to-UTF-8 conversion on every chain probe. The
files are small (kanji.dict is 7.5k lines), so the trie holds both.
trieopen validates keys and each space-separated value word against Str
and reports path:line; trielookup takes the Str every caller holds and
treats a nil trie as an unloaded map; trienew/trieput exist for tests.
The overflow guards on growth, Trie.root (always 0) and the per-language
init loop written twice are gone.
2026-08-16 15:56:32 +09:00

54 lines
1.3 KiB
C

void die(char*, ...);
int sinit(Str*, char*, int);
void sclear(Str*);
void sputr(Str*, Rune);
void spopr(Str*);
void sappend(Str*, Str*);
int scmp(Str*, Str*);
int stoutf(Str*, char*, int);
Rune slastr(Str*);
int mapget(Trie*, Str*, Str*);
Trie* trienew(void);
void trieput(Trie*, char*, int, char*, int);
Trie* trieopen(char*);
void trieclose(Trie*);
int trielookup(Trie*, Str*, char**, int*);
Lang* getlang(int);
void langinit(char*);
void dictthread(void*);
void dictlookup(Dictreq*, Dictres*);
void drawthread(void*);
void popuparea(Area*, int, Area*, int, int, Area*);
void popupposition(Caret*, int, int, Area*, int, int, int*, int*);
int pagemarker(char*, int, int, int, int);
void popuplayout(Drawcmd*, int, int, Popup*);
void popupdraw(u32int*, Drawcmd*, Popup*);
void imthread(void*);
Emit transmap(Im*, Rune);
Emit transko(Im*, Rune);
Emit transvi(Im*, Rune);
void backko(Im*);
void backvi(Im*);
void srvinit(void);
void srvthread(void*);
void ibusthread(void*);
void ximthread(void*);
void ximownernotify(void);
void* emalloc(ulong);
void* erealloc(void*, ulong);
int textinit(void);
void textclose(void);
int textwidth(Str*);
void textdraw(u32int*, int, int, int, int, Str*);
void textdrawfit(u32int*, int, int, int, int, int, Str*);
void textdrawfitcolor(u32int*, int, int, int, int, int, u32int, Str*);