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
515d16fe
Commit
515d16fe
authored
Sep 23, 2020
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update for configure
parent
896a8ebb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
68 deletions
+63
-68
GNUmakefile.in
+1
-2
configure.ac
+3
-14
include/cif++/CifUtils.hpp
+2
-2
include/cif++/Config.hpp.in
+1
-50
src/CifUtils.cpp
+56
-0
No files found.
GNUmakefile.in
View file @
515d16fe
...
...
@@ -30,8 +30,7 @@ firstTarget: all
CXX
=
@CXX@
CXXFLAGS
=
@CXXFLAGS@ @BOOST_CPPFLAGS@ @LIBBZ2_CPPFLAGS@
LDFLAGS
=
@LDFLAGS@ @LIBS@ @BOOST_LDFLAGS@ @LIBBZ2_LDFLAGS@
LIBS
=
@BOOST_IOSTREAMS_LIB@
\
@LIBS@
LIBS
=
@LIBS@
prefix
=
@prefix@
exec_prefix
=
@exec_prefix@
...
...
configure.ac
View file @
515d16fe
...
...
@@ -33,20 +33,9 @@ AC_CHECK_HEADER_STDBOOL
AC_CHECK_TYPES([ptrdiff_t])
AC_PROG_MAKE_SET
AC_ARG_VAR([USE_RSRC], [Use resources to store internal data, requires mrc])
AC_ARG_VAR([MRC], [Specify a location for the mrc executable])
dnl We really like to use mrc
if test "x$MRC" = "x"; then
AC_PATH_PROG([MRC], [mrc])
fi
if test "x$MRC" = "x"; then
AC_MSG_WARN([mrc not found, building without support for resources.])
else
USE_RSRC=1
fi
AX_BOOST_BASE([1.71])
AX_BOOST_BASE([1.71], [], [
AC_MSG_ERROR([Sorry, your boost is not found or not up-to-date.])
])
AX_BOOST_REGEX
AX_CHECK_LIBRARY([LIBZ], [zlib.h], [z], [],
...
...
include/cif++/CifUtils.hpp
View file @
515d16fe
...
...
@@ -252,10 +252,10 @@ class rsrc_loader
static
void
init
(
std
::
initializer_list
<
rsrc_loader_info
>
loaders
=
{
{
rsrc_loader_type
::
file
,
"."
},
#if USE_RSRC
{
rsrc_loader_type
::
mrsrc
,
""
,
{
gResourceIndex
,
gResourceData
,
gResourceName
}
}
,
{
rsrc_loader_type
::
mrsrc
,
""
,
{
gResourceIndex
,
gResourceData
,
gResourceName
}
}
#endif
{
rsrc_loader_type
::
file
,
"."
}
})
{
assert
(
not
s_instance
);
...
...
include/cif++/Config.hpp.in
View file @
515d16fe
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2020 NKI/AVL, Netherlands Cancer Institute
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if defined(_MSC_VER)
// These are Microsoft Visual C++ special settings
// the iso646 file contains the C++ keywords that are
// otherwise not recognized.
#include <ciso646>
#define snprintf _snprintf
// Disable some warnings
#pragma warning (disable : 4996)
#pragma warning (disable : 4355)
#endif
/* include/cif++/Config.hpp.in. Generated from configure.ac by autoheader. */
/* define if the Boost library is available */
#undef HAVE_BOOST
/* define if the Boost::IOStreams library is available */
#undef HAVE_BOOST_IOSTREAMS
/* define if the Boost::Regex library is available */
#undef HAVE_BOOST_REGEX
/* define if the Boost::Thread library is available */
#undef HAVE_BOOST_THREAD
/* define if the compiler supports basic C++17 syntax */
#undef HAVE_CXX17
...
...
@@ -69,10 +24,6 @@
/* Define to 1 if LIBZ is found */
#undef HAVE_LIBZ
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
...
...
src/CifUtils.cpp
View file @
515d16fe
...
...
@@ -33,6 +33,8 @@
#include <atomic>
#include <mutex>
#include <thread>
#include <filesystem>
#include <fstream>
#if defined(_MSC_VER)
#define TERM_WIDTH 80
...
...
@@ -48,6 +50,7 @@
#include "cif++/CifUtils.hpp"
namespace
ba
=
boost
::
algorithm
;
namespace
fs
=
std
::
filesystem
;
namespace
cif
{
...
...
@@ -732,6 +735,58 @@ rsrc mrsrc_rsrc_loader_impl::load(const std::string& path) const
return
{
m_data
+
node
->
m_data
,
node
->
m_size
};
}
struct
mrsrc_file_loader_impl
:
public
rsrc_loader_impl
{
mrsrc_file_loader_impl
(
const
rsrc_loader_info
&
info
);
virtual
rsrc
load
(
const
std
::
string
&
path
)
const
;
fs
::
path
m_rsrc_dir
;
mutable
std
::
mutex
m_mutex
;
mutable
std
::
map
<
fs
::
path
,
std
::
string
>
m_cache
;
};
mrsrc_file_loader_impl
::
mrsrc_file_loader_impl
(
const
rsrc_loader_info
&
info
)
:
m_rsrc_dir
(
info
.
info
)
{
if
(
not
fs
::
is_directory
(
m_rsrc_dir
))
{
std
::
cerr
<<
"The directory "
<<
info
.
info
<<
" does not exist"
<<
std
::
endl
<<
"Loading dictionaries will most likely fail"
<<
std
::
endl
;
}
}
rsrc
mrsrc_file_loader_impl
::
load
(
const
std
::
string
&
path
)
const
{
std
::
unique_lock
lock
(
m_mutex
);
fs
::
path
p
=
m_rsrc_dir
/
path
;
if
(
fs
::
exists
(
p
))
{
auto
i
=
m_cache
.
find
(
p
);
if
(
i
==
m_cache
.
end
())
{
std
::
ostringstream
s
;
std
::
ifstream
f
(
p
);
if
(
not
f
.
is_open
())
throw
std
::
runtime_error
(
"Could not open "
+
p
.
string
());
std
::
string
line
;
while
(
std
::
getline
(
f
,
line
))
s
<<
line
<<
std
::
endl
;
std
::
string
data
=
s
.
str
();
std
::
tie
(
i
,
std
::
ignore
)
=
m_cache
.
emplace
(
p
,
data
);
}
return
{
i
->
second
.
c_str
(),
i
->
second
.
length
()
};
}
return
{};
}
rsrc_loader
::
rsrc_loader
(
const
std
::
initializer_list
<
rsrc_loader_info
>&
loaders
)
{
for
(
auto
&
l
:
loaders
)
...
...
@@ -741,6 +796,7 @@ rsrc_loader::rsrc_loader(const std::initializer_list<rsrc_loader_info>& loaders)
switch
(
l
.
type
)
{
case
rsrc_loader_type
:
:
file
:
m_loaders
.
push_back
(
new
mrsrc_file_loader_impl
(
l
));
break
;
case
rsrc_loader_type
:
:
mrsrc
:
...
...
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