Changeset 484
- Timestamp:
- Apr 20, 2004, 2:15:17 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 8 edited
-
sys/psAbort.c (modified) (2 diffs)
-
sys/psError.c (modified) (2 diffs)
-
sys/psLogMsg.c (modified) (2 diffs)
-
sysUtils/psAbort.c (modified) (2 diffs)
-
sysUtils/psDList.c (modified) (5 diffs)
-
sysUtils/psDList.h (modified) (2 diffs)
-
sysUtils/psError.c (modified) (2 diffs)
-
sysUtils/psLogMsg.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psAbort.c
r432 r484 9 9 * @author Eric Van Alst, MHPCC 10 10 * 11 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-04- 16 02:18:57 $11 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-04-21 00:15:17 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 65 65 66 66 // Call logging function with PS_LOG_ABORT level 67 ps VLogMsg(name, PS_LOG_ABORT, fmt, argPtr);67 psLogMsg(name, PS_LOG_ABORT, fmt, argPtr); 68 68 69 69 // Clean up stack after variable arguement has been used -
trunk/psLib/src/sys/psError.c
r463 r484 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-04-2 0 02:30:07 $12 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-04-21 00:15:17 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 65 65 66 66 // Call logging function with PS_LOG_ERROR level 67 ps VLogMsg(name, PS_LOG_ERROR, fmt, argPtr);67 psLogMsg(name, PS_LOG_ERROR, fmt, argPtr); 68 68 69 69 // Clean up stack after variable arguement has been used -
trunk/psLib/src/sys/psLogMsg.c
r482 r484 9 9 #include <time.h> 10 10 #include <unistd.h> 11 11 12 /* #include "psLib.h" */ 12 13 #include "psLogMsg.h" … … 160 161 level 161 162 fmt 162 ap 163 app_psVLogMsg 163 164 Output: 164 165 none -
trunk/psLib/src/sysUtils/psAbort.c
r432 r484 9 9 * @author Eric Van Alst, MHPCC 10 10 * 11 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-04- 16 02:18:57 $11 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-04-21 00:15:17 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 65 65 66 66 // Call logging function with PS_LOG_ABORT level 67 ps VLogMsg(name, PS_LOG_ABORT, fmt, argPtr);67 psLogMsg(name, PS_LOG_ABORT, fmt, argPtr); 68 68 69 69 // Clean up stack after variable arguement has been used -
trunk/psLib/src/sysUtils/psDList.c
r460 r484 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-04-2 0 01:38:34$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-04-21 00:15:17 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 77 77 78 78 if (where > list->n) { 79 psError(__FILE__, "Invalid index %d (only %d elements in psDList).", where, list->n); 80 dlistElemFree(elem); // cleanup just allocated element 81 82 return list; 79 psError(__FILE__, "Invalid index %d (only %d elements in psDList); assuming tail.", where, list->n); 80 where = PS_DLIST_TAIL; 81 } 82 83 if (where == PS_DLIST_PREVIOUS) { 84 if (list->iter == NULL) { // if no iterator position, just insert it in the front of the list. 85 where = PS_DLIST_HEAD; 86 } else { 87 elem->prev = list->iter->prev; 88 elem->next = list->iter; 89 elem->data = psMemIncrRefCounter(data); 90 91 list->iter->prev = elem; 92 if (elem->prev != NULL) { 93 elem->prev->next = elem; 94 } 95 96 list->n++; 97 } 83 98 } 84 99 … … 111 126 } 112 127 list->n++; 113 } else if (where == PS_DLIST_PREVIOUS) { 114 if (list->iter == NULL) { // if no position, just insert it in the front of the list. 115 return psDlistAdd(list,data,PS_DLIST_HEAD); 116 } 117 elem->prev = list->iter->prev; 118 elem->next = list->iter; 119 elem->data = psMemIncrRefCounter(data); 120 121 list->iter->prev = elem; 122 if (elem->prev != NULL) { 123 elem->prev->next = elem; 124 } 125 126 list->n++; 127 } else if (where == PS_DLIST_NEXT) { 128 if (list->iter == NULL) { 129 return psDlistAdd(list,data,PS_DLIST_TAIL); 130 } 131 elem->prev = list->iter; 132 elem->next = list->iter->next; 133 elem->data = psMemIncrRefCounter(data); 134 135 list->iter->next = elem; 136 if (elem->next != NULL) { 137 elem->next->prev = elem; 138 } 139 140 list->n++; 141 } else if (where < 0) { 142 /// XXX What is the best way to communicate this failure to the caller? 143 psError(__func__,"The given insert location (%i) for psDlistAdd is invalid.",where); 144 } else { 145 } 128 } else 129 else if (where == PS_DLIST_NEXT) { 130 if (list->iter == NULL) { 131 return psDlistAdd(list,data,PS_DLIST_TAIL); 132 } 133 elem->prev = list->iter; 134 elem->next = list->iter->next; 135 elem->data = psMemIncrRefCounter(data); 136 137 list->iter->next = elem; 138 if (elem->next != NULL) { 139 elem->next->prev = elem; 140 } 141 142 list->n++; 143 } else if (where < 0) { 144 /// XXX What is the best way to communicate this failure to the caller? 145 psError(__func__,"The given insert location (%i) for psDlistAdd is invalid. " 146 "Adding to head instead.",where); 147 return psDlistAdd(list,data,PS_DLIST_HEAD); // should add it somewhere... 148 } else {} 146 149 147 150 return list; … … 248 251 } 249 252 250 /*****************************************************************************/251 253 /* 252 254 * Retrieve an element from the list, or iterate over list. … … 316 318 } 317 319 318 /*****************************************************************************/ 319 /* 320 * Some wrappers for those iteration calls using psDlistGet. 321 * 322 * First a call to set the iteration pointer to the head of the list 323 */ 324 void psDlistSetIterator(psDlist *list, 325 int where) 326 { 327 if (where != PS_DLIST_HEAD && where != PS_DLIST_TAIL) { 328 psError(__func__, "Invalid where argument: %d; assuming PS_DLIST_HEAD", where); 329 where = PS_DLIST_HEAD; 330 } 331 332 psDlistGet(list, where); // initialise iterator at head/tail 333 } 334 335 /* 336 * and now return the previous/next element of the list 337 */ 338 void *psDlistGetNext(psDlist *list) 339 { 340 return psDlistGet(list, PS_DLIST_NEXT); 341 } 342 343 void *psDlistGetPrevious(psDlist *list) 344 { 345 return psDlistGet(list, PS_DLIST_PREVIOUS); 346 } 347 348 void *psDlistGetCurrent(psDlist *list) 349 { 350 return psDlistGet(list, PS_DLIST_CURRENT); 351 } 352 353 #if 0 354 /* 355 * Convert a psDlist to/from a psVoidPtrArray 356 */ 357 psVoidPtrArray *psDlistToArray(psDlist *restrict dlist) 358 { 359 if (dlist == NULL) { 360 return NULL; 361 } 362 363 psVoidPtrArray *restrict arr = psVoidPtrArrayAlloc(dlist->n, dlist->n); 364 365 psDlistElem *ptr = dlist->head; 366 for (int i = 0, n = dlist->n; i < n; i++) { 367 arr->arr[i] = ptr->data; 368 369 ptr->data = NULL; 370 ptr = ptr->next; 371 } 372 373 psDlistFree(dlist, NULL); 374 375 return arr; 376 } 377 378 psDlist *psArrayToDlist(psVoidPtrArray *arr) 379 { 380 psDlist *list = psDlistAlloc(NULL); // list of elements 381 382 for (int i = 0, n = arr->n; i < n; i++) { 383 psDlistAppend(list, 384 psMemDecrRefCounter(arr->arr[i])); // it's already Incr 385 arr->arr[i] = NULL; 386 } 387 388 psVoidPtrArrayFree(arr, NULL); 389 390 return list; 391 } 392 393 #endif 320 psDlistElem* dlistGetIterator(psDlist* list) 321 { 322 323 324 /* 325 * Some wrappers for those iteration calls using psDlistGet. 326 * 327 * First a call to set the iteration pointer to the head of the list 328 */ 329 void psDlistSetIterator(psDlist *list, 330 int where) { 331 if (where != PS_DLIST_HEAD && where != PS_DLIST_TAIL) { 332 psError(__func__, "Invalid where argument: %d; assuming PS_DLIST_HEAD", where); 333 where = PS_DLIST_HEAD; 334 } 335 336 psDlistGet(list, where); // initialise iterator at head/tail 337 } 338 339 /* 340 * and now return the previous/next element of the list 341 */ 342 void *psDlistGetNext(psDlist *list) { 343 return psDlistGet(list, PS_DLIST_NEXT); 344 } 345 346 void *psDlistGetPrevious(psDlist *list) { 347 return psDlistGet(list, PS_DLIST_PREVIOUS); 348 } 349 350 void *psDlistGetCurrent(psDlist *list) { 351 return psDlistGet(list, PS_DLIST_CURRENT); 352 } 353 354 #if 0 355 /* 356 * Convert a psDlist to/from a psVoidPtrArray 357 */ 358 psVoidPtrArray *psDlistToArray(psDlist *restrict dlist) { 359 if (dlist == NULL) { 360 return NULL; 361 } 362 363 psVoidPtrArray *restrict arr = psVoidPtrArrayAlloc(dlist->n, dlist->n); 364 365 psDlistElem *ptr = dlist->head; 366 for (int i = 0, n = dlist->n; i < n; i++) { 367 arr->arr[i] = ptr->data; 368 369 ptr->data = NULL; 370 ptr = ptr->next; 371 } 372 373 psDlistFree(dlist, NULL); 374 375 return arr; 376 } 377 378 psDlist *psArrayToDlist(psVoidPtrArray *arr) { 379 psDlist *list = psDlistAlloc(NULL); // list of elements 380 381 for (int i = 0, n = arr->n; i < n; i++) { 382 psDlistAppend(list, 383 psMemDecrRefCounter(arr->arr[i])); // it's already Incr 384 arr->arr[i] = NULL; 385 } 386 387 psVoidPtrArrayFree(arr, NULL); 388 389 return list; 390 } 391 392 #endif -
trunk/psLib/src/sysUtils/psDList.h
r460 r484 9 9 * @author Robert Daniel DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-04-2 0 01:38:34$11 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-04-21 00:15:17 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 38 38 { 39 39 int n; ///< number of elements on list 40 psDlistElem *head; ///< first element on list (may be NULL)41 psDlistElem *tail; ///< last element on list (may be NULL)42 psDlistElem *iter; ///< iteration cursor40 psDlistElem* head; ///< first element on list (may be NULL) 41 psDlistElem* tail; ///< last element on list (may be NULL) 42 psDlistElem* iter; ///< iteration cursor 43 43 int iterIndex; 44 44 } -
trunk/psLib/src/sysUtils/psError.c
r463 r484 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-04-2 0 02:30:07 $12 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-04-21 00:15:17 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 65 65 66 66 // Call logging function with PS_LOG_ERROR level 67 ps VLogMsg(name, PS_LOG_ERROR, fmt, argPtr);67 psLogMsg(name, PS_LOG_ERROR, fmt, argPtr); 68 68 69 69 // Clean up stack after variable arguement has been used -
trunk/psLib/src/sysUtils/psLogMsg.c
r482 r484 9 9 #include <time.h> 10 10 #include <unistd.h> 11 11 12 /* #include "psLib.h" */ 12 13 #include "psLogMsg.h" … … 160 161 level 161 162 fmt 162 ap 163 app_psVLogMsg 163 164 Output: 164 165 none
Note:
See TracChangeset
for help on using the changeset viewer.
