The R Project SVN R

Rev

Rev 58668 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 58668 Rev 59039
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1997--2003 The R Development Core Team.
4
 *  Copyright (C) 1997--2003 The R Core Team.
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU Lesser General Public License as published by
7
 *  it under the terms of the GNU Lesser General Public License as published by
8
 *  the Free Software Foundation; either version 2.1 of the License, or
8
 *  the Free Software Foundation; either version 2.1 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
10
 *
10
 *
11
 *  This program is distributed in the hope that it will be useful,
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU Lesser General Public License for more details.
14
 *  GNU Lesser General Public License for more details.
15
 *
15
 *
16
 *  You should have received a copy of the GNU Lesser General Public License
16
 *  You should have received a copy of the GNU Lesser General Public License
17
 *  along with this program; if not, a copy is available at
17
 *  along with this program; if not, a copy is available at
18
 *  http://www.r-project.org/Licenses/
18
 *  http://www.r-project.org/Licenses/
19
 *
19
 *
20
 *  Much of this is from Doug Bates.
20
 *  Much of this is from Doug Bates.
21
 */
21
 */
22
 
22
 
23
#ifndef R_S_H
23
#ifndef R_S_H
24
#define R_S_H
24
#define R_S_H
25
 
25
 
26
#ifndef USING_R
26
#ifndef USING_R
27
# define USING_R
27
# define USING_R
28
/* is this a good idea? - conflicts with many versions of f2c.h */
28
/* is this a good idea? - conflicts with many versions of f2c.h */
29
# define longint int
29
# define longint int
30
#endif
30
#endif
31
 
31
 
32
#ifdef __cplusplus
32
#ifdef __cplusplus
33
extern "C" {
33
extern "C" {
34
#endif
34
#endif
35
 
35
 
36
#include <stddef.h>
36
#include <stddef.h>
37
#include <stdlib.h>
37
#include <stdlib.h>
38
#include <stdio.h>
38
#include <stdio.h>
39
#include <limits.h>
39
#include <limits.h>
40
#include <float.h>
40
#include <float.h>
41
# include <math.h>
41
# include <math.h>
42
 
42
 
43
#include <Rconfig.h>
43
#include <Rconfig.h>
44
#include <R_ext/Constants.h>
44
#include <R_ext/Constants.h>
45
#include <R_ext/Memory.h>	/* S_alloc */
45
#include <R_ext/Memory.h>	/* S_alloc */
46
 
46
 
47
/* subset of those in Random.h */
47
/* subset of those in Random.h */
48
extern void seed_in(long *);
48
extern void seed_in(long *);
49
extern void seed_out(long *);
49
extern void seed_out(long *);
50
extern double unif_rand(void);
50
extern double unif_rand(void);
51
extern double norm_rand(void);
51
extern double norm_rand(void);
52
 
52
 
53
/* Macros for S/R Compatibility */
53
/* Macros for S/R Compatibility */
54
 
54
 
55
#include <R_ext/RS.h>
55
#include <R_ext/RS.h>
56
/* for PROBLEM ... Calloc, Realloc, Free, Memcpy, F77_xxxx */
56
/* for PROBLEM ... Calloc, Realloc, Free, Memcpy, F77_xxxx */
57
 
57
 
58
/* S4 uses macros equivalent to */
58
/* S4 uses macros equivalent to */
59
#define Salloc(n,t) (t*)S_alloc(n, sizeof(t))
59
#define Salloc(n,t) (t*)S_alloc(n, sizeof(t))
60
#define Srealloc(p,n,old,t) (t*)S_realloc(p,n,old,sizeof(t))
60
#define Srealloc(p,n,old,t) (t*)S_realloc(p,n,old,sizeof(t))
61
 
61
 
62
/* S's complex is different, and is a define to S_complex now */
62
/* S's complex is different, and is a define to S_complex now */
63
typedef struct {
63
typedef struct {
64
	double re;
64
	double re;
65
	double im;
65
	double im;
66
} S_complex;
66
} S_complex;
67
 
67
 
68
#ifdef S_OLD_COMPLEX
68
#ifdef S_OLD_COMPLEX
69
# define complex S_complex
69
# define complex S_complex
70
#endif
70
#endif
71
 
71
 
72
#ifndef NO_CALL_R
72
#ifndef NO_CALL_R
73
/* Not quite full compatibility: beware! */
73
/* Not quite full compatibility: beware! */
74
/* void	call_R(char*, long, void**, char**, long*, char**, long, char**);*/
74
/* void	call_R(char*, long, void**, char**, long*, char**, long, char**);*/
75
#define call_S call_R
75
#define call_S call_R
76
#endif
76
#endif
77
 
77
 
78
 
78
 
79
#ifdef __cplusplus
79
#ifdef __cplusplus
80
}
80
}
81
#endif
81
#endif
82
 
82
 
83
#endif /* !R_S_H */
83
#endif /* !R_S_H */