94 lines
1.3 KiB
C
94 lines
1.3 KiB
C
#include "epoch.h"
|
|
#include <stdint.h>
|
|
|
|
#define u128 __uint128_t
|
|
|
|
typedef struct {
|
|
uint16_t major;
|
|
} __Simple;
|
|
|
|
typedef struct {
|
|
uint16_t major;
|
|
uint16_t minor;
|
|
} __Rapid;
|
|
|
|
typedef struct {
|
|
uint16_t major;
|
|
uint16_t minor;
|
|
uint16_t patch;
|
|
} __SemVer;
|
|
|
|
typedef struct {
|
|
uint16_t major;
|
|
uint16_t minor;
|
|
uint16_t patch;
|
|
uint16_t build;
|
|
} __Extended;
|
|
|
|
typedef enum {
|
|
Simple,
|
|
Rapid,
|
|
SemVer,
|
|
Extended,
|
|
} VersionKindTag;
|
|
|
|
typedef struct {
|
|
char hash[7];
|
|
DateTime dt;
|
|
} GitRevision;
|
|
|
|
typedef enum {
|
|
Alpha,
|
|
Beta,
|
|
ReleaseCandidate,
|
|
GitRev,
|
|
PRNone,
|
|
} PreReleaseTag;
|
|
|
|
typedef enum {
|
|
any,
|
|
arm,
|
|
arm64,
|
|
loongson,
|
|
mips32,
|
|
mips64,
|
|
powerepc,
|
|
powerpc64,
|
|
riscv64,
|
|
s390x,
|
|
sparc,
|
|
sparc64,
|
|
x86,
|
|
x86_64,
|
|
} Arch;
|
|
|
|
typedef struct {
|
|
VersionKindTag vk_tag;
|
|
union {
|
|
__Simple simple;
|
|
__Rapid rapid;
|
|
__SemVer semver;
|
|
__Extended extended;
|
|
} vk_data;
|
|
PreReleaseTag pr_tag;
|
|
union {
|
|
uint16_t alpha;
|
|
uint16_t beta;
|
|
uint16_t rc;
|
|
GitRevision *git;
|
|
} pr_data;
|
|
Arch arch;
|
|
} Version;
|
|
|
|
typedef enum {
|
|
CompGreater,
|
|
CompEqual,
|
|
CompLess,
|
|
CompNone,
|
|
} Comparison;
|
|
|
|
u128 u128FromVersion(Version *self);
|
|
Comparison compareVersion(Version *self, Version *other);
|
|
int parseVersion(Version *self, const char *s);
|
|
char *versionToString(Version *self);
|
|
|