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