IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 17, 2009, 12:08:50 PM (17 years ago)
Author:
beaumont
Message:

merged with head

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/ppStats/src/ppStatsVersion.c

    r13993 r23352  
    11#include "ppStatsInternal.h"
    22
    3 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name
     3#ifndef PPSTATS_VERSION
     4#error "PPSTATS_VERSION is not set"
     5#endif
     6#ifndef PPSTATS_BRANCH
     7#error "PPSTATS_BRANCH is not set"
     8#endif
     9#ifndef PPSTATS_SOURCE
     10#error "PPSTATS_SOURCE is not set"
     11#endif
     12
     13#define xstr(s) str(s)
     14#define str(s) #s
    415
    516psString ppStatsVersion(void)
    617{
    7     psString version = NULL;            // Version, to return
    8     psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION);
    9     return version;
     18    char *value = NULL;
     19    psStringAppend(&value, "%s@%s", xstr(PPSTATS_BRANCH), xstr(PPSTATS_VERSION));
     20    return value;
     21}
     22
     23psString ppStatsSource(void)
     24{
     25    return psStringCopy(xstr(PPSTATS_SOURCE));
    1026}
    1127
    1228psString ppStatsVersionLong(void)
    1329{
    14     psString version = ppStatsVersion(); // Version, to return
    15     psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag
    16     psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__);
    17     psFree(tag);
     30    psString version = ppStatsVersion();  // Version, to return
     31    psString source = ppStatsSource();    // Source
     32
     33    psStringPrepend(&version, "ppStats ");
     34    psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__);
     35    psFree(source);
     36
     37#ifdef __OPTIMIZE__
     38    psStringAppend(&version, " optimised");
     39#else
     40    psStringAppend(&version, " unoptimised");
     41#endif
     42
    1843    return version;
     44};
     45
     46bool ppStatsVersionHeader(psMetadata *header)
     47{
     48    PS_ASSERT_METADATA_NON_NULL(header, false);
     49
     50    psString version = ppStatsVersion(); // Software version
     51    psString source = ppStatsSource();   // Software source
     52
     53    psStringPrepend(&version, "ppStats version: ");
     54    psStringPrepend(&source, "ppStats source: ");
     55
     56    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, version);
     57    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, source);
     58
     59    psFree(version);
     60    psFree(source);
     61
     62    return true;
    1963}
Note: See TracChangeset for help on using the changeset viewer.