⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tctoeuc.c

📁 T-kernel 的extension源代码
💻 C
字号:
/* *---------------------------------------------------------------------- *    T-Kernel / Standard Extension * *    Copyright (C) 2006 by Ken Sakamura. All rights reserved. *    T-Kernel / Standard Extension is distributed  *      under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * *    Version:   1.00.00 *    Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* *	tctoeuc.c (libtcstr) * *	W	tctoeuc(UB *euc, TC tc) * *	Convert a TC character into an EUC character and store it in euc. *	Return the number of converted bytes (1 or 2) as a function value. *	If euc == NULL, do not store the conversion result, but return a correct function value. *	If the character cannot be converted, return the function value "-1"; if tc == TNULL, return the function value "0". */#include <basic.h>#include <tstring.h>#include <tcode.h>#define TSD_TEU_VAL_32		32#define TSD_TEU_VAL_128		128#define TSD_TEU_SFT_8		8#define TSD_TEU_RTN_2		2#define TSD_TEU_RTN_M1		(-1)#define TSD_TEU_MSK_0X8080	(TC)0x8080#define TSD_TEU_VAL_0X80	(TC)0x80#define TSD_TEU_MAX_0X23FF	(TC)0x23ffEXPORT	W	tctoeuc( UB *euc, TC tc ){	W	c;	if (tc == TNULL) {		return 0;	}	if ((tc & TSD_TEU_MSK_0X8080) != (TC)0) {		return TSD_TEU_RTN_M1;	}	if ((tc < TSD_TEU_VAL_0X80) != 0) {		if (euc != 0) {			*euc = (UB)tc;		}		return 1;	}	if ((tc >= TK_KSP )&&( tc < TSD_TEU_MAX_0X23FF)) {		for (c = TSD_TEU_VAL_32; c < TSD_TEU_VAL_128; c++) {			if (_asctotc[c] == tc) {				if (euc != 0) {					*euc = (UB)c;				}				return 1;			}		}	}	if (euc != 0) {		tc |= TSD_TEU_MSK_0X8080;		*(euc++) = (UB)(tc >> (TC)TSD_TEU_SFT_8);		*euc = (UB)tc;	}	return	TSD_TEU_RTN_2;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -