zscan 2.0.8 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,73 @@
|
|
|
1
|
+
#ifndef RBIMPL_RSTRUCT_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_RSTRUCT_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 Routines to manipulate struct ::RStruct.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/attr/artificial.h"
|
|
24
|
+
#include "ruby/internal/dllexport.h"
|
|
25
|
+
#include "ruby/internal/value.h"
|
|
26
|
+
#include "ruby/internal/value_type.h"
|
|
27
|
+
#include "ruby/internal/arithmetic/long.h"
|
|
28
|
+
#include "ruby/internal/arithmetic/int.h"
|
|
29
|
+
#if !defined RUBY_EXPORT && !defined RUBY_NO_OLD_COMPATIBILITY
|
|
30
|
+
# include "ruby/backward.h"
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#define RSTRUCT_PTR(st) rb_struct_ptr(st)
|
|
34
|
+
/** @cond INTERNAL_MACRO */
|
|
35
|
+
#define RSTRUCT_LEN RSTRUCT_LEN
|
|
36
|
+
#define RSTRUCT_SET RSTRUCT_SET
|
|
37
|
+
#define RSTRUCT_GET RSTRUCT_GET
|
|
38
|
+
/** @endcond */
|
|
39
|
+
|
|
40
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
|
41
|
+
VALUE rb_struct_size(VALUE s);
|
|
42
|
+
VALUE rb_struct_aref(VALUE, VALUE);
|
|
43
|
+
VALUE rb_struct_aset(VALUE, VALUE, VALUE);
|
|
44
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
|
45
|
+
|
|
46
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
47
|
+
static inline long
|
|
48
|
+
RSTRUCT_LEN(VALUE st)
|
|
49
|
+
{
|
|
50
|
+
RBIMPL_ASSERT_TYPE(st, RUBY_T_STRUCT);
|
|
51
|
+
|
|
52
|
+
return RB_NUM2LONG(rb_struct_size(st));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
56
|
+
static inline VALUE
|
|
57
|
+
RSTRUCT_SET(VALUE st, int k, VALUE v)
|
|
58
|
+
{
|
|
59
|
+
RBIMPL_ASSERT_TYPE(st, RUBY_T_STRUCT);
|
|
60
|
+
|
|
61
|
+
return rb_struct_aset(st, INT2NUM(k), (v));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
65
|
+
static inline VALUE
|
|
66
|
+
RSTRUCT_GET(VALUE st, int k)
|
|
67
|
+
{
|
|
68
|
+
RBIMPL_ASSERT_TYPE(st, RUBY_T_STRUCT);
|
|
69
|
+
|
|
70
|
+
return rb_struct_aref(st, INT2NUM(k));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#endif /* RBIMPL_RSTRUCT_H */
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#ifndef RBIMPL_RTYPEDDATA_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_RTYPEDDATA_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 struct ::RTypedData.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/config.h"
|
|
24
|
+
|
|
25
|
+
#ifdef STDC_HEADERS
|
|
26
|
+
# include <stddef.h>
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#include "ruby/internal/assume.h"
|
|
30
|
+
#include "ruby/internal/attr/artificial.h"
|
|
31
|
+
#include "ruby/internal/attr/pure.h"
|
|
32
|
+
#include "ruby/internal/cast.h"
|
|
33
|
+
#include "ruby/internal/core/rbasic.h"
|
|
34
|
+
#include "ruby/internal/core/rdata.h"
|
|
35
|
+
#include "ruby/internal/dllexport.h"
|
|
36
|
+
#include "ruby/internal/error.h"
|
|
37
|
+
#include "ruby/internal/fl_type.h"
|
|
38
|
+
#include "ruby/internal/stdbool.h"
|
|
39
|
+
#include "ruby/internal/value_type.h"
|
|
40
|
+
|
|
41
|
+
#define HAVE_TYPE_RB_DATA_TYPE_T 1
|
|
42
|
+
#define HAVE_RB_DATA_TYPE_T_FUNCTION 1
|
|
43
|
+
#define HAVE_RB_DATA_TYPE_T_PARENT 1
|
|
44
|
+
#define RUBY_TYPED_DEFAULT_FREE RUBY_DEFAULT_FREE
|
|
45
|
+
#define RUBY_TYPED_NEVER_FREE RUBY_NEVER_FREE
|
|
46
|
+
#define RTYPEDDATA(obj) RBIMPL_CAST((struct RTypedData *)(obj))
|
|
47
|
+
#define RTYPEDDATA_DATA(v) (RTYPEDDATA(v)->data)
|
|
48
|
+
#define Check_TypedStruct(v, t) \
|
|
49
|
+
rb_check_typeddata(RBIMPL_CAST((VALUE)(v)), (t))
|
|
50
|
+
|
|
51
|
+
/** @cond INTERNAL_MACRO */
|
|
52
|
+
#define RTYPEDDATA_P RTYPEDDATA_P
|
|
53
|
+
#define RTYPEDDATA_TYPE RTYPEDDATA_TYPE
|
|
54
|
+
#define RUBY_TYPED_FREE_IMMEDIATELY RUBY_TYPED_FREE_IMMEDIATELY
|
|
55
|
+
#define RUBY_TYPED_WB_PROTECTED RUBY_TYPED_WB_PROTECTED
|
|
56
|
+
#define RUBY_TYPED_PROMOTED1 RUBY_TYPED_PROMOTED1
|
|
57
|
+
/** @endcond */
|
|
58
|
+
|
|
59
|
+
/* bits for rb_data_type_struct::flags */
|
|
60
|
+
enum rbimpl_typeddata_flags {
|
|
61
|
+
RUBY_TYPED_FREE_IMMEDIATELY = 1,
|
|
62
|
+
RUBY_TYPED_WB_PROTECTED = RUBY_FL_WB_PROTECTED, /* THIS FLAG DEPENDS ON Ruby version */
|
|
63
|
+
RUBY_TYPED_PROMOTED1 = RUBY_FL_PROMOTED1 /* THIS FLAG DEPENDS ON Ruby version */
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
typedef struct rb_data_type_struct rb_data_type_t;
|
|
67
|
+
|
|
68
|
+
struct rb_data_type_struct {
|
|
69
|
+
const char *wrap_struct_name;
|
|
70
|
+
struct {
|
|
71
|
+
RUBY_DATA_FUNC dmark;
|
|
72
|
+
RUBY_DATA_FUNC dfree;
|
|
73
|
+
size_t (*dsize)(const void *);
|
|
74
|
+
RUBY_DATA_FUNC dcompact;
|
|
75
|
+
void *reserved[1]; /* For future extension.
|
|
76
|
+
This array *must* be filled with ZERO. */
|
|
77
|
+
} function;
|
|
78
|
+
const rb_data_type_t *parent;
|
|
79
|
+
void *data; /* This area can be used for any purpose
|
|
80
|
+
by a programmer who define the type. */
|
|
81
|
+
VALUE flags; /* RUBY_FL_WB_PROTECTED */
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
struct RTypedData {
|
|
85
|
+
struct RBasic basic;
|
|
86
|
+
const rb_data_type_t *type;
|
|
87
|
+
VALUE typed_flag; /* 1 or not */
|
|
88
|
+
void *data;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
|
92
|
+
VALUE rb_data_typed_object_wrap(VALUE klass, void *datap, const rb_data_type_t *);
|
|
93
|
+
VALUE rb_data_typed_object_zalloc(VALUE klass, size_t size, const rb_data_type_t *type);
|
|
94
|
+
int rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *parent);
|
|
95
|
+
int rb_typeddata_is_kind_of(VALUE obj, const rb_data_type_t *data_type);
|
|
96
|
+
void *rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type);
|
|
97
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
|
98
|
+
|
|
99
|
+
#define TypedData_Wrap_Struct(klass,data_type,sval)\
|
|
100
|
+
rb_data_typed_object_wrap((klass),(sval),(data_type))
|
|
101
|
+
|
|
102
|
+
#define TypedData_Make_Struct0(result, klass, type, size, data_type, sval) \
|
|
103
|
+
VALUE result = rb_data_typed_object_zalloc(klass, size, data_type); \
|
|
104
|
+
(sval) = RBIMPL_CAST((type *)RTYPEDDATA_DATA(result)); \
|
|
105
|
+
RBIMPL_CAST(/*suppress unused variable warnings*/(void)(sval))
|
|
106
|
+
|
|
107
|
+
#ifdef HAVE_STMT_AND_DECL_IN_EXPR
|
|
108
|
+
#define TypedData_Make_Struct(klass, type, data_type, sval) \
|
|
109
|
+
RB_GNUC_EXTENSION({ \
|
|
110
|
+
TypedData_Make_Struct0( \
|
|
111
|
+
data_struct_obj, \
|
|
112
|
+
klass, \
|
|
113
|
+
type, \
|
|
114
|
+
sizeof(type), \
|
|
115
|
+
data_type, \
|
|
116
|
+
sval); \
|
|
117
|
+
data_struct_obj; \
|
|
118
|
+
})
|
|
119
|
+
#else
|
|
120
|
+
#define TypedData_Make_Struct(klass, type, data_type, sval) \
|
|
121
|
+
rb_data_typed_object_make( \
|
|
122
|
+
(klass), \
|
|
123
|
+
(data_type), \
|
|
124
|
+
RBIMPL_CAST((void **)&(sval)), \
|
|
125
|
+
sizeof(type))
|
|
126
|
+
#endif
|
|
127
|
+
|
|
128
|
+
#define TypedData_Get_Struct(obj,type,data_type,sval) \
|
|
129
|
+
((sval) = RBIMPL_CAST((type *)rb_check_typeddata((obj), (data_type))))
|
|
130
|
+
|
|
131
|
+
RBIMPL_ATTR_PURE()
|
|
132
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
133
|
+
static inline bool
|
|
134
|
+
rbimpl_rtypeddata_p(VALUE obj)
|
|
135
|
+
{
|
|
136
|
+
return RTYPEDDATA(obj)->typed_flag == 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
|
140
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
141
|
+
static inline bool
|
|
142
|
+
RTYPEDDATA_P(VALUE obj)
|
|
143
|
+
{
|
|
144
|
+
#if ! RUBY_NDEBUG
|
|
145
|
+
if (RB_UNLIKELY(! RB_TYPE_P(obj, RUBY_T_DATA))) {
|
|
146
|
+
Check_Type(obj, RUBY_T_DATA);
|
|
147
|
+
RBIMPL_UNREACHABLE_RETURN(false);
|
|
148
|
+
}
|
|
149
|
+
#endif
|
|
150
|
+
|
|
151
|
+
return rbimpl_rtypeddata_p(obj);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
|
155
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
156
|
+
/* :TODO: can this function be __attribute__((returns_nonnull)) or not? */
|
|
157
|
+
static inline const struct rb_data_type_struct *
|
|
158
|
+
RTYPEDDATA_TYPE(VALUE obj)
|
|
159
|
+
{
|
|
160
|
+
#if ! RUBY_NDEBUG
|
|
161
|
+
if (RB_UNLIKELY(! RTYPEDDATA_P(obj))) {
|
|
162
|
+
rb_unexpected_type(obj, RUBY_T_DATA);
|
|
163
|
+
RBIMPL_UNREACHABLE_RETURN(NULL);
|
|
164
|
+
}
|
|
165
|
+
#endif
|
|
166
|
+
|
|
167
|
+
return RTYPEDDATA(obj)->type;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static inline VALUE
|
|
171
|
+
rb_data_typed_object_make(VALUE klass, const rb_data_type_t *type, void **datap, size_t size)
|
|
172
|
+
{
|
|
173
|
+
TypedData_Make_Struct0(result, klass, void, size, type, *datap);
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
RBIMPL_ATTR_DEPRECATED(("by: rb_data_typed_object_wrap"))
|
|
178
|
+
static inline VALUE
|
|
179
|
+
rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type)
|
|
180
|
+
{
|
|
181
|
+
return rb_data_typed_object_wrap(klass, datap, type);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
#endif /* RBIMPL_RTYPEDDATA_H */
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
#ifndef RBIMPL_CTYPE_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_CTYPE_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 Our own, locale independent, character handling routines.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/config.h"
|
|
24
|
+
|
|
25
|
+
#ifdef STDC_HEADERS
|
|
26
|
+
# include <ctype.h>
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#include "ruby/internal/attr/artificial.h"
|
|
30
|
+
#include "ruby/internal/attr/const.h"
|
|
31
|
+
#include "ruby/internal/attr/constexpr.h"
|
|
32
|
+
#include "ruby/internal/dllexport.h"
|
|
33
|
+
|
|
34
|
+
#ifndef ISPRINT
|
|
35
|
+
# define ISASCII rb_isascii
|
|
36
|
+
# define ISPRINT rb_isprint
|
|
37
|
+
# define ISGRAPH rb_isgraph
|
|
38
|
+
# define ISSPACE rb_isspace
|
|
39
|
+
# define ISUPPER rb_isupper
|
|
40
|
+
# define ISLOWER rb_islower
|
|
41
|
+
# define ISALNUM rb_isalnum
|
|
42
|
+
# define ISALPHA rb_isalpha
|
|
43
|
+
# define ISDIGIT rb_isdigit
|
|
44
|
+
# define ISXDIGIT rb_isxdigit
|
|
45
|
+
# define ISBLANK rb_isblank
|
|
46
|
+
# define ISCNTRL rb_iscntrl
|
|
47
|
+
# define ISPUNCT rb_ispunct
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#define TOUPPER rb_toupper
|
|
51
|
+
#define TOLOWER rb_tolower
|
|
52
|
+
#define STRCASECMP st_locale_insensitive_strcasecmp
|
|
53
|
+
#define STRNCASECMP st_locale_insensitive_strncasecmp
|
|
54
|
+
#define STRTOUL ruby_strtoul
|
|
55
|
+
|
|
56
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
|
57
|
+
/* locale insensitive functions */
|
|
58
|
+
int st_locale_insensitive_strcasecmp(const char *s1, const char *s2);
|
|
59
|
+
int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n);
|
|
60
|
+
unsigned long ruby_strtoul(const char *str, char **endptr, int base);
|
|
61
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* We are making the functions below to return `int` instead of `bool`. They
|
|
65
|
+
* have been as such since their birth at 5f237d79033b2109afb768bc889611fa9630.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
RBIMPL_ATTR_CONST()
|
|
69
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
70
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
71
|
+
static inline int
|
|
72
|
+
rb_isascii(int c)
|
|
73
|
+
{
|
|
74
|
+
return '\0' <= c && c <= '\x7f';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
RBIMPL_ATTR_CONST()
|
|
78
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
79
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
80
|
+
static inline int
|
|
81
|
+
rb_isupper(int c)
|
|
82
|
+
{
|
|
83
|
+
return 'A' <= c && c <= 'Z';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
RBIMPL_ATTR_CONST()
|
|
87
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
88
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
89
|
+
static inline int
|
|
90
|
+
rb_islower(int c)
|
|
91
|
+
{
|
|
92
|
+
return 'a' <= c && c <= 'z';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
RBIMPL_ATTR_CONST()
|
|
96
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
97
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
98
|
+
static inline int
|
|
99
|
+
rb_isalpha(int c)
|
|
100
|
+
{
|
|
101
|
+
return rb_isupper(c) || rb_islower(c);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
RBIMPL_ATTR_CONST()
|
|
105
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
106
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
107
|
+
static inline int
|
|
108
|
+
rb_isdigit(int c)
|
|
109
|
+
{
|
|
110
|
+
return '0' <= c && c <= '9';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
RBIMPL_ATTR_CONST()
|
|
114
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
115
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
116
|
+
static inline int
|
|
117
|
+
rb_isalnum(int c)
|
|
118
|
+
{
|
|
119
|
+
return rb_isalpha(c) || rb_isdigit(c);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
RBIMPL_ATTR_CONST()
|
|
123
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
124
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
125
|
+
static inline int
|
|
126
|
+
rb_isxdigit(int c)
|
|
127
|
+
{
|
|
128
|
+
return rb_isdigit(c) || ('A' <= c && c <= 'F') || ('a' <= c && c <= 'f');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
RBIMPL_ATTR_CONST()
|
|
132
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
133
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
134
|
+
static inline int
|
|
135
|
+
rb_isblank(int c)
|
|
136
|
+
{
|
|
137
|
+
return c == ' ' || c == '\t';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
RBIMPL_ATTR_CONST()
|
|
141
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
142
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
143
|
+
static inline int
|
|
144
|
+
rb_isspace(int c)
|
|
145
|
+
{
|
|
146
|
+
return c == ' ' || ('\t' <= c && c <= '\r');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
RBIMPL_ATTR_CONST()
|
|
150
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
151
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
152
|
+
static inline int
|
|
153
|
+
rb_iscntrl(int c)
|
|
154
|
+
{
|
|
155
|
+
return ('\0' <= c && c < ' ') || c == '\x7f';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
RBIMPL_ATTR_CONST()
|
|
159
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
160
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
161
|
+
static inline int
|
|
162
|
+
rb_isprint(int c)
|
|
163
|
+
{
|
|
164
|
+
return ' ' <= c && c <= '\x7e';
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
RBIMPL_ATTR_CONST()
|
|
168
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
169
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
170
|
+
static inline int
|
|
171
|
+
rb_ispunct(int c)
|
|
172
|
+
{
|
|
173
|
+
return !rb_isalnum(c);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
RBIMPL_ATTR_CONST()
|
|
177
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
178
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
179
|
+
static inline int
|
|
180
|
+
rb_isgraph(int c)
|
|
181
|
+
{
|
|
182
|
+
return '!' <= c && c <= '\x7e';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
RBIMPL_ATTR_CONST()
|
|
186
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
187
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
188
|
+
static inline int
|
|
189
|
+
rb_tolower(int c)
|
|
190
|
+
{
|
|
191
|
+
return rb_isupper(c) ? (c|0x20) : c;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
RBIMPL_ATTR_CONST()
|
|
195
|
+
RBIMPL_ATTR_CONSTEXPR(CXX11)
|
|
196
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
|
197
|
+
static inline int
|
|
198
|
+
rb_toupper(int c)
|
|
199
|
+
{
|
|
200
|
+
return rb_islower(c) ? (c&0x5f) : c;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
#endif /* RBIMPL_CTYPE_H */
|