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
311 #define SAWYER_MULTI_THREADED 1
312 #define SAWYER_THREAD_TAG Sawyer::MultiThreadedTag
314 #define SAWYER_MULTI_THREADED 0
315 #define SAWYER_THREAD_TAG Sawyer::SingleThreadedTag
317 #define SAWYER_THREAD_TRAITS Sawyer::SynchronizationTraits<SAWYER_THREAD_TAG>
320 #if __cplusplus >= 201103L
321 #define SAWYER_THREAD_LOCAL thread_local
322 #elif defined(_MSC_VER)
324 #define SAWYER_THREAD_LOCAL __declspec(thread)
327 #define SAWYER_THREAD_LOCAL __thread
330 #define SAWYER_THREAD_LOCAL
338 #if defined(SAWYER_DO_EXPORTS) || defined(ROSE_UTIL_EXPORTS) // defined in CMake when compiling libsawyer
339 #define SAWYER_EXPORT __declspec(dllexport)
341 #define SAWYER_EXPORT_NORETURN __declspec(dllexport noreturn)
344 #define SAWYER_EXPORT_NORETURN __declspec(dllexport)
347 #define SAWYER_EXPORT __declspec(dllimport)
348 #define SAWYER_EXPORT_NORETURN __declspec(noreturn)
350 #elif defined(__APPLE__) && defined(__MACH__)
354 #define SAWYER_EXPORT
358 #define SAWYER_EXPORT_NORETURN
363 #define SAWYER_EXPORT
364 #define SAWYER_EXPORT_NORETURN
367 #define SAWYER_LINKAGE_INFO SAWYER_VERSION_MAJOR, SAWYER_VERSION_MINOR, SAWYER_VERSION_PATCH, SAWYER_MULTI_THREADED
368 #define SAWYER_CHECK_LINKAGE Sawyer::initializeLibrary(SAWYER_LINKAGE_INFO)
381 size_t vminor=SAWYER_VERSION_MINOR,
382 size_t vpatch=SAWYER_VERSION_PATCH,
383 bool withThreads=SAWYER_MULTI_THREADED);
388 SAWYER_EXPORT boost::int64_t
strtoll(
const char*,
char**,
int);
393 SAWYER_EXPORT boost::uint64_t
strtoull(
const char*,
char**,
int);
401 SAWYER_EXPORT FILE *
popen(
const std::string&,
const char *how);
404 SAWYER_EXPORT
int pclose(FILE*);
439 # define SAWYER_ARGUSED(X) (void)(X)
446 # define SAWYER_ATTR_UNUSED
447 # define SAWYER_ATTR_NORETURN
448 # define SAWYER_PRETTY_FUNCTION __FUNCSIG__
449 # define SAWYER_MAY_ALIAS
450 # define SAWYER_STATIC_INIT
451 # define SAWYER_DEPRECATED(WHY)
455 # define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
456 std::vector<TYPE> NAME##Vec_(SIZE); \
457 TYPE *NAME = &(NAME##Vec_[0]);
464 # define SAWYER_ATTR_UNUSED
465 # define SAWYER_ATTR_NORETURN
466 # define SAWYER_PRETTY_FUNCTION __PRETTY_FUNCTION__
467 # define SAWYER_MAY_ALIAS
468 # define SAWYER_STATIC_INIT
469 # define SAWYER_DEPRECATED(WHY)
471 # define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
472 TYPE NAME[SIZE]; memset(NAME, 0, (SIZE)*sizeof(TYPE))
474 #elif defined(__APPLE__) && defined(__MACH__)
479 # define SAWYER_ATTR_UNUSED
480 # define SAWYER_ATTR_NORETURN
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_ATTR_NORETURN __attribute__((noreturn))
500 # define SAWYER_PRETTY_FUNCTION __PRETTY_FUNCTION__
501 # define SAWYER_MAY_ALIAS __attribute__((may_alias))
502 # define SAWYER_DEPRECATED(WHY) __attribute__((deprecated))
506 # define SAWYER_STATIC_INIT __attribute__((init_priority(101)))
508 # define SAWYER_VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE) \
509 TYPE NAME[SIZE]; memset(NAME, 0, (SIZE)*sizeof(TYPE))
513 #define SAWYER_CONFIGURED
int pclose(FILE *)
Semi-portable replacement for pclose.
std::string readOneLine(FILE *)
Reads one line of input from a file.
FILE * popen(const std::string &, const char *how)
Semi-portable replacement for popen.
std::string thisExecutableName()
Return the name of this program obtained from the operating system.
std::string generateSequentialName(size_t length=3)
Generate a sequential name.
Name space for the entire library.
void checkBoost()
Check for valid boost version or abort.
boost::uint64_t strtoull(const char *, char **, int)
Portable replacement for strtoull.
boost::int64_t strtoll(const char *, char **, int)
Portable replacement for strtoll.
bool initializeLibrary(size_t vmajor=0, size_t vminor=1, size_t vpatch=0, bool withThreads=0)
Explicitly initialize the library.