Merge pull request #88 from google/gencode2
First version of a real C codegen for upb.pull/13171/head
commit
d5167fff74
11 changed files with 2973 additions and 26 deletions
@ -0,0 +1,83 @@ |
|||||||
|
|
||||||
|
μpb Design |
||||||
|
---------- |
||||||
|
|
||||||
|
**NOTE:** the design described here is being implemented currently, but is not |
||||||
|
yet complete. The repo is in heavy transition right now. |
||||||
|
|
||||||
|
μpb has the following design goals: |
||||||
|
|
||||||
|
- C89 compatible. |
||||||
|
- small code size (both for the core library and generated messages). |
||||||
|
- fast performance (hundreds of MB/s). |
||||||
|
- idiomatic for C programs. |
||||||
|
- easy to wrap in high-level languages (Python, Ruby, Lua, etc) with |
||||||
|
good performance and all standard protobuf features. |
||||||
|
- hands-off about memory management, allowing for easy integration |
||||||
|
with existing VMs and/or garbage collectors. |
||||||
|
- offers binary ABI compatibility between apps, generated messages, and |
||||||
|
the core library (doesn't require re-generating messages or recompiling |
||||||
|
your application when the core library changes). |
||||||
|
- provides all features that users expect from a protobuf library |
||||||
|
(generated messages in C, reflection, text format, etc.). |
||||||
|
- layered, so the core is small and doesn't require descriptors. |
||||||
|
- tidy about symbol references, so that any messages or features that |
||||||
|
aren't used by a C program can have their code GC'd by the linker. |
||||||
|
- possible to use protobuf binary format without leaking message/field |
||||||
|
names into the binary. |
||||||
|
|
||||||
|
μpb accomplishes these goals by keeping a very small core that does not contain |
||||||
|
descriptors. We need some way of knowing what fields are in each message and |
||||||
|
where they live, but instead of descriptors, we keep a small/lightweight summary |
||||||
|
of the .proto file. We call this a `upb_msglayout`. It contains the bare |
||||||
|
minimum of what we need to know to parse and serialize protobuf binary format |
||||||
|
into our internal representation for messages, `upb_msg`. |
||||||
|
|
||||||
|
The core then contains functions to parse/serialize a message, given a `upb_msg*` |
||||||
|
and a `const upb_msglayout*`. |
||||||
|
|
||||||
|
This approach is similar to [nanopb](https://github.com/nanopb/nanopb) which |
||||||
|
also compiles message definitions to a compact, internal representation without |
||||||
|
names. However nanopb does not aim to be a fully-featured library, and has no |
||||||
|
support for text format, JSON, or descriptors. μpb is unique in that it has a |
||||||
|
small core similar to nanopb (though not quite as small), but also offers a |
||||||
|
full-featured protobuf library for applications that want reflection, text |
||||||
|
format, JSON format, etc. |
||||||
|
|
||||||
|
Without descriptors, the core doesn't have access to field names, so it cannot |
||||||
|
parse/serialize to protobuf text format or JSON. Instead this functionality |
||||||
|
lives in separate modules that depend on the module implementing descriptors. |
||||||
|
With the descriptor module we can parse/serialize binary descriptors and |
||||||
|
validate that they follow all the rules of protobuf schemas. |
||||||
|
|
||||||
|
To provide binary compatibility, we version the structs that generated messages |
||||||
|
use to create a `upb_msglayout*`. The current initializers are |
||||||
|
`upb_msglayout_msginit_v1`, `upb_msglayout_fieldinit_v1`, etc. Then |
||||||
|
`upb_msglayout*` uses these as its internal representation. If upb changes its |
||||||
|
internal representation for a `upb_msglayout*`, it will also include code to |
||||||
|
convert the old representation to the new representation. This will use some |
||||||
|
more memory/CPU at runtime to convert between the two, but apps that statically |
||||||
|
link μpb will never need to worry about this. |
||||||
|
|
||||||
|
TODO |
||||||
|
---- |
||||||
|
|
||||||
|
The current state of the repo is quite different than what is described above. |
||||||
|
Here are the major items that need to be implemented. |
||||||
|
|
||||||
|
1. implement the core generic protobuf binary encoder/decoder that uses a |
||||||
|
`upb_msglayout*`. |
||||||
|
2. remove all mention of handlers, sink, etc. from core into their own module. |
||||||
|
All of the handlers stuff needs substantial revision, but moving it out of |
||||||
|
core is the first priority. |
||||||
|
3. move all of the def/refcounted stuff out of core. The defs also need |
||||||
|
substantial revision, but moving them out of core is the first priority. |
||||||
|
4. revise our generated code until it is in a state where we feel comfortable |
||||||
|
committing to API/ABI stability for it. This may involve moving different |
||||||
|
parts of the generated code into separate files, like keeping the serialized |
||||||
|
descriptor in a separate file from the compact msglayout. |
||||||
|
5. revise all of the existing encoders/decoders and handlers. We probably |
||||||
|
will want to keep handlers, since they let us decouple encoders/decoders |
||||||
|
from `upb_msg`, but we need to simplify all of that a LOT. Likely we will |
||||||
|
want to make handlers only per-message instead of per-field, except for |
||||||
|
variable-length fields. |
@ -0,0 +1,162 @@ |
|||||||
|
/* This is a upb implementation of the upb conformance tests, see:
|
||||||
|
* https://github.com/google/protobuf/tree/master/conformance
|
||||||
|
*/ |
||||||
|
|
||||||
|
#include <errno.h> |
||||||
|
#include <stdarg.h> |
||||||
|
#include <stdlib.h> |
||||||
|
#include <unistd.h> |
||||||
|
|
||||||
|
#include "conformance.upb.h" |
||||||
|
#include "google/protobuf/test_messages_proto3.upb.h" |
||||||
|
|
||||||
|
int test_count = 0; |
||||||
|
|
||||||
|
bool CheckedRead(int fd, void *buf, size_t len) { |
||||||
|
size_t ofs = 0; |
||||||
|
while (len > 0) { |
||||||
|
ssize_t bytes_read = read(fd, (char*)buf + ofs, len); |
||||||
|
|
||||||
|
if (bytes_read == 0) return false; |
||||||
|
|
||||||
|
if (bytes_read < 0) { |
||||||
|
perror("reading from test runner"); |
||||||
|
exit(1); |
||||||
|
} |
||||||
|
|
||||||
|
len -= bytes_read; |
||||||
|
ofs += bytes_read; |
||||||
|
} |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
void CheckedWrite(int fd, const void *buf, size_t len) { |
||||||
|
if (write(fd, buf, len) != len) { |
||||||
|
perror("writing to test runner"); |
||||||
|
exit(1); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void DoTest( |
||||||
|
const conformance_ConformanceRequest* request, |
||||||
|
conformance_ConformanceResponse *response, |
||||||
|
upb_env *env) { |
||||||
|
conformance_ConformanceResponse_new(env); |
||||||
|
protobuf_test_messages_proto3_TestAllTypes *test_message; |
||||||
|
|
||||||
|
switch (conformance_ConformanceRequest_payload_case(request)) { |
||||||
|
case conformance_ConformanceRequest_payload_protobuf_payload: |
||||||
|
test_message = protobuf_test_messages_proto3_TestAllTypes_parsenew( |
||||||
|
conformance_ConformanceRequest_protobuf_payload(request), env); |
||||||
|
|
||||||
|
if (!test_message) { |
||||||
|
/* TODO(haberman): return details. */ |
||||||
|
static char msg[] = "Parse error (no more details available)."; |
||||||
|
conformance_ConformanceResponse_set_parse_error( |
||||||
|
response, upb_stringview_make(msg, sizeof(msg))); |
||||||
|
return; |
||||||
|
} |
||||||
|
break; |
||||||
|
|
||||||
|
case conformance_ConformanceRequest_payload_json_payload: { |
||||||
|
static char msg[] = "JSON support not yet implemented."; |
||||||
|
conformance_ConformanceResponse_set_skipped( |
||||||
|
response, upb_stringview_make(msg, sizeof(msg))); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
case conformance_ConformanceRequest_payload_NOT_SET: |
||||||
|
fprintf(stderr, "conformance_upb: Request didn't have payload."); |
||||||
|
exit(1); |
||||||
|
} |
||||||
|
|
||||||
|
switch (conformance_ConformanceRequest_requested_output_format(request)) { |
||||||
|
case conformance_UNSPECIFIED: |
||||||
|
fprintf(stderr, "conformance_upb: Unspecified output format."); |
||||||
|
exit(1); |
||||||
|
|
||||||
|
case conformance_PROTOBUF: { |
||||||
|
size_t serialized_len; |
||||||
|
char *serialized = protobuf_test_messages_proto3_TestAllTypes_serialize( |
||||||
|
test_message, env, &serialized_len); |
||||||
|
if (!serialized) { |
||||||
|
fprintf(stderr, "conformance_upb: Error serializing."); |
||||||
|
exit(1); |
||||||
|
} |
||||||
|
conformance_ConformanceResponse_set_protobuf_payload( |
||||||
|
response, upb_stringview_make(serialized, serialized_len)); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
case conformance_JSON: { |
||||||
|
static char msg[] = "JSON support not yet implemented."; |
||||||
|
conformance_ConformanceResponse_set_skipped( |
||||||
|
response, upb_stringview_make(msg, sizeof(msg))); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
default: |
||||||
|
fprintf(stderr, "conformance_upb: Unknown output format: %d", |
||||||
|
conformance_ConformanceRequest_requested_output_format(request)); |
||||||
|
exit(1); |
||||||
|
} |
||||||
|
|
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
bool DoTestIo() { |
||||||
|
upb_env env; |
||||||
|
upb_status status; |
||||||
|
char *serialized_input; |
||||||
|
char *serialized_output; |
||||||
|
uint32_t input_size; |
||||||
|
size_t output_size; |
||||||
|
conformance_ConformanceRequest *request; |
||||||
|
conformance_ConformanceResponse *response; |
||||||
|
|
||||||
|
if (!CheckedRead(STDIN_FILENO, &input_size, sizeof(uint32_t))) { |
||||||
|
// EOF.
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
upb_env_init(&env); |
||||||
|
upb_env_reporterrorsto(&env, &status); |
||||||
|
serialized_input = upb_env_malloc(&env, input_size); |
||||||
|
|
||||||
|
if (!CheckedRead(STDIN_FILENO, serialized_input, input_size)) { |
||||||
|
fprintf(stderr, "conformance_upb: unexpected EOF on stdin.\n"); |
||||||
|
exit(1); |
||||||
|
} |
||||||
|
|
||||||
|
request = conformance_ConformanceRequest_parsenew( |
||||||
|
upb_stringview_make(serialized_input, input_size), &env); |
||||||
|
response = conformance_ConformanceResponse_new(&env); |
||||||
|
|
||||||
|
if (request) { |
||||||
|
DoTest(request, response, &env); |
||||||
|
} else { |
||||||
|
fprintf(stderr, "conformance_upb: parse of ConformanceRequest failed: %s\n", |
||||||
|
upb_status_errmsg(&status)); |
||||||
|
} |
||||||
|
|
||||||
|
serialized_output = conformance_ConformanceResponse_serialize( |
||||||
|
response, &env, &output_size); |
||||||
|
|
||||||
|
CheckedWrite(STDOUT_FILENO, &output_size, sizeof(uint32_t)); |
||||||
|
CheckedWrite(STDOUT_FILENO, serialized_output, output_size); |
||||||
|
|
||||||
|
test_count++; |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
int main() { |
||||||
|
while (1) { |
||||||
|
if (!DoTestIo()) { |
||||||
|
fprintf(stderr, "conformance_upb: received EOF from test runner " |
||||||
|
"after %d tests, exiting\n", test_count); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,433 @@ |
|||||||
|
--[[ |
||||||
|
|
||||||
|
Code to generate a C API in: |
||||||
|
foo.proto -> foo.upb.h |
||||||
|
foo.upb.c |
||||||
|
|
||||||
|
This code is evolving very quickly and so there are lots of little things |
||||||
|
that aren't perfect right now. As it settles a little more, the code |
||||||
|
quality should improve. |
||||||
|
|
||||||
|
--]] |
||||||
|
|
||||||
|
local upb = require "upb" |
||||||
|
local dump_cinit = require "dump_cinit" |
||||||
|
local export = {} |
||||||
|
|
||||||
|
local typemap = { |
||||||
|
[upb.TYPE_BOOL] = "bool", |
||||||
|
[upb.TYPE_FLOAT] = "float", |
||||||
|
[upb.TYPE_INT32] = "int32_t", |
||||||
|
[upb.TYPE_UINT32] = "uint32_t", |
||||||
|
[upb.TYPE_DOUBLE] = "double", |
||||||
|
[upb.TYPE_INT64] = "int64_t", |
||||||
|
[upb.TYPE_UINT64] = "uint64_t", |
||||||
|
[upb.TYPE_STRING] = "upb_stringview", |
||||||
|
[upb.TYPE_BYTES] = "upb_stringview", |
||||||
|
} |
||||||
|
|
||||||
|
function strip_proto(filename) |
||||||
|
return string.gsub(filename, '%.proto$','') |
||||||
|
end |
||||||
|
|
||||||
|
local function join(...) |
||||||
|
return table.concat({...}, ".") |
||||||
|
end |
||||||
|
|
||||||
|
local function to_cident(...) |
||||||
|
return string.gsub(join(...), "[%./]", "_") |
||||||
|
end |
||||||
|
|
||||||
|
local function to_preproc(...) |
||||||
|
return string.upper(to_cident(...)) |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
-- Strips away last path element, ie: |
||||||
|
-- foo.Bar.Baz -> foo.Bar |
||||||
|
local function remove_name(name) |
||||||
|
local package_end = 0 |
||||||
|
for i=1,string.len(name) do |
||||||
|
if string.byte(name, i) == string.byte(".", 1) then |
||||||
|
package_end = i - 1 |
||||||
|
end |
||||||
|
end |
||||||
|
return string.sub(name, 1, package_end) |
||||||
|
end |
||||||
|
|
||||||
|
local function dump_enum_vals(enumdef, append) |
||||||
|
local enum_vals = {} |
||||||
|
|
||||||
|
for k, v in enumdef:values() do |
||||||
|
enum_vals[#enum_vals + 1] = {k, v} |
||||||
|
end |
||||||
|
|
||||||
|
table.sort(enum_vals, function(a, b) return a[2] < b[2] end) |
||||||
|
|
||||||
|
-- protobuf convention is that enum values are scoped at the level of the |
||||||
|
-- enum itself, to follow C++. Ie, if you have the enum: |
||||||
|
-- message Foo { |
||||||
|
-- enum E { |
||||||
|
-- VAL1 = 1; |
||||||
|
-- VAL2 = 2; |
||||||
|
-- } |
||||||
|
-- } |
||||||
|
-- |
||||||
|
-- The name of VAL1 is Foo.VAL1, not Foo.E.VAL1. |
||||||
|
-- |
||||||
|
-- This seems a bit sketchy, but people often name their enum values |
||||||
|
-- accordingly, ie: |
||||||
|
-- |
||||||
|
-- enum Foo { |
||||||
|
-- FOO_VAL1 = 1; |
||||||
|
-- FOO_VAL2 = 2; |
||||||
|
-- } |
||||||
|
-- |
||||||
|
-- So if we don't respect this also, we end up with constants that look like: |
||||||
|
-- |
||||||
|
-- GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_DOUBLE = 1 |
||||||
|
-- |
||||||
|
-- (notice the duplicated "TYPE"). |
||||||
|
local cident = to_cident(remove_name(enumdef:full_name())) |
||||||
|
for i, pair in ipairs(enum_vals) do |
||||||
|
k, v = pair[1], pair[2] |
||||||
|
append(' %s = %d', cident .. "_" .. k, v) |
||||||
|
if i == #enum_vals then |
||||||
|
append('\n') |
||||||
|
else |
||||||
|
append(',\n') |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
local function ctype(field) |
||||||
|
if field:label() == upb.LABEL_REPEATED then |
||||||
|
return "upb_array*" |
||||||
|
elseif field:type() == upb.TYPE_MESSAGE then |
||||||
|
if field:containing_type():file() == field:subdef():file() then |
||||||
|
return to_cident(field:subdef():full_name()) .. "*" |
||||||
|
else |
||||||
|
return "struct " .. to_cident(field:subdef():full_name()) .. "*" |
||||||
|
end |
||||||
|
elseif field:type() == upb.TYPE_ENUM then |
||||||
|
return to_cident(field:subdef():full_name()) |
||||||
|
else |
||||||
|
return typemap[field:type()] or "void*" |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
local function emit_file_warning(filedef, append) |
||||||
|
append('/* This file was generated by upbc (the upb compiler) from the input\n') |
||||||
|
append(' * file:\n') |
||||||
|
append(' *\n') |
||||||
|
append(' * %s\n', filedef:name()) |
||||||
|
append(' *\n') |
||||||
|
append(' * Do not edit -- your changes will be discarded when the file is\n') |
||||||
|
append(' * regenerated. */\n\n') |
||||||
|
end |
||||||
|
|
||||||
|
local function field_layout_rank(field) |
||||||
|
-- Order: |
||||||
|
-- 1, 2, 3. primitive fields (8, 4, 1 byte) |
||||||
|
-- 4. oneof fields |
||||||
|
-- 5. string fields |
||||||
|
-- 6. submessage fields |
||||||
|
-- 7. repeated fields |
||||||
|
-- |
||||||
|
-- This has the following nice properties: |
||||||
|
-- |
||||||
|
-- 1. padding alignment is (nearly) minimized. |
||||||
|
-- 2. fields that might have defaults (1-5) are segregated |
||||||
|
-- from fields that are always zero-initialized (6-7). |
||||||
|
local rank |
||||||
|
if field:containing_oneof() then |
||||||
|
rank = 4 |
||||||
|
elseif field:label() == upb.LABEL_REPEATED then |
||||||
|
rank = 7 |
||||||
|
elseif field:type() == upb.TYPE_MESSAGE then |
||||||
|
rank = 6 |
||||||
|
elseif field:type() == upb.TYPE_STRING or field:type() == upb.TYPE_BYTES then |
||||||
|
rank = 5 |
||||||
|
elseif field:type() == upb.TYPE_BOOL then |
||||||
|
rank = 3 |
||||||
|
elseif field:type() == upb.TYPE_FLOAT or |
||||||
|
field:type() == upb.TYPE_INT32 or |
||||||
|
field:type() == upb.TYPE_UINT32 then |
||||||
|
rank = 2 |
||||||
|
else |
||||||
|
rank = 1 |
||||||
|
end |
||||||
|
|
||||||
|
-- Break ties with field number. |
||||||
|
return (rank * 2^29) + field:number() |
||||||
|
end |
||||||
|
|
||||||
|
local function has_hasbit(field) |
||||||
|
if field:containing_type():file():syntax() == upb.SYNTAX_PROTO2 then |
||||||
|
return field:label() ~= upb.LABEL_REPEATED and not field:containing_oneof() |
||||||
|
else |
||||||
|
return false |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
local function write_h_file(filedef, append) |
||||||
|
emit_file_warning(filedef, append) |
||||||
|
local basename_preproc = to_preproc(filedef:name()) |
||||||
|
append('#ifndef %s_UPB_H_\n', basename_preproc) |
||||||
|
append('#define %s_UPB_H_\n\n', basename_preproc) |
||||||
|
|
||||||
|
append('#include "upb/msg.h"\n\n') |
||||||
|
|
||||||
|
append('UPB_BEGIN_EXTERN_C\n\n') |
||||||
|
|
||||||
|
for msg in filedef:defs(upb.DEF_MSG) do |
||||||
|
-- TODO(haberman): forward declare C++ type names so we can use |
||||||
|
-- UPB_DECLARE_TYPE(). |
||||||
|
local msgname = to_cident(msg:full_name()) |
||||||
|
append('struct %s;\n', msgname) |
||||||
|
append('typedef struct %s %s;\n', msgname, msgname) |
||||||
|
end |
||||||
|
|
||||||
|
append("/* Enums */\n\n") |
||||||
|
for _, def in ipairs(sorted_defs(filedef:defs(upb.DEF_ENUM))) do |
||||||
|
local cident = to_cident(def:full_name()) |
||||||
|
append('typedef enum {\n') |
||||||
|
dump_enum_vals(def, append) |
||||||
|
append('} %s;\n\n', cident) |
||||||
|
end |
||||||
|
|
||||||
|
for msg in filedef:defs(upb.DEF_MSG) do |
||||||
|
local msgname = to_cident(msg:full_name()) |
||||||
|
append('/* %s message definition. */\n', msgname) |
||||||
|
append('extern const upb_msglayout_msginit_v1 %s_msginit;\n', msgname) |
||||||
|
append('%s *%s_new(upb_env *env);\n', msgname, msgname) |
||||||
|
append('%s *%s_parsenew(upb_stringview buf, upb_env *env);\n', |
||||||
|
msgname, msgname) |
||||||
|
append('char *%s_serialize(%s *msg, upb_env *env, size_t *len);\n', |
||||||
|
msgname, msgname) |
||||||
|
append('void %s_free(%s *msg, upb_env *env);\n', msgname, msgname) |
||||||
|
append('\n') |
||||||
|
|
||||||
|
append('/* %s getters. */\n', msgname) |
||||||
|
local setters, get_setters = dump_cinit.str_appender() |
||||||
|
for field in msg:fields() do |
||||||
|
local fieldname = to_cident(field:name()) |
||||||
|
if field:type() == upb.TYPE_MESSAGE and |
||||||
|
field:subdef():file() ~= filedef then |
||||||
|
-- Forward declaration for message type declared in another file. |
||||||
|
append('struct %s;\n', to_cident(field:subdef():full_name())) |
||||||
|
end |
||||||
|
if field:label() == upb.LABEL_REPEATED then |
||||||
|
else |
||||||
|
local typename = ctype(field) |
||||||
|
append('%s %s_%s(const %s *msg);\n', |
||||||
|
typename, msgname, fieldname, msgname) |
||||||
|
setters('void %s_set_%s(%s *msg, %s value);\n', |
||||||
|
msgname, fieldname, msgname, typename) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
for oneof in msg:oneofs() do |
||||||
|
local fullname = to_cident(oneof:containing_type():full_name() .. "." .. oneof:name()) |
||||||
|
append('typedef enum {\n') |
||||||
|
for field in oneof:fields() do |
||||||
|
append(' %s = %d,\n', fullname .. "_" .. field:name(), field:number()) |
||||||
|
end |
||||||
|
append(' %s_NOT_SET = 0,\n', fullname) |
||||||
|
append('} %s_oneofcases;\n', fullname) |
||||||
|
append('%s_oneofcases %s_case(const %s *msg);\n', fullname, fullname, msgname) |
||||||
|
end |
||||||
|
|
||||||
|
append('\n') |
||||||
|
append('/* %s setters. */\n', msgname) |
||||||
|
append(get_setters()) |
||||||
|
|
||||||
|
append('\n') |
||||||
|
append('\n') |
||||||
|
end |
||||||
|
|
||||||
|
append('UPB_END_EXTERN_C') |
||||||
|
|
||||||
|
append('\n') |
||||||
|
append('\n') |
||||||
|
|
||||||
|
append('#endif /* %s_UPB_H_ */\n', basename_preproc) |
||||||
|
end |
||||||
|
|
||||||
|
local function write_c_file(filedef, hfilename, append) |
||||||
|
emit_file_warning(filedef, append) |
||||||
|
|
||||||
|
append('#include <stddef.h>\n') |
||||||
|
append('#include "upb/msg.h"\n') |
||||||
|
append('#include "upb/upb.h"\n') |
||||||
|
append('#include "%s"\n\n', hfilename) |
||||||
|
|
||||||
|
for dep in filedef:dependencies() do |
||||||
|
local outbase = strip_proto(dep:name()) |
||||||
|
append('#include "%s.upb.h"\n', outbase) |
||||||
|
end |
||||||
|
|
||||||
|
append('\n') |
||||||
|
|
||||||
|
for msg in filedef:defs(upb.DEF_MSG) do |
||||||
|
local msgname = to_cident(msg:full_name()) |
||||||
|
|
||||||
|
local fields_array_ref = "NULL" |
||||||
|
local submsgs_array_ref = "NULL" |
||||||
|
local field_count = 0 |
||||||
|
local submsg_count = 0 |
||||||
|
local submsg_set = {} |
||||||
|
local submsg_indexes = {} |
||||||
|
local hasbit_count = 0 |
||||||
|
local hasbit_indexes = {} |
||||||
|
-- TODO(haberman): oneofs |
||||||
|
|
||||||
|
-- Create a layout order for fields. We use this order for the struct and |
||||||
|
-- for offsets, but our list of fields we keep in field number order. |
||||||
|
local fields_layout_order = {} |
||||||
|
for field in msg:fields() do |
||||||
|
table.insert(fields_layout_order, field) |
||||||
|
end |
||||||
|
table.sort(fields_layout_order, function(a, b) |
||||||
|
return field_layout_rank(a) < field_layout_rank(b) |
||||||
|
end) |
||||||
|
|
||||||
|
-- Another sorted array in field number order. |
||||||
|
local fields_number_order = {} |
||||||
|
for field in msg:fields() do |
||||||
|
table.insert(fields_number_order, field) |
||||||
|
end |
||||||
|
table.sort(fields_number_order, function(a, b) |
||||||
|
return a:number() < b:number() |
||||||
|
end) |
||||||
|
|
||||||
|
append('struct %s {\n', msgname) |
||||||
|
for _, field in ipairs(fields_layout_order) do |
||||||
|
field_count = field_count + 1 |
||||||
|
|
||||||
|
if field:type() == upb.TYPE_MESSAGE then |
||||||
|
submsg_count = submsg_count + 1 |
||||||
|
submsg_set[field:subdef()] = true |
||||||
|
end |
||||||
|
|
||||||
|
if has_hasbit(field) then |
||||||
|
hasbit_indexes[field] = hasbit_count |
||||||
|
hasbit_count = hasbit_count + 1 |
||||||
|
end |
||||||
|
|
||||||
|
append(' %s %s;\n', ctype(field), field:name()) |
||||||
|
end |
||||||
|
append('};\n\n') |
||||||
|
|
||||||
|
if submsg_count > 0 then |
||||||
|
-- TODO(haberman): could save a little bit of space by only generating a |
||||||
|
-- "submsgs" array for every strongly-connected component. |
||||||
|
local submsgs_array_name = msgname .. "_submsgs" |
||||||
|
submsgs_array_ref = "&" .. submsgs_array_name .. "[0]" |
||||||
|
append('static const upb_msglayout_msginit_v1 *const %s[%s] = {\n', |
||||||
|
submsgs_array_name, submsg_count) |
||||||
|
|
||||||
|
-- Create a deterministically-sorted array of submessage entries. |
||||||
|
local submsg_array = {} |
||||||
|
for k, v in pairs(submsg_set) do |
||||||
|
table.insert(submsg_array, k) |
||||||
|
end |
||||||
|
table.sort(submsg_array, function(a, b) |
||||||
|
return a:full_name() < b:full_name() |
||||||
|
end) |
||||||
|
|
||||||
|
for i, submsg in ipairs(submsg_array) do |
||||||
|
append(' &%s_msginit,\n', to_cident(submsg:full_name())) |
||||||
|
submsg_indexes[submsg] = i - 1 |
||||||
|
end |
||||||
|
|
||||||
|
append('};\n\n') |
||||||
|
end |
||||||
|
|
||||||
|
if field_count > 0 then |
||||||
|
local fields_array_name = msgname .. "__fields" |
||||||
|
fields_array_ref = "&" .. fields_array_name .. "[0]" |
||||||
|
append('static const upb_msglayout_fieldinit_v1 %s[%s] = {\n', |
||||||
|
fields_array_name, field_count) |
||||||
|
for _, field in ipairs(fields_number_order) do |
||||||
|
local submsg_index = "-1" |
||||||
|
local oneof_index = "UPB_NOT_IN_ONEOF" |
||||||
|
if field:type() == upb.TYPE_MESSAGE then |
||||||
|
submsg_index = submsg_indexes[field:subdef()] |
||||||
|
end |
||||||
|
-- TODO(haberman): oneofs. |
||||||
|
append(' {%s, offsetof(%s, %s), %s, %s, %s, %s, %s},\n', |
||||||
|
field:number(), |
||||||
|
msgname, |
||||||
|
field:name(), |
||||||
|
hasbit_indexes[field] or "-1", |
||||||
|
oneof_index, |
||||||
|
submsg_index, |
||||||
|
field:descriptor_type(), |
||||||
|
field:label()) |
||||||
|
end |
||||||
|
append('};\n\n') |
||||||
|
end |
||||||
|
|
||||||
|
append('const upb_msglayout_msginit_v1 %s_msginit = {\n', msgname) |
||||||
|
append(' %s,\n', submsgs_array_ref) |
||||||
|
append(' %s,\n', fields_array_ref) |
||||||
|
append(' NULL, /* TODO. oneofs */\n') |
||||||
|
append(' NULL, /* TODO. default_msg */\n') |
||||||
|
append(' UPB_ALIGNED_SIZEOF(%s), %s, %s, %s, %s\n', |
||||||
|
msgname, field_count, |
||||||
|
0, -- TODO: oneof_count |
||||||
|
'false', -- TODO: extendable |
||||||
|
'true' -- TODO: is_proto2 |
||||||
|
) |
||||||
|
append('};\n\n') |
||||||
|
|
||||||
|
append('%s *%s_new(upb_env *env) {\n', msgname, msgname) |
||||||
|
append(' %s *msg = upb_env_malloc(env, sizeof(*msg));\n', |
||||||
|
msgname) |
||||||
|
append(' memset(msg, 0, sizeof(*msg)); /* TODO: defaults */\n') |
||||||
|
append(' return msg;\n') |
||||||
|
append('}\n') |
||||||
|
|
||||||
|
append('%s *%s_parsenew(upb_stringview buf, upb_env *env) {\n', |
||||||
|
msgname, msgname) |
||||||
|
append(' UPB_UNUSED(buf);\n') |
||||||
|
append(' UPB_UNUSED(env);\n') |
||||||
|
append(' return NULL;\n') |
||||||
|
append('}\n') |
||||||
|
|
||||||
|
append('char *%s_serialize(%s *msg, upb_env *env, size_t *size) {\n', |
||||||
|
msgname, msgname) |
||||||
|
append(' UPB_UNUSED(msg);\n') |
||||||
|
append(' UPB_UNUSED(env);\n') |
||||||
|
append(' UPB_UNUSED(size);\n') |
||||||
|
append(' return NULL; /* TODO. */\n') |
||||||
|
append('}\n') |
||||||
|
|
||||||
|
for field in msg:fields() do |
||||||
|
local typename = ctype(field) |
||||||
|
append('%s %s_%s(const %s *msg) {\n', |
||||||
|
typename, msgname, field:name(), msgname); |
||||||
|
append(' return msg->%s;\n', field:name()) |
||||||
|
append('}\n') |
||||||
|
append('void %s_set_%s(%s *msg, %s value) {\n', |
||||||
|
msgname, field:name(), msgname, typename); |
||||||
|
append(' msg->%s = value;\n', field:name()) |
||||||
|
append('}\n') |
||||||
|
end |
||||||
|
|
||||||
|
for oneof in msg:oneofs() do |
||||||
|
local fullname = to_cident(oneof:containing_type():full_name() .. "." .. oneof:name()) |
||||||
|
append('%s_oneofcases %s_case(const %s *msg) {\n', fullname, fullname, msgname) |
||||||
|
append(' return 0; /* TODO. */') |
||||||
|
append('}') |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
function export.write_gencode(filedef, hfilename, append_h, append_c) |
||||||
|
write_h_file(filedef, append_h) |
||||||
|
write_c_file(filedef, hfilename, append_c) |
||||||
|
end |
||||||
|
|
||||||
|
return export |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,527 @@ |
|||||||
|
/* This file was generated by upbc (the upb compiler) from the input
|
||||||
|
* file: |
||||||
|
* |
||||||
|
* upb/descriptor/descriptor.proto |
||||||
|
* |
||||||
|
* Do not edit -- your changes will be discarded when the file is |
||||||
|
* regenerated. */ |
||||||
|
|
||||||
|
#ifndef UPB_DESCRIPTOR_DESCRIPTOR_PROTO_UPB_H_ |
||||||
|
#define UPB_DESCRIPTOR_DESCRIPTOR_PROTO_UPB_H_ |
||||||
|
|
||||||
|
#include "upb/msg.h" |
||||||
|
|
||||||
|
UPB_BEGIN_EXTERN_C |
||||||
|
|
||||||
|
struct google_protobuf_FileDescriptorSet; |
||||||
|
typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet; |
||||||
|
struct google_protobuf_FileDescriptorProto; |
||||||
|
typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto; |
||||||
|
struct google_protobuf_DescriptorProto; |
||||||
|
typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto; |
||||||
|
struct google_protobuf_DescriptorProto_ExtensionRange; |
||||||
|
typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; |
||||||
|
struct google_protobuf_DescriptorProto_ReservedRange; |
||||||
|
typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; |
||||||
|
struct google_protobuf_FieldDescriptorProto; |
||||||
|
typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; |
||||||
|
struct google_protobuf_OneofDescriptorProto; |
||||||
|
typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; |
||||||
|
struct google_protobuf_EnumDescriptorProto; |
||||||
|
typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; |
||||||
|
struct google_protobuf_EnumValueDescriptorProto; |
||||||
|
typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; |
||||||
|
struct google_protobuf_ServiceDescriptorProto; |
||||||
|
typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto; |
||||||
|
struct google_protobuf_MethodDescriptorProto; |
||||||
|
typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto; |
||||||
|
struct google_protobuf_FileOptions; |
||||||
|
typedef struct google_protobuf_FileOptions google_protobuf_FileOptions; |
||||||
|
struct google_protobuf_MessageOptions; |
||||||
|
typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; |
||||||
|
struct google_protobuf_FieldOptions; |
||||||
|
typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; |
||||||
|
struct google_protobuf_EnumOptions; |
||||||
|
typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; |
||||||
|
struct google_protobuf_EnumValueOptions; |
||||||
|
typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions; |
||||||
|
struct google_protobuf_ServiceOptions; |
||||||
|
typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions; |
||||||
|
struct google_protobuf_MethodOptions; |
||||||
|
typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions; |
||||||
|
struct google_protobuf_UninterpretedOption; |
||||||
|
typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption; |
||||||
|
struct google_protobuf_UninterpretedOption_NamePart; |
||||||
|
typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart; |
||||||
|
struct google_protobuf_SourceCodeInfo; |
||||||
|
typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; |
||||||
|
struct google_protobuf_SourceCodeInfo_Location; |
||||||
|
typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; |
||||||
|
/* Enums */ |
||||||
|
|
||||||
|
typedef enum { |
||||||
|
google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, |
||||||
|
google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, |
||||||
|
google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 |
||||||
|
} google_protobuf_FieldDescriptorProto_Label; |
||||||
|
|
||||||
|
typedef enum { |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, |
||||||
|
google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 |
||||||
|
} google_protobuf_FieldDescriptorProto_Type; |
||||||
|
|
||||||
|
typedef enum { |
||||||
|
google_protobuf_FieldOptions_STRING = 0, |
||||||
|
google_protobuf_FieldOptions_CORD = 1, |
||||||
|
google_protobuf_FieldOptions_STRING_PIECE = 2 |
||||||
|
} google_protobuf_FieldOptions_CType; |
||||||
|
|
||||||
|
typedef enum { |
||||||
|
google_protobuf_FieldOptions_JS_NORMAL = 0, |
||||||
|
google_protobuf_FieldOptions_JS_STRING = 1, |
||||||
|
google_protobuf_FieldOptions_JS_NUMBER = 2 |
||||||
|
} google_protobuf_FieldOptions_JSType; |
||||||
|
|
||||||
|
typedef enum { |
||||||
|
google_protobuf_FileOptions_SPEED = 1, |
||||||
|
google_protobuf_FileOptions_CODE_SIZE = 2, |
||||||
|
google_protobuf_FileOptions_LITE_RUNTIME = 3 |
||||||
|
} google_protobuf_FileOptions_OptimizeMode; |
||||||
|
|
||||||
|
/* google_protobuf_FileDescriptorSet message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorSet_msginit; |
||||||
|
google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_env *env); |
||||||
|
google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_FileDescriptorSet_serialize(google_protobuf_FileDescriptorSet *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_FileDescriptorSet_free(google_protobuf_FileDescriptorSet *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_FileDescriptorSet getters. */ |
||||||
|
|
||||||
|
/* google_protobuf_FileDescriptorSet setters. */ |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_FileDescriptorProto message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorProto_msginit; |
||||||
|
google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_env *env); |
||||||
|
google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_FileDescriptorProto_serialize(google_protobuf_FileDescriptorProto *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_FileDescriptorProto_free(google_protobuf_FileDescriptorProto *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_FileDescriptorProto getters. */ |
||||||
|
upb_stringview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg); |
||||||
|
upb_stringview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg); |
||||||
|
google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg); |
||||||
|
google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg); |
||||||
|
upb_stringview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg); |
||||||
|
|
||||||
|
/* google_protobuf_FileDescriptorProto setters. */ |
||||||
|
void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value); |
||||||
|
void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value); |
||||||
|
void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_stringview value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_DescriptorProto message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_msginit; |
||||||
|
google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_env *env); |
||||||
|
google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_DescriptorProto_serialize(google_protobuf_DescriptorProto *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_DescriptorProto_free(google_protobuf_DescriptorProto *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_DescriptorProto getters. */ |
||||||
|
upb_stringview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg); |
||||||
|
google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg); |
||||||
|
|
||||||
|
/* google_protobuf_DescriptorProto setters. */ |
||||||
|
void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_DescriptorProto_ExtensionRange message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ExtensionRange_msginit; |
||||||
|
google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_env *env); |
||||||
|
google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_DescriptorProto_ExtensionRange_serialize(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_DescriptorProto_ExtensionRange_free(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_DescriptorProto_ExtensionRange getters. */ |
||||||
|
int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg); |
||||||
|
int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg); |
||||||
|
|
||||||
|
/* google_protobuf_DescriptorProto_ExtensionRange setters. */ |
||||||
|
void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value); |
||||||
|
void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_DescriptorProto_ReservedRange message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ReservedRange_msginit; |
||||||
|
google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_env *env); |
||||||
|
google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_DescriptorProto_ReservedRange_serialize(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_DescriptorProto_ReservedRange_free(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_DescriptorProto_ReservedRange getters. */ |
||||||
|
int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg); |
||||||
|
int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg); |
||||||
|
|
||||||
|
/* google_protobuf_DescriptorProto_ReservedRange setters. */ |
||||||
|
void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value); |
||||||
|
void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_FieldDescriptorProto message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_FieldDescriptorProto_msginit; |
||||||
|
google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_env *env); |
||||||
|
google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_FieldDescriptorProto_serialize(google_protobuf_FieldDescriptorProto *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_FieldDescriptorProto_free(google_protobuf_FieldDescriptorProto *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_FieldDescriptorProto getters. */ |
||||||
|
upb_stringview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
upb_stringview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
google_protobuf_FieldDescriptorProto_Label google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
google_protobuf_FieldDescriptorProto_Type google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
upb_stringview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
upb_stringview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
upb_stringview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg); |
||||||
|
|
||||||
|
/* google_protobuf_FieldDescriptorProto setters. */ |
||||||
|
void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value); |
||||||
|
void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Label value); |
||||||
|
void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Type value); |
||||||
|
void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value); |
||||||
|
void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value); |
||||||
|
void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_OneofDescriptorProto message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_OneofDescriptorProto_msginit; |
||||||
|
google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_env *env); |
||||||
|
google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_OneofDescriptorProto_serialize(google_protobuf_OneofDescriptorProto *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_OneofDescriptorProto_free(google_protobuf_OneofDescriptorProto *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_OneofDescriptorProto getters. */ |
||||||
|
upb_stringview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg); |
||||||
|
|
||||||
|
/* google_protobuf_OneofDescriptorProto setters. */ |
||||||
|
void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_stringview value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_EnumDescriptorProto message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_msginit; |
||||||
|
google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_env *env); |
||||||
|
google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_EnumDescriptorProto_serialize(google_protobuf_EnumDescriptorProto *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_EnumDescriptorProto_free(google_protobuf_EnumDescriptorProto *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_EnumDescriptorProto getters. */ |
||||||
|
upb_stringview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg); |
||||||
|
google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg); |
||||||
|
|
||||||
|
/* google_protobuf_EnumDescriptorProto setters. */ |
||||||
|
void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_EnumValueDescriptorProto message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_EnumValueDescriptorProto_msginit; |
||||||
|
google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_env *env); |
||||||
|
google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_EnumValueDescriptorProto_serialize(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_EnumValueDescriptorProto_free(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_EnumValueDescriptorProto getters. */ |
||||||
|
upb_stringview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg); |
||||||
|
int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg); |
||||||
|
google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg); |
||||||
|
|
||||||
|
/* google_protobuf_EnumValueDescriptorProto setters. */ |
||||||
|
void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value); |
||||||
|
void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_ServiceDescriptorProto message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_ServiceDescriptorProto_msginit; |
||||||
|
google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_env *env); |
||||||
|
google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_ServiceDescriptorProto_serialize(google_protobuf_ServiceDescriptorProto *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_ServiceDescriptorProto_free(google_protobuf_ServiceDescriptorProto *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_ServiceDescriptorProto getters. */ |
||||||
|
upb_stringview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg); |
||||||
|
google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg); |
||||||
|
|
||||||
|
/* google_protobuf_ServiceDescriptorProto setters. */ |
||||||
|
void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_MethodDescriptorProto message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_MethodDescriptorProto_msginit; |
||||||
|
google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_env *env); |
||||||
|
google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_MethodDescriptorProto_serialize(google_protobuf_MethodDescriptorProto *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_MethodDescriptorProto_free(google_protobuf_MethodDescriptorProto *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_MethodDescriptorProto getters. */ |
||||||
|
upb_stringview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg); |
||||||
|
upb_stringview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg); |
||||||
|
upb_stringview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg); |
||||||
|
google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg); |
||||||
|
bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg); |
||||||
|
bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg); |
||||||
|
|
||||||
|
/* google_protobuf_MethodDescriptorProto setters. */ |
||||||
|
void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value); |
||||||
|
void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value); |
||||||
|
void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value); |
||||||
|
void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_FileOptions message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_FileOptions_msginit; |
||||||
|
google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_env *env); |
||||||
|
google_protobuf_FileOptions *google_protobuf_FileOptions_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_FileOptions_serialize(google_protobuf_FileOptions *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_FileOptions_free(google_protobuf_FileOptions *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_FileOptions getters. */ |
||||||
|
upb_stringview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg); |
||||||
|
upb_stringview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg); |
||||||
|
google_protobuf_FileOptions_OptimizeMode google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg); |
||||||
|
bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg); |
||||||
|
upb_stringview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg); |
||||||
|
bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg); |
||||||
|
bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg); |
||||||
|
bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg); |
||||||
|
bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg); |
||||||
|
bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg); |
||||||
|
bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg); |
||||||
|
bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg); |
||||||
|
upb_stringview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg); |
||||||
|
upb_stringview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg); |
||||||
|
bool google_protobuf_FileOptions_javanano_use_deprecated_package(const google_protobuf_FileOptions *msg); |
||||||
|
upb_stringview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg); |
||||||
|
upb_stringview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg); |
||||||
|
|
||||||
|
/* google_protobuf_FileOptions setters. */ |
||||||
|
void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_stringview value); |
||||||
|
void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_stringview value); |
||||||
|
void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, google_protobuf_FileOptions_OptimizeMode value); |
||||||
|
void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value); |
||||||
|
void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_stringview value); |
||||||
|
void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value); |
||||||
|
void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value); |
||||||
|
void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value); |
||||||
|
void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value); |
||||||
|
void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value); |
||||||
|
void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value); |
||||||
|
void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value); |
||||||
|
void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value); |
||||||
|
void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_stringview value); |
||||||
|
void google_protobuf_FileOptions_set_javanano_use_deprecated_package(google_protobuf_FileOptions *msg, bool value); |
||||||
|
void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value); |
||||||
|
void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_stringview value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_MessageOptions message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_MessageOptions_msginit; |
||||||
|
google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_env *env); |
||||||
|
google_protobuf_MessageOptions *google_protobuf_MessageOptions_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_MessageOptions_serialize(google_protobuf_MessageOptions *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_MessageOptions_free(google_protobuf_MessageOptions *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_MessageOptions getters. */ |
||||||
|
bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg); |
||||||
|
bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg); |
||||||
|
bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg); |
||||||
|
bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg); |
||||||
|
|
||||||
|
/* google_protobuf_MessageOptions setters. */ |
||||||
|
void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value); |
||||||
|
void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value); |
||||||
|
void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value); |
||||||
|
void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_FieldOptions message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_FieldOptions_msginit; |
||||||
|
google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_env *env); |
||||||
|
google_protobuf_FieldOptions *google_protobuf_FieldOptions_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_FieldOptions_serialize(google_protobuf_FieldOptions *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_FieldOptions_free(google_protobuf_FieldOptions *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_FieldOptions getters. */ |
||||||
|
google_protobuf_FieldOptions_CType google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg); |
||||||
|
bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg); |
||||||
|
bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg); |
||||||
|
bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg); |
||||||
|
google_protobuf_FieldOptions_JSType google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg); |
||||||
|
bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg); |
||||||
|
|
||||||
|
/* google_protobuf_FieldOptions setters. */ |
||||||
|
void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_CType value); |
||||||
|
void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value); |
||||||
|
void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value); |
||||||
|
void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value); |
||||||
|
void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_JSType value); |
||||||
|
void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_EnumOptions message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_EnumOptions_msginit; |
||||||
|
google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_env *env); |
||||||
|
google_protobuf_EnumOptions *google_protobuf_EnumOptions_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_EnumOptions_serialize(google_protobuf_EnumOptions *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_EnumOptions_free(google_protobuf_EnumOptions *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_EnumOptions getters. */ |
||||||
|
bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg); |
||||||
|
bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg); |
||||||
|
|
||||||
|
/* google_protobuf_EnumOptions setters. */ |
||||||
|
void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value); |
||||||
|
void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_EnumValueOptions message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_EnumValueOptions_msginit; |
||||||
|
google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_env *env); |
||||||
|
google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_EnumValueOptions_serialize(google_protobuf_EnumValueOptions *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_EnumValueOptions_free(google_protobuf_EnumValueOptions *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_EnumValueOptions getters. */ |
||||||
|
bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg); |
||||||
|
|
||||||
|
/* google_protobuf_EnumValueOptions setters. */ |
||||||
|
void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_ServiceOptions message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_ServiceOptions_msginit; |
||||||
|
google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_env *env); |
||||||
|
google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_ServiceOptions_serialize(google_protobuf_ServiceOptions *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_ServiceOptions_free(google_protobuf_ServiceOptions *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_ServiceOptions getters. */ |
||||||
|
bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg); |
||||||
|
|
||||||
|
/* google_protobuf_ServiceOptions setters. */ |
||||||
|
void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_MethodOptions message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_MethodOptions_msginit; |
||||||
|
google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_env *env); |
||||||
|
google_protobuf_MethodOptions *google_protobuf_MethodOptions_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_MethodOptions_serialize(google_protobuf_MethodOptions *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_MethodOptions_free(google_protobuf_MethodOptions *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_MethodOptions getters. */ |
||||||
|
bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg); |
||||||
|
|
||||||
|
/* google_protobuf_MethodOptions setters. */ |
||||||
|
void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_UninterpretedOption message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_msginit; |
||||||
|
google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_env *env); |
||||||
|
google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_UninterpretedOption_serialize(google_protobuf_UninterpretedOption *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_UninterpretedOption_free(google_protobuf_UninterpretedOption *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_UninterpretedOption getters. */ |
||||||
|
upb_stringview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg); |
||||||
|
uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg); |
||||||
|
int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg); |
||||||
|
double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg); |
||||||
|
upb_stringview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg); |
||||||
|
upb_stringview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg); |
||||||
|
|
||||||
|
/* google_protobuf_UninterpretedOption setters. */ |
||||||
|
void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_stringview value); |
||||||
|
void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value); |
||||||
|
void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value); |
||||||
|
void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value); |
||||||
|
void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_stringview value); |
||||||
|
void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_stringview value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_UninterpretedOption_NamePart message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_NamePart_msginit; |
||||||
|
google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_env *env); |
||||||
|
google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_UninterpretedOption_NamePart_serialize(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_UninterpretedOption_NamePart_free(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_UninterpretedOption_NamePart getters. */ |
||||||
|
upb_stringview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg); |
||||||
|
bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg); |
||||||
|
|
||||||
|
/* google_protobuf_UninterpretedOption_NamePart setters. */ |
||||||
|
void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_stringview value); |
||||||
|
void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value); |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_SourceCodeInfo message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_msginit; |
||||||
|
google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_env *env); |
||||||
|
google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_SourceCodeInfo_serialize(google_protobuf_SourceCodeInfo *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_SourceCodeInfo_free(google_protobuf_SourceCodeInfo *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_SourceCodeInfo getters. */ |
||||||
|
|
||||||
|
/* google_protobuf_SourceCodeInfo setters. */ |
||||||
|
|
||||||
|
|
||||||
|
/* google_protobuf_SourceCodeInfo_Location message definition. */ |
||||||
|
extern const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_Location_msginit; |
||||||
|
google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_env *env); |
||||||
|
google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parsenew(upb_stringview buf, upb_env *env); |
||||||
|
char *google_protobuf_SourceCodeInfo_Location_serialize(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env, size_t *len); |
||||||
|
void google_protobuf_SourceCodeInfo_Location_free(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env); |
||||||
|
|
||||||
|
/* google_protobuf_SourceCodeInfo_Location getters. */ |
||||||
|
upb_stringview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg); |
||||||
|
upb_stringview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg); |
||||||
|
|
||||||
|
/* google_protobuf_SourceCodeInfo_Location setters. */ |
||||||
|
void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value); |
||||||
|
void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value); |
||||||
|
|
||||||
|
|
||||||
|
UPB_END_EXTERN_C |
||||||
|
|
||||||
|
#endif /* UPB_DESCRIPTOR_DESCRIPTOR_PROTO_UPB_H_ */ |
Loading…
Reference in new issue