~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/examples/c/plcdemos.h

  • Committer: Joachim Erfle
  • Date: 2013-07-24 13:53:41 UTC
  • Revision ID: joachim.erfle@desy.de-20130724135341-1qojpp701zsn009p
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// $Id: plcdemos.h 11289 2010-10-29 20:44:17Z airwin $
 
2
//
 
3
//      Everything needed by the C demo programs.
 
4
//      Created to avoid junking up plplot.h with this stuff.
 
5
//
 
6
 
 
7
#ifndef __PLCDEMOS_H__
 
8
#define __PLCDEMOS_H__
 
9
 
 
10
#include <math.h>
 
11
#include <string.h>
 
12
#include <ctype.h>
 
13
 
 
14
#include "plConfig.h"
 
15
#include "plplot.h"
 
16
 
 
17
// define PI if not defined by math.h
 
18
 
 
19
// Actually M_PI seems to be more widely used so we deprecate PI.
 
20
#ifndef PI
 
21
#define PI    3.1415926535897932384
 
22
#endif
 
23
 
 
24
#ifndef M_PI
 
25
#define M_PI    3.1415926535897932384
 
26
#endif
 
27
 
 
28
// various utility macros
 
29
 
 
30
#ifndef MAX
 
31
#define MAX( a, b )    ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
 
32
#endif
 
33
 
 
34
#ifndef MIN
 
35
#define MIN( a, b )    ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
 
36
#endif
 
37
 
 
38
#ifndef ROUND
 
39
#define ROUND( a )    (PLINT) ( ( a ) < 0. ? ( ( a ) - .5 ) : ( ( a ) + .5 ) )
 
40
#endif
 
41
 
 
42
// Declarations for save string functions
 
43
 
 
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
 
59
 
 
60
// Add in missing isnan definition if required
 
61
#if defined ( PL__HAVE_ISNAN )
 
62
#  define isnan    _isnan
 
63
#  if defined ( _MSC_VER )
 
64
#    include <float.h>
 
65
#  endif
 
66
#endif
 
67
 
 
68
#if !defined ( PL_HAVE_ISNAN )
 
69
#  define isnan( x )    ( ( x ) != ( x ) )
 
70
#endif
 
71
 
 
72
#endif  // __PLCDEMOS_H__