1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
/*
* ΥååΥȥ꤬
* ɤѴƥȤˤäƻѤƤ뤫롣
* åΥȥƤθߥƥ֤
* ѴƥȤȤäƤʤΤߤ˲뤳ȤǤ롣
*/
#include <stdlib.h>
#include <string.h>
#include <alloc.h>
#include <conf.h>
#include "dic_main.h"
#include "dic_personality.h"
#include "mem_dic.h"
static struct dic_session *g_current_session;
/* åcurrentѡʥƥΥåФƺ */
struct dic_session *
anthy_create_session(void)
{
int i;
struct mem_dic * d = anthy_current_personal_dic_cache;
for (i = 0; i < MAX_SESSION; i++) {
if (d->sessions[i].is_free) {
d->sessions[i].is_free = 0;
d->sessions[i].dic = d;
return &d->sessions[i];
}
}
return 0;
}
void
anthy_activate_session(struct dic_session *d)
{
g_current_session = d;
}
void
anthy_release_session(struct dic_session *d)
{
if (g_current_session == d) {
g_current_session = 0;
}
d->is_free = 1;
anthy_invalidate_seq_ent_mask(d->dic, ~d->mask);
}
int
anthy_get_current_session_mask(void)
{
if (g_current_session) {
return g_current_session->mask;
}
return 0;
}
void
anthy_init_sessions(struct mem_dic *d)
{
int i;
for (i = 0; i < MAX_SESSION; i++) {
d->sessions[i].id = i;
d->sessions[i].mask = (1<<i);
d->sessions[i].is_free = 1;
}
}
|