libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_version.h File Reference

Go to the source code of this file.

Macros

#define GBL_VERSION_STRING_SIZE
 
Bitfields

Bitfield positions and masks

#define GBL_VERSION_MAJOR_BITPOS
 
#define GBL_VERSION_MAJOR_MASK
 
#define GBL_VERSION_MINOR_BITPOS
 
#define GBL_VERSION_MINOR_MASK
 
#define GBL_VERSION_PATCH_BITPOS
 
#define GBL_VERSION_PATCH_MASK
 
Compile-Time Versioning

Macros for compile-time encoding

#define GBL_VERSION_MAKE(major, minor, patch)
 
#define GBL_VERSION_STRING(major, minor, patch)
 

Typedefs

typedef uint32_t GblVersion
 

Functions

char * GblVersion_string (GblVersion self, char *pBuffer)
 
Creation

Methods for creating and encoding

GblVersion GblVersion_make (uint8_t major, uint16_t minor, uint8_t patch)
 
GblVersion GblVersion_parse (const char *pString)
 
Field Extraction

Methods for getting field values

uint8_t GblVersion_major (GblVersion self)
 
uint16_t GblVersion_minor (GblVersion self)
 
uint8_t GblVersion_patch (GblVersion self)
 
Field Encoding

Methods for setting field values

void GblVersion_setMajor (GblVersion *pSelf, uint8_t major)
 
void GblVersion_setMinor (GblVersion *pSelf, uint16_t minor)
 
void GblVersion_setPatch (GblVersion *pSelf, uint8_t patch)
 

Detailed Description

GblVersion type, utlities and query functions.

This file contains the GblVersion typedef and its associated API. A GblVersion is a 32-bit unsigned integer, encoded as:

Bits 24-31 9-23 0-8
Field Major Minor Patch
Note
Since it's just an unsigned integer, two versions can directly be compared to one-another for version checks.
Todo:
  • implement fuzzy comparison: GblVersion_compare(version, ">=3.23.0")
  • registered GblType?
Author
2023 Falco Girgis

Definition in file gimbal_version.h.

Macro Definition Documentation

◆ GBL_VERSION_MAJOR_BITPOS

#define GBL_VERSION_MAJOR_BITPOS

Bit position of the MAJOR field.

Definition at line 32 of file gimbal_version.h.

◆ GBL_VERSION_MAJOR_MASK

#define GBL_VERSION_MAJOR_MASK

Bit mask of the MAJOR field.

Definition at line 33 of file gimbal_version.h.

◆ GBL_VERSION_MINOR_BITPOS

#define GBL_VERSION_MINOR_BITPOS

Bit position of the MINOR field.

Definition at line 35 of file gimbal_version.h.

◆ GBL_VERSION_MINOR_MASK

#define GBL_VERSION_MINOR_MASK

Bit mask of the MINOR field.

Definition at line 36 of file gimbal_version.h.

◆ GBL_VERSION_PATCH_BITPOS

#define GBL_VERSION_PATCH_BITPOS

Bit position of the PATCH field.

Definition at line 38 of file gimbal_version.h.

◆ GBL_VERSION_PATCH_MASK

#define GBL_VERSION_PATCH_MASK

Bit mask of the PATCH field.

Definition at line 39 of file gimbal_version.h.

◆ GBL_VERSION_STRING_SIZE

#define GBL_VERSION_STRING_SIZE

Size required for a string buffer to hold a version, used with GblVersion_string()

Definition at line 43 of file gimbal_version.h.

◆ GBL_VERSION_MAKE

#define GBL_VERSION_MAKE (   major,
  minor,
  patch 
)

Encodes a GblVersion from its constituents.

Definition at line 50 of file gimbal_version.h.

◆ GBL_VERSION_STRING

#define GBL_VERSION_STRING (   major,
  minor,
  patch 
)

Creates a compile-time stringified version from its constituents.

Definition at line 52 of file gimbal_version.h.

Function Documentation

◆ GblVersion_make()

GblVersion GblVersion_make ( uint8_t  major,
uint16_t  minor,
uint8_t  patch 
)

Creates and returns a GblVersion from its packed constituent values.

◆ GblVersion_parse()

GblVersion GblVersion_parse ( const char *  pString)

Parses and returns a GblVersion from an encoded version string in the format "MAJOR.MINOR.PATCH".

◆ GblVersion_string()

char * GblVersion_string ( GblVersion  self,
char *  pBuffer 
)

Stringifies a GblVersion, storing it within pBuffer and returning pBuffer.

◆ GblVersion_major()

uint8_t GblVersion_major ( GblVersion  self)

Extracts the 8-bit MAJOR version number field.

◆ GblVersion_minor()

uint16_t GblVersion_minor ( GblVersion  self)

Extracts the 16-bit MINOR version number field.

◆ GblVersion_patch()

uint8_t GblVersion_patch ( GblVersion  self)

Extracts the 8-bit PATCH version number field.

◆ GblVersion_setMajor()

void GblVersion_setMajor ( GblVersion pSelf,
uint8_t  major 
)

Sets the 8-bit MAJOR version number field to major.

◆ GblVersion_setMinor()

void GblVersion_setMinor ( GblVersion pSelf,
uint16_t  minor 
)

Sets the 16-bit MINOR version number field to minor.

◆ GblVersion_setPatch()

void GblVersion_setPatch ( GblVersion pSelf,
uint8_t  patch 
)

Sets the 8-bit PATCH version number field to patch.