zscan 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/ext/extconf.rb +9 -1
  3. data/ext/pack/builtin-27.h +79 -0
  4. data/ext/pack/builtin.h +79 -0
  5. data/ext/pack/internal-27.h +96 -0
  6. data/ext/pack/internal-27/array.h +103 -0
  7. data/ext/pack/internal-27/bignum.h +246 -0
  8. data/ext/pack/internal-27/bits.h +566 -0
  9. data/ext/pack/internal-27/class.h +162 -0
  10. data/ext/pack/internal-27/compar.h +50 -0
  11. data/ext/pack/internal-27/compile.h +32 -0
  12. data/ext/pack/internal-27/compilers.h +108 -0
  13. data/ext/pack/internal-27/complex.h +29 -0
  14. data/ext/pack/internal-27/cont.h +23 -0
  15. data/ext/pack/internal-27/dir.h +17 -0
  16. data/ext/pack/internal-27/enc.h +20 -0
  17. data/ext/pack/internal-27/encoding.h +28 -0
  18. data/ext/pack/internal-27/enum.h +19 -0
  19. data/ext/pack/internal-27/enumerator.h +22 -0
  20. data/ext/pack/internal-27/error.h +129 -0
  21. data/ext/pack/internal-27/eval.h +33 -0
  22. data/ext/pack/internal-27/file.h +39 -0
  23. data/ext/pack/internal-27/fixnum.h +185 -0
  24. data/ext/pack/internal-27/gc.h +153 -0
  25. data/ext/pack/internal-27/hash.h +234 -0
  26. data/ext/pack/internal-27/imemo.h +242 -0
  27. data/ext/pack/internal-27/inits.h +51 -0
  28. data/ext/pack/internal-27/io.h +35 -0
  29. data/ext/pack/internal-27/load.h +19 -0
  30. data/ext/pack/internal-27/loadpath.h +17 -0
  31. data/ext/pack/internal-27/math.h +24 -0
  32. data/ext/pack/internal-27/missing.h +19 -0
  33. data/ext/pack/internal-27/mjit.h +29 -0
  34. data/ext/pack/internal-27/numeric.h +249 -0
  35. data/ext/pack/internal-27/object.h +60 -0
  36. data/ext/pack/internal-27/parse.h +23 -0
  37. data/ext/pack/internal-27/proc.h +32 -0
  38. data/ext/pack/internal-27/process.h +130 -0
  39. data/ext/pack/internal-27/random.h +17 -0
  40. data/ext/pack/internal-27/range.h +37 -0
  41. data/ext/pack/internal-27/rational.h +68 -0
  42. data/ext/pack/internal-27/re.h +29 -0
  43. data/ext/pack/internal-27/sanitizers.h +191 -0
  44. data/ext/pack/internal-27/serial.h +24 -0
  45. data/ext/pack/internal-27/signal.h +22 -0
  46. data/ext/pack/internal-27/static_assert.h +17 -0
  47. data/ext/pack/internal-27/string.h +135 -0
  48. data/ext/pack/internal-27/struct.h +154 -0
  49. data/ext/pack/internal-27/symbol.h +41 -0
  50. data/ext/pack/internal-27/thread.h +52 -0
  51. data/ext/pack/internal-27/time.h +35 -0
  52. data/ext/pack/internal-27/transcode.h +21 -0
  53. data/ext/pack/internal-27/util.h +31 -0
  54. data/ext/pack/internal-27/variable.h +92 -0
  55. data/ext/pack/internal-27/vm.h +127 -0
  56. data/ext/pack/internal-27/warnings.h +17 -0
  57. data/ext/pack/internal.h +57 -2102
  58. data/ext/pack/internal/array.h +103 -0
  59. data/ext/pack/internal/bignum.h +246 -0
  60. data/ext/pack/internal/bits.h +566 -0
  61. data/ext/pack/internal/class.h +162 -0
  62. data/ext/pack/internal/compar.h +50 -0
  63. data/ext/pack/internal/compile.h +32 -0
  64. data/ext/pack/internal/compilers.h +108 -0
  65. data/ext/pack/internal/complex.h +29 -0
  66. data/ext/pack/internal/cont.h +23 -0
  67. data/ext/pack/internal/dir.h +17 -0
  68. data/ext/pack/internal/enc.h +20 -0
  69. data/ext/pack/internal/encoding.h +28 -0
  70. data/ext/pack/internal/enum.h +19 -0
  71. data/ext/pack/internal/enumerator.h +22 -0
  72. data/ext/pack/internal/error.h +129 -0
  73. data/ext/pack/internal/eval.h +33 -0
  74. data/ext/pack/internal/file.h +39 -0
  75. data/ext/pack/internal/fixnum.h +185 -0
  76. data/ext/pack/internal/gc.h +153 -0
  77. data/ext/pack/internal/hash.h +234 -0
  78. data/ext/pack/internal/imemo.h +242 -0
  79. data/ext/pack/internal/inits.h +51 -0
  80. data/ext/pack/internal/io.h +35 -0
  81. data/ext/pack/internal/load.h +19 -0
  82. data/ext/pack/internal/loadpath.h +17 -0
  83. data/ext/pack/internal/math.h +24 -0
  84. data/ext/pack/internal/missing.h +19 -0
  85. data/ext/pack/internal/mjit.h +29 -0
  86. data/ext/pack/internal/numeric.h +249 -0
  87. data/ext/pack/internal/object.h +60 -0
  88. data/ext/pack/internal/parse.h +23 -0
  89. data/ext/pack/internal/proc.h +32 -0
  90. data/ext/pack/internal/process.h +130 -0
  91. data/ext/pack/internal/random.h +17 -0
  92. data/ext/pack/internal/range.h +37 -0
  93. data/ext/pack/internal/rational.h +68 -0
  94. data/ext/pack/internal/re.h +29 -0
  95. data/ext/pack/internal/sanitizers.h +191 -0
  96. data/ext/pack/internal/serial.h +24 -0
  97. data/ext/pack/internal/signal.h +22 -0
  98. data/ext/pack/internal/static_assert.h +17 -0
  99. data/ext/pack/internal/string.h +135 -0
  100. data/ext/pack/internal/struct.h +154 -0
  101. data/ext/pack/internal/symbol.h +41 -0
  102. data/ext/pack/internal/thread.h +52 -0
  103. data/ext/pack/internal/time.h +35 -0
  104. data/ext/pack/internal/transcode.h +21 -0
  105. data/ext/pack/internal/util.h +31 -0
  106. data/ext/pack/internal/variable.h +92 -0
  107. data/ext/pack/internal/vm.h +127 -0
  108. data/ext/pack/internal/warnings.h +17 -0
  109. data/ext/pack/pack-26.c +2 -109
  110. data/ext/pack/pack-27.c +1022 -0
  111. data/ext/pack/pack.c +57 -1047
  112. data/lib/zscan.rb +1 -1
  113. data/zscan.gemspec +1 -1
  114. metadata +109 -3
