primary_connect_proto 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +39 -0
- data/connect_proto.gemspec +1 -1
- data/lib/connect_proto/build/meta_pb.rb +39 -37
- metadata +3 -37
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/defs.c +0 -2366
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/encode_decode.c +0 -1795
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/extconf.rb +0 -21
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/map.c +0 -836
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/message.c +0 -859
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/protobuf.c +0 -136
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/protobuf.h +0 -667
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/repeated_field.c +0 -686
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/storage.c +0 -1198
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/upb.c +0 -13817
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/upb.h +0 -6777
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/ext/google/protobuf_c/wrap_memcpy.c +0 -51
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/2.3/protobuf_c.bundle +0 -0
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/2.4/protobuf_c.bundle +0 -0
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/2.5/protobuf_c.bundle +0 -0
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/2.6/protobuf_c.bundle +0 -0
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/2.7/protobuf_c.bundle +0 -0
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/any_pb.rb +0 -19
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/api_pb.rb +0 -41
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/duration_pb.rb +0 -19
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/empty_pb.rb +0 -17
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/field_mask_pb.rb +0 -18
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/message_exts.rb +0 -53
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/repeated_field.rb +0 -188
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/source_context_pb.rb +0 -18
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/struct_pb.rb +0 -37
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/timestamp_pb.rb +0 -19
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/type_pb.rb +0 -91
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/well_known_types.rb +0 -230
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf/wrappers_pb.rb +0 -50
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/lib/google/protobuf.rb +0 -147
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/tests/basic.rb +0 -543
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/tests/generated_code_test.rb +0 -23
- data/vendor/bundle/ruby/2.6.0/gems/google-protobuf-4.0.0.rc.2-universal-darwin/tests/stress.rb +0 -38
- data/vendor/bundle/ruby/2.6.0/specifications/google-protobuf-4.0.0.rc.2-universal-darwin.gemspec +0 -44
@@ -1,136 +0,0 @@
|
|
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
|
-
#include "protobuf.h"
|
32
|
-
|
33
|
-
VALUE cError;
|
34
|
-
VALUE cParseError;
|
35
|
-
VALUE cTypeError;
|
36
|
-
VALUE c_only_cookie = Qnil;
|
37
|
-
|
38
|
-
static VALUE cached_empty_string = Qnil;
|
39
|
-
static VALUE cached_empty_bytes = Qnil;
|
40
|
-
|
41
|
-
static VALUE create_frozen_string(const char* str, size_t size, bool binary) {
|
42
|
-
VALUE str_rb = rb_str_new(str, size);
|
43
|
-
|
44
|
-
rb_enc_associate(str_rb,
|
45
|
-
binary ? kRubyString8bitEncoding : kRubyStringUtf8Encoding);
|
46
|
-
rb_obj_freeze(str_rb);
|
47
|
-
return str_rb;
|
48
|
-
}
|
49
|
-
|
50
|
-
VALUE get_frozen_string(const char* str, size_t size, bool binary) {
|
51
|
-
if (size == 0) {
|
52
|
-
return binary ? cached_empty_bytes : cached_empty_string;
|
53
|
-
} else {
|
54
|
-
// It is harder to memoize non-empty strings. The obvious approach would be
|
55
|
-
// to use a Ruby hash keyed by string as memo table, but looking up in such a table
|
56
|
-
// requires constructing a string (the very thing we're trying to avoid).
|
57
|
-
//
|
58
|
-
// Since few fields have defaults, we will just optimize the empty string
|
59
|
-
// case for now.
|
60
|
-
return create_frozen_string(str, size, binary);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
// -----------------------------------------------------------------------------
|
65
|
-
// Utilities.
|
66
|
-
// -----------------------------------------------------------------------------
|
67
|
-
|
68
|
-
// Raises a Ruby error if |status| is not OK, using its error message.
|
69
|
-
void check_upb_status(const upb_status* status, const char* msg) {
|
70
|
-
if (!upb_ok(status)) {
|
71
|
-
rb_raise(rb_eRuntimeError, "%s: %s\n", msg, upb_status_errmsg(status));
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
// String encodings: we look these up once, at load time, and then cache them
|
76
|
-
// here.
|
77
|
-
rb_encoding* kRubyStringUtf8Encoding;
|
78
|
-
rb_encoding* kRubyStringASCIIEncoding;
|
79
|
-
rb_encoding* kRubyString8bitEncoding;
|
80
|
-
|
81
|
-
// Ruby-interned string: "descriptor". We use this identifier to store an
|
82
|
-
// instance variable on message classes we create in order to link them back to
|
83
|
-
// their descriptors.
|
84
|
-
//
|
85
|
-
// We intern this once at module load time then use the interned identifier at
|
86
|
-
// runtime in order to avoid the cost of repeatedly interning in hot paths.
|
87
|
-
const char* kDescriptorInstanceVar = "descriptor";
|
88
|
-
ID descriptor_instancevar_interned;
|
89
|
-
|
90
|
-
// -----------------------------------------------------------------------------
|
91
|
-
// Initialization/entry point.
|
92
|
-
// -----------------------------------------------------------------------------
|
93
|
-
|
94
|
-
// This must be named "Init_protobuf_c" because the Ruby module is named
|
95
|
-
// "protobuf_c" -- the VM looks for this symbol in our .so.
|
96
|
-
void Init_protobuf_c() {
|
97
|
-
VALUE google = rb_define_module("Google");
|
98
|
-
VALUE protobuf = rb_define_module_under(google, "Protobuf");
|
99
|
-
VALUE internal = rb_define_module_under(protobuf, "Internal");
|
100
|
-
|
101
|
-
descriptor_instancevar_interned = rb_intern(kDescriptorInstanceVar);
|
102
|
-
DescriptorPool_register(protobuf);
|
103
|
-
Descriptor_register(protobuf);
|
104
|
-
FileDescriptor_register(protobuf);
|
105
|
-
FieldDescriptor_register(protobuf);
|
106
|
-
OneofDescriptor_register(protobuf);
|
107
|
-
EnumDescriptor_register(protobuf);
|
108
|
-
MessageBuilderContext_register(internal);
|
109
|
-
OneofBuilderContext_register(internal);
|
110
|
-
EnumBuilderContext_register(internal);
|
111
|
-
FileBuilderContext_register(internal);
|
112
|
-
Builder_register(internal);
|
113
|
-
RepeatedField_register(protobuf);
|
114
|
-
Map_register(protobuf);
|
115
|
-
|
116
|
-
cError = rb_const_get(protobuf, rb_intern("Error"));
|
117
|
-
cParseError = rb_const_get(protobuf, rb_intern("ParseError"));
|
118
|
-
cTypeError = rb_const_get(protobuf, rb_intern("TypeError"));
|
119
|
-
|
120
|
-
rb_define_singleton_method(protobuf, "discard_unknown",
|
121
|
-
Google_Protobuf_discard_unknown, 1);
|
122
|
-
rb_define_singleton_method(protobuf, "deep_copy",
|
123
|
-
Google_Protobuf_deep_copy, 1);
|
124
|
-
|
125
|
-
kRubyStringUtf8Encoding = rb_utf8_encoding();
|
126
|
-
kRubyStringASCIIEncoding = rb_usascii_encoding();
|
127
|
-
kRubyString8bitEncoding = rb_ascii8bit_encoding();
|
128
|
-
|
129
|
-
rb_gc_register_address(&c_only_cookie);
|
130
|
-
c_only_cookie = rb_class_new_instance(0, NULL, rb_cObject);
|
131
|
-
|
132
|
-
rb_gc_register_address(&cached_empty_string);
|
133
|
-
rb_gc_register_address(&cached_empty_bytes);
|
134
|
-
cached_empty_string = create_frozen_string("", 0, false);
|
135
|
-
cached_empty_bytes = create_frozen_string("", 0, true);
|
136
|
-
}
|