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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? scim_pinyin.cpp

?? 嵌入式Linux上的拼音輸入法
?? CPP
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
	for (unsigned int i=0; i<sizeof(rules)/sizeof(ReplaceRulePair); i++) {
		if (rules[i].initial == initial && rules[i].final == final) {
			initial = rules[i].new_initial;
			final = rules[i].new_final;
			break;
		}
	}

	if (initial != SCIM_PINYIN_ZeroInitial && final == SCIM_PINYIN_Iou)
		final = SCIM_PINYIN_Iu;
	if (initial != SCIM_PINYIN_ZeroInitial && final == SCIM_PINYIN_Uei)
		final = SCIM_PINYIN_Ui;
	if (initial != SCIM_PINYIN_ZeroInitial && final == SCIM_PINYIN_Uen)
		final = SCIM_PINYIN_Un;
}

int
PinyinKey::parse_pinyin_key (const PinyinValidator &validator,
							 PinyinParsedKeyVector &vec,
							 const char *key)
{
#if 0
	vec.clear ();

	int usedlen = 0;
	int keylen = strlen (key);

	if (keylen <= 0) return 0;

	PinyinParsedKey aKey;

	while (usedlen < keylen) {
		if (!isalpha (*key)) {
			key ++;
			usedlen ++;
			continue;
		}

		int len = aKey.set_key (validator, key);
		if (len) {
			aKey.set_pos (usedlen);
			aKey.set_length (len);
			vec.push_back (aKey);
		} else {
			break;
		}

		key += len;
		usedlen += len;
	}
	return usedlen;
#else
	vec.clear ();

	int keylen = strlen (key);
	if (keylen <= 0) return 0;

	PinyinParsedKey aKey;
	int usedlen = 0;
	int len;
	bool found;

	const char *key_start, *key_end;

	key_end = key + keylen;

	while (key_end > key) {

		if (*(key_end-1) == '\'') {
			--key_end;
			--keylen;
			if (keylen == 0) break;
		}

		key_start = std::max (key_end - SCIM_PINYIN_KEY_MAXLEN, key);
		found = false;

		while (key_start < key_end) {
			if (isalpha (*key_start)) {
				len = aKey.set_key (validator, key_start, key_end - key_start);
				if (len == key_end - key_start) {
					found = true;
					aKey.set_pos (key_start - key);
					aKey.set_length (len);
					usedlen += len;
					key_end = key_start;
					vec.push_back (aKey);
					break;
				}
			}
			++ key_start;
		}
		if (!found) {
			-- keylen;
			key_end = key + keylen; 
			usedlen = 0;
			vec.clear ();
		}
	}

	std::reverse (vec.begin (), vec.end ());

	return usedlen;
#endif
}

int
PinyinKey::parse_pinyin_key (const PinyinValidator &validator,
							 PinyinKeyVector &vec,
							 const char *key)
{
#if 0
	vec.clear ();

	int usedlen = 0;
	int keylen = strlen (key);

	if (keylen <= 0) return 0;

	PinyinKey aKey;

	while (usedlen < keylen) {
		if (!isalpha (*key)) {
			key ++;
			usedlen ++;
			continue;
		}

		int len = aKey.set_key (validator, key);
		if (len && validator (aKey)) {
			vec.push_back (aKey);
		} else if (!len) break;
		key += len;
		usedlen += len;
	}
	return usedlen;
#else
	vec.clear ();

	int keylen = strlen (key);
	if (keylen <= 0) return 0;

	PinyinKey aKey;
	int usedlen = 0;
	int len;
	bool found;

	const char *key_start, *key_end;

	key_end = key + keylen;

	while (key_end > key) {
		
		if (*(key_end-1) == '\'') {
			--key_end;
			--keylen;
			if (keylen == 0) break;
		}

		key_start = std::max (key_end - SCIM_PINYIN_KEY_MAXLEN, key);
		found = false;

		while (key_start < key_end) {
			if (isalpha (*key_start)) {
				len = aKey.set_key (validator, key_start, key_end - key_start);
				if (len == key_end - key_start) {
					found = true;
					usedlen += len;
					key_end = key_start;
					vec.push_back (aKey);
					break;
				}
			}
			++ key_start;
		}
		if (!found) {
			-- keylen;
			key_end = key + keylen; 
			usedlen = 0;
			vec.clear ();
		}
	}

	std::reverse (vec.begin (), vec.end ());

	return usedlen;
#endif
}

