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

📄 lib_ascii.c

📁 飞思卡尔HCS12的OS移植(ucosII),实现了三个任务,IDE:CODEWARRIOR
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
*********************************************************************************************************
*                                               uC/LIB
*                                       CUSTOM LIBRARY MODULES
*
*                          (c) Copyright 2004-2007; Micrium, Inc.; Weston, FL
*
*               All rights reserved.  Protected by international copyright laws.
*
*               uC/LIB is provided in source form for FREE evaluation, for educational
*               use or peaceful research.  If you plan on using uC/LIB in a commercial
*               product you need to contact Micrium to properly license its use in your
*               product.  We provide ALL the source code for your convenience and to
*               help you experience uC/LIB.  The fact that the source code is provided
*               does NOT mean that you can use it without paying a licensing fee.
*
*               Knowledge of the source code may NOT be used to develop a similar product.
*
*               Please help us continue to provide the Embedded community with the finest
*               software available.  Your honesty is greatly appreciated.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                       ASCII CHARACTER DEFINITIONS
*
* Filename      : lib_ascii.c
* Version       : V1.25
* Programmer(s) : BAN
* Note(s)       : (1) ECMA-6 '7-Bit coded Character Set' (6th edition), which corresponds to the
*                     3rd edition of ISO 646, specifies several versions of a 7-bit character set :
*
*                     (a) THE GENERAL VERSION, which allows characters at 0x23 and 0x24 to be given
*                         a set alternate form and allows the characters 0x40, 0x5B, 0x5D, 0x60, 0x7B &
*                         0x7D to be assigned a "unique graphic character" or to be declared as unused.
*                         All other characters are explicitly specified.
*
*                     (b) THE INTERNATIONAL REFERENCE VERSION, which explicitly specifies all characters
*                         in the 7-bit character set.
*
*                     (c) NATIONAL & APPLICATION-ORIENTED VERSIONS, which may be derived from the
*                         standard in specified ways.
*
*                     The character set represented in this file reproduces the Internation Reference
*                     Version.  This is identical to the 7-bit character set which occupies Unicode
*                     characters 0x0000 through 0x007F.  The character names are taken from v5.0 of the
*                     Unicode specification, with certain abbreviations so that the resulting #define
*                     names will not violate ANSI C naming restriction :
*
*                     (a) For the Latin capital & lowercase letters, the name component 'LETTER_'
*                         is left out.
*********************************************************************************************************
* Note(s)       : (1) NO compiler-supplied standard library functions are used in library or product software.
*
*                     (a) ALL standard library functions are implemented in the custom library modules :
*
*                         (1) \<Custom Library Directory>\lib*.*
*
*                         (2) \<Custom Library Directory>\Ports\<cpu>\<compiler>\lib*_a.*
*
*                               where
*                                       <Custom Library Directory>      directory path for custom library software
*                                       <cpu>                           directory name for specific processor (CPU)
*                                       <compiler>                      directory name for specific compiler
*
*                     (b) Product-specific library functions are implemented in individual products.
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                            INCLUDE FILES
*********************************************************************************************************
*/

#define    LIB_ASCII_MODULE
#include  <lib_ascii.h>


/*$PAGE*/
/*
*********************************************************************************************************
*                                            LOCAL DEFINES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                           LOCAL CONSTANTS
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                          LOCAL DATA TYPES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                            LOCAL TABLES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                       LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                      LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                     LOCAL CONFIGURATION ERRORS
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                            ASCII_IsAlnum()
*
* Description : Determine whether character is an alphanumeric character.
*
* Argument(s) : c           Character to examine.
*
* Return(s)   : DEF_YES, if character is     an alphanumeric character.
*
*               DEF_NO,	 if character is NOT an alphanumeric character.
*
* Caller(s)   : various.
*
* Note(s)     : (1) 'ASCII_IsAlnum()' returns TRUE if EITHER 'ASCII_IsAlpha()' or 'ASCII_IsDigit()'
*                   would return TRUE for the argument character.
*********************************************************************************************************
*/

CPU_BOOLEAN  ASCII_IsAlnum (CPU_CHAR  c)
{
    CPU_BOOLEAN  rtn;


    rtn = ((((c >= ASCII_CHAR_LATIN_CAPITAL_A) && (c <= ASCII_CHAR_LATIN_CAPITAL_Z)) ||
            ((c >= ASCII_CHAR_LATIN_SMALL_A  ) && (c <= ASCII_CHAR_LATIN_SMALL_Z  )) ||
            ((c >= ASCII_CHAR_DIGIT_ZERO     ) && (c <= ASCII_CHAR_DIGIT_NINE     ))) ? (DEF_YES) : (DEF_NO));

    return (rtn);
}


