1
// $Id: plcdemos.h 11289 2010-10-29 20:44:17Z airwin $
3
// Everything needed by the C demo programs.
4
// Created to avoid junking up plplot.h with this stuff.
17
// define PI if not defined by math.h
19
// Actually M_PI seems to be more widely used so we deprecate PI.
21
#define PI 3.1415926535897932384
25
#define M_PI 3.1415926535897932384
28
// various utility macros
31
#define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
35
#define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
39
#define ROUND( a ) (PLINT) ( ( a ) < 0. ? ( ( a ) - .5 ) : ( ( a ) + .5 ) )
42
// Declarations for save string functions
44
#ifdef PL_HAVE_SNPRINTF
45
// In case only _snprintf is declared (as for Visual C++ and
46
// Borland compiler toolset) we redefine the function names
47
#ifdef _PL_HAVE_SNPRINTF
48
#define snprintf _snprintf
49
#define snscanf _snscanf
50
#endif // _PL_HAVE_SNPRINTF
51
#else // !PL_HAVE_SNPRINTF
52
// declare dummy functions which just call the unsafe
53
// functions ignoring the size of the string
54
int plsnprintf( char *buffer, int n, const char *format, ... );
55
int plsnscanf( const char *buffer, int n, const char *format, ... );
56
#define snprintf plsnprintf
57
#define snscanf plsnscanf
58
#endif // PL_HAVE_SNPRINTF
60
// Add in missing isnan definition if required
61
#if defined ( PL__HAVE_ISNAN )
63
# if defined ( _MSC_VER )
68
#if !defined ( PL_HAVE_ISNAN )
69
# define isnan( x ) ( ( x ) != ( x ) )
72
#endif // __PLCDEMOS_H__