parent
b2a388212a
commit
b79fd65a83
28 changed files with 434 additions and 7126 deletions
@ -1,725 +0,0 @@ |
||||
--[[ |
||||
|
||||
Routines for dumping internal data structures into C initializers |
||||
that can be compiled into a .o file. |
||||
|
||||
--]] |
||||
|
||||
local upbtable = require "upb.table" |
||||
local upb = require "upb" |
||||
local export = {} |
||||
|
||||
-- A tiny little abstraction that decouples the dump_* functions from |
||||
-- what they're writing to (appending to a string, writing to file I/O, etc). |
||||
-- This could possibly matter since naive string building is O(n^2) in the |
||||
-- number of appends. |
||||
function export.str_appender() |
||||
local str = "" |
||||
local function append(fmt, ...) |
||||
str = str .. string.format(fmt, ...) |
||||
end |
||||
local function get() |
||||
return str |
||||
end |
||||
return append, get |
||||
end |
||||
|
||||
function export.file_appender(file) |
||||
local f = file |
||||
local function append(fmt, ...) |
||||
f:write(string.format(fmt, ...)) |
||||
end |
||||
return append |
||||
end |
||||
|
||||
function handler_types(base) |
||||
local ret = {} |
||||
for k, _ in pairs(base) do |
||||
if string.find(k, "^" .. "HANDLER_") then |
||||
ret[#ret + 1] = k |
||||
end |
||||
end |
||||
return ret |
||||
end |
||||
|
||||
function octchar(num) |
||||
assert(num < 8) |
||||
local idx = num + 1 -- 1-based index |
||||
return string.sub("01234567", idx, idx) |
||||
end |
||||
|
||||
function c_escape(num) |
||||
assert(num < 256) |
||||
return string.format("\\%s%s%s", |
||||
octchar(math.floor(num / 64)), |
||||
octchar(math.floor(num / 8) % 8), |
||||
octchar(num % 8)); |
||||
end |
||||
|
||||
-- const(f, label) -> UPB_LABEL_REPEATED, where f:label() == upb.LABEL_REPEATED |
||||
function const(obj, name, base) |
||||
local val = obj[name] |
||||
base = base or upb |
||||
|
||||
-- Support both f:label() and f.label. |
||||
if type(val) == "function" then |
||||
val = val(obj) |
||||
end |
||||
|
||||
for k, v in pairs(base) do |
||||
if v == val and string.find(k, "^" .. string.upper(name)) then |
||||
return "UPB_" .. k |
||||
end |
||||
end |
||||
assert(false, "Couldn't find UPB_" .. string.upper(name) .. |
||||
" constant for value: " .. val) |
||||
end |
||||
|
||||
function sortedkeys(tab) |
||||
arr = {} |
||||
for key in pairs(tab) do |
||||
arr[#arr + 1] = key |
||||
end |
||||
table.sort(arr) |
||||
return arr |
||||
end |
||||
|
||||
function sorted_defs(defs) |
||||
local sorted = {} |
||||
|
||||
for def in defs do |
||||
if def.type == deftype then |
||||
sorted[#sorted + 1] = def |
||||
end |
||||
end |
||||
|
||||
table.sort(sorted, |
||||
function(a, b) return a:full_name() < b:full_name() end) |
||||
|
||||
return sorted |
||||
end |
||||
|
||||
function constlist(pattern) |
||||
local ret = {} |
||||
for k, v in pairs(upb) do |
||||
if string.find(k, "^" .. pattern) then |
||||
ret[k] = v |
||||
end |
||||
end |
||||
return ret |
||||
end |
||||
|
||||
function boolstr(val) |
||||
if val == true then |
||||
return "true" |
||||
elseif val == false then |
||||
return "false" |
||||
else |
||||
assert(false, "Bad bool value: " .. tostring(val)) |
||||
end |
||||
end |
||||
|
||||
--[[ |
||||
|
||||
LinkTable: an object that tracks all linkable objects and their offsets to |
||||
facilitate linking. |
||||
|
||||
--]] |
||||
|
||||
local LinkTable = {} |
||||
function LinkTable:new(types) |
||||
local linktab = { |
||||
types = types, |
||||
table = {}, -- ptr -> {type, 0-based offset} |
||||
obj_arrays = {} -- Establishes the ordering for each object type |
||||
} |
||||
for type, _ in pairs(types) do |
||||
linktab.obj_arrays[type] = {} |
||||
end |
||||
setmetatable(linktab, {__index = LinkTable}) -- Inheritance |
||||
return linktab |
||||
end |
||||
|
||||
-- Adds a new object to the sequence of objects of this type. |
||||
function LinkTable:add(objtype, ptr, obj) |
||||
obj = obj or ptr |
||||
assert(self.table[obj] == nil) |
||||
assert(self.types[objtype]) |
||||
local arr = self.obj_arrays[objtype] |
||||
self.table[ptr] = {objtype, #arr} |
||||
arr[#arr + 1] = obj |
||||
end |
||||
|
||||
-- Returns a C symbol name for the given objtype and offset. |
||||
function LinkTable:csym(objtype, offset) |
||||
local typestr = assert(self.types[objtype]) |
||||
return string.format("%s[%d]", typestr, offset) |
||||
end |
||||
|
||||
-- Returns the address of the given C object. |
||||
function LinkTable:addr(obj) |
||||
if obj == upbtable.NULL then |
||||
return "NULL" |
||||
else |
||||
local tabent = assert(self.table[obj], "unknown object: " .. tostring(obj)) |
||||
return "&" .. self:csym(tabent[1], tabent[2]) |
||||
end |
||||
end |
||||
|
||||
-- Returns an array declarator indicating how many objects have been added. |
||||
function LinkTable:cdecl(objtype) |
||||
return self:csym(objtype, #self.obj_arrays[objtype]) |
||||
end |
||||
|
||||
function LinkTable:objs(objtype) |
||||
-- Return iterator function, allowing use as: |
||||
-- for obj in linktable:objs(type) do |
||||
-- -- ... |
||||
-- done |
||||
local array = self.obj_arrays[objtype] |
||||
local i = 0 |
||||
return function() |
||||
i = i + 1 |
||||
if array[i] then return array[i] end |
||||
end |
||||
end |
||||
|
||||
function LinkTable:empty(objtype) |
||||
return #self.obj_arrays[objtype] == 0 |
||||
end |
||||
|
||||
--[[ |
||||
|
||||
Dumper: an object that can dump C initializers for several constructs. |
||||
Uses a LinkTable to resolve references when necessary. |
||||
|
||||
--]] |
||||
|
||||
local Dumper = {} |
||||
function Dumper:new(linktab) |
||||
local obj = {linktab = linktab} |
||||
setmetatable(obj, {__index = Dumper}) -- Inheritance |
||||
return obj |
||||
end |
||||
|
||||
-- Dumps a upb_tabval, eg: |
||||
-- UPB_TABVALUE_INIT(5) |
||||
function Dumper:_value(val, upbtype) |
||||
if type(val) == "nil" then |
||||
return "UPB_TABVALUE_EMPTY_INIT" |
||||
elseif type(val) == "number" then |
||||
-- Use upbtype to disambiguate what kind of number it is. |
||||
if upbtype == upbtable.CTYPE_INT32 then |
||||
return string.format("UPB_TABVALUE_INT_INIT(%d)", val) |
||||
else |
||||
-- TODO(haberman): add support for these so we can properly support |
||||
-- default values. |
||||
error("Unsupported number type " .. upbtype) |
||||
end |
||||
elseif type(val) == "string" then |
||||
return string.format('UPB_TABVALUE_PTR_INIT("%s")', val) |
||||
else |
||||
-- We take this as an object reference that has an entry in the link table. |
||||
return string.format("UPB_TABVALUE_PTR_INIT(%s)", self.linktab:addr(val)) |
||||
end |
||||
end |
||||
|
||||
-- Dumps a table key. |
||||
function Dumper:tabkey(key) |
||||
if type(key) == "nil" then |
||||
return "UPB_TABKEY_NONE" |
||||
elseif type(key) == "string" then |
||||
local len = #key |
||||
local len1 = c_escape(len % 256) |
||||
local len2 = c_escape(math.floor(len / 256) % 256) |
||||
local len3 = c_escape(math.floor(len / (256 * 256)) % 256) |
||||
local len4 = c_escape(math.floor(len / (256 * 256 * 256)) % 256) |
||||
return string.format('UPB_TABKEY_STR("%s", "%s", "%s", "%s", "%s")', |
||||
len1, len2, len3, len4, key) |
||||
else |
||||
return string.format("UPB_TABKEY_NUM(%d)", key) |
||||
end |
||||
end |
||||
|
||||
-- Dumps a table entry. |
||||
function Dumper:tabent(ent) |
||||
local key = self:tabkey(ent.key) |
||||
local val = self:_value(ent.value, ent.valtype) |
||||
local next = self.linktab:addr(ent.next) |
||||
return string.format(' {%s, %s, %s},\n', key, val, next) |
||||
end |
||||
|
||||
-- Dumps an inttable array entry. This is almost the same as value() above, |
||||
-- except that nil values have a special value to indicate "empty". |
||||
function Dumper:arrayval(val) |
||||
if val.val then |
||||
return string.format(" %s,\n", self:_value(val.val, val.valtype)) |
||||
else |
||||
return " UPB_TABVALUE_EMPTY_INIT,\n" |
||||
end |
||||
end |
||||
|
||||
-- Dumps an initializer for the given strtable/inttable (respectively). Its |
||||
-- entries must have previously been added to the linktable. |
||||
function Dumper:strtable(t) |
||||
-- UPB_STRTABLE_INIT(count, mask, type, size_lg2, entries) |
||||
return string.format( |
||||
"UPB_STRTABLE_INIT(%d, %d, %s, %d, %s)", |
||||
t.count, t.mask, const(t, "ctype", upbtable) , t.size_lg2, |
||||
self.linktab:addr(t.entries[1].ptr)) |
||||
end |
||||
|
||||
function Dumper:inttable(t) |
||||
local lt = assert(self.linktab) |
||||
-- UPB_INTTABLE_INIT(count, mask, type, size_lg2, ent, a, asize, acount) |
||||
local entries = "NULL" |
||||
if #t.entries > 0 then |
||||
entries = lt:addr(t.entries[1].ptr) |
||||
end |
||||
return string.format( |
||||
"UPB_INTTABLE_INIT(%d, %d, %s, %d, %s, %s, %d, %d)", |
||||
t.count, t.mask, const(t, "ctype", upbtable), t.size_lg2, entries, |
||||
lt:addr(t.array[1].ptr), t.array_size, t.array_count) |
||||
end |
||||
|
||||
-- A visitor for visiting all tables of a def. Used first to count entries |
||||
-- and later to dump them. |
||||
local function gettables(def) |
||||
if def:def_type() == upb.DEF_MSG then |
||||
return {int = upbtable.msgdef_itof(def), str = upbtable.msgdef_ntof(def)} |
||||
elseif def:def_type() == upb.DEF_ENUM then |
||||
return {int = upbtable.enumdef_iton(def), str = upbtable.enumdef_ntoi(def)} |
||||
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 join(...) |
||||
return table.concat({...}, ".") |
||||
end |
||||
|
||||
local function split(str) |
||||
local ret = {} |
||||
for word in string.gmatch(str, "%w+") do |
||||
table.insert(ret, word) |
||||
end |
||||
return ret |
||||
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 start_namespace(package, append) |
||||
local package_components = split(package) |
||||
for _, component in ipairs(package_components) do |
||||
append("namespace %s {\n", component) |
||||
end |
||||
end |
||||
|
||||
local function end_namespace(package, append) |
||||
local package_components = split(package) |
||||
for i=#package_components,1,-1 do |
||||
append("} /* namespace %s */\n", package_components[i]) |
||||
end |
||||
end |
||||
|
||||
--[[ |
||||
|
||||
Top-level, exported dumper functions |
||||
|
||||
--]] |
||||
|
||||
local function dump_defs_c(filedef, append) |
||||
local defs = {} |
||||
for def in filedef:defs(upb.DEF_ANY) do |
||||
defs[#defs + 1] = def |
||||
if (def:def_type() == upb.DEF_MSG) then |
||||
for field in def:fields() do |
||||
defs[#defs + 1] = field |
||||
end |
||||
end |
||||
end |
||||
|
||||
-- Sort all defs by (type, name). |
||||
-- This gives us a linear ordering that we can use to create offsets into |
||||
-- shared arrays like REFTABLES, hash table entries, and arrays. |
||||
table.sort(defs, function(a, b) |
||||
if a:def_type() ~= b:def_type() then |
||||
return a:def_type() < b:def_type() |
||||
else |
||||
return a:full_name() < b:full_name() end |
||||
end |
||||
) |
||||
|
||||
-- Perform pre-pass to build the link table. |
||||
local linktab = LinkTable:new{ |
||||
[upb.DEF_MSG] = "msgs", |
||||
[upb.DEF_FIELD] = "fields", |
||||
[upb.DEF_ENUM] = "enums", |
||||
intentries = "intentries", |
||||
strentries = "strentries", |
||||
arrays = "arrays", |
||||
} |
||||
local reftable_count = 0 |
||||
|
||||
for _, def in ipairs(defs) do |
||||
assert(def:is_frozen(), "can only dump frozen defs.") |
||||
linktab:add(def:def_type(), def) |
||||
reftable_count = reftable_count + 2 |
||||
local tables = gettables(def) |
||||
if tables then |
||||
for _, e in ipairs(tables.str.entries) do |
||||
linktab:add("strentries", e.ptr, e) |
||||
end |
||||
for _, e in ipairs(tables.int.entries) do |
||||
linktab:add("intentries", e.ptr, e) |
||||
end |
||||
for _, e in ipairs(tables.int.array) do |
||||
linktab:add("arrays", e.ptr, e) |
||||
end |
||||
end |
||||
end |
||||
|
||||
-- Emit forward declarations. |
||||
emit_file_warning(filedef, append) |
||||
append('#include "upb/def.h"\n') |
||||
append('#include "upb/structdefs.int.h"\n\n') |
||||
append("static const upb_msgdef %s;\n", linktab:cdecl(upb.DEF_MSG)) |
||||
append("static const upb_fielddef %s;\n", linktab:cdecl(upb.DEF_FIELD)) |
||||
if not linktab:empty(upb.DEF_ENUM) then |
||||
append("static const upb_enumdef %s;\n", linktab:cdecl(upb.DEF_ENUM)) |
||||
end |
||||
append("static const upb_tabent %s;\n", linktab:cdecl("strentries")) |
||||
if not linktab:empty("intentries") then |
||||
append("static const upb_tabent %s;\n", linktab:cdecl("intentries")) |
||||
end |
||||
append("static const upb_tabval %s;\n", linktab:cdecl("arrays")) |
||||
append("\n") |
||||
append("#ifdef UPB_DEBUG_REFS\n") |
||||
append("static upb_inttable reftables[%d];\n", reftable_count) |
||||
append("#endif\n") |
||||
append("\n") |
||||
|
||||
-- Emit defs. |
||||
local dumper = Dumper:new(linktab) |
||||
|
||||
local reftable = 0 |
||||
|
||||
append("static const upb_msgdef %s = {\n", linktab:cdecl(upb.DEF_MSG)) |
||||
for m in linktab:objs(upb.DEF_MSG) do |
||||
local tables = gettables(m) |
||||
-- UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, |
||||
-- refs, ref2s) |
||||
append(' UPB_MSGDEF_INIT("%s", %d, %d, %s, %s, %s, %s,' .. |
||||
' &reftables[%d], &reftables[%d]),\n', |
||||
m:full_name(), |
||||
upbtable.msgdef_selector_count(m), |
||||
upbtable.msgdef_submsg_field_count(m), |
||||
dumper:inttable(tables.int), |
||||
dumper:strtable(tables.str), |
||||
boolstr(m:_map_entry()), |
||||
const(m, "syntax"), |
||||
reftable, reftable + 1) |
||||
reftable = reftable + 2 |
||||
end |
||||
append("};\n\n") |
||||
|
||||
append("static const upb_fielddef %s = {\n", linktab:cdecl(upb.DEF_FIELD)) |
||||
for f in linktab:objs(upb.DEF_FIELD) do |
||||
local subdef = "NULL" |
||||
if f:has_subdef() then |
||||
subdef = string.format("(const upb_def*)(%s)", linktab:addr(f:subdef())) |
||||
end |
||||
local intfmt |
||||
if f:type() == upb.TYPE_UINT32 or |
||||
f:type() == upb.TYPE_INT32 or |
||||
f:type() == upb.TYPE_UINT64 or |
||||
f:type() == upb.TYPE_INT64 then |
||||
intfmt = const(f, "intfmt") |
||||
else |
||||
intfmt = "0" |
||||
end |
||||
-- UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, |
||||
-- packed, name, num, msgdef, subdef, selector_base, |
||||
-- index, -- default_value) |
||||
append(' UPB_FIELDDEF_INIT(%s, %s, %s, %s, %s, %s, %s, "%s", %d, %s, ' .. |
||||
'%s, %d, %d, {0},' .. -- TODO: support default value |
||||
'&reftables[%d], &reftables[%d]),\n', |
||||
const(f, "label"), const(f, "type"), intfmt, |
||||
boolstr(f:istagdelim()), boolstr(f:is_extension()), |
||||
boolstr(f:lazy()), boolstr(f:packed()), f:name(), f:number(), |
||||
linktab:addr(f:containing_type()), subdef, |
||||
upbtable.fielddef_selector_base(f), f:index(), |
||||
reftable, reftable + 1 |
||||
) |
||||
reftable = reftable + 2 |
||||
end |
||||
append("};\n\n") |
||||
|
||||
if not linktab:empty(upb.DEF_ENUM) then |
||||
append("static const upb_enumdef %s = {\n", linktab:cdecl(upb.DEF_ENUM)) |
||||
for e in linktab:objs(upb.DEF_ENUM) do |
||||
local tables = gettables(e) |
||||
-- UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval) |
||||
append(' UPB_ENUMDEF_INIT("%s", %s, %s, %d, ' .. |
||||
'&reftables[%d], &reftables[%d]),\n', |
||||
e:full_name(), |
||||
dumper:strtable(tables.str), |
||||
dumper:inttable(tables.int), |
||||
--e:default()) |
||||
0, |
||||
reftable, reftable + 1) |
||||
reftable = reftable + 2 |
||||
end |
||||
append("};\n\n") |
||||
end |
||||
|
||||
append("static const upb_tabent %s = {\n", linktab:cdecl("strentries")) |
||||
for ent in linktab:objs("strentries") do |
||||
append(dumper:tabent(ent)) |
||||
end |
||||
append("};\n\n"); |
||||
|
||||
if not linktab:empty("intentries") then |
||||
append("static const upb_tabent %s = {\n", linktab:cdecl("intentries")) |
||||
for ent in linktab:objs("intentries") do |
||||
append(dumper:tabent(ent)) |
||||
end |
||||
append("};\n\n"); |
||||
end |
||||
|
||||
append("static const upb_tabval %s = {\n", linktab:cdecl("arrays")) |
||||
for ent in linktab:objs("arrays") do |
||||
append(dumper:arrayval(ent)) |
||||
end |
||||
append("};\n\n"); |
||||
|
||||
append("#ifdef UPB_DEBUG_REFS\n") |
||||
append("static upb_inttable reftables[%d] = {\n", reftable_count) |
||||
for i = 1,reftable_count do |
||||
append(" UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),\n") |
||||
end |
||||
append("};\n") |
||||
append("#endif\n\n") |
||||
|
||||
append("static const upb_msgdef *refm(const upb_msgdef *m, const void *owner) {\n") |
||||
append(" upb_msgdef_ref(m, owner);\n") |
||||
append(" return m;\n") |
||||
append("}\n\n") |
||||
append("static const upb_enumdef *refe(const upb_enumdef *e, const void *owner) {\n") |
||||
append(" upb_enumdef_ref(e, owner);\n") |
||||
append(" return e;\n") |
||||
append("}\n\n") |
||||
|
||||
append("/* Public API. */\n") |
||||
|
||||
for m in linktab:objs(upb.DEF_MSG) do |
||||
append("const upb_msgdef *upbdefs_%s_get(const void *owner)" .. |
||||
" { return refm(%s, owner); }\n", |
||||
to_cident(m:full_name()), linktab:addr(m)) |
||||
end |
||||
|
||||
append("\n") |
||||
|
||||
for e in linktab:objs(upb.DEF_ENUM) do |
||||
append("const upb_enumdef *upbdefs_%s_get(const void *owner)" .. |
||||
" { return refe(%s, owner); }\n", |
||||
to_cident(e:full_name()), linktab:addr(e)) |
||||
end |
||||
|
||||
return linktab |
||||
end |
||||
|
||||
local function dump_defs_for_type(format, defs, append) |
||||
local sorted = sorted_defs(defs) |
||||
for _, def in ipairs(sorted) do |
||||
append(format, to_cident(def:full_name()), def:full_name()) |
||||
end |
||||
|
||||
append("\n") |
||||
end |
||||
|
||||
local function make_children_map(file) |
||||
-- Maps file:package() or msg:full_name() -> children. |
||||
local map = {} |
||||
for def in file:defs(upb.DEF_ANY) do |
||||
local container = remove_name(def:full_name()) |
||||
if not map[container] then |
||||
map[container] = {} |
||||
end |
||||
table.insert(map[container], def) |
||||
end |
||||
|
||||
-- Sort all the lists for a consistent ordering. |
||||
for name, children in pairs(map) do |
||||
table.sort(children, function(a, b) return a:name() < b:name() end) |
||||
end |
||||
|
||||
return map |
||||
end |
||||
|
||||
local print_classes |
||||
|
||||
local function print_message(def, map, indent, append) |
||||
append("\n") |
||||
append("%sclass %s : public ::upb::reffed_ptr<const ::upb::MessageDef> {\n", |
||||
indent, def:name()) |
||||
append("%s public:\n", indent) |
||||
append("%s %s(const ::upb::MessageDef* m, const void *ref_donor = NULL)\n", |
||||
indent, def:name()) |
||||
append("%s : reffed_ptr(m, ref_donor) {\n", indent) |
||||
append("%s UPB_ASSERT(upbdefs_%s_is(m));\n", indent, to_cident(def:full_name())) |
||||
append("%s }\n", indent) |
||||
append("\n") |
||||
append("%s static %s get() {\n", indent, def:name()) |
||||
append("%s const ::upb::MessageDef* m = upbdefs_%s_get(&m);\n", indent, to_cident(def:full_name())) |
||||
append("%s return %s(m, &m);\n", indent, def:name()) |
||||
append("%s }\n", indent) |
||||
-- TODO(haberman): add fields |
||||
print_classes(def:full_name(), map, indent .. " ", append) |
||||
append("%s};\n", indent) |
||||
end |
||||
|
||||
local function print_enum(def, indent, append) |
||||
append("\n") |
||||
append("%sclass %s : public ::upb::reffed_ptr<const ::upb::EnumDef> {\n", |
||||
indent, def:name()) |
||||
append("%s public:\n", indent) |
||||
append("%s %s(const ::upb::EnumDef* e, const void *ref_donor = NULL)\n", |
||||
indent, def:name()) |
||||
append("%s : reffed_ptr(e, ref_donor) {\n", indent) |
||||
append("%s UPB_ASSERT(upbdefs_%s_is(e));\n", indent, to_cident(def:full_name())) |
||||
append("%s }\n", indent) |
||||
append("%s static %s get() {\n", indent, def:name()) |
||||
append("%s const ::upb::EnumDef* e = upbdefs_%s_get(&e);\n", indent, to_cident(def:full_name())) |
||||
append("%s return %s(e, &e);\n", indent, def:name()) |
||||
append("%s }\n", indent) |
||||
append("%s};\n", indent) |
||||
end |
||||
|
||||
function print_classes(name, map, indent, append) |
||||
if not map[name] then |
||||
return |
||||
end |
||||
|
||||
for _, def in ipairs(map[name]) do |
||||
if def:def_type() == upb.DEF_MSG then |
||||
print_message(def, map, indent, append) |
||||
elseif def:def_type() == upb.DEF_ENUM then |
||||
print_enum(def, indent, append) |
||||
else |
||||
error("Unknown def type for " .. def:full_name()) |
||||
end |
||||
end |
||||
end |
||||
|
||||
local function dump_defs_h(file, append, linktab) |
||||
local basename_preproc = to_preproc(file:name()) |
||||
append("/* This file contains accessors for a set of compiled-in defs.\n") |
||||
append(" * Note that unlike Google's protobuf, it does *not* define\n") |
||||
append(" * generated classes or any other kind of data structure for\n") |
||||
append(" * actually storing protobufs. It only contains *defs* which\n") |
||||
append(" * let you reflect over a protobuf *schema*.\n") |
||||
append(" */\n") |
||||
emit_file_warning(file, append) |
||||
append('#ifndef %s_UPB_H_\n', basename_preproc) |
||||
append('#define %s_UPB_H_\n\n', basename_preproc) |
||||
append('#include "upb/def.h"\n\n') |
||||
append('UPB_BEGIN_EXTERN_C\n\n') |
||||
|
||||
-- Dump C enums for proto enums. |
||||
|
||||
append("/* MessageDefs: call these functions to get a ref to a msgdef. */\n") |
||||
dump_defs_for_type( |
||||
"const upb_msgdef *upbdefs_%s_get(const void *owner);\n", |
||||
file:defs(upb.DEF_MSG), append) |
||||
|
||||
append("/* EnumDefs: call these functions to get a ref to an enumdef. */\n") |
||||
dump_defs_for_type( |
||||
"const upb_enumdef *upbdefs_%s_get(const void *owner);\n", |
||||
file:defs(upb.DEF_ENUM), append) |
||||
|
||||
append("/* Functions to test whether this message is of a certain type. */\n") |
||||
dump_defs_for_type( |
||||
"UPB_INLINE bool upbdefs_%s_is(const upb_msgdef *m) {\n" .. |
||||
" return strcmp(upb_msgdef_fullname(m), \"%s\") == 0;\n}\n", |
||||
file:defs(upb.DEF_MSG), append) |
||||
|
||||
append("/* Functions to test whether this enum is of a certain type. */\n") |
||||
dump_defs_for_type( |
||||
"UPB_INLINE bool upbdefs_%s_is(const upb_enumdef *e) {\n" .. |
||||
" return strcmp(upb_enumdef_fullname(e), \"%s\") == 0;\n}\n", |
||||
file:defs(upb.DEF_ENUM), append) |
||||
|
||||
append("\n") |
||||
|
||||
-- fields |
||||
local fields = {} |
||||
|
||||
for f in linktab:objs(upb.DEF_FIELD) do |
||||
local symname = f:containing_type():full_name() .. "." .. f:name() |
||||
fields[#fields + 1] = {to_cident(symname), f} |
||||
end |
||||
|
||||
table.sort(fields, function(a, b) return a[1] < b[1] end) |
||||
|
||||
append("/* Functions to get a fielddef from a msgdef reference. */\n") |
||||
for _, field in ipairs(fields) do |
||||
local f = field[2] |
||||
local msg_cident = to_cident(f:containing_type():full_name()) |
||||
local field_cident = to_cident(f:name()) |
||||
append("UPB_INLINE const upb_fielddef *upbdefs_%s_f_%s(const upb_msgdef *m) {" .. |
||||
" UPB_ASSERT(upbdefs_%s_is(m));" .. |
||||
" return upb_msgdef_itof(m, %d); }\n", |
||||
msg_cident, field_cident, msg_cident, f:number()) |
||||
end |
||||
|
||||
append('\nUPB_END_EXTERN_C\n\n') |
||||
|
||||
-- C++ wrappers. |
||||
local children_map = make_children_map(file) |
||||
|
||||
append("#ifdef __cplusplus\n\n") |
||||
append("namespace upbdefs {\n") |
||||
start_namespace(file:package(), append) |
||||
print_classes(file:package(), children_map, "", append) |
||||
append("\n") |
||||
end_namespace(file:package(), append) |
||||
append("} /* namespace upbdefs */\n\n") |
||||
append("#endif /* __cplusplus */\n") |
||||
|
||||
append("\n") |
||||
append('#endif /* %s_UPB_H_ */\n', basename_preproc) |
||||
end |
||||
|
||||
function export.dump_defs(filedef, append_h, append_c) |
||||
local linktab = dump_defs_c(filedef, append_c) |
||||
dump_defs_h(filedef, append_h, linktab) |
||||
end |
||||
|
||||
return export |
@ -1,64 +0,0 @@ |
||||
--[[ |
||||
|
||||
Tests for dump_cinit.lua. Runs first in a mode that generates |
||||
some C code for an extension. The C code is compiled and then |
||||
loaded by a second invocation of the test which checks that the |
||||
generated defs are as expected. |
||||
|
||||
--]] |
||||
|
||||
local dump_cinit = require "dump_cinit" |
||||
local upb = require "upb" |
||||
|
||||
-- Once APIs for loading descriptors are fleshed out, we should replace this |
||||
-- with a descriptor for a meaty protobuf like descriptor.proto. |
||||
local symtab = upb.SymbolTable{ |
||||
upb.EnumDef{full_name = "MyEnum", |
||||
values = { |
||||
{"FOO", 1}, |
||||
{"BAR", 77} |
||||
} |
||||
}, |
||||
upb.MessageDef{full_name = "MyMessage", |
||||
fields = { |
||||
upb.FieldDef{label = upb.LABEL_REQUIRED, name = "field1", number = 1, |
||||
type = upb.TYPE_INT32}, |
||||
upb.FieldDef{label = upb.LABEL_REPEATED, name = "field2", number = 2, |
||||
type = upb.TYPE_ENUM, subdef_name = ".MyEnum"}, |
||||
upb.FieldDef{name = "field3", number = 3, type = upb.TYPE_MESSAGE, |
||||
subdef_name = ".MyMessage"} |
||||
} |
||||
} |
||||
} |
||||
|
||||
if arg[1] == "generate" then |
||||
local f = assert(io.open(arg[2], "w")) |
||||
local f_h = assert(io.open(arg[2] .. ".h", "w")) |
||||
local appendc = dump_cinit.file_appender(f) |
||||
local appendh = dump_cinit.file_appender(f_h) |
||||
f:write('#include "lua.h"\n') |
||||
f:write('#include "upb/bindings/lua/upb.h"\n') |
||||
dump_cinit.dump_defs(symtab, "testdefs", appendh, appendc) |
||||
f:write([[int luaopen_staticdefs(lua_State *L) { |
||||
const upb_symtab *s = upbdefs_testdefs(&s); |
||||
lupb_symtab_pushwrapper(L, s, &s); |
||||
return 1; |
||||
}]]) |
||||
f_h:close() |
||||
f:close() |
||||
elseif arg[1] == "test" then |
||||
local symtab = require "staticdefs" |
||||
local msg = assert(symtab:lookup("MyMessage")) |
||||
local enum = assert(symtab:lookup("MyEnum")) |
||||
local f2 = assert(msg:field("field2")) |
||||
assert(msg:def_type() == upb.DEF_MSG) |
||||
assert(msg:full_name() == "MyMessage") |
||||
assert(enum:def_type() == upb.DEF_ENUM) |
||||
assert(enum:full_name() == "MyEnum") |
||||
assert(enum:value("FOO") == 1) |
||||
assert(f2:name() == "field2") |
||||
assert(f2:containing_type() == msg) |
||||
assert(f2:subdef() == enum) |
||||
else |
||||
error("Unknown operation " .. arg[1]) |
||||
end |
@ -1,211 +0,0 @@ |
||||
/*
|
||||
** require("upb.table") -- a Lua extension for accessing upb_table |
||||
** |
||||
** This is an internal-only interface and exists for the sole purpose of |
||||
** writing a C code generator in Lua that can dump a upb_table as static C |
||||
** initializers. This lets us use Lua for convenient string manipulation while |
||||
** saving us from re-implementing the upb_table hash function and hash table |
||||
** layout / collision strategy in Lua. |
||||
** |
||||
** Since this is used only as part of the toolchain (and not part of the |
||||
** runtime) we do not hold this module to the same stringent requirements as |
||||
** the main Lua modules (for example that misbehaving Lua programs cannot |
||||
** crash the interpreter). |
||||
*/ |
||||
|
||||
#include <float.h> |
||||
#include <math.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
|
||||
#include "lauxlib.h" |
||||
#include "upb/bindings/lua/upb.h" |
||||
#include "upb/def.h" |
||||
#include "upb/structdefs.int.h" |
||||
#include "upb/table.int.h" |
||||
|
||||
static void lupbtable_setnum(lua_State *L, int tab, const char *key, |
||||
lua_Number val) { |
||||
lua_pushnumber(L, val); |
||||
lua_setfield(L, tab - 1, key); |
||||
} |
||||
|
||||
static void lupbtable_pushval(lua_State *L, upb_tabval val, upb_ctype_t ctype) { |
||||
switch (ctype) { |
||||
case UPB_CTYPE_INT32: |
||||
lua_pushnumber(L, val.val); |
||||
break; |
||||
case UPB_CTYPE_PTR: |
||||
lupb_def_pushwrapper(L, (void*)val.val, NULL); |
||||
break; |
||||
case UPB_CTYPE_CSTR: |
||||
lua_pushstring(L, (const char*)val.val); |
||||
break; |
||||
default: |
||||
luaL_error(L, "Unexpected type: %d", ctype); |
||||
} |
||||
} |
||||
|
||||
/* Sets a few fields common to both hash table entries and arrays. */ |
||||
static void lupbtable_setmetafields(lua_State *L, int ctype, const void *ptr) { |
||||
/* We tack this onto every entry so we know it even if the entries
|
||||
* don't stay with the table. */ |
||||
lua_pushnumber(L, ctype); |
||||
lua_setfield(L, -2, "valtype"); |
||||
|
||||
/* Set this to facilitate linking. */ |
||||
lua_pushlightuserdata(L, (void*)ptr); |
||||
lua_setfield(L, -2, "ptr"); |
||||
} |
||||
|
||||
static void lupbtable_pushent(lua_State *L, const upb_tabent *e, |
||||
bool inttab, int ctype) { |
||||
lua_newtable(L); |
||||
if (!upb_tabent_isempty(e)) { |
||||
if (inttab) { |
||||
lua_pushnumber(L, e->key); |
||||
} else { |
||||
uint32_t len; |
||||
const char *str = upb_tabstr(e->key, &len); |
||||
lua_pushlstring(L, str, len); |
||||
} |
||||
lua_setfield(L, -2, "key"); |
||||
lupbtable_pushval(L, e->val, ctype); |
||||
lua_setfield(L, -2, "value"); |
||||
} |
||||
lua_pushlightuserdata(L, (void*)e->next); |
||||
lua_setfield(L, -2, "next"); |
||||
lupbtable_setmetafields(L, ctype, e); |
||||
} |
||||
|
||||
/* Dumps the shared part of upb_table into a Lua table. */ |
||||
static void lupbtable_pushtable(lua_State *L, const upb_table *t, bool inttab) { |
||||
size_t i; |
||||
|
||||
lua_newtable(L); |
||||
lupbtable_setnum(L, -1, "count", t->count); |
||||
lupbtable_setnum(L, -1, "mask", t->mask); |
||||
lupbtable_setnum(L, -1, "ctype", t->ctype); |
||||
lupbtable_setnum(L, -1, "size_lg2", t->size_lg2); |
||||
|
||||
lua_newtable(L); |
||||
for (i = 0; i < upb_table_size(t); i++) { |
||||
lupbtable_pushent(L, &t->entries[i], inttab, t->ctype); |
||||
lua_rawseti(L, -2, i + 1); |
||||
} |
||||
lua_setfield(L, -2, "entries"); |
||||
} |
||||
|
||||
/* Dumps a upb_inttable to a Lua table. */ |
||||
static void lupbtable_pushinttable(lua_State *L, const upb_inttable *t) { |
||||
size_t i; |
||||
|
||||
lupbtable_pushtable(L, &t->t, true); |
||||
lupbtable_setnum(L, -1, "array_size", t->array_size); |
||||
lupbtable_setnum(L, -1, "array_count", t->array_count); |
||||
|
||||
lua_newtable(L); |
||||
for (i = 0; i < t->array_size; i++) { |
||||
lua_newtable(L); |
||||
if (upb_arrhas(t->array[i])) { |
||||
lupbtable_pushval(L, t->array[i], t->t.ctype); |
||||
lua_setfield(L, -2, "val"); |
||||
} |
||||
lupbtable_setmetafields(L, t->t.ctype, &t->array[i]); |
||||
lua_rawseti(L, -2, i + 1); |
||||
} |
||||
lua_setfield(L, -2, "array"); |
||||
} |
||||
|
||||
static void lupbtable_pushstrtable(lua_State *L, const upb_strtable *t) { |
||||
lupbtable_pushtable(L, &t->t, false); |
||||
} |
||||
|
||||
static int lupbtable_msgdef_itof(lua_State *L) { |
||||
const upb_msgdef *m = lupb_msgdef_check(L, 1); |
||||
lupbtable_pushinttable(L, &m->itof); |
||||
return 1; |
||||
} |
||||
|
||||
static int lupbtable_msgdef_ntof(lua_State *L) { |
||||
const upb_msgdef *m = lupb_msgdef_check(L, 1); |
||||
lupbtable_pushstrtable(L, &m->ntof); |
||||
return 1; |
||||
} |
||||
|
||||
static int lupbtable_enumdef_iton(lua_State *L) { |
||||
const upb_enumdef *e = lupb_enumdef_check(L, 1); |
||||
lupbtable_pushinttable(L, &e->iton); |
||||
return 1; |
||||
} |
||||
|
||||
static int lupbtable_enumdef_ntoi(lua_State *L) { |
||||
const upb_enumdef *e = lupb_enumdef_check(L, 1); |
||||
lupbtable_pushstrtable(L, &e->ntoi); |
||||
return 1; |
||||
} |
||||
|
||||
static int lupbtable_symtab_symtab(lua_State *L) { |
||||
const upb_symtab *s = lupb_symtab_check(L, 1); |
||||
lupbtable_pushstrtable(L, &s->symtab); |
||||
return 1; |
||||
} |
||||
|
||||
static void lupbtable_setfieldi(lua_State *L, const char *field, int i) { |
||||
lua_pushnumber(L, i); |
||||
lua_setfield(L, -2, field); |
||||
} |
||||
|
||||
/* These aren't from the table, but they access other internal-only
|
||||
* definitions. */ |
||||
static int lupb_fielddef_selectorbase(lua_State *L) { |
||||
const upb_fielddef *f = lupb_fielddef_check(L, 1); |
||||
if (!upb_fielddef_isfrozen(f)) |
||||
luaL_error(L, "_selectorbase is only defined for frozen fielddefs"); |
||||
lua_pushinteger(L, f->selector_base); |
||||
return 1; |
||||
} |
||||
|
||||
static int lupb_msgdef_selectorcount(lua_State *L) { |
||||
const upb_msgdef *m = lupb_msgdef_check(L, 1); |
||||
lua_pushinteger(L, m->selector_count); |
||||
return 1; |
||||
} |
||||
|
||||
static int lupb_msgdef_submsgfieldcount(lua_State *L) { |
||||
const upb_msgdef *m = lupb_msgdef_check(L, 1); |
||||
lua_pushinteger(L, m->submsg_field_count); |
||||
return 1; |
||||
} |
||||
|
||||
static const struct luaL_Reg lupbtable_toplevel_m[] = { |
||||
{"msgdef_itof", lupbtable_msgdef_itof}, |
||||
{"msgdef_ntof", lupbtable_msgdef_ntof}, |
||||
{"enumdef_iton", lupbtable_enumdef_iton}, |
||||
{"enumdef_ntoi", lupbtable_enumdef_ntoi}, |
||||
{"symtab_symtab", lupbtable_symtab_symtab}, |
||||
|
||||
{"msgdef_selector_count", lupb_msgdef_selectorcount}, |
||||
{"msgdef_submsg_field_count", lupb_msgdef_submsgfieldcount}, |
||||
|
||||
{"fielddef_selector_base", lupb_fielddef_selectorbase}, |
||||
|
||||
{NULL, NULL} |
||||
}; |
||||
|
||||
int luaopen_upb_table_c(lua_State *L) { |
||||
static char module_key; |
||||
if (lupb_openlib(L, &module_key, "upb.table", lupbtable_toplevel_m)) { |
||||
return 1; |
||||
} |
||||
|
||||
/* We define these here because they are not public. */ |
||||
lupbtable_setfieldi(L, "CTYPE_PTR", UPB_CTYPE_PTR); |
||||
lupbtable_setfieldi(L, "CTYPE_CSTR", UPB_CTYPE_CSTR); |
||||
lupbtable_setfieldi(L, "CTYPE_INT32", UPB_CTYPE_INT32); |
||||
|
||||
lua_pushlightuserdata(L, NULL); |
||||
lua_setfield(L, -2, "NULL"); |
||||
|
||||
return 1; /* Return a single Lua value, the package table created above. */ |
||||
} |
@ -1,3 +0,0 @@ |
||||
|
||||
require "upb" |
||||
return require "upb.table_c" |
Binary file not shown.
@ -1,788 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// https://developers.google.com/protocol-buffers/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
// Author: kenton@google.com (Kenton Varda) |
||||
// Based on original Protocol Buffers design by |
||||
// Sanjay Ghemawat, Jeff Dean, and others. |
||||
// |
||||
// The messages in this file describe the definitions found in .proto files. |
||||
// A valid .proto file can be translated directly to a FileDescriptorProto |
||||
// without any other information (e.g. without reading its imports). |
||||
|
||||
|
||||
syntax = "proto2"; |
||||
|
||||
package google.protobuf; |
||||
option go_package = "descriptor"; |
||||
option java_package = "com.google.protobuf"; |
||||
option java_outer_classname = "DescriptorProtos"; |
||||
option csharp_namespace = "Google.Protobuf.Reflection"; |
||||
option objc_class_prefix = "GPB"; |
||||
|
||||
// descriptor.proto must be optimized for speed because reflection-based |
||||
// algorithms don't work during bootstrapping. |
||||
option optimize_for = SPEED; |
||||
|
||||
// The protocol compiler can output a FileDescriptorSet containing the .proto |
||||
// files it parses. |
||||
message FileDescriptorSet { |
||||
repeated FileDescriptorProto file = 1; |
||||
} |
||||
|
||||
// Describes a complete .proto file. |
||||
message FileDescriptorProto { |
||||
optional string name = 1; // file name, relative to root of source tree |
||||
optional string package = 2; // e.g. "foo", "foo.bar", etc. |
||||
|
||||
// Names of files imported by this file. |
||||
repeated string dependency = 3; |
||||
// Indexes of the public imported files in the dependency list above. |
||||
repeated int32 public_dependency = 10; |
||||
// Indexes of the weak imported files in the dependency list. |
||||
// For Google-internal migration only. Do not use. |
||||
repeated int32 weak_dependency = 11; |
||||
|
||||
// All top-level definitions in this file. |
||||
repeated DescriptorProto message_type = 4; |
||||
repeated EnumDescriptorProto enum_type = 5; |
||||
repeated ServiceDescriptorProto service = 6; |
||||
repeated FieldDescriptorProto extension = 7; |
||||
|
||||
optional FileOptions options = 8; |
||||
|
||||
// This field contains optional information about the original source code. |
||||
// You may safely remove this entire field without harming runtime |
||||
// functionality of the descriptors -- the information is needed only by |
||||
// development tools. |
||||
optional SourceCodeInfo source_code_info = 9; |
||||
|
||||
// The syntax of the proto file. |
||||
// The supported values are "proto2" and "proto3". |
||||
optional string syntax = 12; |
||||
} |
||||
|
||||
// Describes a message type. |
||||
message DescriptorProto { |
||||
optional string name = 1; |
||||
|
||||
repeated FieldDescriptorProto field = 2; |
||||
repeated FieldDescriptorProto extension = 6; |
||||
|
||||
repeated DescriptorProto nested_type = 3; |
||||
repeated EnumDescriptorProto enum_type = 4; |
||||
|
||||
message ExtensionRange { |
||||
optional int32 start = 1; |
||||
optional int32 end = 2; |
||||
} |
||||
repeated ExtensionRange extension_range = 5; |
||||
|
||||
repeated OneofDescriptorProto oneof_decl = 8; |
||||
|
||||
optional MessageOptions options = 7; |
||||
|
||||
// Range of reserved tag numbers. Reserved tag numbers may not be used by |
||||
// fields or extension ranges in the same message. Reserved ranges may |
||||
// not overlap. |
||||
message ReservedRange { |
||||
optional int32 start = 1; // Inclusive. |
||||
optional int32 end = 2; // Exclusive. |
||||
} |
||||
repeated ReservedRange reserved_range = 9; |
||||
// Reserved field names, which may not be used by fields in the same message. |
||||
// A given name may only be reserved once. |
||||
repeated string reserved_name = 10; |
||||
} |
||||
|
||||
// Describes a field within a message. |
||||
message FieldDescriptorProto { |
||||
enum Type { |
||||
// 0 is reserved for errors. |
||||
// Order is weird for historical reasons. |
||||
TYPE_DOUBLE = 1; |
||||
TYPE_FLOAT = 2; |
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if |
||||
// negative values are likely. |
||||
TYPE_INT64 = 3; |
||||
TYPE_UINT64 = 4; |
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if |
||||
// negative values are likely. |
||||
TYPE_INT32 = 5; |
||||
TYPE_FIXED64 = 6; |
||||
TYPE_FIXED32 = 7; |
||||
TYPE_BOOL = 8; |
||||
TYPE_STRING = 9; |
||||
TYPE_GROUP = 10; // Tag-delimited aggregate. |
||||
TYPE_MESSAGE = 11; // Length-delimited aggregate. |
||||
|
||||
// New in version 2. |
||||
TYPE_BYTES = 12; |
||||
TYPE_UINT32 = 13; |
||||
TYPE_ENUM = 14; |
||||
TYPE_SFIXED32 = 15; |
||||
TYPE_SFIXED64 = 16; |
||||
TYPE_SINT32 = 17; // Uses ZigZag encoding. |
||||
TYPE_SINT64 = 18; // Uses ZigZag encoding. |
||||
}; |
||||
|
||||
enum Label { |
||||
// 0 is reserved for errors |
||||
LABEL_OPTIONAL = 1; |
||||
LABEL_REQUIRED = 2; |
||||
LABEL_REPEATED = 3; |
||||
// TODO(sanjay): Should we add LABEL_MAP? |
||||
}; |
||||
|
||||
optional string name = 1; |
||||
optional int32 number = 3; |
||||
optional Label label = 4; |
||||
|
||||
// If type_name is set, this need not be set. If both this and type_name |
||||
// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. |
||||
optional Type type = 5; |
||||
|
||||
// For message and enum types, this is the name of the type. If the name |
||||
// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping |
||||
// rules are used to find the type (i.e. first the nested types within this |
||||
// message are searched, then within the parent, on up to the root |
||||
// namespace). |
||||
optional string type_name = 6; |
||||
|
||||
// For extensions, this is the name of the type being extended. It is |
||||
// resolved in the same manner as type_name. |
||||
optional string extendee = 2; |
||||
|
||||
// For numeric types, contains the original text representation of the value. |
||||
// For booleans, "true" or "false". |
||||
// For strings, contains the default text contents (not escaped in any way). |
||||
// For bytes, contains the C escaped value. All bytes >= 128 are escaped. |
||||
// TODO(kenton): Base-64 encode? |
||||
optional string default_value = 7; |
||||
|
||||
// If set, gives the index of a oneof in the containing type's oneof_decl |
||||
// list. This field is a member of that oneof. |
||||
optional int32 oneof_index = 9; |
||||
|
||||
// JSON name of this field. The value is set by protocol compiler. If the |
||||
// user has set a "json_name" option on this field, that option's value |
||||
// will be used. Otherwise, it's deduced from the field's name by converting |
||||
// it to camelCase. |
||||
optional string json_name = 10; |
||||
|
||||
optional FieldOptions options = 8; |
||||
} |
||||
|
||||
// Describes a oneof. |
||||
message OneofDescriptorProto { |
||||
optional string name = 1; |
||||
} |
||||
|
||||
// Describes an enum type. |
||||
message EnumDescriptorProto { |
||||
optional string name = 1; |
||||
|
||||
repeated EnumValueDescriptorProto value = 2; |
||||
|
||||
optional EnumOptions options = 3; |
||||
} |
||||
|
||||
// Describes a value within an enum. |
||||
message EnumValueDescriptorProto { |
||||
optional string name = 1; |
||||
optional int32 number = 2; |
||||
|
||||
optional EnumValueOptions options = 3; |
||||
} |
||||
|
||||
// Describes a service. |
||||
message ServiceDescriptorProto { |
||||
optional string name = 1; |
||||
repeated MethodDescriptorProto method = 2; |
||||
|
||||
optional ServiceOptions options = 3; |
||||
} |
||||
|
||||
// Describes a method of a service. |
||||
message MethodDescriptorProto { |
||||
optional string name = 1; |
||||
|
||||
// Input and output type names. These are resolved in the same way as |
||||
// FieldDescriptorProto.type_name, but must refer to a message type. |
||||
optional string input_type = 2; |
||||
optional string output_type = 3; |
||||
|
||||
optional MethodOptions options = 4; |
||||
|
||||
// Identifies if client streams multiple client messages |
||||
optional bool client_streaming = 5 [default=false]; |
||||
// Identifies if server streams multiple server messages |
||||
optional bool server_streaming = 6 [default=false]; |
||||
} |
||||
|
||||
|
||||
// =================================================================== |
||||
// Options |
||||
|
||||
// Each of the definitions above may have "options" attached. These are |
||||
// just annotations which may cause code to be generated slightly differently |
||||
// or may contain hints for code that manipulates protocol messages. |
||||
// |
||||
// Clients may define custom options as extensions of the *Options messages. |
||||
// These extensions may not yet be known at parsing time, so the parser cannot |
||||
// store the values in them. Instead it stores them in a field in the *Options |
||||
// message called uninterpreted_option. This field must have the same name |
||||
// across all *Options messages. We then use this field to populate the |
||||
// extensions when we build a descriptor, at which point all protos have been |
||||
// parsed and so all extensions are known. |
||||
// |
||||
// Extension numbers for custom options may be chosen as follows: |
||||
// * For options which will only be used within a single application or |
||||
// organization, or for experimental options, use field numbers 50000 |
||||
// through 99999. It is up to you to ensure that you do not use the |
||||
// same number for multiple options. |
||||
// * For options which will be published and used publicly by multiple |
||||
// independent entities, e-mail protobuf-global-extension-registry@google.com |
||||
// to reserve extension numbers. Simply provide your project name (e.g. |
||||
// Objective-C plugin) and your project website (if available) -- there's no |
||||
// need to explain how you intend to use them. Usually you only need one |
||||
// extension number. You can declare multiple options with only one extension |
||||
// number by putting them in a sub-message. See the Custom Options section of |
||||
// the docs for examples: |
||||
// https://developers.google.com/protocol-buffers/docs/proto#options |
||||
// If this turns out to be popular, a web service will be set up |
||||
// to automatically assign option numbers. |
||||
|
||||
|
||||
message FileOptions { |
||||
|
||||
// Sets the Java package where classes generated from this .proto will be |
||||
// placed. By default, the proto package is used, but this is often |
||||
// inappropriate because proto packages do not normally start with backwards |
||||
// domain names. |
||||
optional string java_package = 1; |
||||
|
||||
|
||||
// If set, all the classes from the .proto file are wrapped in a single |
||||
// outer class with the given name. This applies to both Proto1 |
||||
// (equivalent to the old "--one_java_file" option) and Proto2 (where |
||||
// a .proto always translates to a single class, but you may want to |
||||
// explicitly choose the class name). |
||||
optional string java_outer_classname = 8; |
||||
|
||||
// If set true, then the Java code generator will generate a separate .java |
||||
// file for each top-level message, enum, and service defined in the .proto |
||||
// file. Thus, these types will *not* be nested inside the outer class |
||||
// named by java_outer_classname. However, the outer class will still be |
||||
// generated to contain the file's getDescriptor() method as well as any |
||||
// top-level extensions defined in the file. |
||||
optional bool java_multiple_files = 10 [default=false]; |
||||
|
||||
// If set true, then the Java code generator will generate equals() and |
||||
// hashCode() methods for all messages defined in the .proto file. |
||||
// This increases generated code size, potentially substantially for large |
||||
// protos, which may harm a memory-constrained application. |
||||
// - In the full runtime this is a speed optimization, as the |
||||
// AbstractMessage base class includes reflection-based implementations of |
||||
// these methods. |
||||
// - In the lite runtime, setting this option changes the semantics of |
||||
// equals() and hashCode() to more closely match those of the full runtime; |
||||
// the generated methods compute their results based on field values rather |
||||
// than object identity. (Implementations should not assume that hashcodes |
||||
// will be consistent across runtimes or versions of the protocol compiler.) |
||||
optional bool java_generate_equals_and_hash = 20 [default=false]; |
||||
|
||||
// If set true, then the Java2 code generator will generate code that |
||||
// throws an exception whenever an attempt is made to assign a non-UTF-8 |
||||
// byte sequence to a string field. |
||||
// Message reflection will do the same. |
||||
// However, an extension field still accepts non-UTF-8 byte sequences. |
||||
// This option has no effect on when used with the lite runtime. |
||||
optional bool java_string_check_utf8 = 27 [default=false]; |
||||
|
||||
|
||||
// Generated classes can be optimized for speed or code size. |
||||
enum OptimizeMode { |
||||
SPEED = 1; // Generate complete code for parsing, serialization, |
||||
// etc. |
||||
CODE_SIZE = 2; // Use ReflectionOps to implement these methods. |
||||
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. |
||||
} |
||||
optional OptimizeMode optimize_for = 9 [default=SPEED]; |
||||
|
||||
// Sets the Go package where structs generated from this .proto will be |
||||
// placed. If omitted, the Go package will be derived from the following: |
||||
// - The basename of the package import path, if provided. |
||||
// - Otherwise, the package statement in the .proto file, if present. |
||||
// - Otherwise, the basename of the .proto file, without extension. |
||||
optional string go_package = 11; |
||||
|
||||
|
||||
|
||||
// Should generic services be generated in each language? "Generic" services |
||||
// are not specific to any particular RPC system. They are generated by the |
||||
// main code generators in each language (without additional plugins). |
||||
// Generic services were the only kind of service generation supported by |
||||
// early versions of google.protobuf. |
||||
// |
||||
// Generic services are now considered deprecated in favor of using plugins |
||||
// that generate code specific to your particular RPC system. Therefore, |
||||
// these default to false. Old code which depends on generic services should |
||||
// explicitly set them to true. |
||||
optional bool cc_generic_services = 16 [default=false]; |
||||
optional bool java_generic_services = 17 [default=false]; |
||||
optional bool py_generic_services = 18 [default=false]; |
||||
|
||||
// Is this file deprecated? |
||||
// Depending on the target platform, this can emit Deprecated annotations |
||||
// for everything in the file, or it will be completely ignored; in the very |
||||
// least, this is a formalization for deprecating files. |
||||
optional bool deprecated = 23 [default=false]; |
||||
|
||||
// Enables the use of arenas for the proto messages in this file. This applies |
||||
// only to generated classes for C++. |
||||
optional bool cc_enable_arenas = 31 [default=false]; |
||||
|
||||
|
||||
// Sets the objective c class prefix which is prepended to all objective c |
||||
// generated classes from this .proto. There is no default. |
||||
optional string objc_class_prefix = 36; |
||||
|
||||
// Namespace for generated classes; defaults to the package. |
||||
optional string csharp_namespace = 37; |
||||
|
||||
// Whether the nano proto compiler should generate in the deprecated non-nano |
||||
// suffixed package. |
||||
optional bool javanano_use_deprecated_package = 38; |
||||
|
||||
// Sets the php class prefix which is prepended to all php generated classes |
||||
// from this .proto. Default is empty. |
||||
optional string php_class_prefix = 40; |
||||
|
||||
// Use this option to change the namespace of php generated classes. Default |
||||
// is empty. When this option is empty, the package name will be used for |
||||
// determining the namespace. |
||||
optional string php_namespace = 41; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message MessageOptions { |
||||
// Set true to use the old proto1 MessageSet wire format for extensions. |
||||
// This is provided for backwards-compatibility with the MessageSet wire |
||||
// format. You should not use this for any other reason: It's less |
||||
// efficient, has fewer features, and is more complicated. |
||||
// |
||||
// The message must be defined exactly as follows: |
||||
// message Foo { |
||||
// option message_set_wire_format = true; |
||||
// extensions 4 to max; |
||||
// } |
||||
// Note that the message cannot have any defined fields; MessageSets only |
||||
// have extensions. |
||||
// |
||||
// All extensions of your type must be singular messages; e.g. they cannot |
||||
// be int32s, enums, or repeated messages. |
||||
// |
||||
// Because this is an option, the above two restrictions are not enforced by |
||||
// the protocol compiler. |
||||
optional bool message_set_wire_format = 1 [default=false]; |
||||
|
||||
// Disables the generation of the standard "descriptor()" accessor, which can |
||||
// conflict with a field of the same name. This is meant to make migration |
||||
// from proto1 easier; new code should avoid fields named "descriptor". |
||||
optional bool no_standard_descriptor_accessor = 2 [default=false]; |
||||
|
||||
// Is this message deprecated? |
||||
// Depending on the target platform, this can emit Deprecated annotations |
||||
// for the message, or it will be completely ignored; in the very least, |
||||
// this is a formalization for deprecating messages. |
||||
optional bool deprecated = 3 [default=false]; |
||||
|
||||
// Whether the message is an automatically generated map entry type for the |
||||
// maps field. |
||||
// |
||||
// For maps fields: |
||||
// map<KeyType, ValueType> map_field = 1; |
||||
// The parsed descriptor looks like: |
||||
// message MapFieldEntry { |
||||
// option map_entry = true; |
||||
// optional KeyType key = 1; |
||||
// optional ValueType value = 2; |
||||
// } |
||||
// repeated MapFieldEntry map_field = 1; |
||||
// |
||||
// Implementations may choose not to generate the map_entry=true message, but |
||||
// use a native map in the target language to hold the keys and values. |
||||
// The reflection APIs in such implementions still need to work as |
||||
// if the field is a repeated message field. |
||||
// |
||||
// NOTE: Do not set the option in .proto files. Always use the maps syntax |
||||
// instead. The option should only be implicitly set by the proto compiler |
||||
// parser. |
||||
optional bool map_entry = 7; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message FieldOptions { |
||||
// The ctype option instructs the C++ code generator to use a different |
||||
// representation of the field than it normally would. See the specific |
||||
// options below. This option is not yet implemented in the open source |
||||
// release -- sorry, we'll try to include it in a future version! |
||||
optional CType ctype = 1 [default = STRING]; |
||||
enum CType { |
||||
// Default mode. |
||||
STRING = 0; |
||||
|
||||
CORD = 1; |
||||
|
||||
STRING_PIECE = 2; |
||||
} |
||||
// The packed option can be enabled for repeated primitive fields to enable |
||||
// a more efficient representation on the wire. Rather than repeatedly |
||||
// writing the tag and type for each element, the entire array is encoded as |
||||
// a single length-delimited blob. In proto3, only explicit setting it to |
||||
// false will avoid using packed encoding. |
||||
optional bool packed = 2; |
||||
|
||||
|
||||
// The jstype option determines the JavaScript type used for values of the |
||||
// field. The option is permitted only for 64 bit integral and fixed types |
||||
// (int64, uint64, sint64, fixed64, sfixed64). By default these types are |
||||
// represented as JavaScript strings. This avoids loss of precision that can |
||||
// happen when a large value is converted to a floating point JavaScript |
||||
// numbers. Specifying JS_NUMBER for the jstype causes the generated |
||||
// JavaScript code to use the JavaScript "number" type instead of strings. |
||||
// This option is an enum to permit additional types to be added, |
||||
// e.g. goog.math.Integer. |
||||
optional JSType jstype = 6 [default = JS_NORMAL]; |
||||
enum JSType { |
||||
// Use the default type. |
||||
JS_NORMAL = 0; |
||||
|
||||
// Use JavaScript strings. |
||||
JS_STRING = 1; |
||||
|
||||
// Use JavaScript numbers. |
||||
JS_NUMBER = 2; |
||||
} |
||||
|
||||
// Should this field be parsed lazily? Lazy applies only to message-type |
||||
// fields. It means that when the outer message is initially parsed, the |
||||
// inner message's contents will not be parsed but instead stored in encoded |
||||
// form. The inner message will actually be parsed when it is first accessed. |
||||
// |
||||
// This is only a hint. Implementations are free to choose whether to use |
||||
// eager or lazy parsing regardless of the value of this option. However, |
||||
// setting this option true suggests that the protocol author believes that |
||||
// using lazy parsing on this field is worth the additional bookkeeping |
||||
// overhead typically needed to implement it. |
||||
// |
||||
// This option does not affect the public interface of any generated code; |
||||
// all method signatures remain the same. Furthermore, thread-safety of the |
||||
// interface is not affected by this option; const methods remain safe to |
||||
// call from multiple threads concurrently, while non-const methods continue |
||||
// to require exclusive access. |
||||
// |
||||
// |
||||
// Note that implementations may choose not to check required fields within |
||||
// a lazy sub-message. That is, calling IsInitialized() on the outher message |
||||
// may return true even if the inner message has missing required fields. |
||||
// This is necessary because otherwise the inner message would have to be |
||||
// parsed in order to perform the check, defeating the purpose of lazy |
||||
// parsing. An implementation which chooses not to check required fields |
||||
// must be consistent about it. That is, for any particular sub-message, the |
||||
// implementation must either *always* check its required fields, or *never* |
||||
// check its required fields, regardless of whether or not the message has |
||||
// been parsed. |
||||
optional bool lazy = 5 [default=false]; |
||||
|
||||
// Is this field deprecated? |
||||
// Depending on the target platform, this can emit Deprecated annotations |
||||
// for accessors, or it will be completely ignored; in the very least, this |
||||
// is a formalization for deprecating fields. |
||||
optional bool deprecated = 3 [default=false]; |
||||
|
||||
// For Google-internal migration only. Do not use. |
||||
optional bool weak = 10 [default=false]; |
||||
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message EnumOptions { |
||||
|
||||
// Set this option to true to allow mapping different tag names to the same |
||||
// value. |
||||
optional bool allow_alias = 2; |
||||
|
||||
// Is this enum deprecated? |
||||
// Depending on the target platform, this can emit Deprecated annotations |
||||
// for the enum, or it will be completely ignored; in the very least, this |
||||
// is a formalization for deprecating enums. |
||||
optional bool deprecated = 3 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message EnumValueOptions { |
||||
// Is this enum value deprecated? |
||||
// Depending on the target platform, this can emit Deprecated annotations |
||||
// for the enum value, or it will be completely ignored; in the very least, |
||||
// this is a formalization for deprecating enum values. |
||||
optional bool deprecated = 1 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message ServiceOptions { |
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
||||
// framework. We apologize for hoarding these numbers to ourselves, but |
||||
// we were already using them long before we decided to release Protocol |
||||
// Buffers. |
||||
|
||||
// Is this service deprecated? |
||||
// Depending on the target platform, this can emit Deprecated annotations |
||||
// for the service, or it will be completely ignored; in the very least, |
||||
// this is a formalization for deprecating services. |
||||
optional bool deprecated = 33 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message MethodOptions { |
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
||||
// framework. We apologize for hoarding these numbers to ourselves, but |
||||
// we were already using them long before we decided to release Protocol |
||||
// Buffers. |
||||
|
||||
// Is this method deprecated? |
||||
// Depending on the target platform, this can emit Deprecated annotations |
||||
// for the method, or it will be completely ignored; in the very least, |
||||
// this is a formalization for deprecating methods. |
||||
optional bool deprecated = 33 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
|
||||
// A message representing a option the parser does not recognize. This only |
||||
// appears in options protos created by the compiler::Parser class. |
||||
// DescriptorPool resolves these when building Descriptor objects. Therefore, |
||||
// options protos in descriptor objects (e.g. returned by Descriptor::options(), |
||||
// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions |
||||
// in them. |
||||
message UninterpretedOption { |
||||
// The name of the uninterpreted option. Each string represents a segment in |
||||
// a dot-separated name. is_extension is true iff a segment represents an |
||||
// extension (denoted with parentheses in options specs in .proto files). |
||||
// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents |
||||
// "foo.(bar.baz).qux". |
||||
message NamePart { |
||||
required string name_part = 1; |
||||
required bool is_extension = 2; |
||||
} |
||||
repeated NamePart name = 2; |
||||
|
||||
// The value of the uninterpreted option, in whatever type the tokenizer |
||||
// identified it as during parsing. Exactly one of these should be set. |
||||
optional string identifier_value = 3; |
||||
optional uint64 positive_int_value = 4; |
||||
optional int64 negative_int_value = 5; |
||||
optional double double_value = 6; |
||||
optional bytes string_value = 7; |
||||
optional string aggregate_value = 8; |
||||
} |
||||
|
||||
// =================================================================== |
||||
// Optional source code info |
||||
|
||||
// Encapsulates information about the original source file from which a |
||||
// FileDescriptorProto was generated. |
||||
message SourceCodeInfo { |
||||
// A Location identifies a piece of source code in a .proto file which |
||||
// corresponds to a particular definition. This information is intended |
||||
// to be useful to IDEs, code indexers, documentation generators, and similar |
||||
// tools. |
||||
// |
||||
// For example, say we have a file like: |
||||
// message Foo { |
||||
// optional string foo = 1; |
||||
// } |
||||
// Let's look at just the field definition: |
||||
// optional string foo = 1; |
||||
// ^ ^^ ^^ ^ ^^^ |
||||
// a bc de f ghi |
||||
// We have the following locations: |
||||
// span path represents |
||||
// [a,i) [ 4, 0, 2, 0 ] The whole field definition. |
||||
// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). |
||||
// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). |
||||
// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). |
||||
// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). |
||||
// |
||||
// Notes: |
||||
// - A location may refer to a repeated field itself (i.e. not to any |
||||
// particular index within it). This is used whenever a set of elements are |
||||
// logically enclosed in a single code segment. For example, an entire |
||||
// extend block (possibly containing multiple extension definitions) will |
||||
// have an outer location whose path refers to the "extensions" repeated |
||||
// field without an index. |
||||
// - Multiple locations may have the same path. This happens when a single |
||||
// logical declaration is spread out across multiple places. The most |
||||
// obvious example is the "extend" block again -- there may be multiple |
||||
// extend blocks in the same scope, each of which will have the same path. |
||||
// - A location's span is not always a subset of its parent's span. For |
||||
// example, the "extendee" of an extension declaration appears at the |
||||
// beginning of the "extend" block and is shared by all extensions within |
||||
// the block. |
||||
// - Just because a location's span is a subset of some other location's span |
||||
// does not mean that it is a descendent. For example, a "group" defines |
||||
// both a type and a field in a single declaration. Thus, the locations |
||||
// corresponding to the type and field and their components will overlap. |
||||
// - Code which tries to interpret locations should probably be designed to |
||||
// ignore those that it doesn't understand, as more types of locations could |
||||
// be recorded in the future. |
||||
repeated Location location = 1; |
||||
message Location { |
||||
// Identifies which part of the FileDescriptorProto was defined at this |
||||
// location. |
||||
// |
||||
// Each element is a field number or an index. They form a path from |
||||
// the root FileDescriptorProto to the place where the definition. For |
||||
// example, this path: |
||||
// [ 4, 3, 2, 7, 1 ] |
||||
// refers to: |
||||
// file.message_type(3) // 4, 3 |
||||
// .field(7) // 2, 7 |
||||
// .name() // 1 |
||||
// This is because FileDescriptorProto.message_type has field number 4: |
||||
// repeated DescriptorProto message_type = 4; |
||||
// and DescriptorProto.field has field number 2: |
||||
// repeated FieldDescriptorProto field = 2; |
||||
// and FieldDescriptorProto.name has field number 1: |
||||
// optional string name = 1; |
||||
// |
||||
// Thus, the above path gives the location of a field name. If we removed |
||||
// the last element: |
||||
// [ 4, 3, 2, 7 ] |
||||
// this path refers to the whole field declaration (from the beginning |
||||
// of the label to the terminating semicolon). |
||||
repeated int32 path = 1 [packed=true]; |
||||
|
||||
// Always has exactly three or four elements: start line, start column, |
||||
// end line (optional, otherwise assumed same as start line), end column. |
||||
// These are packed into a single field for efficiency. Note that line |
||||
// and column numbers are zero-based -- typically you will want to add |
||||
// 1 to each before displaying to a user. |
||||
repeated int32 span = 2 [packed=true]; |
||||
|
||||
// If this SourceCodeInfo represents a complete declaration, these are any |
||||
// comments appearing before and after the declaration which appear to be |
||||
// attached to the declaration. |
||||
// |
||||
// A series of line comments appearing on consecutive lines, with no other |
||||
// tokens appearing on those lines, will be treated as a single comment. |
||||
// |
||||
// leading_detached_comments will keep paragraphs of comments that appear |
||||
// before (but not connected to) the current element. Each paragraph, |
||||
// separated by empty lines, will be one comment element in the repeated |
||||
// field. |
||||
// |
||||
// Only the comment content is provided; comment markers (e.g. //) are |
||||
// stripped out. For block comments, leading whitespace and an asterisk |
||||
// will be stripped from the beginning of each line other than the first. |
||||
// Newlines are included in the output. |
||||
// |
||||
// Examples: |
||||
// |
||||
// optional int32 foo = 1; // Comment attached to foo. |
||||
// // Comment attached to bar. |
||||
// optional int32 bar = 2; |
||||
// |
||||
// optional string baz = 3; |
||||
// // Comment attached to baz. |
||||
// // Another line attached to baz. |
||||
// |
||||
// // Comment attached to qux. |
||||
// // |
||||
// // Another line attached to qux. |
||||
// optional double qux = 4; |
||||
// |
||||
// // Detached comment for corge. This is not leading or trailing comments |
||||
// // to qux or corge because there are blank lines separating it from |
||||
// // both. |
||||
// |
||||
// // Detached comment for corge paragraph 2. |
||||
// |
||||
// optional string corge = 5; |
||||
// /* Block comment attached |
||||
// * to corge. Leading asterisks |
||||
// * will be removed. */ |
||||
// /* Block comment attached to |
||||
// * grault. */ |
||||
// optional int32 grault = 6; |
||||
// |
||||
// // ignored detached comments. |
||||
optional string leading_comments = 3; |
||||
optional string trailing_comments = 4; |
||||
repeated string leading_detached_comments = 6; |
||||
} |
||||
} |
@ -1,927 +0,0 @@ |
||||
/* 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. */ |
||||
|
||||
#include "upb/def.h" |
||||
#include "upb/structdefs.int.h" |
||||
|
||||
static const upb_msgdef msgs[22]; |
||||
static const upb_fielddef fields[107]; |
||||
static const upb_enumdef enums[5]; |
||||
static const upb_tabent strentries[236]; |
||||
static const upb_tabent intentries[18]; |
||||
static const upb_tabval arrays[187]; |
||||
|
||||
#ifdef UPB_DEBUG_REFS |
||||
static upb_inttable reftables[268]; |
||||
#endif |
||||
|
||||
static const upb_msgdef msgs[22] = { |
||||
UPB_MSGDEF_INIT("google.protobuf.DescriptorProto", 41, 8, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[0], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[0]), false, UPB_SYNTAX_PROTO2, &reftables[0], &reftables[1]), |
||||
UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ExtensionRange", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[11], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[16]), false, UPB_SYNTAX_PROTO2, &reftables[2], &reftables[3]), |
||||
UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ReservedRange", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[14], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[20]), false, UPB_SYNTAX_PROTO2, &reftables[4], &reftables[5]), |
||||
UPB_MSGDEF_INIT("google.protobuf.EnumDescriptorProto", 12, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[17], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[24]), false, UPB_SYNTAX_PROTO2, &reftables[6], &reftables[7]), |
||||
UPB_MSGDEF_INIT("google.protobuf.EnumOptions", 9, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[0], &arrays[21], 4, 2), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[28]), false, UPB_SYNTAX_PROTO2, &reftables[8], &reftables[9]), |
||||
UPB_MSGDEF_INIT("google.protobuf.EnumValueDescriptorProto", 9, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[25], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[32]), false, UPB_SYNTAX_PROTO2, &reftables[10], &reftables[11]), |
||||
UPB_MSGDEF_INIT("google.protobuf.EnumValueOptions", 8, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[2], &arrays[29], 2, 1), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[36]), false, UPB_SYNTAX_PROTO2, &reftables[12], &reftables[13]), |
||||
UPB_MSGDEF_INIT("google.protobuf.FieldDescriptorProto", 24, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[31], 11, 10), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &strentries[40]), false, UPB_SYNTAX_PROTO2, &reftables[14], &reftables[15]), |
||||
UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 13, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[4], &arrays[42], 11, 6), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[56]), false, UPB_SYNTAX_PROTO2, &reftables[16], &reftables[17]), |
||||
UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 43, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[53], 13, 12), UPB_STRTABLE_INIT(12, 15, UPB_CTYPE_PTR, 4, &strentries[72]), false, UPB_SYNTAX_PROTO2, &reftables[18], &reftables[19]), |
||||
UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 7, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[66], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[88]), false, UPB_SYNTAX_PROTO2, &reftables[20], &reftables[21]), |
||||
UPB_MSGDEF_INIT("google.protobuf.FileOptions", 38, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[6], &arrays[68], 42, 17), UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_PTR, 5, &strentries[92]), false, UPB_SYNTAX_PROTO2, &reftables[22], &reftables[23]), |
||||
UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 11, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[8], &arrays[110], 8, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[124]), false, UPB_SYNTAX_PROTO2, &reftables[24], &reftables[25]), |
||||
UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 16, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[118], 7, 6), UPB_STRTABLE_INIT(6, 7, UPB_CTYPE_PTR, 3, &strentries[132]), false, UPB_SYNTAX_PROTO2, &reftables[26], &reftables[27]), |
||||
UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 8, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[10], &arrays[125], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[140]), false, UPB_SYNTAX_PROTO2, &reftables[28], &reftables[29]), |
||||
UPB_MSGDEF_INIT("google.protobuf.OneofDescriptorProto", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[126], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[144]), false, UPB_SYNTAX_PROTO2, &reftables[30], &reftables[31]), |
||||
UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 12, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[128], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[148]), false, UPB_SYNTAX_PROTO2, &reftables[32], &reftables[33]), |
||||
UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 8, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[14], &arrays[132], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[152]), false, UPB_SYNTAX_PROTO2, &reftables[34], &reftables[35]), |
||||
UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 7, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[133], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[156]), false, UPB_SYNTAX_PROTO2, &reftables[36], &reftables[37]), |
||||
UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 20, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[135], 7, 5), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[160]), false, UPB_SYNTAX_PROTO2, &reftables[38], &reftables[39]), |
||||
UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 19, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[142], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[168]), false, UPB_SYNTAX_PROTO2, &reftables[40], &reftables[41]), |
||||
UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 7, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[151], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[184]), false, UPB_SYNTAX_PROTO2, &reftables[42], &reftables[43]), |
||||
}; |
||||
|
||||
static const upb_fielddef fields[107] = { |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "aggregate_value", 8, &msgs[20], NULL, 16, 6, {0},&reftables[44], &reftables[45]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "allow_alias", 2, &msgs[4], NULL, 7, 1, {0},&reftables[46], &reftables[47]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_enable_arenas", 31, &msgs[11], NULL, 24, 12, {0},&reftables[48], &reftables[49]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_generic_services", 16, &msgs[11], NULL, 18, 6, {0},&reftables[50], &reftables[51]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "client_streaming", 5, &msgs[13], NULL, 14, 4, {0},&reftables[52], &reftables[53]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "csharp_namespace", 37, &msgs[11], NULL, 28, 14, {0},&reftables[54], &reftables[55]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "ctype", 1, &msgs[8], (const upb_def*)(&enums[2]), 7, 1, {0},&reftables[56], &reftables[57]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "default_value", 7, &msgs[7], NULL, 17, 7, {0},&reftables[58], &reftables[59]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "dependency", 3, &msgs[9], NULL, 31, 8, {0},&reftables[60], &reftables[61]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[8], NULL, 9, 3, {0},&reftables[62], &reftables[63]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[14], NULL, 7, 1, {0},&reftables[64], &reftables[65]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[12], NULL, 9, 3, {0},&reftables[66], &reftables[67]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 23, &msgs[11], NULL, 22, 10, {0},&reftables[68], &reftables[69]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 1, &msgs[6], NULL, 7, 1, {0},&reftables[70], &reftables[71]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[4], NULL, 8, 2, {0},&reftables[72], &reftables[73]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[17], NULL, 7, 1, {0},&reftables[74], &reftables[75]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, false, false, "double_value", 6, &msgs[20], NULL, 12, 4, {0},&reftables[76], &reftables[77]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[2], NULL, 4, 1, {0},&reftables[78], &reftables[79]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[1], NULL, 4, 1, {0},&reftables[80], &reftables[81]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 5, &msgs[9], (const upb_def*)(&msgs[3]), 14, 1, {0},&reftables[82], &reftables[83]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 4, &msgs[0], (const upb_def*)(&msgs[3]), 19, 2, {0},&reftables[84], &reftables[85]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "extendee", 2, &msgs[7], NULL, 8, 2, {0},&reftables[86], &reftables[87]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 6, &msgs[0], (const upb_def*)(&msgs[7]), 25, 4, {0},&reftables[88], &reftables[89]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 7, &msgs[9], (const upb_def*)(&msgs[7]), 20, 3, {0},&reftables[90], &reftables[91]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension_range", 5, &msgs[0], (const upb_def*)(&msgs[1]), 22, 3, {0},&reftables[92], &reftables[93]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "field", 2, &msgs[0], (const upb_def*)(&msgs[7]), 13, 0, {0},&reftables[94], &reftables[95]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "file", 1, &msgs[10], (const upb_def*)(&msgs[9]), 6, 0, {0},&reftables[96], &reftables[97]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "go_package", 11, &msgs[11], NULL, 15, 5, {0},&reftables[98], &reftables[99]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "identifier_value", 3, &msgs[20], NULL, 7, 1, {0},&reftables[100], &reftables[101]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "input_type", 2, &msgs[13], NULL, 8, 2, {0},&reftables[102], &reftables[103]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_BOOL, 0, false, false, false, false, "is_extension", 2, &msgs[21], NULL, 6, 1, {0},&reftables[104], &reftables[105]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generate_equals_and_hash", 20, &msgs[11], NULL, 21, 9, {0},&reftables[106], &reftables[107]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_generic_services", 17, &msgs[11], NULL, 19, 7, {0},&reftables[108], &reftables[109]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_multiple_files", 10, &msgs[11], NULL, 14, 4, {0},&reftables[110], &reftables[111]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_outer_classname", 8, &msgs[11], NULL, 10, 2, {0},&reftables[112], &reftables[113]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "java_package", 1, &msgs[11], NULL, 7, 1, {0},&reftables[114], &reftables[115]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "java_string_check_utf8", 27, &msgs[11], NULL, 23, 11, {0},&reftables[116], &reftables[117]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "javanano_use_deprecated_package", 38, &msgs[11], NULL, 31, 15, {0},&reftables[118], &reftables[119]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "json_name", 10, &msgs[7], NULL, 21, 9, {0},&reftables[120], &reftables[121]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "jstype", 6, &msgs[8], (const upb_def*)(&enums[3]), 11, 5, {0},&reftables[122], &reftables[123]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "label", 4, &msgs[7], (const upb_def*)(&enums[0]), 12, 4, {0},&reftables[124], &reftables[125]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "lazy", 5, &msgs[8], NULL, 10, 4, {0},&reftables[126], &reftables[127]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "leading_comments", 3, &msgs[19], NULL, 9, 2, {0},&reftables[128], &reftables[129]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "leading_detached_comments", 6, &msgs[19], NULL, 17, 4, {0},&reftables[130], &reftables[131]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "location", 1, &msgs[18], (const upb_def*)(&msgs[19]), 6, 0, {0},&reftables[132], &reftables[133]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "map_entry", 7, &msgs[12], NULL, 10, 4, {0},&reftables[134], &reftables[135]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "message_set_wire_format", 1, &msgs[12], NULL, 7, 1, {0},&reftables[136], &reftables[137]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "message_type", 4, &msgs[9], (const upb_def*)(&msgs[0]), 11, 0, {0},&reftables[138], &reftables[139]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "method", 2, &msgs[16], (const upb_def*)(&msgs[13]), 7, 0, {0},&reftables[140], &reftables[141]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 6, 0, {0},&reftables[142], &reftables[143]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 5, 1, {0},&reftables[144], &reftables[145]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 23, 6, {0},&reftables[146], &reftables[147]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 9, 2, {0},&reftables[148], &reftables[149]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 9, 2, {0},&reftables[150], &reftables[151]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 3, 0, {0},&reftables[152], &reftables[153]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 5, 1, {0},&reftables[154], &reftables[155]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 5, 1, {0},&reftables[156], &reftables[157]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 33, 8, {0},&reftables[158], &reftables[159]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, false, "name_part", 1, &msgs[21], NULL, 3, 0, {0},&reftables[160], &reftables[161]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, false, "negative_int_value", 5, &msgs[20], NULL, 11, 3, {0},&reftables[162], &reftables[163]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "nested_type", 3, &msgs[0], (const upb_def*)(&msgs[0]), 16, 1, {0},&reftables[164], &reftables[165]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "no_standard_descriptor_accessor", 2, &msgs[12], NULL, 8, 2, {0},&reftables[166], &reftables[167]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 3, &msgs[7], NULL, 11, 3, {0},&reftables[168], &reftables[169]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 2, &msgs[5], NULL, 8, 2, {0},&reftables[170], &reftables[171]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "objc_class_prefix", 36, &msgs[11], NULL, 25, 13, {0},&reftables[172], &reftables[173]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "oneof_decl", 8, &msgs[0], (const upb_def*)(&msgs[15]), 29, 6, {0},&reftables[174], &reftables[175]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "oneof_index", 9, &msgs[7], NULL, 20, 8, {0},&reftables[176], &reftables[177]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "optimize_for", 9, &msgs[11], (const upb_def*)(&enums[4]), 13, 3, {0},&reftables[178], &reftables[179]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 26, 5, {0},&reftables[180], &reftables[181]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 21, 4, {0},&reftables[182], &reftables[183]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 4, 0, {0},&reftables[184], &reftables[185]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 4, 0, {0},&reftables[186], &reftables[187]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 8, 1, {0},&reftables[188], &reftables[189]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 8, 1, {0},&reftables[190], &reftables[191]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 4, 0, {0},&reftables[192], &reftables[193]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "output_type", 3, &msgs[13], NULL, 11, 3, {0},&reftables[194], &reftables[195]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "package", 2, &msgs[9], NULL, 26, 7, {0},&reftables[196], &reftables[197]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "packed", 2, &msgs[8], NULL, 8, 2, {0},&reftables[198], &reftables[199]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "path", 1, &msgs[19], NULL, 5, 0, {0},&reftables[200], &reftables[201]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_class_prefix", 40, &msgs[11], NULL, 32, 16, {0},&reftables[202], &reftables[203]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_namespace", 41, &msgs[11], NULL, 35, 17, {0},&reftables[204], &reftables[205]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, false, "positive_int_value", 4, &msgs[20], NULL, 10, 2, {0},&reftables[206], &reftables[207]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "public_dependency", 10, &msgs[9], NULL, 36, 9, {0},&reftables[208], &reftables[209]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "py_generic_services", 18, &msgs[11], NULL, 20, 8, {0},&reftables[210], &reftables[211]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "reserved_name", 10, &msgs[0], NULL, 38, 9, {0},&reftables[212], &reftables[213]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "reserved_range", 9, &msgs[0], (const upb_def*)(&msgs[2]), 32, 7, {0},&reftables[214], &reftables[215]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "server_streaming", 6, &msgs[13], NULL, 15, 5, {0},&reftables[216], &reftables[217]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 17, 2, {0},&reftables[218], &reftables[219]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 22, 5, {0},&reftables[220], &reftables[221]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 8, 1, {0},&reftables[222], &reftables[223]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 3, 0, {0},&reftables[224], &reftables[225]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 3, 0, {0},&reftables[226], &reftables[227]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 13, 5, {0},&reftables[228], &reftables[229]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 40, 11, {0},&reftables[230], &reftables[231]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 12, 3, {0},&reftables[232], &reftables[233]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 13, 5, {0},&reftables[234], &reftables[235]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 14, 6, {0},&reftables[236], &reftables[237]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[12], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[238], &reftables[239]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[240], &reftables[241]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[242], &reftables[243]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[244], &reftables[245]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[246], &reftables[247]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[248], &reftables[249]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 6, 0, {0},&reftables[250], &reftables[251]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 7, 0, {0},&reftables[252], &reftables[253]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 12, 6, {0},&reftables[254], &reftables[255]), |
||||
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 39, 10, {0},&reftables[256], &reftables[257]), |
||||
}; |
||||
|
||||
static const upb_enumdef enums[5] = { |
||||
UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Label", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[188]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[154], 4, 3), 0, &reftables[258], &reftables[259]), |
||||
UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Type", UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_INT32, 5, &strentries[192]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[158], 19, 18), 0, &reftables[260], &reftables[261]), |
||||
UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.CType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[224]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[177], 3, 3), 0, &reftables[262], &reftables[263]), |
||||
UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.JSType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[228]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[180], 3, 3), 0, &reftables[264], &reftables[265]), |
||||
UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[232]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[183], 4, 3), 0, &reftables[266], &reftables[267]), |
||||
}; |
||||
|
||||
static const upb_tabent strentries[236] = { |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "extension"), UPB_TABVALUE_PTR_INIT(&fields[22]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\015", "\000", "\000", "\000", "reserved_name"), UPB_TABVALUE_PTR_INIT(&fields[84]), NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[57]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "field"), UPB_TABVALUE_PTR_INIT(&fields[25]), &strentries[12]}, |
||||
{UPB_TABKEY_STR("\017", "\000", "\000", "\000", "extension_range"), UPB_TABVALUE_PTR_INIT(&fields[24]), &strentries[14]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "nested_type"), UPB_TABVALUE_PTR_INIT(&fields[60]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\016", "\000", "\000", "\000", "reserved_range"), UPB_TABVALUE_PTR_INIT(&fields[85]), NULL}, |
||||
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[68]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "oneof_decl"), UPB_TABVALUE_PTR_INIT(&fields[65]), NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[20]), &strentries[13]}, |
||||
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[91]), NULL}, |
||||
{UPB_TABKEY_STR("\003", "\000", "\000", "\000", "end"), UPB_TABVALUE_PTR_INIT(&fields[18]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[90]), NULL}, |
||||
{UPB_TABKEY_STR("\003", "\000", "\000", "\000", "end"), UPB_TABVALUE_PTR_INIT(&fields[17]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "value"), UPB_TABVALUE_PTR_INIT(&fields[104]), NULL}, |
||||
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[73]), NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[52]), &strentries[26]}, |
||||
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[103]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[14]), NULL}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "allow_alias"), UPB_TABVALUE_PTR_INIT(&fields[1]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[63]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[74]), NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[50]), &strentries[34]}, |
||||
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[102]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[13]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "oneof_index"), UPB_TABVALUE_PTR_INIT(&fields[66]), NULL}, |
||||
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "label"), UPB_TABVALUE_PTR_INIT(&fields[40]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[56]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[62]), &strentries[53]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\010", "\000", "\000", "\000", "extendee"), UPB_TABVALUE_PTR_INIT(&fields[21]), NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "type_name"), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "json_name"), UPB_TABVALUE_PTR_INIT(&fields[38]), NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "type"), UPB_TABVALUE_PTR_INIT(&fields[95]), &strentries[50]}, |
||||
{UPB_TABKEY_STR("\015", "\000", "\000", "\000", "default_value"), UPB_TABVALUE_PTR_INIT(&fields[7]), NULL}, |
||||
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[70]), NULL}, |
||||
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "weak"), UPB_TABVALUE_PTR_INIT(&fields[105]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "packed"), UPB_TABVALUE_PTR_INIT(&fields[77]), NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "lazy"), UPB_TABVALUE_PTR_INIT(&fields[41]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "ctype"), UPB_TABVALUE_PTR_INIT(&fields[6]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "jstype"), UPB_TABVALUE_PTR_INIT(&fields[39]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[9]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "extension"), UPB_TABVALUE_PTR_INIT(&fields[23]), NULL}, |
||||
{UPB_TABKEY_STR("\017", "\000", "\000", "\000", "weak_dependency"), UPB_TABVALUE_PTR_INIT(&fields[106]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[51]), NULL}, |
||||
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "service"), UPB_TABVALUE_PTR_INIT(&fields[87]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "source_code_info"), UPB_TABVALUE_PTR_INIT(&fields[88]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "syntax"), UPB_TABVALUE_PTR_INIT(&fields[93]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "dependency"), UPB_TABVALUE_PTR_INIT(&fields[8]), NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "message_type"), UPB_TABVALUE_PTR_INIT(&fields[47]), NULL}, |
||||
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "package"), UPB_TABVALUE_PTR_INIT(&fields[76]), NULL}, |
||||
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[69]), &strentries[86]}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[19]), NULL}, |
||||
{UPB_TABKEY_STR("\021", "\000", "\000", "\000", "public_dependency"), UPB_TABVALUE_PTR_INIT(&fields[82]), &strentries[85]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "file"), UPB_TABVALUE_PTR_INIT(&fields[26]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\023", "\000", "\000", "\000", "cc_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[3]), NULL}, |
||||
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "csharp_namespace"), UPB_TABVALUE_PTR_INIT(&fields[5]), &strentries[116]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "go_package"), UPB_TABVALUE_PTR_INIT(&fields[27]), NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "java_package"), UPB_TABVALUE_PTR_INIT(&fields[35]), &strentries[120]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "java_outer_classname"), UPB_TABVALUE_PTR_INIT(&fields[34]), NULL}, |
||||
{UPB_TABKEY_STR("\015", "\000", "\000", "\000", "php_namespace"), UPB_TABVALUE_PTR_INIT(&fields[80]), &strentries[113]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\023", "\000", "\000", "\000", "java_multiple_files"), UPB_TABVALUE_PTR_INIT(&fields[33]), &strentries[117]}, |
||||
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL}, |
||||
{UPB_TABKEY_STR("\025", "\000", "\000", "\000", "java_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[32]), &strentries[118]}, |
||||
{UPB_TABKEY_STR("\035", "\000", "\000", "\000", "java_generate_equals_and_hash"), UPB_TABVALUE_PTR_INIT(&fields[31]), NULL}, |
||||
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "php_class_prefix"), UPB_TABVALUE_PTR_INIT(&fields[79]), NULL}, |
||||
{UPB_TABKEY_STR("\037", "\000", "\000", "\000", "javanano_use_deprecated_package"), UPB_TABVALUE_PTR_INIT(&fields[37]), &strentries[123]}, |
||||
{UPB_TABKEY_STR("\023", "\000", "\000", "\000", "py_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[83]), NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "optimize_for"), UPB_TABVALUE_PTR_INIT(&fields[67]), NULL}, |
||||
{UPB_TABKEY_STR("\026", "\000", "\000", "\000", "java_string_check_utf8"), UPB_TABVALUE_PTR_INIT(&fields[36]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[12]), &strentries[119]}, |
||||
{UPB_TABKEY_STR("\021", "\000", "\000", "\000", "objc_class_prefix"), UPB_TABVALUE_PTR_INIT(&fields[64]), NULL}, |
||||
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "cc_enable_arenas"), UPB_TABVALUE_PTR_INIT(&fields[2]), NULL}, |
||||
{UPB_TABKEY_STR("\027", "\000", "\000", "\000", "message_set_wire_format"), UPB_TABVALUE_PTR_INIT(&fields[46]), &strentries[128]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[11]), NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "map_entry"), UPB_TABVALUE_PTR_INIT(&fields[45]), NULL}, |
||||
{UPB_TABKEY_STR("\037", "\000", "\000", "\000", "no_standard_descriptor_accessor"), UPB_TABVALUE_PTR_INIT(&fields[61]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "client_streaming"), UPB_TABVALUE_PTR_INIT(&fields[4]), NULL}, |
||||
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "server_streaming"), UPB_TABVALUE_PTR_INIT(&fields[86]), NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[55]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "input_type"), UPB_TABVALUE_PTR_INIT(&fields[29]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "output_type"), UPB_TABVALUE_PTR_INIT(&fields[75]), NULL}, |
||||
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[71]), NULL}, |
||||
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[10]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[54]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[72]), &strentries[150]}, |
||||
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "method"), UPB_TABVALUE_PTR_INIT(&fields[48]), NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[53]), &strentries[149]}, |
||||
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[15]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\010", "\000", "\000", "\000", "location"), UPB_TABVALUE_PTR_INIT(&fields[44]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "span"), UPB_TABVALUE_PTR_INIT(&fields[89]), &strentries[167]}, |
||||
{UPB_TABKEY_STR("\031", "\000", "\000", "\000", "leading_detached_comments"), UPB_TABVALUE_PTR_INIT(&fields[43]), &strentries[165]}, |
||||
{UPB_TABKEY_STR("\021", "\000", "\000", "\000", "trailing_comments"), UPB_TABVALUE_PTR_INIT(&fields[94]), NULL}, |
||||
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "leading_comments"), UPB_TABVALUE_PTR_INIT(&fields[42]), &strentries[164]}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "path"), UPB_TABVALUE_PTR_INIT(&fields[78]), NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "double_value"), UPB_TABVALUE_PTR_INIT(&fields[16]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[49]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\022", "\000", "\000", "\000", "negative_int_value"), UPB_TABVALUE_PTR_INIT(&fields[59]), NULL}, |
||||
{UPB_TABKEY_STR("\017", "\000", "\000", "\000", "aggregate_value"), UPB_TABVALUE_PTR_INIT(&fields[0]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\022", "\000", "\000", "\000", "positive_int_value"), UPB_TABVALUE_PTR_INIT(&fields[81]), NULL}, |
||||
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "identifier_value"), UPB_TABVALUE_PTR_INIT(&fields[28]), NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "string_value"), UPB_TABVALUE_PTR_INIT(&fields[92]), &strentries[182]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "is_extension"), UPB_TABVALUE_PTR_INIT(&fields[30]), NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "name_part"), UPB_TABVALUE_PTR_INIT(&fields[58]), NULL}, |
||||
{UPB_TABKEY_STR("\016", "\000", "\000", "\000", "LABEL_REQUIRED"), UPB_TABVALUE_INT_INIT(2), &strentries[190]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\016", "\000", "\000", "\000", "LABEL_REPEATED"), UPB_TABVALUE_INT_INIT(3), NULL}, |
||||
{UPB_TABKEY_STR("\016", "\000", "\000", "\000", "LABEL_OPTIONAL"), UPB_TABVALUE_INT_INIT(1), NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "TYPE_FIXED64"), UPB_TABVALUE_INT_INIT(6), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "TYPE_STRING"), UPB_TABVALUE_INT_INIT(9), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "TYPE_FLOAT"), UPB_TABVALUE_INT_INIT(2), &strentries[221]}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "TYPE_DOUBLE"), UPB_TABVALUE_INT_INIT(1), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "TYPE_INT32"), UPB_TABVALUE_INT_INIT(5), NULL}, |
||||
{UPB_TABKEY_STR("\015", "\000", "\000", "\000", "TYPE_SFIXED32"), UPB_TABVALUE_INT_INIT(15), NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "TYPE_FIXED32"), UPB_TABVALUE_INT_INIT(7), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "TYPE_MESSAGE"), UPB_TABVALUE_INT_INIT(11), &strentries[222]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "TYPE_INT64"), UPB_TABVALUE_INT_INIT(3), &strentries[219]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "TYPE_ENUM"), UPB_TABVALUE_INT_INIT(14), NULL}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "TYPE_UINT32"), UPB_TABVALUE_INT_INIT(13), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "TYPE_UINT64"), UPB_TABVALUE_INT_INIT(4), &strentries[218]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\015", "\000", "\000", "\000", "TYPE_SFIXED64"), UPB_TABVALUE_INT_INIT(16), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "TYPE_BYTES"), UPB_TABVALUE_INT_INIT(12), NULL}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "TYPE_SINT64"), UPB_TABVALUE_INT_INIT(18), NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "TYPE_BOOL"), UPB_TABVALUE_INT_INIT(8), NULL}, |
||||
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "TYPE_GROUP"), UPB_TABVALUE_INT_INIT(10), NULL}, |
||||
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "TYPE_SINT32"), UPB_TABVALUE_INT_INIT(17), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "CORD"), UPB_TABVALUE_INT_INIT(1), NULL}, |
||||
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "STRING"), UPB_TABVALUE_INT_INIT(0), &strentries[225]}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "STRING_PIECE"), UPB_TABVALUE_INT_INIT(2), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "JS_NORMAL"), UPB_TABVALUE_INT_INIT(0), NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "JS_NUMBER"), UPB_TABVALUE_INT_INIT(2), NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "JS_STRING"), UPB_TABVALUE_INT_INIT(1), NULL}, |
||||
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "CODE_SIZE"), UPB_TABVALUE_INT_INIT(2), NULL}, |
||||
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "SPEED"), UPB_TABVALUE_INT_INIT(1), &strentries[235]}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "LITE_RUNTIME"), UPB_TABVALUE_INT_INIT(3), NULL}, |
||||
}; |
||||
|
||||
static const upb_tabent intentries[18] = { |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[103]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[102]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[10]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[15]), NULL}, |
||||
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, |
||||
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL}, |
||||
}; |
||||
|
||||
static const upb_tabval arrays[187] = { |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[57]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[25]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[60]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[20]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[24]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[22]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[68]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[65]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[85]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[84]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[91]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[18]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[90]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[17]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[52]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[104]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[73]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[1]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[14]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[50]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[63]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[74]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[13]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[56]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[21]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[62]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[40]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[95]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[96]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[7]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[70]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[66]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[38]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[6]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[77]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[9]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[41]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[39]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[105]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[51]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[76]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[8]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[47]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[19]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[87]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[23]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[69]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[88]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[82]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[106]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[93]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[26]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[35]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[34]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[67]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[33]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[27]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[3]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[32]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[83]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[31]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[12]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[36]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[2]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[64]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[5]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[37]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[79]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[80]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[46]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[61]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[11]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[45]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[55]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[29]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[75]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[71]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[4]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[86]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[54]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[53]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[48]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[72]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[44]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[78]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[89]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[42]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[94]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[43]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[49]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[28]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[81]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[59]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[16]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[92]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[0]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT(&fields[58]), |
||||
UPB_TABVALUE_PTR_INIT(&fields[30]), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT("LABEL_OPTIONAL"), |
||||
UPB_TABVALUE_PTR_INIT("LABEL_REQUIRED"), |
||||
UPB_TABVALUE_PTR_INIT("LABEL_REPEATED"), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT("TYPE_DOUBLE"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_FLOAT"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_INT64"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_UINT64"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_INT32"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_FIXED64"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_FIXED32"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_BOOL"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_STRING"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_GROUP"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_MESSAGE"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_BYTES"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_UINT32"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_ENUM"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_SFIXED32"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_SFIXED64"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_SINT32"), |
||||
UPB_TABVALUE_PTR_INIT("TYPE_SINT64"), |
||||
UPB_TABVALUE_PTR_INIT("STRING"), |
||||
UPB_TABVALUE_PTR_INIT("CORD"), |
||||
UPB_TABVALUE_PTR_INIT("STRING_PIECE"), |
||||
UPB_TABVALUE_PTR_INIT("JS_NORMAL"), |
||||
UPB_TABVALUE_PTR_INIT("JS_STRING"), |
||||
UPB_TABVALUE_PTR_INIT("JS_NUMBER"), |
||||
UPB_TABVALUE_EMPTY_INIT, |
||||
UPB_TABVALUE_PTR_INIT("SPEED"), |
||||
UPB_TABVALUE_PTR_INIT("CODE_SIZE"), |
||||
UPB_TABVALUE_PTR_INIT("LITE_RUNTIME"), |
||||
}; |
||||
|
||||
#ifdef UPB_DEBUG_REFS |
||||
static upb_inttable reftables[268] = { |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), |
||||
}; |
||||
#endif |
||||
|
||||
static const upb_msgdef *refm(const upb_msgdef *m, const void *owner) { |
||||
upb_msgdef_ref(m, owner); |
||||
return m; |
||||
} |
||||
|
||||
static const upb_enumdef *refe(const upb_enumdef *e, const void *owner) { |
||||
upb_enumdef_ref(e, owner); |
||||
return e; |
||||
} |
||||
|
||||
/* Public API. */ |
||||
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_get(const void *owner) { return refm(&msgs[0], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get(const void *owner) { return refm(&msgs[1], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_get(const void *owner) { return refm(&msgs[2], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_EnumDescriptorProto_get(const void *owner) { return refm(&msgs[3], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_EnumOptions_get(const void *owner) { return refm(&msgs[4], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_EnumValueDescriptorProto_get(const void *owner) { return refm(&msgs[5], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_EnumValueOptions_get(const void *owner) { return refm(&msgs[6], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_FieldDescriptorProto_get(const void *owner) { return refm(&msgs[7], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_FieldOptions_get(const void *owner) { return refm(&msgs[8], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_FileDescriptorProto_get(const void *owner) { return refm(&msgs[9], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_FileDescriptorSet_get(const void *owner) { return refm(&msgs[10], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_FileOptions_get(const void *owner) { return refm(&msgs[11], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_MessageOptions_get(const void *owner) { return refm(&msgs[12], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_MethodDescriptorProto_get(const void *owner) { return refm(&msgs[13], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_MethodOptions_get(const void *owner) { return refm(&msgs[14], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_OneofDescriptorProto_get(const void *owner) { return refm(&msgs[15], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_ServiceDescriptorProto_get(const void *owner) { return refm(&msgs[16], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_ServiceOptions_get(const void *owner) { return refm(&msgs[17], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo_get(const void *owner) { return refm(&msgs[18], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo_Location_get(const void *owner) { return refm(&msgs[19], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption_get(const void *owner) { return refm(&msgs[20], owner); } |
||||
const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption_NamePart_get(const void *owner) { return refm(&msgs[21], owner); } |
||||
|
||||
const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Label_get(const void *owner) { return refe(&enums[0], owner); } |
||||
const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Type_get(const void *owner) { return refe(&enums[1], owner); } |
||||
const upb_enumdef *upbdefs_google_protobuf_FieldOptions_CType_get(const void *owner) { return refe(&enums[2], owner); } |
||||
const upb_enumdef *upbdefs_google_protobuf_FieldOptions_JSType_get(const void *owner) { return refe(&enums[3], owner); } |
||||
const upb_enumdef *upbdefs_google_protobuf_FileOptions_OptimizeMode_get(const void *owner) { return refe(&enums[4], owner); } |
@ -1,608 +0,0 @@ |
||||
/* This file contains accessors for a set of compiled-in defs.
|
||||
* Note that unlike Google's protobuf, it does *not* define |
||||
* generated classes or any other kind of data structure for |
||||
* actually storing protobufs. It only contains *defs* which |
||||
* let you reflect over a protobuf *schema*. |
||||
*/ |
||||
/* 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/def.h" |
||||
|
||||
UPB_BEGIN_EXTERN_C |
||||
|
||||
/* MessageDefs: call these functions to get a ref to a msgdef. */ |
||||
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_EnumDescriptorProto_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_EnumOptions_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_EnumValueDescriptorProto_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_EnumValueOptions_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_FieldDescriptorProto_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_FieldOptions_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_FileDescriptorProto_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_FileDescriptorSet_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_FileOptions_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_MessageOptions_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_MethodDescriptorProto_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_MethodOptions_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_OneofDescriptorProto_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_ServiceDescriptorProto_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_ServiceOptions_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo_Location_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption_get(const void *owner); |
||||
const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption_NamePart_get(const void *owner); |
||||
|
||||
/* EnumDefs: call these functions to get a ref to an enumdef. */ |
||||
const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Label_get(const void *owner); |
||||
const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Type_get(const void *owner); |
||||
const upb_enumdef *upbdefs_google_protobuf_FieldOptions_CType_get(const void *owner); |
||||
const upb_enumdef *upbdefs_google_protobuf_FieldOptions_JSType_get(const void *owner); |
||||
const upb_enumdef *upbdefs_google_protobuf_FileOptions_OptimizeMode_get(const void *owner); |
||||
|
||||
/* Functions to test whether this message is of a certain type. */ |
||||
UPB_INLINE bool upbdefs_google_protobuf_DescriptorProto_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.DescriptorProto") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_DescriptorProto_ExtensionRange_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.DescriptorProto.ExtensionRange") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_DescriptorProto_ReservedRange_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.DescriptorProto.ReservedRange") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_EnumDescriptorProto_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.EnumDescriptorProto") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_EnumOptions_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.EnumOptions") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_EnumValueDescriptorProto_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.EnumValueDescriptorProto") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_EnumValueOptions_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.EnumValueOptions") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_FieldDescriptorProto_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FieldDescriptorProto") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_FieldOptions_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FieldOptions") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_FileDescriptorProto_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FileDescriptorProto") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_FileDescriptorSet_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FileDescriptorSet") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_FileOptions_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FileOptions") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_MessageOptions_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.MessageOptions") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_MethodDescriptorProto_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.MethodDescriptorProto") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_MethodOptions_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.MethodOptions") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_OneofDescriptorProto_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.OneofDescriptorProto") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_ServiceDescriptorProto_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.ServiceDescriptorProto") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_ServiceOptions_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.ServiceOptions") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_SourceCodeInfo_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.SourceCodeInfo") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_SourceCodeInfo_Location_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.SourceCodeInfo.Location") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_UninterpretedOption_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.UninterpretedOption") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_UninterpretedOption_NamePart_is(const upb_msgdef *m) { |
||||
return strcmp(upb_msgdef_fullname(m), "google.protobuf.UninterpretedOption.NamePart") == 0; |
||||
} |
||||
|
||||
/* Functions to test whether this enum is of a certain type. */ |
||||
UPB_INLINE bool upbdefs_google_protobuf_FieldDescriptorProto_Label_is(const upb_enumdef *e) { |
||||
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FieldDescriptorProto.Label") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_FieldDescriptorProto_Type_is(const upb_enumdef *e) { |
||||
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FieldDescriptorProto.Type") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_FieldOptions_CType_is(const upb_enumdef *e) { |
||||
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FieldOptions.CType") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_FieldOptions_JSType_is(const upb_enumdef *e) { |
||||
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FieldOptions.JSType") == 0; |
||||
} |
||||
UPB_INLINE bool upbdefs_google_protobuf_FileOptions_OptimizeMode_is(const upb_enumdef *e) { |
||||
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FileOptions.OptimizeMode") == 0; |
||||
} |
||||
|
||||
|
||||
/* Functions to get a fielddef from a msgdef reference. */ |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_f_end(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_ExtensionRange_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_f_start(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_ExtensionRange_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_f_end(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_ReservedRange_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_f_start(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_ReservedRange_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_enum_type(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 4); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_extension(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 6); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_extension_range(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 5); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_field(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_nested_type(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_oneof_decl(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 8); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_options(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 7); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_reserved_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 10); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_reserved_range(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 9); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumDescriptorProto_f_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumDescriptorProto_f_options(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumDescriptorProto_f_value(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumOptions_f_allow_alias(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumOptions_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumOptions_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumOptions_is(m)); return upb_msgdef_itof(m, 999); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueDescriptorProto_f_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueDescriptorProto_f_number(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueDescriptorProto_f_options(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumValueOptions_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_EnumValueOptions_is(m)); return upb_msgdef_itof(m, 999); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_default_value(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 7); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_extendee(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_json_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 10); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_label(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 4); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_number(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_oneof_index(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 9); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_options(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 8); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_type(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 5); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_type_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 6); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_ctype(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_jstype(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 6); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_lazy(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 5); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_packed(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 999); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_weak(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 10); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_dependency(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_enum_type(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 5); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_extension(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 7); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_message_type(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 4); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_options(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 8); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_package(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_public_dependency(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 10); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_service(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 6); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_source_code_info(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 9); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_syntax(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 12); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_weak_dependency(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 11); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorSet_f_file(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorSet_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_cc_enable_arenas(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 31); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_cc_generic_services(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 16); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_csharp_namespace(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 37); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 23); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_go_package(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 11); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_generate_equals_and_hash(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 20); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_generic_services(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 17); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_multiple_files(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 10); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_outer_classname(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 8); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_package(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_string_check_utf8(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 27); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_javanano_use_deprecated_package(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 38); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_objc_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 36); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_optimize_for(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 9); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_php_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 40); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_php_namespace(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 41); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_py_generic_services(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 18); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 999); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_map_entry(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 7); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_message_set_wire_format(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_no_standard_descriptor_accessor(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 999); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_client_streaming(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 5); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_input_type(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_options(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 4); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_output_type(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_server_streaming(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 6); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MethodOptions_is(m)); return upb_msgdef_itof(m, 33); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MethodOptions_is(m)); return upb_msgdef_itof(m, 999); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_OneofDescriptorProto_f_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_OneofDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceDescriptorProto_f_method(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_ServiceDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceDescriptorProto_f_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_ServiceDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceDescriptorProto_f_options(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_ServiceDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_ServiceOptions_is(m)); return upb_msgdef_itof(m, 33); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_ServiceOptions_is(m)); return upb_msgdef_itof(m, 999); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_leading_comments(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_leading_detached_comments(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 6); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_path(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_span(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_trailing_comments(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 4); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_f_location(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_SourceCodeInfo_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_NamePart_f_is_extension(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_NamePart_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_NamePart_f_name_part(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_NamePart_is(m)); return upb_msgdef_itof(m, 1); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_aggregate_value(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 8); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_double_value(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 6); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_identifier_value(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 3); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_name(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 2); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_negative_int_value(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 5); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_positive_int_value(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 4); } |
||||
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_string_value(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 7); } |
||||
|
||||
UPB_END_EXTERN_C |
||||
|
||||
#ifdef __cplusplus |
||||
|
||||
namespace upbdefs { |
||||
namespace google { |
||||
namespace protobuf { |
||||
|
||||
class DescriptorProto : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
DescriptorProto(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_is(m)); |
||||
} |
||||
|
||||
static DescriptorProto get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_DescriptorProto_get(&m); |
||||
return DescriptorProto(m, &m); |
||||
} |
||||
|
||||
class ExtensionRange : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
ExtensionRange(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_ExtensionRange_is(m)); |
||||
} |
||||
|
||||
static ExtensionRange get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get(&m); |
||||
return ExtensionRange(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class ReservedRange : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
ReservedRange(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_DescriptorProto_ReservedRange_is(m)); |
||||
} |
||||
|
||||
static ReservedRange get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_DescriptorProto_ReservedRange_get(&m); |
||||
return ReservedRange(m, &m); |
||||
} |
||||
}; |
||||
}; |
||||
|
||||
class EnumDescriptorProto : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
EnumDescriptorProto(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_EnumDescriptorProto_is(m)); |
||||
} |
||||
|
||||
static EnumDescriptorProto get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_EnumDescriptorProto_get(&m); |
||||
return EnumDescriptorProto(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class EnumOptions : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
EnumOptions(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_EnumOptions_is(m)); |
||||
} |
||||
|
||||
static EnumOptions get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_EnumOptions_get(&m); |
||||
return EnumOptions(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class EnumValueDescriptorProto : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
EnumValueDescriptorProto(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)); |
||||
} |
||||
|
||||
static EnumValueDescriptorProto get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_EnumValueDescriptorProto_get(&m); |
||||
return EnumValueDescriptorProto(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class EnumValueOptions : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
EnumValueOptions(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_EnumValueOptions_is(m)); |
||||
} |
||||
|
||||
static EnumValueOptions get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_EnumValueOptions_get(&m); |
||||
return EnumValueOptions(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class FieldDescriptorProto : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
FieldDescriptorProto(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); |
||||
} |
||||
|
||||
static FieldDescriptorProto get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_FieldDescriptorProto_get(&m); |
||||
return FieldDescriptorProto(m, &m); |
||||
} |
||||
|
||||
class Label : public ::upb::reffed_ptr<const ::upb::EnumDef> { |
||||
public: |
||||
Label(const ::upb::EnumDef* e, const void *ref_donor = NULL) |
||||
: reffed_ptr(e, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_Label_is(e)); |
||||
} |
||||
static Label get() { |
||||
const ::upb::EnumDef* e = upbdefs_google_protobuf_FieldDescriptorProto_Label_get(&e); |
||||
return Label(e, &e); |
||||
} |
||||
}; |
||||
|
||||
class Type : public ::upb::reffed_ptr<const ::upb::EnumDef> { |
||||
public: |
||||
Type(const ::upb::EnumDef* e, const void *ref_donor = NULL) |
||||
: reffed_ptr(e, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FieldDescriptorProto_Type_is(e)); |
||||
} |
||||
static Type get() { |
||||
const ::upb::EnumDef* e = upbdefs_google_protobuf_FieldDescriptorProto_Type_get(&e); |
||||
return Type(e, &e); |
||||
} |
||||
}; |
||||
}; |
||||
|
||||
class FieldOptions : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
FieldOptions(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_is(m)); |
||||
} |
||||
|
||||
static FieldOptions get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_FieldOptions_get(&m); |
||||
return FieldOptions(m, &m); |
||||
} |
||||
|
||||
class CType : public ::upb::reffed_ptr<const ::upb::EnumDef> { |
||||
public: |
||||
CType(const ::upb::EnumDef* e, const void *ref_donor = NULL) |
||||
: reffed_ptr(e, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_CType_is(e)); |
||||
} |
||||
static CType get() { |
||||
const ::upb::EnumDef* e = upbdefs_google_protobuf_FieldOptions_CType_get(&e); |
||||
return CType(e, &e); |
||||
} |
||||
}; |
||||
|
||||
class JSType : public ::upb::reffed_ptr<const ::upb::EnumDef> { |
||||
public: |
||||
JSType(const ::upb::EnumDef* e, const void *ref_donor = NULL) |
||||
: reffed_ptr(e, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FieldOptions_JSType_is(e)); |
||||
} |
||||
static JSType get() { |
||||
const ::upb::EnumDef* e = upbdefs_google_protobuf_FieldOptions_JSType_get(&e); |
||||
return JSType(e, &e); |
||||
} |
||||
}; |
||||
}; |
||||
|
||||
class FileDescriptorProto : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
FileDescriptorProto(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorProto_is(m)); |
||||
} |
||||
|
||||
static FileDescriptorProto get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_FileDescriptorProto_get(&m); |
||||
return FileDescriptorProto(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class FileDescriptorSet : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
FileDescriptorSet(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FileDescriptorSet_is(m)); |
||||
} |
||||
|
||||
static FileDescriptorSet get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_FileDescriptorSet_get(&m); |
||||
return FileDescriptorSet(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class FileOptions : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
FileOptions(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); |
||||
} |
||||
|
||||
static FileOptions get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_FileOptions_get(&m); |
||||
return FileOptions(m, &m); |
||||
} |
||||
|
||||
class OptimizeMode : public ::upb::reffed_ptr<const ::upb::EnumDef> { |
||||
public: |
||||
OptimizeMode(const ::upb::EnumDef* e, const void *ref_donor = NULL) |
||||
: reffed_ptr(e, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_FileOptions_OptimizeMode_is(e)); |
||||
} |
||||
static OptimizeMode get() { |
||||
const ::upb::EnumDef* e = upbdefs_google_protobuf_FileOptions_OptimizeMode_get(&e); |
||||
return OptimizeMode(e, &e); |
||||
} |
||||
}; |
||||
}; |
||||
|
||||
class MessageOptions : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
MessageOptions(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); |
||||
} |
||||
|
||||
static MessageOptions get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_MessageOptions_get(&m); |
||||
return MessageOptions(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class MethodDescriptorProto : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
MethodDescriptorProto(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); |
||||
} |
||||
|
||||
static MethodDescriptorProto get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_MethodDescriptorProto_get(&m); |
||||
return MethodDescriptorProto(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class MethodOptions : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
MethodOptions(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_MethodOptions_is(m)); |
||||
} |
||||
|
||||
static MethodOptions get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_MethodOptions_get(&m); |
||||
return MethodOptions(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class OneofDescriptorProto : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
OneofDescriptorProto(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_OneofDescriptorProto_is(m)); |
||||
} |
||||
|
||||
static OneofDescriptorProto get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_OneofDescriptorProto_get(&m); |
||||
return OneofDescriptorProto(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class ServiceDescriptorProto : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
ServiceDescriptorProto(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_ServiceDescriptorProto_is(m)); |
||||
} |
||||
|
||||
static ServiceDescriptorProto get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_ServiceDescriptorProto_get(&m); |
||||
return ServiceDescriptorProto(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class ServiceOptions : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
ServiceOptions(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_ServiceOptions_is(m)); |
||||
} |
||||
|
||||
static ServiceOptions get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_ServiceOptions_get(&m); |
||||
return ServiceOptions(m, &m); |
||||
} |
||||
}; |
||||
|
||||
class SourceCodeInfo : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
SourceCodeInfo(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_SourceCodeInfo_is(m)); |
||||
} |
||||
|
||||
static SourceCodeInfo get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_SourceCodeInfo_get(&m); |
||||
return SourceCodeInfo(m, &m); |
||||
} |
||||
|
||||
class Location : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
Location(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); |
||||
} |
||||
|
||||
static Location get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_SourceCodeInfo_Location_get(&m); |
||||
return Location(m, &m); |
||||
} |
||||
}; |
||||
}; |
||||
|
||||
class UninterpretedOption : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
UninterpretedOption(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_is(m)); |
||||
} |
||||
|
||||
static UninterpretedOption get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_UninterpretedOption_get(&m); |
||||
return UninterpretedOption(m, &m); |
||||
} |
||||
|
||||
class NamePart : public ::upb::reffed_ptr<const ::upb::MessageDef> { |
||||
public: |
||||
NamePart(const ::upb::MessageDef* m, const void *ref_donor = NULL) |
||||
: reffed_ptr(m, ref_donor) { |
||||
UPB_ASSERT(upbdefs_google_protobuf_UninterpretedOption_NamePart_is(m)); |
||||
} |
||||
|
||||
static NamePart get() { |
||||
const ::upb::MessageDef* m = upbdefs_google_protobuf_UninterpretedOption_NamePart_get(&m); |
||||
return NamePart(m, &m); |
||||
} |
||||
}; |
||||
}; |
||||
|
||||
} /* namespace protobuf */ |
||||
} /* namespace google */ |
||||
} /* namespace upbdefs */ |
||||
|
||||
#endif /* __cplusplus */ |
||||
|
||||
#endif /* UPB_DESCRIPTOR_DESCRIPTOR_PROTO_UPB_H_ */ |
@ -1,900 +0,0 @@ |
||||
/*
|
||||
** XXX: The routines in this file that consume a string do not currently |
||||
** support having the string span buffers. In the future, as upb_sink and |
||||
** its buffering/sharing functionality evolve there should be an easy and |
||||
** idiomatic way of correctly handling this case. For now, we accept this |
||||
** limitation since we currently only parse descriptors from single strings. |
||||
*/ |
||||
|
||||
#include "upb/descriptor/reader.h" |
||||
|
||||
#include <errno.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include "upb/def.h" |
||||
#include "upb/sink.h" |
||||
#include "upb/descriptor/descriptor.upbdefs.h" |
||||
|
||||
/* Compares a NULL-terminated string with a non-NULL-terminated string. */ |
||||
static bool upb_streq(const char *str, const char *buf, size_t n) { |
||||
return strlen(str) == n && memcmp(str, buf, n) == 0; |
||||
} |
||||
|
||||
/* We keep a stack of all the messages scopes we are currently in, as well as
|
||||
* the top-level file scope. This is necessary to correctly qualify the |
||||
* definitions that are contained inside. "name" tracks the name of the |
||||
* message or package (a bare name -- not qualified by any enclosing scopes). */ |
||||
typedef struct { |
||||
char *name; |
||||
/* Index of the first def that is under this scope. For msgdefs, the
|
||||
* msgdef itself is at start-1. */ |
||||
int start; |
||||
uint32_t oneof_start; |
||||
uint32_t oneof_index; |
||||
} upb_descreader_frame; |
||||
|
||||
/* The maximum number of nested declarations that are allowed, ie.
|
||||
* message Foo { |
||||
* message Bar { |
||||
* message Baz { |
||||
* } |
||||
* } |
||||
* } |
||||
* |
||||
* This is a resource limit that affects how big our runtime stack can grow. |
||||
* TODO: make this a runtime-settable property of the Reader instance. */ |
||||
#define UPB_MAX_MESSAGE_NESTING 64 |
||||
|
||||
struct upb_descreader { |
||||
upb_sink sink; |
||||
upb_inttable files; |
||||
upb_strtable files_by_name; |
||||
upb_filedef *file; /* The last file in files. */ |
||||
upb_descreader_frame stack[UPB_MAX_MESSAGE_NESTING]; |
||||
int stack_len; |
||||
upb_inttable oneofs; |
||||
|
||||
uint32_t number; |
||||
char *name; |
||||
bool saw_number; |
||||
bool saw_name; |
||||
|
||||
char *default_string; |
||||
|
||||
upb_fielddef *f; |
||||
}; |
||||
|
||||
static char *upb_gstrndup(const char *buf, size_t n) { |
||||
char *ret = upb_gmalloc(n + 1); |
||||
if (!ret) return NULL; |
||||
memcpy(ret, buf, n); |
||||
ret[n] = '\0'; |
||||
return ret; |
||||
} |
||||
|
||||
/* Returns a newly allocated string that joins input strings together, for
|
||||
* example: |
||||
* join("Foo.Bar", "Baz") -> "Foo.Bar.Baz" |
||||
* join("", "Baz") -> "Baz" |
||||
* Caller owns a ref on the returned string. */ |
||||
static char *upb_join(const char *base, const char *name) { |
||||
if (!base || strlen(base) == 0) { |
||||
return upb_gstrdup(name); |
||||
} else { |
||||
char *ret = upb_gmalloc(strlen(base) + strlen(name) + 2); |
||||
if (!ret) { |
||||
return NULL; |
||||
} |
||||
ret[0] = '\0'; |
||||
strcat(ret, base); |
||||
strcat(ret, "."); |
||||
strcat(ret, name); |
||||
return ret; |
||||
} |
||||
} |
||||
|
||||
/* Qualify the defname for all defs starting with offset "start" with "str". */ |
||||
static bool upb_descreader_qualify(upb_filedef *f, char *str, int32_t start) { |
||||
size_t i; |
||||
for (i = start; i < upb_filedef_defcount(f); i++) { |
||||
upb_def *def = upb_filedef_mutabledef(f, i); |
||||
char *name = upb_join(str, upb_def_fullname(def)); |
||||
if (!name) { |
||||
/* Need better logic here; at this point we've qualified some names but
|
||||
* not others. */ |
||||
return false; |
||||
} |
||||
upb_def_setfullname(def, name, NULL); |
||||
upb_gfree(name); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
|
||||
/* upb_descreader ************************************************************/ |
||||
|
||||
static upb_msgdef *upb_descreader_top(upb_descreader *r) { |
||||
int index; |
||||
UPB_ASSERT(r->stack_len > 1); |
||||
index = r->stack[r->stack_len-1].start - 1; |
||||
UPB_ASSERT(index >= 0); |
||||
return upb_downcast_msgdef_mutable(upb_filedef_mutabledef(r->file, index)); |
||||
} |
||||
|
||||
static upb_def *upb_descreader_last(upb_descreader *r) { |
||||
return upb_filedef_mutabledef(r->file, upb_filedef_defcount(r->file) - 1); |
||||
} |
||||
|
||||
/* Start/end handlers for FileDescriptorProto and DescriptorProto (the two
|
||||
* entities that have names and can contain sub-definitions. */ |
||||
void upb_descreader_startcontainer(upb_descreader *r) { |
||||
upb_descreader_frame *f = &r->stack[r->stack_len++]; |
||||
f->start = upb_filedef_defcount(r->file); |
||||
f->oneof_start = upb_inttable_count(&r->oneofs); |
||||
f->oneof_index = 0; |
||||
f->name = NULL; |
||||
} |
||||
|
||||
bool upb_descreader_endcontainer(upb_descreader *r) { |
||||
upb_descreader_frame *f = &r->stack[r->stack_len - 1]; |
||||
|
||||
while (upb_inttable_count(&r->oneofs) > f->oneof_start) { |
||||
upb_oneofdef *o = upb_value_getptr(upb_inttable_pop(&r->oneofs)); |
||||
bool ok = upb_msgdef_addoneof(upb_descreader_top(r), o, &r->oneofs, NULL); |
||||
UPB_ASSERT(ok); |
||||
} |
||||
|
||||
if (!upb_descreader_qualify(r->file, f->name, f->start)) { |
||||
return false; |
||||
} |
||||
upb_gfree(f->name); |
||||
f->name = NULL; |
||||
|
||||
r->stack_len--; |
||||
return true; |
||||
} |
||||
|
||||
void upb_descreader_setscopename(upb_descreader *r, char *str) { |
||||
upb_descreader_frame *f = &r->stack[r->stack_len-1]; |
||||
upb_gfree(f->name); |
||||
f->name = str; |
||||
} |
||||
|
||||
static upb_oneofdef *upb_descreader_getoneof(upb_descreader *r, |
||||
uint32_t index) { |
||||
bool found; |
||||
upb_value val; |
||||
upb_descreader_frame *f = &r->stack[r->stack_len-1]; |
||||
|
||||
/* DescriptorProto messages can be nested, so we will see the nested messages
|
||||
* between when we see the FieldDescriptorProto and the OneofDescriptorProto. |
||||
* We need to preserve the oneofs in between these two things. */ |
||||
index += f->oneof_start; |
||||
|
||||
while (upb_inttable_count(&r->oneofs) <= index) { |
||||
upb_inttable_push(&r->oneofs, upb_value_ptr(upb_oneofdef_new(&r->oneofs))); |
||||
} |
||||
|
||||
found = upb_inttable_lookup(&r->oneofs, index, &val); |
||||
UPB_ASSERT(found); |
||||
return upb_value_getptr(val); |
||||
} |
||||
|
||||
/** Handlers for google.protobuf.FileDescriptorSet. ***************************/ |
||||
|
||||
static void *fileset_startfile(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
r->file = upb_filedef_new(&r->files); |
||||
upb_inttable_push(&r->files, upb_value_ptr(r->file)); |
||||
return r; |
||||
} |
||||
|
||||
/** Handlers for google.protobuf.FileDescriptorProto. *************************/ |
||||
|
||||
static bool file_start(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
upb_descreader_startcontainer(r); |
||||
return true; |
||||
} |
||||
|
||||
static bool file_end(void *closure, const void *hd, upb_status *status) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(status); |
||||
return upb_descreader_endcontainer(r); |
||||
} |
||||
|
||||
static size_t file_onname(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
char *name; |
||||
bool ok; |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
name = upb_gstrndup(buf, n); |
||||
upb_strtable_insert(&r->files_by_name, name, upb_value_ptr(r->file)); |
||||
/* XXX: see comment at the top of the file. */ |
||||
ok = upb_filedef_setname(r->file, name, NULL); |
||||
upb_gfree(name); |
||||
UPB_ASSERT(ok); |
||||
return n; |
||||
} |
||||
|
||||
static size_t file_onpackage(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
char *package; |
||||
bool ok; |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
package = upb_gstrndup(buf, n); |
||||
/* XXX: see comment at the top of the file. */ |
||||
upb_descreader_setscopename(r, package); |
||||
ok = upb_filedef_setpackage(r->file, package, NULL); |
||||
UPB_ASSERT(ok); |
||||
return n; |
||||
} |
||||
|
||||
static void *file_startphpnamespace(void *closure, const void *hd, |
||||
size_t size_hint) { |
||||
upb_descreader *r = closure; |
||||
bool ok; |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(size_hint); |
||||
|
||||
ok = upb_filedef_setphpnamespace(r->file, "", NULL); |
||||
UPB_ASSERT(ok); |
||||
return closure; |
||||
} |
||||
|
||||
static size_t file_onphpnamespace(void *closure, const void *hd, |
||||
const char *buf, size_t n, |
||||
const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
char *php_namespace; |
||||
bool ok; |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
php_namespace = upb_gstrndup(buf, n); |
||||
ok = upb_filedef_setphpnamespace(r->file, php_namespace, NULL); |
||||
upb_gfree(php_namespace); |
||||
UPB_ASSERT(ok); |
||||
return n; |
||||
} |
||||
|
||||
static size_t file_onphpprefix(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
char *prefix; |
||||
bool ok; |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
prefix = upb_gstrndup(buf, n); |
||||
ok = upb_filedef_setphpprefix(r->file, prefix, NULL); |
||||
upb_gfree(prefix); |
||||
UPB_ASSERT(ok); |
||||
return n; |
||||
} |
||||
|
||||
static size_t file_onsyntax(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
bool ok; |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
/* XXX: see comment at the top of the file. */ |
||||
if (upb_streq("proto2", buf, n)) { |
||||
ok = upb_filedef_setsyntax(r->file, UPB_SYNTAX_PROTO2, NULL); |
||||
} else if (upb_streq("proto3", buf, n)) { |
||||
ok = upb_filedef_setsyntax(r->file, UPB_SYNTAX_PROTO3, NULL); |
||||
} else { |
||||
ok = false; |
||||
} |
||||
|
||||
UPB_ASSERT(ok); |
||||
return n; |
||||
} |
||||
|
||||
static void *file_startmsg(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
upb_msgdef *m = upb_msgdef_new(&m); |
||||
bool ok = upb_filedef_addmsg(r->file, m, &m, NULL); |
||||
UPB_UNUSED(hd); |
||||
UPB_ASSERT(ok); |
||||
return r; |
||||
} |
||||
|
||||
static void *file_startenum(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
upb_enumdef *e = upb_enumdef_new(&e); |
||||
bool ok = upb_filedef_addenum(r->file, e, &e, NULL); |
||||
UPB_UNUSED(hd); |
||||
UPB_ASSERT(ok); |
||||
return r; |
||||
} |
||||
|
||||
static void *file_startext(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
bool ok; |
||||
r->f = upb_fielddef_new(r); |
||||
ok = upb_filedef_addext(r->file, r->f, r, NULL); |
||||
UPB_UNUSED(hd); |
||||
UPB_ASSERT(ok); |
||||
return r; |
||||
} |
||||
|
||||
static size_t file_ondep(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
upb_value val; |
||||
if (upb_strtable_lookup2(&r->files_by_name, buf, n, &val)) { |
||||
upb_filedef_adddep(r->file, upb_value_getptr(val)); |
||||
} |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
return n; |
||||
} |
||||
|
||||
/** Handlers for google.protobuf.EnumValueDescriptorProto. *********************/ |
||||
|
||||
static bool enumval_startmsg(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
r->saw_number = false; |
||||
r->saw_name = false; |
||||
return true; |
||||
} |
||||
|
||||
static size_t enumval_onname(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
/* XXX: see comment at the top of the file. */ |
||||
upb_gfree(r->name); |
||||
r->name = upb_gstrndup(buf, n); |
||||
r->saw_name = true; |
||||
return n; |
||||
} |
||||
|
||||
static bool enumval_onnumber(void *closure, const void *hd, int32_t val) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
r->number = val; |
||||
r->saw_number = true; |
||||
return true; |
||||
} |
||||
|
||||
static bool enumval_endmsg(void *closure, const void *hd, upb_status *status) { |
||||
upb_descreader *r = closure; |
||||
upb_enumdef *e; |
||||
UPB_UNUSED(hd); |
||||
|
||||
if(!r->saw_number || !r->saw_name) { |
||||
upb_status_seterrmsg(status, "Enum value missing name or number."); |
||||
return false; |
||||
} |
||||
e = upb_downcast_enumdef_mutable(upb_descreader_last(r)); |
||||
upb_enumdef_addval(e, r->name, r->number, status); |
||||
upb_gfree(r->name); |
||||
r->name = NULL; |
||||
return true; |
||||
} |
||||
|
||||
/** Handlers for google.protobuf.EnumDescriptorProto. *************************/ |
||||
|
||||
static bool enum_endmsg(void *closure, const void *hd, upb_status *status) { |
||||
upb_descreader *r = closure; |
||||
upb_enumdef *e; |
||||
UPB_UNUSED(hd); |
||||
|
||||
e = upb_downcast_enumdef_mutable(upb_descreader_last(r)); |
||||
if (upb_def_fullname(upb_descreader_last(r)) == NULL) { |
||||
upb_status_seterrmsg(status, "Enum had no name."); |
||||
return false; |
||||
} |
||||
if (upb_enumdef_numvals(e) == 0) { |
||||
upb_status_seterrmsg(status, "Enum had no values."); |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
static size_t enum_onname(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
char *fullname = upb_gstrndup(buf, n); |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
/* XXX: see comment at the top of the file. */ |
||||
upb_def_setfullname(upb_descreader_last(r), fullname, NULL); |
||||
upb_gfree(fullname); |
||||
return n; |
||||
} |
||||
|
||||
/** Handlers for google.protobuf.FieldDescriptorProto *************************/ |
||||
|
||||
static bool field_startmsg(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
UPB_ASSERT(r->f); |
||||
upb_gfree(r->default_string); |
||||
r->default_string = NULL; |
||||
|
||||
/* fielddefs default to packed, but descriptors default to non-packed. */ |
||||
upb_fielddef_setpacked(r->f, false); |
||||
return true; |
||||
} |
||||
|
||||
/* Converts the default value in string "str" into "d". Passes a ref on str.
|
||||
* Returns true on success. */ |
||||
static bool parse_default(char *str, upb_fielddef *f) { |
||||
bool success = true; |
||||
char *end; |
||||
switch (upb_fielddef_type(f)) { |
||||
case UPB_TYPE_INT32: { |
||||
long val = strtol(str, &end, 0); |
||||
if (val > INT32_MAX || val < INT32_MIN || errno == ERANGE || *end) |
||||
success = false; |
||||
else |
||||
upb_fielddef_setdefaultint32(f, val); |
||||
break; |
||||
} |
||||
case UPB_TYPE_INT64: { |
||||
/* XXX: Need to write our own strtoll, since it's not available in c89. */ |
||||
long long val = strtol(str, &end, 0); |
||||
if (val > INT64_MAX || val < INT64_MIN || errno == ERANGE || *end) |
||||
success = false; |
||||
else |
||||
upb_fielddef_setdefaultint64(f, val); |
||||
break; |
||||
} |
||||
case UPB_TYPE_UINT32: { |
||||
unsigned long val = strtoul(str, &end, 0); |
||||
if (val > UINT32_MAX || errno == ERANGE || *end) |
||||
success = false; |
||||
else |
||||
upb_fielddef_setdefaultuint32(f, val); |
||||
break; |
||||
} |
||||
case UPB_TYPE_UINT64: { |
||||
/* XXX: Need to write our own strtoull, since it's not available in c89. */ |
||||
unsigned long long val = strtoul(str, &end, 0); |
||||
if (val > UINT64_MAX || errno == ERANGE || *end) |
||||
success = false; |
||||
else |
||||
upb_fielddef_setdefaultuint64(f, val); |
||||
break; |
||||
} |
||||
case UPB_TYPE_DOUBLE: { |
||||
double val = strtod(str, &end); |
||||
if (errno == ERANGE || *end) |
||||
success = false; |
||||
else |
||||
upb_fielddef_setdefaultdouble(f, val); |
||||
break; |
||||
} |
||||
case UPB_TYPE_FLOAT: { |
||||
/* XXX: Need to write our own strtof, since it's not available in c89. */ |
||||
float val = strtod(str, &end); |
||||
if (errno == ERANGE || *end) |
||||
success = false; |
||||
else |
||||
upb_fielddef_setdefaultfloat(f, val); |
||||
break; |
||||
} |
||||
case UPB_TYPE_BOOL: { |
||||
if (strcmp(str, "false") == 0) |
||||
upb_fielddef_setdefaultbool(f, false); |
||||
else if (strcmp(str, "true") == 0) |
||||
upb_fielddef_setdefaultbool(f, true); |
||||
else |
||||
success = false; |
||||
break; |
||||
} |
||||
default: abort(); |
||||
} |
||||
return success; |
||||
} |
||||
|
||||
static bool field_endmsg(void *closure, const void *hd, upb_status *status) { |
||||
upb_descreader *r = closure; |
||||
upb_fielddef *f = r->f; |
||||
UPB_UNUSED(hd); |
||||
|
||||
/* TODO: verify that all required fields were present. */ |
||||
UPB_ASSERT(upb_fielddef_number(f) != 0); |
||||
UPB_ASSERT(upb_fielddef_name(f) != NULL); |
||||
UPB_ASSERT((upb_fielddef_subdefname(f) != NULL) == upb_fielddef_hassubdef(f)); |
||||
|
||||
if (r->default_string) { |
||||
if (upb_fielddef_issubmsg(f)) { |
||||
upb_status_seterrmsg(status, "Submessages cannot have defaults."); |
||||
return false; |
||||
} |
||||
if (upb_fielddef_isstring(f) || upb_fielddef_type(f) == UPB_TYPE_ENUM) { |
||||
upb_fielddef_setdefaultcstr(f, r->default_string, NULL); |
||||
} else { |
||||
if (r->default_string && !parse_default(r->default_string, f)) { |
||||
/* We don't worry too much about giving a great error message since the
|
||||
* compiler should have ensured this was correct. */ |
||||
upb_status_seterrmsg(status, "Error converting default value."); |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
static bool field_onlazy(void *closure, const void *hd, bool val) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
|
||||
upb_fielddef_setlazy(r->f, val); |
||||
return true; |
||||
} |
||||
|
||||
static bool field_onpacked(void *closure, const void *hd, bool val) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
|
||||
upb_fielddef_setpacked(r->f, val); |
||||
return true; |
||||
} |
||||
|
||||
static bool field_ontype(void *closure, const void *hd, int32_t val) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
|
||||
upb_fielddef_setdescriptortype(r->f, val); |
||||
return true; |
||||
} |
||||
|
||||
static bool field_onlabel(void *closure, const void *hd, int32_t val) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
|
||||
upb_fielddef_setlabel(r->f, val); |
||||
return true; |
||||
} |
||||
|
||||
static bool field_onnumber(void *closure, const void *hd, int32_t val) { |
||||
upb_descreader *r = closure; |
||||
bool ok; |
||||
UPB_UNUSED(hd); |
||||
|
||||
ok = upb_fielddef_setnumber(r->f, val, NULL); |
||||
UPB_ASSERT(ok); |
||||
return true; |
||||
} |
||||
|
||||
static size_t field_onname(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
char *name = upb_gstrndup(buf, n); |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
/* XXX: see comment at the top of the file. */ |
||||
upb_fielddef_setname(r->f, name, NULL); |
||||
upb_gfree(name); |
||||
return n; |
||||
} |
||||
|
||||
static size_t field_ontypename(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
char *name = upb_gstrndup(buf, n); |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
/* XXX: see comment at the top of the file. */ |
||||
upb_fielddef_setsubdefname(r->f, name, NULL); |
||||
upb_gfree(name); |
||||
return n; |
||||
} |
||||
|
||||
static size_t field_onextendee(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
char *name = upb_gstrndup(buf, n); |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
/* XXX: see comment at the top of the file. */ |
||||
upb_fielddef_setcontainingtypename(r->f, name, NULL); |
||||
upb_gfree(name); |
||||
return n; |
||||
} |
||||
|
||||
static size_t field_ondefaultval(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
/* Have to convert from string to the correct type, but we might not know the
|
||||
* type yet, so we save it as a string until the end of the field. |
||||
* XXX: see comment at the top of the file. */ |
||||
upb_gfree(r->default_string); |
||||
r->default_string = upb_gstrndup(buf, n); |
||||
return n; |
||||
} |
||||
|
||||
static bool field_ononeofindex(void *closure, const void *hd, int32_t index) { |
||||
upb_descreader *r = closure; |
||||
upb_oneofdef *o = upb_descreader_getoneof(r, index); |
||||
bool ok = upb_oneofdef_addfield(o, r->f, &r->f, NULL); |
||||
UPB_UNUSED(hd); |
||||
|
||||
UPB_ASSERT(ok); |
||||
return true; |
||||
} |
||||
|
||||
/** Handlers for google.protobuf.OneofDescriptorProto. ************************/ |
||||
|
||||
static size_t oneof_name(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
upb_descreader_frame *f = &r->stack[r->stack_len-1]; |
||||
upb_oneofdef *o = upb_descreader_getoneof(r, f->oneof_index++); |
||||
char *name_null_terminated = upb_gstrndup(buf, n); |
||||
bool ok = upb_oneofdef_setname(o, name_null_terminated, NULL); |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
UPB_ASSERT(ok); |
||||
free(name_null_terminated); |
||||
return n; |
||||
} |
||||
|
||||
/** Handlers for google.protobuf.DescriptorProto ******************************/ |
||||
|
||||
static bool msg_start(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
UPB_UNUSED(hd); |
||||
|
||||
upb_descreader_startcontainer(r); |
||||
return true; |
||||
} |
||||
|
||||
static bool msg_end(void *closure, const void *hd, upb_status *status) { |
||||
upb_descreader *r = closure; |
||||
upb_msgdef *m = upb_descreader_top(r); |
||||
UPB_UNUSED(hd); |
||||
|
||||
if(!upb_def_fullname(upb_msgdef_upcast_mutable(m))) { |
||||
upb_status_seterrmsg(status, "Encountered message with no name."); |
||||
return false; |
||||
} |
||||
return upb_descreader_endcontainer(r); |
||||
} |
||||
|
||||
static size_t msg_name(void *closure, const void *hd, const char *buf, |
||||
size_t n, const upb_bufhandle *handle) { |
||||
upb_descreader *r = closure; |
||||
upb_msgdef *m = upb_descreader_top(r); |
||||
/* XXX: see comment at the top of the file. */ |
||||
char *name = upb_gstrndup(buf, n); |
||||
UPB_UNUSED(hd); |
||||
UPB_UNUSED(handle); |
||||
|
||||
upb_def_setfullname(upb_msgdef_upcast_mutable(m), name, NULL); |
||||
upb_descreader_setscopename(r, name); /* Passes ownership of name. */ |
||||
return n; |
||||
} |
||||
|
||||
static void *msg_startmsg(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
upb_msgdef *m = upb_msgdef_new(&m); |
||||
bool ok = upb_filedef_addmsg(r->file, m, &m, NULL); |
||||
UPB_UNUSED(hd); |
||||
UPB_ASSERT(ok); |
||||
return r; |
||||
} |
||||
|
||||
static void *msg_startext(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
upb_fielddef *f = upb_fielddef_new(&f); |
||||
bool ok = upb_filedef_addext(r->file, f, &f, NULL); |
||||
UPB_UNUSED(hd); |
||||
UPB_ASSERT(ok); |
||||
return r; |
||||
} |
||||
|
||||
static void *msg_startfield(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
r->f = upb_fielddef_new(&r->f); |
||||
/* We can't add the new field to the message until its name/number are
|
||||
* filled in. */ |
||||
UPB_UNUSED(hd); |
||||
return r; |
||||
} |
||||
|
||||
static bool msg_endfield(void *closure, const void *hd) { |
||||
upb_descreader *r = closure; |
||||
upb_msgdef *m = upb_descreader_top(r); |
||||
bool ok; |
||||
UPB_UNUSED(hd); |
||||
|
||||
/* Oneof fields are added to the msgdef through their oneof, so don't need to
|
||||
* be added here. */ |
||||
if (upb_fielddef_containingoneof(r->f) == NULL) { |
||||
ok = upb_msgdef_addfield(m, r->f, &r->f, NULL); |
||||
UPB_ASSERT(ok); |
||||
} |
||||
r->f = NULL; |
||||
return true; |
||||
} |
||||
|
||||
static bool msg_onmapentry(void *closure, const void *hd, bool mapentry) { |
||||
upb_descreader *r = closure; |
||||
upb_msgdef *m = upb_descreader_top(r); |
||||
UPB_UNUSED(hd); |
||||
|
||||
upb_msgdef_setmapentry(m, mapentry); |
||||
r->f = NULL; |
||||
return true; |
||||
} |
||||
|
||||
|
||||
|
||||
/** Code to register handlers *************************************************/ |
||||
|
||||
#define F(msg, field) upbdefs_google_protobuf_ ## msg ## _f_ ## field(m) |
||||
|
||||
static void reghandlers(const void *closure, upb_handlers *h) { |
||||
const upb_msgdef *m = upb_handlers_msgdef(h); |
||||
UPB_UNUSED(closure); |
||||
|
||||
if (upbdefs_google_protobuf_FileDescriptorSet_is(m)) { |
||||
upb_handlers_setstartsubmsg(h, F(FileDescriptorSet, file), |
||||
&fileset_startfile, NULL); |
||||
} else if (upbdefs_google_protobuf_DescriptorProto_is(m)) { |
||||
upb_handlers_setstartmsg(h, &msg_start, NULL); |
||||
upb_handlers_setendmsg(h, &msg_end, NULL); |
||||
upb_handlers_setstring(h, F(DescriptorProto, name), &msg_name, NULL); |
||||
upb_handlers_setstartsubmsg(h, F(DescriptorProto, extension), &msg_startext, |
||||
NULL); |
||||
upb_handlers_setstartsubmsg(h, F(DescriptorProto, nested_type), |
||||
&msg_startmsg, NULL); |
||||
upb_handlers_setstartsubmsg(h, F(DescriptorProto, field), |
||||
&msg_startfield, NULL); |
||||
upb_handlers_setendsubmsg(h, F(DescriptorProto, field), |
||||
&msg_endfield, NULL); |
||||
upb_handlers_setstartsubmsg(h, F(DescriptorProto, enum_type), |
||||
&file_startenum, NULL); |
||||
} else if (upbdefs_google_protobuf_FileDescriptorProto_is(m)) { |
||||
upb_handlers_setstartmsg(h, &file_start, NULL); |
||||
upb_handlers_setendmsg(h, &file_end, NULL); |
||||
upb_handlers_setstring(h, F(FileDescriptorProto, name), &file_onname, |
||||
NULL); |
||||
upb_handlers_setstring(h, F(FileDescriptorProto, package), &file_onpackage, |
||||
NULL); |
||||
upb_handlers_setstring(h, F(FileDescriptorProto, syntax), &file_onsyntax, |
||||
NULL); |
||||
upb_handlers_setstartsubmsg(h, F(FileDescriptorProto, message_type), |
||||
&file_startmsg, NULL); |
||||
upb_handlers_setstartsubmsg(h, F(FileDescriptorProto, enum_type), |
||||
&file_startenum, NULL); |
||||
upb_handlers_setstartsubmsg(h, F(FileDescriptorProto, extension), |
||||
&file_startext, NULL); |
||||
upb_handlers_setstring(h, F(FileDescriptorProto, dependency), |
||||
&file_ondep, NULL); |
||||
} else if (upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)) { |
||||
upb_handlers_setstartmsg(h, &enumval_startmsg, NULL); |
||||
upb_handlers_setendmsg(h, &enumval_endmsg, NULL); |
||||
upb_handlers_setstring(h, F(EnumValueDescriptorProto, name), &enumval_onname, NULL); |
||||
upb_handlers_setint32(h, F(EnumValueDescriptorProto, number), &enumval_onnumber, |
||||
NULL); |
||||
} else if (upbdefs_google_protobuf_EnumDescriptorProto_is(m)) { |
||||
upb_handlers_setendmsg(h, &enum_endmsg, NULL); |
||||
upb_handlers_setstring(h, F(EnumDescriptorProto, name), &enum_onname, NULL); |
||||
} else if (upbdefs_google_protobuf_FieldDescriptorProto_is(m)) { |
||||
upb_handlers_setstartmsg(h, &field_startmsg, NULL); |
||||
upb_handlers_setendmsg(h, &field_endmsg, NULL); |
||||
upb_handlers_setint32(h, F(FieldDescriptorProto, type), &field_ontype, |
||||
NULL); |
||||
upb_handlers_setint32(h, F(FieldDescriptorProto, label), &field_onlabel, |
||||
NULL); |
||||
upb_handlers_setint32(h, F(FieldDescriptorProto, number), &field_onnumber, |
||||
NULL); |
||||
upb_handlers_setstring(h, F(FieldDescriptorProto, name), &field_onname, |
||||
NULL); |
||||
upb_handlers_setstring(h, F(FieldDescriptorProto, type_name), |
||||
&field_ontypename, NULL); |
||||
upb_handlers_setstring(h, F(FieldDescriptorProto, extendee), |
||||
&field_onextendee, NULL); |
||||
upb_handlers_setstring(h, F(FieldDescriptorProto, default_value), |
||||
&field_ondefaultval, NULL); |
||||
upb_handlers_setint32(h, F(FieldDescriptorProto, oneof_index), |
||||
&field_ononeofindex, NULL); |
||||
} else if (upbdefs_google_protobuf_OneofDescriptorProto_is(m)) { |
||||
upb_handlers_setstring(h, F(OneofDescriptorProto, name), &oneof_name, NULL); |
||||
} else if (upbdefs_google_protobuf_FieldOptions_is(m)) { |
||||
upb_handlers_setbool(h, F(FieldOptions, lazy), &field_onlazy, NULL); |
||||
upb_handlers_setbool(h, F(FieldOptions, packed), &field_onpacked, NULL); |
||||
} else if (upbdefs_google_protobuf_MessageOptions_is(m)) { |
||||
upb_handlers_setbool(h, F(MessageOptions, map_entry), &msg_onmapentry, NULL); |
||||
} else if (upbdefs_google_protobuf_FileOptions_is(m)) { |
||||
upb_handlers_setstring(h, F(FileOptions, php_class_prefix), |
||||
&file_onphpprefix, NULL); |
||||
upb_handlers_setstartstr(h, F(FileOptions, php_namespace), |
||||
&file_startphpnamespace, NULL); |
||||
upb_handlers_setstring(h, F(FileOptions, php_namespace), |
||||
&file_onphpnamespace, NULL); |
||||
} |
||||
|
||||
UPB_ASSERT(upb_ok(upb_handlers_status(h))); |
||||
} |
||||
|
||||
#undef F |
||||
|
||||
void descreader_cleanup(void *_r) { |
||||
upb_descreader *r = _r; |
||||
size_t i; |
||||
|
||||
for (i = 0; i < upb_descreader_filecount(r); i++) { |
||||
upb_filedef_unref(upb_descreader_file(r, i), &r->files); |
||||
} |
||||
|
||||
upb_gfree(r->name); |
||||
upb_inttable_uninit(&r->files); |
||||
upb_strtable_uninit(&r->files_by_name); |
||||
upb_inttable_uninit(&r->oneofs); |
||||
upb_gfree(r->default_string); |
||||
while (r->stack_len > 0) { |
||||
upb_descreader_frame *f = &r->stack[--r->stack_len]; |
||||
upb_gfree(f->name); |
||||
} |
||||
} |
||||
|
||||
|
||||
/* Public API ****************************************************************/ |
||||
|
||||
upb_descreader *upb_descreader_create(upb_env *e, const upb_handlers *h) { |
||||
upb_descreader *r = upb_env_malloc(e, sizeof(upb_descreader)); |
||||
if (!r || !upb_env_addcleanup(e, descreader_cleanup, r)) { |
||||
return NULL; |
||||
} |
||||
|
||||
upb_inttable_init(&r->files, UPB_CTYPE_PTR); |
||||
upb_strtable_init(&r->files_by_name, UPB_CTYPE_PTR); |
||||
upb_inttable_init(&r->oneofs, UPB_CTYPE_PTR); |
||||
upb_sink_reset(upb_descreader_input(r), h, r); |
||||
r->stack_len = 0; |
||||
r->name = NULL; |
||||
r->default_string = NULL; |
||||
|
||||
return r; |
||||
} |
||||
|
||||
size_t upb_descreader_filecount(const upb_descreader *r) { |
||||
return upb_inttable_count(&r->files); |
||||
} |
||||
|
||||
upb_filedef *upb_descreader_file(const upb_descreader *r, size_t i) { |
||||
upb_value v; |
||||
if (upb_inttable_lookup(&r->files, i, &v)) { |
||||
return upb_value_getptr(v); |
||||
} else { |
||||
return NULL; |
||||
} |
||||
} |
||||
|
||||
upb_sink *upb_descreader_input(upb_descreader *r) { |
||||
return &r->sink; |
||||
} |
||||
|
||||
const upb_handlers *upb_descreader_newhandlers(const void *owner) { |
||||
const upb_msgdef *m = upbdefs_google_protobuf_FileDescriptorSet_get(&m); |
||||
const upb_handlers *h = upb_handlers_newfrozen(m, owner, reghandlers, NULL); |
||||
upb_msgdef_unref(m, &m); |
||||
return h; |
||||
} |
@ -1,83 +0,0 @@ |
||||
/*
|
||||
** upb::descriptor::Reader (upb_descreader) |
||||
** |
||||
** Provides a way of building upb::Defs from data in descriptor.proto format. |
||||
*/ |
||||
|
||||
#ifndef UPB_DESCRIPTOR_H |
||||
#define UPB_DESCRIPTOR_H |
||||
|
||||
#include "upb/sink.h" |
||||
|
||||
#ifdef __cplusplus |
||||
namespace upb { |
||||
namespace descriptor { |
||||
class Reader; |
||||
} /* namespace descriptor */ |
||||
} /* namespace upb */ |
||||
#endif |
||||
|
||||
UPB_DECLARE_TYPE(upb::descriptor::Reader, upb_descreader) |
||||
|
||||
#ifdef __cplusplus |
||||
|
||||
/* Class that receives descriptor data according to the descriptor.proto schema
|
||||
* and use it to build upb::Defs corresponding to that schema. */ |
||||
class upb::descriptor::Reader { |
||||
public: |
||||
/* These handlers must have come from NewHandlers() and must outlive the
|
||||
* Reader. |
||||
* |
||||
* TODO: generate the handlers statically (like we do with the |
||||
* descriptor.proto defs) so that there is no need to pass this parameter (or |
||||
* to build/memory-manage the handlers at runtime at all). Unfortunately this |
||||
* is a bit tricky to implement for Handlers, but necessary to simplify this |
||||
* interface. */ |
||||
static Reader* Create(Environment* env, const Handlers* handlers); |
||||
|
||||
/* The reader's input; this is where descriptor.proto data should be sent. */ |
||||
Sink* input(); |
||||
|
||||
/* Use to get the FileDefs that have been parsed. */ |
||||
size_t file_count() const; |
||||
FileDef* file(size_t i) const; |
||||
|
||||
/* Builds and returns handlers for the reader, owned by "owner." */ |
||||
static Handlers* NewHandlers(const void* owner); |
||||
|
||||
private: |
||||
UPB_DISALLOW_POD_OPS(Reader, upb::descriptor::Reader) |
||||
}; |
||||
|
||||
#endif |
||||
|
||||
UPB_BEGIN_EXTERN_C |
||||
|
||||
/* C API. */ |
||||
upb_descreader *upb_descreader_create(upb_env *e, const upb_handlers *h); |
||||
upb_sink *upb_descreader_input(upb_descreader *r); |
||||
size_t upb_descreader_filecount(const upb_descreader *r); |
||||
upb_filedef *upb_descreader_file(const upb_descreader *r, size_t i); |
||||
const upb_handlers *upb_descreader_newhandlers(const void *owner); |
||||
|
||||
UPB_END_EXTERN_C |
||||
|
||||
#ifdef __cplusplus |
||||
/* C++ implementation details. ************************************************/ |
||||
namespace upb { |
||||
namespace descriptor { |
||||
inline Reader* Reader::Create(Environment* e, const Handlers *h) { |
||||
return upb_descreader_create(e, h); |
||||
} |
||||
inline Sink* Reader::input() { return upb_descreader_input(this); } |
||||
inline size_t Reader::file_count() const { |
||||
return upb_descreader_filecount(this); |
||||
} |
||||
inline FileDef* Reader::file(size_t i) const { |
||||
return upb_descreader_file(this, i); |
||||
} |
||||
} /* namespace descriptor */ |
||||
} /* namespace upb */ |
||||
#endif |
||||
|
||||
#endif /* UPB_DESCRIPTOR_H */ |
@ -1,54 +0,0 @@ |
||||
|
||||
#include "upb/pb/glue.h" |
||||
|
||||
#include "upb/descriptor/reader.h" |
||||
#include "upb/pb/decoder.h" |
||||
|
||||
upb_filedef **upb_loaddescriptor(const char *buf, size_t n, const void *owner, |
||||
upb_status *status) { |
||||
/* Create handlers. */ |
||||
const upb_pbdecodermethod *decoder_m; |
||||
const upb_handlers *reader_h = upb_descreader_newhandlers(&reader_h); |
||||
upb_env env; |
||||
upb_pbdecodermethodopts opts; |
||||
upb_pbdecoder *decoder; |
||||
upb_descreader *reader; |
||||
bool ok; |
||||
size_t i; |
||||
upb_filedef **ret = NULL; |
||||
|
||||
upb_pbdecodermethodopts_init(&opts, reader_h); |
||||
decoder_m = upb_pbdecodermethod_new(&opts, &decoder_m); |
||||
|
||||
upb_env_init(&env); |
||||
upb_env_reporterrorsto(&env, status); |
||||
|
||||
reader = upb_descreader_create(&env, reader_h); |
||||
decoder = upb_pbdecoder_create(&env, decoder_m, upb_descreader_input(reader)); |
||||
|
||||
/* Push input data. */ |
||||
ok = upb_bufsrc_putbuf(buf, n, upb_pbdecoder_input(decoder)); |
||||
|
||||
if (!ok) { |
||||
goto cleanup; |
||||
} |
||||
|
||||
ret = upb_gmalloc(sizeof (*ret) * (upb_descreader_filecount(reader) + 1)); |
||||
|
||||
if (!ret) { |
||||
goto cleanup; |
||||
} |
||||
|
||||
for (i = 0; i < upb_descreader_filecount(reader); i++) { |
||||
ret[i] = upb_descreader_file(reader, i); |
||||
upb_filedef_ref(ret[i], owner); |
||||
} |
||||
|
||||
ret[i] = NULL; |
||||
|
||||
cleanup: |
||||
upb_env_uninit(&env); |
||||
upb_handlers_unref(reader_h, &reader_h); |
||||
upb_pbdecodermethod_unref(decoder_m, &decoder_m); |
||||
return ret; |
||||
} |
@ -1,72 +0,0 @@ |
||||
/*
|
||||
** upb's core components like upb_decoder and upb_msg are carefully designed to |
||||
** avoid depending on each other for maximum orthogonality. In other words, |
||||
** you can use a upb_decoder to decode into *any* kind of structure; upb_msg is |
||||
** just one such structure. A upb_msg can be serialized/deserialized into any |
||||
** format, protobuf binary format is just one such format. |
||||
** |
||||
** However, for convenience we provide functions here for doing common |
||||
** operations like deserializing protobuf binary format into a upb_msg. The |
||||
** compromise is that this file drags in almost all of upb as a dependency, |
||||
** which could be undesirable if you're trying to use a trimmed-down build of |
||||
** upb. |
||||
** |
||||
** While these routines are convenient, they do not reuse any encoding/decoding |
||||
** state. For example, if a decoder is JIT-based, it will be re-JITted every |
||||
** time these functions are called. For this reason, if you are parsing lots |
||||
** of data and efficiency is an issue, these may not be the best functions to |
||||
** use (though they are useful for prototyping, before optimizing). |
||||
*/ |
||||
|
||||
#ifndef UPB_GLUE_H |
||||
#define UPB_GLUE_H |
||||
|
||||
#include <stdbool.h> |
||||
#include "upb/def.h" |
||||
|
||||
#ifdef __cplusplus |
||||
#include <vector> |
||||
|
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* Loads a binary descriptor and returns a NULL-terminated array of unfrozen
|
||||
* filedefs. The caller owns the returned array, which must be freed with |
||||
* upb_gfree(). */ |
||||
upb_filedef **upb_loaddescriptor(const char *buf, size_t n, const void *owner, |
||||
upb_status *status); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
|
||||
namespace upb { |
||||
|
||||
inline bool LoadDescriptor(const char* buf, size_t n, Status* status, |
||||
std::vector<reffed_ptr<FileDef> >* files) { |
||||
FileDef** parsed_files = upb_loaddescriptor(buf, n, &parsed_files, status); |
||||
|
||||
if (parsed_files) { |
||||
FileDef** p = parsed_files; |
||||
while (*p) { |
||||
files->push_back(reffed_ptr<FileDef>(*p, &parsed_files)); |
||||
++p; |
||||
} |
||||
free(parsed_files); |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/* Templated so it can accept both string and std::string. */ |
||||
template <typename T> |
||||
bool LoadDescriptor(const T& desc, Status* status, |
||||
std::vector<reffed_ptr<FileDef> >* files) { |
||||
return LoadDescriptor(desc.c_str(), desc.size(), status, files); |
||||
} |
||||
|
||||
} /* namespace upb */ |
||||
|
||||
#endif |
||||
|
||||
#endif /* UPB_GLUE_H */ |
@ -1,191 +0,0 @@ |
||||
/*
|
||||
** This file contains definitions of structs that should be considered private |
||||
** and NOT stable across versions of upb. |
||||
** |
||||
** The only reason they are declared here and not in .c files is to allow upb |
||||
** and the application (if desired) to embed statically-initialized instances |
||||
** of structures like defs. |
||||
** |
||||
** If you include this file, all guarantees of ABI compatibility go out the |
||||
** window! Any code that includes this file needs to recompile against the |
||||
** exact same version of upb that they are linking against. |
||||
** |
||||
** You also need to recompile if you change the value of the UPB_DEBUG_REFS |
||||
** flag. |
||||
*/ |
||||
|
||||
#include "upb/def.h" |
||||
|
||||
#ifndef UPB_STATICINIT_H_ |
||||
#define UPB_STATICINIT_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
/* Because of how we do our typedefs, this header can't be included from C++. */ |
||||
#error This file cannot be included from C++ |
||||
#endif |
||||
|
||||
/* upb_refcounted *************************************************************/ |
||||
|
||||
|
||||
/* upb_def ********************************************************************/ |
||||
|
||||
struct upb_def { |
||||
upb_refcounted base; |
||||
|
||||
const char *fullname; |
||||
const upb_filedef* file; |
||||
char type; /* A upb_deftype_t (char to save space) */ |
||||
|
||||
/* Used as a flag during the def's mutable stage. Must be false unless
|
||||
* it is currently being used by a function on the stack. This allows |
||||
* us to easily determine which defs were passed into the function's |
||||
* current invocation. */ |
||||
bool came_from_user; |
||||
}; |
||||
|
||||
#define UPB_DEF_INIT(name, type, vtbl, refs, ref2s) \ |
||||
{ UPB_REFCOUNT_INIT(vtbl, refs, ref2s), name, NULL, type, false } |
||||
|
||||
|
||||
/* upb_fielddef ***************************************************************/ |
||||
|
||||
struct upb_fielddef { |
||||
upb_def base; |
||||
|
||||
union { |
||||
int64_t sint; |
||||
uint64_t uint; |
||||
double dbl; |
||||
float flt; |
||||
void *bytes; |
||||
} defaultval; |
||||
union { |
||||
const upb_msgdef *def; /* If !msg_is_symbolic. */ |
||||
char *name; /* If msg_is_symbolic. */ |
||||
} msg; |
||||
union { |
||||
const upb_def *def; /* If !subdef_is_symbolic. */ |
||||
char *name; /* If subdef_is_symbolic. */ |
||||
} sub; /* The msgdef or enumdef for this field, if upb_hassubdef(f). */ |
||||
bool subdef_is_symbolic; |
||||
bool msg_is_symbolic; |
||||
const upb_oneofdef *oneof; |
||||
bool default_is_string; |
||||
bool type_is_set_; /* False until type is explicitly set. */ |
||||
bool is_extension_; |
||||
bool lazy_; |
||||
bool packed_; |
||||
upb_intfmt_t intfmt; |
||||
bool tagdelim; |
||||
upb_fieldtype_t type_; |
||||
upb_label_t label_; |
||||
uint32_t number_; |
||||
uint32_t selector_base; /* Used to index into a upb::Handlers table. */ |
||||
uint32_t index_; |
||||
}; |
||||
|
||||
extern const struct upb_refcounted_vtbl upb_fielddef_vtbl; |
||||
|
||||
#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \ |
||||
packed, name, num, msgdef, subdef, selector_base, \
|
||||
index, defaultval, refs, ref2s) \
|
||||
{ \
|
||||
UPB_DEF_INIT(name, UPB_DEF_FIELD, &upb_fielddef_vtbl, refs, ref2s), \
|
||||
defaultval, {msgdef}, {subdef}, NULL, false, false, \
|
||||
type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \
|
||||
lazy, packed, intfmt, tagdelim, type, label, num, selector_base, index \
|
||||
} |
||||
|
||||
|
||||
/* upb_msgdef *****************************************************************/ |
||||
|
||||
struct upb_msgdef { |
||||
upb_def base; |
||||
|
||||
size_t selector_count; |
||||
uint32_t submsg_field_count; |
||||
|
||||
/* Tables for looking up fields by number and name. */ |
||||
upb_inttable itof; /* int to field */ |
||||
upb_strtable ntof; /* name to field/oneof */ |
||||
|
||||
/* Is this a map-entry message? */ |
||||
bool map_entry; |
||||
|
||||
/* Whether this message has proto2 or proto3 semantics. */ |
||||
upb_syntax_t syntax; |
||||
|
||||
/* TODO(haberman): proper extension ranges (there can be multiple). */ |
||||
}; |
||||
|
||||
extern const struct upb_refcounted_vtbl upb_msgdef_vtbl; |
||||
|
||||
/* TODO: also support static initialization of the oneofs table. This will be
|
||||
* needed if we compile in descriptors that contain oneofs. */ |
||||
#define UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, \ |
||||
map_entry, syntax, refs, ref2s) \
|
||||
{ \
|
||||
UPB_DEF_INIT(name, UPB_DEF_MSG, &upb_fielddef_vtbl, refs, ref2s), \
|
||||
selector_count, submsg_field_count, itof, ntof, map_entry, syntax \
|
||||
} |
||||
|
||||
|
||||
/* upb_enumdef ****************************************************************/ |
||||
|
||||
struct upb_enumdef { |
||||
upb_def base; |
||||
|
||||
upb_strtable ntoi; |
||||
upb_inttable iton; |
||||
int32_t defaultval; |
||||
}; |
||||
|
||||
extern const struct upb_refcounted_vtbl upb_enumdef_vtbl; |
||||
|
||||
#define UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval, refs, ref2s) \ |
||||
{ UPB_DEF_INIT(name, UPB_DEF_ENUM, &upb_enumdef_vtbl, refs, ref2s), ntoi, \
|
||||
iton, defaultval } |
||||
|
||||
|
||||
/* upb_oneofdef ***************************************************************/ |
||||
|
||||
struct upb_oneofdef { |
||||
upb_refcounted base; |
||||
|
||||
uint32_t index; /* Index within oneofs. */ |
||||
const char *name; |
||||
upb_strtable ntof; |
||||
upb_inttable itof; |
||||
const upb_msgdef *parent; |
||||
}; |
||||
|
||||
extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl; |
||||
|
||||
#define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \ |
||||
{ UPB_REFCOUNT_INIT(&upb_oneofdef_vtbl, refs, ref2s), 0, name, ntof, itof } |
||||
|
||||
|
||||
/* upb_symtab *****************************************************************/ |
||||
|
||||
struct upb_symtab { |
||||
upb_refcounted base; |
||||
|
||||
upb_strtable symtab; |
||||
}; |
||||
|
||||
struct upb_filedef { |
||||
upb_refcounted base; |
||||
|
||||
const char *name; |
||||
const char *package; |
||||
const char *phpprefix; |
||||
const char *phpnamespace; |
||||
upb_syntax_t syntax; |
||||
|
||||
upb_inttable defs; |
||||
upb_inttable deps; |
||||
}; |
||||
|
||||
extern const struct upb_refcounted_vtbl upb_filedef_vtbl; |
||||
|
||||
#endif /* UPB_STATICINIT_H_ */ |
Loading…
Reference in new issue