Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
3f884968
Commit
3f884968
authored
Oct 07, 2020
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export version number of lib
parent
e450fee0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
0 deletions
+59
-0
.gitignore
+1
-0
GNUmakefile.in
+17
-0
include/cif++/CifUtils.hpp
+6
-0
src/CifUtils.cpp
+35
-0
No files found.
.gitignore
View file @
3f884968
...
@@ -15,3 +15,4 @@ config.log
...
@@ -15,3 +15,4 @@ config.log
libtool
libtool
rsrc/lib-version.txt
rsrc/lib-version.txt
version-info*.txt
version-info*.txt
src/revision.hpp
GNUmakefile.in
View file @
3f884968
...
@@ -132,6 +132,23 @@ $(OBJDIR)/Symmetry.lo: src/SymOpTable_data.cpp
...
@@ -132,6 +132,23 @@ $(OBJDIR)/Symmetry.lo: src/SymOpTable_data.cpp
endif
endif
REVISION
=
$(
shell
git log
--pretty
=
format:%h
--max-count
=
1
)
REVISION_FILE
=
version-info-
$(REVISION)
.txt
$(REVISION_FILE)
:
rm
-f
version-info-
*
.txt
git describe
--match
=
build
--dirty
>
$@
@
git log
--pretty
=
medium
--date
=
iso8601
-1
>>
$@
src/revision.hpp
:
$(REVISION_FILE)
@
echo
'const char kRevision[] = R"('
>
$@
@
cat
$?
>>
$@
@
echo
')";'
>>
$@
$(OBJDIR)/CifUtils.o
:
src/revision.hpp
$(OBJDIR)/CifUtils.lo
:
src/revision.hpp
$(LIB_TARGET)
:
$(OBJECTS)
$(LIB_TARGET)
:
$(OBJECTS)
$(CXXLINK)
-rpath
$(libdir)
$(OBJECTS)
$(LIBS)
$(CXXLINK)
-rpath
$(libdir)
$(OBJECTS)
$(LIBS)
...
...
include/cif++/CifUtils.hpp
View file @
3f884968
...
@@ -54,6 +54,12 @@ extern const char gResourceName[];
...
@@ -54,6 +54,12 @@ extern const char gResourceName[];
namespace
cif
namespace
cif
{
{
// the git 'build' number
std
::
string
get_version_nr
();
// std::string get_version_date();
// --------------------------------------------------------------------
// some basic utilities: Since we're using ASCII input only, we define for optimisation
// some basic utilities: Since we're using ASCII input only, we define for optimisation
// our own case conversion routines.
// our own case conversion routines.
...
...
src/CifUtils.cpp
View file @
3f884968
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include <fstream>
#include <fstream>
#include <map>
#include <map>
#include <chrono>
#include <chrono>
#include <regex>
#if defined(_MSC_VER)
#if defined(_MSC_VER)
#define TERM_WIDTH 80
#define TERM_WIDTH 80
...
@@ -58,6 +59,40 @@ namespace cif
...
@@ -58,6 +59,40 @@ namespace cif
extern
int
VERBOSE
;
extern
int
VERBOSE
;
// --------------------------------------------------------------------
// --------------------------------------------------------------------
std
::
string
get_version_nr
()
{
const
std
::
regex
rxVersionNr
(
R"(build-(\d+)-g[0-9a-f]{7}(-dirty)?)"
);
#include "revision.hpp"
struct
membuf
:
public
std
::
streambuf
{
membuf
(
char
*
data
,
size_t
length
)
{
this
->
setg
(
data
,
data
,
data
+
length
);
}
}
buffer
(
const_cast
<
char
*>
(
kRevision
),
sizeof
(
kRevision
));
std
::
istream
is
(
&
buffer
);
std
::
string
line
,
result
;
while
(
getline
(
is
,
line
))
{
std
::
smatch
m
;
if
(
std
::
regex_match
(
line
,
m
,
rxVersionNr
))
{
result
=
m
[
1
];
if
(
m
[
2
].
matched
)
result
+=
'*'
;
break
;
}
}
return
result
;
}
// --------------------------------------------------------------------
// This really makes a difference, having our own tolower routines
// This really makes a difference, having our own tolower routines
const
uint8_t
kCharToLowerMap
[
256
]
=
const
uint8_t
kCharToLowerMap
[
256
]
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment