1 /* 2 * Copyright (c) 1996-2000 Lucent Technologies. 3 * See README file for details. 4 * 5 * 6 * Most of the changes formerly needed here are handled through 7 * the Makefiles and #ifdef's. 8 * 9 * 10 */ 11 12 #define CVERSION 1 13 14 #ifndef I_LF_H 15 #define I_LF_H 16 17 /*RVERSION*/ 18 19 /* 20 * DIRSEP: '/' for unix; '\\' for DOS 21 */ 22 #ifdef DOS 23 #define DIRSEP '\\' 24 #else 25 #define DIRSEP '/' 26 #endif 27 28 29 /* 30 Some older math libraries have no lgamma() function, and gamma(arg) 31 actually returns log(gamma(arg)). If so, you need to change 32 LGAMMA macro below. 33 34 If all else fails, you can also use lflgamma(). 35 36 Use the definitions for erf, erfc and daws only if your 37 math libraries don't include these functions. 38 */ 39 #ifdef DOS 40 #define LGAMMA(arg) lflgamma(arg) 41 #define erf(x) lferf(x) 42 #define erfc(x) lferfc(x) 43 #else 44 #define LGAMMA(arg) lgamma(arg) 45 #endif 46 #define daws(x) lfdaws(x) 47 48 49 /* 50 Does your system support popen() and pclose() 51 for pipes? For most flavours of unix, yes. 52 For other OS's, usually not, and you'll need to 53 uncomment the following line. 54 55 (This is only relevant if making the C version). 56 */ 57 /* #define NOPIPES */ 58 59 60 /* 61 (the #ifdef's below should now take care of this). 62 the INT type is used for all integers provided in .C() calls from S. 63 For the S version, this should be long int. 64 For the R version, should be int. 65 For the C version, either is adequate. 66 Usually this only makes a difference on 64 bit systems. 67 */ 68 69 //#ifndef SWINVERSION 70 71 //#ifdef RVERSION 72 //typedef int INT; 73 //#else 74 //#ifdef SVERSION 75 //typedef long int INT; 76 //#else 77 typedef int INT; 78 //#endif /* SVERSION */ 79 //#endif /* RVERSION */ 80 81 //#endif /* SWINVERSION */ 82 83 /******** NOTHING BELOW HERE NEEDS CHANGING **********/ 84 85 #include <stdlib.h> 86 #include <stdio.h> 87 #include <string.h> 88 #include <math.h> 89 90 #ifdef RVERSION 91 #undef LGAMMA 92 #define LGAMMA(arg) Rf_lgammafn(arg) 93 extern double Rf_lgammafn(); 94 #define SVERSION 95 #endif 96 97 #ifdef SWINVERSION 98 #define SVERSION 99 #include "newredef.h" 100 #endif 101 102 #include "mutil.h" 103 #include "lfcons.h" 104 #include "lfstruc.h" 105 #include "design.h" 106 #include "lffuns.h" 107 108 #ifdef CVERSION 109 //#undef printf 110 //#define printf lfprintf 111 //extern int lfprintf(const char *format, ...); 112 //extern int printf(const char *format, ...); 113 #endif 114 115 #ifdef SVERSION 116 #define printf printf 117 #endif 118 119 #ifdef INTERFACE 120 #define printf printf 121 #endif 122 123 #define ERROR(args) printf("Error: "), printf args , printf("\n"), lf_error=1 124 #define WARN(args) printf("Warning: "),printf args, printf("\n") 125 126 #define MAX(a,b) (((a)>(b)) ? (a) : (b)) 127 #define MIN(a,b) (((a)<(b)) ? (a) : (b)) 128 #define SGN(x) (((x)>0) ? 1 : -1) 129 #define SQR(x) ((x)*(x)) 130 #define NOSLN 0.1278433 131 #define GFACT 2.5 132 #define EFACT 3.0 133 134 #define MAXCOLOR 20 135 #define MAXWIN 5 136 137 #ifdef SWINVERSION 138 #define ISWAP(a,b) { int zz; zz = a; a = b; b = zz; } 139 #else 140 #define ISWAP(a,b) { INT zz; zz = a; a = b; b = zz; } 141 extern INT lf_error; 142 #endif 143 144 extern INT lf_error; 145 146 double lf_exp(double x); 147 148 #endif /* I_LF_H */ 149