diff --git a/include/semver.h b/include/semver.h index cbf3a75..e740261 100644 --- a/include/semver.h +++ b/include/semver.h @@ -4,91 +4,101 @@ #define u128 __uint128_t typedef struct { - uint16_t major; + uint16_t major; } __Simple; typedef struct { - uint16_t major; - uint16_t minor; + uint16_t major; + uint16_t minor; } __Rapid; typedef struct { - uint16_t major; - uint16_t minor; - uint16_t patch; + uint16_t major; + uint16_t minor; + uint16_t patch; } __SemVer; typedef struct { - uint16_t major; - uint16_t minor; - uint16_t patch; - uint16_t build; + uint16_t major; + uint16_t minor; + uint16_t patch; + uint16_t build; } __Extended; typedef enum { - Simple, - Rapid, - SemVer, - Extended, + Simple, + Rapid, + SemVer, + Extended, } VersionKindTag; typedef struct { - char hash[7]; - DateTime dt; + char hash[7]; + DateTime dt; } GitRevision; typedef enum { - Alpha, - Beta, - ReleaseCandidate, - GitRev, - PRNone, + Alpha, + Beta, + ReleaseCandidate, + GitRev, + PRNone, } PreReleaseTag; typedef enum { - any, - arm, - arm64, - loongson, - mips32, - mips64, - powerepc, - powerpc64, - riscv64, - s390x, - sparc, - sparc64, - x86, - x86_64, + 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; + PreReleaseTag pr_tag; + union { + uint16_t alpha; + uint16_t beta; + uint16_t rc; + GitRevision *git; + }; +} PreRelease; + +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, + 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); +u128 u128FromVersion(Version *self); +Comparison compareVersion (Version *self, Version *other); +int parseVersion (Version *self, const char *s); +char *versionToString(Version *self);