// TODO: Pass "DicTraverseSession *traverseSession" when the source code structure settles down. static void initSessionInstance(void *traverseSession, const Dictionary *const dictionary, const int *prevWord, const int prevWordLength) { if (traverseSession) { DicTraverseSession *tSession = static_cast<DicTraverseSession *>(traverseSession); tSession->init(dictionary, prevWord, prevWordLength); } }
static void latinime_initDicTraverseSession(JNIEnv *env, jclass clazz, jlong traverseSession, jlong dictionary, jintArray previousWord, jint previousWordLength) { DicTraverseSession *ts = reinterpret_cast<DicTraverseSession *>(traverseSession); if (!ts) { return; } Dictionary *dict = reinterpret_cast<Dictionary *>(dictionary); if (!previousWord) { PrevWordsInfo prevWordsInfo; ts->init(dict, &prevWordsInfo, 0 /* suggestOptions */); return; } int prevWord[previousWordLength]; env->GetIntArrayRegion(previousWord, 0, previousWordLength, prevWord); PrevWordsInfo prevWordsInfo(prevWord, previousWordLength, false /* isStartOfSentence */); ts->init(dict, &prevWordsInfo, 0 /* suggestOptions */); }