File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 144144for i in " ${! in_scalars_name[@]} " ; do
145145 R_SIGNATURE+=$' \t SEXP ' " ${in_scalars_name[$i]} " $' ,\n '
146146done
147- R_SIGNATURE=${R_SIGNATURE% $' \n ' }
147+ R_SIGNATURE=${R_SIGNATURE% , $' \n ' }
148148
149149# # 6) PARAM_DOC
150150# #
Original file line number Diff line number Diff line change 2424#include "normalize.h"
2525#include <ta_libc.h>
2626
27+ // the lookback function
28+ // is exported as a standalone
29+ // function for downstream wrappers
30+ // clang-format off
31+ SEXP impl_ta_${NAME}_lookback($R_SIGNATURE
32+ )
33+ // clang-format on
34+ {
35+ // calculate lookback
36+ const int lookback = {{LOOKBACK}};
37+ SEXP output = PROTECT(Rf_ScalarInteger(lookback));
38+
39+ return output;
40+ }
41+
2742// clang-format off
2843SEXP impl_ta_{{NAME}}(
2944 SEXP inOpen,
Original file line number Diff line number Diff line change @@ -110,3 +110,31 @@ ${FUN}.matrix <- function(
110110 ...
111111 )
112112}
113+
114+ #' @usage NULL
115+ ${ALIAS}_lookback <- ${FUN}_lookback <- function(
116+ x,
117+ cols,${ARGS}
118+ ...
119+ ) {
120+ ## validate 'cols'-argument
121+ ## if explicitly passed
122+ if (!missing(cols)) {
123+ assert_formula(cols)
124+ }
125+
126+ ## construct series
127+ ## from input
128+ constructed_series <- series(
129+ x = cols,
130+ default_formula = ${FORMULA},
131+ data = x,
132+ ...
133+ )
134+
135+ .Call(
136+ C_impl_ta_${TA_FUN}_lookback,
137+ ## splice:lookback:start
138+ ## splice:lookback:end
139+ )
140+ }
Original file line number Diff line number Diff line change 2020#include <Rinternals.h>
2121#include <ta_libc.h>
2222
23+ // the lookback function
24+ // is exported as a standalone
25+ // function for downstream wrappers
2326// clang-format off
24- SEXP impl_ta_${NAME}($R_SIGNATURE
27+ SEXP impl_ta_${NAME}_lookback($R_SIGNATURE
28+ )
29+ // clang-format on
30+ {
31+ // calculate lookback
32+ const int lookback = TA_${NAME}_Lookback($LOOKBACK_ARGS);
33+
34+ SEXP output = PROTECT(Rf_ScalarInteger(lookback));
35+
36+ return output;
37+ }
38+
39+ // clang-format off
40+ SEXP impl_ta_${NAME}($R_SIGNATURE,
2541 SEXP na_bridge
2642)
2743// clang-format on
Original file line number Diff line number Diff line change @@ -163,6 +163,34 @@ $FUN.numeric <- function(
163163
164164}
165165
166+ #' @usage NULL
167+ ${ALIAS}_lookback <- ${FUN}_lookback <- function(
168+ x,
169+ cols,${ARGS}
170+ ...
171+ ) {
172+ ## validate 'cols'-argument
173+ ## if explicitly passed
174+ if (!missing(cols)) {
175+ assert_formula(cols)
176+ }
177+
178+ ## construct series
179+ ## from input
180+ constructed_series <- series(
181+ x = cols,
182+ default_formula = ${FORMULA},
183+ data = x,
184+ ...
185+ )
186+
187+ .Call(
188+ C_impl_ta_${TA_FUN}_lookback,
189+ ## splice:lookback:start
190+ ## splice:lookback:end
191+ )
192+ }
193+
166194#' @usage NULL
167195#' @aliases $FUN
168196#'
Original file line number Diff line number Diff line change @@ -70,3 +70,16 @@ ${FUN}.numeric <- function(
7070 ## return indicator
7171 as.double(x)
7272}
73+
74+ #' @usage NULL
75+ ${ALIAS}_lookback <- ${FUN}_lookback <- function(
76+ x,${ARGS}
77+ ) {
78+
79+ .Call(
80+ C_impl_ta_${TA_FUN}_lookback,
81+ ## splice:lookback:start
82+ ## splice:lookback:end
83+ )
84+
85+ }
You can’t perform that action at this time.
0 commit comments