2022-09-20 14:30:34 +00:00
|
|
|
#include "config.h"
|
2022-09-20 14:34:24 +00:00
|
|
|
#include "std/stdio.h"
|
2022-09-20 14:30:34 +00:00
|
|
|
|
|
|
|
#define STRINGIZE(x) #x
|
|
|
|
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
|
|
|
|
|
|
|
|
int __moon_version_major()
|
|
|
|
{
|
|
|
|
#ifndef MOON_MAJOR
|
|
|
|
return 0;
|
|
|
|
#else
|
|
|
|
return MOON_MAJOR;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
int __moon_version_minor()
|
|
|
|
{
|
|
|
|
#ifndef MOON_MINOR
|
|
|
|
return 3;
|
|
|
|
#else
|
|
|
|
return MOON_MINOR;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* __moon_version_suffix()
|
|
|
|
{
|
|
|
|
#ifndef _MOON_SUFFIX
|
|
|
|
return "";
|
|
|
|
#else
|
|
|
|
return STRINGIZE_VALUE_OF(_MOON_SUFFIX);
|
|
|
|
#endif
|
2022-09-20 14:34:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char* moon_version()
|
|
|
|
{
|
|
|
|
static char version[64];
|
|
|
|
snprintf(version, sizeof(version), "%d.%d%s", __moon_version_major(), __moon_version_minor(),
|
|
|
|
__moon_version_suffix()); // FIXME: this string is constant each build and should only be calculated once
|
|
|
|
return version;
|
2022-09-20 14:30:34 +00:00
|
|
|
}
|