Home | History | Annotate | Download | only in lib

Lines Matching refs:pr

270  *  shortcut  : pr
337 static void pr_getOutputItemList (picodata_ProcessingUnit this, pr_subobj_t * pr,
360 pr_subobj_t * pr = (pr_subobj_t *) this->subObj;
364 if ((pr->workMemTop + byteSize) < PR_WORK_MEM_SIZE) {
365 (*adr) = (void *)(&(pr->pr_WorkMem[pr->workMemTop]));
367 pr->workMemTop += byteSize;
369 PICODBG_INFO(("pr_WorkMem: +%u, tot:%i of %i", byteSize, pr->workMemTop, PR_WORK_MEM_SIZE));
372 if (pr->workMemTop > pr->maxWorkMemTop) {
373 pr->maxWorkMemTop = pr->workMemTop;
375 PICODBG_INFO(("new max pr_WorkMem: %i of %i", pr->workMemTop, PR_WORK_MEM_SIZE));
381 PICODBG_ERROR(("pr out of working memory"));
382 picoos_emRaiseException(this->common->em, PICO_EXC_OUT_OF_MEM, (picoos_char *)"pr out of dynamic memory", (picoos_char *)"");
383 pr->outOfMemory = TRUE;
387 (*adr) = picoos_allocate(pr->dynMemMM, byteSize);
389 prevmaxDynMemSize = pr->maxDynMemSize;
390 picoos_getMemUsage(pr->dynMemMM, 1, &pr->dynMemSize, &incrUsedBytes, &pr->maxDynMemSize);
392 PICODBG_INFO(("pr_DynMem : +%i, tot:%i of %i", incrUsedBytes, pr->dynMemSize, PR_DYN_MEM_SIZE));
396 if (pr->maxDynMemSize > prevmaxDynMemSize) {
397 PICODBG_INFO(("new max pr_DynMem : %i of %i", pr->maxDynMemSize, PR_DYN_MEM_SIZE));
402 PICODBG_ERROR(("pr out of dynamic memory"));
403 picoos_emRaiseException(this->common->em, PICO_EXC_OUT_OF_MEM, (picoos_char *)"pr out of dynamic memory", (picoos_char *)"");
404 pr->outOfMemory = TRUE;
415 pr_subobj_t * pr = (pr_subobj_t *) this->subObj;
421 picoos_deallocate(pr->dynMemMM, &(*adr));
422 picoos_getMemUsage(pr->dynMemMM, 1, &pr->dynMemSize, &incrUsedBytes, &pr->maxDynMemSize);
424 PICODBG_INFO(("pr_DynMem : %i, tot:%i of %i: adr: %u", incrUsedBytes, pr->dynMemSize, PR_DYN_MEM_SIZE, *adr));
435 pr_subobj_t * pr = (pr_subobj_t *) this->subObj;
437 *lmemState = pr->workMemTop;
443 pr_subobj_t * pr = (pr_subobj_t *) this->subObj;
446 PICODBG_INFO(("pr_WorkMem: -%i, tot:%i of %i", pr->workMemTop-lmemState, lmemState, PR_WORK_MEM_SIZE));
449 pr->workMemTop = lmemState;
621 static picoos_int32 tok_tokenDigitStrToInt (picodata_ProcessingUnit this, pr_subobj_t * pr, picoos_uchar stokenStr[])
635 id = picoktab_graphOffset(pr->graphs, utf8char);
637 if (picoktab_getIntPropValue(pr->graphs, id, &n)) {
859 static pico_Status pr_addContext (register picodata_ProcessingUnit this, pr_subobj_t * pr, pr_ContextList * ctxList, picokpr_VarStrPtr contextNamePtr, picokpr_VarStrPtr netNamePtr, picokpr_VarStrPtr prodNamePtr)
883 net = pr->preproc[i];
886 net = pr->preproc[i];
915 pr_subobj_t * pr = (pr_subobj_t *) this->subObj;
922 pr->ctxList = NULL;
924 if (pr->preproc[p] != NULL) {
925 n = picokpr_getCtxArrLen(pr->preproc[p]);
927 ctxNamePtr = picokpr_getVarStrPtr(pr->preproc[p], picokpr_getCtxCtxNameOfs(pr->preproc[p], i));
928 netNamePtr = picokpr_getVarStrPtr(pr->preproc[p], picokpr_getCtxNetNameOfs(pr->preproc[p], i));
929 prodNamePtr = picokpr_getVarStrPtr(pr->preproc[p], picokpr_getCtxProdNameOfs(pr->preproc[p], i));
930 status = pr_addContext(this, pr, &pr->ctxList, ctxNamePtr,netNamePtr, prodNamePtr);
943 pr_subobj_t * pr = (pr_subobj_t *) this->subObj;
946 while (pr->ctxList != NULL) {
947 c = pr->ctxList;
948 pr->ctxList = pr->ctxList->rNext;
967 static void pr_setContext (register picodata_ProcessingUnit this, pr_subobj_t * pr, picoos_uchar context[])
972 ctx = pr_findContext(pr->ctxList,context);
974 pr->actCtx = ctx;
975 pr->actCtxChanged = TRUE;
1019 pr_subobj_t * pr = (pr_subobj_t *) this->subObj;
1023 if (pr->outOfMemory) return;
1028 if (pr->outOfMemory) return;
1039 if (pr->outOfMemory) return;
1067 pr_subobj_t * pr = (pr_subobj_t *) this->subObj;
1071 if (pr->outOfMemory) return;
1109 static void pr_putItem (picodata_ProcessingUnit this, pr_subobj_t * pr,
1118 pr->tmpItem.next = NULL;
1119 pr->tmpItem.val = 0;
1120 pr->tmpItem.head.type = itemType;
1121 pr->tmpItem.head.info1 = info1;
1122 pr->tmpItem.head.info2 = info2;
1124 pr_initItem(this, &pr->tmpItem);
1135 pr->tmpItem.head.len = picoos_strlen((picoos_char*)str);
1136 for (i=0; i<pr->tmpItem.head.len; i++) {
1137 pr->tmpItem.data[i] = str[i];
1139 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, & item);
1140 if (pr->outOfMemory) return;
1146 pr->tmpItem.head.len = 0;
1147 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, & item);
1148 if (pr->outOfMemory) return;
1156 pr->tmpItem.head.len = 2;
1157 pr->tmpItem.data[0] = val % 256;
1158 pr->tmpItem.data[1] = val / 256;
1159 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, & item);
1160 if (pr->outOfMemory) return;
1171 pr->tmpItem.head.len = picoos_strlen((picoos_char*)str);
1172 for (i=0; i<pr->tmpItem.head.len; i++) {
1173 pr->tmpItem.data[i] = str[i];
1175 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, & item);
1176 if (pr->outOfMemory) return;
1185 static void pr_appendItemToOutItemList (picodata_ProcessingUnit this, pr_subobj_t * pr,
1200 if (((pr->spellMode != 0) && (item->head.type == PICODATA_ITEM_TOKEN) && (item->head.info1 != PICODATA_ITEMINFO1_TOKTYPE_SPACE))) {
1210 lid = picoktab_graphOffset(pr->graphs, lstr);
1211 if ((lid > 0) && picoktab_getIntPropTokenType(pr->graphs, lid, &ltype) &&
1214 picoktab_getIntPropTokenSubType(pr->graphs,lid, &lsubtype);
1221 if (pr->outOfMemory) return;
1229 litem->val = tok_tokenDigitStrToInt(this, pr, litem->data);
1240 if (pr->spellMode == PR_SPELL_WITH_SENTENCE_BREAK) {
1242 if (pr->outOfMemory) return;
1255 } else if (pr->spellMode == PR_SPELL_WITH_SENTENCE_BREAK) {
1257 if (pr->outOfMemory) return;
1263 } else if (pr->spellMode > 0) {
1265 if (pr->outOfMemory) return;
1270 litem->data[0] = pr->spellMode % 256;
1271 litem->data[1] = pr->spellMode / 256;
1277 pr->spellMode = item->data[0]+256*item->data[1];
1280 pr->spellMode = 0;
1303 static void pr_genCommands (picodata_ProcessingUnit this, pr_subobj_t * pr,
1339 pr_putItem(this, pr, & (*first),& (*last),PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_IGNORE,PICODATA_ITEMINFO2_CMD_START,0,(picoos_uchar*)"");
1341 pr_putItem(this, pr, & (*first),& (*last),PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_IGNORE,PICODATA_ITEMINFO2_CMD_END,0,(picoos_uchar*)"");
1364 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD, lcmd,PICODATA_ITEMINFO2_CMD_ABSOLUTE, picokpr_getOutItemVal(network, picokpr_getOutItemArgOfs(network, outitem)),(picoos_uchar*)"");
1369 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,lcmd,PICODATA_ITEMINFO2_CMD_ABSOLUTE,picoos_atoi((picoos_char*)lvar->first->data),(picoos_uchar*)"");
1374 pr_getOutputItemList(this, pr, network,picokpr_getOutItemArgOfs(network, outitem),vars,& lf,& ll);
1375 if (pr->outOfMemory) return;
1377 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,lcmd,PICODATA_ITEMINFO2_CMD_ABSOLUTE,picoos_atoi((picoos_char*)lf->data),(picoos_uchar*)"");
1382 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,lcmd,PICODATA_ITEMINFO2_CMD_ABSOLUTE,lnum,(picoos_uchar*)"");
1395 pr_getOutputItemList(this, pr, network,picokpr_getOutItemArgOfs(network, outitem),vars,& lf,& ll);
1396 if (pr->outOfMemory) return;
1400 if (picodata_mapPAStrToPAIds(pr->transducer, this->common, pr->xsampa_parser, pr->svoxpa_parser, pr->xsampa2svoxpa_mapper, lf->data, alphabet, pr->tmpStr1, sizeof(pr->tmpStr1)-1) == PICO_OK) {
1401 pr_putItem(this, pr, & (*first),& (*last), PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_PHONEME,
1402 PICODATA_ITEMINFO2_CMD_START, 0, pr->tmpStr1);
1414 pr_putItem(this, pr, & (*first),& (*last), PICODATA_ITEM_TOKEN, PICODATA_ITEMINFO1_CMD_PHONEME,
1419 pr_putItem(this, pr, & (*first),& (*last), PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_PHONEME,
1427 pr_putItem(this, pr, & (*first),& (*last), PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_FLUSH, PICODATA_ITEMINFO2_NA, 0, (picoos_uchar*)"");
1430 pr_putItem(this, pr, & (*first),& (*last), PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_FLUSH, PICODATA_ITEMINFO2_NA, 0, (picoos_uchar*)"");
1432 pr_putItem(this, pr, & (*first),& (*last), PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_SIL, PICODATA_ITEMINFO2_NA, PICO_PARAGRAPH_PAUSE_DUR, (picoos_uchar*)"");
1439 pr_putItem(this, pr, & (*first),& (*last), PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_SIL, PICODATA_ITEMINFO2_NA, picokpr_getOutItemVal(network, picokpr_getOutItemArgOfs(network, outitem)), (picoos_uchar*)"");
1444 pr_putItem(this, pr, & (*first),& (*last), PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_SIL, PICODATA_ITEMINFO2_NA, picoos_atoi((picoos_char*)lvar->first->data), (picoos_uchar*)"");
1449 pr_getOutputItemList(this, pr, network,picokpr_getOutItemArgOfs(network, outitem),vars,& lf,& ll);
1450 if (pr->outOfMemory) return;
1452 pr_putItem(this, pr
1461 pr->tmpStr1[0] = 0;
1465 pr_strcpy(pr->tmpStr1, (picoos_uchar*)PICO_CONTEXT_DEFAULT);
1469 pr->tmpStr1[0] = 0;
1479 pr->tmpStr1[0] = 0;
1482 pr_strcat(pr->tmpStr1,litem->data);
1486 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD, lcmd,lnum,0,pr->tmpStr1);
1491 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,lcmd,lnum,0,lstrp);
1496 pr_getOutputItemList(this, pr, network,picokpr_getOutItemArgOfs(network, outitem),vars,& lf,& ll);
1497 if (pr->outOfMemory) return;
1499 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,lcmd,lnum,0,lf->data);
1504 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,lcmd,lnum,0,pr->tmpStr1);
1513 pr->tmpStr1[0] = 0;
1522 pr->tmpStr1[0] = 0;
1525 pr_strcat(pr->tmpStr1,litem->data);
1529 if ((lnum = picodata_getPuTypeFromExtension(pr->tmpStr1, /*input*/FALSE)) != PICODATA_ITEMINFO2_CMD_TO_UNKNOWN) {
1530 if (pr->saveFile[0] != 0) {
1531 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_UNSAVE,
1532 picodata_getPuTypeFromExtension(pr->saveFile, /*input*/FALSE),0,pr->saveFile);
1534 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD, lcmd,lnum,0,pr->tmpStr1);
1535 pr_strcpy(pr->saveFile, pr->tmpStr1);
1542 if (pr->saveFile[0] != 0) {
1543 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_UNSAVE,
1544 picodata_getPuTypeFromExtension(pr->saveFile, /*input*/FALSE),0,pr->saveFile);
1546 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD, lcmd,lnum,0,lstrp);
1547 pr_strcpy(pr->saveFile, lstrp);
1549 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,lcmd,lnum,0,lstrp);
1554 pr_getOutputItemList(this, pr, network,picokpr_getOutItemArgOfs(network, outitem),vars,& lf,& ll);
1555 if (pr->outOfMemory) return;
1558 if (pr->saveFile[0] != 0) {
1559 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_UNSAVE,
1560 picodata_getPuTypeFromExtension(pr->saveFile, /*input*/FALSE),0,pr->saveFile);
1562 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD, lcmd,lnum,0,lf->data);
1563 pr_strcpy(pr->saveFile, lf->data);
1570 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,lcmd,lnum,0,pr->tmpStr1);
1580 pr->tmpStr1[0] = 0;
1598 pr->tmpStr1[0] = 0;
1601 pr_strcat(pr->tmpStr1,litem->data);
1605 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD, PICODATA_ITEMINFO1_CMD_PLAY,
1606 picodata_getPuTypeFromExtension(pr->tmpStr1, /*input*/TRUE),0, pr->tmpStr1);
1612 pr_strcpy(pr->tmpStr1, lstrp);
1618 pr_getOutputItemList(this, pr, network,picokpr_getOutItemArgOfs(network, outitem),vars,& lf,& ll);
1619 if (pr->outOfMemory) return;
1621 pr_strcpy(pr->tmpStr1, lf->data);
1657 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,PICODATA_ITEMINFO1_CMD_PLAY,
1658 picodata_getPuTypeFromExtension(pr->tmpStr1, /*input*/TRUE),0,pr->tmpStr1);
1660 pr_putItem(this, pr,& (*first),& (*last),PICODATA_ITEM_CMD,lcmd,linfo2,0,(picoos_uchar*)"");
1670 pr_subobj_t * pr,
1704 if (pr->outOfMemory) return;
1705 pr_initItem(this, &pr->tmpItem);
1706 pr->tmpItem.head.type = PICODATA_ITEM_TOKEN;
1707 pr->tmpItem.head.info1 = PICODATA_ITEMINFO1_TOKTYPE_UNDEFINED;
1708 pr->tmpItem.head.info2 = -1;
1709 pr->tmpItem.head.len = pr_strcpy(pr->tmpItem.data, lstrp);
1710 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, &litem2);
1711 if (pr->outOfMemory) return;
1723 if (pr->outOfMemory) return;
1735 pr_getOutputItemList(this, pr, network,largOfs,vars,& lf,& ll);
1736 if (pr->outOfMemory) return;
1743 pr_initItem(this, &pr->tmpItem);
1744 if (pr->outOfMemory) return;
1745 pr->tmpItem.head.type = PICODATA_ITEM_TOKEN;
1746 pr->tmpItem.head.info1 = lf->head.info1;
1747 pr->tmpItem.head.info2 = lf->head.info2;
1748 pr->tmpItem.head.len = picobase_det_utf8_length(lf->data[li]);
1749 for (li2 = 0; li2 < pr->tmpItem.head.len; li2++) {
1750 pr->tmpItem.data[li2] = lf->data[li];
1753 pr->tmpItem.data[pr->tmpItem.head.len] = 0;
1754 pr->tmpItem.val = 0;
1755 lid = picoktab_graphOffset(pr->graphs,pr->tmpItem.data);
1757 if (picoktab_getIntPropTokenType(pr->graphs, lid, &ltype)) {
1759 pr->tmpItem.head.len = pr_strcat(pr->tmpItem.data,(picoos_uchar*)SPEC_CHAR);
1762 picoktab_getIntPropTokenSubType(pr->graphs, lid, &lsubtype);
1767 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, &litem2);
1768 if (pr->outOfMemory) return;
1771 pr_initItem(this, &pr->tmpItem);
1772 pr->tmpItem.head.type = PICODATA_ITEM_TOKEN;
1773 pr->tmpItem.head.info1 = PICODATA_ITEMINFO1_TOKTYPE_CHAR;
1774 pr->tmpItem.head.info2 = lsubtype;
1775 pr->tmpItem.head.len = 1;
1776 pr->tmpItem.data[0] = ',';
1777 pr->tmpItem.data[1] = 0;
1778 pr->tmpItem.val = 0;
1779 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, &litem2);
1780 if (pr->outOfMemory) return;
1783 pr_initItem(this, &pr->tmpItem);
1784 pr->tmpItem.head.type = PICODATA_ITEM_CMD;
1785 pr->tmpItem.head.info1 = PICODATA_ITEMINFO1_CMD_FLUSH;
1786 pr->tmpItem.head.info2 = PICODATA_ITEMINFO2_NA;
1787 pr->tmpItem.head.len = 0;
1788 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, &litem2);
1789 if (pr->outOfMemory) return;
1792 pr_initItem(this, &pr->tmpItem);
1793 pr->tmpItem.head.type = PICODATA_ITEM_TOKEN;
1794 pr->tmpItem.head.info1 = PICODATA_ITEMINFO1_TOKTYPE_CHAR;
1795 pr->tmpItem.head.info2 = lsubtype;
1796 pr->tmpItem.head.len = 1;
1797 pr->tmpItem.data[0] = ',';
1798 pr->tmpItem.data[1] = 0;
1799 pr->tmpItem.val = 0;
1800 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, &litem2);
1801 if (pr->outOfMemory) return;
1808 if (pr->outOfMemory) return;
1819 pr_getOutputItemList(this, pr, network,picokpr_getOutItemArgOfs(network, lo),vars,& lf,& ll);
1820 if (pr->outOfMemory) return;
1821 pr_initItem(this, &pr->tmpItem);
1822 pr->tmpItem.head.type = PICODATA_ITEM_TOKEN;
1823 pr->tmpItem.head.info1 = PICODATA_ITEMINFO1_TOKTYPE_UNDEFINED;
1824 pr->tmpItem.head.info2 = -(1);
1825 pr->tmpItem.head.len = 0;
1826 pr->tmpItem.data[0] = 0;
1827 pr->tmpItem.val = 0;
1831 pr->tmpItem.head.len = pr_strcat(pr->tmpItem.data,lf->data);
1834 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, &litem2);
1835 if (pr->outOfMemory) return;
1839 if (pr->outOfMemory) return;
1842 pr_initItem(this, &pr->tmpItem);
1843 pr->tmpItem.head.type = PICODATA_ITEM_TOKEN;
1844 pr->tmpItem.head.info1 = PICODATA_ITEMINFO1_TOKTYPE_UNDEFINED;
1845 pr->tmpItem.head.info2 = -(1);
1846 pr->tmpItem.head.len = 0;
1847 pr->tmpItem.data[0] = 0;
1848 pr->tmpItem.val = 0;
1855 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, &litem2);
1856 if (pr->outOfMemory) return;
1861 pr_getOutputItemList(this, pr, network,picokpr_getOutItemArgOfs(network, lo),vars,& lf,& ll);
1862 if (pr->outOfMemory) return;
1864 pr_initItem(this, &pr->tmpItem);
1865 pr_copyItemContent(this, lf, &pr->tmpItem);
1867 pr_int_to_string(lval32, (picoos_char *)pr->tmpItem.data, PR_MAX_DATA_LEN_Z);
1868 pr->tmpItem.head.len = pr_strlen(pr->tmpItem.data);
1869 pr->tmpItem.val = lval32;
1871 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, &litem2);
1879 pr_getOutputItemList(this, pr, network,picokpr_getOutItemNextOfs(network, picokpr_getOutItemArgOfs(network, lo)),vars,& lf,& ll);
1880 if (pr->outOfMemory) return;
1882 pr_initItem(this, &pr->tmpItem);
1883 pr_copyItemContent(this, lf, &pr->tmpItem);
1885 llen2 = picobase_utf8_length(pr->tmpItem.data,PR_MAX_DATA_LEN);
1890 ln = ln + picobase_det_utf8_length(pr->tmpItem.data[ln]);
1893 pr->tmpItem.data[ln] = 0;
1894 pr->tmpItem.head.len = ln;
1895 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, &litem2);
1896 if (pr->outOfMemory) return;
1902 pr_getOutputItemList(this, pr, network,picokpr_getOutItemNextOfs(network, picokpr_getOutItemArgOfs(network, lo)),vars,& lf,& ll);
1903 if (pr->outOfMemory) return;
1905 pr_initItem(this, &pr->tmpItem);
1906 pr_copyItemContent(this, lf, & pr->tmpItem);
1908 llen2 = picobase_utf8_length(pr->tmpItem.data,PR_MAX_DATA_LEN);
1912 ln = ln + picobase_det_utf8_length(pr->tmpItem.data[ln]);
1915 pr->tmpItem.head.len = pr_removeSubstring(0,ln,pr->tmpItem.data);
1916 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, & litem2);
1917 if (pr->outOfMemory) return;
1923 pr_getOutputItemList(this, pr, network,picokpr_getOutItemNextOfs(network, picokpr_getOutItemArgOfs(network, lo)),vars,& lf,& ll);
1924 if (pr->outOfMemory) return;
1933 if (pr->outOfMemory) return;
1939 pr_getOutputItemList(this, pr, network, picokpr_getOutItemArgOfs(network, lo),vars,& lf,& ll);
1940 if (pr->outOfMemory) return;
1942 pr_initItem(this, &pr->tmpItem);
1943 pr_copyItemContent(this, lf, & pr->tmpItem);
1945 while ((li < lf->head.len) && (pr->tmpItem.data[li] == '0')) {
1948 pr->tmpItem.head.len = pr_removeSubstring(0,li,pr->tmpItem.data);
1949 pr_copyItem(this, pr_WorkMem, &pr->tmpItem, & litem2);
1950 if (pr->outOfMemory) return;
1956 pr_genCommands(this, pr, network,lo,vars,& (*first),& (*last));
1957 if (pr->outOfMemory) return;
1988 static void pr_getOutput (picodata_ProcessingUnit this, pr_subobj_t * pr,
2010 while ((*i) < pr->rbestpath.rlen) {
2011 with__0 = & pr->rbestpath.rele[*i];
2014 while ((li < 127) && (li < pr->rbestpath.rele[*i].rdepth)) {
2015 pr->lspaces[li++] = ' ';
2018 pr->lspaces[li] = 0;
2020 PICODBG_INFO(("pp path :%s%s(", pr->lspaces, picokpr_getVarStrPtr(with__0->rnetwork,with__0->rprodname)));
2022 if ((pr->ritems[with__0->ritemid+1] != NULL) && (pr->ritems[with__0->ritemid+1]->head.type == PICODATA_ITEM_TOKEN)) {
2023 PICODBG_INFO(("pp in (1): %s'%s'", pr->lspaces, pr->ritems[with__0->ritemid+1]->data));
2025 if ((pr->ritems[with__0->ritemid+1] != NULL)) {
2026 while ((pr->rinItemList != NULL) && (pr->rinItemList != pr->ritems[with__0->ritemid+1]) && (pr->rinItemList->head.type != PICODATA_ITEM_TOKEN)) {
2027 lit = pr->rinItemList;
2028 pr->rinItemList = pr->rinItemList->next;
2031 if (pr->outOfMemory) return;
2035 if (pr->rinItemList != NULL) {
2036 lit = pr->rinItemList;
2037 pr->rinItemList = pr->rinItemList->next;
2056 pr_getOutput(this, pr, & (*i),(d + 1),& lvar->first,& lvar->last);
2057 if (pr->outOfMemory) return;
2060 pr_getOutput(this, pr, & (*i),(d + 1),& ldit,& ldlit);
2061 if (pr->outOfMemory) return;
2075 if (pr->outOfMemory) return;
2077 lit->head.info1 = pr->ritems[with__0->ritemid+1]->head.info1;
2078 lit->head.info2 = pr->ritems[with__0->ritemid+1]->head.info2;
2079 if (pr->ritems[with__0->ritemid+1]->head.info1 == PICODATA_ITEMINFO1_TOKTYPE_SPACE) {
2082 lit->head.len = pr_strcpy(lit->data, pr->ritems[with__0->ritemid+1]->data);
2088 if ((pr->ritems[with__0->ritemid+1]->head.info1 == PICODATA_ITEMINFO1_TOKTYPE_SPACE)) {
2091 lvar->last->head.len = pr_strcat(lvar->last->data,pr->ritems[with__0->ritemid+1]->data);
2097 lvar->first = pr->ritems[with__0->ritemid+1];
2098 lvar->last = pr->ritems[with__0->ritemid+1];
2102 pr_getOutputItemList(this, pr, with__0->rnetwork,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEOut),lvars,& (*o),& (*ol));
2103 if (pr->outOfMemory) return;
2105 } else if (((*i) < (pr->rbestpath.rlen - 1)) && (d != pr->rbestpath.rele[(*i) + 1].rdepth)) {
2106 if ((*i > 0) && (with__0->rdepth-1) == pr->rbestpath.rele[*i + 1].rdepth) {
2109 pr->lspaces[li++] = ' ';
2111 pr->lspaces[li] = 0;
2112 PICODBG_INFO(("pp path :%s)", pr->lspaces));
2123 while ((li < 127) && (li < pr->rbestpath.rele[*i].rdepth-1)) {
2124 pr->lspaces[li++] = ' ';
2126 pr->lspaces[li] = 0;
2127 PICODBG_INFO(("pp path :%s)", pr->lspaces));
2131 static void pr_outputPath (picodata_ProcessingUnit this, pr_subobj_t * pr)
2146 pr_getOutput(this, pr, & li,1,& lf,& ll);
2147 if (pr->outOfMemory) return;
2161 pr->insidePhoneme = TRUE;
2163 pr->insidePhoneme = FALSE;
2168 pr->rignore++;
2172 if (pr->rignore > 0) {
2173 pr->rignore--;
2179 if (pr->rignore <= 0) {
2180 pr_setContext(this, pr, lit->data);
2183 if (pr->rignore <= 0) {
2185 if (pr->outOfMemory) return;
2186 pr_appendItem(this, & pr->routItemList,& pr->rlastOutItem, lit2);
2189 if ((pr->rignore <= 0) && !(pr->insidePhoneme && (pr_isCmdType(lit,PICODATA_ITEMINFO1_CMD_PLAY) ||
2193 if (pr->outOfMemory) return;
2194 pr_appendItemToOutItemList(this, pr, & pr->routItemList,& pr->rlastOutItem,lit2);
2195 if (pr->outOfMemory) return;
2199 for (li = 0; li<pr->rbestpath.rlen; li++) {
2200 with__0 = & pr->rbestpath.rele[li];
2201 pr_disposeItem(this, & pr->ritems[with__0->ritemid+1]);
2262 static picoos_bool pr_getNextToken (picodata_ProcessingUnit this, pr_subobj_t * pr)
2268 len = pr->ractpath.rlen;
2269 with__0 = & pr->ractpath.rele[len - 1];
2271 if ((len > 0) && (pr->ractpath.rlen < PR_MAX_PATH_LEN) && ((PR_TSE_MASK_NEXT & npset) != 0)) {
2272 pr_initPathEle(& pr->ractpath.rele[len]);
2273 pr->ractpath.rele[len].rnetwork = with__0->rnetwork;
2274 pr->ractpath.rele[len].rtok = picokpr_getTokNextOfs(with__0->rnetwork, with__0->rtok);
2275 pr->ractpath.rele[len].rdepth = with__0->rdepth;
2276 pr->ractpath.rlen++;
2287 static picoos_bool pr_getAltToken (picodata_ProcessingUnit this, pr_subobj_t * pr)
2294 with__0 = & pr->ractpath.rele[pr->ractpath.rlen - 1];
2295 if ((pr->ractpath.rlen > 0) && (pr->ractpath.rlen < PR_MAX_PATH_LEN)) {
2318 if (pr->ractpath.rlen >= PR_MAX_PATH_LEN) {
2326 static picoos_bool pr_findProduction (picodata_ProcessingUnit this, pr_subobj_t * pr,
2338 pr_getTermPartStr(str,& ind,'.',pr->tmpStr1,& done);
2339 pr_getTermPartStr(str,& ind,'.',pr->tmpStr2,& done);
2343 if (!found && (pr->preproc[p] != NULL)) {
2344 if (pr_strEqual(pr->tmpStr1, picokpr_getPreprocNetName(pr->preproc[p]))) {
2346 lprodarrlen = picokpr_getProdArrLen(pr->preproc[p]);
2348 lstrp = picokpr_getVarStrPtr(pr->preproc[p],picokpr_getProdNameOfs(pr->preproc[p], i));
2349 if (pr_strEqual(pr->tmpStr2, lstrp)) {
2350 *network = pr->preproc[p];
2351 *tokOfs = picokpr_getProdATokOfs(pr->preproc[p], i);
2363 static picoos_bool pr_getProdToken (picodata_ProcessingUnit this, pr_subobj_t * pr)
2369 if ((pr->ractpath.rlen > 0) && (pr->ractpath.rlen < PR_MAX_PATH_LEN)) {
2370 with__0 = & pr->ractpath.rele[pr->ractpath.rlen - 1];
2374 pr_initPathEle(& pr->ractpath.rele[pr->ractpath.rlen]);
2376 if (pr_findProduction(this, pr, lstrp,& pr->ractpath.rele[pr->ractpath.rlen].rnetwork,& pr->ractpath.rele[pr->ractpath.rlen].rtok)) {
2379 pr->ractpath.rele[pr->ractpath.rlen].rdepth = with__0->rdepth + 1;
2380 pr->ractpath.rlen++;
2386 pr_initPathEle(& pr->ractpath.rele[pr->ractpath.rlen]);
2387 pr->ractpath.rele[pr->ractpath.rlen].rnetwork = with__0->rnetwork;
2388 pr->ractpath.rele[pr->ractpath.rlen].rtok = picokpr_getProdATokOfs(with__0->rnetwork, pr_attrVal(with__0->rnetwork, with__0->rtok,PR_TSEProd));
2391 pr->ractpath.rele[pr->ractpath.rlen].rdepth = with__0->rdepth + 1;
2392 pr->ractpath.rlen++;
2397 if (pr->ractpath.rlen >= PR_MAX_PATH_LEN) {
2404 static picoos_bool pr_getProdContToken (picodata_ProcessingUnit this, pr_subobj_t * pr)
2408 li = pr->ractpath.rlen - 1;
2409 while ((li > 0) && !((pr->ractpath.rele[li].rdepth == (pr->ractpath.rele[pr->ractpath.rlen - 1].rdepth - 1)) && ((PR_TSE_MASK_PROD &picokpr_getTokSetWP(pr->ractpath.rele[li].rnetwork, pr->ractpath.rele[li].rtok)) != 0))) {
2412 if (((li >= 0) && (pr->ractpath.rlen < PR_MAX_PATH_LEN) && (PR_TSE_MASK_NEXT &picokpr_getTokSetNP(pr->ractpath.rele[li].rnetwork, pr->ractpath.rele[li].rtok)) != 0)) {
2413 pr_initPathEle(& pr->ractpath.rele[pr->ractpath.rlen]);
2414 pr->ractpath.rele[pr->ractpath.rlen].rnetwork = pr->ractpath.rele[li].rnetwork;
2415 pr->ractpath.rele[pr->ractpath.rlen].rtok = picokpr_getTokNextOfs(pr->ractpath.rele[li].rnetwork, pr->ractpath.rele[li].rtok);
2416 pr->ractpath.rele[pr->ractpath.rlen].rdepth = pr->ractpath.rele[li].rdepth;
2417 pr->ractpath.rlen++;
2420 if (pr->ractpath.rlen >= PR_MAX_PATH_LEN) {
2429 static picoos_bool pr_getTopLevelToken (picodata_ProcessingUnit this, pr_subobj_t * pr, picoos_bool firstprod)
2432 if (pr->actCtx != NULL) {
2433 pr->prodList = pr->actCtx->rProdList;
2435 pr->prodList = NULL;
2437 } else if (pr->prodList != NULL) {
2438 pr->prodList = pr->prodList->rNext;
2440 if ((pr->prodList != NULL) && (pr->prodList->rProdOfs != 0) && (picokpr_getProdATokOfs(pr->prodList->rNetwork, pr->prodList->rProdOfs) != 0)) {
2441 pr_initPathEle(& pr->ractpath.rele[pr->ractpath.rlen]);
2442 pr->ractpath.rele[pr->ractpath.rlen].rdepth = 1;
2443 pr->ractpath.rele[pr->ractpath.rlen].rnetwork = pr->prodList->rNetwork;
2444 pr->ractpath.rele[pr->ractpath.rlen].rtok = picokpr_getProdATokOfs(pr->prodList->rNetwork, pr->prodList->rProdOfs);
2445 pr->ractpath.rele[pr->ractpath.rlen].rlState = PR_LSInit;
2446 pr->ractpath.rele[pr->ractpath.rlen].rcompare = -1;
2447 pr->ractpath.rele[pr->ractpath.rlen].rprodname = picokpr_getProdNameOfs(pr->prodList->rNetwork, pr->prodList->rProdOfs);
2448 pr->ractpath.rele[pr->ractpath.rlen].rprodprefcost = picokpr_getProdPrefCost(pr->prodList->rNetwork, pr->prodList->rProdOfs);
2449 pr->ractpath.rlen++;
2457 static picoos_bool pr_getToken (picodata_ProcessingUnit this, pr_subobj_t * pr)
2462 ln = (pr->ractpath.rlen - 2);
2463 while ((ln >= 0) && (pr->ractpath.rele[ln].ritemid == -1)) {
2467 lid = pr->ractpath.rele[ln].ritemid + 1;
2471 if (lid < pr->rnritems) {
2472 pr->ractpath.rele[pr->ractpath.rlen - 1].ritemid = lid;
2474 pr->ractpath.rele[pr->ractpath.rlen - 1].ritemid = -1;
2476 return (lid < pr->rnritems);
2480 static picoos_bool pr_getNextMultiToken (picodata_ProcessingUnit this, pr_subobj_t * pr)
2484 len = pr->ractpath.rlen;
2486 pr->ractpath.rele[len].rtok = pr->ractpath.rele[len - 1].rtok;
2487 pr->ractpath.rele[len].ritemid = -(1);
2488 pr->ractpath.rele[len].rcompare = pr->ractpath.rele[len - 1].rcompare;
2489 pr->ractpath.rele[len].rdepth = pr->ractpath.rele[len - 1].rdepth;
2490 pr
2491 pr->ractpath.rlen++;
2503 static pr_MatchState pr_matchMultiToken (picodata_ProcessingUnit this, pr_subobj_t * pr,
2516 pr = pr; /* avoid warning "var not used in this function"*/
2523 static pr_MatchState pr_matchTokensSpace (picodata_ProcessingUnit this, pr_subobj_t * pr, picoos_int32 cmpres,
2533 with__0 = & pr->ractpath.rele[pr->ractpath.rlen - 1];
2537 lstrp = (picokpr_VarStrPtr)&pr->ritems[with__0->ritemid+1]->data;
2563 if (((PR_TSE_MASK_ID & wpset) != 0) && (pr->ritems[with__0->ritemid+1]->head.info2 != pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEID))) {
2570 static pr_MatchState pr_matchTokensDigit (picodata_ProcessingUnit this, pr_subobj_t * pr, picoos_int32 cmpres,
2578 with__0 = & pr->ractpath.rele[pr->ractpath.rlen - 1];
2582 lstrp = (picokpr_VarStrPtr)&pr->ritems[with__0->ritemid+1]->data;
2587 lval = pr->ritems[with__0->ritemid+1]->val;
2612 if (((PR_TSE_MASK_ID & wpset) != 0) && (pr->ritems[with__0->ritemid+1]->head.info2 != pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEID))) {
2619 static pr_MatchState pr_matchTokensSeq (picodata_ProcessingUnit this, pr_subobj_t * pr, picoos_int32 cmpres,
2627 with__0 = & pr->ractpath.rele[pr->ractpath.rlen - 1];
2632 lstrp = (picokpr_VarStrPtr)(void *) &pr->ritems[with__0->ritemid+1]->data;
2655 if (((PR_TSE_MASK_ID & wpset) != 0) && (pr->ritems[with__0->ritemid+1]->head.info2 != pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEID))) {
2662 static pr_MatchState pr_matchTokensChar (picodata_ProcessingUnit this, pr_subobj_t * pr, picoos_int32 cmpres,
2667 with__0 = & pr->ractpath.rele[pr->ractpath.rlen - 1];
2675 if (((PR_TSE_MASK_ID & wpset) != 0) && (pr->ritems[with__0->ritemid+1]->head.info2 != pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEID))) {
2682 static pr_MatchState pr_matchTokensLetter (picodata_ProcessingUnit this, pr_subobj_t * pr, picoos_int32 cmpres,
2690 with__0 = & pr->ractpath.rele[pr->ractpath.rlen - 1];
2695 lulen = picobase_utf8_length(pr->ritems[with__0->ritemid+1]->data, PR_MAX_DATA_LEN);
2709 if (((PR_TSE_MASK_HEAD & wpset) != 0) && !(picokpr_isEqualHead(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->strci,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEHead)))) {
2712 if (((PR_TSE_MASK_MID & wpset) != 0) && !(picokpr_isEqualMid(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->strci,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEMid)))) {
2715 if (((PR_TSE_MASK_TAIL & wpset) != 0) && !(picokpr_isEqualTail(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->strci,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSETail)))) {
2719 if (((PR_TSE_MASK_STR & wpset) != 0) && !(picokpr_isEqual(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->strcis,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEStr)))) {
2722 if (((PR_TSE_MASK_HEAD & wpset) != 0) && !(picokpr_isEqualHead(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->strcis,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEHead)))) {
2725 if (((PR_TSE_MASK_MID & wpset) != 0) && !(picokpr_isEqualMid(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->strcis,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEMid)))) {
2728 if (((PR_TSE_MASK_TAIL & wpset) != 0) && !(picokpr_isEqualTail(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->strcis,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSETail)))) {
2732 if (((PR_TSE_MASK_STR & wpset) != 0) && !(picokpr_isEqual(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->data,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEStr)))) {
2735 if (((PR_TSE_MASK_HEAD & wpset) != 0) && !(picokpr_isEqualHead(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->data,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEHead)))) {
2738 if (((PR_TSE_MASK_MID & wpset) != 0) && !(picokpr_isEqualMid(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->data,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEMid)))) {
2741 if (((PR_TSE_MASK_TAIL & wpset) != 0) && !(picokpr_isEqualTail(with__0->rnetwork,pr->ritems[with__0->ritemid+1]->data,PR_MAX_DATA_LEN,pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSETail)))) {
2745 if (((PR_TSE_MASK_AUC & npset) != 0) && !(pr->ritems[with__0->ritemid+1]->auc)) {
2748 if (((PR_TSE_MASK_ALC & npset) != 0) && !(pr->ritems[with__0->ritemid+1]->alc)) {
2751 if (((PR_TSE_MASK_SUC & npset) != 0) && !(pr->ritems[with__0->ritemid+1]->suc)) {
2754 if (((PR_TSE_MASK_ROMAN & npset) != 0) && !(pr_isLatinNumber(pr->ritems[with__0->ritemid+1]->data,& lromanval))) {
2757 if (((PR_TSE_MASK_ID & wpset) != 0) && (pr->ritems[with__0->ritemid+1]->head.info2 != pr_attrVal(with__0->rnetwork, with__0->rtok, PR_TSEID))) {
2764 static pr_MatchState pr_matchTokensBegin (picodata_ProcessingUnit this, pr_subobj_t * pr,
2769 if ((PR_TSE_MASK_BEGIN &picokpr_getTokSetNP(pr->ractpath.rele[pr->ractpath.rlen - 1].rnetwork, pr->ractpath.rele[pr->ractpath.rlen - 1].rtok)) != 0) {
2778 static pr_MatchState pr_matchTokensEnd (picodata_ProcessingUnit this, pr_subobj_t * pr,
2783 if ((PR_TSE_MASK_END &picokpr_getTokSetNP(pr->ractpath.rele[pr->ractpath.rlen - 1].rnetwork, pr->ractpath.rele[pr->ractpath.rlen - 1].rtok)) != 0) {
2791 static pr_MatchState pr_matchTokens (picodata_ProcessingUnit this, pr_subobj_t * pr, picoos_int16 * cmpres)
2799 with__0 = & pr->ractpath.rele[pr->ractpath.rlen - 1];
2806 pr_compare(pr->ritems[with__0->ritemid+1]->strci,lstrp,cmpres);
2809 return pr_matchMultiToken(this, pr, npset, wpset);
2811 switch (pr->ritems[with__0->ritemid+1]->head.info1) {
2813 return pr_matchTokensBegin(this, pr, npset, wpset);
2816 return pr_matchTokensEnd(this, pr, npset, wpset);
2819 return pr_matchTokensSpace(this, pr, *cmpres, npset, wpset);
2822 return pr_matchTokensDigit(this, pr, *cmpres, npset, wpset);
2825 return pr_matchTokensLetter(this, pr, *cmpres, npset, wpset);
2828 return pr_matchTokensSeq(this, pr, *cmpres, npset, wpset);
2831 return pr_matchTokensChar(this, pr, *cmpres, npset, wpset);
2894 void pr_processToken (picodata_ProcessingUnit this, pr_subobj_t * pr)
2903 pr->rgState = PR_GSContinue;
2904 if ((pr->ractpath.rlen == 0)) {
2905 if (pr_getTopLevelToken(this, pr, FALSE)) {
2906 pr->rgState = PR_GSContinue;
2907 } else if (pr->rbestpath.rlen == 0) {
2908 pr->rgState = PR_GSNotFound;
2910 pr->rgState = PR_GSFound;
2913 if (pr->maxPathLen < pr->ractpath.rlen) {
2914 pr->maxPathLen = pr->ractpath.rlen;
2916 with__0 = & pr->ractpath.rele[pr->ractpath.rlen - 1];
2923 pr_calcPathCost(&pr->ractpath);
2924 if ((pr->rbestpath.rlen == 0) || (pr->ractpath.rcost < pr->rbestpath.rcost)) {
2925 pr->rbestpath.rlen = pr->ractpath.rlen;
2926 pr->rbestpath.rcost = pr->ractpath.rcost;
2927 for (li = 0; li < pr->ractpath.rlen; li++) {
2928 pr->rbestpath.rele[li] = pr->ractpath.rele[li];
2947 ldummy = pr_getProdToken(this, pr);
2951 ldummy = pr_getProdContToken(this, pr);
2954 pr->ractpath.rlen--;
2957 if (pr_getToken(this, pr)) {
2959 } else if (pr->forceOutput) {
2963 pr->rgState = PR_GSNeedToken;
2967 if (pr_getToken(this, pr)) {
2974 switch (pr_matchTokens(this, pr, & with__0->rcompare)) {
2980 ldummy = pr_getNextMultiToken(this, pr);
2984 ldummy = pr_getNextMultiToken(this, pr);
2993 ldummy = pr_getNextToken(this, pr);
2997 ldummy = pr_getAltToken(this, pr);
3004 pr->nrIterations--;
3005 } while ((pr->rgState == PR_GSContinue) && (pr->nrIterations > 0));
3009 void pr_process (picodata_ProcessingUnit this, pr_subobj_t * pr)
3011 switch (pr->rgState) {
3015 pr->ractpath.rlen = 0;
3016 pr->ractpath.rcost = PR_COST_INIT;
3017 pr->rbestpath.rlen = 0;
3018 pr->rbestpath.rcost = PR_COST_INIT;
3019 if (pr_getTopLevelToken(this, pr, TRUE)) {
3020 pr->rgState = PR_GSContinue;
3022 pr->rgState = PR_GSNotFound;
3026 pr_processToken(this, pr);
3029 pr->rgState = PR_GSContinue;
3032 pr->rgState = PR_GS_START;
3038 static void pr_prepareItem (picodata_ProcessingUnit this, pr_subobj_t * pr, pr_ioItemPtr item)
3040 pr->ritems[pr->rnritems + 1] = item;
3041 pr->rnritems++;
3045 static void pr_processItems (picodata_ProcessingUnit this, pr_subobj_t * pr)
3052 while ((pr->rinItemList != NULL) && (pr->rinItemList->head.type != PICODATA_ITEM_TOKEN)) {
3053 lit = pr->rinItemList;
3056 pr->rinItemList = pr->rinItemList->next;
3059 pr->insidePhoneme = TRUE;
3061 pr->insidePhoneme = FALSE;
3063 if (pr->insidePhoneme && (pr_isCmdType(lit,PICODATA_ITEMINFO1_CMD_PLAY) || pr_isCmdType(lit,PICODATA_ITEMINFO1_CMD_IGNSIG))) {
3066 pr_setContext(this, pr, lit->data);
3068 } else if (pr->rignore <= 0) {
3069 pr_appendItemToOutItemList(this, pr, & pr->routItemList,& pr->rlastOutItem,lit);
3070 if (pr->outOfMemory) return;
3074 pr->rgState = PR_GS_START;
3076 if (pr->rinItemList != NULL) {
3077 pr_process(this, pr);
3078 if (pr->rgState == PR_GSNotFound) {
3079 lit = pr->rinItemList;
3080 pr->rinItemList = pr->rinItemList->next;
3083 if (pr->rignore <= 0) {
3088 pr->insidePhoneme = TRUE;
3090 pr->insidePhoneme = FALSE;
3092 if (((pr->rignore <= 0) && !((pr->insidePhoneme && (pr_isCmdType(lit,PICODATA_ITEMINFO1_CMD_PLAY) || pr_isCmdType(lit,PICODATA_ITEMINFO1_CMD_IGNSIG)))))) {
3093 pr_appendItemToOutItemList(this, pr, & pr->routItemList,& pr->rlastOutItem,lit);
3094 if (pr->outOfMemory) return;
3098 pr->rgState = PR_GS_START;
3099 pr->rnritems = 0;
3100 } else if (pr->rgState == PR_GSFound) {
3101 pr_outputPath(this, pr);
3102 if (pr->outOfMemory) return;
3103 pr->rgState = PR_GS_START;
3104 pr->rnritems = 0;
3107 if (pr->rinItemList == NULL) {
3108 pr->rlastInItem = NULL;
3109 } else if (pr->rnritems == 0) {
3110 lit = pr->rinItemList;
3113 pr_prepareItem(this, pr, lit);
3123 extern void pr_treatItem (picodata_ProcessingUnit this, pr_subobj_t * pr, pr_ioItemPtr item)
3127 pr_startItemList(& pr->routItemList,& pr->rlastOutItem);
3129 if (!PR_ENABLED || (pr->rgState == PR_GSNoPreproc)) {
3134 pr_appendItemToOutItemList(this, pr, & pr->routItemList,& pr->rlastOutItem,item);
3137 if (pr->actCtxChanged) {
3138 pr->rgState = PR_GS_START;
3139 pr->ractpath.rcost = PR_COST_INIT;
3140 pr->ractpath.rlen = 0;
3141 pr->rbestpath.rcost = PR_COST_INIT;
3142 pr->rbestpath.rlen = 0;
3143 pr->prodList = NULL;
3144 pr->rnritems = 0;
3145 pr->actCtxChanged = FALSE;
3149 pr->forceOutput = TRUE;
3151 pr_appendItem(this, & pr->rinItemList,& pr->rlastInItem, item);
3152 if (pr->rnritems == 0) {
3153 lit = pr->rinItemList;
3156 pr_prepareItem(this, pr, lit);
3161 pr_prepareItem(this, pr, item);
3175 pr_subobj_t * pr;
3180 pr = (pr_subobj_t *) this->subObj;
3182 pr->rinItemList = NULL;
3183 pr->rlastInItem = NULL;
3184 pr->routItemList = NULL;
3185 pr->rlastOutItem = NULL;
3186 pr->ractpath.rcost = PR_COST_INIT;
3187 pr->ractpath.rlen = 0;
3188 pr->rbestpath.rcost = PR_COST_INIT;
3189 pr->rbestpath.rlen = 0;
3190 pr->rnritems = 0;
3191 pr->ritems[0] = NULL;
3192 pr->rignore = 0;
3193 pr->spellMode = 0;
3194 pr->maxPathLen = 0;
3195 pr->insidePhoneme = FALSE;
3196 pr->saveFile[0] = 0;
3198 pr->outReadPos = 0;
3199 pr->outWritePos = 0;
3200 pr->inBufLen = 0;
3202 pr->rgState = PR_GSNoPreproc;
3204 if (pr->preproc[i] != NULL) {
3205 pr->rgState = PR_GS_START;
3208 pr->actCtx = pr_findContext(pr->ctxList, (picoos_uchar*)PICO_CONTEXT_DEFAULT);
3209 pr->actCtxChanged = FALSE;
3210 pr->prodList = NULL;
3212 if (((picoos_uint32)pr->pr_WorkMem % PICOOS_ALIGN_SIZE) == 0) {
3213 pr->workMemTop = 0;
3216 pr->workMemTop = PICOOS_ALIGN_SIZE - ((picoos_uint32)pr->pr_WorkMem % PICOOS_ALIGN_SIZE);
3218 pr->maxWorkMemTop=0;
3219 pr->dynMemSize=0;
3220 pr->maxDynMemSize=0;
3221 /* this is ok to be in 'initialize' because it is a private memory within pr. Creating a new mm
3224 pr->dynMemMM = picoos_newMemoryManager((void *)pr->pr_DynMem, PR_DYN_MEM_SIZE,
3226 pr->outOfMemory = FALSE;
3228 pr->forceOutput = FALSE;
3235 pr->xsampa_parser = picokfst_getFST(this->voice->kbArray[PICOKNOW_KBID_FST_XSAMPA_PARSE]);
3237 pr->svoxpa_parser = picokfst_getFST(this->voice->kbArray[PICOKNOW_KBID_FST_SVOXPA_PARSE]);
3239 pr->xsampa2svoxpa_mapper = picokfst_getFST(this->voice->kbArray[PICOKNOW_KBID_FST_XSAMPA2SVOXPA]);
3268 pr_subobj_t * pr;
3271 pr = (pr_subobj_t *) this->subObj;
3273 PICODBG_INFO(("max pr_WorkMem: %i of %i", pr->maxWorkMemTop, PR_WORK_MEM_SIZE));
3274 PICODBG_INFO(("max pr_DynMem: %i of %i", pr->maxDynMemSize, PR_DYN_MEM_SIZE));
3287 pr_subobj_t * pr;
3309 pr = (pr_subobj_t *) this->subObj;
3311 pr->graphs = picoktab_getGraphs(this->voice->kbArray[PICOKNOW_KBID_TAB_GRAPHS]);
3312 pr
3314 pr->preproc[1+i] = picokpr_getPreproc(this->voice->kbArray[PICOKNOW_KBID_TPP_USER_1+i]);
3332 register pr_subobj_t * pr;
3350 pr = (pr_subobj_t *) this->subObj;
3352 if (pr->outOfMemory) return PICODATA_PU_ERROR;
3355 pr->nrIterations = PR_MAX_NR_ITERATIONS;
3359 if ((pr->outWritePos - pr->outReadPos) > 0) {
3361 if (picodata_cbPutItem(this->cbOut, &pr->outBuf[pr->outReadPos], pr->outWritePos - pr->outReadPos, numBytesOutput) == PICO_OK) {
3362 pr->outReadPos += *numBytesOutput;
3363 if (pr->outWritePos == pr->outReadPos) {
3364 pr->outWritePos = 0;
3365 pr->outReadPos = 0;
3372 else if (pr->routItemList != NULL) {
3374 it = pr->routItemList;
3375 pr->routItemList = pr->routItemList->next;
3376 if (pr->routItemList == NULL) {
3377 pr->rlastOutItem = NULL;
3383 && (((id = picoktab_graphOffset(pr->graphs, it->data)) > 0))
3384 && picoktab_getIntPropPunct(pr->graphs, id, &info1, &info2)) {
3387 pr->outBuf[pr->outWritePos++] = PICODATA_ITEM_PUNC;
3388 pr->outBuf[pr->outWritePos++] = info1;
3389 pr->outBuf[pr->outWritePos++] = info2;
3390 pr->outBuf[pr->outWritePos++] = 0;
3392 (picoos_uint8 *)"pr: ", pr->outBuf, pr->outWritePos);
3398 pr->outBuf[pr->outWritePos++] = PICODATA_ITEM_WORDGRAPH;
3399 pr->outBuf[pr->outWritePos++] = PICODATA_ITEMINFO1_NA;
3400 pr->outBuf[pr->outWritePos++] = PICODATA_ITEMINFO2_NA;
3401 lenpos=pr->outWritePos;
3402 pr->outBuf[pr->outWritePos++] = 0;
3414 else if (((id = picoktab_graphOffset(pr->graphs, inUtf8char)) > 0) && picoktab_getStrPropGraphsubs1(pr->graphs, id, outUtf8char)) {
3417 pr->outBuf[pr->outWritePos++] = PICODATA_ITEM_WORDGRAPH;
3418 pr->outBuf[pr->outWritePos++] = PICODATA_ITEMINFO1_NA;
3419 pr->outBuf[pr->outWritePos++] = PICODATA_ITEMINFO2_NA;
3420 lenpos=pr->outWritePos;
3421 pr->outBuf[pr->outWritePos++] = 0;
3425 pr->outBuf[pr->outWritePos++] = outUtf8char[i];
3426 pr->outBuf[lenpos]++;
3428 if (picoktab_getStrPropGraphsubs2(pr->graphs, id, outUtf8char)) {
3431 pr->outBuf[pr->outWritePos++] = outUtf8char[i];
3432 pr->outBuf[lenpos]++;
3440 pr->outBuf[pr->outWritePos++] = PICODATA_ITEM_WORDGRAPH;
3441 pr->outBuf[pr->outWritePos++] = PICODATA_ITEMINFO1_NA;
3442 pr->outBuf[pr->outWritePos++] = PICODATA_ITEMINFO2_NA;
3443 lenpos=pr->outWritePos;
3444 pr->outBuf[pr->outWritePos++] = 0;
3448 pr->outBuf[pr->outWritePos++] = inUtf8char[i];
3449 pr->outBuf[lenpos]++;
3456 (picoos_uint8 *)"pr: ", pr->outBuf, pr->outWritePos);
3462 pr->outBuf[pr->outWritePos++] = it->head.type;
3463 pr->outBuf[pr->outWritePos++] = it->head.info1;
3464 pr->outBuf[pr->outWritePos++] = it->head.info2;
3465 pr->outBuf[pr->outWritePos++] = it->head.len;
3467 pr->outBuf[pr->outWritePos++] = it->data[i];
3470 (picoos_uint8 *)"pr: ", pr->outBuf, pr->outWritePos);
3474 else if (pr->forceOutput) {
3475 pr_processItems(this, pr);
3476 if (pr->rinItemList == NULL) {
3477 pr->forceOutput = FALSE;
3480 else if ((pr->rgState != PR_GSNeedToken) && (pr->rinItemList != NULL)) {
3481 pr_processItems(this, pr);
3483 else if (pr->inBufLen > 0) {
3486 if (pr->dynMemSize < (45*PR_DYN_MEM_SIZE / 100)) {
3487 pr_newItem(this, pr_DynMem, &it, pr->inBuf[0], pr->inBuf[3], /*inItem*/TRUE);
3488 if (pr->outOfMemory) return PICODATA_PU_ERROR;
3489 it->head.type = pr->inBuf[0];
3490 it->head.info1 = pr->inBuf[1];
3491 it->head.info2 = pr->inBuf[2];
3492 it->head.len = pr->inBuf[3];
3493 for (i=0; i<pr->inBuf[3]; i++) {
3494 it->data[i] = pr->inBuf[4+i];
3496 it->data[pr->inBuf[3]] = 0;
3497 if ((pr->inBuf[0] == PICODATA_ITEM_TOKEN) && ((pr->inBuf[1] == PICODATA_ITEMINFO1_TOKTYPE_DIGIT))) {
3498 it->val = tok_tokenDigitStrToInt(this, pr, it->data);
3502 if (pr->inBuf[0] == PICODATA_ITEM_TOKEN) {
3510 pr_treatItem(this, pr, it);
3511 if (pr->outOfMemory) return PICODATA_PU_ERROR;
3512 pr_processItems(this, pr);
3513 pr->inBufLen = 0;
3516 pr->forceOutput = TRUE;
3522 rv = picodata_cbGetItem(this->cbIn, pr->inBuf, IN_BUF_SIZE+PICODATA_ITEM_HEADSIZE, &pr->inBufLen);
3528 pr->inBufLen = 0;
3533 pr->inBufLen = 0;
3540 PICODBG_INFO(("memory: dyn=%u, work=%u", pr->dynMemSize, pr->workMemTop));
3542 if (pr->nrIterations <= 0) {