IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10286


Ignore:
Timestamp:
Nov 29, 2006, 11:33:09 AM (20 years ago)
Author:
Paul Price
Message:

Adding function to return long version information, including CVS tag name, whether psDB was included, and the date and time of compilation. Added function to strip CVS keywords from the keyword/value string.

Location:
trunk/psLib/src/sys
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psConfigure.c

    r10284 r10286  
    1313 *  @author Robert DeSonia, MHPCC
    1414 *
    15  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2006-11-29 20:24:19 $
     15 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2006-11-29 21:33:09 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3434static FILE *memCheckFile = NULL;       // File to which to write results of mem check
    3535
     36static const char *cvsTag = "$Name: not supported by cvs2svn $"; // CVS tag name
     37
    3638psString psLibVersion(void)
    3739{
    38     psString version = NULL;
    39     psStringAppend(&version, "%s-v%s",PACKAGE_NAME,PACKAGE_VERSION);
     40    psString version = NULL;            // Version, to return
     41    psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION);
     42    return version;
     43}
     44
     45psString psLibVersionLong(void)
     46{
     47    psString version = psLibVersion();    // Version, to return
     48    psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag
     49
     50    psStringAppend(&version, " (cvs tag %s) compiled %s at %s with"
     51                   #ifdef OMIT_PSDB
     52                   "out"
     53                   #endif
     54                   " psDB", tag, __DATE__, __TIME__);
     55
     56    psFree(tag);
    4057    return version;
    4158}
  • trunk/psLib/src/sys/psConfigure.h

    r9538 r10286  
    1313 *  @author Robert DeSonia, MHPCC
    1414 *
    15  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2006-10-13 21:13:48 $
     15 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2006-11-29 21:33:09 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3030 *  Returns the current psLib version name as a string.
    3131 *
    32  *  @return char*: String with version name.
     32 *  @return psString: String with version name.
    3333 */
    3434psString psLibVersion(
    3535    void
    3636);
     37
     38/** Get current psLib version (full identification)
     39 *
     40 *  Returns the current psLib version name and other information identifying the compilation.
     41 *
     42 *  @return psString: String with identity.
     43 */
     44psString psLibVersionLong(void);
     45
    3746
    3847/** Initializes persistent memory.
  • trunk/psLib/src/sys/psString.c

    r9538 r10286  
    1313 *  @author David Robbins, MHPCC
    1414 *
    15  *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2006-10-13 21:13:48 $
     15 *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2006-11-29 21:33:09 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    379379    return msg;
    380380}
     381
     382
     383psString psStringStripCVS(const char *string, const char *tagName)
     384{
     385    PS_ASSERT_STRING_NON_EMPTY(string, NULL);
     386    PS_ASSERT_STRING_NON_EMPTY(tagName, NULL);
     387
     388    psString tagString = NULL;          // Tag string, e.g., "$Name:" from "Name"
     389    psStringAppend(&tagString, "$%s:", tagName);
     390    char *p = strstr(string, tagString); // The start of the real tag
     391    psFree(tagString);
     392    if (!p) {
     393        return psStringCopy("UNKNOWN");
     394    }
     395
     396    psString tag = psStringCopy(string + 6); // The tag, without the leading tagString
     397    p = strrchr(tag, '$');              // The closing dollar sign
     398    if (p) {
     399        *p = 0;
     400    }
     401    psStringStrip(tag);
     402    if (*tag == 0) {
     403        psFree(tag);
     404        return psStringCopy("UNKNOWN");
     405    }
     406
     407    return tag;
     408}
     409
  • trunk/psLib/src/sys/psString.h

    r9939 r10286  
    1414 *  @author David Robbins, MHPCC
    1515 *
    16  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2006-11-10 00:31:12 $
     16 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2006-11-29 21:33:09 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    208208);
    209209
     210/// Given a CVS keyword string, strip off the CVS-specific keyword to get the value
     211psString psStringStripCVS(const char *string, ///< The string, something like "$CVSKEYWORD: Value$"
     212                          const char *tagName ///< The name of the tag to remove, something like "CVSKEYWORD"
     213                         );
    210214
    211215#define PS_ASSERT_STRING_NON_EMPTY(NAME, RVAL) \
Note: See TracChangeset for help on using the changeset viewer.