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);
413#define SAWYER_HAVE_BOOST_SERIALIZATION
414#ifdef SAWYER_HAVE_BOOST_SERIALIZATION
415 #include <boost/serialization/access.hpp>
416 #include <boost/serialization/nvp.hpp>
417 #include <boost/serialization/split_member.hpp>
424#if defined(CEREAL_SAVE_FUNCTION_NAME) && defined(CEREAL_LOAD_FUNCTION_NAME) && defined(CEREAL_SERIALIZE_FUNCTION_NAME)
425 #define SAWYER_HAVE_CEREAL
426 #include <cereal/cereal.hpp>
445# define SAWYER_ARGUSED(X) (void)(X)
452# define SAWYER_ATTR_UNUSED
453# define SAWYER_PRETTY_FUNCTION __FUNCSIG__
454# define SAWYER_MAY_ALIAS
455# define SAWYER_STATIC_INIT
456# define SAWYER_DEPRECATED(WHY)
460# define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
461 std::vector<TYPE> NAME##Vec_(SIZE); \
462 TYPE *NAME = &(NAME##Vec_[0]);
469# define SAWYER_ATTR_UNUSED
470# define SAWYER_PRETTY_FUNCTION __PRETTY_FUNCTION__
471# define SAWYER_MAY_ALIAS
472# define SAWYER_STATIC_INIT
473# define SAWYER_DEPRECATED(WHY)
475# define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
476 TYPE NAME[SIZE]; memset(NAME, 0, (SIZE)*sizeof(TYPE))
478#elif defined(__APPLE__) && defined(__MACH__)
483# define SAWYER_ATTR_UNUSED
484# define SAWYER_PRETTY_FUNCTION __PRETTY_FUNCTION__
485# define SAWYER_MAY_ALIAS
486# define SAWYER_STATIC_INIT
487# define SAWYER_DEPRECATED(WHY)
491# define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
492 std::vector<TYPE> NAME##Vec_(SIZE); \
493 TYPE *NAME = &(NAME##Vec_[0]);
501# define SAWYER_ATTR_UNUSED __attribute__((unused))
502# define SAWYER_PRETTY_FUNCTION __PRETTY_FUNCTION__
503# define SAWYER_MAY_ALIAS __attribute__((may_alias))
504# define SAWYER_DEPRECATED(WHY) __attribute__((deprecated))
508# define SAWYER_STATIC_INIT __attribute__((init_priority(101)))
510# define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
511 TYPE *NAME = (TYPE*)alloca((SIZE) * sizeof(TYPE)); memset(NAME, 0, (SIZE)*sizeof(TYPE))
515#define SAWYER_CONFIGURED
std::string thisExecutablePath()
Return the full path of this program obtained from the operating system.
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.