@@ -122,7 +122,7 @@
Loading
122 122
123 123
listener_dataptr_or_null <- function(x) {
124 124
  cat(crayon::italic(
125 -
    crayon::cyan(x[[1]], ": ALTREP dataptr_or_null, null returned: ")),
125 +
    crayon::cyan(x[[1]], ": ALTREP dataptr_or_null : null returned: ")),
126 126
    display_parameter(x[[2]]), "\n", sep = "")
127 127
}
128 128

@@ -64,12 +64,6 @@
Loading
64 64
    )
65 65
  }
66 66
67 -
  #define LAZYVEC_DIAGNOSTICS(x) VECTOR_ELT(R_altrep_data1(x), 0)
68 -
  #define LAZYVEC_PACKAGE_ENV(x) VECTOR_ELT(R_altrep_data1(x), 1)
69 -
  #define LAZYVEC_USER_DATA(x) VECTOR_ELT(R_altrep_data1(x), 2)
70 -
  #define LAZYVEC_FULL_VEC(x) VECTOR_ELT(R_altrep_data1(x), 3)
71 -
  #define LAZYVEC_ENV(x) VECTOR_ELT(R_altrep_data1(x), 4)
72 -
73 67
  payload <- list(
74 68
75 69
    # user defined or diagnostic API

@@ -135,19 +135,21 @@
Loading
135 135
136 136
R_xlen_t lazyvec_logical_Get_region_method(SEXP x, R_xlen_t i, R_xlen_t n, int *buf)
137 137
{
138 +
  // test for expanded vector here
139 +
138 140
  // custom payload
139 141
  SEXP user_data = PROTECT(LAZYVEC_USER_DATA(x));
140 -
  
142 +
141 143
  // calling environment
142 144
  SEXP calling_env = PROTECT(LAZYVEC_PACKAGE_ENV(x));
143 -
  
145 +
144 146
  // length listener method
145 147
  SEXP get_region_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_GET_REGION));
146 -
  
148 +
147 149
  // i, n argument
148 150
  SEXP i_arg = PROTECT(Rf_ScalarInteger((int)(i + 1)));
149 151
  SEXP n_arg = PROTECT(Rf_ScalarInteger((int)(i)));
150 -
  
152 +
151 153
  // should return a length n vector containing the elements
152 154
  SEXP vec_elems = PROTECT(call_tripple_r_interface(get_region_listener, user_data, i_arg, n_arg, calling_env));
153 155
@@ -158,7 +160,7 @@
Loading
158 160
159 161
  UNPROTECT(6);
160 162
161 -
  return LENGTH(vec_elems);
163 +
  return (R_xlen_t) LENGTH(vec_elems);
162 164
}
163 165
164 166

@@ -0,0 +1,32 @@
Loading
1 +
//  lazyvec - R package for creating, testing and deploying custom ALTREP vectors
2 +
//
3 +
//  Copyright (C) 2019-present, Mark AJ Klik
4 +
//
5 +
//  This file is part of the lazyvec R package.
6 +
//
7 +
//  The lazyvec R package is free software: you can redistribute it and/or modify it
8 +
//  under the terms of the GNU Affero General Public License version 3 as
9 +
//  published by the Free Software Foundation.
10 +
//
11 +
//  The lazyvec R package is distributed in the hope that it will be useful, but
12 +
//  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 +
//  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
14 +
//  for more details.
15 +
//
16 +
//  You should have received a copy of the GNU Affero General Public License along
17 +
//  with the lazyvec R package. If not, see <http://www.gnu.org/licenses/>.
18 +
//
19 +
//  You can contact the author at:
20 +
//  - lazyvec R package source repository : https://github.com/fstpackage/lazyvec
21 +
22 +
23 +
#include <Rcpp.h>
24 +
25 +
#include "api_helpers.h"
26 +
27 +
28 +
// Get the exact ALTREP class descriptor
29 +
// [[Rcpp::export]]
30 +
void lazyvec_deexpand(SEXP lazy_vec) {
31 +
  LAZYVEC_SET_FULL_VEC(lazy_vec, R_NilValue);
32 +
}

