diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-05-24 10:52:17 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-05-24 10:52:17 -0400 |
commit | d5354e6059979054fdfae6caf173617170910b41 (patch) | |
tree | b763b3558d4e3f348f6e5f0599c0bac5c2a4e51e /include | |
parent | 56a84270f4b88c48bf19f9d2cb5a77b34d4f350d (diff) | |
download | spmc-d5354e6059979054fdfae6caf173617170910b41.tar.gz |
Add version type and functions:
* struct Version
* version_{init,read,free}
* version_from() now wraps new functions to return a uint64_t
Diffstat (limited to 'include')
-rw-r--r-- | include/version_spec.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/include/version_spec.h b/include/version_spec.h index aab6540..a05dcb8 100644 --- a/include/version_spec.h +++ b/include/version_spec.h @@ -4,10 +4,11 @@ #ifndef SPM_VERSION_SPEC_H #define SPM_VERSION_SPEC_H -#define VERSION_BASE 16 -#define VERSION_ADDENDUM_BITS 16 +#define VERSION_MAX 8 +#define VERSION_BASE 10 #define VERSION_DELIM "." -#define VERSION_LOCAL "=" +#define VERSION_DELIM_LOCAL "+" +#define VERSION_LOCAL_MAX 255 #define VERSION_OPERATORS " ~!=<>" #define VERSION_NOOP 1 << 0 #define VERSION_EQ 1 << 1 @@ -16,11 +17,16 @@ #define VERSION_LT 1 << 4 #define VERSION_COMPAT 1 << 5 -// version_spec.c -char *version_suffix_get_alpha(char *str); -char *version_suffix_get_modifier(char *str); -int64_t version_suffix_modifier_calc(char *str); -int version_suffix_alpha_calc(char *str); +struct Version { + char *local; + uint64_t asInt; + uint32_t part[VERSION_MAX]; +}; + +struct Version *version_init(); +int version_read(struct Version **version, char *s); +void version_info(struct Version *version); + uint64_t version_from(const char *str); int version_spec_from(const char *op); ManifestPackage **find_by_spec(const Manifest *manifest, const char *name, const char *op, const char *version_str); |