slow_blink 0.0.8 → 0.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.
@@ -39,6 +39,14 @@
39
39
  #if YYDEBUG
40
40
  extern int yydebug;
41
41
  #endif
42
+ /* "%code requires" blocks. */
43
+ #line 7 "etc/slow_blink/ext_schema_parser/parser.y" /* glr.c:197 */
44
+
45
+
46
+ #define YY_DECL int yylex(YYSTYPE * yylval_param, YYLTYPE * yylloc_param, yyscan_t yyscanner, VALUE crefs)
47
+
48
+
49
+ #line 50 "ext/slow_blink/ext_schema_parser/parser.h" /* glr.c:197 */
42
50
 
43
51
  /* Token type. */
44
52
  #ifndef YYTOKENTYPE
@@ -106,6 +114,6 @@ struct YYLTYPE
106
114
 
107
115
 
108
116
 
109
- int yyparse (yyscan_t scanner, VALUE filename, VALUE *tree);
117
+ int yyparse (yyscan_t scanner, VALUE filename, VALUE crefs, VALUE *tree);
110
118
 
111
119
  #endif /* !YY_YY_EXT_SLOW_BLINK_EXT_SCHEMA_PARSER_PARSER_H_INCLUDED */
@@ -84,12 +84,7 @@ static VALUE cWeakError11;
84
84
 
85
85
  static const struct blink_stream_user cUserStream = {
86
86
  .read = myRead,
87
- .write = myWrite,
88
- .tell = NULL,
89
- .peek = NULL,
90
- .seekCur = NULL,
91
- .seekSet = NULL,
92
- .eof = NULL
87
+ .write = myWrite
93
88
  };
94
89
 
95
90
  /* functions **********************************************************/
@@ -152,8 +147,6 @@ void Init_ext_compact_encoder(void)
152
147
 
153
148
  /* static functions ***************************************************/
154
149
 
155
- #include <assert.h>
156
-
157
150
  static bool myRead(void *state, void *buf, size_t nbyte)
158
151
  {
159
152
  bool retval = false;
@@ -474,7 +467,7 @@ static VALUE getU32(VALUE self)
474
467
  VALUE retval = Qnil;
475
468
  uint32_t val;
476
469
  bool isNull;
477
- rb_gc_mark(self);
470
+
478
471
  struct blink_stream stream;
479
472
  (void)BLINK_Stream_initUser(&stream, &self, cUserStream);
480
473
  if(BLINK_Compact_decodeU32(&stream, &val, &isNull)){
@@ -634,7 +627,6 @@ static VALUE getBool(VALUE self)
634
627
  bool val;
635
628
  bool isNull;
636
629
  struct blink_stream stream;
637
- rb_gc_mark(self);
638
630
 
639
631
  (void)BLINK_Stream_initUser(&stream, &self, cUserStream);
640
632
  if(BLINK_Compact_decodeBool(&stream, &val, &isNull)){
@@ -655,7 +647,6 @@ static VALUE getBinary(VALUE self)
655
647
  uint32_t size;
656
648
  bool isNull;
657
649
  struct blink_stream stream;
658
- rb_gc_mark(self);
659
650
 
660
651
  (void)BLINK_Stream_initUser(&stream, &self, cUserStream);
661
652
 
@@ -664,7 +655,6 @@ static VALUE getBinary(VALUE self)
664
655
  if(!isNull){
665
656
 
666
657
  retval = rb_funcall(self, rb_intern("read"), 1, UINT2NUM(size));
667
- rb_gc_mark(retval);
668
658
 
669
659
  if((retval == Qnil) || ((uint32_t)NUM2UINT(rb_funcall(retval, rb_intern("size"), 0)) != size)){
670
660
 
@@ -70,20 +70,27 @@ module SlowBlink
70
70
  # @param buffer [Array<SchemaBuffer,String>]
71
71
  def initialize(*buffer)
72
72
 
73
+ # This array keeps references to the various objects
74
+ # created in the C extension parser
75
+ @crefs = []
76
+
73
77
  namespace = []
74
78
 
75
79
  if buffer.size > 0
76
80
  buffer.each do |b|
77
81
  if b.kind_of? String
78
- namespace << SlowBlink.parse_file_buffer(b)
82
+ namespace << parse_file_buffer(b, nil)
79
83
  else
80
- namespace << SlowBlink.parse_file_buffer(b.buffer, filename: b.filename)
84
+ namespace << parse_file_buffer(b.buffer, b.filename)
81
85
  end
82
86
  end
83
87
  else
84
88
  raise ArgumentError.new "at least one buffer required"
85
89
  end
86
90
 
91
+ # we safely have all our c references rooted at namespace so this can go away
92
+ @crefs = nil
93
+
87
94
  @defs = {}
88
95
 
89
96
  # create groups and definitions
@@ -21,5 +21,5 @@
21
21
 
22
22
 
23
23
  module SlowBlink
24
- VERSION = '0.0.8'.freeze
24
+ VERSION = '0.0.9'.freeze
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slow_blink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Harper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-04 00:00:00.000000000 Z
11
+ date: 2017-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubyforge_project:
148
- rubygems_version: 2.6.8
148
+ rubygems_version: 2.6.11
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: Blink Protocol in Ruby