📄 lib_ascii.c
字号:
/*
*********************************************************************************************************
* uC/LIB
* CUSTOM LIBRARY MODULES
*
* (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL
*
* All rights reserved. Protected by international copyright laws.
*
* uC/LIB is provided in source form to registered licensees ONLY. It is
* illegal to distribute this source code to any third party unless you receive
* written permission by an authorized Micrium representative. 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.
*
* You can contact us at www.micrium.com.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* ASCII CHARACTER OPERATIONS
*
* Filename : lib_ascii.c
* Version : V1.35.00
* Programmer(s) : BAN
* ITJ
*********************************************************************************************************
* 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.
*
*
* (2) (a) 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 :
*
* (1) 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.
*
* (2) THE INTERNATIONAL REFERENCE VERSION, which explicitly specifies all characters
* in the 7-bit character set.
*
* (3) NATIONAL & APPLICATION-ORIENTED VERSIONS, which may be derived from the
* standard in specified ways.
*
* (b) 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 :
*
* (1) For the Latin capital & lowercase letters, the name components 'LETTER_CAPITAL'
* & 'LETTER_SMALL' are replaced by 'UPPER' & 'LOWER', respectively.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* 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
*********************************************************************************************************
*/
/*$PAGE*/
/*
*********************************************************************************************************
* ASCII_IsAlpha()
*
* Description : Determine whether a 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) : Application.
*
* Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.2.(2) states that "isalpha() returns true only for the
* characters for which isupper() or islower() is true".
*********************************************************************************************************
*/
CPU_BOOLEAN ASCII_IsAlpha (CPU_CHAR c)
{
CPU_BOOLEAN alpha;
alpha = ASCII_IS_ALPHA(c);
return (alpha);
}
/*
*********************************************************************************************************
* ASCII_IsAlphaNum()
*
* Description : Determine whether a 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) : Application.
*
* Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.1.(2) states that "isalnum() ... tests for any character
* for which isalpha() or isdigit() is true".
*********************************************************************************************************
*/
CPU_BOOLEAN ASCII_IsAlphaNum (CPU_CHAR c)
{
CPU_BOOLEAN alpha_num;
alpha_num = ASCII_IS_ALPHA_NUM(c);
return (alpha_num);
}
/*$PAGE*/
/*
*********************************************************************************************************
* ASCII_IsLower()
*
* Description : Determine whether a character is a lowercase alphabetic character.
*
* Argument(s) : c Character to examine.
*
* Return(s) : DEF_YES, if character is a lowercase alphabetic character.
*
* DEF_NO, if character is NOT a lowercase alphabetic character.
*
* Caller(s) : Application.
*
* Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.7.(2) states that "islower() returns true only for
* the lowercase letters".
*********************************************************************************************************
*/
CPU_BOOLEAN ASCII_IsLower (CPU_CHAR c)
{
CPU_BOOLEAN lower;
lower = ASCII_IS_LOWER(c);
return (lower);
}
/*
*********************************************************************************************************
* ASCII_IsUpper()
*
* Description : Determine whether a character is an uppercase alphabetic character.
*
* Argument(s) : c Character to examine.
*
* Return(s) : DEF_YES, if character is an uppercase alphabetic character.
*
* DEF_NO, if character is NOT an uppercase alphabetic character.
*
* Caller(s) : Application.
*
* Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.11.(2) states that "isupper() returns true only for
* the uppercase letters".
*********************************************************************************************************
*/
CPU_BOOLEAN ASCII_IsUpper (CPU_CHAR c)
{
CPU_BOOLEAN upper;
upper = ASCII_IS_UPPER(c);
return (upper);
}
/*$PAGE*/
/*
*********************************************************************************************************
* ASCII_IsDig()
*
* Description : Determine whether a character is a decimal-digit character.
*
* Argument(s) : c Character to examine.
*
* Return(s) : DEF_YES, if character is a decimal-digit character.
*
* DEF_NO, if character is NOT a decimal-digit character.
*
* Caller(s) : Application.
*
* Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.5.(2) states that "isdigit() ... tests for any
* decimal-digit character".
*********************************************************************************************************
*/
CPU_BOOLEAN ASCII_IsDig (CPU_CHAR c)
{
CPU_BOOLEAN dig;
dig = ASCII_IS_DIG(c);
return (dig);
}
/*
*********************************************************************************************************
* ASCII_IsDigOct()
*
* Description : Determine whether a character is an octal-digit character.
*
* Argument(s) : c Character to examine.
*
* Return(s) : DEF_YES, if character is an octal-digit character.
*
* DEF_NO, if character is NOT an octal-digit character.
*
* Caller(s) : Application.
*
* Note(s) : none.
*********************************************************************************************************
*/
CPU_BOOLEAN ASCII_IsDigOct (CPU_CHAR c)
{
CPU_BOOLEAN dig_oct;
dig_oct = ASCII_IS_DIG_OCT(c);
return (dig_oct);
}
/*
*********************************************************************************************************
* ASCII_IsDigHex()
*
* Description : Determine whether a character is a hexadecimal-digit character.
*
* Argument(s) : c Character to examine.
*
* Return(s) : DEF_YES, if character is a hexadecimal-digit character.
*
* DEF_NO, if character is NOT a hexadecimal-digit character.
*
* Caller(s) : Application.
*
* Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.12.(2) states that "isxdigit() ... tests for any
* hexadecimal-digit character".
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -