11#include <boost/cstdint.hpp>
12#include <boost/thread/recursive_mutex.hpp>
302#ifndef SAWYER_VERSION_MAJOR
303#define SAWYER_VERSION_MAJOR 0
304#define SAWYER_VERSION_MINOR 1
305#define SAWYER_VERSION_PATCH 0
313 #define SAWYER_MULTI_THREADED 1
314 #define SAWYER_THREAD_TAG Sawyer::MultiThreadedTag
316 #define SAWYER_MULTI_THREADED 0
317 #define SAWYER_THREAD_TAG Sawyer::SingleThreadedTag
319#define SAWYER_THREAD_TRAITS Sawyer::SynchronizationTraits<SAWYER_THREAD_TAG>
322 #if __cplusplus >= 201103L
323 #define SAWYER_THREAD_LOCAL thread_local
324 #elif defined(_MSC_VER)
326 #define SAWYER_THREAD_LOCAL __declspec(thread)
329 #define SAWYER_THREAD_LOCAL __thread
332 #define SAWYER_THREAD_LOCAL
338 #if defined(SAWYER_DO_EXPORTS) || defined(ROSE_UTIL_EXPORTS)
339 #define SAWYER_EXPORT __declspec(dllexport)
341 #define SAWYER_EXPORT __declspec(dllimport)
344 #define SAWYER_EXPORT
348#define SAWYER_LINKAGE_INFO SAWYER_VERSION_MAJOR, SAWYER_VERSION_MINOR, SAWYER_VERSION_PATCH, SAWYER_MULTI_THREADED
349#define SAWYER_CHECK_LINKAGE Sawyer::initializeLibrary(SAWYER_LINKAGE_INFO)
366 size_t vminor=SAWYER_VERSION_MINOR,
367 size_t vpatch=SAWYER_VERSION_PATCH,
368 bool withThreads=SAWYER_MULTI_THREADED);
373SAWYER_EXPORT boost::int64_t
strtoll(
const char*,
char**,
int);
378SAWYER_EXPORT boost::uint64_t
strtoull(
const char*,
char**,
int);
386SAWYER_EXPORT FILE *
popen(
const std::string&,
const char *how);
410#define SAWYER_HAVE_BOOST_SERIALIZATION
411 #ifdef SAWYER_HAVE_BOOST_SERIALIZATION
412 #include <boost/serialization/access.hpp>
413 #include <boost/serialization/nvp.hpp>
414 #include <boost/serialization/split_member.hpp>
421#if defined(CEREAL_SAVE_FUNCTION_NAME) && defined(CEREAL_LOAD_FUNCTION_NAME) && defined(CEREAL_SERIALIZE_FUNCTION_NAME)
422 #define SAWYER_HAVE_CEREAL
423 #include <cereal/cereal.hpp>
442# define SAWYER_ARGUSED(X) (void)(X)
449# define SAWYER_ATTR_UNUSED
450# define SAWYER_PRETTY_FUNCTION __FUNCSIG__
451# define SAWYER_MAY_ALIAS
452# define SAWYER_STATIC_INIT
453# define SAWYER_DEPRECATED(WHY)
457# define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
458 std::vector<TYPE> NAME##Vec_(SIZE); \
459 TYPE *NAME = &(NAME##Vec_[0]);
466# define SAWYER_ATTR_UNUSED
467# define SAWYER_PRETTY_FUNCTION __PRETTY_FUNCTION__
468# define SAWYER_MAY_ALIAS
469# define SAWYER_STATIC_INIT
470# define SAWYER_DEPRECATED(WHY)
472# define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
473 TYPE NAME[SIZE]; memset(NAME, 0, (SIZE)*sizeof(TYPE))
475#elif defined(__APPLE__) && defined(__MACH__)
480# define SAWYER_ATTR_UNUSED
481# define SAWYER_PRETTY_FUNCTION __PRETTY_FUNCTION__
482# define SAWYER_MAY_ALIAS
483# define SAWYER_STATIC_INIT
484# define SAWYER_DEPRECATED(WHY)
488# define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
489 std::vector<TYPE> NAME##Vec_(SIZE); \
490 TYPE *NAME = &(NAME##Vec_[0]);
498# define SAWYER_ATTR_UNUSED __attribute__((unused))
499# define SAWYER_PRETTY_FUNCTION __PRETTY_FUNCTION__
500# define SAWYER_MAY_ALIAS __attribute__((may_alias))
501# define SAWYER_DEPRECATED(WHY) __attribute__((deprecated))
505# define SAWYER_STATIC_INIT __attribute__((init_priority(101)))
507# define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
508 TYPE *NAME = (TYPE*)alloca((SIZE) * sizeof(TYPE)); memset(NAME, 0, (SIZE)*sizeof(TYPE))
513#define SAWYER_CONFIGURED
int pclose(FILE *)
Semi-portable replacement for pclose.
std::string generateSequentialName(size_t length=3)
Generate a sequential name.
boost::int64_t strtoll(const char *, char **, int)
Portable replacement for strtoll.
std::string thisExecutableName()
Return the name of this program obtained from the operating system.
bool initializeLibrary(size_t vmajor=0, size_t vminor=1, size_t vpatch=0, bool withThreads=0)
Explicitly initialize the library.
std::string readOneLine(FILE *)
Reads one line of input from a file.
void checkBoost()
Check for valid boost version or abort.
boost::uint64_t strtoull(const char *, char **, int)
Portable replacement for strtoull.
FILE * popen(const std::string &, const char *how)
Semi-portable replacement for popen.