亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? affixmgr.cxx

?? 管理項(xiàng)目進(jìn)度工具的原代碼
?? CXX
?? 第 1 頁 / 共 3 頁
字號:
#include "license.readme"

#include <cstdlib>
#include <cstring>
#include <cstdio>

#include "affixmgr.hxx"
#include "affentry.hxx"

//using namespace std;
#pragma warning(disable:4244)
#pragma warning(disable:4514)
#pragma warning(disable:4706)

// First some base level utility routines
extern void   mychomp(char * s);
extern char * mystrdup(const char * s);
extern char * myrevstrdup(const char * s);
extern char * mystrsep(char ** sptr, const char delim);
extern int    isSubset(const char * s1, const char * s2); 
extern int    isRevSubset(const char * s1, const char * end_of_s2, int len_s2); 


AffixMgr::AffixMgr(const char * affpath, HashMgr* ptr) 
{
  // register hash manager and load affix data from aff file
  pHMgr = ptr;
  trystring = NULL;
  encoding=NULL;
  reptable = NULL;
  numrep = 0;
  maptable = NULL;
  nummap = 0;
  compound=NULL;
  nosplitsugs= (0==1);

  cpdmin = 3;  // default value
  for (int i=0; i < SETSIZE; i++) {
     pStart[i] = NULL;
     sStart[i] = NULL;
     pFlag[i] = NULL;
     sFlag[i] = NULL;
  }
  if (parse_file(affpath)) {
     fprintf(stderr,"Failure loading aff file %s\n",affpath);
     fflush(stderr);
  }
}


AffixMgr::~AffixMgr() 
{
 
  // pass through linked prefix entries and clean up
  for (int i=0; i < SETSIZE ;i++) {
       pFlag[i] = NULL;
       PfxEntry * ptr = (PfxEntry *)pStart[i];
       PfxEntry * nptr = NULL;
       while (ptr) {
            nptr = ptr->getNext();
            delete(ptr);
            ptr = nptr;
            nptr = NULL;
       }  
  }

  // pass through linked suffix entries and clean up
  for (int j=0; j < SETSIZE ; j++) {
       sFlag[j] = NULL;
       SfxEntry * ptr = (SfxEntry *)sStart[j];
       SfxEntry * nptr = NULL;
       while (ptr) {
            nptr = ptr->getNext();
            delete(ptr);
            ptr = nptr;
            nptr = NULL;
       }  
  }

  if (trystring) free(trystring);
  trystring=NULL;
  if (encoding) free(encoding);
  encoding=NULL;
  if (maptable) {  
     for (int j=0; j < nummap; j++) {
        free(maptable[j].set);
        maptable[j].set = NULL;
        maptable[j].len = 0;
     }
     free(maptable);  
     maptable = NULL;
  }
  nummap = 0;
  if (reptable) {  
     for (int j=0; j < numrep; j++) {
        free(reptable[j].pattern);
        free(reptable[j].replacement);
        reptable[j].pattern = NULL;
        reptable[j].replacement = NULL;
     }
     free(reptable);  
     reptable = NULL;
  }
  numrep = 0;
  if (compound) free(compound);
  compound=NULL;
  pHMgr = NULL;
  cpdmin = 0;
}


