summaryrefslogtreecommitdiff
path: root/ext/fiddle/fiddle.c
diff options
context:
space:
mode:
authorKenta Murata <[email protected]>2020-12-11 09:41:12 +0900
committerGitHub <[email protected]>2020-12-11 09:41:12 +0900
commit9b0c36b39032cffff3c62a2b0e1fc38fa429f5ea (patch)
tree667648b7563a97e5d5270baccd5654d5de91358c /ext/fiddle/fiddle.c
parent6b1d2de6cc2e85fda7885fe77dbd7c99c4eb1ef2 (diff)
Import fiddle-1.0.4 (#3860)
I don't use tool/sync_default_gem.rb because the last sync was incomplete. Co-authored-by: Hiroshi SHIBATA <[email protected]> Co-authored-by: Alan Wu <[email protected]> Co-authored-by: sinisterchipmunk <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Notes
Notes: Merged-By: mrkn <[email protected]>
Diffstat (limited to 'ext/fiddle/fiddle.c')
-rw-r--r--ext/fiddle/fiddle.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c
index 546b1dc451..dd819a298c 100644
--- a/ext/fiddle/fiddle.c
+++ b/ext/fiddle/fiddle.c
@@ -7,6 +7,10 @@ VALUE rb_eFiddleError;
void Init_fiddle_pointer(void);
void Init_fiddle_pinned(void);
+#ifdef FIDDLE_MEMORY_VIEW
+void Init_fiddle_memory_view(void);
+#endif
+
/*
* call-seq: Fiddle.malloc(size)
*
@@ -204,6 +208,38 @@ Init_fiddle(void)
rb_define_const(mFiddle, "TYPE_LONG_LONG", INT2NUM(TYPE_LONG_LONG));
#endif
+#ifdef TYPE_INT8_T
+ /* Document-const: TYPE_INT8_T
+ *
+ * C type - int8_t
+ */
+ rb_define_const(mFiddle, "TYPE_INT8_T", INT2NUM(TYPE_INT8_T));
+#endif
+
+#ifdef TYPE_INT16_T
+ /* Document-const: TYPE_INT16_T
+ *
+ * C type - int16_t
+ */
+ rb_define_const(mFiddle, "TYPE_INT16_T", INT2NUM(TYPE_INT16_T));
+#endif
+
+#ifdef TYPE_INT32_T
+ /* Document-const: TYPE_INT32_T
+ *
+ * C type - int32_t
+ */
+ rb_define_const(mFiddle, "TYPE_INT32_T", INT2NUM(TYPE_INT32_T));
+#endif
+
+#ifdef TYPE_INT64_T
+ /* Document-const: TYPE_INT64_T
+ *
+ * C type - int64_t
+ */
+ rb_define_const(mFiddle, "TYPE_INT64_T", INT2NUM(TYPE_INT64_T));
+#endif
+
/* Document-const: TYPE_FLOAT
*
* C type - float
@@ -298,6 +334,30 @@ Init_fiddle(void)
rb_define_const(mFiddle, "ALIGN_LONG_LONG", INT2NUM(ALIGN_LONG_LONG));
#endif
+ /* Document-const: ALIGN_INT8_T
+ *
+ * The alignment size of a int8_t
+ */
+ rb_define_const(mFiddle, "ALIGN_INT8_T", INT2NUM(ALIGN_INT8_T));
+
+ /* Document-const: ALIGN_INT16_T
+ *
+ * The alignment size of a int16_t
+ */
+ rb_define_const(mFiddle, "ALIGN_INT16_T", INT2NUM(ALIGN_INT16_T));
+
+ /* Document-const: ALIGN_INT32_T
+ *
+ * The alignment size of a int32_t
+ */
+ rb_define_const(mFiddle, "ALIGN_INT32_T", INT2NUM(ALIGN_INT32_T));
+
+ /* Document-const: ALIGN_INT64_T
+ *
+ * The alignment size of a int64_t
+ */
+ rb_define_const(mFiddle, "ALIGN_INT64_T", INT2NUM(ALIGN_INT64_T));
+
/* Document-const: ALIGN_FLOAT
*
* The alignment size of a float
@@ -388,6 +448,30 @@ Init_fiddle(void)
rb_define_const(mFiddle, "SIZEOF_LONG_LONG", INT2NUM(sizeof(LONG_LONG)));
#endif
+ /* Document-const: SIZEOF_INT8_T
+ *
+ * size of a int8_t
+ */
+ rb_define_const(mFiddle, "SIZEOF_INT8_T", INT2NUM(sizeof(int8_t)));
+
+ /* Document-const: SIZEOF_INT16_T
+ *
+ * size of a int16_t
+ */
+ rb_define_const(mFiddle, "SIZEOF_INT16_T", INT2NUM(sizeof(int16_t)));
+
+ /* Document-const: SIZEOF_INT32_T
+ *
+ * size of a int32_t
+ */
+ rb_define_const(mFiddle, "SIZEOF_INT32_T", INT2NUM(sizeof(int32_t)));
+
+ /* Document-const: SIZEOF_INT64_T
+ *
+ * size of a int64_t
+ */
+ rb_define_const(mFiddle, "SIZEOF_INT64_T", INT2NUM(sizeof(int64_t)));
+
/* Document-const: SIZEOF_FLOAT
*
* size of a float
@@ -461,5 +545,9 @@ Init_fiddle(void)
Init_fiddle_handle();
Init_fiddle_pointer();
Init_fiddle_pinned();
+
+#ifdef FIDDLE_MEMORY_VIEW
+ Init_fiddle_memory_view();
+#endif
}
/* vim: set noet sws=4 sw=4: */