Fix multi-context
This commit is contained in:
parent
a916f81d8a
commit
788eed763a
15 changed files with 163 additions and 125 deletions
|
|
@ -1,27 +1,11 @@
|
|||
#include <sj_kanakan.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
DictFile* dict;
|
||||
DICTL* node;
|
||||
char out[64 * 1024];
|
||||
int i = 0;
|
||||
char c[64 * 1024];
|
||||
char b;
|
||||
Sj3Context ctx;
|
||||
|
||||
ctx.work = calloc(1, sizeof(Global));
|
||||
|
||||
node = calloc(1, sizeof(DICTL));
|
||||
ctx.work->Jdictlist = node;
|
||||
|
||||
initwork(&ctx);
|
||||
|
||||
dict = opendict(&ctx, "dic.bin", "");
|
||||
|
||||
node->dict = &dict->dict;
|
||||
node->next = NULL;
|
||||
|
||||
seldict(&ctx, dict->dict.dicid);
|
||||
char out[64 * 1024];
|
||||
int i = 0;
|
||||
char c[64 * 1024];
|
||||
char b;
|
||||
Sj3Context* ctx = alloccontext("dic.bin");
|
||||
|
||||
c[0] = 0;
|
||||
|
||||
|
|
@ -37,7 +21,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
i = 0;
|
||||
while((strlen(c) - i) > 0 && (i += cl2knj(&ctx, (u_char*)c + i, strlen(c) - i, (u_char*)out))) {
|
||||
while((strlen(c) - i) > 0 && (i += cl2knj(ctx, (u_char*)c + i, strlen(c) - i, (u_char*)out))) {
|
||||
STDYOUT* s = (STDYOUT*)out;
|
||||
|
||||
printf("> %s\n", out + sizeof(STDYOUT));
|
||||
|
|
@ -46,5 +30,7 @@ int main(int argc, char** argv) {
|
|||
c[0] = 0;
|
||||
}
|
||||
|
||||
free_context(ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue