Rcpp Version 1.0.9
internal.h
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 //
3 // internal.h: Rcpp R/C++ interface class library --
4 //
5 // Copyright (C) 2012 - 2015 Dirk Eddelbuettel and Romain Francois
6 //
7 // This file is part of Rcpp.
8 //
9 // Rcpp is free software: you can redistribute it and/or modify it
10 // under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // Rcpp is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21 
22 #ifndef Rcpp_internal_h
23 #define Rcpp_internal_h
24 
25 #include <R_ext/Rdynload.h>
26 
27 #define CALLFUN_0(name) SEXP name()
28 #define CALLFUN_1(name) SEXP name(SEXP)
29 #define CALLFUN_2(name) SEXP name(SEXP,SEXP)
30 #define CALLFUN_3(name) SEXP name(SEXP,SEXP,SEXP)
31 #define CALLFUN_4(name) SEXP name(SEXP,SEXP,SEXP,SEXP)
32 #define CALLFUN_5(name) SEXP name(SEXP,SEXP,SEXP,SEXP,SEXP)
33 #define EXTFUN(name) SEXP name(SEXP)
34 
35 // this file contains declarations of functions that are not
36 // exported via Rcpp.h but are needed to make Rcpp work internally
37 
38 #define MAX_ARGS 65
39 #define UNPACK_EXTERNAL_ARGS(__CARGS__,__P__) \
40 SEXP __CARGS__[MAX_ARGS]; \
41 int nargs = 0; \
42 for (; nargs<MAX_ARGS; nargs++) { \
43  if (Rf_isNull(__P__)) break; \
44  __CARGS__[nargs] = CAR(__P__); \
45  __P__ = CDR(__P__); \
46 }
47 
48 #define RCPP_FUN_1(__OUT__,__NAME__, ___0) \
49 __OUT__ RCPP_DECORATE(__NAME__)(___0); \
50 SEXP __NAME__(SEXP x0) { \
51  SEXP res = R_NilValue; \
52  BEGIN_RCPP \
53  res = ::Rcpp::wrap(RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter(x0))); \
54  return res; \
55  END_RCPP \
56 } \
57 __OUT__ RCPP_DECORATE(__NAME__)(___0)
58 
59 
60 #define RCPP_FUN_2(__OUT__,__NAME__, ___0, ___1) \
61 __OUT__ RCPP_DECORATE(__NAME__)(___0, ___1); \
62 SEXP __NAME__(SEXP x0, SEXP x1) { \
63  SEXP res = R_NilValue; \
64  BEGIN_RCPP \
65  res = ::Rcpp::wrap(RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter(x0), \
66  ::Rcpp::internal::converter(x1))); \
67  return res; \
68  END_RCPP \
69 } \
70 __OUT__ RCPP_DECORATE(__NAME__)(___0, ___1)
71 
72 #define RCPP_FUN_3(__OUT__,__NAME__, ___0, ___1, ___2) \
73 __OUT__ RCPP_DECORATE(__NAME__)(___0, ___1, ___2); \
74 SEXP __NAME__(SEXP x0, SEXP x1, SEXP x2) { \
75  SEXP res = R_NilValue; \
76  BEGIN_RCPP \
77  res = ::Rcpp::wrap(RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter(x0), \
78  ::Rcpp::internal::converter(x1), \
79  ::Rcpp::internal::converter(x2))); \
80  return res; \
81  END_RCPP \
82 } \
83 __OUT__ RCPP_DECORATE(__NAME__)(___0, ___1, ___2)
84 
85 #define RCPP_FUN_4(__OUT__,__NAME__, ___0, ___1, ___2, ___3) \
86 __OUT__ RCPP_DECORATE(__NAME__)(___0, ___1, ___2, ___3); \
87 SEXP __NAME__(SEXP x0, SEXP x1, SEXP x2, SEXP x3) { \
88  SEXP res = R_NilValue; \
89  BEGIN_RCPP \
90  res = ::Rcpp::wrap( RCPP_DECORATE(__NAME__)(::Rcpp::internal::converter(x0), \
91  ::Rcpp::internal::converter(x1), \
92  ::Rcpp::internal::converter(x2), \
93  ::Rcpp::internal::converter(x3))); \
94  return res; \
95  END_RCPP \
96 } \
97 __OUT__ RCPP_DECORATE(__NAME__)(___0, ___1, ___2, ___3)
98 
100 
102 
103 CALLFUN_1(Class__name);
104 CALLFUN_1(Class__has_default_constructor);
105 
106 CALLFUN_1(CppClass__complete);
107 CALLFUN_1(CppClass__methods);
108 
109 CALLFUN_1(Module__classes_info);
110 CALLFUN_1(Module__complete);
111 CALLFUN_1(Module__functions_arity);
112 CALLFUN_1(Module__functions_names);
113 CALLFUN_2(Module__get_class);
114 CALLFUN_2(Module__has_class);
115 CALLFUN_2(Module__has_function);
116 CALLFUN_2(Module__get_function);
117 CALLFUN_1(Module__name);
118 CALLFUN_2(CppObject__finalize);
119 
122 
124 CALLFUN_3(CppField__get);
125 CALLFUN_4(CppField__set);
126 
130 
132 
133 /* .External functions */
141 
142 void init_Rcpp_routines(DllInfo*);
143 
144 #undef CALLFUN_0
145 #undef CALLFUN_1
146 #undef CALLFUN_2
147 #undef CALLFUN_3
148 #undef CALLFUN_4
149 #undef CALLFUN_5
150 
151 #endif
SEXP as_character_externalptr(SEXP xp)
Definition: api.cpp:160
SEXP rcpp_capabilities()
Definition: api.cpp:167
SEXP getRcppVersionStrings()
Definition: api.cpp:289
SEXP rcpp_can_use_cxx11()
Definition: api.cpp:265
SEXP rcpp_can_use_cxx0x()
Definition: api.cpp:255
SEXP init_Rcpp_cache()
Definition: barrier.cpp:177
SEXP get_rcpp_cache()
Definition: barrier.cpp:133
SEXP rcpp_error_recorder(SEXP e)
Definition: barrier.cpp:219
void init_Rcpp_routines(DllInfo *)
Definition: rcpp_init.cpp:78
SEXP get_Rcpp_protection_stack()
#define CALLFUN_1(name)
Definition: internal.h:28
#define CALLFUN_4(name)
Definition: internal.h:31
#define EXTFUN(name)
Definition: internal.h:33
#define CALLFUN_2(name)
Definition: internal.h:29
#define CALLFUN_0(name)
Definition: internal.h:27
#define CALLFUN_3(name)
Definition: internal.h:30
SEXP CppMethod__invoke_void(SEXP args)
Definition: module.cpp:185
SEXP CppMethod__invoke(SEXP args)
Definition: module.cpp:166
SEXP InternalFunction_invoke(SEXP args)
Definition: module.cpp:117
SEXP CppMethod__invoke_notvoid(SEXP args)
Definition: module.cpp:204
SEXP class__dummyInstance(SEXP args)
Definition: module.cpp:152
SEXP Module__invoke(SEXP args)
Definition: module.cpp:126
SEXP class__newInstance(SEXP args)
Definition: module.cpp:137