chkctype.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 94 行
C
94 行
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
#include "variety.h"
#include <jstring.h>
#include <jctype.h>
/**
*
* Name: chkctype 僶僀僩扨埵偺暥帤僞僀僾傪挷傋傞
*
* Synopsis: ret = chkctype( c, mode );
*
* int ret; 僞僀僾
* unsigned char c;暥帤乮僶僀僩扨埵乯
* int mode; 儌乕僪
*
* Description: 僶僀僩扨埵偺僞僀僾傪挷傋傞丅們倛倠們倲倷倫倕偱偼
* 倣倧倓倕偵侾埲奜偺抣傪梌偊傞偲丄娍帤偺戞侾僶僀僩
* 偐偳偆偐傪挷傋丄戞侾僶僀僩側傜俠俿丵俲俰侾傪曉偟
* 偦傟埲奜側傜偽俠俿丵俙俶俲傪曉偡丅倣倧倓倕偵侾傪
* 梌偊傞偲娍帤偺戞俀僶僀僩偐偳偆偐傪挷傋丄戞俀僶僀
* 僩側傜偽俠俿丵俲俰俀傪曉偟偦傟埲奜側傜偽俠俿丵俬
* 俴俧俴傪曉偡丅
* 値倲倛們倲倷倫倕偼暥帤楍偺愭摢傪侽偲偡傞埵抲倐偵
* 偁傞僶僀僩偵偮偄偰僞僀僾傪挷傋傞丅
*
* Returns: 僰儖暥帤偺応崌偼俠俿丵俬俴俧俴傪曉偡丅
* 値倲倛們倲倷倫倕偱偼埵抲倐傑偱偺娫偵僰儖暥帤偑偁
* 偭偨応崌傕俠俿丵俷俴俧俴傪曉偡丅
*
*
* Name: chkctype Check type of character by byte unit
*
* Synopsis: ret = chkctype( c, mode );
*
* int ret; Type
* unsigned char c;Character (byte unit)
* int mode; mode
*
* Description: Check type of character by byte unit. Checktype
* checks whether c is the first byte of KANJI character
* when mode is something except 1, if c is the first byte,
* it returns CT_KJ1. If c is other, it returns CT_ANK.
* When mode is 1, it checks whether c is the second byte of
* KANJI character and if c is the second byte of KANJI character,
* it returns CT_KJ2. If c is other, it returns CT_ILGL.
* Nthctype checks type of the b th byte of string.
*
* Returns: If c is NULL character, chkctype returns CT_ILGL.
* Nthctype returns CT_ILGL when it find NULL character until
* the b th byte.
*
**/
_WCRTLINK int chkctype( JCHAR c, int type )
{
if( c == '\0' ) return( CT_ILGL ); // JBS 92/10/01
if( type == CT_KJ1 )
return( iskanji2( c ) ? CT_KJ2 : CT_ILGL );
else
return( iskanji( c ) ? CT_KJ1 : CT_ANK );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?