// read in aff file and build up prefix and suffix entry objects 
int  AffixMgr::parse_file(const char * affpath)
{

  // io buffers
  char line[MAXLNLEN+1];
 
  // affix type
  char ft;

  // open the affix file
  FILE * afflst;
  afflst = fopen(affpath,"r");
  if (!afflst) {
    fprintf(stderr,"Error - could not open affix description file %s\n",affpath);
    return 1;
  }

  // step one is to parse the affix file building up the internal
  // affix data structures


    // read in each line ignoring any that do not
    // start with a known line type indicator

    while (fgets(line,MAXLNLEN,afflst)) {
       mychomp(line);

       /* parse in the try string */
       if (strncmp(line,"TRY",3) == 0) {
          if (parse_try(line)) {
             return 1;
          }
       }

       /* parse in the name of the character set used by the .dict and .aff */
       if (strncmp(line,"SET",3) == 0) {
          if (parse_set(line)) {
             return 1;
          }
       }

       /* parse in the flag used by the controlled compound words */
       if (strncmp(line,"COMPOUNDFLAG",12) == 0) {
          if (parse_cpdflag(line)) {
             return 1;
          }
       }

       /* parse in the flag used by the controlled compound words */
       if (strncmp(line,"COMPOUNDMIN",11) == 0) {
          if (parse_cpdmin(line)) {
             return 1;
          }
       }

       /* parse in the typical fault correcting table */
       if (strncmp(line,"REP",3) == 0) {
          if (parse_reptable(line, afflst)) {
             return 1;
          }
       }

       /* parse in the related character map table */
       if (strncmp(line,"MAP",3) == 0) {
          if (parse_maptable(line, afflst)) {
             return 1;
          }
       }

       // parse this affix: P - prefix, S - suffix
       ft = ' ';
       if (strncmp(line,"PFX",3) == 0) ft = 'P';
       if (strncmp(line,"SFX",3) == 0) ft = 'S';
       if (ft != ' ') {
          if (parse_affix(line, ft, afflst)) {
             return 1;
          }
       }

       // handle NOSPLITSUGS
       if (strncmp(line,"NOSPLITSUGS",11) == 0)
		   nosplitsugs=(0==0);

    }
    fclose(afflst);

    // convert affix trees to sorted list
    process_pfx_tree_to_list();
    process_sfx_tree_to_list();

    // now we can speed up performance greatly taking advantage of the 
    // relationship between the affixes and the idea of "subsets".

    // View each prefix as a potential leading subset of another and view
    // each suffix (reversed) as a potential trailing subset of another.

    // To illustrate this relationship if we know the prefix "ab" is found in the
    // word to examine, only prefixes that "ab" is a leading subset of need be examined.
    // Furthermore is "ab" is not present then none of the prefixes that "ab" is
    // is a subset need be examined.
    // The same argument goes for suffix string that are reversed.

    // Then to top this off why not examine the first char of the word to quickly
    // limit the set of prefixes to examine (i.e. the prefixes to examine must 
    // be leading supersets of the first character of the word (if they exist)
 
    // To take advantage of this "subset" relationship, we need to add two links
    // from entry.  One to take next if the current prefix is found (call it nexteq)
    // and one to take next if the current prefix is not found (call it nextne).

    // Since we have built ordered lists, all that remains is to properly intialize 
    // the nextne and nexteq pointers that relate them

    process_pfx_order();
    process_sfx_order();

    return 0;
}


// we want to be able to quickly access prefix information
// both by prefix flag, and sorted by prefix string itself 
// so we need to set up two indexes

int AffixMgr::build_pfxtree(AffEntry* pfxptr)
{
  PfxEntry * ptr;
  PfxEntry * pptr;
  PfxEntry * ep = (PfxEntry*) pfxptr;

  // get the right starting points
  const char * key = ep->getKey();
  const unsigned char flg = ep->getFlag();

  // first index by flag which must exist
  ptr = (PfxEntry*)pFlag[flg];
  ep->setFlgNxt(ptr);
  pFlag[flg] = (AffEntry *) ep;


  // handle the special case of null affix string
  if (strlen(key) == 0) {
    // always inset them at head of list at element 0
     ptr = (PfxEntry*)pStart[0];
     ep->setNext(ptr);
     pStart[0] = (AffEntry*)ep;
     return 0;
  }

  // now handle the normal case
  ep->setNextEQ(NULL);
  ep->setNextNE(NULL);

  unsigned char sp = *((const unsigned char *)key);
  ptr = (PfxEntry*)pStart[sp];
  
  // handle the first insert 
  if (!ptr) {
     pStart[sp] = (AffEntry*)ep;
     return 0;
  }


  // otherwise use binary tree insertion so that a sorted
  // list can easily be generated later
  pptr = NULL;
  for (;;) {
    pptr = ptr;
    if (strcmp(ep->getKey(), ptr->getKey() ) <= 0) {
       ptr = ptr->getNextEQ();
       if (!ptr) {
	  pptr->setNextEQ(ep);
          break;
       }
    } else {
       ptr = ptr->getNextNE();
       if (!ptr) {
	  pptr->setNextNE(ep);
          break;
       }
    }
  }
  return 0;
}



// we want to be able to quickly access suffix information
// both by suffix flag, and sorted by the reverse of the
// suffix string itself; so we need to set up two indexes
int AffixMgr::build_sfxtree(AffEntry* sfxptr)
{
  SfxEntry * ptr;
  SfxEntry * pptr;
  SfxEntry * ep = (SfxEntry *) sfxptr;

  /* get the right starting point */
  const char * key = ep->getKey();
  const unsigned char flg = ep->getFlag();

  // first index by flag which must exist
  ptr = (SfxEntry*)sFlag[flg];
  ep->setFlgNxt(ptr);
  sFlag[flg] = (AffEntry *) ep;


  // next index by affix string

  // handle the special case of null affix string
  if (strlen(key) == 0) {
    // always inset them at head of list at element 0
     ptr = (SfxEntry*)sStart[0];
     ep->setNext(ptr);
     sStart[0] = (AffEntry*)ep;
     return 0;
  }

  // now handle the normal case
  ep->setNextEQ(NULL);
  ep->setNextNE(NULL);

  unsigned char sp = *((const unsigned char *)key);
  ptr = (SfxEntry*)sStart[sp];
  
  // handle the first insert 
  if (!ptr) {
     sStart[sp] = (AffEntry*)ep;
     return 0;
  }


  // otherwise use binary tree insertion so that a sorted
  // list can easily be generated later
  pptr = NULL;
  for (;;) {
    pptr = ptr;
    if (strcmp(ep->getKey(), ptr->getKey() ) <= 0) {
       ptr = ptr->getNextEQ();
       if (!ptr) {
	  pptr->setNextEQ(ep);
          break;
       }
    } else {
       ptr = ptr->getNextNE();
       if (!ptr) {
	  pptr->setNextNE(ep);
          break;
       }
    }
  }
  return 0;
}


// convert from binary tree to sorted list
int AffixMgr::process_pfx_tree_to_list()
{
  for (int i=1; i< SETSIZE; i++) {
    pStart[i] = process_pfx_in_order(pStart[i],NULL);
  }
  return 0;
}


AffEntry* AffixMgr::process_pfx_in_order(AffEntry* ptr, AffEntry* nptr)
{
  if (ptr) {
    nptr = process_pfx_in_order(((PfxEntry*) ptr)->getNextNE(), nptr);
    ((PfxEntry*) ptr)->setNext((PfxEntry*) nptr);
    nptr = process_pfx_in_order(((PfxEntry*) ptr)->getNextEQ(), ptr);
  }
  return nptr;
}


// convert from binary tree to sorted list
int AffixMgr:: process_sfx_tree_to_list()
{
  for (int i=1; i< SETSIZE; i++) {
    sStart[i] = process_sfx_in_order(sStart[i],NULL);
  }
  return 0;
}

AffEntry* AffixMgr::process_sfx_in_order(AffEntry* ptr, AffEntry* nptr)
{
  if (ptr) {
    nptr = process_sfx_in_order(((SfxEntry*) ptr)->getNextNE(), nptr);
    ((SfxEntry*) ptr)->setNext((SfxEntry*) nptr);
    nptr = process_sfx_in_order(((SfxEntry*) ptr)->getNextEQ(), ptr);
  }
  return nptr;
}



