Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / include / R_ext / RS.h @ 2486

History | View | Annotate | Download (3.1 kB)

1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1999-2007 The R Core Team.
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU Lesser General Public License as published by
7
 *  the Free Software Foundation; either version 2.1 of the License, or
8
 *  (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Lesser General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Lesser General Public License
16
 *  along with this program; if not, a copy is available at
17
 *  http://www.r-project.org/Licenses/
18
 */
19

    
20
/* Included by R.h: API */
21

    
22
#ifndef R_RS_H
23
#define R_RS_H
24

    
25
#ifndef NO_C_HEADERS
26
# include <string.h>                /* for memcpy, memset */
27
#endif
28

    
29
#include <Rconfig.h>                /* for F77_APPEND_UNDERSCORE */
30

    
31
#ifdef  __cplusplus
32
extern "C" {
33
#endif
34

    
35
/* S Like Error Handling */
36

    
37
#include <R_ext/Error.h>        /* for error and warning */
38

    
39
#ifndef STRICT_R_HEADERS
40

    
41
#define R_PROBLEM_BUFSIZE        4096
42
/* Parentheses added for FC4 with gcc4 and -D_FORTIFY_SOURCE=2 */
43
#define PROBLEM                        {char R_problem_buf[R_PROBLEM_BUFSIZE];(sprintf)(R_problem_buf,
44
#define MESSAGE                 {char R_problem_buf[R_PROBLEM_BUFSIZE];(sprintf)(R_problem_buf,
45
#define ERROR                        ),error(R_problem_buf);}
46
#define RECOVER(x)                ),error(R_problem_buf);}
47
#define WARNING(x)                ),warning(R_problem_buf);}
48
#define LOCAL_EVALUATOR                /**/
49
#define NULL_ENTRY                /**/
50
#define WARN                        WARNING(NULL)
51

    
52
#endif
53

    
54
/* S Like Memory Management */
55

    
56
extern void *R_chk_calloc(size_t, size_t);
57
extern void *R_chk_realloc(void *, size_t);
58
extern void R_chk_free(void *);
59

    
60
#ifndef STRICT_R_HEADERS
61
/* S-PLUS 3.x but not 5.x NULLs the pointer in the following */
62
#define Calloc(n, t)   (t *) R_chk_calloc( (size_t) (n), sizeof(t) )
63
#define Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (size_t)((n) * sizeof(t)) )
64
#define Free(p)        (R_chk_free( (void *)(p) ), (p) = NULL)
65
#endif
66
#define R_Calloc(n, t)   (t *) R_chk_calloc( (size_t) (n), sizeof(t) )
67
#define R_Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (size_t)((n) * sizeof(t)) )
68
#define R_Free(p)      (R_chk_free( (void *)(p) ), (p) = NULL)
69

    
70
#define Memcpy(p,q,n)  memcpy( p, q, (size_t)(n) * sizeof(*p) )
71

    
72
/* added for 3.0.0 */
73
#define Memzero(p,n)  memset(p, 0, (size_t)(n) * sizeof(*p))
74

    
75
#define CallocCharBuf(n) (char *) R_chk_calloc((size_t) ((n)+1), sizeof(char))
76

    
77
/* S Like Fortran Interface */
78
/* These may not be adequate everywhere. Convex had _ prepending common
79
   blocks, and some compilers may need to specify Fortran linkage */
80

    
81
#ifdef HAVE_F77_UNDERSCORE
82
# define F77_CALL(x)        x ## _
83
#else
84
# define F77_CALL(x)        x
85
#endif
86
#define F77_NAME(x)    F77_CALL(x)
87
#define F77_SUB(x)     F77_CALL(x)
88
#define F77_COM(x)     F77_CALL(x)
89
#define F77_COMDECL(x) F77_CALL(x)
90

    
91
#ifndef NO_CALL_R
92
void        call_R(char*, long, void**, char**, long*, char**, long, char**);
93
#endif
94

    
95
#ifdef  __cplusplus
96
}
97
#endif
98

    
99
#endif /* R_RS_H */