/*
*********************************************************************************************************
*                                            ASCII_IsAlpha()
*
* Description : Determine whether character is an alphabetic character.
*
* Argument(s) : c           Character to examine.
*
* Return(s)   : DEF_YES, if character is     an alphabetic character.
*
*               DEF_NO,	 if character is NOT an alphabetic character.
*
* Caller(s)   : various.
*
* Note(s)     : (1) 'ASCII_IsAlpha()' returns TRUE if EITHER 'ASCII_IsLower()' or 'ASCII_IsUpper()'
*                   would return TRUE for the argument character.
*********************************************************************************************************
*/

CPU_BOOLEAN  ASCII_IsAlpha (CPU_CHAR  c)
{
    CPU_BOOLEAN  rtn;


    rtn = ((((c >= ASCII_CHAR_LATIN_CAPITAL_A) && (c <= ASCII_CHAR_LATIN_CAPITAL_Z)) ||
            ((c >= ASCII_CHAR_LATIN_SMALL_A  ) && (c <= ASCII_CHAR_LATIN_SMALL_Z  ))) ? (DEF_YES) : (DEF_NO));

    return (rtn);
}


/*
*********************************************************************************************************
*                                            ASCII_IsBlank()
*
* Description : Determine whether character is a standard blank character.
*
* Argument(s) : c           Character to examine.
*
* Return(s)   : DEF_YES, if character is     a standard blank character.
*
*               DEF_NO,	 if character is NOT a standard blank character.
*
* Caller(s)   : various.
*
* Note(s)     : (1) ISO/IEC 9899, Section 7.4.1.3.2 defines the 'standard blank characters' as the space
*                   (' ') and the horizontal tab ('\t').
*
*               (2) 'ASCII_IsBlank()' returns TRUE if the argument character is a space or horizontal
*                   tab.
*********************************************************************************************************
*/

CPU_BOOLEAN  ASCII_IsBlank (CPU_CHAR  c)
{
    CPU_BOOLEAN  rtn;


    rtn = (((c == ASCII_CHAR_SPACE) || (c == ASCII_CHAR_HT)) ? (DEF_YES) : (DEF_NO));

    return (rtn);
}


/*
*********************************************************************************************************
*                                            ASCII_IsCtrl()
*
* Description : Determine whether character is a control character.
*
* Argument(s) : c           Character to examine.
*
* Return(s)   : DEF_YES, if character is     a control character.
*
*               DEF_NO,	 if character is NOT a control character.
*
* Caller(s)   : various.
*
* Note(s)     : (1) ISO/IEC 9899, Note 170, states that in the 'seven-bit ASCII character set, the
*                   control characters are those whose values lie from 0 (NUL) through 0x1F (US) and
*                   the character 0x7F (DEL)'.
*********************************************************************************************************
*/

CPU_BOOLEAN  ASCII_IsCtrl (CPU_CHAR  c)
{
    CPU_BOOLEAN  rtn;


    rtn = (((c <= ASCII_CHAR_IS1) || (c == ASCII_CHAR_DELETE))  ? (DEF_YES) : (DEF_NO));

    return (rtn);
}


/*
*********************************************************************************************************
*                                            ASCII_IsDigit()
*
* Description : Determine whether character is an decimal-digit character.
*
* Argument(s) : c           Character to examine.
*
* Return(s)   : DEF_YES, if character is     an decimal-digit character.
*
*               DEF_NO,	 if character is NOT an decimal-digit character.
*
* Caller(s)   : various.
*
* Note(s)     : none.
*********************************************************************************************************
*/

CPU_BOOLEAN  ASCII_IsDigit (CPU_CHAR  c)
{
    CPU_BOOLEAN  rtn;


    rtn = (((c >= ASCII_CHAR_DIGIT_ZERO) && (c <= ASCII_CHAR_DIGIT_NINE)) ? (DEF_YES) : (DEF_NO));

    return (rtn);
}


/*
*********************************************************************************************************
*                                            ASCII_IsGraph()
*
* Description : Determine whether character is any printing character except space (' ').
*
* Argument(s) : c           Character to examine.
*
* Return(s)   : DEF_YES, if character is     an graphic character.
*
*               DEF_NO,	 if character is NOT an graphic character.
*

⌨️ 快捷键说明

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