The R Project SVN R

Rev

Rev 75414 | Rev 84208 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
73472 luke 1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 2016  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
 *  https://www.R-project.org/Licenses/
18
 */
19
 
20
#ifndef R_EXT_ALTREP_H_
21
#define R_EXT_ALTREP_H_
22
 
75414 luke 23
#ifdef  __cplusplus
24
extern "C" {
25
#endif
26
 
73472 luke 27
#define STRUCT_SUBTYPES
28
#ifdef STRUCT_SUBTYPES
29
# define R_SEXP(x) (x).ptr
30
# define R_SUBTYPE_INIT(x) { x }
31
  typedef struct { SEXP ptr; } R_altrep_class_t;
32
#else
33
# define R_SEXP(x) ((SEXP) (x))
34
# define R_SUBTYPE_INIT(x) (void *) (x)
35
  typedef struct R_altcls *R_altrep_class_t;
36
#endif
37
 
38
SEXP
75414 luke 39
R_new_altrep(R_altrep_class_t aclass, SEXP data1, SEXP data2);
73472 luke 40
 
41
R_altrep_class_t
42
R_make_altstring_class(const char *cname, const char *pname, DllInfo *info);
43
R_altrep_class_t
44
R_make_altinteger_class(const char *cname, const char *pname, DllInfo *info);
45
R_altrep_class_t
46
R_make_altreal_class(const char *cname, const char *pname, DllInfo *info);
75481 luke 47
R_altrep_class_t
48
R_make_altlogical_class(const char *cname, const char *pname, DllInfo *info);
49
R_altrep_class_t
50
R_make_altraw_class(const char *cname, const char *pname, DllInfo *info);
51
R_altrep_class_t
52
R_make_altcomplex_class(const char *cname, const char *pname, DllInfo *info);
53
 
73472 luke 54
Rboolean R_altrep_inherits(SEXP x, R_altrep_class_t);
55
 
56
typedef SEXP (*R_altrep_UnserializeEX_method_t)(SEXP, SEXP, SEXP, int, int);
57
typedef SEXP (*R_altrep_Unserialize_method_t)(SEXP, SEXP);
58
typedef SEXP (*R_altrep_Serialized_state_method_t)(SEXP);
59
typedef SEXP (*R_altrep_DuplicateEX_method_t)(SEXP, Rboolean);
60
typedef SEXP (*R_altrep_Duplicate_method_t)(SEXP, Rboolean);
61
typedef SEXP (*R_altrep_Coerce_method_t)(SEXP, int);
62
typedef Rboolean (*R_altrep_Inspect_method_t)(SEXP, int, int, int,
63
					      void (*)(SEXP, int, int, int));
64
typedef R_xlen_t (*R_altrep_Length_method_t)(SEXP);
65
 
66
typedef void *(*R_altvec_Dataptr_method_t)(SEXP, Rboolean);
73718 luke 67
typedef const void *(*R_altvec_Dataptr_or_null_method_t)(SEXP);
73472 luke 68
typedef SEXP (*R_altvec_Extract_subset_method_t)(SEXP, SEXP, SEXP);
69
 
70
typedef int (*R_altinteger_Elt_method_t)(SEXP, R_xlen_t);
71
typedef R_xlen_t
72
(*R_altinteger_Get_region_method_t)(SEXP, R_xlen_t, R_xlen_t, int *);
73
typedef int (*R_altinteger_Is_sorted_method_t)(SEXP);
74
typedef int (*R_altinteger_No_NA_method_t)(SEXP);
74224 luke 75
typedef SEXP (*R_altinteger_Sum_method_t)(SEXP, Rboolean); 
76
typedef SEXP (*R_altinteger_Min_method_t)(SEXP, Rboolean);
77
typedef SEXP (*R_altinteger_Max_method_t)(SEXP, Rboolean);
73472 luke 78
 
79
typedef double (*R_altreal_Elt_method_t)(SEXP, R_xlen_t);
80
typedef R_xlen_t
81
(*R_altreal_Get_region_method_t)(SEXP, R_xlen_t, R_xlen_t, double *);
82
typedef int (*R_altreal_Is_sorted_method_t)(SEXP);
83
typedef int (*R_altreal_No_NA_method_t)(SEXP);
74224 luke 84
typedef SEXP (*R_altreal_Sum_method_t)(SEXP, Rboolean); 
85
typedef SEXP (*R_altreal_Min_method_t)(SEXP, Rboolean);
86
typedef SEXP (*R_altreal_Max_method_t)(SEXP, Rboolean);
73472 luke 87
 
75481 luke 88
typedef int (*R_altlogical_Elt_method_t)(SEXP, R_xlen_t);
89
typedef R_xlen_t
90
(*R_altlogical_Get_region_method_t)(SEXP, R_xlen_t, R_xlen_t, int *);
91
typedef int (*R_altlogical_Is_sorted_method_t)(SEXP);
92
typedef int (*R_altlogical_No_NA_method_t)(SEXP);
93
typedef SEXP (*R_altlogical_Sum_method_t)(SEXP, Rboolean);
94
 
95
typedef Rbyte (*R_altraw_Elt_method_t)(SEXP, R_xlen_t);
96
typedef R_xlen_t
97
(*R_altraw_Get_region_method_t)(SEXP, R_xlen_t, R_xlen_t, Rbyte *);
98
 
99
typedef Rcomplex (*R_altcomplex_Elt_method_t)(SEXP, R_xlen_t);
100
typedef R_xlen_t
101
(*R_altcomplex_Get_region_method_t)(SEXP, R_xlen_t, R_xlen_t, Rcomplex *);
102
 
73472 luke 103
typedef SEXP (*R_altstring_Elt_method_t)(SEXP, R_xlen_t);
104
typedef void (*R_altstring_Set_elt_method_t)(SEXP, R_xlen_t, SEXP);
105
typedef int (*R_altstring_Is_sorted_method_t)(SEXP);
106
typedef int (*R_altstring_No_NA_method_t)(SEXP);
107
 
108
#define DECLARE_METHOD_SETTER(CNAME, MNAME)				\
109
    void								\
110
    R_set_##CNAME##_##MNAME##_method(R_altrep_class_t cls,		\
111
				     R_##CNAME##_##MNAME##_method_t fun);
112
 
113
DECLARE_METHOD_SETTER(altrep, UnserializeEX)
114
DECLARE_METHOD_SETTER(altrep, Unserialize)
115
DECLARE_METHOD_SETTER(altrep, Serialized_state)
116
DECLARE_METHOD_SETTER(altrep, DuplicateEX)
117
DECLARE_METHOD_SETTER(altrep, Duplicate)
118
DECLARE_METHOD_SETTER(altrep, Coerce)
119
DECLARE_METHOD_SETTER(altrep, Inspect)
120
DECLARE_METHOD_SETTER(altrep, Length)
121
 
122
DECLARE_METHOD_SETTER(altvec, Dataptr)
123
DECLARE_METHOD_SETTER(altvec, Dataptr_or_null)
124
DECLARE_METHOD_SETTER(altvec, Extract_subset)
125
 
126
DECLARE_METHOD_SETTER(altinteger, Elt)
127
DECLARE_METHOD_SETTER(altinteger, Get_region)
128
DECLARE_METHOD_SETTER(altinteger, Is_sorted)
129
DECLARE_METHOD_SETTER(altinteger, No_NA)
74224 luke 130
DECLARE_METHOD_SETTER(altinteger, Sum)
131
DECLARE_METHOD_SETTER(altinteger, Min)
132
DECLARE_METHOD_SETTER(altinteger, Max)
73472 luke 133
 
134
DECLARE_METHOD_SETTER(altreal, Elt)
135
DECLARE_METHOD_SETTER(altreal, Get_region)
136
DECLARE_METHOD_SETTER(altreal, Is_sorted)
137
DECLARE_METHOD_SETTER(altreal, No_NA)
74224 luke 138
DECLARE_METHOD_SETTER(altreal, Sum)
139
DECLARE_METHOD_SETTER(altreal, Min)
140
DECLARE_METHOD_SETTER(altreal, Max)
73472 luke 141
 
75481 luke 142
DECLARE_METHOD_SETTER(altlogical, Elt)
143
DECLARE_METHOD_SETTER(altlogical, Get_region)
144
DECLARE_METHOD_SETTER(altlogical, Is_sorted)
145
DECLARE_METHOD_SETTER(altlogical, No_NA)
146
DECLARE_METHOD_SETTER(altlogical, Sum)
147
 
148
DECLARE_METHOD_SETTER(altraw, Elt)
149
DECLARE_METHOD_SETTER(altraw, Get_region)
150
 
151
DECLARE_METHOD_SETTER(altcomplex, Elt)
152
DECLARE_METHOD_SETTER(altcomplex, Get_region)
153
 
73472 luke 154
DECLARE_METHOD_SETTER(altstring, Elt)
155
DECLARE_METHOD_SETTER(altstring, Set_elt)
156
DECLARE_METHOD_SETTER(altstring, Is_sorted)
157
DECLARE_METHOD_SETTER(altstring, No_NA)
158
 
75414 luke 159
#ifdef  __cplusplus
160
}
161
#endif
162
 
73472 luke 163
#endif /* R_EXT_ALTREP_H_ */