@@ -135,19 +135,21 @@
Loading
135 135
136 136
R_xlen_t lazyvec_raw_Get_region_method(SEXP x, R_xlen_t i, R_xlen_t n, Rbyte *buf)
137 137
{
138 +
  // test for expanded vector here
139 +
138 140
  // custom payload
139 141
  SEXP user_data = PROTECT(LAZYVEC_USER_DATA(x));
140 -
  
142 +
141 143
  // calling environment
142 144
  SEXP calling_env = PROTECT(LAZYVEC_PACKAGE_ENV(x));
143 -
  
145 +
144 146
  // length listener method
145 147
  SEXP get_region_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_GET_REGION));
146 -
  
148 +
147 149
  // i, n argument
148 150
  SEXP i_arg = PROTECT(Rf_ScalarInteger((int)(i + 1)));
149 151
  SEXP n_arg = PROTECT(Rf_ScalarInteger((int)(i)));
150 -
  
152 +
151 153
  // should return a length n vector containing the elements
152 154
  SEXP vec_elems = PROTECT(call_tripple_r_interface(get_region_listener, user_data, i_arg, n_arg, calling_env));
153 155
@@ -158,7 +160,7 @@
Loading
158 160
159 161
  UNPROTECT(6);
160 162
161 -
  return LENGTH(vec_elems);
163 +
  return (R_xlen_t) LENGTH(vec_elems);
162 164
}
163 165
164 166

@@ -207,7 +207,7 @@
Loading
207 207
  if (i + n > vec_length) warning("Method element called with range outside the vector")
208 208
209 209
  cat(crayon::italic(
210 -
    crayon::cyan(x$vec_id, ": element : result = ")),
210 +
    crayon::cyan(x$vec_id, ": get_region : result = ")),
211 211
    display_parameter(result), "\n", sep = "")
212 212
213 213
  result

@@ -135,19 +135,21 @@
Loading
135 135
136 136
R_xlen_t lazyvec_integer_Get_region_method(SEXP x, R_xlen_t i, R_xlen_t n, int *buf)
137 137
{
138 +
  // test for expanded vector here
139 +
138 140
  // custom payload
139 141
  SEXP user_data = PROTECT(LAZYVEC_USER_DATA(x));
140 -
  
142 +
141 143
  // calling environment
142 144
  SEXP calling_env = PROTECT(LAZYVEC_PACKAGE_ENV(x));
143 -
  
145 +
144 146
  // length listener method
145 147
  SEXP get_region_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_GET_REGION));
146 -
  
148 +
147 149
  // i, n argument
148 150
  SEXP i_arg = PROTECT(Rf_ScalarInteger((int)(i + 1)));
149 151
  SEXP n_arg = PROTECT(Rf_ScalarInteger((int)(i)));
150 -
  
152 +
151 153
  // should return a length n vector containing the elements
152 154
  SEXP vec_elems = PROTECT(call_tripple_r_interface(get_region_listener, user_data, i_arg, n_arg, calling_env));
153 155
@@ -158,7 +160,7 @@
Loading
158 160
159 161
  UNPROTECT(6);
160 162
161 -
  return LENGTH(vec_elems);
163 +
  return (R_xlen_t) LENGTH(vec_elems);
162 164
}
163 165
164 166

@@ -135,19 +135,21 @@
Loading
135 135
136 136
R_xlen_t lazyvec_real_Get_region_method(SEXP x, R_xlen_t i, R_xlen_t n, double *buf)
137 137
{
138 +
  // test for expanded vector here
139 +
138 140
  // custom payload
139 141
  SEXP user_data = PROTECT(LAZYVEC_USER_DATA(x));
140 -
  
142 +
141 143
  // calling environment
142 144
  SEXP calling_env = PROTECT(LAZYVEC_PACKAGE_ENV(x));
143 -
  
145 +
144 146
  // length listener method
145 147
  SEXP get_region_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_GET_REGION));
146 -
  
148 +
147 149
  // i, n argument
148 150
  SEXP i_arg = PROTECT(Rf_ScalarInteger((int)(i + 1)));
149 151
  SEXP n_arg = PROTECT(Rf_ScalarInteger((int)(i)));
150 -
  
152 +
151 153
  // should return a length n vector containing the elements
152 154
  SEXP vec_elems = PROTECT(call_tripple_r_interface(get_region_listener, user_data, i_arg, n_arg, calling_env));
153 155
@@ -158,7 +160,7 @@
Loading
158 160
159 161
  UNPROTECT(6);
160 162
161 -
  return LENGTH(vec_elems);
163 +
  return (R_xlen_t) LENGTH(vec_elems);
162 164
}
163 165
164 166
Files Coverage
R 52.98%
src 24.39%
Project Totals (23 files) 28.49%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading