Lines Matching refs:pCur
930 amatch_cursor *pCur; in amatchOpen() local
931 pCur = sqlite3_malloc( sizeof(*pCur) ); in amatchOpen()
932 if( pCur==0 ) return SQLITE_NOMEM; in amatchOpen()
933 memset(pCur, 0, sizeof(*pCur)); in amatchOpen()
934 pCur->pVtab = p; in amatchOpen()
935 *ppCursor = &pCur->base; in amatchOpen()
944 static void amatchClearCursor(amatch_cursor *pCur){ in amatchClearCursor() argument
946 for(pWord=pCur->pAllWords; pWord; pWord=pNextWord){ in amatchClearCursor()
950 pCur->pAllWords = 0; in amatchClearCursor()
951 sqlite3_free(pCur->zInput); in amatchClearCursor()
952 pCur->zInput = 0; in amatchClearCursor()
953 sqlite3_free(pCur->zBuf); in amatchClearCursor()
954 pCur->zBuf = 0; in amatchClearCursor()
955 pCur->nBuf = 0; in amatchClearCursor()
956 pCur->pCost = 0; in amatchClearCursor()
957 pCur->pWord = 0; in amatchClearCursor()
958 pCur->pCurrent = 0; in amatchClearCursor()
959 pCur->rLimit = 1000000; in amatchClearCursor()
960 pCur->iLang = 0; in amatchClearCursor()
961 pCur->nWord = 0; in amatchClearCursor()
968 amatch_cursor *pCur = (amatch_cursor *)cur; in amatchClose() local
969 amatchClearCursor(pCur); in amatchClose()
970 pCur->pVtab->nCursor--; in amatchClose()
971 sqlite3_free(pCur); in amatchClose()
1023 amatch_cursor *pCur, in amatchAddWord() argument
1035 if( rCost>pCur->rLimit ){ in amatchAddWord()
1040 if( nBase+nTail+3>pCur->nBuf ){ in amatchAddWord()
1041 pCur->nBuf = nBase+nTail+100; in amatchAddWord()
1042 pCur->zBuf = sqlite3_realloc(pCur->zBuf, pCur->nBuf); in amatchAddWord()
1043 if( pCur->zBuf==0 ){ in amatchAddWord()
1044 pCur->nBuf = 0; in amatchAddWord()
1049 memcpy(pCur->zBuf, zBuf+2, 2); in amatchAddWord()
1050 memcpy(pCur->zBuf+2, zWordBase, nBase); in amatchAddWord()
1051 memcpy(pCur->zBuf+2+nBase, zWordTail, nTail+1); in amatchAddWord()
1052 pNode = amatchAvlSearch(pCur->pWord, pCur->zBuf); in amatchAddWord()
1058 pWord->zWord+2, pWord->nMatch, pCur->zInput, pCur->zInput, in amatchAddWord()
1061 amatchAvlRemove(&pCur->pCost, &pWord->sCost); in amatchAddWord()
1068 pOther = amatchAvlInsert(&pCur->pCost, &pWord->sCost); in amatchAddWord()
1077 pWord->iSeq = pCur->nWord++; in amatchAddWord()
1080 pWord->pNext = pCur->pAllWords; in amatchAddWord()
1081 pCur->pAllWords = pWord; in amatchAddWord()
1084 pOther = amatchAvlInsert(&pCur->pCost, &pWord->sCost); in amatchAddWord()
1088 amatchStrcpy(pWord->zWord, pCur->zBuf); in amatchAddWord()
1089 pOther = amatchAvlInsert(&pCur->pWord, &pWord->sWord); in amatchAddWord()
1093 pWord->nMatch, pCur->zInput, pCur->zInput+pWord->nMatch, rCost, in amatchAddWord()
1103 amatch_cursor *pCur = (amatch_cursor*)cur; in amatchNext() local
1107 amatch_vtab *p = pCur->pVtab; in amatchNext()
1142 sqlite3_bind_int(p->pVCheck, 2, pCur->iLang); in amatchNext()
1145 pNode = amatchAvlFirst(pCur->pCost); in amatchNext()
1151 amatchAvlRemove(&pCur->pCost, &pWord->sCost); in amatchNext()
1155 pWord->zWord+2, pWord->nMatch, pCur->zInput, pCur->zInput+pWord->nMatch, in amatchNext()
1166 zNextIn[0] = pCur->zInput[pWord->nMatch]; in amatchNext()
1168 for(i=1; i<=4 && (pCur->zInput[pWord->nMatch+i]&0xc0)==0x80; i++){ in amatchNext()
1169 zNextIn[i] = pCur->zInput[pWord->nMatch+i]; in amatchNext()
1185 amatchAddWord(pCur, pWord->rCost, pWord->nMatch+nNextIn, zBuf, ""); in amatchNext()
1215 amatchAddWord(pCur, pWord->rCost+p->rIns, pWord->nMatch, in amatchNext()
1219 amatchAddWord(pCur, pWord->rCost+p->rSub, pWord->nMatch+nNextIn, in amatchNext()
1229 amatchAddWord(pCur, pWord->rCost+p->rDel, pWord->nMatch+nNextIn, in amatchNext()
1234 if( pRule->iLang!=pCur->iLang ) continue; in amatchNext()
1235 if( strncmp(pRule->zFrom, pCur->zInput+pWord->nMatch, pRule->nFrom)==0 ){ in amatchNext()
1236 amatchAddWord(pCur, pWord->rCost+pRule->rCost, in amatchNext()
1241 pCur->pCurrent = pWord; in amatchNext()
1256 amatch_cursor *pCur = (amatch_cursor *)pVtabCursor; in amatchFilter() local
1260 amatchClearCursor(pCur); in amatchFilter()
1267 pCur->rLimit = (amatch_cost)sqlite3_value_int(argv[idx]); in amatchFilter()
1271 pCur->iLang = (amatch_cost)sqlite3_value_int(argv[idx]); in amatchFilter()
1274 pCur->zInput = sqlite3_mprintf("%s", zWord); in amatchFilter()
1275 if( pCur->zInput==0 ) return SQLITE_NOMEM; in amatchFilter()
1276 amatchAddWord(pCur, 0, 0, "", ""); in amatchFilter()
1287 amatch_cursor *pCur = (amatch_cursor*)cur; in amatchColumn() local
1290 sqlite3_result_text(ctx, pCur->pCurrent->zWord+2, -1, SQLITE_STATIC); in amatchColumn()
1294 sqlite3_result_int(ctx, pCur->pCurrent->rCost); in amatchColumn()
1298 sqlite3_result_int(ctx, pCur->iLang); in amatchColumn()
1302 sqlite3_result_int(ctx, pCur->nWord); in amatchColumn()
1317 amatch_cursor *pCur = (amatch_cursor*)cur; in amatchRowid() local
1318 *pRowid = pCur->iRowid; in amatchRowid()
1326 amatch_cursor *pCur = (amatch_cursor*)cur; in amatchEof() local
1327 return pCur->pCurrent==0; in amatchEof()