UCOS_TI_LM3S_Keil
 全部 结构体 文件 函数 变量 类型定义 宏定义 
lib_ascii.h
浏览该文件的文档.
1 /*
2 *********************************************************************************************************
3 * uC/LIB
4 * CUSTOM LIBRARY MODULES
5 *
6 * (c) Copyright 2004-2009; Micrium, Inc.; Weston, FL
7 *
8 * All rights reserved. Protected by international copyright laws.
9 *
10 * uC/LIB is provided in source form for FREE evaluation, for educational
11 * use or peaceful research. If you plan on using uC/LIB in a commercial
12 * product you need to contact Micrium to properly license its use in your
13 * product. We provide ALL the source code for your convenience and to
14 * help you experience uC/LIB. The fact that the source code is provided
15 * does NOT mean that you can use it without paying a licensing fee.
16 *
17 * Knowledge of the source code may NOT be used to develop a similar product.
18 *
19 * Please help us continue to provide the Embedded community with the finest
20 * software available. Your honesty is greatly appreciated.
21 *********************************************************************************************************
22 */
23 
24 /*
25 *********************************************************************************************************
26 *
27 * ASCII CHARACTER OPERATIONS
28 *
29 * Filename : lib_ascii.h
30 * Version : V1.30
31 * Programmer(s) : BAN
32 *********************************************************************************************************
33 * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software.
34 *
35 * (a) ALL standard library functions are implemented in the custom library modules :
36 *
37 * (1) <Custom Library Directory>\lib*.*
38 *
39 * (2) <Custom Library Directory>\Ports<cpu><compiler>\lib*_a.*
40 *
41 * where
42 * <Custom Library Directory> directory path for custom library software
43 * <cpu> directory name for specific processor (CPU)
44 * <compiler> directory name for specific compiler
45 *
46 * (b) Product-specific library functions are implemented in individual products.
47 *
48 *
49 * (2) (a) ECMA-6 '7-Bit coded Character Set' (6th edition), which corresponds to the
50 * 3rd edition of ISO 646, specifies several versions of a 7-bit character set :
51 *
52 * (1) THE GENERAL VERSION, which allows characters at 0x23 and 0x24 to be given a
53 * set alternate form and allows the characters 0x40, 0x5B, 0x5D, 0x60, 0x7B &
54 * 0x7D to be assigned a "unique graphic character" or to be declared as unused.
55 * All other characters are explicitly specified.
56 *
57 * (2) THE INTERNATIONAL REFERENCE VERSION, which explicitly specifies all characters
58 * in the 7-bit character set.
59 *
60 * (3) NATIONAL & APPLICATION-ORIENTED VERSIONS, which may be derived from the
61 * standard in specified ways.
62 *
63 * (b) The character set represented in this file reproduces the Internation Reference
64 * Version. This is identical to the 7-bit character set which occupies Unicode
65 * characters 0x0000 through 0x007F. The character names are taken from v5.0 of the
66 * Unicode specification, with certain abbreviations so that the resulting #define
67 * names will not violate ANSI C naming restriction :
68 *
69 * (1) For the Latin capital & lowercase letters, the name components 'LETTER_CAPITAL'
70 * & 'LETTER_SMALL' are replaced by 'UPPER' & 'LOWER', respectively.
71 *********************************************************************************************************
72 */
73 
74 
75 /*
76 *********************************************************************************************************
77 * MODULE
78 *********************************************************************************************************
79 */
80 
81 #ifndef LIB_ASCII_MODULE_PRESENT
82 #define LIB_ASCII_MODULE_PRESENT
83 
84 
85 /*$PAGE*/
86 /*
87 *********************************************************************************************************
88 * INCLUDE FILES
89 *
90 * Note(s) : (1) The following common software files are located in the following directories :
91 *
92 * (a) <Custom Library Directory>\lib*.*
93 *
94 * (b) (1) <CPU-Compiler Directory>\cpu_def.h
95 *
96 * (2) <CPU-Compiler Directory><cpu><compiler>\cpu*.*
97 *
98 * where
99 * <Custom Library Directory> directory path for custom library software
100 * <CPU-Compiler Directory> directory path for common CPU-compiler software
101 * <cpu> directory name for specific processor (CPU)
102 * <compiler> directory name for specific compiler
103 *
104 * (2) Compiler MUST be configured to include the '<Custom Library Directory>\uC-LIB\',
105 * '<CPU-Compiler Directory>\' directory, & the specific CPU-compiler directory as
106 * additional include path directories.
107 *********************************************************************************************************
108 */
109 
110 #include <cpu.h>
111 #include <lib_def.h>
112 
113 
114 /*
115 *********************************************************************************************************
116 * EXTERNS
117 *********************************************************************************************************
118 */
119 
120 #ifdef LIB_ASCII_MODULE
121 #define LIB_ASCII_EXT
122 #else
123 #define LIB_ASCII_EXT extern
124 #endif
125 
126 
127 /*$PAGE*/
128 /*
129 *********************************************************************************************************
130 * DEFINES
131 *********************************************************************************************************
132 */
133 
134 /*
135 *********************************************************************************************************
136 * ASCII CHARACTER DEFINES
137 *********************************************************************************************************
138 */
139 
140  /* -------------------- C0 CONTROLS ------------------- */
141 #define ASCII_CHAR_NULL 0x00 /* '\0' */
142 #define ASCII_CHAR_START_OF_HEADING 0x01
143 #define ASCII_CHAR_START_OF_TEXT 0x02
144 #define ASCII_CHAR_END_OF_TEXT 0x03
145 #define ASCII_CHAR_END_OF_TRANSMISSION 0x04
146 #define ASCII_CHAR_ENQUIRY 0x05
147 #define ASCII_CHAR_ACKNOWLEDGE 0x06
148 #define ASCII_CHAR_BELL 0x07 /* '\a' */
149 #define ASCII_CHAR_BACKSPACE 0x08 /* '\b' */
150 #define ASCII_CHAR_CHARACTER_TABULATION 0x09 /* '\t' */
151 #define ASCII_CHAR_LINE_FEED 0x0A /* '\n' */
152 #define ASCII_CHAR_LINE_TABULATION 0x0B /* '\v' */
153 #define ASCII_CHAR_FORM_FEED 0x0C /* '\f' */
154 #define ASCII_CHAR_CARRIAGE_RETURN 0x0D /* '\r' */
155 #define ASCII_CHAR_SHIFT_OUT 0x0E
156 #define ASCII_CHAR_SHIFT_IN 0x0F
157 #define ASCII_CHAR_DATA_LINK_ESCAPE 0x10
158 #define ASCII_CHAR_DEVICE_CONTROL_ONE 0x11
159 #define ASCII_CHAR_DEVICE_CONTROL_TWO 0x12
160 #define ASCII_CHAR_DEVICE_CONTROL_THREE 0x13
161 #define ASCII_CHAR_DEVICE_CONTROL_FOUR 0x14
162 #define ASCII_CHAR_NEGATIVE_ACKNOWLEDGE 0x15
163 #define ASCII_CHAR_SYNCHRONOUS_IDLE 0x16
164 #define ASCII_CHAR_END_OF_TRANSMISSION_BLOCK 0x17
165 #define ASCII_CHAR_CANCEL 0x18
166 #define ASCII_CHAR_END_OF_MEDIUM 0x19
167 #define ASCII_CHAR_SUBSITUTE 0x1A
168 #define ASCII_CHAR_ESCAPE 0x1B
169 #define ASCII_CHAR_INFO_SEPARATOR_FOUR 0x1C
170 #define ASCII_CHAR_INFO_SEPARATOR_THREE 0x1D
171 #define ASCII_CHAR_INFO_SEPARATOR_TWO 0x1E
172 #define ASCII_CHAR_INFO_SEPARATOR_ONE 0x1F
173 
174 #define ASCII_CHAR_NUL ASCII_CHAR_NULL
175 #define ASCII_CHAR_SOH ASCII_CHAR_START_OF_HEADING
176 #define ASCII_CHAR_START_HEADING ASCII_CHAR_START_OF_HEADING
177 #define ASCII_CHAR_STX ASCII_CHAR_START_OF_TEXT
178 #define ASCII_CHAR_START_TEXT ASCII_CHAR_START_OF_TEXT
179 #define ASCII_CHAR_ETX ASCII_CHAR_END_OF_TEXT
180 #define ASCII_CHAR_END_TEXT ASCII_CHAR_END_OF_TEXT
181 #define ASCII_CHAR_EOT ASCII_CHAR_END_OF_TRANSMISSION
182 #define ASCII_CHAR_END_TRANSMISSION ASCII_CHAR_END_OF_TRANSMISSION
183 #define ASCII_CHAR_ENQ ASCII_CHAR_ENQUIRY
184 #define ASCII_CHAR_ACK ASCII_CHAR_ACKNOWLEDGE
185 #define ASCII_CHAR_BEL ASCII_CHAR_BELL
186 #define ASCII_CHAR_BS ASCII_CHAR_BACKSPACE
187 #define ASCII_CHAR_HT ASCII_CHAR_CHARACTER_TABULATION
188 #define ASCII_CHAR_TAB ASCII_CHAR_CHARACTER_TABULATION
189 #define ASCII_CHAR_LF ASCII_CHAR_LINE_FEED
190 #define ASCII_CHAR_VT ASCII_CHAR_LINE_TABULATION
191 #define ASCII_CHAR_FF ASCII_CHAR_FORM_FEED
192 #define ASCII_CHAR_CR ASCII_CHAR_CARRIAGE_RETURN
193 #define ASCII_CHAR_SO ASCII_CHAR_SHIFT_OUT
194 #define ASCII_CHAR_SI ASCII_CHAR_SHIFT_IN
195 #define ASCII_CHAR_DLE ASCII_CHAR_DATA_LINK_ESCAPE
196 #define ASCII_CHAR_DC1 ASCII_CHAR_DEVICE_CONTROL_ONE
197 #define ASCII_CHAR_DC2 ASCII_CHAR_DEVICE_CONTROL_TWO
198 #define ASCII_CHAR_DC3 ASCII_CHAR_DEVICE_CONTROL_THREE
199 #define ASCII_CHAR_DC4 ASCII_CHAR_DEVICE_CONTROL_FOUR
200 #define ASCII_CHAR_DEV_CTRL_ONE ASCII_CHAR_DEVICE_CONTROL_ONE
201 #define ASCII_CHAR_DEV_CTRL_TWO ASCII_CHAR_DEVICE_CONTROL_TWO
202 #define ASCII_CHAR_DEV_CTRL_THREE ASCII_CHAR_DEVICE_CONTROL_THREE
203 #define ASCII_CHAR_DEV_CTRL_FOUR ASCII_CHAR_DEVICE_CONTROL_FOUR
204 #define ASCII_CHAR_NAK ASCII_CHAR_NEGATIVE_ACKNOWLEDGE
205 #define ASCII_CHAR_NEG_ACK ASCII_CHAR_NEGATIVE_ACKNOWLEDGE
206 #define ASCII_CHAR_SYN ASCII_CHAR_SYNCHRONOUS_IDLE
207 #define ASCII_CHAR_SYNC_IDLE ASCII_CHAR_SYNCHRONOUS_IDLE
208 #define ASCII_CHAR_ETB ASCII_CHAR_END_OF_TRANSMISSION_BLOCK
209 #define ASCII_CHAR_END_TRANSMISSION_BLK ASCII_CHAR_END_OF_TRANSMISSION_BLOCK
210 #define ASCII_CHAR_CAN ASCII_CHAR_CANCEL
211 #define ASCII_CHAR_EM ASCII_CHAR_END_OF_MEDIUM
212 #define ASCII_CHAR_END_MEDIUM ASCII_CHAR_END_OF_MEDIUM
213 #define ASCII_CHAR_SUB ASCII_CHAR_SUBSITUTE
214 #define ASCII_CHAR_ESC ASCII_CHAR_ESCAPE
215 #define ASCII_CHAR_IS1 ASCII_CHAR_INFO_SEPARATOR_ONE
216 #define ASCII_CHAR_IS2 ASCII_CHAR_INFO_SEPARATOR_TWO
217 #define ASCII_CHAR_IS3 ASCII_CHAR_INFO_SEPARATOR_THREE
218 #define ASCII_CHAR_IS4 ASCII_CHAR_INFO_SEPARATOR_FOUR
219 
220 
221 /*$PAGE*/
222  /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */
223 #define ASCII_CHAR_SPACE 0x20 /* ' ' */
224 #define ASCII_CHAR_EXCLAMATION_MARK 0x21 /* '!' */
225 #define ASCII_CHAR_QUOTATION_MARK 0x22 /* '\"' */
226 #define ASCII_CHAR_NUMBER_SIGN 0x23 /* '#' */
227 #define ASCII_CHAR_DOLLAR_SIGN 0x24 /* '$' */
228 #define ASCII_CHAR_PERCENTAGE_SIGN 0x25 /* '%' */
229 #define ASCII_CHAR_AMPERSAND 0x26 /* '&' */
230 #define ASCII_CHAR_APOSTROPHE 0x27 /* '\'' */
231 #define ASCII_CHAR_LEFT_PARENTHESIS 0x28 /* '(' */
232 #define ASCII_CHAR_RIGHT_PARENTHESIS 0x29 /* ')' */
233 #define ASCII_CHAR_ASTERISK 0x2A /* '*' */
234 #define ASCII_CHAR_PLUS_SIGN 0x2B /* '+' */
235 #define ASCII_CHAR_COMMA 0x2C /* ',' */
236 #define ASCII_CHAR_HYPHEN_MINUS 0x2D /* '-' */
237 #define ASCII_CHAR_FULL_STOP 0x2E /* '.' */
238 #define ASCII_CHAR_SOLIDUS 0x2F /* '/' */
239 
240 #define ASCII_CHAR_PAREN_LEFT ASCII_CHAR_LEFT_PARENTHESIS
241 #define ASCII_CHAR_PAREN_RIGHT ASCII_CHAR_RIGHT_PARENTHESIS
242 
243 
244  /* ------------------- ASCII DIGITS ------------------- */
245 #define ASCII_CHAR_DIGIT_ZERO 0x30 /* '0' */
246 #define ASCII_CHAR_DIGIT_ONE 0x31 /* '1' */
247 #define ASCII_CHAR_DIGIT_TWO 0x32 /* '2' */
248 #define ASCII_CHAR_DIGIT_THREE 0x33 /* '3' */
249 #define ASCII_CHAR_DIGIT_FOUR 0x34 /* '4' */
250 #define ASCII_CHAR_DIGIT_FIVE 0x35 /* '5' */
251 #define ASCII_CHAR_DIGIT_SIX 0x36 /* '6' */
252 #define ASCII_CHAR_DIGIT_SEVEN 0x37 /* '7' */
253 #define ASCII_CHAR_DIGIT_EIGHT 0x38 /* '8' */
254 #define ASCII_CHAR_DIGIT_NINE 0x39 /* '9' */
255 
256 #define ASCII_CHAR_DIG_ZERO ASCII_CHAR_DIGIT_ZERO
257 #define ASCII_CHAR_DIG_ONE ASCII_CHAR_DIGIT_ONE
258 #define ASCII_CHAR_DIG_TWO ASCII_CHAR_DIGIT_TWO
259 #define ASCII_CHAR_DIG_THREE ASCII_CHAR_DIGIT_THREE
260 #define ASCII_CHAR_DIG_FOUR ASCII_CHAR_DIGIT_FOUR
261 #define ASCII_CHAR_DIG_FIVE ASCII_CHAR_DIGIT_FIVE
262 #define ASCII_CHAR_DIG_SIX ASCII_CHAR_DIGIT_SIX
263 #define ASCII_CHAR_DIG_SEVEN ASCII_CHAR_DIGIT_SEVEN
264 #define ASCII_CHAR_DIG_EIGHT ASCII_CHAR_DIGIT_EIGHT
265 #define ASCII_CHAR_DIG_NINE ASCII_CHAR_DIGIT_NINE
266 
267 
268  /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */
269 #define ASCII_CHAR_COLON 0x3A /* ':' */
270 #define ASCII_CHAR_SEMICOLON 0x3B /* ';' */
271 #define ASCII_CHAR_LESS_THAN_SIGN 0x3C /* '<' */
272 #define ASCII_CHAR_EQUALS_SIGN 0x3D /* '=' */
273 #define ASCII_CHAR_GREATER_THAN_SIGN 0x3E /* '>' */
274 #define ASCII_CHAR_QUESTION_MARK 0x3F /* '\?' */
275 #define ASCII_CHAR_COMMERCIAL_AT 0x40 /* '@' */
276 
277 #define ASCII_CHAR_AT_SIGN ASCII_CHAR_COMMERCIAL_AT
278 
279 
280 /*$PAGE*/
281  /* ------------- UPPERCASE LATIN ALPHABET ------------- */
282 #define ASCII_CHAR_LATIN_UPPER_A 0x41 /* 'A' */
283 #define ASCII_CHAR_LATIN_UPPER_B 0x42 /* 'B' */
284 #define ASCII_CHAR_LATIN_UPPER_C 0x43 /* 'C' */
285 #define ASCII_CHAR_LATIN_UPPER_D 0x44 /* 'D' */
286 #define ASCII_CHAR_LATIN_UPPER_E 0x45 /* 'E' */
287 #define ASCII_CHAR_LATIN_UPPER_F 0x46 /* 'F' */
288 #define ASCII_CHAR_LATIN_UPPER_G 0x47 /* 'G' */
289 #define ASCII_CHAR_LATIN_UPPER_H 0x48 /* 'H' */
290 #define ASCII_CHAR_LATIN_UPPER_I 0x49 /* 'I' */
291 #define ASCII_CHAR_LATIN_UPPER_J 0x4A /* 'J' */
292 #define ASCII_CHAR_LATIN_UPPER_K 0x4B /* 'K' */
293 #define ASCII_CHAR_LATIN_UPPER_L 0x4C /* 'L' */
294 #define ASCII_CHAR_LATIN_UPPER_M 0x4D /* 'M' */
295 #define ASCII_CHAR_LATIN_UPPER_N 0x4E /* 'N' */
296 #define ASCII_CHAR_LATIN_UPPER_O 0x4F /* 'O' */
297 #define ASCII_CHAR_LATIN_UPPER_P 0x50 /* 'P' */
298 #define ASCII_CHAR_LATIN_UPPER_Q 0x51 /* 'Q' */
299 #define ASCII_CHAR_LATIN_UPPER_R 0x52 /* 'R' */
300 #define ASCII_CHAR_LATIN_UPPER_S 0x53 /* 'S' */
301 #define ASCII_CHAR_LATIN_UPPER_T 0x54 /* 'T' */
302 #define ASCII_CHAR_LATIN_UPPER_U 0x55 /* 'U' */
303 #define ASCII_CHAR_LATIN_UPPER_V 0x56 /* 'V' */
304 #define ASCII_CHAR_LATIN_UPPER_W 0x57 /* 'W' */
305 #define ASCII_CHAR_LATIN_UPPER_X 0x58 /* 'X' */
306 #define ASCII_CHAR_LATIN_UPPER_Y 0x59 /* 'Y' */
307 #define ASCII_CHAR_LATIN_UPPER_Z 0x5A /* 'Z' */
308 
309 
310  /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */
311 #define ASCII_CHAR_LEFT_SQUARE_BRACKET 0x5B /* '[' */
312 #define ASCII_CHAR_REVERSE_SOLIDUS 0x5C /* '\\' */
313 #define ASCII_CHAR_RIGHT_SQUARE_BRACKET 0x5D /* ']' */
314 #define ASCII_CHAR_CIRCUMFLEX_ACCENT 0x5E /* '^' */
315 #define ASCII_CHAR_LOW_LINE 0x5F /* '_' */
316 #define ASCII_CHAR_GRAVE_ACCENT 0x60 /* '`' */
317 
318 #define ASCII_CHAR_BRACKET_SQUARE_LEFT ASCII_CHAR_LEFT_SQUARE_BRACKET
319 #define ASCII_CHAR_BRACKET_SQUARE_RIGHT ASCII_CHAR_RIGHT_SQUARE_BRACKET
320 
321 
322  /* ------------- LOWERCASE LATIN ALPHABET ------------- */
323 #define ASCII_CHAR_LATIN_LOWER_A 0x61 /* 'a' */
324 #define ASCII_CHAR_LATIN_LOWER_B 0x62 /* 'b' */
325 #define ASCII_CHAR_LATIN_LOWER_C 0x63 /* 'c' */
326 #define ASCII_CHAR_LATIN_LOWER_D 0x64 /* 'd' */
327 #define ASCII_CHAR_LATIN_LOWER_E 0x65 /* 'e' */
328 #define ASCII_CHAR_LATIN_LOWER_F 0x66 /* 'f' */
329 #define ASCII_CHAR_LATIN_LOWER_G 0x67 /* 'g' */
330 #define ASCII_CHAR_LATIN_LOWER_H 0x68 /* 'h' */
331 #define ASCII_CHAR_LATIN_LOWER_I 0x69 /* 'i' */
332 #define ASCII_CHAR_LATIN_LOWER_J 0x6A /* 'j' */
333 #define ASCII_CHAR_LATIN_LOWER_K 0x6B /* 'k' */
334 #define ASCII_CHAR_LATIN_LOWER_L 0x6C /* 'l' */
335 #define ASCII_CHAR_LATIN_LOWER_M 0x6D /* 'm' */
336 #define ASCII_CHAR_LATIN_LOWER_N 0x6E /* 'n' */
337 #define ASCII_CHAR_LATIN_LOWER_O 0x6F /* 'o' */
338 #define ASCII_CHAR_LATIN_LOWER_P 0x70 /* 'p' */
339 #define ASCII_CHAR_LATIN_LOWER_Q 0x71 /* 'q' */
340 #define ASCII_CHAR_LATIN_LOWER_R 0x72 /* 'r' */
341 #define ASCII_CHAR_LATIN_LOWER_S 0x73 /* 's' */
342 #define ASCII_CHAR_LATIN_LOWER_T 0x74 /* 't' */
343 #define ASCII_CHAR_LATIN_LOWER_U 0x75 /* 'u' */
344 #define ASCII_CHAR_LATIN_LOWER_V 0x76 /* 'v' */
345 #define ASCII_CHAR_LATIN_LOWER_W 0x77 /* 'w' */
346 #define ASCII_CHAR_LATIN_LOWER_X 0x78 /* 'x' */
347 #define ASCII_CHAR_LATIN_LOWER_Y 0x79 /* 'y' */
348 #define ASCII_CHAR_LATIN_LOWER_Z 0x7A /* 'z' */
349 
350 
351  /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */
352 #define ASCII_CHAR_LEFT_CURLY_BRACKET 0x7B /* '{' */
353 #define ASCII_CHAR_VERTICAL_LINE 0x7C /* '|' */
354 #define ASCII_CHAR_RIGHT_CURLY_BRACKET 0x7D /* '}' */
355 #define ASCII_CHAR_TILDE 0x7E /* '~' */
356 
357 #define ASCII_CHAR_BRACKET_CURLY_LEFT ASCII_CHAR_LEFT_CURLY_BRACKET
358 #define ASCII_CHAR_BRACKET_CURLY_RIGHT ASCII_CHAR_RIGHT_CURLY_BRACKET
359 
360 
361  /* ---------------- CONTROL CHARACTERS ---------------- */
362 #define ASCII_CHAR_DELETE 0x7F
363 
364 #define ASCII_CHAR_DEL ASCII_CHAR_DELETE
365 
366 
367 /*$PAGE*/
368 /*
369 *********************************************************************************************************
370 * DATA TYPES
371 *********************************************************************************************************
372 */
373 
374 
375 /*
376 *********************************************************************************************************
377 * GLOBAL VARIABLES
378 *********************************************************************************************************
379 */
380 
381 
382 /*$PAGE*/
383 /*
384 *********************************************************************************************************
385 * MACRO'S
386 *********************************************************************************************************
387 */
388 
389 /*
390 *********************************************************************************************************
391 * ASCII CHARACTER CLASSIFICATION MACRO's
392 *
393 * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.(1) states that "character classification functions ...
394 * return nonzero (true) if and only if the value of the argument 'c' conforms to ... the
395 * description of the function."
396 *********************************************************************************************************
397 */
398 
399 /*
400 *********************************************************************************************************
401 * ASCII_IS_DIG()
402 *
403 * Description : Determine whether a character is a decimal-digit character.
404 *
405 * Argument(s) : c Character to examine.
406 *
407 * Return(s) : DEF_YES, if character is a decimal-digit character.
408 *
409 * DEF_NO, if character is NOT a decimal-digit character.
410 *
411 * Caller(s) : Application.
412 *
413 * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.5.(2) states that "isdigit() ... tests for any
414 * decimal-digit character".
415 *********************************************************************************************************
416 */
417 
418 #define ASCII_IS_DIG(c) ((((c) >= ASCII_CHAR_DIG_ZERO) && ((c) <= ASCII_CHAR_DIG_NINE)) ? (DEF_YES) : (DEF_NO))
419 
420 
421 /*
422 *********************************************************************************************************
423 * ASCII_IS_DIG_OCT()
424 *
425 * Description : Determine whether a character is an octal-digit character.
426 *
427 * Argument(s) : c Character to examine.
428 *
429 * Return(s) : DEF_YES, if character is an octal-digit character.
430 *
431 * DEF_NO, if character is NOT an octal-digit character.
432 *
433 * Caller(s) : Application.
434 *
435 * Note(s) : none.
436 *********************************************************************************************************
437 */
438 
439 #define ASCII_IS_DIG_OCT(c) ((((c) >= ASCII_CHAR_DIG_ZERO) && ((c) <= ASCII_CHAR_DIG_SEVEN)) ? (DEF_YES) : (DEF_NO))
440 
441 
442 /*
443 *********************************************************************************************************
444 * ASCII_IS_DIG_HEX()
445 *
446 * Description : Determine whether a character is a hexadecimal-digit character.
447 *
448 * Argument(s) : c Character to examine.
449 *
450 * Return(s) : DEF_YES, if character is a hexadecimal-digit character.
451 *
452 * DEF_NO, if character is NOT a hexadecimal-digit character.
453 *
454 * Caller(s) : Application.
455 *
456 * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.12.(2) states that "isxdigit() ... tests for any
457 * hexadecimal-digit character".
458 *********************************************************************************************************
459 */
460 
461 #define ASCII_IS_DIG_HEX(c) (((((c) >= ASCII_CHAR_DIG_ZERO ) && ((c) <= ASCII_CHAR_DIG_NINE )) || \
462  (((c) >= ASCII_CHAR_LATIN_UPPER_A) && ((c) <= ASCII_CHAR_LATIN_UPPER_F)) || \
463  (((c) >= ASCII_CHAR_LATIN_LOWER_A) && ((c) <= ASCII_CHAR_LATIN_LOWER_F))) ? (DEF_YES) : (DEF_NO))
464 
465 
466 /*$PAGE*/
467 /*
468 *********************************************************************************************************
469 * ASCII_IS_LOWER()
470 *
471 * Description : Determine whether a character is a lowercase alphabetic character.
472 *
473 * Argument(s) : c Character to examine.
474 *
475 * Return(s) : DEF_YES, if character is a lowercase alphabetic character.
476 *
477 * DEF_NO, if character is NOT a lowercase alphabetic character.
478 *
479 * Caller(s) : Application.
480 *
481 * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.7.(2) states that "islower() returns true only for
482 * the lowercase letters".
483 *********************************************************************************************************
484 */
485 
486 #define ASCII_IS_LOWER(c) ((((c) >= ASCII_CHAR_LATIN_LOWER_A) && ((c) <= ASCII_CHAR_LATIN_LOWER_Z)) ? (DEF_YES) : (DEF_NO))
487 
488 
489 /*
490 *********************************************************************************************************
491 * ASCII_IS_UPPER()
492 *
493 * Description : Determine whether a character is an uppercase alphabetic character.
494 *
495 * Argument(s) : c Character to examine.
496 *
497 * Return(s) : DEF_YES, if character is an uppercase alphabetic character.
498 *
499 * DEF_NO, if character is NOT an uppercase alphabetic character.
500 *
501 * Caller(s) : Application.
502 *
503 * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.11.(2) states that "isupper() returns true only for
504 * the uppercase letters".
505 *********************************************************************************************************
506 */
507 
508 #define ASCII_IS_UPPER(c) ((((c) >= ASCII_CHAR_LATIN_UPPER_A) && ((c) <= ASCII_CHAR_LATIN_UPPER_Z)) ? (DEF_YES) : (DEF_NO))
509 
510 
511 /*$PAGE*/
512 /*
513 *********************************************************************************************************
514 * ASCII_IS_ALPHA()
515 *
516 * Description : Determine whether a character is an alphabetic character.
517 *
518 * Argument(s) : c Character to examine.
519 *
520 * Return(s) : DEF_YES, if character is an alphabetic character.
521 *
522 * DEF_NO, if character is NOT an alphabetic character.
523 *
524 * Caller(s) : Application.
525 *
526 * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.2.(2) states that "isalpha() returns true only for the
527 * characters for which isupper() or islower() is true".
528 *********************************************************************************************************
529 */
530 
531 #define ASCII_IS_ALPHA(c) ((((ASCII_IS_UPPER(c)) == DEF_YES) || \
532  ((ASCII_IS_LOWER(c)) == DEF_YES)) ? (DEF_YES) : (DEF_NO))
533 
534 
535 /*
536 *********************************************************************************************************
537 * ASCII_IS_ALPHA_NUM()
538 *
539 * Description : Determine whether a character is an alphanumeric character.
540 *
541 * Argument(s) : c Character to examine.
542 *
543 * Return(s) : DEF_YES, if character is an alphanumeric character.
544 *
545 * DEF_NO, if character is NOT an alphanumeric character.
546 *
547 * Caller(s) : Application.
548 *
549 * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.1.(2) states that "isalnum() ... tests for any character
550 * for which isalpha() or isdigit() is true".
551 *********************************************************************************************************
552 */
553 
554 #define ASCII_IS_ALPHA_NUM(c) ((((ASCII_IS_ALPHA(c)) == DEF_YES) || \
555  ((ASCII_IS_DIG (c)) == DEF_YES)) ? (DEF_YES) : (DEF_NO))
556 
557 
558 /*$PAGE*/
559 /*
560 *********************************************************************************************************
561 * ASCII_IS_BLANK()
562 *
563 * Description : Determine whether a character is a standard blank character.
564 *
565 * Argument(s) : c Character to examine.
566 *
567 * Return(s) : DEF_YES, if character is a standard blank character.
568 *
569 * DEF_NO, if character is NOT a standard blank character.
570 *
571 * Caller(s) : Application.
572 *
573 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.3.(2) states that "isblank() returns true only for
574 * the standard blank characters".
575 *
576 * (b) ISO/IEC 9899:TC2, Section 7.4.1.3.(2) defines "the standard blank characters" as
577 * the "space (' '), and horizontal tab ('\t')".
578 *********************************************************************************************************
579 */
580 
581 #define ASCII_IS_BLANK(c) ((((c) == ASCII_CHAR_SPACE) || ((c) == ASCII_CHAR_HT)) ? (DEF_YES) : (DEF_NO))
582 
583 
584 /*
585 *********************************************************************************************************
586 * ASCII_IS_SPACE()
587 *
588 * Description : Determine whether a character is a white-space character.
589 *
590 * Argument(s) : c Character to examine.
591 *
592 * Return(s) : DEF_YES, if character is a white-space character.
593 *
594 * DEF_NO, if character is NOT a white-space character.
595 *
596 * Caller(s) : Application.
597 *
598 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.10.(2) states that "isspace() returns true only
599 * for the standard white-space characters".
600 *
601 * (b) ISO/IEC 9899:TC2, Section 7.4.1.10.(2) defines "the standard white-space characters"
602 * as the "space (' '), form feed ('\f'), new-line ('\n'), carriage return ('\r'),
603 * horizontal tab ('\t'), and vertical tab ('\v')".
604 *********************************************************************************************************
605 */
606 
607 #define ASCII_IS_SPACE(c) ((((c) == ASCII_CHAR_SPACE) || ((c) == ASCII_CHAR_CR) || \
608  ((c) == ASCII_CHAR_LF ) || ((c) == ASCII_CHAR_FF) || \
609  ((c) == ASCII_CHAR_HT ) || ((c) == ASCII_CHAR_VT)) ? (DEF_YES) : (DEF_NO))
610 
611 
612 /*$PAGE*/
613 /*
614 *********************************************************************************************************
615 * ASCII_IS_PRINT()
616 *
617 * Description : Determine whether a character is a printing character.
618 *
619 * Argument(s) : c Character to examine.
620 *
621 * Return(s) : DEF_YES, if character is a printing character.
622 *
623 * DEF_NO, if character is NOT a printing character.
624 *
625 * Caller(s) : Application.
626 *
627 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.8.(2) states that "isprint() ... tests for any
628 * printing character including space (' ')".
629 *
630 * (b) ISO/IEC 9899:TC2, Section 7.4.(3), Note 169, states that in "the seven-bit US
631 * ASCII character set, the printing characters are those whose values lie from
632 * 0x20 (space) through 0x7E (tilde)".
633 *********************************************************************************************************
634 */
635 
636 #define ASCII_IS_PRINT(c) ((((c) >= ASCII_CHAR_SPACE) && ((c) <= ASCII_CHAR_TILDE)) ? (DEF_YES) : (DEF_NO))
637 
638 
639 /*
640 *********************************************************************************************************
641 * ASCII_IS_GRAPH()
642 *
643 * Description : Determine whether a character is any printing character except a space character.
644 *
645 * Argument(s) : c Character to examine.
646 *
647 * Return(s) : DEF_YES, if character is a graphic character.
648 *
649 * DEF_NO, if character is NOT a graphic character.
650 *
651 * Caller(s) : Application.
652 *
653 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.6.(2) states that "isgraph() ... tests for any
654 * printing character except space (' ')".
655 *
656 * (b) ISO/IEC 9899:TC2, Section 7.4.(3), Note 169, states that in "the seven-bit US
657 * ASCII character set, the printing characters are those whose values lie from
658 * 0x20 (space) through 0x7E (tilde)".
659 *********************************************************************************************************
660 */
661 
662 #define ASCII_IS_GRAPH(c) ((((c) >= ASCII_CHAR_EXCLAMATION_MARK) && ((c) <= ASCII_CHAR_TILDE)) ? (DEF_YES) : (DEF_NO))
663 
664 
665 /*$PAGE*/
666 /*
667 *********************************************************************************************************
668 * ASCII_IS_PUNCT()
669 *
670 * Description : Determine whether a character is a punctuation character.
671 *
672 * Argument(s) : c Character to examine.
673 *
674 * Return(s) : DEF_YES, if character is a punctuation character.
675 *
676 * DEF_NO, if character is NOT a punctuation character.
677 *
678 * Caller(s) : Application.
679 *
680 * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.9.(2) states that "ispunct() returns true for every
681 * printing character for which neither isspace() nor isalnum() is true".
682 *********************************************************************************************************
683 */
684 
685 #define ASCII_IS_PUNCT(c) ((((ASCII_IS_PRINT(c)) == DEF_YES) && \
686  ((ASCII_IS_SPACE(c)) == DEF_NO ) && \
687  ((ASCII_IS_ALPHA_NUM(c)) == DEF_NO )) ? (DEF_YES) : (DEF_NO))
688 
689 
690 /*
691 *********************************************************************************************************
692 * ASCII_IS_CTRL()
693 *
694 * Description : Determine whether a character is a control character.
695 *
696 * Argument(s) : c Character to examine.
697 *
698 * Return(s) : DEF_YES, if character is a control character.
699 *
700 * DEF_NO, if character is NOT a control character.
701 *
702 * Caller(s) : Application.
703 *
704 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.4.(2) states that "iscntrl() ... tests for any
705 * control character".
706 *
707 * (b) ISO/IEC 9899:TC2, Section 7.4.(3), Note 169, states that in "the seven-bit US
708 * ASCII character set, ... the control characters are those whose values lie from
709 * 0 (NUL) through 0x1F (US), and the character 0x7F (DEL)".
710 *********************************************************************************************************
711 */
712 
713 #define ASCII_IS_CTRL(c) (((((CPU_INT08S)(c) >= ASCII_CHAR_NULL ) && ((c) <= ASCII_CHAR_IS1)) || \
714  ((c) == ASCII_CHAR_DEL)) ? (DEF_YES) : (DEF_NO))
715 
716 
717 /*$PAGE*/
718 /*
719 *********************************************************************************************************
720 * ASCII CHARACTER CASE MAPPING MACRO's
721 *********************************************************************************************************
722 */
723 
724 /*
725 *********************************************************************************************************
726 * ASCII_TO_LOWER()
727 *
728 * Description : Convert uppercase alphabetic character to its corresponding lowercase alphabetic character.
729 *
730 * Argument(s) : c Character to convert.
731 *
732 * Return(s) : Lowercase equivalent of 'c', if character 'c' is an uppercase character (see Note #1b1).
733 *
734 * Character 'c', otherwise (see Note #1b2).
735 *
736 * Caller(s) : Application.
737 *
738 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.2.1.(2) states that "tolower() ... converts an
739 * uppercase letter to a corresponding lowercase letter".
740 *
741 * (b) ISO/IEC 9899:TC2, Section 7.4.2.1.(3) states that :
742 *
743 * (1) (A) "if the argument is a character for which isupper() is true and there are
744 * one or more corresponding characters ... for which islower() is true," ...
745 * (B) "tolower() ... returns one of the corresponding characters;" ...
746 *
747 * (2) "otherwise, the argument is returned unchanged."
748 *********************************************************************************************************
749 */
750 
751 #define ASCII_TO_LOWER(c) (((ASCII_IS_UPPER(c)) == DEF_YES) ? ((c) + (ASCII_CHAR_LATIN_LOWER_A - ASCII_CHAR_LATIN_UPPER_A)) : (c))
752 
753 
754 /*
755 *********************************************************************************************************
756 * ASCII_TO_UPPER()
757 *
758 * Description : Convert lowercase alphabetic character to its corresponding uppercase alphabetic character.
759 *
760 * Argument(s) : c Character to convert.
761 *
762 * Return(s) : Uppercase equivalent of 'c', if character 'c' is a lowercase character (see Note #1b1).
763 *
764 * Character 'c', otherwise (see Note #1b2).
765 *
766 * Caller(s) : Application.
767 *
768 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.2.2.(2) states that "toupper() ... converts a
769 * lowercase letter to a corresponding uppercase letter".
770 *
771 * (b) ISO/IEC 9899:TC2, Section 7.4.2.2.(3) states that :
772 *
773 * (1) (A) "if the argument is a character for which islower() is true and there are
774 * one or more corresponding characters ... for which isupper() is true," ...
775 * (B) "toupper() ... returns one of the corresponding characters;" ...
776 *
777 * (2) "otherwise, the argument is returned unchanged."
778 *********************************************************************************************************
779 */
780 
781 #define ASCII_TO_UPPER(c) (((ASCII_IS_LOWER(c)) == DEF_YES) ? ((c) - (ASCII_CHAR_LATIN_LOWER_A - ASCII_CHAR_LATIN_UPPER_A)) : (c))
782 
783 
784 /*$PAGE*/
785 /*
786 *********************************************************************************************************
787 * FUNCTION PROTOTYPES
788 *********************************************************************************************************
789 */
790 
792 
794 
796 
798 
800 
802 
804 
806 
808 
810 
812 
814 
816 
817 
819 
821 
822 
824  CPU_CHAR c2);
825 
826 
827 /*$PAGE*/
828 /*
829 *********************************************************************************************************
830 * CONFIGURATION ERRORS
831 *********************************************************************************************************
832 */
833 
834 
835 /*
836 *********************************************************************************************************
837 * MODULE END
838 *********************************************************************************************************
839 */
840 
841 #endif /* End of lib ascii module include. */
842