UCOS_TI_LM3S_Keil
 全部 结构体 文件 函数 变量 类型定义 宏定义 
lib_str.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 STRING MANAGEMENT
28 *
29 * Filename : lib_str.h
30 * Version : V1.30
31 * Programmer(s) : ITJ
32 * JDH
33 *********************************************************************************************************
34 * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software.
35 *
36 * (a) ALL standard library functions are implemented in the custom library modules :
37 *
38 * (1) <Custom Library Directory>\lib*.*
39 *
40 * (2) <Custom Library Directory>\Ports<cpu><compiler>\lib*_a.*
41 *
42 * where
43 * <Custom Library Directory> directory path for custom library software
44 * <cpu> directory name for specific processor (CPU)
45 * <compiler> directory name for specific compiler
46 *
47 * (b) Product-specific library functions are implemented in individual products.
48 *********************************************************************************************************
49 */
50 
51 
52 /*
53 *********************************************************************************************************
54 * MODULE
55 *********************************************************************************************************
56 */
57 
58 #ifndef LIB_STR_MODULE_PRESENT
59 #define LIB_STR_MODULE_PRESENT
60 
61 
62 /*$PAGE*/
63 /*
64 *********************************************************************************************************
65 * INCLUDE FILES
66 *
67 * Note(s) : (1) The following common software files are located in the following directories :
68 *
69 * (a) <Custom Library Directory>\lib*.*
70 *
71 * (b) (1) <CPU-Compiler Directory>\cpu_def.h
72 *
73 * (2) <CPU-Compiler Directory><cpu><compiler>\cpu*.*
74 *
75 * where
76 * <Custom Library Directory> directory path for custom library software
77 * <CPU-Compiler Directory> directory path for common CPU-compiler software
78 * <cpu> directory name for specific processor (CPU)
79 * <compiler> directory name for specific compiler
80 *
81 * (2) Compiler MUST be configured to include the '<Custom Library Directory>\uC-LIB\',
82 * '<CPU-Compiler Directory>\' directory, & the specific CPU-compiler directory as
83 * additional include path directories.
84 *
85 * (3) NO compiler-supplied standard library functions SHOULD be used.
86 *
87 * #### The reference to standard library header files SHOULD be removed once all custom
88 * library functions are implemented WITHOUT reference to ANY standard library function(s).
89 *
90 * See also 'STANDARD LIBRARY MACRO'S Note #1'.
91 *********************************************************************************************************
92 */
93 
94 #include <cpu.h>
95 
96 #include <lib_def.h>
97 #include <lib_ascii.h>
98 
99 #include <app_cfg.h>
100 
101  /* See Note #3. */
102 #include <stdlib.h>
103 #include <ctype.h>
104 #include <errno.h>
105 #include <limits.h>
106 #include <stdio.h>
107 
108 
109 /*
110 *********************************************************************************************************
111 * EXTERNS
112 *********************************************************************************************************
113 */
114 
115 #ifdef LIB_STR_MODULE
116 #define LIB_STR_EXT
117 #else
118 #define LIB_STR_EXT extern
119 #endif
120 
121 
122 /*$PAGE*/
123 /*
124 *********************************************************************************************************
125 * DEFAULT CONFIGURATION
126 *********************************************************************************************************
127 */
128 
129 /*
130 *********************************************************************************************************
131 * STRING FLOATING POINT CONFIGURATION
132 *
133 * Note(s) : (1) Configure LIB_STR_CFG_FP_EN to enable/disable floating point string function(s).
134 *********************************************************************************************************
135 */
136  /* Configure floating point feature(s) [see Note #1] : */
137 #ifndef LIB_STR_CFG_FP_EN
138 #define LIB_STR_CFG_FP_EN DEF_DISABLED
139  /* DEF_DISABLED Floating point functions DISABLED */
140  /* DEF_ENABLED Floating point functions ENABLED */
141 #endif
142 
143 
144 /*
145 *********************************************************************************************************
146 * DEFINES
147 *********************************************************************************************************
148 */
149 
150 
151 /*
152 *********************************************************************************************************
153 * DATA TYPES
154 *********************************************************************************************************
155 */
156 
157 
158 /*
159 *********************************************************************************************************
160 * GLOBAL VARIABLES
161 *********************************************************************************************************
162 */
163 
164 
165 /*$PAGE*/
166 /*
167 *********************************************************************************************************
168 * MACRO'S
169 *********************************************************************************************************
170 */
171 
172 /*
173 *********************************************************************************************************
174 * STANDARD LIBRARY MACRO'S
175 *
176 * Note(s) : (1) NO compiler-supplied standard library functions SHOULD be used.
177 *
178 * #### The reference to standard memory functions SHOULD be removed once all custom library
179 * functions are implemented WITHOUT reference to ANY standard library function(s).
180 *
181 * See also 'INCLUDE FILES Note #3'.
182 *
183 * (2) Redefinition of library functions SHOULD be deprecated & replaced with the actual library
184 * macro's &/or functions.
185 *********************************************************************************************************
186 */
187 
188  /* See Note #1. */
189 #define Str_FmtPrint snprintf
190 #define Str_FmtScan sscanf
191 
192  /* See Note #2. */
193 #define Str_IsPrint(a) ASCII_IsPrint(a)
194 #define Str_ToLong(a, b, c) Str_ParseNbr_Int32S((CPU_CHAR *)(a), (CPU_CHAR **)(b), (CPU_INT08U)(c))
195 
196 
197 /*$PAGE*/
198 /*
199 *********************************************************************************************************
200 * FUNCTION PROTOTYPES
201 *********************************************************************************************************
202 */
203 
204  /* ------------------ STR LEN FNCTS ------------------ */
205 CPU_SIZE_T Str_Len (CPU_CHAR *pstr);
206 
208  CPU_SIZE_T len_max);
209 
210 
211  /* ------------------ STR COPY FNCTS ------------------ */
212 CPU_CHAR *Str_Copy (CPU_CHAR *pdest,
213  CPU_CHAR *psrc);
214 
215 CPU_CHAR *Str_Copy_N (CPU_CHAR *pdest,
216  CPU_CHAR *psrc,
217  CPU_SIZE_T len_max);
218 
219 
220 CPU_CHAR *Str_Cat (CPU_CHAR *pdest,
221  CPU_CHAR *pstr_cat);
222 
223 CPU_CHAR *Str_Cat_N (CPU_CHAR *pdest,
224  CPU_CHAR *pstr_cat,
225  CPU_SIZE_T len_max);
226 
227 
228  /* ------------------ STR CMP FNCTS ------------------ */
229 CPU_INT16S Str_Cmp (CPU_CHAR *p1_str,
230  CPU_CHAR *p2_str);
231 
232 CPU_INT16S Str_Cmp_N (CPU_CHAR *p1_str,
233  CPU_CHAR *p2_str,
234  CPU_SIZE_T len_max);
235 
237  CPU_CHAR *p2_str);
238 
240  CPU_CHAR *p2_str,
241  CPU_SIZE_T len_max);
242 
243 
244  /* ------------------ STR SRCH FNCTS ------------------ */
245 CPU_CHAR *Str_Char (CPU_CHAR *pstr,
246  CPU_CHAR srch_char);
247 
249  CPU_SIZE_T len_max,
250  CPU_CHAR srch_char);
251 
253  CPU_CHAR srch_char);
254 
255 
256 CPU_CHAR *Str_Str (CPU_CHAR *pstr,
257  CPU_CHAR *psrch_str);
258 
259 
260 /*$PAGE*/
261  /* ------------------ STR FMT FNCTS ------------------ */
263  CPU_INT08U nbr_dig,
264  CPU_INT08U nbr_base,
265  CPU_CHAR lead_char,
266  CPU_BOOLEAN lower_case,
267  CPU_BOOLEAN nul,
268  CPU_CHAR *pstr);
269 
271  CPU_INT08U nbr_dig,
272  CPU_INT08U nbr_base,
273  CPU_CHAR lead_char,
274  CPU_BOOLEAN lower_case,
275  CPU_BOOLEAN nul,
276  CPU_CHAR *pstr);
277 
278 #if (LIB_STR_CFG_FP_EN == DEF_ENABLED)
279 CPU_CHAR *Str_FmtNbr_32 (CPU_FP32 nbr,
280  CPU_INT08U nbr_dig,
281  CPU_INT08U nbr_dp,
282  CPU_CHAR lead_char,
283  CPU_BOOLEAN nul,
284  CPU_CHAR *pstr);
285 #endif
286 
287 
288  /* ----------------- STR PARSE FNCTS ------------------ */
290  CPU_CHAR **pstr_next,
291  CPU_INT08U nbr_base);
292 
294  CPU_CHAR **pstr_next,
295  CPU_INT08U nbr_base);
296 
297 
298 /*$PAGE*/
299 /*
300 *********************************************************************************************************
301 * CONFIGURATION ERRORS
302 *********************************************************************************************************
303 */
304 
305 #ifndef LIB_STR_CFG_FP_EN
306 #error "LIB_STR_CFG_FP_EN not #define'd in 'app_cfg.h'"
307 #error " [MUST be DEF_DISABLED] "
308 #error " [ || DEF_ENABLED ] "
309 
310 #elif ((LIB_STR_CFG_FP_EN != DEF_DISABLED) && \
311  (LIB_STR_CFG_FP_EN != DEF_ENABLED ))
312 #error "LIB_STR_CFG_FP_EN illegally #define'd in 'app_cfg.h'"
313 #error " [MUST be DEF_DISABLED] "
314 #error " [ || DEF_ENABLED ] "
315 #endif
316 
317 
318 /*
319 *********************************************************************************************************
320 * MODULE END
321 *********************************************************************************************************
322 */
323 
324 #endif /* End of lib str module include. */
325