#include "ppStatsInternal.h"

psString ppStatsVersion(void)
{
#ifndef PPSTATS_VERSION
#error "PPSTATS_VERSION is not set"
#endif
#ifndef PPSTATS_BRANCH
#error "PPSTATS_BRANCH is not set"
#endif
    return psStringCopy(PPSTATS_BRANCH "@" PPSTATS_VERSION);
}

psString ppStatsSource(void)
{
#ifndef PPSTATS_SOURCE
#error "PPSTATS_SOURCE is not set"
#endif
    return psStringCopy(PPSTATS_SOURCE);
}

psString ppStatsVersionLong(void)
{
    psString version = ppStatsVersion();  // Version, to return
    psString source = ppStatsSource();    // Source

    psStringPrepend(&version, "ppStats ");
    psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__);
    psFree(source);

#ifdef __OPTIMIZE__
    psStringAppend(&version, " optimised");
#else
    psStringAppend(&version, " unoptimised");
#endif

    return version;
};
