webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
protobuf.h
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2014 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #ifndef __GOOGLE_PROTOBUF_RUBY_PROTOBUF_H__
32 #define __GOOGLE_PROTOBUF_RUBY_PROTOBUF_H__
33 
34 #include <ruby/ruby.h>
35 #include <ruby/vm.h>
36 #include <ruby/encoding.h>
37 
38 #include "upb.h"
39 
40 // Forward decls.
41 struct DescriptorPool;
42 struct Descriptor;
43 struct FieldDescriptor;
44 struct EnumDescriptor;
45 struct MessageLayout;
46 struct MessageField;
47 struct MessageHeader;
49 struct EnumBuilderContext;
50 struct Builder;
51 
53 typedef struct Descriptor Descriptor;
58 typedef struct MessageField MessageField;
63 typedef struct Builder Builder;
64 
65 /*
66  It can be a bit confusing how the C structs defined below and the Ruby
67  objects interact and hold references to each other. First, a few principles:
68 
69  - Ruby's "TypedData" abstraction lets a Ruby VALUE hold a pointer to a C
70  struct (or arbitrary memory chunk), own it, and free it when collected.
71  Thus, each struct below will have a corresponding Ruby object
72  wrapping/owning it.
73 
74  - To get back from an underlying upb {msg,enum}def to the Ruby object, we
75  keep a global hashmap, accessed by get_def_obj/add_def_obj below.
76 
77  The in-memory structure is then something like:
78 
79  Ruby | upb
80  |
81  DescriptorPool ------------|-----------> upb_symtab____________________
82  | | (message types) \
83  | v \
84  Descriptor ---------------|-----------> upb_msgdef (enum types)|
85  |--> msgclass | | ^ |
86  | (dynamically built) | | | (submsg fields) |
87  |--> MessageLayout | | | /
88  |--------------------------|> decoder method| | /
89  \--------------------------|> serialize | | /
90  | handlers v | /
91  FieldDescriptor -----------|-----------> upb_fielddef /
92  | | /
93  | v (enum fields) /
94  EnumDescriptor ------------|-----------> upb_enumdef <----------'
95  |
96  |
97  ^ | \___/
98  `---------------|-----------------' (get_def_obj map)
99  */
100 
101 // -----------------------------------------------------------------------------
102 // Ruby class structure definitions.
103 // -----------------------------------------------------------------------------
104 
105 struct DescriptorPool {
107 };
108 
109 struct Descriptor {
110  const upb_msgdef* msgdef;
111  MessageLayout* layout;
112  VALUE klass; // begins as nil
116  const upb_handlers* pb_serialize_handlers;
119  // Handlers hold type class references for sub-message fields directly in some
120  // cases. We need to keep these rooted because they might otherwise be
121  // collected.
123 };
124 
125 struct FieldDescriptor {
126  const upb_fielddef* fielddef;
127 };
128 
129 struct OneofDescriptor {
130  const upb_oneofdef* oneofdef;
131 };
132 
133 struct EnumDescriptor {
134  const upb_enumdef* enumdef;
135  VALUE module; // begins as nil
136 };
137 
138 struct MessageBuilderContext {
139  VALUE descriptor;
140  VALUE builder;
141 };
142 
143 struct OneofBuilderContext {
144  VALUE descriptor;
145  VALUE builder;
146 };
147 
148 struct EnumBuilderContext {
149  VALUE enumdesc;
150 };
151 
152 struct Builder {
154  upb_def** defs; // used only while finalizing
155 };
156 
157 extern VALUE cDescriptorPool;
158 extern VALUE cDescriptor;
159 extern VALUE cFieldDescriptor;
160 extern VALUE cEnumDescriptor;
161 extern VALUE cMessageBuilderContext;
162 extern VALUE cOneofBuilderContext;
163 extern VALUE cEnumBuilderContext;
164 extern VALUE cBuilder;
165 
166 extern VALUE cError;
167 extern VALUE cParseError;
168 
169 // We forward-declare all of the Ruby method implementations here because we
170 // sometimes call the methods directly across .c files, rather than going
171 // through Ruby's method dispatching (e.g. during message parse). It's cleaner
172 // to keep the list of object methods together than to split them between
173 // static-in-file definitions and header declarations.
174 
175 void DescriptorPool_mark(void* _self);
176 void DescriptorPool_free(void* _self);
177 VALUE DescriptorPool_alloc(VALUE klass);
178 void DescriptorPool_register(VALUE module);
180 VALUE DescriptorPool_add(VALUE _self, VALUE def);
181 VALUE DescriptorPool_build(VALUE _self);
182 VALUE DescriptorPool_lookup(VALUE _self, VALUE name);
183 VALUE DescriptorPool_generated_pool(VALUE _self);
184 
185 void Descriptor_mark(void* _self);
186 void Descriptor_free(void* _self);
187 VALUE Descriptor_alloc(VALUE klass);
188 void Descriptor_register(VALUE module);
190 VALUE Descriptor_name(VALUE _self);
191 VALUE Descriptor_name_set(VALUE _self, VALUE str);
192 VALUE Descriptor_each(VALUE _self);
193 VALUE Descriptor_lookup(VALUE _self, VALUE name);
194 VALUE Descriptor_add_field(VALUE _self, VALUE obj);
195 VALUE Descriptor_add_oneof(VALUE _self, VALUE obj);
196 VALUE Descriptor_each_oneof(VALUE _self);
197 VALUE Descriptor_lookup_oneof(VALUE _self, VALUE name);
198 VALUE Descriptor_msgclass(VALUE _self);
199 extern const rb_data_type_t _Descriptor_type;
200 
201 void FieldDescriptor_mark(void* _self);
202 void FieldDescriptor_free(void* _self);
203 VALUE FieldDescriptor_alloc(VALUE klass);
204 void FieldDescriptor_register(VALUE module);
206 VALUE FieldDescriptor_name(VALUE _self);
207 VALUE FieldDescriptor_name_set(VALUE _self, VALUE str);
208 VALUE FieldDescriptor_type(VALUE _self);
209 VALUE FieldDescriptor_type_set(VALUE _self, VALUE type);
210 VALUE FieldDescriptor_label(VALUE _self);
211 VALUE FieldDescriptor_label_set(VALUE _self, VALUE label);
212 VALUE FieldDescriptor_number(VALUE _self);
213 VALUE FieldDescriptor_number_set(VALUE _self, VALUE number);
214 VALUE FieldDescriptor_submsg_name(VALUE _self);
215 VALUE FieldDescriptor_submsg_name_set(VALUE _self, VALUE value);
216 VALUE FieldDescriptor_subtype(VALUE _self);
217 VALUE FieldDescriptor_get(VALUE _self, VALUE msg_rb);
218 VALUE FieldDescriptor_set(VALUE _self, VALUE msg_rb, VALUE value);
221 
222 void OneofDescriptor_mark(void* _self);
223 void OneofDescriptor_free(void* _self);
224 VALUE OneofDescriptor_alloc(VALUE klass);
225 void OneofDescriptor_register(VALUE module);
227 VALUE OneofDescriptor_name(VALUE _self);
228 VALUE OneofDescriptor_name_set(VALUE _self, VALUE value);
229 VALUE OneofDescriptor_add_field(VALUE _self, VALUE field);
230 VALUE OneofDescriptor_each(VALUE _self, VALUE field);
231 
232 void EnumDescriptor_mark(void* _self);
233 void EnumDescriptor_free(void* _self);
234 VALUE EnumDescriptor_alloc(VALUE klass);
235 void EnumDescriptor_register(VALUE module);
237 VALUE EnumDescriptor_name(VALUE _self);
238 VALUE EnumDescriptor_name_set(VALUE _self, VALUE str);
239 VALUE EnumDescriptor_add_value(VALUE _self, VALUE name, VALUE number);
240 VALUE EnumDescriptor_lookup_name(VALUE _self, VALUE name);
241 VALUE EnumDescriptor_lookup_value(VALUE _self, VALUE number);
242 VALUE EnumDescriptor_each(VALUE _self);
243 VALUE EnumDescriptor_enummodule(VALUE _self);
244 extern const rb_data_type_t _EnumDescriptor_type;
245 
246 void MessageBuilderContext_mark(void* _self);
247 void MessageBuilderContext_free(void* _self);
248 VALUE MessageBuilderContext_alloc(VALUE klass);
249 void MessageBuilderContext_register(VALUE module);
251 VALUE MessageBuilderContext_initialize(VALUE _self,
252  VALUE descriptor,
253  VALUE builder);
254 VALUE MessageBuilderContext_optional(int argc, VALUE* argv, VALUE _self);
255 VALUE MessageBuilderContext_required(int argc, VALUE* argv, VALUE _self);
256 VALUE MessageBuilderContext_repeated(int argc, VALUE* argv, VALUE _self);
257 VALUE MessageBuilderContext_map(int argc, VALUE* argv, VALUE _self);
258 VALUE MessageBuilderContext_oneof(VALUE _self, VALUE name);
259 
260 void OneofBuilderContext_mark(void* _self);
261 void OneofBuilderContext_free(void* _self);
262 VALUE OneofBuilderContext_alloc(VALUE klass);
263 void OneofBuilderContext_register(VALUE module);
265 VALUE OneofBuilderContext_initialize(VALUE _self,
266  VALUE descriptor,
267  VALUE builder);
268 VALUE OneofBuilderContext_optional(int argc, VALUE* argv, VALUE _self);
269 
270 void EnumBuilderContext_mark(void* _self);
271 void EnumBuilderContext_free(void* _self);
272 VALUE EnumBuilderContext_alloc(VALUE klass);
273 void EnumBuilderContext_register(VALUE module);
275 VALUE EnumBuilderContext_initialize(VALUE _self, VALUE enumdesc);
276 VALUE EnumBuilderContext_value(VALUE _self, VALUE name, VALUE number);
277 
278 void Builder_mark(void* _self);
279 void Builder_free(void* _self);
280 VALUE Builder_alloc(VALUE klass);
281 void Builder_register(VALUE module);
283 VALUE Builder_add_message(VALUE _self, VALUE name);
284 VALUE Builder_add_enum(VALUE _self, VALUE name);
285 VALUE Builder_finalize_to_pool(VALUE _self, VALUE pool_rb);
286 
287 // -----------------------------------------------------------------------------
288 // Native slot storage abstraction.
289 // -----------------------------------------------------------------------------
290 
291 #define NATIVE_SLOT_MAX_SIZE sizeof(uint64_t)
292 
295  VALUE type_class,
296  void* memory,
297  VALUE value);
298 // Atomically (with respect to Ruby VM calls) either update the value and set a
299 // oneof case, or do neither. If |case_memory| is null, then no case value is
300 // set.
302  VALUE type_class,
303  void* memory,
304  VALUE value,
305  uint32_t* case_memory,
306  uint32_t case_number);
308  VALUE type_class,
309  const void* memory);
310 void native_slot_init(upb_fieldtype_t type, void* memory);
311 void native_slot_mark(upb_fieldtype_t type, void* memory);
312 void native_slot_dup(upb_fieldtype_t type, void* to, void* from);
313 void native_slot_deep_copy(upb_fieldtype_t type, void* to, void* from);
314 bool native_slot_eq(upb_fieldtype_t type, void* mem1, void* mem2);
315 
318 
319 extern rb_encoding* kRubyStringUtf8Encoding;
320 extern rb_encoding* kRubyStringASCIIEncoding;
321 extern rb_encoding* kRubyString8bitEncoding;
322 
323 VALUE field_type_class(const upb_fielddef* field);
324 
325 #define MAP_KEY_FIELD 1
326 #define MAP_VALUE_FIELD 2
327 
328 // Oneof case slot value to indicate that no oneof case is set. The value `0` is
329 // safe because field numbers are used as case identifiers, and no field can
330 // have a number of 0.
331 #define ONEOF_CASE_NONE 0
332 
333 // These operate on a map field (i.e., a repeated field of submessages whose
334 // submessage type is a map-entry msgdef).
335 bool is_map_field(const upb_fielddef* field);
338 
339 // These operate on a map-entry msgdef.
340 const upb_fielddef* map_entry_key(const upb_msgdef* msgdef);
341 const upb_fielddef* map_entry_value(const upb_msgdef* msgdef);
342 
343 // -----------------------------------------------------------------------------
344 // Repeated field container type.
345 // -----------------------------------------------------------------------------
346 
347 typedef struct {
350  void* elements;
351  int size;
352  int capacity;
353 } RepeatedField;
354 
355 void RepeatedField_mark(void* self);
356 void RepeatedField_free(void* self);
357 VALUE RepeatedField_alloc(VALUE klass);
358 VALUE RepeatedField_init(int argc, VALUE* argv, VALUE self);
359 void RepeatedField_register(VALUE module);
360 
361 extern const rb_data_type_t RepeatedField_type;
362 extern VALUE cRepeatedField;
363 
365 
366 VALUE RepeatedField_each(VALUE _self);
367 VALUE RepeatedField_index(int argc, VALUE* argv, VALUE _self);
368 void* RepeatedField_index_native(VALUE _self, int index);
369 VALUE RepeatedField_index_set(VALUE _self, VALUE _index, VALUE val);
370 void RepeatedField_reserve(RepeatedField* self, int new_size);
371 VALUE RepeatedField_push(VALUE _self, VALUE val);
372 void RepeatedField_push_native(VALUE _self, void* data);
373 VALUE RepeatedField_pop_one(VALUE _self);
374 VALUE RepeatedField_insert(int argc, VALUE* argv, VALUE _self);
375 VALUE RepeatedField_replace(VALUE _self, VALUE list);
376 VALUE RepeatedField_clear(VALUE _self);
377 VALUE RepeatedField_length(VALUE _self);
378 VALUE RepeatedField_dup(VALUE _self);
379 VALUE RepeatedField_deep_copy(VALUE _self);
380 VALUE RepeatedField_to_ary(VALUE _self);
381 VALUE RepeatedField_eq(VALUE _self, VALUE _other);
382 VALUE RepeatedField_hash(VALUE _self);
383 VALUE RepeatedField_inspect(VALUE _self);
384 VALUE RepeatedField_plus(VALUE _self, VALUE list);
385 
386 // Defined in repeated_field.c; also used by Map.
387 void validate_type_class(upb_fieldtype_t type, VALUE klass);
388 
389 // -----------------------------------------------------------------------------
390 // Map container type.
391 // -----------------------------------------------------------------------------
392 
393 typedef struct {
398 } Map;
399 
400 void Map_mark(void* self);
401 void Map_free(void* self);
402 VALUE Map_alloc(VALUE klass);
403 VALUE Map_init(int argc, VALUE* argv, VALUE self);
404 void Map_register(VALUE module);
405 
406 extern const rb_data_type_t Map_type;
407 extern VALUE cMap;
408 
409 Map* ruby_to_Map(VALUE value);
410 
411 VALUE Map_each(VALUE _self);
412 VALUE Map_keys(VALUE _self);
413 VALUE Map_values(VALUE _self);
414 VALUE Map_index(VALUE _self, VALUE key);
415 VALUE Map_index_set(VALUE _self, VALUE key, VALUE value);
416 VALUE Map_has_key(VALUE _self, VALUE key);
417 VALUE Map_delete(VALUE _self, VALUE key);
418 VALUE Map_clear(VALUE _self);
419 VALUE Map_length(VALUE _self);
420 VALUE Map_dup(VALUE _self);
421 VALUE Map_deep_copy(VALUE _self);
422 VALUE Map_eq(VALUE _self, VALUE _other);
423 VALUE Map_hash(VALUE _self);
424 VALUE Map_inspect(VALUE _self);
425 VALUE Map_merge(VALUE _self, VALUE hashmap);
426 VALUE Map_merge_into_self(VALUE _self, VALUE hashmap);
427 
428 typedef struct {
429  Map* self;
431 } Map_iter;
432 
433 void Map_begin(VALUE _self, Map_iter* iter);
434 void Map_next(Map_iter* iter);
435 bool Map_done(Map_iter* iter);
436 VALUE Map_iter_key(Map_iter* iter);
437 VALUE Map_iter_value(Map_iter* iter);
438 
439 // -----------------------------------------------------------------------------
440 // Message layout / storage.
441 // -----------------------------------------------------------------------------
442 
443 #define MESSAGE_FIELD_NO_CASE ((size_t)-1)
444 
445 struct MessageField {
446  size_t offset;
447  size_t case_offset; // for oneofs, a uint32. Else, MESSAGE_FIELD_NO_CASE.
448 };
449 
450 struct MessageLayout {
451  const upb_msgdef* msgdef;
452  MessageField* fields;
453  size_t size;
454 };
455 
456 MessageLayout* create_layout(const upb_msgdef* msgdef);
457 void free_layout(MessageLayout* layout);
458 VALUE layout_get(MessageLayout* layout,
459  const void* storage,
460  const upb_fielddef* field);
461 void layout_set(MessageLayout* layout,
462  void* storage,
463  const upb_fielddef* field,
464  VALUE val);
465 void layout_init(MessageLayout* layout, void* storage);
466 void layout_mark(MessageLayout* layout, void* storage);
467 void layout_dup(MessageLayout* layout, void* to, void* from);
468 void layout_deep_copy(MessageLayout* layout, void* to, void* from);
469 VALUE layout_eq(MessageLayout* layout, void* msg1, void* msg2);
470 VALUE layout_hash(MessageLayout* layout, void* storage);
471 VALUE layout_inspect(MessageLayout* layout, void* storage);
472 
473 // -----------------------------------------------------------------------------
474 // Message class creation.
475 // -----------------------------------------------------------------------------
476 
477 struct MessageHeader {
478  Descriptor* descriptor; // kept alive by self.class.descriptor reference.
479  // Data comes after this.
480 };
481 
482 extern rb_data_type_t Message_type;
483 
485 void* Message_data(void* msg);
486 void Message_mark(void* self);
487 void Message_free(void* self);
488 VALUE Message_alloc(VALUE klass);
489 VALUE Message_method_missing(int argc, VALUE* argv, VALUE _self);
490 VALUE Message_initialize(int argc, VALUE* argv, VALUE _self);
491 VALUE Message_dup(VALUE _self);
492 VALUE Message_deep_copy(VALUE _self);
493 VALUE Message_eq(VALUE _self, VALUE _other);
494 VALUE Message_hash(VALUE _self);
495 VALUE Message_inspect(VALUE _self);
496 VALUE Message_index(VALUE _self, VALUE field_name);
497 VALUE Message_index_set(VALUE _self, VALUE field_name, VALUE value);
498 VALUE Message_descriptor(VALUE klass);
499 VALUE Message_decode(VALUE klass, VALUE data);
500 VALUE Message_encode(VALUE klass, VALUE msg_rb);
501 VALUE Message_decode_json(VALUE klass, VALUE data);
502 VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass);
503 
504 VALUE Google_Protobuf_deep_copy(VALUE self, VALUE obj);
505 
507 VALUE enum_lookup(VALUE self, VALUE number);
508 VALUE enum_resolve(VALUE self, VALUE sym);
509 
511  Descriptor* descriptor, const void *owner);
512 
513 // Maximum depth allowed during encoding, to avoid stack overflows due to
514 // cycles.
515 #define ENCODE_MAX_NESTING 63
516 
517 // -----------------------------------------------------------------------------
518 // Global map from upb {msg,enum}defs to wrapper Descriptor/EnumDescriptor
519 // instances.
520 // -----------------------------------------------------------------------------
521 void add_def_obj(const void* def, VALUE value);
522 VALUE get_def_obj(const void* def);
523 
524 // -----------------------------------------------------------------------------
525 // Utilities.
526 // -----------------------------------------------------------------------------
527 
528 void check_upb_status(const upb_status* status, const char* msg);
529 
530 #define CHECK_UPB(code, msg) do { \
531  upb_status status = UPB_STATUS_INIT; \
532  code; \
533  check_upb_status(&status, msg); \
534 } while (0)
535 
537 
538 #endif // __GOOGLE_PROTOBUF_RUBY_PROTOBUF_H__
void native_slot_set_value_and_case(upb_fieldtype_t type, VALUE type_class, void *memory, VALUE value, uint32_t *case_memory, uint32_t case_number)
Definition: storage.c:115
const upb_handlers * fill_handlers
Definition: protobuf.h:113
uint32_t ID
Definition: wav_header.cc:29
VALUE cOneofBuilderContext
VALUE Map_init(int argc, VALUE *argv, VALUE self)
Definition: map.c:215
VALUE Map_deep_copy(VALUE _self)
Definition: map.c:526
VALUE enumdesc
Definition: protobuf.h:149
VALUE RepeatedField_pop_one(VALUE _self)
Definition: repeated_field.c:250
VALUE Map_merge_into_self(VALUE _self, VALUE hashmap)
Definition: map.c:716
VALUE Message_dup(VALUE _self)
Definition: message.c:263
upb_fieldtype_t
Definition: upb.h:1435
const upb_handlers * json_serialize_handlers_preserve
Definition: protobuf.h:118
VALUE EnumDescriptor_name_set(VALUE _self, VALUE str)
Definition: defs.c:1064
bool Map_done(Map_iter *iter)
Definition: map.c:767
VALUE Descriptor_alloc(VALUE klass)
Definition: defs.c:274
void DescriptorPool_free(void *_self)
Definition: defs.c:102
#define size
Definition: float-mm.c:27
void OneofDescriptor_free(void *_self)
Definition: defs.c:892
VALUE FieldDescriptor_type(VALUE _self)
Definition: defs.c:674
Definition: upb.c:10388
void native_slot_validate_string_encoding(upb_fieldtype_t type, VALUE value)
Definition: storage.c:89
void EnumBuilderContext_mark(void *_self)
Definition: defs.c:1549
VALUE Map_values(VALUE _self)
Definition: map.c:325
zval * native_slot_get(upb_fieldtype_t type, const void *memory TSRMLS_DC)
Definition: storage.c:63
VALUE fieldtype_to_ruby(upb_fieldtype_t type)
Definition: defs.c:582
void RepeatedField_free(void *self)
Definition: repeated_field.c:590
int capacity
Definition: protobuf.h:352
const FieldDescriptor * field
Definition: parser_unittest.cc:2279
void free_layout(MessageLayout *layout)
Definition: storage.c:386
VALUE cError
Definition: protobuf.c:42
VALUE RepeatedField_plus(VALUE _self, VALUE list)
Definition: repeated_field.c:471
VALUE build_module_from_enumdesc(EnumDescriptor *enumdef)
Definition: message.c:534
VALUE descriptor
Definition: protobuf.h:139
void DescriptorPool_mark(void *_self)
Definition: defs.c:99
void EnumBuilderContext_register(VALUE module)
Definition: defs.c:1567
VALUE EnumDescriptor_lookup_name(VALUE _self, VALUE name)
Definition: defs.c:1098
void MessageBuilderContext_mark(void *_self)
Definition: defs.c:1176
VALUE RepeatedField_each(VALUE _self)
Definition: repeated_field.c:86
VALUE cEnumBuilderContext
VALUE Builder_add_message(VALUE _self, VALUE name)
Definition: defs.c:1664
VALUE FieldDescriptor_label(VALUE _self)
Definition: defs.c:705
void Builder_free(void *_self)
Definition: defs.c:1620
VALUE Message_alloc(VALUE klass)
Definition: message.c:55
VALUE Descriptor_each_oneof(VALUE _self)
Definition: defs.c:425
void layout_dup(MessageLayout *layout, void *to, void *from)
Definition: storage.c:728
VALUE MessageBuilderContext_required(int argc, VALUE *argv, VALUE _self)
Definition: defs.c:1291
VALUE Map_clear(VALUE _self)
Definition: map.c:453
unsigned int uint32_t
Definition: ptypes.h:105
Definition: protobuf.h:90
void OneofDescriptor_mark(void *_self)
Definition: defs.c:889
VALUE MessageBuilderContext_alloc(VALUE klass)
Definition: defs.c:1187
rb_encoding * kRubyString8bitEncoding
Definition: protobuf.c:68
void RepeatedField_reserve(RepeatedField *self, int new_size)
Definition: repeated_field.c:187
VALUE RepeatedField_hash(VALUE _self)
Definition: repeated_field.c:443
void layout_mark(MessageLayout *layout, void *storage)
Definition: storage.c:707
const upb_fielddef * map_field_key(const upb_fielddef *field)
Definition: storage.c:369
VALUE EnumDescriptor_enummodule(VALUE _self)
Definition: defs.c:1156
VALUE Google_Protobuf_deep_copy(VALUE self, VALUE obj)
Definition: message.c:569
VALUE Message_index_set(VALUE _self, VALUE field_name, VALUE value)
Definition: message.c:407
VALUE RepeatedField_index(int argc, VALUE *argv, VALUE _self)
Definition: repeated_field.c:108
Descriptor * ruby_to_Descriptor(VALUE value)
VALUE cMessageBuilderContext
void * RepeatedField_index_native(VALUE _self, int index)
Definition: repeated_field.c:240
VALUE RepeatedField_clear(VALUE _self)
Definition: repeated_field.c:291
upb_fieldtype_t value_type
Definition: protobuf.h:395
VALUE RepeatedField_push(VALUE _self, VALUE val)
Definition: repeated_field.c:212
const Descriptor * descriptor
Definition: descriptor.cc:271
const upb_handlers * json_serialize_handlers
Definition: protobuf.h:117
VALUE cDescriptor
void native_slot_deep_copy(upb_fieldtype_t type, void *to, void *from)
Definition: storage.c:310
void Map_free(void *self)
Definition: map.c:162
VALUE Descriptor_each(VALUE _self)
Definition: defs.c:343
VALUE MessageBuilderContext_oneof(VALUE _self, VALUE name)
Definition: defs.c:1448
EnumDescriptor * ruby_to_EnumDescriptor(VALUE value)
VALUE DescriptorPool_generated_pool(VALUE _self)
Definition: defs.c:218
VALUE layout_inspect(MessageLayout *layout, void *storage)
Definition: storage.c:840
VALUE RepeatedField_inspect(VALUE _self)
Definition: protobuf.h:174
void Descriptor_mark(void *_self)
Definition: defs.c:228
VALUE RepeatedField_init(int argc, VALUE *argv, VALUE self)
Definition: repeated_field.c:617
VALUE EnumBuilderContext_alloc(VALUE klass)
Definition: defs.c:1559
void Message_free(void *self)
Definition: message.c:46
VALUE RepeatedField_deep_copy(VALUE _self)
Definition: repeated_field.c:348
VALUE FieldDescriptor_set(VALUE _self, VALUE msg_rb, VALUE value)
Definition: defs.c:872
VALUE FieldDescriptor_submsg_name_set(VALUE _self, VALUE value)
Definition: defs.c:812
VALUE EnumBuilderContext_initialize(VALUE _self, VALUE enumdesc)
Definition: defs.c:1585
Definition: upb.h:3092
upb_strtable table
Definition: protobuf.h:397
void layout_init(MessageLayout *layout, void *storage)
Definition: storage.c:457
void Builder_mark(void *_self)
Definition: defs.c:1615
EGLenum EGLObjectKHR EGLLabelKHR label
Definition: eglext.h:121
Definition: status.py:1
void * Message_data(void *msg)
Definition: message.c:37
OPENSSL_EXPORT const ASN1_OBJECT * obj
Definition: x509.h:1053
VALUE cBuilder
const upb_pbdecodermethod * fill_method
Definition: protobuf.h:114
upb_symtab * symtab
Definition: protobuf.h:66
VALUE Builder_finalize_to_pool(VALUE _self, VALUE pool_rb)
Definition: defs.c:1734
VALUE OneofDescriptor_alloc(VALUE klass)
Definition: defs.c:905
ID descriptor_instancevar_interned
Definition: protobuf.c:77
VALUE RepeatedField_alloc(VALUE klass)
Definition: repeated_field.c:607
VALUE Builder_alloc(VALUE klass)
Definition: defs.c:1634
VALUE RepeatedField_to_ary(VALUE _self)
Definition: repeated_field.c:373
Definition: upb.h:3140
VALUE Message_eq(VALUE _self, VALUE _other)
Definition: message.c:305
MessageLayout * create_layout(const upb_msgdef *msgdef)
Definition: storage.c:293
VALUE layout_eq(MessageLayout *layout, void *msg1, void *msg2)
Definition: storage.c:784
Definition: protobuf.h:152
VALUE Map_delete(VALUE _self, VALUE key)
Definition: map.c:430
Definition: upb.h:3044
VALUE FieldDescriptor_name(VALUE _self)
Definition: defs.c:533
VALUE FieldDescriptor_subtype(VALUE _self)
Definition: defs.c:833
void Message_mark(void *self)
Definition: message.c:41
OneofDescriptor * ruby_to_OneofDescriptor(VALUE value)
EnumBuilderContext * ruby_to_EnumBuilderContext(VALUE value)
VALUE FieldDescriptor_number_set(VALUE _self, VALUE number)
Definition: defs.c:777
Definition: protobuf.h:85
void EnumDescriptor_free(void *_self)
Definition: defs.c:1008
EGLStreamKHR EGLint EGLint offset
Definition: eglext.h:984
VALUE FieldDescriptor_submsg_name(VALUE _self)
Definition: defs.c:794
VALUE Map_inspect(VALUE _self)
Definition: map.c:661
Definition: protobuf.h:393
Definition: upb.h:987
VALUE enum_resolve(VALUE self, VALUE sym)
Definition: message.c:509
Definition: protobuf.h:347
upb_fieldtype_t field_type
Definition: protobuf.h:348
RepeatedField * ruby_to_RepeatedField(VALUE value)
Definition: repeated_field.c:44
upb_def ** defs
Definition: protobuf.h:154
VALUE klass
Definition: protobuf.h:112
VALUE EnumDescriptor_name(VALUE _self)
Definition: defs.c:1052
VALUE FieldDescriptor_alloc(VALUE klass)
Definition: defs.c:497
void MessageBuilderContext_register(VALUE module)
Definition: defs.c:1196
VALUE layout_hash(MessageLayout *layout, void *storage)
Definition: storage.c:824
VALUE Map_iter_key(Map_iter *iter)
Definition: map.c:771
VALUE Map_each(VALUE _self)
Definition: map.c:272
GLuint index
Definition: gl2.h:383
VALUE EnumDescriptor_add_value(VALUE _self, VALUE name, VALUE number)
Definition: defs.c:1081
EGLAttrib * value
Definition: eglext.h:120
VALUE Map_length(VALUE _self)
Definition: map.c:471
void native_slot_set(upb_fieldtype_t type, VALUE type_class, void *memory, VALUE value)
Definition: storage.c:110
DescriptorPool * ruby_to_DescriptorPool(VALUE value)
VALUE Map_merge(VALUE _self, VALUE hashmap)
Definition: map.c:705
VALUE cDescriptorPool
VALUE Descriptor_lookup_oneof(VALUE _self, VALUE name)
Definition: defs.c:446
void layout_deep_copy(MessageLayout *layout, void *to, void *from)
Definition: storage.c:755
VALUE OneofDescriptor_name_set(VALUE _self, VALUE value)
Definition: defs.c:943
OneofBuilderContext * ruby_to_OneofBuilderContext(VALUE value)
VALUE OneofDescriptor_add_field(VALUE _self, VALUE field)
Definition: defs.c:966
VALUE Map_index_set(VALUE _self, VALUE key, VALUE value)
Definition: map.c:378
void validate_type_class(upb_fieldtype_t type, VALUE klass)
Definition: repeated_field.c:514
VALUE Map_iter_value(Map_iter *iter)
Definition: map.c:778
VALUE Message_deep_copy(VALUE _self)
Definition: message.c:280
VALUE RepeatedField_length(VALUE _self)
Definition: repeated_field.c:303
const rb_data_type_t _Descriptor_type
void FieldDescriptor_mark(void *_self)
Definition: defs.c:481
VALUE DescriptorPool_build(VALUE _self)
Definition: defs.c:184
Definition: protobuf.h:64
VALUE Message_decode(VALUE klass, VALUE data)
Definition: encode_decode.c:699
VALUE DescriptorPool_lookup(VALUE _self, VALUE name)
Definition: defs.c:199
EGLImageKHR EGLint * name
Definition: eglext.h:851
Definition: upb.h:3126
const rb_data_type_t _EnumDescriptor_type
const AtomicString & number()
Definition: InputTypeNames.cpp:100
VALUE EnumDescriptor_alloc(VALUE klass)
Definition: defs.c:1022
void Map_begin(VALUE _self, Map_iter *iter)
Definition: map.c:757
VALUE FieldDescriptor_name_set(VALUE _self, VALUE str)
Definition: defs.c:545
void RepeatedField_push_native(VALUE _self, void *data)
Definition: repeated_field.c:228
VALUE EnumBuilderContext_value(VALUE _self, VALUE name, VALUE number)
Definition: defs.c:1604
const char * argv[]
Definition: DumpRenderTree.cpp:1631
VALUE Message_initialize(int argc, VALUE *argv, VALUE _self)
Definition: message.c:239
void OneofBuilderContext_register(VALUE module)
Definition: defs.c:1489
VALUE Map_index(VALUE _self, VALUE key)
Definition: map.c:353
zval * get_def_obj(const void *def)
Definition: protobuf.c:23
VALUE RepeatedField_eq(VALUE _self, VALUE _other)
Definition: repeated_field.c:401
VALUE OneofBuilderContext_alloc(VALUE klass)
Definition: defs.c:1480
const upb_fielddef * map_field_value(const upb_fielddef *field)
Definition: storage.c:374
Definition: protobuf.h:133
FieldDescriptor * ruby_to_FieldDescriptor(VALUE value)
VALUE MessageBuilderContext_initialize(VALUE _self, VALUE descriptor, VALUE builder)
Definition: defs.c:1219
const zend_class_entry * build_class_from_descriptor(zval *php_descriptor TSRMLS_DC)
Definition: message.c:240
VALUE DescriptorPool_alloc(VALUE klass)
Definition: defs.c:114
VALUE Map_dup(VALUE _self)
Definition: map.c:498
Definition: protobuf.h:428
VALUE Descriptor_lookup(VALUE _self, VALUE name)
Definition: defs.c:364
void FieldDescriptor_free(void *_self)
Definition: defs.c:484
VALUE Message_method_missing(int argc, VALUE *argv, VALUE _self)
Definition: message.c:126
VALUE cRepeatedField
Definition: repeated_field.c:42
void OneofBuilderContext_mark(void *_self)
Definition: defs.c:1469
EGLenum type
Definition: eglext.h:63
VALUE Descriptor_msgclass(VALUE _self)
Definition: defs.c:463
EGLStreamKHR EGLint EGLint EGLint const void * data
Definition: eglext.h:984
void native_slot_check_int_range_precision(upb_fieldtype_t type, VALUE value)
Definition: storage.c:66
void Map_mark(void *self)
Definition: map.c:143
void FieldDescriptor_register(VALUE module)
Definition: defs.c:506
VALUE Message_descriptor(VALUE klass)
Definition: message.c:427
str
Definition: make-dist.py:305
void Map_register(VALUE module)
Definition: map.c:786
void Map_next(Map_iter *iter)
Definition: map.c:763
void * elements
Definition: protobuf.h:350
Definition: upb.h:504
void layout_set(MessageLayout *layout, void *storage, const upb_fielddef *field, VALUE val)
Definition: storage.c:606
void check_upb_status(const upb_status *status, const char *msg)
Definition: def.c:7
VALUE MessageBuilderContext_repeated(int argc, VALUE *argv, VALUE _self)
Definition: defs.c:1316
VALUE descriptor
Definition: protobuf.h:144
Definition: protobuf.h:156
VALUE cFieldDescriptor
VALUE module
Definition: protobuf.h:135
void OneofDescriptor_register(VALUE module)
Definition: defs.c:912
VALUE Message_index(VALUE _self, VALUE field_name)
Definition: message.c:388
Definition: protobuf.h:138
upb_fieldtype_t key_type
Definition: protobuf.h:394
VALUE pending_list
Definition: protobuf.h:153
rb_encoding * kRubyStringASCIIEncoding
Definition: protobuf.c:67
void add_def_obj(const void *def, zval *value)
Definition: protobuf.c:14
void Descriptor_register(VALUE module)
Definition: defs.c:290
const upb_pbdecodermethod * new_fillmsg_decodermethod(Descriptor *descriptor, const void *owner)
Definition: encode_decode.c:626
Definition: upb.h:3680
upb_fieldtype_t ruby_to_fieldtype(VALUE type)
Definition: defs.c:554
VALUE Message_encode_json(int argc, VALUE *argv, VALUE klass)
Definition: encode_decode.c:1189
Definition: protobuf.h:168
VALUE Descriptor_add_oneof(VALUE _self, VALUE obj)
Definition: defs.c:406
VALUE Message_hash(VALUE _self)
Definition: message.c:326
VALUE Map_hash(VALUE _self)
Definition: map.c:627
VALUE enum_lookup(VALUE self, VALUE number)
Definition: message.c:489
VALUE RepeatedField_insert(int argc, VALUE *argv, VALUE _self)
void MessageBuilderContext_free(void *_self)
Definition: defs.c:1182
VALUE Descriptor_add_field(VALUE _self, VALUE obj)
Definition: defs.c:383
Map * ruby_to_Map(VALUE value)
Definition: map.c:137
VALUE FieldDescriptor_label_set(VALUE _self, VALUE label)
Definition: defs.c:728
VALUE MessageBuilderContext_map(int argc, VALUE *argv, VALUE _self)
Definition: defs.c:1344
VALUE Map_keys(VALUE _self)
Definition: map.c:301
VALUE builder
Definition: protobuf.h:140
VALUE field_type_class(const upb_fielddef *field)
Definition: storage.c:503
VALUE OneofBuilderContext_optional(int argc, VALUE *argv, VALUE _self)
Definition: defs.c:1526
void RepeatedField_register(VALUE module)
Definition: repeated_field.c:622
void Descriptor_free(void *_self)
Definition: defs.c:234
VALUE Message_inspect(VALUE _self)
Definition: message.c:341
VALUE cMap
Definition: map.c:135
void native_slot_dup(upb_fieldtype_t type, void *to, void *from)
Definition: storage.c:306
void Builder_register(VALUE module)
Definition: defs.c:1643
VALUE FieldDescriptor_type_set(VALUE _self, VALUE type)
Definition: defs.c:689
bool is_map_field(const upb_fielddef *field)
Definition: storage.c:280
VALUE DescriptorPool_add(VALUE _self, VALUE def)
Definition: defs.c:160
const rb_data_type_t RepeatedField_type
Definition: repeated_field.c:37
void DescriptorPool_register(VALUE module)
Definition: defs.c:120
VALUE Descriptor_name(VALUE _self)
Definition: defs.c:315
VALUE EnumDescriptor_each(VALUE _self)
Definition: defs.c:1134
Definition: upb.h:7486
void RepeatedField_mark(void *self)
Definition: repeated_field.c:579
void EnumDescriptor_register(VALUE module)
Definition: defs.c:1030
VALUE RepeatedField_dup(VALUE _self)
Definition: repeated_field.c:329
const upb_fielddef * map_entry_key(const upb_msgdef *msgdef)
Definition: storage.c:379
rb_encoding * kRubyStringUtf8Encoding
Definition: protobuf.c:66
Definition: upb.h:3025
VALUE OneofBuilderContext_initialize(VALUE _self, VALUE descriptor, VALUE builder)
Definition: defs.c:1508
VALUE OneofDescriptor_name(VALUE _self)
Definition: defs.c:931
VALUE Message_encode(VALUE klass, VALUE msg_rb)
Definition: encode_decode.c:1154
CFArrayRef CFTypeRef key
Definition: AVFoundationCFSoftLinking.h:129
VALUE OneofDescriptor_each(VALUE _self, VALUE field)
Definition: defs.c:984
const rb_data_type_t Map_type
Definition: map.c:130
VALUE FieldDescriptor_get(VALUE _self, VALUE msg_rb)
Definition: defs.c:854
void EnumBuilderContext_free(void *_self)
Definition: defs.c:1554
VALUE typeclass_references
Definition: protobuf.h:122
rb_data_type_t Message_type
Definition: message.c:50
VALUE RepeatedField_replace(VALUE _self, VALUE list)
Definition: repeated_field.c:275
GLuint GLsizei GLsizei GLfloat * val
Definition: gl2ext.h:3301
VALUE FieldDescriptor_number(VALUE _self)
Definition: defs.c:765
void OneofBuilderContext_free(void *_self)
Definition: defs.c:1475
Builder * ruby_to_Builder(VALUE value)
VALUE Map_alloc(VALUE klass)
Definition: map.c:168
size_t native_slot_size(upb_fieldtype_t type)
Definition: storage.c:19
const upb_fielddef * map_entry_value(const upb_msgdef *msgdef)
Definition: storage.c:385
VALUE Map_has_key(VALUE _self, VALUE key)
Definition: map.c:408
VALUE MessageBuilderContext_optional(int argc, VALUE *argv, VALUE _self)
Definition: defs.c:1262
int size
Definition: protobuf.h:351
void native_slot_mark(upb_fieldtype_t type, void *memory)
Definition: storage.c:294
const upb_json_parsermethod * json_fill_method
Definition: protobuf.h:115
VALUE builder
Definition: protobuf.h:145
VALUE Builder_add_enum(VALUE _self, VALUE name)
Definition: defs.c:1686
zval * layout_get(MessageLayout *layout, const void *storage, const upb_fielddef *field TSRMLS_DC)
Definition: storage.c:515
VALUE Message_decode_json(VALUE klass, VALUE data)
Definition: encode_decode.c:740
VALUE EnumDescriptor_lookup_value(VALUE _self, VALUE number)
Definition: defs.c:1116
VALUE cParseError
Definition: protobuf.c:43
VALUE cEnumDescriptor
VALUE value_type_class
Definition: protobuf.h:396
Definition: protobuf.h:70
bool native_slot_eq(upb_fieldtype_t type, void *mem1, void *mem2)
Definition: storage.c:330
Definition: protobuf.h:95
VALUE Descriptor_name_set(VALUE _self, VALUE str)
Definition: defs.c:327
Definition: upb.h:792
Definition: upb.h:3154
void native_slot_init(upb_fieldtype_t type, void *memory)
Definition: storage.c:101
VALUE field_type_class
Definition: protobuf.h:349
upb_strtable_iter it
Definition: protobuf.h:430
VALUE RepeatedField_index_set(VALUE _self, VALUE _index, VALUE val)
Definition: repeated_field.c:158
VALUE Map_eq(VALUE _self, VALUE _other)
Definition: map.c:566
MessageBuilderContext * ruby_to_MessageBuilderContext(VALUE value)
void EnumDescriptor_mark(void *_self)
Definition: defs.c:1003
Definition: protobuf.h:162