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

📄 lib_ascii.h

📁 飞思卡尔HCS12的OS移植(ucosII),实现了三个任务,IDE:CODEWARRIOR
💻 H
📖 第 1 页 / 共 3 页
字号:
#define  ASCII_CHAR_EQUALS_SIGN                         0x3D    /* '='                                                  */
#define  ASCII_CHAR_GREATER_THAN_SIGN                   0x3E    /* '>'                                                  */
#define  ASCII_CHAR_QUESTION_MARK                       0x3F    /* '\?'                                                 */
#define  ASCII_CHAR_COMMERCIAL_AT                       0x40    /* '@'                                                  */

                                                                /* ------------- UPPERCASE LATIN ALPHABET ------------- */
#define  ASCII_CHAR_LATIN_CAPITAL_A                     0x41    /* 'A'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_B                     0x42    /* 'B'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_C                     0x43    /* 'C'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_D                     0x44    /* 'D'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_E                     0x45    /* 'E'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_F                     0x46    /* 'F'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_G                     0x47    /* 'G'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_H                     0x48    /* 'H'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_I                     0x49    /* 'I'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_J                     0x4A    /* 'J'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_K                     0x4B    /* 'K'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_L                     0x4C    /* 'L'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_M                     0x4D    /* 'M'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_N                     0x4E    /* 'N'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_O                     0x4F    /* 'O'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_P                     0x50    /* 'P'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_Q                     0x51    /* 'Q'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_R                     0x52    /* 'R'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_S                     0x53    /* 'S'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_T                     0x54    /* 'T'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_U                     0x55    /* 'U'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_V                     0x56    /* 'V'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_W                     0x57    /* 'W'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_X                     0x58    /* 'X'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_Y                     0x59    /* 'Y'                                                  */
#define  ASCII_CHAR_LATIN_CAPITAL_Z                     0x5A    /* 'Z'                                                  */

                                                                /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */
#define  ASCII_CHAR_LEFT_SQUARE_BRACKET                 0x5B    /* '['                                                  */
#define  ASCII_CHAR_REVERSE_SOLIDUS                     0x5C    /* '\\'                                                 */
#define  ASCII_CHAR_RIGHT_SQUARE_BRACKET                0x5D    /* ']'                                                  */
#define  ASCII_CHAR_CIRCUMFLEX_ACCENT                   0x5E    /* '^'                                                  */
#define  ASCII_CHAR_LOW_LINE                            0x5F    /* '_'                                                  */
#define  ASCII_CHAR_GRAVE_ACCENT                        0x60    /* '`'                                                  */

                                                                /* ------------- LOWERCASE LATIN ALPHABET ------------- */
#define  ASCII_CHAR_LATIN_SMALL_A                       0x61    /* 'a'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_B                       0x62    /* 'b'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_C                       0x63    /* 'c'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_D                       0x64    /* 'd'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_E                       0x65    /* 'e'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_F                       0x66    /* 'f'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_G                       0x67    /* 'g'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_H                       0x68    /* 'h'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_I                       0x69    /* 'i'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_J                       0x6A    /* 'j'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_K                       0x6B    /* 'k'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_L                       0x6C    /* 'l'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_M                       0x6D    /* 'm'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_N                       0x6E    /* 'n'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_O                       0x6F    /* 'o'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_P                       0x70    /* 'p'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_Q                       0x71    /* 'q'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_R                       0x72    /* 'r'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_S                       0x73    /* 's'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_T                       0x74    /* 't'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_U                       0x75    /* 'u'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_V                       0x76    /* 'v'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_W                       0x77    /* 'w'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_X                       0x78    /* 'x'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_Y                       0x79    /* 'y'                                                  */
#define  ASCII_CHAR_LATIN_SMALL_Z                       0x7A    /* 'z'                                                  */

                                                                /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */
#define  ASCII_CHAR_LEFT_CURLY_BRACKET                  0x7B    /* '{'                                                  */
#define  ASCII_CHAR_VERTICAL_LINE                       0x7C    /* '|'                                                  */
#define  ASCII_CHAR_RIGHT_CURLY_BRACKET                 0x7D    /* '}'                                                  */
#define  ASCII_CHAR_TILDE                               0x7E    /* '~'                                                  */

                                                                /* ----------------- CONTROL CHARACTER ---------------- */
#define  ASCII_CHAR_DELETE                              0x7F
#define  ASCII_CHAR_DEL                                 ASCII_CHAR_DELETE


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


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


/*
*********************************************************************************************************
*                                               MACRO'S
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                 ASCII CHARACTER CLASSIFICATION MACRO's
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                            ASCII_IS_ALNUM()
*
* 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_IS_ALNUM()' returns TRUE if EITHER 'ASCII_IS_ALPHA()' or 'ASCII_IS_DIGIT()'
*                   would return TRUE for the argument character.
*********************************************************************************************************
*/

#define  ASCII_IS_ALNUM(c)           (((((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))

/*
*********************************************************************************************************
*                                            ASCII_IS_ALPHA()
*
* 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_IS_ALPHA()' returns TRUE if EITHER 'ASCII_IS_LOWER()' or 'ASCII_IS_UPPER()'
*                   would return TRUE for the argument character.
*********************************************************************************************************
*/

#define  ASCII_IS_ALPHA(c)           (((((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))

/*
*********************************************************************************************************
*                                            ASCII_IS_BLANK()
*
* 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_IS_BLANK()' returns TRUE if the argument character is a space or horizontal
*                   tab.
*********************************************************************************************************
*/

#define  ASCII_IS_BLANK(c)            ((((c) == ASCII_CHAR_SPACE) || ((c) == ASCII_CHAR_HT)) ? (DEF_YES) : (DEF_NO))

/*
*********************************************************************************************************
*                                            ASCII_IS_CTRL()
*
* 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)'.
*********************************************************************************************************
*/

#define  ASCII_IS_CTRL(c)            (((((c) >= ASCII_CHAR_NULL  ) && ((c) <= ASCII_CHAR_IS1)) || \
                                       (((c) == ASCII_CHAR_DELETE)                           ))   ? (DEF_YES) : (DEF_NO))


/*
*********************************************************************************************************
*                                            ASCII_IS_DIGIT()
*
* 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.
*********************************************************************************************************
*/

#define  ASCII_IS_DIGIT(c)            ((((c) >= ASCII_CHAR_DIGIT_ZERO) && ((c) <= ASCII_CHAR_DIGIT_NINE)) ? (DEF_YES) : (DEF_NO))

/*
*********************************************************************************************************
*                                            ASCII_IS_GRAPH()
*
* 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.
*
* Caller(s)   : various.
*
* Note(s)     : (1) See 'ASCII_IS_PRINT() Note #1'.
*********************************************************************************************************
*/

⌨️ 快捷键说明

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