//////////////////////////////////////////////////////////////////////////////
// implementation of PinyinValidator
PinyinValidator::PinyinValidator (/*const PinyinCustomSettings &custom,(*/
								  const PinyinTable *table)
{
	initialize (/*custom, */table);
}

void
PinyinValidator::initialize (/*const PinyinCustomSettings &custom,*/
							 const PinyinTable *table)
{
	memset (m_bitmap, 0, PinyinValidatorBitmapSize);

	if (!table || table->size() <=0) return;

	for (int i=0; i<SCIM_PINYIN_InitialNumber; i++) {
		for (int j=0; j<SCIM_PINYIN_FinalNumber; j++) {
			for (int k=0; k<SCIM_PINYIN_ToneNumber; k++) {
				PinyinKey key(static_cast<PinyinInitial>(i),
							  static_cast<PinyinFinal>(j),
							  static_cast<PinyinTone>(k));
				if (!table->has_key (key)) {
					int val = (k * SCIM_PINYIN_FinalNumber + j) * SCIM_PINYIN_InitialNumber + i;
					m_bitmap [val >> 3] |= (1 << (val % 8));
				}
			}
		}
	}
}

bool
PinyinValidator::operator () (PinyinKey key) const
{
	if (key.get_initial () == SCIM_PINYIN_ZeroInitial && key.get_final () == SCIM_PINYIN_ZeroFinal)
		return false;

	int val = (key.get_tone () * SCIM_PINYIN_FinalNumber + key.get_final ()) *
				SCIM_PINYIN_InitialNumber + key.get_initial ();

	return  (m_bitmap [ val >> 3 ] & (1 << (val % 8))) == 0;
}

/*
//////////////////////////////////////////////////////////////////////////////
// implementation of PinyinKey comparision classes
static int
__scim_pinyin_compare_initial (const PinyinCustomSettings &custom,
							   PinyinInitial lhs,
							   PinyinInitial rhs)
{
	// Ambiguity LeRi, NeLe, FoHe will break binary search
	// we treat them as special cases
	if (custom.use_ambiguities [SCIM_PINYIN_AmbLeRi]) {
		if (lhs == SCIM_PINYIN_Ri) lhs = SCIM_PINYIN_Le;
		if (rhs == SCIM_PINYIN_Ri) rhs = SCIM_PINYIN_Le;
	}

	if (custom.use_ambiguities [SCIM_PINYIN_AmbNeLe]) {
		if (lhs == SCIM_PINYIN_Ne) lhs = SCIM_PINYIN_Le;
		if (rhs == SCIM_PINYIN_Ne) rhs = SCIM_PINYIN_Le;
	}

	if (custom.use_ambiguities [SCIM_PINYIN_AmbFoHe]) {
		if (lhs == SCIM_PINYIN_He) lhs = SCIM_PINYIN_Fo;
		if (rhs == SCIM_PINYIN_He) rhs = SCIM_PINYIN_Fo;
	}

	if ((lhs == rhs) ||
		(custom.use_ambiguities [SCIM_PINYIN_AmbZhiZi] &&
		 ((lhs == SCIM_PINYIN_Zhi && rhs == SCIM_PINYIN_Zi) ||
		  (lhs == SCIM_PINYIN_Zi && rhs == SCIM_PINYIN_Zhi))) ||
			  
		(custom.use_ambiguities [SCIM_PINYIN_AmbChiCi] &&
		 ((lhs == SCIM_PINYIN_Chi && rhs == SCIM_PINYIN_Ci) ||
		  (lhs == SCIM_PINYIN_Ci && rhs == SCIM_PINYIN_Chi))) ||
			  
		(custom.use_ambiguities [SCIM_PINYIN_AmbShiSi] &&
		 ((lhs == SCIM_PINYIN_Shi && rhs == SCIM_PINYIN_Si) ||
		  (lhs == SCIM_PINYIN_Si && rhs == SCIM_PINYIN_Shi)))) 
		return 0;
	else if (lhs < rhs) return -1;
	return 1;
}

static int
__scim_pinyin_compare_final (const PinyinCustomSettings &custom,
							 PinyinFinal lhs,
							 PinyinFinal rhs)
{
	if(((lhs == rhs) ||
		(custom.use_ambiguities [SCIM_PINYIN_AmbAnAng] &&
		 ((lhs == SCIM_PINYIN_An && rhs == SCIM_PINYIN_Ang) ||
		  (lhs == SCIM_PINYIN_Ang && rhs == SCIM_PINYIN_An))) ||
			  
		(custom.use_ambiguities [SCIM_PINYIN_AmbEnEng] &&
		 ((lhs == SCIM_PINYIN_En && rhs == SCIM_PINYIN_Eng) ||
		  (lhs == SCIM_PINYIN_Eng && rhs == SCIM_PINYIN_En))) ||
			  
	 	(custom.use_ambiguities [SCIM_PINYIN_AmbInIng] &&
		 ((lhs == SCIM_PINYIN_In && rhs == SCIM_PINYIN_Ing) ||
		  (lhs == SCIM_PINYIN_Ing && rhs == SCIM_PINYIN_In)))))
		return 0;
	else if (custom.use_incomplete && (lhs == SCIM_PINYIN_ZeroFinal || rhs == SCIM_PINYIN_ZeroFinal))
		return 0;
	else if (lhs < rhs) return -1;
	return 1;
}

static int
__scim_pinyin_compare_tone (const PinyinCustomSettings &custom,
							PinyinTone lhs,
							PinyinTone rhs)
{
	if(lhs == rhs || lhs == SCIM_PINYIN_ZeroTone || rhs == SCIM_PINYIN_ZeroTone || !custom.use_tone)
		return 0;
	else if (lhs < rhs) return -1;
	return 1;
}

bool
PinyinKeyLessThan::operator () (PinyinKey lhs, PinyinKey rhs) const
{
	switch (__scim_pinyin_compare_initial (m_custom,
				static_cast<PinyinInitial>(lhs.m_initial),
				static_cast<PinyinInitial>(rhs.m_initial))) {
		case 0:
			switch (__scim_pinyin_compare_final (m_custom,
					  static_cast<PinyinFinal>(lhs.m_final),
					  static_cast<PinyinFinal>(rhs.m_final))) {
				case 0:
					switch (__scim_pinyin_compare_tone (m_custom,
							 static_cast<PinyinTone>(lhs.m_tone),
							 static_cast<PinyinTone>(rhs.m_tone))) {
						case -1:
							return true;
						default:
							return false;
					}
				case -1:
					return true;
				default:
					return false;
			}
		case -1:
			return true;
		default:
			return false;
	}
	return false;
}

bool
PinyinKeyEqualTo::operator () (PinyinKey lhs, PinyinKey rhs) const
{
	if (!__scim_pinyin_compare_initial (m_custom,
			static_cast<PinyinInitial>(lhs.m_initial),
			static_cast<PinyinInitial>(rhs.m_initial)) &&
		!__scim_pinyin_compare_final (m_custom,
			static_cast<PinyinFinal>(lhs.m_final),
			static_cast<PinyinFinal>(rhs.m_final)) &&
		!__scim_pinyin_compare_tone (m_custom,
			static_cast<PinyinTone>(lhs.m_tone),
			static_cast<PinyinTone>(rhs.m_tone)))
		return true;
	return false;
}
*/
//////////////////////////////////////////////////////////////////////////////
// implementation of PinyinEntry
std::ostream&
PinyinEntry::output_text (std::ostream &os) const
{
	m_key.output_text (os) << "\t" << size() << "\t";

	for (std::vector<CharFrequencyPair>::const_iterator i = m_chars.begin(); i != m_chars.end(); i++) {
		utf8_write_wchar (os, i->first);
		os << i->second << ' ';
	}

	os << '\n';

	return os;
}
/*
std::ostream&
PinyinEntry::output_binary (std::ostream &os) const
{
	unsigned char bytes [8];

	m_key.output_binary (os);

	scim_uint32tobytes (bytes, (uint32) size());

	os.write ((char*)bytes, sizeof (unsigned char) * 4);

	for (std::vector<CharFrequencyPair>::const_iterator i = m_chars.begin(); i != m_chars.end(); i++) {
		utf8_write_wchar (os, i->first);
		scim_uint32tobytes (bytes, i->second);
		os.write ((char*)bytes, sizeof (unsigned char) * 4);
	}

	return os;
}
*/
std::istream&
PinyinEntry::input_text (const PinyinValidator &validator, std::istream &is)
{
	m_chars.clear();
	String value;
	uint32 n, len, freq;
	ucs4_t wc;

	m_key.input_text (validator, is);
	is >> n;
	m_chars.reserve (n+1);

	for (uint32 i=0; i<n; i++) {
		is >> value;
		if(strcmp(value.c_str(),"0")==0){
			continue;
		}
		if ((len = utf8_mbtowc (&wc, (const unsigned char*)(value.c_str()), value.length())) > 0) {
			if (value.length () > len)
				freq = atoi (value.c_str() + len);
			else
				freq = 0;
			m_chars.push_back (CharFrequencyPair (wc,freq));
		}
	}
	sort ();

	std::vector <CharFrequencyPair> (m_chars).swap (m_chars);

	return is;
}
/*
std::istream&
PinyinEntry::input_binary (const PinyinValidator &validator, std::istream &is)
{
	m_chars.clear();
	uint32 n, freq;
	ucs4_t wc;

	unsigned char bytes [8];

	m_key.input_binary (validator, is);

	is.read ((char*)bytes, sizeof (unsigned char) * 4);
	n = scim_bytestouint32 (bytes);
	m_chars.reserve (n+1);

	for (uint32 i=0; i<n; i++) {
		if ((wc = utf8_read_wchar (is)) > 0) {
			is.read ((char*)bytes, sizeof (unsigned char) * 4);
			freq = scim_bytestouint32 (bytes);
			m_chars.push_back (CharFrequencyPair (wc, freq));
		}
	}
	sort ();

	std::vector <CharFrequencyPair> (m_chars).swap (m_chars);

	return is;
}
*/
//////////////////////////////////////////////////////////////////////////////
// implementation of PinyinTable
PinyinTable::PinyinTable (/*const PinyinCustomSettings &custom,*/
						  const PinyinValidator *validator,
						  std::istream &is)
	: /*m_revmap_ok (false),
	  m_pinyin_key_less (custom),
	  m_pinyin_key_equal (custom),*/
	  m_validator (validator)
	  //m_custom (custom)
{
	if (!m_validator) m_validator = &scim_default_pinyin_validator;
	
	input (is);
}

