IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11705


Ignore:
Timestamp:
Feb 7, 2007, 6:35:35 PM (19 years ago)
Author:
jhoblitt
Message:

change psListAlloc() & psListIteratorAlloc() into wrappers so file/lineo/func can be recorded in the memBlock

Location:
trunk/psLib/src/types
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psList.c

    r11668 r11705  
    55 *  @author Robert Lupton, Princeton University
    66 *  @author Robert Daniel DeSonia, MHPCC
     7 *  @author Joshua Hoblitt, University of Hawaii
    78 *
    8  *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-02-06 21:36:09 $
     9 *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-02-08 04:35:35 $
    1011 *
    1112 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1819#include <stdlib.h>
    1920#include <stdio.h>
     21
    2022#include "psError.h"
    2123#include "psAbort.h"
     
    121123}
    122124
    123 psList* psListAlloc(psPtr data)
    124 {
    125     psList* list = psAlloc(sizeof(psList));
     125psList* p_psListAlloc(const char *file,
     126                    unsigned int lineno,
     127                    const char *func,
     128                    psPtr data)
     129{
     130    psList* list = p_psAlloc(file, lineno, func, sizeof(psList));
    126131
    127132    psMemSetDeallocator(list, (psFreeFunc) listFree);
     
    147152}
    148153
    149 psListIterator* psListIteratorAlloc(psList* list,
     154psListIterator* p_psListIteratorAlloc(const char *file,
     155                                    unsigned int lineno,
     156                                    const char *func,
     157                                    psList* list,
    150158                                    long location,
    151159                                    bool mutable)
     
    156164        return false;
    157165    }
    158     psListIterator* iter = psAlloc(sizeof(psListIterator));
     166    psListIterator* iter = p_psAlloc(file, lineno, func, sizeof(psListIterator));
    159167
    160168    psMemSetDeallocator(iter, (psFreeFunc) listIteratorFree);
  • trunk/psLib/src/types/psList.h

    r11248 r11705  
    55 *  @author Robert Daniel DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-01-23 22:47:23 $
     7 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-02-08 04:35:35 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2222/** Special values of index into list
    2323 *
    24  *  This list of possible list position values should be contiguous non-positive values ending with
    25  *  PS_LIST_UNKNOWN.  Any value less-than-or-equal-to PS_LIST_UNKNOWN is considered a undefined position.
     24 *  This list of possible list position values should be contiguous
     25 *  non-positive values ending with PS_LIST_UNKNOWN.  Any value
     26 *  less-than-or-equal-to PS_LIST_UNKNOWN is considered a undefined position.
    2627 *
    2728 */
     
    3031    PS_LIST_TAIL = -1,                 ///< at tail
    3132};
     33
    3234
    3335/** Doubly-linked list element */
     
    3941}
    4042psListElem;
     43
    4144
    4245/** The psList Linked list structure.  User should not allocate this struct
     
    5861psList;
    5962
     63
    6064/** The psList iterator structure.  This should be allocated via
    6165 *  psListIteratorAlloc and not directly.
     
    7983/** Checks the type of a particular pointer.
    8084 *
    81  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     85 *  Uses the appropriate deallocation function in psMemBlock to check the ptr
     86 *  datatype.
    8287 *
    8388 *  @return bool:       True if the pointer matches a psList structure, false otherwise.
     
    8590bool psMemCheckList(
    8691    psPtr ptr                          ///< the pointer whose type to check
    87 )
    88 ;
     92);
     93
    8994
    9095/** Creates a psList linked list object.
     
    9297 *  @return psList* A new psList object.
    9398 */
     99#ifdef DOXYGEN
    94100psList* psListAlloc(
    95101    psPtr data          ///< initial data item; may be NULL if an empty psList is desired
    96102);
     103#else // ifdef DOXYGEN
     104psList* p_psListAlloc(
     105    const char *file,                   ///< File of caller
     106    unsigned int lineno,                ///< Line number of caller
     107    const char *func,                   ///< Function name of caller
     108    psPtr data                          ///< initial data item; may be NULL if an empty psList is desired
     109);
     110#define psListAlloc(data) \
     111      p_psListAlloc(__FILE__, __LINE__, __func__, data)
     112#endif // ifdef DOXYGEN
     113
    97114
    98115/** Creates a psListIterator object and associates it with a psList.
     
    100117 *  @return psListIterator* A new psListIterator object.
    101118 */
     119#ifdef DOXYGEN
    102120psListIterator* psListIteratorAlloc(
    103121    psList* list,                      ///< the psList to iterate with
     
    106124    bool mutable                       ///< Is it permissible to modify list?
    107125);
     126#else // ifdef DOXYGEN
     127psListIterator* p_psListIteratorAlloc(
     128    const char *file,                   ///< File of caller
     129    unsigned int lineno,                ///< Line number of caller
     130    const char *func,                   ///< Function name of caller
     131    psList* list,                      ///< the psList to iterate with
     132    long location,                     ///< the initial starting point.
     133    ///<  This can be a numeric index, PS_LIST_HEAD, or PS_LIST_TAIL.
     134    bool mutable                       ///< Is it permissible to modify list?
     135);
     136#define psListIteratorAlloc(list, location, mutable) \
     137      p_psListIteratorAlloc(__FILE__, __LINE__, __func__, list, location, mutable)
     138#endif // ifdef DOXYGEN
     139
    108140
    109141/** Set the iterator of the list to a given position.  If location is invalid the
     
    116148    long location                      ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
    117149);
     150
    118151
    119152/** Adds an element to a psList at position given.
     
    127160);
    128161
     162
    129163/** Adds an data item to a psList at position just after the list position given
    130164 *
     
    136170);
    137171
     172
    138173/** Adds a data item to a psList at position just before the list position given
    139174 *
     
    154189);
    155190
     191
    156192/** Remove an item from a list.
    157193 *
     
    162198    psPtr data                         ///< data item to find and remove
    163199);
     200
    164201
    165202/** Retrieve an item from a list.
     
    175212);
    176213
     214
    177215/** Position the specified iterator to the next item in list.
    178216 *
     
    184222);
    185223
     224
    186225/** Position the specified iterator to the previous item in list.
    187226 *
     
    193232);
    194233
     234
    195235/** Convert a linked list to an array
    196236 *
     
    202242);
    203243
     244
    204245/** Convert array to a doubly-linked list
    205246 *
     
    210251    const psArray* array               ///< vector to convert
    211252);
     253
    212254
    213255/** Sort a list via a comparison function.
     
    227269);
    228270
     271
    229272/** Get the number of elements in use from a specified psList. (list.n)
    230273 *
     
    235278);
    236279
     280
    237281/// @} End of DataContainer Functions
    238282#endif // #ifndef PS_LIST_H
Note: See TracChangeset for help on using the changeset viewer.