/** @file pswarpVersion.c
 *
 *  @brief
 *
 *  @ingroup pswarp
 *
 *  @author IfA
 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
 *  @date $Date: 2009-02-05 20:44:04 $
 *  Copyright 2009 Institute for Astronomy, University of Hawaii
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>
#include <pslib.h>
#include <psmodules.h>
#include "pswarp.h"


psString pswarpVersion(void)
{
#ifndef PSWARP_VERSION
#error "PSWARP_VERSION is not set"
#endif
#ifndef PSWARP_BRANCH
#error "PSWARP_BRANCH is not set"
#endif
    return psStringCopy(PSWARP_BRANCH "@" PSWARP_VERSION);
}

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

psString pswarpVersionLong(void)
{
    psString version = pswarpVersion();  // Version, to return
    psString source = pswarpSource();    // Source

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

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

    return version;
};
