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

Refactor TYPEOF to enum-style #224

Merged
merged 7 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4

- name: Update bindings
run: |
Expand Down
110 changes: 78 additions & 32 deletions bindings/bindings-linux-aarch64-R4.2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* automatically generated by rust-bindgen 0.69.1 */
/* automatically generated by rust-bindgen 0.69.4 */

/* libR-sys version: 0.6.0 */
/* libR-sys version: 0.7.0 */
/* bindgen clang version: Ubuntu clang version 15.0.7 */
/* clang-rs version: Ubuntu clang version 15.0.7 */
/* r version: 4.2.3 */
Expand Down Expand Up @@ -97,33 +97,6 @@ pub const HAVE_ALLOCA_H: u32 = 1;
pub const HAVE_UINTPTR_T: u32 = 1;
pub const R_XLEN_T_MAX: u64 = 4503599627370496;
pub const R_SHORT_LEN_MAX: u32 = 2147483647;
pub const NILSXP: u32 = 0;
pub const SYMSXP: u32 = 1;
pub const LISTSXP: u32 = 2;
pub const CLOSXP: u32 = 3;
pub const ENVSXP: u32 = 4;
pub const PROMSXP: u32 = 5;
pub const LANGSXP: u32 = 6;
pub const SPECIALSXP: u32 = 7;
pub const BUILTINSXP: u32 = 8;
pub const CHARSXP: u32 = 9;
pub const LGLSXP: u32 = 10;
pub const INTSXP: u32 = 13;
pub const REALSXP: u32 = 14;
pub const CPLXSXP: u32 = 15;
pub const STRSXP: u32 = 16;
pub const DOTSXP: u32 = 17;
pub const ANYSXP: u32 = 18;
pub const VECSXP: u32 = 19;
pub const EXPRSXP: u32 = 20;
pub const BCODESXP: u32 = 21;
pub const EXTPTRSXP: u32 = 22;
pub const WEAKREFSXP: u32 = 23;
pub const RAWSXP: u32 = 24;
pub const S4SXP: u32 = 25;
pub const NEWSXP: u32 = 30;
pub const FREESXP: u32 = 31;
pub const FUNSXP: u32 = 99;
pub const TYPE_BITS: u32 = 5;
pub const MAX_NUM_SEXPTYPE: u32 = 32;
pub const NAMEDMAX: u32 = 7;
Expand Down Expand Up @@ -285,6 +258,7 @@ pub struct _IO_FILE {
pub _unused2: [::std::os::raw::c_char; 20usize],
}
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum Rboolean {
#[doc = ", MAYBE"]
Expand Down Expand Up @@ -327,6 +301,7 @@ pub struct Rf_RegisteredNativeSymbol {
}
pub type R_RegisteredNativeSymbol = Rf_RegisteredNativeSymbol;
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum NativeSymbolType {
R_ANY_SYM = 0,
Expand All @@ -338,8 +313,66 @@ pub enum NativeSymbolType {
pub type Rbyte = ::std::os::raw::c_uchar;
#[doc = "type for length of (standard, not long) vectors etc"]
pub type R_len_t = ::std::os::raw::c_int;
#[doc = "NOT YET using enum:\n 1)\tThe internal SEXPREC struct has 'SEXPTYPE type : 5'\n\t(making FUNSXP and CLOSXP equivalent in there),\n\tgiving (-Wall only ?) warnings all over the place\n 2)\tMany switch(type) { case ... } statements need a final `default:'\n\tadded in order to avoid warnings like \\[e.g. l.170 of ../main/util.c\\]\n\t \"enumeration value `FUNSXP' not handled in switch\""]
pub type SEXPTYPE = ::std::os::raw::c_uint;
#[repr(u32)]
#[non_exhaustive]
#[doc = "------ enum_SEXPTYPE -----"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum SEXPTYPE {
#[doc = "nil = NULL"]
NILSXP = 0,
#[doc = "symbols"]
SYMSXP = 1,
#[doc = "lists of dotted pairs"]
LISTSXP = 2,
#[doc = "closures"]
CLOSXP = 3,
#[doc = "environments"]
ENVSXP = 4,
#[doc = "promises: \\[un\\]evaluated closure arguments"]
PROMSXP = 5,
#[doc = "language constructs (special lists)"]
LANGSXP = 6,
#[doc = "special forms"]
SPECIALSXP = 7,
#[doc = "builtin non-special forms"]
BUILTINSXP = 8,
#[doc = "\"scalar\" string type (internal only)"]
CHARSXP = 9,
#[doc = "logical vectors"]
LGLSXP = 10,
#[doc = "integer vectors"]
INTSXP = 13,
#[doc = "real variables"]
REALSXP = 14,
#[doc = "complex variables"]
CPLXSXP = 15,
#[doc = "string vectors"]
STRSXP = 16,
#[doc = "dot-dot-dot object"]
DOTSXP = 17,
#[doc = "make \"any\" args work"]
ANYSXP = 18,
#[doc = "generic vectors"]
VECSXP = 19,
#[doc = "expressions vectors"]
EXPRSXP = 20,
#[doc = "byte code"]
BCODESXP = 21,
#[doc = "external pointer"]
EXTPTRSXP = 22,
#[doc = "weak reference"]
WEAKREFSXP = 23,
#[doc = "raw bytes"]
RAWSXP = 24,
#[doc = "S4 non-vector"]
S4SXP = 25,
#[doc = "fresh node creaed in new page"]
NEWSXP = 30,
#[doc = "node released by GC"]
FREESXP = 31,
#[doc = "Closure or Builtin"]
FUNSXP = 99,
}
pub type SEXP = *mut SEXPREC;
#[doc = "We sometimes need to coerce a protected value and place the new\ncoerced value under protection. For these cases PROTECT_WITH_INDEX\nsaves an index of the protection location that can be used to\nreplace the protected value using REPROTECT."]
pub type PROTECT_INDEX = ::std::os::raw::c_int;
Expand All @@ -350,6 +383,7 @@ pub struct R_allocator {
}
pub type R_allocator_t = R_allocator;
#[repr(u32)]
#[non_exhaustive]
#[doc = "../main/character.c :"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum nchar_type {
Expand All @@ -358,6 +392,7 @@ pub enum nchar_type {
Width = 2,
}
#[repr(u32)]
#[non_exhaustive]
#[doc = "cetype_t is an identifier reseved by POSIX, but it is\nwell established as public. Could remap by a #define though"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cetype_t {
Expand All @@ -372,6 +407,7 @@ pub enum cetype_t {
pub type R_CFinalizer_t = ::std::option::Option<unsafe extern "C" fn(arg1: SEXP)>;
pub type R_pstream_data_t = *mut ::std::os::raw::c_void;
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum R_pstream_format_t {
R_pstream_any_format = 0,
Expand Down Expand Up @@ -430,6 +466,7 @@ pub struct R_hashtab_type {
pub cell: SEXP,
}
#[repr(u32)]
#[non_exhaustive]
#[doc = "Startup Actions"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum SA_TYPE {
Expand Down Expand Up @@ -506,6 +543,7 @@ impl structRstart {
}
pub type Rstart = *mut structRstart;
#[repr(u32)]
#[non_exhaustive]
#[doc = "PARSE_NULL will not be returned by R_ParseVector"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum ParseStatus {
Expand Down Expand Up @@ -641,6 +679,7 @@ pub type R_altstring_Is_sorted_method_t =
pub type R_altstring_No_NA_method_t =
::std::option::Option<unsafe extern "C" fn(arg1: SEXP) -> ::std::os::raw::c_int>;
#[repr(u32)]
#[non_exhaustive]
#[doc = "The graphics engine will only accept locations and dimensions\n in native device coordinates, but it provides the following functions\n for converting between a couple of simple alternative coordinate\n systems and device coordinates:\n DEVICE = native units of the device\n NDC = Normalised device coordinates\n INCHES = inches (!)\n CM = centimetres (!!)"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum GEUnit {
Expand All @@ -652,6 +691,7 @@ pub enum GEUnit {
GE_CM = 3,
}
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum GEevent {
#[doc = "In response to this event, the registered graphics system\n should allocate and initialise the systemSpecific structure\n\n Should return R_NilValue on failure so that engine\n can tidy up memory allocation"]
Expand All @@ -674,6 +714,7 @@ pub enum GEevent {
GE_ScalePS = 8,
}
#[repr(u32)]
#[non_exhaustive]
#[doc = "Some line end/join constants"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum R_GE_lineend {
Expand All @@ -682,6 +723,7 @@ pub enum R_GE_lineend {
GE_SQUARE_CAP = 3,
}
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum R_GE_linejoin {
GE_ROUND_JOIN = 1,
Expand Down Expand Up @@ -970,6 +1012,7 @@ pub struct _DevDesc {
pub reserved: [::std::os::raw::c_char; 64usize],
}
#[repr(i32)]
#[non_exhaustive]
#[doc = "These give the indices of some known keys"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum R_KeyName {
Expand Down Expand Up @@ -998,6 +1041,7 @@ pub enum R_KeyName {
knDEL = 21,
}
#[repr(u32)]
#[non_exhaustive]
#[doc = "These are the three possible mouse events"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum R_MouseEvent {
Expand Down Expand Up @@ -1084,6 +1128,7 @@ pub type d2fcn_p = ::std::option::Option<
),
>;
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum RNGtype {
WICHMANN_HILL = 0,
Expand All @@ -1096,6 +1141,7 @@ pub enum RNGtype {
LECUYER_CMRG = 7,
}
#[repr(u32)]
#[non_exhaustive]
#[doc = "Different kinds of \"N(0,1)\" generators :"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum N01type {
Expand All @@ -1107,6 +1153,7 @@ pub enum N01type {
KINDERMAN_RAMAGE = 5,
}
#[repr(u32)]
#[non_exhaustive]
#[doc = "Different ways to generate discrete uniform samples"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum Sampletype {
Expand Down Expand Up @@ -1310,7 +1357,6 @@ extern "C" {
pub fn ATTRIB(x: SEXP) -> SEXP;
pub fn OBJECT(x: SEXP) -> ::std::os::raw::c_int;
pub fn MARK(x: SEXP) -> ::std::os::raw::c_int;
pub fn TYPEOF(x: SEXP) -> ::std::os::raw::c_int;
pub fn NAMED(x: SEXP) -> ::std::os::raw::c_int;
pub fn REFCNT(x: SEXP) -> ::std::os::raw::c_int;
pub fn SET_ATTRIB(x: SEXP, v: SEXP);
Expand Down
Loading