@@ -0,0 +1,35 @@
1
+ #ifndef INTERNAL_TIME_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_TIME_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
+ * @brief Internal header for Time.
11
+ */
12
+ #include "ruby/internal/config.h" /* for SIGNEDNESS_OF_TIME_T */
13
+ #include "internal/bits.h" /* for SIGNED_INTEGER_MAX */
14
+ #include "ruby/ruby.h" /* for VALUE */
15
+
16
+ #if SIGNEDNESS_OF_TIME_T < 0 /* signed */
17
+ # define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
18
+ # define TIMET_MIN SIGNED_INTEGER_MIN(time_t)
19
+ #elif SIGNEDNESS_OF_TIME_T > 0 /* unsigned */
20
+ # define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
21
+ # define TIMET_MIN ((time_t)0)
22
+ #endif
23
+
24
+ struct timeval; /* <- in <sys/time.h> or <winsock2.h> */
25
+
26
+ /* time.c */
27
+ struct timeval rb_time_timeval(VALUE);
28
+
29
+ RUBY_SYMBOL_EXPORT_BEGIN
30
+ /* time.c (export) */
31
+ void ruby_reset_leap_second_info(void);
32
+ void ruby_reset_timezone(void);
33
+ RUBY_SYMBOL_EXPORT_END
34
+
35
+ #endif /* INTERNAL_TIME_H */
@@ -0,0 +1,21 @@
1
+ #ifndef INTERNAL_TRANSCODE_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_TRANSCODE_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
+ * @brief Internal header for Encoding::Converter.
11
+ */
12
+ #include "ruby/internal/config.h"
13
+ #include <stddef.h> /* for size_t */
14
+ #include "ruby/ruby.h" /* for VALUE */
15
+ #include "ruby/encoding.h" /* for rb_econv_t */
16
+
17
+ /* transcode.c */
18
+ extern VALUE rb_cEncodingConverter;
19
+ size_t rb_econv_memsize(rb_econv_t *);
20
+
21
+ #endif /* INTERNAL_TRANSCODE_H */
@@ -0,0 +1,31 @@
1
+ #ifndef INTERNAL_UTIL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_UTIL_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
+ * @brief Internal header corresponding util.c.
11
+ * @warning DO NOT ADD RANDOM GARBAGE HERE THIS FILE IS FOR util.c
12
+ */
13
+ #include "ruby/internal/config.h"
14
+ #include <stddef.h> /* for size_t */
15
+
16
+ #ifdef HAVE_SYS_TYPES_H
17
+ # include <sys/types.h> /* for ssize_t (note: on Windows ssize_t is */
18
+ #endif /* `#define`d in ruby/config.h) */
19
+
20
+ /* util.c */
21
+ char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
22
+ char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve);
23
+
24
+ RUBY_SYMBOL_EXPORT_BEGIN
25
+ /* util.c (export) */
26
+ extern const signed char ruby_digit36_to_number_table[];
27
+ extern const char ruby_hexdigits[];
28
+ extern unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
29
+ RUBY_SYMBOL_EXPORT_END
30
+
31
+ #endif /* INTERNAL_UTIL_H */
@@ -0,0 +1,92 @@
1
+ #ifndef INTERNAL_VARIABLE_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_VARIABLE_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
+ * @brief Internal header for variables.
11
+ */
12
+ #include "ruby/internal/config.h"
13
+ #include <stddef.h> /* for size_t */
14
+ #include "constant.h" /* for rb_const_entry_t */
15
+ #include "ruby/internal/stdbool.h" /* for bool */
16
+ #include "ruby/ruby.h" /* for VALUE */
17
+
18
+ /* global variable */
19
+
20
+ #define ROBJECT_TRANSIENT_FLAG FL_USER13
21
+
22
+ struct rb_global_variable; /* defined in variable.c */
23
+
24
+ struct rb_global_entry {
25
+ struct rb_global_variable *var;
26
+ ID id;
27
+ };
28
+
29
+ /* variable.c */
30
+ void rb_gc_mark_global_tbl(void);
31
+ void rb_gc_update_global_tbl(void);
32
+ size_t rb_generic_ivar_memsize(VALUE);
33
+ VALUE rb_search_class_path(VALUE);
34
+ VALUE rb_attr_delete(VALUE, ID);
35
+ VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
36
+ void rb_autoload_str(VALUE mod, ID id, VALUE file);
37
+ VALUE rb_autoload_at_p(VALUE, ID, int);
38
+ NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE));
39
+ rb_gvar_getter_t *rb_gvar_getter_function_of(const struct rb_global_entry *);
40
+ rb_gvar_setter_t *rb_gvar_setter_function_of(const struct rb_global_entry *);
41
+ bool rb_gvar_is_traced(const struct rb_global_entry *);
42
+ void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_);
43
+ static inline bool ROBJ_TRANSIENT_P(VALUE obj);
44
+ static inline void ROBJ_TRANSIENT_SET(VALUE obj);
45
+ static inline void ROBJ_TRANSIENT_UNSET(VALUE obj);
46
+
47
+ RUBY_SYMBOL_EXPORT_BEGIN
48
+ /* variable.c (export) */
49
+ void rb_mark_generic_ivar(VALUE);
50
+ void rb_mv_generic_ivar(VALUE src, VALUE dst);
51
+ VALUE rb_const_missing(VALUE klass, VALUE name);
52
+ int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
53
+ void rb_iv_tbl_copy(VALUE dst, VALUE src);
54
+ void rb_deprecate_constant(VALUE mod, const char *name);
55
+ RUBY_SYMBOL_EXPORT_END
56
+
57
+ MJIT_SYMBOL_EXPORT_BEGIN
58
+ struct rb_global_entry *rb_global_entry(ID);
59
+ VALUE rb_gvar_get(struct rb_global_entry *);
60
+ VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
61
+ VALUE rb_gvar_defined(struct rb_global_entry *);
62
+ struct st_table *rb_ivar_generic_ivtbl(void);
63
+ void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
64
+ MJIT_SYMBOL_EXPORT_END
65
+
66
+ static inline bool
67
+ ROBJ_TRANSIENT_P(VALUE obj)
68
+ {
69
+ #if USE_TRANSIENT_HEAP
70
+ return FL_TEST_RAW(obj, ROBJECT_TRANSIENT_FLAG);
71
+ #else
72
+ return false;
73
+ #endif
74
+ }
75
+
76
+ static inline void
77
+ ROBJ_TRANSIENT_SET(VALUE obj)
78
+ {
79
+ #if USE_TRANSIENT_HEAP
80
+ FL_SET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
81
+ #endif
82
+ }
83
+
84
+ static inline void
85
+ ROBJ_TRANSIENT_UNSET(VALUE obj)
86
+ {
87
+ #if USE_TRANSIENT_HEAP
88
+ FL_UNSET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
89
+ #endif
90
+ }
91
+
92
+ #endif /* INTERNAL_VARIABLE_H */
@@ -0,0 +1,127 @@
1
+ #ifndef INTERNAL_VM_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_VM_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
+ * @brief Internal header for RubyVM.
11
+ */
12
+ #include "ruby/internal/stdbool.h" /* for bool */
13
+ #include "internal/serial.h" /* for rb_serial_t */
14
+ #include "internal/static_assert.h" /* for STATIC_ASSERT */
15
+ #include "ruby/ruby.h" /* for ID */
16
+ #include "ruby/st.h" /* for st_table */
17
+
18
+ #ifdef rb_funcallv
19
+ # undef rb_funcallv
20
+ #endif
21
+
22
+ #ifdef rb_method_basic_definition_p
23
+ # undef rb_method_basic_definition_p
24
+ #endif
25
+
26
+ struct rb_callable_method_entry_struct; /* in method.h */
27
+ struct rb_method_definition_struct; /* in method.h */
28
+ struct rb_execution_context_struct; /* in vm_core.h */
29
+ struct rb_control_frame_struct; /* in vm_core.h */
30
+ struct rb_calling_info; /* in vm_core.h */
31
+ struct rb_call_data;
32
+
33
+ enum method_missing_reason {
34
+ MISSING_NOENTRY = 0x00,
35
+ MISSING_PRIVATE = 0x01,
36
+ MISSING_PROTECTED = 0x02,
37
+ MISSING_FCALL = 0x04,
38
+ MISSING_VCALL = 0x08,
39
+ MISSING_SUPER = 0x10,
40
+ MISSING_MISSING = 0x20,
41
+ MISSING_NONE = 0x40
42
+ };
43
+
44
+ /* vm_insnhelper.h */
45
+ rb_serial_t rb_next_class_serial(void);
46
+
47
+ /* vm.c */
48
+ VALUE rb_obj_is_thread(VALUE obj);
49
+ void rb_vm_mark(void *ptr);
50
+ PUREFUNC(VALUE rb_vm_top_self(void));
51
+ void rb_vm_inc_const_missing_count(void);
52
+ const void **rb_vm_get_insns_address_table(void);
53
+ VALUE rb_source_location(int *pline);
54
+ const char *rb_source_location_cstr(int *pline);
55
+ MJIT_STATIC void rb_vm_pop_cfunc_frame(void);
56
+ int rb_vm_add_root_module(ID id, VALUE module);
57
+ void rb_vm_check_redefinition_by_prepend(VALUE klass);
58
+ int rb_vm_check_optimizable_mid(VALUE mid);
59
+ VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
60
+ MJIT_STATIC VALUE ruby_vm_special_exception_copy(VALUE);
61
+ PUREFUNC(st_table *rb_vm_fstring_table(void));
62
+
63
+ MJIT_SYMBOL_EXPORT_BEGIN
64
+ VALUE vm_exec(struct rb_execution_context_struct *, int); /* used in JIT-ed code */
65
+ MJIT_SYMBOL_EXPORT_END
66
+
67
+ /* vm_eval.c */
68
+ VALUE rb_current_realfilepath(void);
69
+ VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE);
70
+ typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
71
+ VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
72
+ rb_check_funcall_hook *hook, VALUE arg);
73
+ VALUE rb_check_funcall_with_hook_kw(VALUE recv, ID mid, int argc, const VALUE *argv,
74
+ rb_check_funcall_hook *hook, VALUE arg, int kw_splat);
75
+ const char *rb_type_str(enum ruby_value_type type);
76
+ VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
77
+ VALUE rb_yield_1(VALUE val);
78
+ VALUE rb_yield_force_blockarg(VALUE values);
79
+ VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv,
80
+ rb_block_call_func_t bl_proc, int min_argc, int max_argc,
81
+ VALUE data2);
82
+
83
+ MJIT_SYMBOL_EXPORT_BEGIN
84
+ VALUE rb_vm_call0(struct rb_execution_context_struct *ec, VALUE recv, ID id, int argc, const VALUE *argv, const struct rb_callable_method_entry_struct *me, int kw_splat);
85
+ VALUE rb_vm_call_kw(struct rb_execution_context_struct *ec, VALUE recv, VALUE id, int argc, const VALUE *argv, const struct rb_callable_method_entry_struct *me, int kw_splat);
86
+ VALUE rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj, int argc, const VALUE *argv, int priv);
87
+ MJIT_SYMBOL_EXPORT_END
88
+
89
+ /* vm_insnhelper.c */
90
+ VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
91
+ VALUE rb_eql_opt(VALUE obj1, VALUE obj2);
92
+
93
+ struct rb_iseq_struct;
94
+ MJIT_SYMBOL_EXPORT_BEGIN
95
+ void rb_vm_search_method_slowpath(VALUE cd_owner, struct rb_call_data *cd, VALUE klass);
96
+ MJIT_SYMBOL_EXPORT_END
97
+
98
+ /* vm_dump.c */
99
+ void rb_print_backtrace(void);
100
+
101
+ /* vm_backtrace.c */
102
+ VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
103
+ VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval);
104
+ VALUE rb_make_backtrace(void);
105
+ void rb_backtrace_print_as_bugreport(void);
106
+ int rb_backtrace_p(VALUE obj);
107
+ VALUE rb_backtrace_to_str_ary(VALUE obj);
108
+ VALUE rb_backtrace_to_location_ary(VALUE obj);
109
+ void rb_backtrace_each(VALUE (*iter)(VALUE recv, VALUE str), VALUE output);
110
+
111
+ MJIT_SYMBOL_EXPORT_BEGIN
112
+ VALUE rb_ec_backtrace_object(const struct rb_execution_context_struct *ec);
113
+ void rb_backtrace_use_iseq_first_lineno_for_last_location(VALUE self);
114
+ MJIT_SYMBOL_EXPORT_END
115
+
116
+ #define RUBY_DTRACE_CREATE_HOOK(name, arg) \
117
+ RUBY_DTRACE_HOOK(name##_CREATE, arg)
118
+ #define RUBY_DTRACE_HOOK(name, arg) \
119
+ do { \
120
+ if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
121
+ int dtrace_line; \
122
+ const char *dtrace_file = rb_source_location_cstr(&dtrace_line); \
123
+ if (!dtrace_file) dtrace_file = ""; \
124
+ RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
125
+ } \
126
+ } while (0)
127
+ #endif /* INTERNAL_VM_H */
@@ -0,0 +1,17 @@
1
+ #ifndef INTERNAL_WARNINGS_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_WARNINGS_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
+ * @brief Internal header to suppres / mandate warnings.
11
+ */
12
+ #include "ruby/internal/warning_push.h"
13
+ #define COMPILER_WARNING_PUSH RBIMPL_WARNING_PUSH()
14
+ #define COMPILER_WARNING_POP RBIMPL_WARNING_POP()
15
+ #define COMPILER_WARNING_ERROR(flag) RBIMPL_WARNING_ERROR(flag)
16
+ #define COMPILER_WARNING_IGNORED(flag) RBIMPL_WARNING_IGNORED(flag)
17
+ #endif /* INTERNAL_WARNINGS_H */
@@ -105,10 +105,6 @@ typedef union {
105
105
 
106
106
  #define MAX_INTEGER_PACK_SIZE 8
107
107
 
108
- static const char toofew[] = "too few arguments";
109
-
110
- static void encodes(VALUE,const char*,long,int,int);
111
- static void qpencode(VALUE,VALUE,long);
112
108
 
113
109
  static unsigned long utf8_to_uv(const char*,long*);
114
110
 
@@ -127,114 +123,9 @@ str_associated(VALUE str)
127
123
  return rb_ivar_lookup(str, id_associated, Qfalse);
128
124
  }
129
125
 
130
- static const char uu_table[] =
131
- "`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
132
126
  static const char b64_table[] =
133
127
  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
134
128
 
135
- static void
136
- encodes(VALUE str, const char *s0, long len, int type, int tail_lf)
137
- {
138
- enum {buff_size = 4096, encoded_unit = 4, input_unit = 3};
139
- char buff[buff_size + 1]; /* +1 for tail_lf */
140
- long i = 0;
141
- const char *const trans = type == 'u' ? uu_table : b64_table;
142
- char padding;
143
- const unsigned char *s = (const unsigned char *)s0;
144
-
145
- if (type == 'u') {
146
- buff[i++] = (char)len + ' ';
147
- padding = '`';
148
- }
149
- else {
150
- padding = '=';
151
- }
152
- while (len >= input_unit) {
153
- while (len >= input_unit && buff_size-i >= encoded_unit) {
154
- buff[i++] = trans[077 & (*s >> 2)];
155
- buff[i++] = trans[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
156
- buff[i++] = trans[077 & (((s[1] << 2) & 074) | ((s[2] >> 6) & 03))];
157
- buff[i++] = trans[077 & s[2]];
158
- s += input_unit;
159
- len -= input_unit;
160
- }
161
- if (buff_size-i < encoded_unit) {
162
- rb_str_buf_cat(str, buff, i);
163
- i = 0;
164
- }
165
- }
166
-
167
- if (len == 2) {
168
- buff[i++] = trans[077 & (*s >> 2)];
169
- buff[i++] = trans[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
170
- buff[i++] = trans[077 & (((s[1] << 2) & 074) | (('\0' >> 6) & 03))];
171
- buff[i++] = padding;
172
- }
173
- else if (len == 1) {
174
- buff[i++] = trans[077 & (*s >> 2)];
175
- buff[i++] = trans[077 & (((*s << 4) & 060) | (('\0' >> 4) & 017))];
176
- buff[i++] = padding;
177
- buff[i++] = padding;
178
- }
179
- if (tail_lf) buff[i++] = '\n';
180
- rb_str_buf_cat(str, buff, i);
181
- if ((size_t)i > sizeof(buff)) rb_bug("encodes() buffer overrun");
182
- }
183
-
184
- static const char hex_table[] = "0123456789ABCDEF";
185
-
186
- static void
187
- qpencode(VALUE str, VALUE from, long len)
188
- {
189
- char buff[1024];
190
- long i = 0, n = 0, prev = EOF;
191
- unsigned char *s = (unsigned char*)RSTRING_PTR(from);
192
- unsigned char *send = s + RSTRING_LEN(from);
193
-
194
- while (s < send) {
195
- if ((*s > 126) ||
196
- (*s < 32 && *s != '\n' && *s != '\t') ||
197
- (*s == '=')) {
198
- buff[i++] = '=';
199
- buff[i++] = hex_table[*s >> 4];
200
- buff[i++] = hex_table[*s & 0x0f];
201
- n += 3;
202
- prev = EOF;
203
- }
204
- else if (*s == '\n') {
205
- if (prev == ' ' || prev == '\t') {
206
- buff[i++] = '=';
207
- buff[i++] = *s;
208
- }
209
- buff[i++] = *s;
210
- n = 0;
211
- prev = *s;
212
- }
213
- else {
214
- buff[i++] = *s;
215
- n++;
216
- prev = *s;
217
- }
218
- if (n > len) {
219
- buff[i++] = '=';
220
- buff[i++] = '\n';
221
- n = 0;
222
- prev = '\n';
223
- }
224
- if (i > 1024 - 5) {
225
- rb_str_buf_cat(str, buff, i);
226
- i = 0;
227
- }
228
- s++;
229
- }
230
- if (n > 0) {
231
- buff[i++] = '=';
232
- buff[i++] = '\n';
233
- }
234
- if (i > 0) {
235
- rb_str_buf_cat(str, buff, i);
236
- }
237
- }
238
129
 
239
130
  static inline int
240
131
  hex2num(char c)
@@ -285,6 +176,8 @@ infected_str_new(const char *ptr, long len, VALUE str)
285
176
  #define UNPACK_BLOCK 1
286
177
  #define UNPACK_1 2
287
178
 
179
+ #define castchar(from) (char)((from) & 0xff)
180
+
288
181
  VALUE zscan_internal_unpack(VALUE str, VALUE fmt, long* parsed_len)
289
182
  {
290
183
  char* init_s;