zscan 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/pack/pack-27.c +1 -0
- data/ext/pack/pack.c +1 -0
- data/ext/pack/ruby/backward/2/assume.h +43 -0
- data/ext/pack/ruby/backward/2/attributes.h +157 -0
- data/ext/pack/ruby/backward/2/bool.h +37 -0
- data/ext/pack/ruby/backward/2/extern.h +46 -0
- data/ext/pack/ruby/backward/2/gcc_version_since.h +38 -0
- data/ext/pack/ruby/backward/2/inttypes.h +132 -0
- data/ext/pack/ruby/backward/2/limits.h +100 -0
- data/ext/pack/ruby/backward/2/long_long.h +65 -0
- data/ext/pack/ruby/backward/2/r_cast.h +27 -0
- data/ext/pack/ruby/backward/2/rmodule.h +31 -0
- data/ext/pack/ruby/backward/2/stdalign.h +30 -0
- data/ext/pack/ruby/backward/2/stdarg.h +47 -0
- data/ext/pack/ruby/backward/classext.h +25 -0
- data/ext/pack/ruby/backward/rubyio.h +18 -0
- data/ext/pack/ruby/backward/rubysig.h +26 -0
- data/ext/pack/ruby/backward/st.h +18 -0
- data/ext/pack/ruby/backward/util.h +18 -0
- data/ext/pack/ruby/internal/anyargs.h +375 -0
- data/ext/pack/ruby/internal/arithmetic.h +38 -0
- data/ext/pack/ruby/internal/arithmetic/char.h +58 -0
- data/ext/pack/ruby/internal/arithmetic/double.h +39 -0
- data/ext/pack/ruby/internal/arithmetic/fixnum.h +44 -0
- data/ext/pack/ruby/internal/arithmetic/gid_t.h +34 -0
- data/ext/pack/ruby/internal/arithmetic/int.h +163 -0
- data/ext/pack/ruby/internal/arithmetic/intptr_t.h +42 -0
- data/ext/pack/ruby/internal/arithmetic/long.h +244 -0
- data/ext/pack/ruby/internal/arithmetic/long_long.h +53 -0
- data/ext/pack/ruby/internal/arithmetic/mode_t.h +34 -0
- data/ext/pack/ruby/internal/arithmetic/off_t.h +49 -0
- data/ext/pack/ruby/internal/arithmetic/pid_t.h +34 -0
- data/ext/pack/ruby/internal/arithmetic/short.h +54 -0
- data/ext/pack/ruby/internal/arithmetic/size_t.h +51 -0
- data/ext/pack/ruby/internal/arithmetic/st_data_t.h +59 -0
- data/ext/pack/ruby/internal/arithmetic/uid_t.h +34 -0
- data/ext/pack/ruby/internal/assume.h +90 -0
- data/ext/pack/ruby/internal/attr/alloc_size.h +32 -0
- data/ext/pack/ruby/internal/attr/artificial.h +46 -0
- data/ext/pack/ruby/internal/attr/cold.h +37 -0
- data/ext/pack/ruby/internal/attr/const.h +46 -0
- data/ext/pack/ruby/internal/attr/constexpr.h +85 -0
- data/ext/pack/ruby/internal/attr/deprecated.h +59 -0
- data/ext/pack/ruby/internal/attr/diagnose_if.h +42 -0
- data/ext/pack/ruby/internal/attr/enum_extensibility.h +32 -0
- data/ext/pack/ruby/internal/attr/error.h +32 -0
- data/ext/pack/ruby/internal/attr/flag_enum.h +33 -0
- data/ext/pack/ruby/internal/attr/forceinline.h +40 -0
- data/ext/pack/ruby/internal/attr/format.h +38 -0
- data/ext/pack/ruby/internal/attr/maybe_unused.h +38 -0
- data/ext/pack/ruby/internal/attr/noalias.h +58 -0
- data/ext/pack/ruby/internal/attr/nodiscard.h +45 -0
- data/ext/pack/ruby/internal/attr/noexcept.h +91 -0
- data/ext/pack/ruby/internal/attr/noinline.h +35 -0
- data/ext/pack/ruby/internal/attr/nonnull.h +32 -0
- data/ext/pack/ruby/internal/attr/noreturn.h +48 -0
- data/ext/pack/ruby/internal/attr/pure.h +43 -0
- data/ext/pack/ruby/internal/attr/restrict.h +45 -0
- data/ext/pack/ruby/internal/attr/returns_nonnull.h +37 -0
- data/ext/pack/ruby/internal/attr/warning.h +32 -0
- data/ext/pack/ruby/internal/attr/weakref.h +32 -0
- data/ext/pack/ruby/internal/cast.h +53 -0
- data/ext/pack/ruby/internal/compiler_is.h +45 -0
- data/ext/pack/ruby/internal/compiler_is/apple.h +41 -0
- data/ext/pack/ruby/internal/compiler_is/clang.h +38 -0
- data/ext/pack/ruby/internal/compiler_is/gcc.h +46 -0
- data/ext/pack/ruby/internal/compiler_is/intel.h +41 -0
- data/ext/pack/ruby/internal/compiler_is/msvc.h +57 -0
- data/ext/pack/ruby/internal/compiler_is/sunpro.h +55 -0
- data/ext/pack/ruby/internal/compiler_since.h +61 -0
- data/ext/pack/ruby/internal/config.h +131 -0
- data/ext/pack/ruby/internal/constant_p.h +37 -0
- data/ext/pack/ruby/internal/core.h +35 -0
- data/ext/pack/ruby/internal/core/rarray.h +275 -0
- data/ext/pack/ruby/internal/core/rbasic.h +85 -0
- data/ext/pack/ruby/internal/core/rbignum.h +51 -0
- data/ext/pack/ruby/internal/core/rclass.h +47 -0
- data/ext/pack/ruby/internal/core/rdata.h +174 -0
- data/ext/pack/ruby/internal/core/rfile.h +36 -0
- data/ext/pack/ruby/internal/core/rhash.h +62 -0
- data/ext/pack/ruby/internal/core/rmatch.h +73 -0
- data/ext/pack/ruby/internal/core/robject.h +97 -0
- data/ext/pack/ruby/internal/core/rregexp.h +84 -0
- data/ext/pack/ruby/internal/core/rstring.h +215 -0
- data/ext/pack/ruby/internal/core/rstruct.h +73 -0
- data/ext/pack/ruby/internal/core/rtypeddata.h +184 -0
- data/ext/pack/ruby/internal/ctype.h +203 -0
- data/ext/pack/ruby/internal/dllexport.h +92 -0
- data/ext/pack/ruby/internal/dosish.h +63 -0
- data/ext/pack/ruby/internal/error.h +74 -0
- data/ext/pack/ruby/internal/eval.h +50 -0
- data/ext/pack/ruby/internal/event.h +75 -0
- data/ext/pack/ruby/internal/fl_type.h +469 -0
- data/ext/pack/ruby/internal/gc.h +35 -0
- data/ext/pack/ruby/internal/glob.h +35 -0
- data/ext/pack/ruby/internal/globals.h +159 -0
- data/ext/pack/ruby/internal/has/attribute.h +164 -0
- data/ext/pack/ruby/internal/has/builtin.h +105 -0
- data/ext/pack/ruby/internal/has/c_attribute.h +38 -0
- data/ext/pack/ruby/internal/has/cpp_attribute.h +79 -0
- data/ext/pack/ruby/internal/has/declspec_attribute.h +48 -0
- data/ext/pack/ruby/internal/has/extension.h +33 -0
- data/ext/pack/ruby/internal/has/feature.h +31 -0
- data/ext/pack/ruby/internal/has/warning.h +31 -0
- data/ext/pack/ruby/internal/intern/array.h +78 -0
- data/ext/pack/ruby/internal/intern/bignum.h +105 -0
- data/ext/pack/ruby/internal/intern/class.h +57 -0
- data/ext/pack/ruby/internal/intern/compar.h +34 -0
- data/ext/pack/ruby/internal/intern/complex.h +60 -0
- data/ext/pack/ruby/internal/intern/cont.h +40 -0
- data/ext/pack/ruby/internal/intern/dir.h +33 -0
- data/ext/pack/ruby/internal/intern/enum.h +33 -0
- data/ext/pack/ruby/internal/intern/enumerator.h +79 -0
- data/ext/pack/ruby/internal/intern/error.h +82 -0
- data/ext/pack/ruby/internal/intern/eval.h +59 -0
- data/ext/pack/ruby/internal/intern/file.h +44 -0
- data/ext/pack/ruby/internal/intern/gc.h +57 -0
- data/ext/pack/ruby/internal/intern/hash.h +59 -0
- data/ext/pack/ruby/internal/intern/io.h +70 -0
- data/ext/pack/ruby/internal/intern/load.h +39 -0
- data/ext/pack/ruby/internal/intern/marshal.h +35 -0
- data/ext/pack/ruby/internal/intern/numeric.h +42 -0
- data/ext/pack/ruby/internal/intern/object.h +90 -0
- data/ext/pack/ruby/internal/intern/parse.h +64 -0
- data/ext/pack/ruby/internal/intern/proc.h +53 -0
- data/ext/pack/ruby/internal/intern/process.h +46 -0
- data/ext/pack/ruby/internal/intern/random.h +45 -0
- data/ext/pack/ruby/internal/intern/range.h +35 -0
- data/ext/pack/ruby/internal/intern/rational.h +46 -0
- data/ext/pack/ruby/internal/intern/re.h +50 -0
- data/ext/pack/ruby/internal/intern/ruby.h +37 -0
- data/ext/pack/ruby/internal/intern/select.h +52 -0
- data/ext/pack/ruby/internal/intern/select/largesize.h +103 -0
- data/ext/pack/ruby/internal/intern/select/posix.h +82 -0
- data/ext/pack/ruby/internal/intern/select/win32.h +124 -0
- data/ext/pack/ruby/internal/intern/signal.h +40 -0
- data/ext/pack/ruby/internal/intern/sprintf.h +43 -0
- data/ext/pack/ruby/internal/intern/string.h +290 -0
- data/ext/pack/ruby/internal/intern/struct.h +47 -0
- data/ext/pack/ruby/internal/intern/thread.h +76 -0
- data/ext/pack/ruby/internal/intern/time.h +52 -0
- data/ext/pack/ruby/internal/intern/variable.h +83 -0
- data/ext/pack/ruby/internal/intern/vm.h +77 -0
- data/ext/pack/ruby/internal/interpreter.h +94 -0
- data/ext/pack/ruby/internal/iterator.h +65 -0
- data/ext/pack/ruby/internal/memory.h +286 -0
- data/ext/pack/ruby/internal/method.h +39 -0
- data/ext/pack/ruby/internal/module.h +39 -0
- data/ext/pack/ruby/internal/newobj.h +73 -0
- data/ext/pack/ruby/internal/rgengc.h +199 -0
- data/ext/pack/ruby/internal/scan_args.h +394 -0
- data/ext/pack/ruby/internal/special_consts.h +204 -0
- data/ext/pack/ruby/internal/static_assert.h +77 -0
- data/ext/pack/ruby/internal/stdalign.h +124 -0
- data/ext/pack/ruby/internal/stdbool.h +51 -0
- data/ext/pack/ruby/internal/symbol.h +114 -0
- data/ext/pack/ruby/internal/token_paste.h +75 -0
- data/ext/pack/ruby/internal/value.h +66 -0
- data/ext/pack/ruby/internal/value_type.h +354 -0
- data/ext/pack/ruby/internal/variable.h +62 -0
- data/ext/pack/ruby/internal/warning_push.h +91 -0
- data/ext/pack/ruby/internal/xmalloc.h +201 -0
- data/lib/zscan.rb +1 -1
- data/readme.md +2 -0
- data/zscan.gemspec +1 -1
- metadata +162 -2
@@ -0,0 +1,77 @@
|
|
1
|
+
#ifndef RBIMPL_STATIC_ASSERT_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_STATIC_ASSERT_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief Defines #RBIMPL_STATIC_ASSERT.
|
22
|
+
*/
|
23
|
+
#include <assert.h>
|
24
|
+
#include "ruby/internal/has/extension.h"
|
25
|
+
#include "ruby/internal/compiler_since.h"
|
26
|
+
|
27
|
+
/** @cond INTERNAL_MACRO */
|
28
|
+
#if defined(__cplusplus) && defined(__cpp_static_assert)
|
29
|
+
# /* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations */
|
30
|
+
# define RBIMPL_STATIC_ASSERT0 static_assert
|
31
|
+
|
32
|
+
#elif defined(__cplusplus) && RBIMPL_COMPILER_SINCE(MSVC, 16, 0, 0)
|
33
|
+
# define RBIMPL_STATIC_ASSERT0 static_assert
|
34
|
+
|
35
|
+
#elif defined(__INTEL_CXX11_MODE__)
|
36
|
+
# define RBIMPL_STATIC_ASSERT0 static_assert
|
37
|
+
|
38
|
+
#elif defined(__cplusplus) && __cplusplus >= 201103L
|
39
|
+
# define RBIMPL_STATIC_ASSERT0 static_assert
|
40
|
+
|
41
|
+
#elif defined(__cplusplus) && RBIMPL_HAS_EXTENSION(cxx_static_assert)
|
42
|
+
# define RBIMPL_STATIC_ASSERT0 __extension__ static_assert
|
43
|
+
|
44
|
+
#elif defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__
|
45
|
+
# define RBIMPL_STATIC_ASSERT0 __extension__ static_assert
|
46
|
+
|
47
|
+
#elif defined(__STDC_VERSION__) && RBIMPL_HAS_EXTENSION(c_static_assert)
|
48
|
+
# define RBIMPL_STATIC_ASSERT0 __extension__ _Static_assert
|
49
|
+
|
50
|
+
#elif defined(__STDC_VERSION__) && RBIMPL_COMPILER_SINCE(GCC, 4, 6, 0)
|
51
|
+
# define RBIMPL_STATIC_ASSERT0 __extension__ _Static_assert
|
52
|
+
|
53
|
+
#elif defined(static_assert)
|
54
|
+
# /* Take <assert.h> definition */
|
55
|
+
# define RBIMPL_STATIC_ASSERT0 static_assert
|
56
|
+
#endif
|
57
|
+
/** @endcond */
|
58
|
+
|
59
|
+
/**
|
60
|
+
* @brief Wraps (or simulates) `static_assert`
|
61
|
+
* @param name Valid C/C++ identifier, describing the assertion.
|
62
|
+
* @param expr Expression to assert.
|
63
|
+
* @note `name` shall not be a string literal.
|
64
|
+
*/
|
65
|
+
#if defined(__DOXYGEN__)
|
66
|
+
# define RBIMPL_STATIC_ASSERT static_assert
|
67
|
+
|
68
|
+
#elif defined(RBIMPL_STATIC_ASSERT0)
|
69
|
+
# define RBIMPL_STATIC_ASSERT(name, expr) \
|
70
|
+
RBIMPL_STATIC_ASSERT0(expr, # name ": " # expr)
|
71
|
+
|
72
|
+
#else
|
73
|
+
# define RBIMPL_STATIC_ASSERT(name, expr) \
|
74
|
+
typedef int static_assert_ ## name ## _check[1 - 2 * !(expr)]
|
75
|
+
#endif
|
76
|
+
|
77
|
+
#endif /* RBIMPL_STATIC_ASSERT_H */
|
@@ -0,0 +1,124 @@
|
|
1
|
+
#ifndef RBIMPL_STDALIGN_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_STDALIGN_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief Defines #RBIMPL_ALIGNAS / #RBIMPL_ALIGNOF
|
22
|
+
*/
|
23
|
+
#include "ruby/internal/config.h"
|
24
|
+
|
25
|
+
#ifdef HAVE_STDALIGN_H
|
26
|
+
# include <stdalign.h>
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#include "ruby/internal/compiler_is.h"
|
30
|
+
#include "ruby/internal/compiler_since.h"
|
31
|
+
#include "ruby/internal/has/feature.h"
|
32
|
+
#include "ruby/internal/has/extension.h"
|
33
|
+
#include "ruby/internal/has/attribute.h"
|
34
|
+
#include "ruby/internal/has/declspec_attribute.h"
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Wraps (or simulates) `alignas`. This is C++11's `alignas` and is _different_
|
38
|
+
* from C11 `_Alignas`. For instance,
|
39
|
+
*
|
40
|
+
* ```CXX
|
41
|
+
* typedef struct alignas(128) foo { int foo } foo;
|
42
|
+
* ```
|
43
|
+
*
|
44
|
+
* is a valid C++ while
|
45
|
+
*
|
46
|
+
* ```C
|
47
|
+
* typedef struct _Alignas(128) foo { int foo } foo;
|
48
|
+
* ```
|
49
|
+
*
|
50
|
+
* is an invalid C because:
|
51
|
+
*
|
52
|
+
* - You cannot `struct _Alignas`.
|
53
|
+
* - A `typedef` cannot have alignments.
|
54
|
+
*/
|
55
|
+
#if defined(__cplusplus) && RBIMPL_HAS_FEATURE(cxx_alignas)
|
56
|
+
# define RBIMPL_ALIGNAS alignas
|
57
|
+
|
58
|
+
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
|
59
|
+
# define RBIMPL_ALIGNAS alignas
|
60
|
+
|
61
|
+
#elif defined(__INTEL_CXX11_MODE__)
|
62
|
+
# define RBIMPL_ALIGNAS alignas
|
63
|
+
|
64
|
+
#elif defined(__GXX_EXPERIMENTAL_CXX0X__)
|
65
|
+
# define RBIMPL_ALIGNAS alignas
|
66
|
+
|
67
|
+
#elif RBIMPL_HAS_DECLSPEC_ATTRIBUTE(align)
|
68
|
+
# define RBIMPL_ALIGNAS(_) __declspec(align(_))
|
69
|
+
|
70
|
+
#elif RBIMPL_HAS_ATTRIBUTE(aliged)
|
71
|
+
# define RBIMPL_ALIGNAS(_) __attribute__((__aligned__(_)))
|
72
|
+
|
73
|
+
#else
|
74
|
+
# define RBIMPL_ALIGNAS(_) /* void */
|
75
|
+
#endif
|
76
|
+
|
77
|
+
/**
|
78
|
+
* Wraps (or simulates) `alignof`. Unlike #RBIMPL_ALIGNAS, we can safely say
|
79
|
+
* both C/C++ definitions are effective.
|
80
|
+
*/
|
81
|
+
#if defined(__cplusplus) && RBIMPL_HAS_EXTENSION(cxx_alignof)
|
82
|
+
# define RBIMPL_ALIGNOF __extension__ alignof
|
83
|
+
|
84
|
+
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
|
85
|
+
# define RBIMPL_ALIGNOF alignof
|
86
|
+
|
87
|
+
#elif defined(__INTEL_CXX11_MODE__)
|
88
|
+
# define RBIMPL_ALIGNOF alignof
|
89
|
+
|
90
|
+
#elif defined(__GXX_EXPERIMENTAL_CXX0X__)
|
91
|
+
# define RBIMPL_ALIGNOF alignof
|
92
|
+
|
93
|
+
#elif defined(__STDC_VERSION__) && RBIMPL_HAS_EXTENSION(c_alignof)
|
94
|
+
# define RBIMPL_ALIGNOF __extension__ _Alignof
|
95
|
+
|
96
|
+
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
97
|
+
# define RBIMPL_ALIGNOF _Alignof
|
98
|
+
|
99
|
+
#elif RBIMPL_COMPILER_IS(MSVC)
|
100
|
+
# define RBIMPL_ALIGNOF __alignof
|
101
|
+
|
102
|
+
#elif defined(__GNUC__)
|
103
|
+
# /* At least GCC 2.95 had this. */
|
104
|
+
# define RBIMPL_ALIGNOF __extension__ __alignof__
|
105
|
+
|
106
|
+
#elif defined(__alignof_is_defined) || defined(__DOXYGEN__)
|
107
|
+
# /* OK, we can safely take <stdalign.h> definition. */
|
108
|
+
# define RBIMPL_ALIGNOF alignof
|
109
|
+
|
110
|
+
#elif RBIMPL_COMPILER_SINCE(SunPro, 5, 9, 0)
|
111
|
+
# /* According to their manual, Sun Studio 12 introduced __alignof__ for both
|
112
|
+
# * C/C++. */
|
113
|
+
# define RBIMPL_ALIGNOF __alignof__
|
114
|
+
|
115
|
+
#elif 0
|
116
|
+
# /* THIS IS NG, you cannot define a new type inside of offsetof. */
|
117
|
+
# /* see: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm */
|
118
|
+
# define RBIMPL_ALIGNOF(T) offsetof(struct { char _; T t; }, t)
|
119
|
+
|
120
|
+
#else
|
121
|
+
# error :FIXME: add your compiler here to obtain an alignment.
|
122
|
+
#endif
|
123
|
+
|
124
|
+
#endif /* RBIMPL_STDALIGN_H */
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#ifndef RBIMPL_STDBOOL_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_STDBOOL_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief C99 shim for <stdbool.h>
|
22
|
+
*/
|
23
|
+
#include "ruby/internal/config.h"
|
24
|
+
|
25
|
+
#if defined(__bool_true_false_are_defined)
|
26
|
+
# /* Take that. */
|
27
|
+
|
28
|
+
#elif defined(__cplusplus)
|
29
|
+
# /* bool is a keyword in C++. */
|
30
|
+
# if defined(HAVE_STDBOOL_H) && (__cplusplus >= 201103L)
|
31
|
+
# include <cstdbool>
|
32
|
+
# endif
|
33
|
+
#
|
34
|
+
# ifndef __bool_true_false_are_defined
|
35
|
+
# define __bool_true_false_are_defined
|
36
|
+
# endif
|
37
|
+
|
38
|
+
#elif defined(HAVE_STDBOOL_H)
|
39
|
+
# /* Take stdbool.h definition. */
|
40
|
+
# include <stdbool.h>
|
41
|
+
|
42
|
+
#else
|
43
|
+
typedef unsigned char _Bool;
|
44
|
+
# /* See also http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2229.htm */
|
45
|
+
# define bool _Bool
|
46
|
+
# define true ((_Bool)+1)
|
47
|
+
# define false ((_Bool)+0)
|
48
|
+
# define __bool_true_false_are_defined
|
49
|
+
#endif
|
50
|
+
|
51
|
+
#endif /* RBIMPL_STDBOOL_H */
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#ifndef RBIMPL_SYMBOL_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_SYMBOL_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief Defines #rb_intern
|
22
|
+
*/
|
23
|
+
#include "ruby/internal/config.h"
|
24
|
+
|
25
|
+
#ifdef HAVE_STDDEF_H
|
26
|
+
# include <stddef.h>
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#ifdef HAVE_STRING_H
|
30
|
+
# include <string.h>
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#include "ruby/internal/attr/nonnull.h"
|
34
|
+
#include "ruby/internal/attr/pure.h"
|
35
|
+
#include "ruby/internal/attr/noalias.h"
|
36
|
+
#include "ruby/internal/cast.h"
|
37
|
+
#include "ruby/internal/constant_p.h"
|
38
|
+
#include "ruby/internal/dllexport.h"
|
39
|
+
#include "ruby/internal/has/builtin.h"
|
40
|
+
#include "ruby/internal/value.h"
|
41
|
+
|
42
|
+
#define RB_ID2SYM rb_id2sym
|
43
|
+
#define RB_SYM2ID rb_sym2id
|
44
|
+
#define ID2SYM RB_ID2SYM
|
45
|
+
#define SYM2ID RB_SYM2ID
|
46
|
+
#define CONST_ID_CACHE RUBY_CONST_ID_CACHE
|
47
|
+
#define CONST_ID RUBY_CONST_ID
|
48
|
+
|
49
|
+
/** @cond INTERNAL_MACRO */
|
50
|
+
#define rb_intern_const rb_intern_const
|
51
|
+
/** @endcond */
|
52
|
+
|
53
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
54
|
+
ID rb_sym2id(VALUE);
|
55
|
+
VALUE rb_id2sym(ID);
|
56
|
+
ID rb_intern(const char*);
|
57
|
+
ID rb_intern2(const char*, long);
|
58
|
+
ID rb_intern_str(VALUE str);
|
59
|
+
const char *rb_id2name(ID);
|
60
|
+
ID rb_check_id(volatile VALUE *);
|
61
|
+
ID rb_to_id(VALUE);
|
62
|
+
VALUE rb_id2str(ID);
|
63
|
+
VALUE rb_sym2str(VALUE);
|
64
|
+
VALUE rb_to_symbol(VALUE name);
|
65
|
+
VALUE rb_check_symbol(volatile VALUE *namep);
|
66
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
67
|
+
|
68
|
+
RBIMPL_ATTR_PURE()
|
69
|
+
RBIMPL_ATTR_NONNULL(())
|
70
|
+
static inline ID
|
71
|
+
rb_intern_const(const char *str)
|
72
|
+
{
|
73
|
+
size_t len = strlen(str);
|
74
|
+
return rb_intern2(str, RBIMPL_CAST((long)len));
|
75
|
+
}
|
76
|
+
|
77
|
+
RBIMPL_ATTR_NOALIAS()
|
78
|
+
RBIMPL_ATTR_NONNULL(())
|
79
|
+
static inline ID
|
80
|
+
rbimpl_intern_const(ID *ptr, const char *str)
|
81
|
+
{
|
82
|
+
while (! *ptr) {
|
83
|
+
*ptr = rb_intern_const(str);
|
84
|
+
}
|
85
|
+
|
86
|
+
return *ptr;
|
87
|
+
}
|
88
|
+
|
89
|
+
/* Does anyone use it? Preserved for backward compat. */
|
90
|
+
#define RUBY_CONST_ID_CACHE(result, str) \
|
91
|
+
{ \
|
92
|
+
static ID rb_intern_id_cache; \
|
93
|
+
rbimpl_intern_const(&rb_intern_id_cache, (str)); \
|
94
|
+
result rb_intern_id_cache; \
|
95
|
+
}
|
96
|
+
#define RUBY_CONST_ID(var, str) \
|
97
|
+
do { \
|
98
|
+
static ID rbimpl_id; \
|
99
|
+
(var) = rbimpl_intern_const(&rbimpl_id, (str)); \
|
100
|
+
} while (0)
|
101
|
+
|
102
|
+
#if defined(HAVE_STMT_AND_DECL_IN_EXPR)
|
103
|
+
/* __builtin_constant_p and statement expression is available
|
104
|
+
* since gcc-2.7.2.3 at least. */
|
105
|
+
#define rb_intern(str) \
|
106
|
+
(RBIMPL_CONSTANT_P(str) ? \
|
107
|
+
__extension__ ({ \
|
108
|
+
static ID rbimpl_id; \
|
109
|
+
rbimpl_intern_const(&rbimpl_id, (str)); \
|
110
|
+
}) : \
|
111
|
+
(rb_intern)(str))
|
112
|
+
#endif
|
113
|
+
|
114
|
+
#endif /* RBIMPL_SYMBOL_H */
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#ifndef RBIMPL_TOKEN_PASTE_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_TOKEN_PASTE_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief Defines #RBIMPL_TOKEN_PASTE.
|
22
|
+
*/
|
23
|
+
#include "ruby/internal/config.h"
|
24
|
+
#include "ruby/internal/compiler_since.h"
|
25
|
+
#include "ruby/internal/has/warning.h"
|
26
|
+
#include "ruby/internal/warning_push.h"
|
27
|
+
|
28
|
+
/* :TODO: add your compiler here. There are many compilers that can suppress
|
29
|
+
* warnings via pragmas, but not all of them accept such things inside of `#if`
|
30
|
+
* and variants' conditions. And such nitpicking behavours tend not be
|
31
|
+
* documented. Please improve this file when you are really sure about your
|
32
|
+
* compiler's behaviour. */
|
33
|
+
|
34
|
+
#if RBIMPL_COMPILER_SINCE(GCC, 4, 2, 0)
|
35
|
+
# /* GCC is one of such compiler who cannot write `_Pragma` inside of a `#if`.
|
36
|
+
# * Cannot but globally kill everything. This is of course a very bad thing.
|
37
|
+
# * If you know how to reroute this please tell us. */
|
38
|
+
# /* https://gcc.godbolt.org/z/K2xr7X */
|
39
|
+
# define RBIMPL_TOKEN_PASTE(x, y) TOKEN_PASTE(x, y)
|
40
|
+
# pragma GCC diagnostic ignored "-Wundef"
|
41
|
+
# /* > warning: "symbol" is not defined, evaluates to 0 [-Wundef] */
|
42
|
+
|
43
|
+
#elif RBIMPL_COMPILER_IS(Intel)
|
44
|
+
# /* Ditto for icc. */
|
45
|
+
# /* https://gcc.godbolt.org/z/pTwDxE */
|
46
|
+
# define RBIMPL_TOKEN_PASTE(x, y) TOKEN_PASTE(x, y)
|
47
|
+
# pragma warning(disable: 193)
|
48
|
+
# /* > warning #193: zero used for undefined preprocessing identifier */
|
49
|
+
|
50
|
+
#elif RBIMPL_COMPILER_BEFORE(MSVC, 19, 14, 26428)
|
51
|
+
# /* :FIXME: is 19.14 the exact version they supported this? */
|
52
|
+
# define RBIMPL_TOKEN_PASTE(x, y) TOKEN_PASTE(x, y)
|
53
|
+
# pragma warning(disable: 4668)
|
54
|
+
# /* > warning C4668: 'symbol' is not defined as a preprocessor macro */
|
55
|
+
|
56
|
+
#elif RBIMPL_COMPILER_IS(MSVC)
|
57
|
+
# define RBIMPL_TOKEN_PASTE(x, y) \
|
58
|
+
RBIMPL_WARNING_PUSH() \
|
59
|
+
RBIMPL_WARNING_IGNORED(4668) \
|
60
|
+
TOKEN_PASTE(x, y) \
|
61
|
+
RBIMPL_WARNING_POP()
|
62
|
+
|
63
|
+
#elif RBIMPL_HAS_WARNING("-Wundef")
|
64
|
+
# define RBIMPL_TOKEN_PASTE(x, y) \
|
65
|
+
RBIMPL_WARNING_PUSH() \
|
66
|
+
RBIMPL_WARNING_IGNORED(-Wundef) \
|
67
|
+
TOKEN_PASTE(x, y) \
|
68
|
+
RBIMPL_WARNING_POP()
|
69
|
+
|
70
|
+
#else
|
71
|
+
# /* No way. */
|
72
|
+
# define RBIMPL_TOKEN_PASTE(x, y) TOKEN_PASTE(x, y)
|
73
|
+
#endif
|
74
|
+
|
75
|
+
#endif /* RBIMPL_TOKEN_PASTE_H */
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#ifndef RBIMPL_VALUE_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_VALUE_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief Defines ::VALUE and ::ID.
|
22
|
+
*/
|
23
|
+
#include "ruby/internal/static_assert.h"
|
24
|
+
#include "ruby/backward/2/long_long.h"
|
25
|
+
#include "ruby/backward/2/limits.h"
|
26
|
+
|
27
|
+
#if defined HAVE_UINTPTR_T && 0
|
28
|
+
typedef uintptr_t VALUE;
|
29
|
+
typedef uintptr_t ID;
|
30
|
+
# define SIGNED_VALUE intptr_t
|
31
|
+
# define SIZEOF_VALUE SIZEOF_UINTPTR_T
|
32
|
+
# undef PRI_VALUE_PREFIX
|
33
|
+
# define RBIMPL_VALUE_NULL UINTPTR_C(0)
|
34
|
+
# define RBIMPL_VALUE_ONE UINTPTR_C(1)
|
35
|
+
# define RBIMPL_VALUE_FULL UINTPTR_MAX
|
36
|
+
|
37
|
+
#elif SIZEOF_LONG == SIZEOF_VOIDP
|
38
|
+
typedef unsigned long VALUE;
|
39
|
+
typedef unsigned long ID;
|
40
|
+
# define SIGNED_VALUE long
|
41
|
+
# define SIZEOF_VALUE SIZEOF_LONG
|
42
|
+
# define PRI_VALUE_PREFIX "l"
|
43
|
+
# define RBIMPL_VALUE_NULL 0UL
|
44
|
+
# define RBIMPL_VALUE_ONE 1UL
|
45
|
+
# define RBIMPL_VALUE_FULL ULONG_MAX
|
46
|
+
|
47
|
+
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
|
48
|
+
typedef unsigned LONG_LONG VALUE;
|
49
|
+
typedef unsigned LONG_LONG ID;
|
50
|
+
# define SIGNED_VALUE LONG_LONG
|
51
|
+
# define LONG_LONG_VALUE 1
|
52
|
+
# define SIZEOF_VALUE SIZEOF_LONG_LONG
|
53
|
+
# define PRI_VALUE_PREFIX PRI_LL_PREFIX
|
54
|
+
# define RBIMPL_VALUE_NULL 0ULL
|
55
|
+
# define RBIMPL_VALUE_ONE 1ULL
|
56
|
+
# define RBIMPL_VALUE_FULL ULLONG_MAX
|
57
|
+
|
58
|
+
#else
|
59
|
+
# error ---->> ruby requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<----
|
60
|
+
#endif
|
61
|
+
|
62
|
+
RBIMPL_STATIC_ASSERT(sizeof_int, SIZEOF_INT == sizeof(int));
|
63
|
+
RBIMPL_STATIC_ASSERT(sizeof_long, SIZEOF_LONG == sizeof(long));
|
64
|
+
RBIMPL_STATIC_ASSERT(sizeof_long_long, SIZEOF_LONG_LONG == sizeof(LONG_LONG));
|
65
|
+
RBIMPL_STATIC_ASSERT(sizeof_voidp, SIZEOF_VOIDP == sizeof(void *));
|
66
|
+
#endif /* RBIMPL_VALUE_H */
|