Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Vendor cpp11 headers #451

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: RPostgres
Title: C++ Interface to PostgreSQL
Version: 1.4.6.9001
Date: 2023-10-28
Version: 1.4.6.9002
Date: 2023-11-08
Authors@R: c(
person("Hadley", "Wickham", role = "aut"),
person("Jeroen", "Ooms", role = "aut"),
Expand Down Expand Up @@ -36,7 +36,6 @@ Suggests:
rmarkdown,
testthat (>= 3.0.0)
LinkingTo:
cpp11,
plogr (>= 0.2.0)
VignetteBuilder:
knitr
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<!-- NEWS.md is maintained by https://fledge.cynkra.com, contributors should not edit this file -->

# RPostgres 1.4.6.9002 (2023-11-08)
pachadotdev marked this conversation as resolved.
Show resolved Hide resolved

- Following from #419 (@Antonov548), includes vendoring and portable Makefiles
(@pachadotdev, #450)


# RPostgres 1.4.6.9001 (2023-10-28)

- Merge branch 'cran-1.4.6'.
Expand Down
26 changes: 26 additions & 0 deletions inst/include/cpp11.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// cpp11 version: 0.4.6
// vendored on: 2023-11-08
#pragma once

#include "cpp11/R.hpp"
#include "cpp11/altrep.hpp"
#include "cpp11/as.hpp"
#include "cpp11/attribute_proxy.hpp"
#include "cpp11/data_frame.hpp"
#include "cpp11/doubles.hpp"
#include "cpp11/environment.hpp"
#include "cpp11/external_pointer.hpp"
#include "cpp11/function.hpp"
#include "cpp11/integers.hpp"
#include "cpp11/list.hpp"
#include "cpp11/list_of.hpp"
#include "cpp11/logicals.hpp"
#include "cpp11/matrix.hpp"
#include "cpp11/named_arg.hpp"
#include "cpp11/protect.hpp"
#include "cpp11/r_bool.hpp"
#include "cpp11/r_string.hpp"
#include "cpp11/r_vector.hpp"
#include "cpp11/raws.hpp"
#include "cpp11/sexp.hpp"
#include "cpp11/strings.hpp"
63 changes: 63 additions & 0 deletions inst/include/cpp11/R.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// cpp11 version: 0.4.6
// vendored on: 2023-11-08
#pragma once

#ifdef R_INTERNALS_H_
#if !(defined(R_NO_REMAP) && defined(STRICT_R_HEADERS))
#error R headers were included before cpp11 headers \
and at least one of R_NO_REMAP or STRICT_R_HEADERS \
was not defined.
#endif
#endif

#define R_NO_REMAP
#define STRICT_R_HEADERS
#include "Rinternals.h"

// clang-format off
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wattributes"
#endif

#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wattributes"
#endif
// clang-format on

#include <type_traits>
#include "cpp11/altrep.hpp"

namespace cpp11 {
namespace literals {

constexpr R_xlen_t operator"" _xl(unsigned long long int value) { return value; }

} // namespace literals

namespace traits {
template <typename T>
struct get_underlying_type {
using type = T;
};
} // namespace traits

template <typename T>
inline T na();

template <typename T>
inline typename std::enable_if<!std::is_same<typename std::decay<T>::type, double>::value,
bool>::type
is_na(const T& value) {
return value == na<T>();
}

template <typename T>
inline typename std::enable_if<std::is_same<typename std::decay<T>::type, double>::value,
bool>::type
is_na(const T& value) {
return ISNA(value);
}

} // namespace cpp11
44 changes: 44 additions & 0 deletions inst/include/cpp11/altrep.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// cpp11 version: 0.4.6
// vendored on: 2023-11-08
#pragma once

#include "Rversion.h"

#if defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0)
#define HAS_ALTREP
#endif

#ifndef HAS_ALTREP

#define ALTREP(x) false

#define REAL_ELT(x, i) REAL(x)[i]
#define INTEGER_ELT(x, i) INTEGER(x)[i]
#define LOGICAL_ELT(x, i) LOGICAL(x)[i]
#define RAW_ELT(x, i) RAW(x)[i]

#define SET_REAL_ELT(x, i, val) REAL(x)[i] = val
#define SET_INTEGER_ELT(x, i, val) INTEGER(x)[i] = val
#define SET_LOGICAL_ELT(x, i, val) LOGICAL(x)[i] = val
#define SET_RAW_ELT(x, i, val) RAW(x)[i] = val

#define REAL_GET_REGION(...) \
do { \
} while (false)

#define INTEGER_GET_REGION(...) \
do { \
} while (false)
#endif

#if !defined HAS_ALTREP || (defined(R_VERSION) && R_VERSION < R_Version(3, 6, 0))

#define LOGICAL_GET_REGION(...) \
do { \
} while (false)

#define RAW_GET_REGION(...) \
do { \
} while (false)

#endif
Loading
Loading