Changeset 12286
- Timestamp:
- Mar 6, 2007, 2:17:48 PM (19 years ago)
- Location:
- trunk/psLib/src/sys
- Files:
-
- 2 edited
-
psString.c (modified) (7 diffs)
-
psTrace.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psString.c
r11711 r12286 13 13 * @author David Robbins, MHPCC 14 14 * 15 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $16 * @date $Date: 2007-0 2-08 22:27:30$15 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2007-03-07 00:17:48 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 87 87 unsigned int nChar) 88 88 { 89 PS_ASSERT_PTR_NON_NULL(string, NULL);90 91 89 // Pass through NULL values 92 90 if (!string) { … … 123 121 { 124 122 PS_ASSERT_PTR_NON_NULL(dest, 0); 125 PS_ASSERT_ PTR_NON_NULL(format, 0);123 PS_ASSERT_STRING_NON_EMPTY(format, 0); 126 124 127 125 va_list ap; … … 141 139 { 142 140 PS_ASSERT_PTR_NON_NULL(dest, 0); 143 PS_ASSERT_ PTR_NON_NULL(format, 0);141 PS_ASSERT_STRING_NON_EMPTY(format, 0); 144 142 145 143 size_t length = 0; // complete string length (sans \0) … … 194 192 { 195 193 PS_ASSERT_PTR_NON_NULL(dest, 0); 196 PS_ASSERT_ PTR_NON_NULL(format, 0);194 PS_ASSERT_STRING_NON_EMPTY(format, 0); 197 195 198 196 va_list ap; … … 213 211 { 214 212 PS_ASSERT_PTR_NON_NULL(dest, 0); 215 PS_ASSERT_ PTR_NON_NULL(format, 0);213 PS_ASSERT_STRING_NON_EMPTY(format, 0); 216 214 217 215 size_t length; // complete string length (sans \0) … … 275 273 bool multipleAreSignificant) 276 274 { 277 PS_ASSERT_ PTR_NON_NULL(splitters, NULL);275 PS_ASSERT_STRING_NON_EMPTY(splitters, NULL); 278 276 279 277 psList *values = psListAlloc(NULL); // The list of values to return -
trunk/psLib/src/sys/psTrace.c
r11674 r12286 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.8 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-0 2-07 01:15:49$11 * @version $Revision: 1.86 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-03-07 00:17:48 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 22 22 might give that a numerically low trace level, such as 1, so then any 23 23 non-zero trace level in that code component will display thatmessage. 24 24 25 25 We build a tree of trace components. Every node in the tree has a 26 26 depth, which is it's distance from the root. However, this is not 27 27 not the same thing as a node's "level", which corresponds to the 28 28 trace level of that node. 29 29 30 30 I think the following is the correct behavior, but not sure: 31 31 PS_UNKNOWN_TRACE_LEVEL: We never set the level of a component to this 32 32 value. This value is only used when psTraceGetLevel is called with 33 33 a bad component name, or if the component root is undefined, I think. 34 34 35 35 PS_DEFAULT_TRACE_LEVEL: This should only be used when adding the 36 36 intermediate components of a psS64 name. Ie. the "B" in .A.B.C 37 37 38 38 *****************************************************************************/ 39 39 … … 134 134 // NB: declares TARGET! 135 135 #define FACILITY(TARGET, FUNC, FACIL) \ 136 size_t _facilLength = strlen(FACIL); /* Length of facility name */ \137 size_t _funcLength = strlen(FUNC); /* Length of function name */ \138 char TARGET[_facilLength + _funcLength + 2]; /* facility + the function name */ \139 strcpy(&TARGET[0], FACIL); \140 TARGET[_facilLength] = '.'; \141 strcpy(&TARGET[_facilLength + 1], FUNC);136 size_t _facilLength = strlen(FACIL); /* Length of facility name */ \ 137 size_t _funcLength = strlen(FUNC); /* Length of function name */ \ 138 char TARGET[_facilLength + _funcLength + 2]; /* facility + the function name */ \ 139 strcpy(&TARGET[0], FACIL); \ 140 TARGET[_facilLength] = '.'; \ 141 strcpy(&TARGET[_facilLength + 1], FUNC); 142 142 143 143 144 144 /***************************************************************************** 145 145 Set all trace levels to zero. 146 146 147 147 XXX: Currently, no function calls this routine. 148 148 *****************************************************************************/ … … 267 267 psSetTraceLevel(): add the component named "comp" to the component tree, 268 268 if it is not already there, and set it's trace level to "level". 269 269 270 270 NOTE: We modified this so that the user may omit the leading "," in a 271 271 component name. Since the code was already implemented assuming the "." 272 272 was required, rather than change all that code, in this function, I 273 273 simply add a leading "." to the component name if there is none. 274 274 275 275 Input: 276 276 comp … … 284 284 int level) // desired trace level 285 285 { 286 PS_ASSERT_ PTR_NON_NULL(comp, 0);286 PS_ASSERT_STRING_NON_EMPTY(comp, 0); 287 287 288 288 char *compName = NULL; … … 331 331 finds that component, it returns the level of that component. 332 332 Otherwise, it returns ???. 333 333 334 334 NOTE: We modified this so that the user may omit the leading "," in a 335 335 component name. Since the code was already implemented assuming the "." 336 336 was required, rather than change all that code, in this function, I 337 337 simply add a leading "." to the component name if there is none. 338 338 339 339 Inputs: 340 340 name: … … 449 449 const char *name) 450 450 { 451 PS_ASSERT_ PTR_NON_NULL(name, 0);452 PS_ASSERT_ PTR_NON_NULL(func, 0);451 PS_ASSERT_STRING_NON_EMPTY(name, 0); 452 PS_ASSERT_STRING_NON_EMPTY(func, 0); 453 453 454 454 FACILITY(facility, func, name); … … 527 527 va_list ap) 528 528 { 529 PS_ASSERT_ PTR_NON_NULL(comp, );530 PS_ASSERT_ PTR_NON_NULL(format, );529 PS_ASSERT_STRING_NON_EMPTY(comp, ); 530 PS_ASSERT_STRING_NON_EMPTY(format, ); 531 531 532 532 // XXX EAM : fd < 1 does not print messages … … 660 660 ) 661 661 { 662 PS_ASSERT_ PTR_NON_NULL(file, );663 PS_ASSERT_ PTR_NON_NULL(func, );664 PS_ASSERT_ PTR_NON_NULL(facil, );665 PS_ASSERT_ PTR_NON_NULL(format, );662 PS_ASSERT_STRING_NON_EMPTY(file, ); 663 PS_ASSERT_STRING_NON_EMPTY(func, ); 664 PS_ASSERT_STRING_NON_EMPTY(facil, ); 665 PS_ASSERT_STRING_NON_EMPTY(format, ); 666 666 667 667 FACILITY(name, func, facil); … … 698 698 included in message traces. It does not determine the order in which that 699 699 information will appear (that order is fixed). 700 700 701 701 Input: 702 702 fmt: a string specifying the format.
Note:
See TracChangeset
for help on using the changeset viewer.
