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,82 @@
|
|
|
1
|
+
#ifndef RBIMPL_INTERN_SELECT_POSIX_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_INTERN_SELECT_POSIX_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 Public APIs to provide ::rb_fd_select().
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/config.h"
|
|
24
|
+
|
|
25
|
+
#ifdef HAVE_SYS_SELECT_H
|
|
26
|
+
# include <sys/select.h> /* for select(2) (modern POSIX) */
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#ifdef HAVE_UNISTD_H
|
|
30
|
+
# include <unistd.h> /* for select(2) (archaic UNIX) */
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#include "ruby/internal/attr/pure.h"
|
|
34
|
+
#include "ruby/internal/attr/const.h"
|
|
35
|
+
|
|
36
|
+
typedef fd_set rb_fdset_t;
|
|
37
|
+
|
|
38
|
+
#define rb_fd_zero FD_ZERO
|
|
39
|
+
#define rb_fd_set FD_SET
|
|
40
|
+
#define rb_fd_clr FD_CLR
|
|
41
|
+
#define rb_fd_isset FD_ISSET
|
|
42
|
+
#define rb_fd_init FD_ZERO
|
|
43
|
+
#define rb_fd_select select
|
|
44
|
+
/**@cond INTERNAL_MACRO */
|
|
45
|
+
#define rb_fd_copy rb_fd_copy
|
|
46
|
+
#define rb_fd_dup rb_fd_dup
|
|
47
|
+
#define rb_fd_ptr rb_fd_ptr
|
|
48
|
+
#define rb_fd_max rb_fd_max
|
|
49
|
+
/** @endcond */
|
|
50
|
+
|
|
51
|
+
static inline void
|
|
52
|
+
rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int n)
|
|
53
|
+
{
|
|
54
|
+
*dst = *src;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static inline void
|
|
58
|
+
rb_fd_dup(rb_fdset_t *dst, const fd_set *src, int n)
|
|
59
|
+
{
|
|
60
|
+
*dst = *src;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
RBIMPL_ATTR_PURE()
|
|
64
|
+
/* :TODO: can this function be __attribute__((returns_nonnull)) or not? */
|
|
65
|
+
static inline fd_set *
|
|
66
|
+
rb_fd_ptr(rb_fdset_t *f)
|
|
67
|
+
{
|
|
68
|
+
return f;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
RBIMPL_ATTR_CONST()
|
|
72
|
+
static inline int
|
|
73
|
+
rb_fd_max(const rb_fdset_t *f)
|
|
74
|
+
{
|
|
75
|
+
return FD_SETSIZE;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* :FIXME: What are these? They don't exist for shibling implementations. */
|
|
79
|
+
#define rb_fd_init_copy(d, s) (*(d) = *(s))
|
|
80
|
+
#define rb_fd_term(f) ((void)(f))
|
|
81
|
+
|
|
82
|
+
#endif /* RBIMPL_INTERN_SELECT_POSIX_H */
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#ifndef RBIMPL_INTERN_SELECT_WIN32_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_INTERN_SELECT_WIN32_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 Public APIs to provide ::rb_fd_select().
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/dosish.h" /* for rb_w32_select */
|
|
24
|
+
#include "ruby/internal/attr/nonnull.h"
|
|
25
|
+
#include "ruby/internal/attr/pure.h"
|
|
26
|
+
#include "ruby/internal/attr/noalias.h"
|
|
27
|
+
#include "ruby/internal/dllexport.h"
|
|
28
|
+
#include "ruby/assert.h"
|
|
29
|
+
|
|
30
|
+
/**@cond INTERNAL_MACRO */
|
|
31
|
+
#define rb_fd_zero rb_fd_zero
|
|
32
|
+
#define rb_fd_clr rb_fd_clr
|
|
33
|
+
#define rb_fd_isset rb_fd_isset
|
|
34
|
+
#define rb_fd_copy rb_fd_copy
|
|
35
|
+
#define rb_fd_dup rb_fd_dup
|
|
36
|
+
#define rb_fd_ptr rb_fd_ptr
|
|
37
|
+
#define rb_fd_max rb_fd_max
|
|
38
|
+
/** @endcond */
|
|
39
|
+
|
|
40
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
|
41
|
+
|
|
42
|
+
struct timeval;
|
|
43
|
+
|
|
44
|
+
typedef struct {
|
|
45
|
+
int capa;
|
|
46
|
+
fd_set *fdset;
|
|
47
|
+
} rb_fdset_t;
|
|
48
|
+
|
|
49
|
+
void rb_fd_init(rb_fdset_t *);
|
|
50
|
+
void rb_fd_term(rb_fdset_t *);
|
|
51
|
+
void rb_fd_set(int, rb_fdset_t *);
|
|
52
|
+
void rb_w32_fd_copy(rb_fdset_t *, const fd_set *, int);
|
|
53
|
+
void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
|
|
54
|
+
|
|
55
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
|
56
|
+
|
|
57
|
+
RBIMPL_ATTR_NONNULL(())
|
|
58
|
+
RBIMPL_ATTR_NOALIAS()
|
|
59
|
+
static inline void
|
|
60
|
+
rb_fd_zero(rb_fdset_t *f)
|
|
61
|
+
{
|
|
62
|
+
f->fdset->fd_count = 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
RBIMPL_ATTR_NONNULL(())
|
|
66
|
+
static inline void
|
|
67
|
+
rb_fd_clr(int n, rb_fdset_t *f)
|
|
68
|
+
{
|
|
69
|
+
rb_w32_fdclr(n, f->fdset);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
RBIMPL_ATTR_NONNULL(())
|
|
73
|
+
static inline int
|
|
74
|
+
rb_fd_isset(int n, rb_fdset_t *f)
|
|
75
|
+
{
|
|
76
|
+
return rb_w32_fdisset(n, f->fdset);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
RBIMPL_ATTR_NONNULL(())
|
|
80
|
+
static inline void
|
|
81
|
+
rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int n)
|
|
82
|
+
{
|
|
83
|
+
rb_w32_fd_copy(dst, src, n);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
RBIMPL_ATTR_NONNULL(())
|
|
87
|
+
static inline void
|
|
88
|
+
rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src)
|
|
89
|
+
{
|
|
90
|
+
rb_w32_fd_dup(dst, src);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static inline int
|
|
94
|
+
rb_fd_select(int n, rb_fdset_t *rfds, rb_fdset_t *wfds, rb_fdset_t *efds, struct timeval *timeout)
|
|
95
|
+
{
|
|
96
|
+
return rb_w32_select(
|
|
97
|
+
n,
|
|
98
|
+
rfds ? rfds->fdset : NULL,
|
|
99
|
+
wfds ? wfds->fdset : NULL,
|
|
100
|
+
efds ? efds->fdset : NULL,
|
|
101
|
+
timeout);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
RBIMPL_ATTR_NONNULL(())
|
|
105
|
+
RBIMPL_ATTR_PURE()
|
|
106
|
+
/* :TODO: can this function be __attribute__((returns_nonnull)) or not? */
|
|
107
|
+
static inline fd_set *
|
|
108
|
+
rb_fd_ptr(const rb_fdset_t *f)
|
|
109
|
+
{
|
|
110
|
+
return f->fdset;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
RBIMPL_ATTR_NONNULL(())
|
|
114
|
+
RBIMPL_ATTR_PURE()
|
|
115
|
+
static inline int
|
|
116
|
+
rb_fd_max(const rb_fdset_t *f)
|
|
117
|
+
{
|
|
118
|
+
const fd_set *p = f->fdset;
|
|
119
|
+
|
|
120
|
+
RBIMPL_ASSERT_OR_ASSUME(p);
|
|
121
|
+
return p->fd_count;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
#endif /* RBIMPL_INTERN_SELECT_WIN32_H */
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#ifndef RBIMPL_INTERN_SIGNAL_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_INTERN_SIGNAL_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 Signal handling APIs.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/config.h" /* POSIX_SIGNAL / RETSIGTYPE */
|
|
24
|
+
#include "ruby/internal/dllexport.h"
|
|
25
|
+
#include "ruby/internal/value.h"
|
|
26
|
+
|
|
27
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
|
28
|
+
|
|
29
|
+
/* signal.c */
|
|
30
|
+
VALUE rb_f_kill(int, const VALUE*);
|
|
31
|
+
#ifdef POSIX_SIGNAL
|
|
32
|
+
#define posix_signal ruby_posix_signal
|
|
33
|
+
RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
|
|
34
|
+
#endif
|
|
35
|
+
const char *ruby_signal_name(int);
|
|
36
|
+
void ruby_default_signal(int);
|
|
37
|
+
|
|
38
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
|
39
|
+
|
|
40
|
+
#endif /* RBIMPL_INTERN_SIGNAL_H */
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#ifndef RBIMPL_INTERN_SPRINTF_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_INTERN_SPRINTF_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 private printf(3).
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/attr/format.h"
|
|
24
|
+
#include "ruby/internal/dllexport.h"
|
|
25
|
+
#include "ruby/internal/value.h"
|
|
26
|
+
|
|
27
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
|
28
|
+
|
|
29
|
+
/* sprintf.c */
|
|
30
|
+
VALUE rb_f_sprintf(int, const VALUE*);
|
|
31
|
+
|
|
32
|
+
RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 1, 2)
|
|
33
|
+
VALUE rb_sprintf(const char*, ...);
|
|
34
|
+
VALUE rb_vsprintf(const char*, va_list);
|
|
35
|
+
|
|
36
|
+
RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 2, 3)
|
|
37
|
+
VALUE rb_str_catf(VALUE, const char*, ...);
|
|
38
|
+
VALUE rb_str_vcatf(VALUE, const char*, va_list);
|
|
39
|
+
VALUE rb_str_format(int, const VALUE *, VALUE);
|
|
40
|
+
|
|
41
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
|
42
|
+
|
|
43
|
+
#endif /* RBIMPL_INTERN_SPRINTF_H */
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
#ifndef RBIMPL_INTERN_STRING_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_INTERN_STRING_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 Public APIs related to ::rb_cString.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/config.h"
|
|
24
|
+
|
|
25
|
+
#ifdef STDC_HEADERS
|
|
26
|
+
# include <stddef.h>
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#ifdef HAVE_STRING_H
|
|
30
|
+
# include <string.h>
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#ifdef HAVE_STDINT_H
|
|
34
|
+
# include <stdint.h>
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
#include "ruby/internal/attr/nonnull.h"
|
|
38
|
+
#include "ruby/internal/attr/pure.h"
|
|
39
|
+
#include "ruby/internal/constant_p.h"
|
|
40
|
+
#include "ruby/internal/dllexport.h"
|
|
41
|
+
#include "ruby/internal/value.h"
|
|
42
|
+
#include "ruby/internal/variable.h" /* rb_gvar_setter_t */
|
|
43
|
+
#include "ruby/st.h" /* st_index_t */
|
|
44
|
+
|
|
45
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
|
46
|
+
|
|
47
|
+
/* string.c */
|
|
48
|
+
VALUE rb_str_new(const char*, long);
|
|
49
|
+
VALUE rb_str_new_cstr(const char*);
|
|
50
|
+
VALUE rb_str_new_shared(VALUE);
|
|
51
|
+
VALUE rb_str_new_frozen(VALUE);
|
|
52
|
+
VALUE rb_str_new_with_class(VALUE, const char*, long);
|
|
53
|
+
VALUE rb_tainted_str_new_cstr(const char*);
|
|
54
|
+
VALUE rb_tainted_str_new(const char*, long);
|
|
55
|
+
VALUE rb_external_str_new(const char*, long);
|
|
56
|
+
VALUE rb_external_str_new_cstr(const char*);
|
|
57
|
+
VALUE rb_locale_str_new(const char*, long);
|
|
58
|
+
VALUE rb_locale_str_new_cstr(const char*);
|
|
59
|
+
VALUE rb_filesystem_str_new(const char*, long);
|
|
60
|
+
VALUE rb_filesystem_str_new_cstr(const char*);
|
|
61
|
+
VALUE rb_str_buf_new(long);
|
|
62
|
+
VALUE rb_str_buf_new_cstr(const char*);
|
|
63
|
+
VALUE rb_str_buf_new2(const char*);
|
|
64
|
+
VALUE rb_str_tmp_new(long);
|
|
65
|
+
VALUE rb_usascii_str_new(const char*, long);
|
|
66
|
+
VALUE rb_usascii_str_new_cstr(const char*);
|
|
67
|
+
VALUE rb_utf8_str_new(const char*, long);
|
|
68
|
+
VALUE rb_utf8_str_new_cstr(const char*);
|
|
69
|
+
VALUE rb_str_new_static(const char *, long);
|
|
70
|
+
VALUE rb_usascii_str_new_static(const char *, long);
|
|
71
|
+
VALUE rb_utf8_str_new_static(const char *, long);
|
|
72
|
+
void rb_str_free(VALUE);
|
|
73
|
+
void rb_str_shared_replace(VALUE, VALUE);
|
|
74
|
+
VALUE rb_str_buf_append(VALUE, VALUE);
|
|
75
|
+
VALUE rb_str_buf_cat(VALUE, const char*, long);
|
|
76
|
+
VALUE rb_str_buf_cat2(VALUE, const char*);
|
|
77
|
+
VALUE rb_str_buf_cat_ascii(VALUE, const char*);
|
|
78
|
+
VALUE rb_obj_as_string(VALUE);
|
|
79
|
+
VALUE rb_check_string_type(VALUE);
|
|
80
|
+
void rb_must_asciicompat(VALUE);
|
|
81
|
+
VALUE rb_str_dup(VALUE);
|
|
82
|
+
VALUE rb_str_resurrect(VALUE str);
|
|
83
|
+
VALUE rb_str_locktmp(VALUE);
|
|
84
|
+
VALUE rb_str_unlocktmp(VALUE);
|
|
85
|
+
VALUE rb_str_dup_frozen(VALUE);
|
|
86
|
+
#define rb_str_dup_frozen rb_str_new_frozen
|
|
87
|
+
VALUE rb_str_plus(VALUE, VALUE);
|
|
88
|
+
VALUE rb_str_times(VALUE, VALUE);
|
|
89
|
+
long rb_str_sublen(VALUE, long);
|
|
90
|
+
VALUE rb_str_substr(VALUE, long, long);
|
|
91
|
+
VALUE rb_str_subseq(VALUE, long, long);
|
|
92
|
+
char *rb_str_subpos(VALUE, long, long*);
|
|
93
|
+
void rb_str_modify(VALUE);
|
|
94
|
+
void rb_str_modify_expand(VALUE, long);
|
|
95
|
+
VALUE rb_str_freeze(VALUE);
|
|
96
|
+
void rb_str_set_len(VALUE, long);
|
|
97
|
+
VALUE rb_str_resize(VALUE, long);
|
|
98
|
+
VALUE rb_str_cat(VALUE, const char*, long);
|
|
99
|
+
VALUE rb_str_cat_cstr(VALUE, const char*);
|
|
100
|
+
VALUE rb_str_cat2(VALUE, const char*);
|
|
101
|
+
VALUE rb_str_append(VALUE, VALUE);
|
|
102
|
+
VALUE rb_str_concat(VALUE, VALUE);
|
|
103
|
+
st_index_t rb_memhash(const void *ptr, long len);
|
|
104
|
+
st_index_t rb_hash_start(st_index_t);
|
|
105
|
+
st_index_t rb_hash_uint32(st_index_t, uint32_t);
|
|
106
|
+
st_index_t rb_hash_uint(st_index_t, st_index_t);
|
|
107
|
+
st_index_t rb_hash_end(st_index_t);
|
|
108
|
+
#define rb_hash_uint32(h, i) st_hash_uint32((h), (i))
|
|
109
|
+
#define rb_hash_uint(h, i) st_hash_uint((h), (i))
|
|
110
|
+
#define rb_hash_end(h) st_hash_end(h)
|
|
111
|
+
st_index_t rb_str_hash(VALUE);
|
|
112
|
+
int rb_str_hash_cmp(VALUE,VALUE);
|
|
113
|
+
int rb_str_comparable(VALUE, VALUE);
|
|
114
|
+
int rb_str_cmp(VALUE, VALUE);
|
|
115
|
+
VALUE rb_str_equal(VALUE str1, VALUE str2);
|
|
116
|
+
VALUE rb_str_drop_bytes(VALUE, long);
|
|
117
|
+
void rb_str_update(VALUE, long, long, VALUE);
|
|
118
|
+
VALUE rb_str_replace(VALUE, VALUE);
|
|
119
|
+
VALUE rb_str_inspect(VALUE);
|
|
120
|
+
VALUE rb_str_dump(VALUE);
|
|
121
|
+
VALUE rb_str_split(VALUE, const char*);
|
|
122
|
+
rb_gvar_setter_t rb_str_setter;
|
|
123
|
+
VALUE rb_str_intern(VALUE);
|
|
124
|
+
VALUE rb_sym_to_s(VALUE);
|
|
125
|
+
long rb_str_strlen(VALUE);
|
|
126
|
+
VALUE rb_str_length(VALUE);
|
|
127
|
+
long rb_str_offset(VALUE, long);
|
|
128
|
+
RBIMPL_ATTR_PURE()
|
|
129
|
+
size_t rb_str_capacity(VALUE);
|
|
130
|
+
VALUE rb_str_ellipsize(VALUE, long);
|
|
131
|
+
VALUE rb_str_scrub(VALUE, VALUE);
|
|
132
|
+
VALUE rb_str_succ(VALUE);
|
|
133
|
+
|
|
134
|
+
RBIMPL_ATTR_NONNULL(())
|
|
135
|
+
static inline long
|
|
136
|
+
rbimpl_strlen(const char *str)
|
|
137
|
+
{
|
|
138
|
+
return RBIMPL_CAST((long)strlen(str));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static inline VALUE
|
|
142
|
+
rbimpl_str_new_cstr(const char *str)
|
|
143
|
+
{
|
|
144
|
+
long len = rbimpl_strlen(str);
|
|
145
|
+
return rb_str_new_static(str, len);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
static inline VALUE
|
|
149
|
+
rbimpl_tainted_str_new_cstr(const char *str)
|
|
150
|
+
{
|
|
151
|
+
long len = rbimpl_strlen(str);
|
|
152
|
+
return rb_tainted_str_new(str, len);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static inline VALUE
|
|
156
|
+
rbimpl_usascii_str_new_cstr(const char *str)
|
|
157
|
+
{
|
|
158
|
+
long len = rbimpl_strlen(str);
|
|
159
|
+
return rb_usascii_str_new_static(str, len);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
static inline VALUE
|
|
163
|
+
rbimpl_utf8_str_new_cstr(const char *str)
|
|
164
|
+
{
|
|
165
|
+
long len = rbimpl_strlen(str);
|
|
166
|
+
return rb_utf8_str_new_static(str, len);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static inline VALUE
|
|
170
|
+
rbimpl_external_str_new_cstr(const char *str)
|
|
171
|
+
{
|
|
172
|
+
long len = rbimpl_strlen(str);
|
|
173
|
+
return rb_external_str_new(str, len);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
static inline VALUE
|
|
177
|
+
rbimpl_locale_str_new_cstr(const char *str)
|
|
178
|
+
{
|
|
179
|
+
long len = rbimpl_strlen(str);
|
|
180
|
+
return rb_locale_str_new(str, len);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
static inline VALUE
|
|
184
|
+
rbimpl_str_buf_new_cstr(const char *str)
|
|
185
|
+
{
|
|
186
|
+
long len = rbimpl_strlen(str);
|
|
187
|
+
VALUE buf = rb_str_buf_new(len);
|
|
188
|
+
return rb_str_buf_cat(buf, str, len);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
static inline VALUE
|
|
192
|
+
rbimpl_str_cat_cstr(VALUE buf, const char *str)
|
|
193
|
+
{
|
|
194
|
+
long len = rbimpl_strlen(str);
|
|
195
|
+
return rb_str_cat(buf, str, len);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
static inline VALUE
|
|
199
|
+
rbimpl_exc_new_cstr(VALUE exc, const char *str)
|
|
200
|
+
{
|
|
201
|
+
long len = rbimpl_strlen(str);
|
|
202
|
+
return rb_exc_new(exc, str, len);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
#define rb_str_new(str, len) \
|
|
206
|
+
((RBIMPL_CONSTANT_P(str) && \
|
|
207
|
+
RBIMPL_CONSTANT_P(len) ? \
|
|
208
|
+
rb_str_new_static : \
|
|
209
|
+
rb_str_new) ((str), (len)))
|
|
210
|
+
|
|
211
|
+
#define rb_str_new_cstr(str) \
|
|
212
|
+
((RBIMPL_CONSTANT_P(str) ? \
|
|
213
|
+
rbimpl_str_new_cstr : \
|
|
214
|
+
rb_str_new_cstr) (str))
|
|
215
|
+
|
|
216
|
+
#define rb_usascii_str_new(str, len) \
|
|
217
|
+
((RBIMPL_CONSTANT_P(str) && \
|
|
218
|
+
RBIMPL_CONSTANT_P(len) ? \
|
|
219
|
+
rb_usascii_str_new_static : \
|
|
220
|
+
rb_usascii_str_new) ((str), (len)))
|
|
221
|
+
|
|
222
|
+
#define rb_utf8_str_new(str, len) \
|
|
223
|
+
((RBIMPL_CONSTANT_P(str) && \
|
|
224
|
+
RBIMPL_CONSTANT_P(len) ? \
|
|
225
|
+
rb_utf8_str_new_static : \
|
|
226
|
+
rb_utf8_str_new) ((str), (len)))
|
|
227
|
+
|
|
228
|
+
#define rb_tainted_str_new_cstr(str) \
|
|
229
|
+
((RBIMPL_CONSTANT_P(str) ? \
|
|
230
|
+
rbimpl_tainted_str_new_cstr : \
|
|
231
|
+
rb_tainted_str_new_cstr) (str))
|
|
232
|
+
|
|
233
|
+
#define rb_usascii_str_new_cstr(str) \
|
|
234
|
+
((RBIMPL_CONSTANT_P(str) ? \
|
|
235
|
+
rbimpl_usascii_str_new_cstr : \
|
|
236
|
+
rb_usascii_str_new_cstr) (str))
|
|
237
|
+
|
|
238
|
+
#define rb_utf8_str_new_cstr(str) \
|
|
239
|
+
((RBIMPL_CONSTANT_P(str) ? \
|
|
240
|
+
rbimpl_utf8_str_new_cstr : \
|
|
241
|
+
rb_utf8_str_new_cstr) (str))
|
|
242
|
+
|
|
243
|
+
#define rb_external_str_new_cstr(str) \
|
|
244
|
+
((RBIMPL_CONSTANT_P(str) ? \
|
|
245
|
+
rbimpl_external_str_new_cstr : \
|
|
246
|
+
rb_external_str_new_cstr) (str))
|
|
247
|
+
|
|
248
|
+
#define rb_locale_str_new_cstr(str) \
|
|
249
|
+
((RBIMPL_CONSTANT_P(str) ? \
|
|
250
|
+
rbimpl_locale_str_new_cstr : \
|
|
251
|
+
rb_locale_str_new_cstr) (str))
|
|
252
|
+
|
|
253
|
+
#define rb_str_buf_new_cstr(str) \
|
|
254
|
+
((RBIMPL_CONSTANT_P(str) ? \
|
|
255
|
+
rbimpl_str_buf_new_cstr : \
|
|
256
|
+
rb_str_buf_new_cstr) (str))
|
|
257
|
+
|
|
258
|
+
#define rb_str_cat_cstr(buf, str) \
|
|
259
|
+
((RBIMPL_CONSTANT_P(str) ? \
|
|
260
|
+
rbimpl_str_cat_cstr : \
|
|
261
|
+
rb_str_cat_cstr) ((buf), (str)))
|
|
262
|
+
|
|
263
|
+
#define rb_exc_new_cstr(exc, str) \
|
|
264
|
+
((RBIMPL_CONSTANT_P(str) ? \
|
|
265
|
+
rbimpl_exc_new_cstr : \
|
|
266
|
+
rb_exc_new_cstr) ((exc), (str)))
|
|
267
|
+
|
|
268
|
+
#define rb_str_new2 rb_str_new_cstr
|
|
269
|
+
#define rb_str_new3 rb_str_new_shared
|
|
270
|
+
#define rb_str_new4 rb_str_new_frozen
|
|
271
|
+
#define rb_str_new5 rb_str_new_with_class
|
|
272
|
+
#define rb_tainted_str_new2 rb_tainted_str_new_cstr
|
|
273
|
+
#define rb_str_buf_new2 rb_str_buf_new_cstr
|
|
274
|
+
#define rb_usascii_str_new2 rb_usascii_str_new_cstr
|
|
275
|
+
#define rb_str_buf_cat rb_str_cat
|
|
276
|
+
#define rb_str_buf_cat2 rb_str_cat_cstr
|
|
277
|
+
#define rb_str_cat2 rb_str_cat_cstr
|
|
278
|
+
#define rb_strlen_lit(str) (sizeof(str "") - 1)
|
|
279
|
+
#define rb_str_new_lit(str) rb_str_new_static((str), rb_strlen_lit(str))
|
|
280
|
+
#define rb_usascii_str_new_lit(str) rb_usascii_str_new_static((str), rb_strlen_lit(str))
|
|
281
|
+
#define rb_utf8_str_new_lit(str) rb_utf8_str_new_static((str), rb_strlen_lit(str))
|
|
282
|
+
#define rb_enc_str_new_lit(str, enc) rb_enc_str_new_static((str), rb_strlen_lit(str), (enc))
|
|
283
|
+
#define rb_str_new_literal(str) rb_str_new_lit(str)
|
|
284
|
+
#define rb_usascii_str_new_literal(str) rb_usascii_str_new_lit(str)
|
|
285
|
+
#define rb_utf8_str_new_literal(str) rb_utf8_str_new_lit(str)
|
|
286
|
+
#define rb_enc_str_new_literal(str, enc) rb_enc_str_new_lit(str, enc)
|
|
287
|
+
|
|
288
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
|
289
|
+
|
|
290
|
+
#endif /* RBIMPL_INTERN_STRING_H */
|