// reinitialize the PfxEntry links NextEQ and NextNE to speed searching
// using the idea of leading subsets this time
int AffixMgr::process_pfx_order()
{
    PfxEntry* ptr;

    // loop through each prefix list starting point
    for (int i=1; i < SETSIZE; i++) {

         ptr = (PfxEntry*)pStart[i];

         // look through the remainder of the list
         //  and find next entry with affix that 
         // the current one is not a subset of
         // mark that as destination for NextNE
         // use next in list that you are a subset
         // of as NextEQ

         for (; ptr != NULL; ptr = ptr->getNext()) {

	     PfxEntry * nptr = ptr->getNext();
             for (; nptr != NULL; nptr = nptr->getNext()) {
	         if (! isSubset( ptr->getKey() , nptr->getKey() )) break;
             }
             ptr->setNextNE(nptr);
             ptr->setNextEQ(NULL);
             if ((ptr->getNext()) && isSubset(ptr->getKey() , (ptr->getNext())->getKey())) 
                 ptr->setNextEQ(ptr->getNext());

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久草中文综合在线| 国产尤物一区二区在线| 一本久道中文字幕精品亚洲嫩| 久久精品欧美日韩精品| 国产乱子伦视频一区二区三区| 日韩一级大片在线| 韩国精品久久久| 国产欧美日本一区二区三区| 成人激情动漫在线观看| 最新国产成人在线观看| 免费观看日韩电影| 色综合久久综合网欧美综合网| 国产精品成人一区二区艾草 | 在线综合视频播放| 亚洲欧洲www| 久久国产欧美日韩精品| 大胆亚洲人体视频| 精品国产91洋老外米糕| 国产成人免费在线观看不卡| ㊣最新国产の精品bt伙计久久| 一本久久精品一区二区| 日韩精品91亚洲二区在线观看| 欧美一区二区三区视频免费播放| 九色综合国产一区二区三区| 国产精品久久久久一区二区三区 | 中文字幕在线观看不卡视频| 在线亚洲欧美专区二区| 蜜桃视频在线一区| 国产精品免费视频观看| 9191国产精品| 成人av电影在线观看| 亚洲成va人在线观看| 久久综合成人精品亚洲另类欧美| 99久久免费精品| 日韩成人午夜电影| 国产精品免费丝袜| 日韩亚洲欧美一区二区三区| 成人av电影免费在线播放| 亚洲3atv精品一区二区三区| 国产色婷婷亚洲99精品小说| 欧美午夜电影网| 国产高清在线精品| 五月天激情综合网| 亚洲欧美综合另类在线卡通| 日韩精品中午字幕| 欧美午夜一区二区三区| 国产麻豆精品视频| 免费在线成人网| 亚洲成人一区二区在线观看| 国产精品美女一区二区三区| 日韩欧美在线不卡| 在线一区二区三区四区五区| 国产精品1区二区.| 麻豆成人综合网| 一卡二卡三卡日韩欧美| 亚洲欧洲一区二区在线播放| xnxx国产精品| 欧美一区二区三区婷婷月色 | 一区二区三区在线免费| 久久这里只有精品视频网| 欧美日韩免费电影| 91视频.com| 成a人片国产精品| 国产成人综合自拍| 韩国女主播成人在线| 久久精品国产99| 五月天久久比比资源色| 亚洲影视在线观看| 一区二区三区91| 亚洲欧美精品午睡沙发| 日韩一区在线免费观看| 国产精品欧美精品| 中文字幕亚洲区| 国产精品初高中害羞小美女文| 久久久久成人黄色影片| 国产午夜精品美女毛片视频| 精品国产乱码久久久久久夜甘婷婷 | 久久成人av少妇免费| 偷拍一区二区三区| 日本va欧美va欧美va精品| 五月婷婷激情综合| 日本午夜一本久久久综合| 日韩极品在线观看| 午夜精品福利在线| 日本欧美久久久久免费播放网| 亚洲电影第三页| 人人爽香蕉精品| 免费av成人在线| 国产美女精品人人做人人爽| 国产美女视频91| youjizz久久| 91国偷自产一区二区三区观看| 色视频欧美一区二区三区| 欧美三区在线视频| 日韩久久免费av| 中文字幕第一区二区| 亚洲乱码国产乱码精品精小说| 一区二区三区产品免费精品久久75| 亚洲国产日韩一级| 免费高清视频精品| 国产精一品亚洲二区在线视频| 国产精品99久久久久久宅男| 99久久er热在这里只有精品15| 在线日韩av片| 91麻豆精品国产无毒不卡在线观看| 日韩美女视频一区二区在线观看| 精品国产91久久久久久久妲己| 欧美国产亚洲另类动漫| 一区二区三区在线免费观看| 奇米在线7777在线精品| 岛国一区二区在线观看| 欧洲精品在线观看| 精品国产露脸精彩对白| 国产欧美日韩精品在线| 亚洲精品国产a| 狠狠色综合播放一区二区| 99精品黄色片免费大全| 日韩欧美在线网站| 亚洲免费在线视频| 久久99热这里只有精品| 91麻豆国产香蕉久久精品| 欧美一区二区三区在线视频| 国产精品成人免费| 日本亚洲最大的色成网站www| 成人高清视频在线| 制服丝袜中文字幕一区| 国产精品无码永久免费888| 午夜精品一区二区三区免费视频| 国产福利一区二区三区| 7799精品视频| 综合久久综合久久| 精品一区精品二区高清| 欧美亚洲国产一区二区三区va| 2020国产精品自拍| 亚洲综合激情网| 成人av在线看| 欧美精品一区二区三区一线天视频| 亚洲日本在线天堂| 国产成人超碰人人澡人人澡| 欧美精品第1页| 亚洲欧洲韩国日本视频| 国产麻豆日韩欧美久久| 欧美一区二区观看视频| 亚洲欧美一区二区不卡| 国产成人免费视频一区| 日韩美女一区二区三区| 性欧美疯狂xxxxbbbb| 色综合色综合色综合| 国产欧美一区在线| 国产精品中文欧美| 日韩你懂的在线播放| 日韩有码一区二区三区| 欧美性受xxxx黑人xyx| 亚洲人成在线观看一区二区| 国产成人在线观看| 久久亚洲影视婷婷| 久久精品二区亚洲w码| 欧美精品 国产精品| 亚洲国产视频直播| 在线视频国产一区| 一区二区不卡在线播放| 色欧美88888久久久久久影院| 日本一区二区三区dvd视频在线| 裸体一区二区三区| 欧美成人a在线| 麻豆久久一区二区| 亚洲精品一区二区三区精华液| 免费成人av在线| 26uuu欧美| 国产精品88888| 日本一区二区三区国色天香 | 亚洲精品伦理在线| 色婷婷国产精品综合在线观看| 国产精品第一页第二页第三页| 粉嫩aⅴ一区二区三区四区| 欧美激情资源网| 99精品久久久久久| 亚洲一区二三区| 欧美精品高清视频| 久久99最新地址| 国产日韩成人精品| eeuss国产一区二区三区| 一区在线观看视频| 91官网在线免费观看| 日韩激情视频网站| 久久伊99综合婷婷久久伊| 激情国产一区二区| 国产欧美久久久精品影院| 91网址在线看| 五月天亚洲精品| 精品成人私密视频| 成人黄色a**站在线观看| 一区二区三区在线免费| 欧美一区二区三区四区视频| 国产高清亚洲一区| 一区二区三区四区在线播放 | 国产传媒欧美日韩成人| 亚洲视频香蕉人妖| 欧美精品久久久久久久久老牛影院| 六月婷婷色综合|