comparison rDiff/src/locfit/Source/local.h @ 0:0f80a5141704

version 0.3 uploaded
author vipints
date Thu, 14 Feb 2013 23:38:36 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0f80a5141704
1 /*
2 * Most of the changes formerly needed here are handled through
3 * the Makefiles and #ifdef's.
4 */
5
6 #ifndef I_LF_H
7 #define I_LF_H
8
9 /*
10 * DIRSEP: '/' for unix; '\\' for DOS
11 */
12 #ifdef DOS
13 #define DIRSEP '\\'
14 #else
15 #define DIRSEP '/'
16 #endif
17
18 /*
19 * Some older math libraries have no lgamma() function, and gamma(arg)
20 * actually returns log(gamma(arg)). If so, you need to change
21 * LGAMMA macro below.
22 */
23 #define LGAMMA(arg) lgamma(arg)
24
25 /******** NOTHING BELOW HERE NEEDS CHANGING **********/
26
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <string.h>
30 #include <math.h>
31
32 /*RVERSION*/
33
34 #ifdef SWINVERSION
35 #define SVERSION
36 #include "newredef.h"
37 #endif
38
39 #ifdef RVERSION
40
41 /* #typedef int Sint is defined in R.h */
42 #include <R.h>
43 #include <Rdefines.h>
44 #include <Rinternals.h>
45 #define list_elt(ev,i) VECTOR_PTR(ev)[i]
46 #define dval2(ev,i,j) NUMERIC_POINTER(list_elt(ev,i))[j]
47 #define dvec2(ev,i) NUMERIC_POINTER(list_elt(ev,i))
48 #define ivec2(ev,i) INTEGER_POINTER(list_elt(ev,i))
49 #undef pmatch
50
51 #else
52
53 #ifdef SVERSION
54 #include <S.h>
55 typedef long int Sint;
56 typedef s_object * SEXP;
57 #define list_elt(ev,i) LIST_POINTER(ev)[i]
58 #define dval2(ev,i,j) NUMERIC_POINTER(list_elt(ev,i))[j]
59 #define dvec2(ev,i) NUMERIC_POINTER(list_elt(ev,i))
60 #define ivec2(ev,i) INTEGER_POINTER(list_elt(ev,i))
61 #define ALLOW_MODULES
62 #else
63 typedef int Sint;
64 #endif
65
66 #endif
67
68 #ifdef MATLAB_MEX_FILE
69 #include "mex.h"
70 #define printf mexPrintf
71 #endif
72
73 #ifdef RVERSION
74 #undef LGAMMA
75 #define LGAMMA(arg) Rf_lgammafn(arg)
76 extern double Rf_lgammafn();
77 #define SVERSION
78 #endif
79
80 #include "mutil.h"
81 #include "tube.h"
82
83 #include "lfcons.h"
84
85 typedef char varname[15];
86
87 #ifdef CVERSION
88 #include "cversion.h"
89 #endif
90
91 #include "lfstruc.h"
92 #include "design.h"
93 #include "lffuns.h"
94
95 #ifdef CVERSION
96 #undef printf
97 #define printf lfprintf
98 extern int lfprintf(const char *format, ...);
99 extern int printe(const char *format, ...);
100 #else
101 #define printe printf
102 #endif
103
104 #ifdef ERROR
105 #undef ERROR
106 #endif
107
108 #ifdef WARN
109 #undef WARN
110 #endif
111
112 #define ERROR(args) {printe("Error: "); printe args; printe("\n"); lf_error=1;}
113 #define WARN(args) {printe("Warning: "); printe args; printe("\n"); }
114
115 #define MAX(a,b) (((a)>(b)) ? (a) : (b))
116 #define MIN(a,b) (((a)<(b)) ? (a) : (b))
117 #define SGN(x) (((x)>0) ? 1 : -1)
118 #define SQR(x) ((x)*(x))
119 #define NOSLN 0.1278433
120 #define GFACT 2.5
121 #define EFACT 3.0
122
123 #define MAXCOLOR 20
124 #define MAXWIN 5
125
126 #define ISWAP(a,b) { int zz; zz = a; a = b; b = zz; }
127 extern int lf_error;
128
129 #endif /* I_LF_H */