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