File: survS.h

package info (click to toggle)
survival 2.37-7-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,684 kB
  • ctags: 364
  • sloc: asm: 6,453; ansic: 4,857; makefile: 2
file content (78 lines) | stat: -rw-r--r-- 2,198 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* SCCS $Id: survS.h 11252 2009-03-19 13:46:26Z tlumley $ 
**
**   The S.h file defines a few things that I need, and hundreds that I don't.
** In particular, on some architectures, it defines a variable "time"
** which of course conflicts with lots of my C-code, 'time' being a natural
** variable name for survival models.
**   Thanks to Brian Ripley for suggesting a machine independent way of
** fixing this.
**
** The S_alloc function changed it's argument list from Splus version
**   4 to 5, and there is a different one for R.
**   The ALLOC macro allows me to have common C code for all versions,
**   with only this file "survS.h" changed.
*/


#include "R.h"
#include "Rinternals.h"
#include <R_ext/Utils.h>  
#ifdef USING_R
   /* typedef int Sint; */
#define S_EVALUATOR    /* Turn this into a "blank line" in R */
#else
/*
** Splus definitions, to use R type calls
*/
typedef long Sint;
/* 
**  At this point in time (Splus 8.0.1) I need to add a little
**   to the Insightful definitions.  (They are in the process
**   of improving Rinternals, so this may well go away.)  The 
**   two functions below are defined as "not supported".  I need
**   only certain cases of defineVar and eval, so can safely map them.
**   I am using the 8.1 R*.h files courtesy of Bill Dunlap
*/
#ifdef  defineVar
#undef  defineVar
#endif
#define defineVar(a,b,c) ASSIGN_IN_FRAME(a,b, INTEGER_VALUE(c))

#ifdef  eval
#undef  eval
#endif
#define eval(a, b)  EVAL_IN_FRAME(a, INTEGER_VALUE(b))

/*
** These two refer to undefined functions, so use the 8.0.1 defs
*/
#ifdef asInteger
#undef asInteger
#endif
#define asInteger(a) INTEGER_VALUE(a)
#ifdef asReal
#undef asReal
#endif
#define asReal(a) NUMERIC_VALUE(a)

#endif

/*
** Memory defined with ALLOC is removed automatically by S.
**  That with "Calloc" I have to remove myself.  Use the
**  latter for objects that need to to persist between calls.
*/
#ifdef USING_R
#define ALLOC(a,b)  R_alloc(a,b)
#else
#define ALLOC(a,b)  S_alloc(a,b)
#endif

/*
** Prototype for callback function
**
*/
#ifdef USING_R
void cox_callback(int which, double *coef, double *first, double *second,
		  double *penalty, int *flag, int p, SEXP fexpr, SEXP rho);
#endif