46#if defined(BRLCADBUILD) && defined(HAVE_CONFIG_H)
48# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
49# include "brlcad_config.h"
53# include "config_win.h"
55# include "brlcad_config.h"
61# if !defined(HAVE_DRAND48) && !defined(drand48)
62# define drand48() ((double)rand() / (double)(RAND_MAX + 1))
63# define HAVE_DRAND48 1
64# define srand48(seed) (srand(seed))
65# define HAVE_DECL_DRAND48 1
66# elif !defined(HAVE_DECL_DRAND48) && !defined(__cplusplus)
67extern double drand48(
void);
70# if !defined(__cplusplus) || defined(HAVE_SHARED_RINT_TEST)
73# if !defined(HAVE_LRINT)
74# define lrint(_x) (((_x) < 0.0) ? (long int)ceil((_x)-0.5) : (long int)floor((_x)+0.5))
75# elif !defined(HAVE_WINDOWS_H) && !defined(HAVE_DECL_LRINT)
76long int lrint(
double x);
77# define HAVE_DECL_LRINT 1
81# if !defined(HAVE_LRINT)
87# if !defined(HAVE_RINT)
88# define rint(_x) (((_x) < 0.0) ? ceil((_x)-0.5) : floor((_x)+0.5))
89# elif !defined(HAVE_WINDOWS_H) && !defined(HAVE_DECL_RINT)
91# define HAVE_DECL_RINT 1
95# if !defined(HAVE_RINT)
101# if defined(HAVE_SNPRINTF) && !defined(HAVE_DECL_SNPRINTF) && !defined(snprintf) && !defined(__cplusplus)
103extern int snprintf(
char *str,
size_t size,
const char *format, ...);
111# define __BEGIN_DECLS extern "C" {
112# define __END_DECLS }
114# define __BEGIN_DECLS
127# define HIDDEN static
138#if !defined __cplusplus && (defined(__STRICT_ANSI__) || defined(__GNUC_GNU_INLINE__))
146# define FMAX(a, b) (((a)>(b))?(a):(b))
150# define FMIN(a, b) (((a)<(b))?(a):(b))
154#if defined(BRLCADBUILD) && defined(HAVE_CONFIG_H)
155# if !defined(HAVE_U_TYPES)
156typedef unsigned char u_char;
157typedef unsigned int u_int;
158typedef unsigned long u_long;
159typedef unsigned short u_short;
160# define HAVE_U_TYPES 1
166#ifndef _FILE_OFFSET_BITS
167# define _FILE_OFFSET_BITS 64
175#if defined(BRLCADBUILD) && defined(HAVE_CONFIG_H)
177# ifdef HAVE_SYS_TYPES_H
178# include <sys/types.h>
183typedef ptrdiff_t ssize_t;
184# define HAVE_SSIZE_T 1
186# define SSIZE_MAX LONG_MAX
188# define SSIZE_MAX INT_MAX
197#if !defined(INT8_MAX) || !defined(INT16_MAX) || !defined(INT32_MAX) || !defined(INT64_MAX)
198# if (defined _MSC_VER && (_MSC_VER <= 1500))
203# elif defined(__STDC__) || defined(__STRICT_ANSI__) || defined(__SIZE_TYPE__) || defined(HAVE_STDINT_H)
204# if !defined(__STDC_LIMIT_MACROS)
205# define __STDC_LIMIT_MACROS 1
207# if !defined(__STDC_CONSTANT_MACROS)
208# define __STDC_CONSTANT_MACROS 1
221# include <sys/stat.h>
222# define b_off_t __int64
223# define fstat _fstati64
224# define stat _stati64
225#elif defined (_WIN32)
226# include <sys/stat.h>
227# define b_off_t _off_t
231# define b_off_t off_t
241# define MAXPATHLEN PATH_MAX
242# elif defined(MAX_PATH)
243# define MAXPATHLEN MAX_PATH
244# elif defined(_MAX_PATH)
245# define MAXPATHLEN _MAX_PATH
247# define MAXPATHLEN 2048
265# warning "GCC_PREREQ unexpectedly defined. Ensure common.h is included first."
269# define GCC_PREREQ(major, minor) __GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))
271# define GCC_PREREQ(major, minor) 0
289# warning "ICC_PREREQ unexpectedly defined. Ensure common.h is included first."
292#if defined __INTEL_COMPILER
293# define ICC_PREREQ(version) (__INTEL_COMPILER >= (version))
295# define ICC_PREREQ(version) 0
303# if !GCC_PREREQ(2, 5)
304# define __attribute__(ignore)
309# if !GCC_PREREQ(2, 7)
310# define __format__ format
311# define __printf__ printf
312# define __noreturn__ noreturn
320# define always_inline noinline
335# warning "UNUSED unexpectedly defined. Ensure common.h is included first."
340# define UNUSED(parameter) UNUSED_ ## parameter __attribute__((unused))
341#elif defined(__cplusplus)
343# define UNUSED(parameter)
346# define UNUSED(parameter) (parameter)
362# warning "LIKELY unexpectedly defined. Ensure common.h is included first."
364#if GCC_PREREQ(3, 0) || ICC_PREREQ(800)
365# define LIKELY(expression) __builtin_expect((expression), 1)
367# define LIKELY(expression) (expression)
383# warning "UNLIKELY unexpectedly defined. Ensure common.h is included first."
385#if GCC_PREREQ(3, 0) || ICC_PREREQ(800)
386# define UNLIKELY(expression) __builtin_expect((expression), 0)
388# define UNLIKELY(expression) (expression)
402# warning "DEPRECATED unexpectedly defined. Ensure common.h is included first."
404#if GCC_PREREQ(3, 1) || ICC_PREREQ(800)
405# define DEPRECATED __attribute__((deprecated))
407# define DEPRECATED __declspec(deprecated("This function is DEPRECATED. Please update code to new API."))
416#if defined(_MSC_VER) && defined(__STDC__)
425#if !defined(__STDC_VERSION__)
426# define __STDC_VERSION__ 0
451# pragma warning( disable : 4351 )
482#if defined(__cplusplus)
483# define EXTERNVARINIT extern
485# define EXTERNVARINIT
497# define CPP_STR(x) # x
509# define CPP_XSTR(x) CPP_STR(x)
525# define CPP_GLUE(a, b) a ## b
539# define CPP_XGLUE(a, b) CPP_GLUE(a, b)
552# define CPP_SCAN(sz) "%" CPP_XSTR(sz) "s"
560# define CPP_FILELINE __FILE__ ":" CPP_XSTR(__LINE__)
569# define COMPILER_DLLEXPORT __declspec(dllexport)
570# define COMPILER_DLLIMPORT __declspec(dllimport)
571#elif defined(__GNUC__) || defined(__clang__)
572# define COMPILER_DLLEXPORT __attribute__ ((visibility ("default")))
573# define COMPILER_DLLIMPORT __attribute__ ((visibility ("default")))
575# define COMPILER_DLLEXPORT
576# define COMPILER_DLLIMPORT
void float float int int int int float * size