PinyinTable::PinyinTable (/*(const PinyinCustomSettings &custom,*/
						  const PinyinValidator *validator,
						  const char *tablefile)
	: /*m_revmap_ok (false),
	  m_pinyin_key_less (custom),
	  m_pinyin_key_equal (custom),*/

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美女视频黄免费的久久| 国产精品久久久久一区| 亚洲一区二区三区四区五区中文| 韩国毛片一区二区三区| 精品国产sm最大网站免费看| 免费在线观看日韩欧美| 欧美tickling网站挠脚心| 青青草国产精品亚洲专区无| 日韩免费性生活视频播放| 国内精品久久久久影院一蜜桃| 精品国产1区2区3区| 成人午夜电影久久影院| 亚洲三级视频在线观看| 欧美日韩国产色站一区二区三区| 午夜精品福利一区二区三区av| 在线不卡免费欧美| 国产最新精品免费| 亚洲丝袜另类动漫二区| 欧美视频在线一区| 久久66热偷产精品| 亚洲欧美在线另类| 欧美理论片在线| 国产一区二区在线看| 国产精品久久三| 欧美视频一区二| 国产成人高清在线| 亚洲va欧美va人人爽午夜| 精品国产麻豆免费人成网站| av电影在线观看一区| 亚洲bt欧美bt精品| 久久久99精品免费观看| 91成人免费在线| 国产美女在线精品| 一区二区三区精品视频| 欧美videos大乳护士334| 91色婷婷久久久久合中文| 青青草伊人久久| 亚洲色图一区二区| 久久理论电影网| 欧美日韩精品欧美日韩精品一综合| 久久99久久精品| 亚洲精品五月天| 久久久亚洲综合| 欧美日韩激情一区二区三区| 福利一区二区在线观看| 偷拍一区二区三区四区| 国产精品免费视频一区| 日韩午夜在线观看视频| 91香蕉视频mp4| 狠狠狠色丁香婷婷综合久久五月| 亚洲欧美另类在线| 国产拍揄自揄精品视频麻豆| 欧美日韩你懂的| 97国产一区二区| 国产精品中文有码| 美女视频一区二区| 五月天丁香久久| 亚洲国产精品麻豆| 亚洲三级电影网站| 欧美国产国产综合| 国产亚洲综合在线| 欧美mv和日韩mv的网站| 91精品国产入口在线| 在线视频你懂得一区二区三区| 国产成a人无v码亚洲福利| 老司机免费视频一区二区三区| 亚洲午夜在线视频| 亚洲精品视频自拍| 国产精品国模大尺度视频| 国产亚洲一区二区三区| 久久亚洲影视婷婷| 久久伊人蜜桃av一区二区| 欧美成人三级电影在线| 欧美一级黄色录像| 91精品啪在线观看国产60岁| 欧美色精品在线视频| 欧洲国内综合视频| 欧美在线观看视频一区二区三区| jiyouzz国产精品久久| a4yy欧美一区二区三区| 波多野洁衣一区| 91丨porny丨户外露出| av在线不卡免费看| 在线区一区二视频| 欧美久久久久久蜜桃| 综合网在线视频| 亚洲免费观看高清在线观看| 亚洲欧美激情插| 一区二区三区日韩欧美| 亚洲一二三级电影| 日本亚洲电影天堂| 精品写真视频在线观看| 国产成人亚洲精品狼色在线| 成人一区二区三区中文字幕| 成人app软件下载大全免费| 91亚洲精品一区二区乱码| 色婷婷狠狠综合| 欧美日韩精品免费观看视频 | 亚洲在线视频网站| 亚洲一区二区成人在线观看| 亚洲成人黄色小说| 久久丁香综合五月国产三级网站 | 天使萌一区二区三区免费观看| 午夜视频一区二区三区| 久久精品国产秦先生| 国产成人亚洲综合a∨猫咪| 99在线精品一区二区三区| 91九色最新地址| 日韩精品一区在线观看| 欧美国产精品一区二区三区| 一区二区在线免费观看| 久久99精品网久久| 91小视频免费看| 欧美一区二区精品| 国产精品毛片大码女人| 亚洲国产精品一区二区www | 日韩精品91亚洲二区在线观看| 另类小说一区二区三区| 不卡在线视频中文字幕| 欧美人与z0zoxxxx视频| 国产亚洲人成网站| 亚洲伊人伊色伊影伊综合网| 久久国产精品区| 色哟哟国产精品| 久久久久久久久久看片| 亚洲第一主播视频| 国产91高潮流白浆在线麻豆| 欧美日韩视频一区二区| 国产精品视频一二三| 午夜精品福利一区二区蜜股av| 国产精品自在欧美一区| 欧美日韩精品专区| 国产精品理论在线观看| 美腿丝袜亚洲色图| 波多野结衣一区二区三区| 337p日本欧洲亚洲大胆精品| 亚洲综合视频在线观看| 国产成人精品aa毛片| 日韩欧美一二区| 五月综合激情婷婷六月色窝| 成人高清视频在线| 精品剧情在线观看| 亚洲成人精品一区| 成人av网站在线观看免费| 日韩美女天天操| 婷婷激情综合网| 91麻豆国产精品久久| 欧美激情在线一区二区三区| 青草国产精品久久久久久| 欧美性猛片xxxx免费看久爱 | 一区二区三区在线看| 成人国产精品免费观看视频| 久久综合狠狠综合久久激情| 日韩精品国产精品| 欧美日韩午夜在线| 一区二区三区四区不卡在线| 成人免费福利片| 国产精品久久久久国产精品日日| 九九精品视频在线看| 欧美一区二区三级| 日日夜夜免费精品| 欧美一a一片一级一片| 亚洲天堂福利av| 91免费观看国产| 亚洲欧美日韩综合aⅴ视频| 成人激情电影免费在线观看| 久久精品亚洲一区二区三区浴池| 麻豆久久一区二区| 欧美电影免费观看完整版| 麻豆国产精品官网| 日韩精品一区二区三区视频| 久久99国产精品免费网站| 精品少妇一区二区三区日产乱码 | 91久久精品一区二区三| 亚洲色图.com| 欧美视频三区在线播放| 婷婷综合五月天| 欧美成人三级电影在线| 国产盗摄女厕一区二区三区| 国产日韩欧美精品在线| 成人激情免费视频| 一区二区三区波多野结衣在线观看| 91色婷婷久久久久合中文| 亚洲最新视频在线观看| 欧美日韩国产高清一区| 麻豆一区二区99久久久久| 久久精品日产第一区二区三区高清版| 国产一区视频在线看| 国产精品毛片久久久久久久| 一本久道中文字幕精品亚洲嫩| 亚洲欧美色综合| 欧美精品亚洲二区| 日本一区二区高清| 99久久婷婷国产综合精品电影 | 91久久精品一区二区三| 一区二区三区欧美激情| 欧美亚洲国产一区二区三区| 久久精品国产**网站演员| 精品精品国产高清一毛片一天堂| 久国产精品韩国三级视频|