📄 istlangce.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. * *---------------------------------------------------------------------- *//* * istlangce.c (libtcstr) */#include <basic.h>#include <tlang.h>#include <cnvend.h>#define TSD_ITE_LAN_M2 (-2)/* * Determination of language (script) specification code * Determine whether tp string is a language specification code. * Use ConvEndianH() to perform endian conversion of tp character string for determination. * * Return value > 0 Language specification code (TLANG is returned) * = 0 Not language specification code * = -1 Invalid language specification code * = -2 Indefinite language specification code (The code is not complete) * * len Valid maximum length of tp character string (in TC) * The length includes up to TNULL or len character. * If 0 is specified, len is ignored and up to TNULL is included. * ntp Return the position of the character located next to the language specification code. * Not returned if NULL is specified. * * (Ex.) FE21 Return value = 0x0021 *ntp = tp + 1 * FEFE 0021 Return value = 0x0121 *ntp = tp + 2 * 2121 Return value = 0 *ntp = tp * FE00 Return value = -1 *ntp = tp + 1 * FEFE 2121 Return value = -1 *ntp = tp + 2 * FEFE 0000 Return value = -2 *ntp = tp + 1 * FEFE 0021 (len = 1) Return value = -2 *ntp = tp + 1 */EXPORT W isTLANGce( const TC *tp, W len, TC **ntp ){ W n, lang; TC c; lang = 0; n = 0; while ( (c = ConvEndianH(*tp)) != TNULL ) { lang = isTLANGch(c, &n); if ( lang == 0 ) { break; } tp++; if ( lang != TSD_ITE_LAN_M2 ) { break; } if ( --len == 0 ) { break; } } if ( ntp != NULL ) { *ntp = (TC*)tp; } return lang;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -