engine: look dictionaries up synchronously
The dictionary thread ran in imthread's own proc, so a lookup could only start once the engine blocked, and it was a trie probe anyway; the emoji and Hanja searches already called dictlookup directly. The request/result channels, sequence numbers, staleness checks and the second draw per Japanese key are gone; dictqjp fills the candidates in place. Emit.dict and Lang.dictq only ever triggered lookups for Vietnamese, which has no dictionary. dictlookup(Lang*, key, out, max) returns the count. The Hanja lookup no longer pre-checks for a single syllable; a reading either has an entry or it does not.
This commit is contained in:
23
dat.h
23
dat.h
@@ -54,7 +54,6 @@ struct Emit
|
||||
int eat;
|
||||
Str s;
|
||||
Str next;
|
||||
Str dict;
|
||||
};
|
||||
|
||||
typedef struct Tnode Tnode;
|
||||
@@ -91,7 +90,6 @@ struct Lang
|
||||
char *dictname;
|
||||
Emit (*trans)(Im*, Rune);
|
||||
void (*back)(Im*);
|
||||
void (*dictq)(Im*);
|
||||
Trie *map;
|
||||
Trie *dict;
|
||||
};
|
||||
@@ -190,28 +188,7 @@ struct Keyreq
|
||||
Channel *reply;
|
||||
};
|
||||
|
||||
typedef struct Dictreq Dictreq;
|
||||
struct Dictreq
|
||||
{
|
||||
Str key;
|
||||
Str pre;
|
||||
int lang;
|
||||
u32int seq;
|
||||
};
|
||||
|
||||
typedef struct Dictres Dictres;
|
||||
struct Dictres
|
||||
{
|
||||
Str key;
|
||||
Str kouho[Maxkouho];
|
||||
int nkouho;
|
||||
int lang;
|
||||
u32int seq;
|
||||
};
|
||||
|
||||
extern Lang langs[];
|
||||
extern int nlang;
|
||||
extern Channel *drawc;
|
||||
extern Channel *keyc;
|
||||
extern Channel *dictreqc;
|
||||
extern Channel *dictresc;
|
||||
|
||||
Reference in New Issue
Block a user