summaryrefslogtreecommitdiff
path: root/rtemstoolkit/rld-rtems.cpp
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-04-03 15:37:01 +1000
committerChris Johns <chrisj@rtems.org>2016-04-03 15:37:01 +1000
commit0c0b2d4b529817f4561088c61827af797eee6def (patch)
tree9f174317a926452c0d2b535aec7ae9e21bc65bd4 /rtemstoolkit/rld-rtems.cpp
parentdfa2468af6a5b306231467a7a1e22cddb2ab576e (diff)
rtemstoolkit: Add version number parsing to get major, minor, revision.
Add support to return the major, minor or revision numbers as numbers.
Diffstat (limited to 'rtemstoolkit/rld-rtems.cpp')
-rw-r--r--rtemstoolkit/rld-rtems.cpp43
1 files changed, 42 insertions, 1 deletions
diff --git a/rtemstoolkit/rld-rtems.cpp b/rtemstoolkit/rld-rtems.cpp
index 86351fd..806a2e1 100644
--- a/rtemstoolkit/rld-rtems.cpp
+++ b/rtemstoolkit/rld-rtems.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Chris Johns <chrisj@rtems.org>
+ * Copyright (c) 2011-2016, Chris Johns <chrisj@rtems.org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -28,6 +28,10 @@ namespace rld
static std::string _path;
static std::string _arch_bsp;
+ static uint64_t _version_major = 0;
+ static uint64_t _version_minor = 0;
+ static uint64_t _version_revision = 0;
+
static void
load_cc ()
{
@@ -130,6 +134,10 @@ namespace rld
set_version (const std::string& version_)
{
_version = version_;
+ rld::version_parse (_version,
+ _version_major,
+ _version_minor,
+ _version_revision);
}
void
@@ -154,6 +162,39 @@ namespace rld
return _version;
}
+ uint64_t
+ version_major ()
+ {
+ if (_version_major == 0)
+ rld::version_parse (_version,
+ _version_major,
+ _version_minor,
+ _version_revision);
+ return _version_major;
+ }
+
+ uint64_t
+ version_minor ()
+ {
+ if (_version_minor == 0)
+ rld::version_parse (_version,
+ _version_major,
+ _version_minor,
+ _version_revision);
+ return _version_minor;
+ }
+
+ uint64_t
+ version_revision ()
+ {
+ if (_version_revision == 0)
+ rld::version_parse (_version,
+ _version_major,
+ _version_minor,
+ _version_revision);
+ return _version_revision;
+ }
+
const std::string
arch_bsp ()
{