The R Project SVN R

Rev

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

Rev 70108 Rev 71657
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--2016 The R Core Team.
4
 *  Copyright (C) 1997--2016 The R Core Team.
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This header file 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 file is part of R. R is distributed under the terms of the
-
 
12
 *  GNU General Public License, either Version 2, June 1991 or Version 3,
-
 
13
 *  June 2007. See doc/COPYRIGHTS for details of the copyright status of R.
-
 
14
 *
11
 *  This program is distributed in the hope that it will be useful,
15
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU Lesser General Public License for more details.
18
 *  GNU Lesser General Public License for more details.
15
 *
19
 *
16
 *  You should have received a copy of the GNU Lesser General Public License
20
 *  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
21
 *  along with this program; if not, a copy is available at
18
 *  https://www.R-project.org/Licenses/
22
 *  https://www.R-project.org/Licenses/
19
 *
23
 *
20
 *  Much of this is from Doug Bates.
24
 *  Much of this is from Doug Bates.
21
 */
25
 */
22
 
26
 
23
/* 
27
/* 
24
   This is a legacy header and no longer documented.
28
   This is a legacy header and no longer documented.
25
   Code using it should be converted to use R.h
29
   Code using it should be converted to use R.h
26
*/
30
*/
27
 
31
 
28
/* This header includes C headers and so is not safe for inclusion
32
/* This header includes C headers and so is not safe for inclusion
29
   from C++: use R.h instead. */
33
   from C++: use R.h instead. */
30
 
34
 
31
#ifndef R_S_H
35
#ifndef R_S_H
32
#define R_S_H
36
#define R_S_H
33
 
37
 
34
#ifndef USING_R
38
#ifndef USING_R
35
# define USING_R
39
# define USING_R
36
/* is this a good idea? - conflicts with many versions of f2c.h */
40
/* is this a good idea? - conflicts with many versions of f2c.h */
37
# define longint int
41
# define longint int
38
#endif
42
#endif
39
 
43
 
40
#ifdef __cplusplus
44
#ifdef __cplusplus
41
# error S.h can not be used from C++ code: use R.h instead
45
# error S.h can not be used from C++ code: use R.h instead
42
#endif
46
#endif
43
 
47
 
44
#include <stddef.h>
48
#include <stddef.h>
45
#include <stdlib.h>
49
#include <stdlib.h>
46
#include <stdio.h>
50
#include <stdio.h>
47
#include <limits.h>
51
#include <limits.h>
48
#include <float.h>
52
#include <float.h>
49
#include <math.h>
53
#include <math.h>
50
 
54
 
51
#include <Rconfig.h>
55
#include <Rconfig.h>
52
#include <R_ext/Constants.h>
56
#include <R_ext/Constants.h>
53
#include <R_ext/Memory.h>	/* S_alloc */
57
#include <R_ext/Memory.h>	/* S_alloc */
54
 
58
 
55
/* subset of those in Random.h */
59
/* subset of those in Random.h */
56
extern void seed_in(long *);
60
extern void seed_in(long *);
57
extern void seed_out(long *);
61
extern void seed_out(long *);
58
extern double unif_rand(void);
62
extern double unif_rand(void);
59
extern double norm_rand(void);
63
extern double norm_rand(void);
60
 
64
 
61
/* Macros for S/R Compatibility */
65
/* Macros for S/R Compatibility */
62
 
66
 
63
#include <R_ext/RS.h>
67
#include <R_ext/RS.h>
64
/* for PROBLEM ... Calloc, Realloc, Free, Memcpy, F77_xxxx */
68
/* for PROBLEM ... Calloc, Realloc, Free, Memcpy, F77_xxxx */
65
 
69
 
66
/* S4 uses macros equivalent to */
70
/* S4 uses macros equivalent to */
67
#define Salloc(n,t) (t*)S_alloc(n, sizeof(t))
71
#define Salloc(n,t) (t*)S_alloc(n, sizeof(t))
68
#define Srealloc(p,n,old,t) (t*)S_realloc(p,n,old,sizeof(t))
72
#define Srealloc(p,n,old,t) (t*)S_realloc(p,n,old,sizeof(t))
69
 
73
 
70
/* S's complex is different, and is a define to S_complex now */
74
/* S's complex is different, and is a define to S_complex now */
71
typedef struct {
75
typedef struct {
72
	double re;
76
	double re;
73
	double im;
77
	double im;
74
} S_complex;
78
} S_complex;
75
 
79
 
76
#ifdef S_OLD_COMPLEX
80
#ifdef S_OLD_COMPLEX
77
# define complex S_complex
81
# define complex S_complex
78
#endif
82
#endif
79
 
83
 
80
#ifndef NO_CALL_R
84
#ifndef NO_CALL_R
81
/* Not quite full compatibility: beware! */
85
/* Not quite full compatibility: beware! */
82
/* void	call_R(char*, long, void**, char**, long*, char**, long, char**);*/
86
/* void	call_R(char*, long, void**, char**, long*, char**, long, char**);*/
83
#define call_S call_R
87
#define call_S call_R
84
#endif
88
#endif
85
 
89
 
86
#endif /* !R_S_H */
90
#endif /* !R_S_H */