From c21ad57da6f25cf5d004a0f841c2a2d8f9786315 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 1 Jul 2009 18:02:30 -0700 Subject: More work to msg and parse. Getting close! --- descriptor.c | 294 +++++++++++++++++++++++++++++----------------------------- descriptor.h | 76 +++++++-------- upb.h | 34 +++++-- upb_context.c | 26 +++--- upb_msg.c | 140 +++++++++++++++++++++++++--- upb_msg.h | 143 ++++++++++++++-------------- upb_parse.c | 8 +- upb_parse.h | 5 +- upb_table.c | 4 +- 9 files changed, 432 insertions(+), 298 deletions(-) diff --git a/descriptor.c b/descriptor.c index a4b9367..f60573b 100644 --- a/descriptor.c +++ b/descriptor.c @@ -1,11 +1,11 @@ #include "descriptor.h" static struct upb_string google_protobuf_filedescriptor_name = { - .byte_len=32, .data="google/protobuf/descriptor.proto" + .byte_len=32, .ptr="google/protobuf/descriptor.proto" }; static struct upb_string google_protobuf_filedescriptor_package = { - .byte_len=15, .data="google.protobuf" + .byte_len=15, .ptr="google.protobuf" }; struct google_protobuf_DescriptorProto google_protobuf_FileDescriptorSet_descriptor; @@ -44,7 +44,7 @@ static google_protobuf_DescriptorProto *google_protobuf_filedescriptor_message_t &google_protobuf_UninterpretedOption_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto) google_protobuf_filedescriptor_message_type = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto) google_protobuf_filedescriptor_message_type = { .len=16, .elements=google_protobuf_filedescriptor_message_type_array }; @@ -67,7 +67,7 @@ google_protobuf_FileDescriptorProto google_protobuf_filedescriptor = { /* google_protobuf_FileDescriptorSet_descriptor */ static struct upb_string google_protobuf_FileDescriptorSet_descriptor_name = { - .byte_len=17, .data="FileDescriptorSet" + .byte_len=17, .ptr="FileDescriptorSet" }; struct google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorSet_file_descriptor; @@ -76,7 +76,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_FileDescriptorSet_d &google_protobuf_FileDescriptorSet_file_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FileDescriptorSet_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FileDescriptorSet_descriptor_field = { .len=1, .elements=google_protobuf_FileDescriptorSet_descriptor_field_array }; @@ -88,11 +88,11 @@ google_protobuf_DescriptorProto google_protobuf_FileDescriptorSet_descriptor = { .extension_range = NULL, }; static struct upb_string google_protobuf_FileDescriptorSet_file_fieldname = { - .byte_len=4, .data="file" + .byte_len=4, .ptr="file" }; static struct upb_string google_protobuf_FileDescriptorSet_file_field_typename = { - .byte_len=19, .data="FileDescriptorProto" + .byte_len=19, .ptr="FileDescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorSet_file = { @@ -104,7 +104,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorSet_file = { }; /* google_protobuf_FileDescriptorProto_descriptor */ static struct upb_string google_protobuf_FileDescriptorProto_descriptor_name = { - .byte_len=19, .data="FileDescriptorProto" + .byte_len=19, .ptr="FileDescriptorProto" }; struct google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_name_descriptor; @@ -127,7 +127,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_FileDescriptorProto &google_protobuf_FileDescriptorProto_options_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FileDescriptorProto_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FileDescriptorProto_descriptor_field = { .len=8, .elements=google_protobuf_FileDescriptorProto_descriptor_field_array }; @@ -139,7 +139,7 @@ google_protobuf_DescriptorProto google_protobuf_FileDescriptorProto_descriptor = .extension_range = NULL, }; static struct upb_string google_protobuf_FileDescriptorProto_name_fieldname = { - .byte_len=4, .data="name" + .byte_len=4, .ptr="name" }; google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_name = { @@ -150,7 +150,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_name = .type_name = NULL, }; static struct upb_string google_protobuf_FileDescriptorProto_package_fieldname = { - .byte_len=7, .data="package" + .byte_len=7, .ptr="package" }; google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_package = { @@ -161,7 +161,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_package .type_name = NULL, }; static struct upb_string google_protobuf_FileDescriptorProto_dependency_fieldname = { - .byte_len=10, .data="dependency" + .byte_len=10, .ptr="dependency" }; google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_dependency = { @@ -172,11 +172,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_depende .type_name = NULL, }; static struct upb_string google_protobuf_FileDescriptorProto_message_type_fieldname = { - .byte_len=12, .data="message_type" + .byte_len=12, .ptr="message_type" }; static struct upb_string google_protobuf_FileDescriptorProto_message_type_field_typename = { - .byte_len=15, .data="DescriptorProto" + .byte_len=15, .ptr="DescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_message_type = { @@ -187,11 +187,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_message .type_name = &google_protobuf_FileDescriptorProto_message_type_field_typename, }; static struct upb_string google_protobuf_FileDescriptorProto_enum_type_fieldname = { - .byte_len=9, .data="enum_type" + .byte_len=9, .ptr="enum_type" }; static struct upb_string google_protobuf_FileDescriptorProto_enum_type_field_typename = { - .byte_len=19, .data="EnumDescriptorProto" + .byte_len=19, .ptr="EnumDescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_enum_type = { @@ -202,11 +202,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_enum_ty .type_name = &google_protobuf_FileDescriptorProto_enum_type_field_typename, }; static struct upb_string google_protobuf_FileDescriptorProto_service_fieldname = { - .byte_len=7, .data="service" + .byte_len=7, .ptr="service" }; static struct upb_string google_protobuf_FileDescriptorProto_service_field_typename = { - .byte_len=22, .data="ServiceDescriptorProto" + .byte_len=22, .ptr="ServiceDescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_service = { @@ -217,11 +217,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_service .type_name = &google_protobuf_FileDescriptorProto_service_field_typename, }; static struct upb_string google_protobuf_FileDescriptorProto_extension_fieldname = { - .byte_len=9, .data="extension" + .byte_len=9, .ptr="extension" }; static struct upb_string google_protobuf_FileDescriptorProto_extension_field_typename = { - .byte_len=20, .data="FieldDescriptorProto" + .byte_len=20, .ptr="FieldDescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_extension = { @@ -232,11 +232,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_extensi .type_name = &google_protobuf_FileDescriptorProto_extension_field_typename, }; static struct upb_string google_protobuf_FileDescriptorProto_options_fieldname = { - .byte_len=7, .data="options" + .byte_len=7, .ptr="options" }; static struct upb_string google_protobuf_FileDescriptorProto_options_field_typename = { - .byte_len=11, .data="FileOptions" + .byte_len=11, .ptr="FileOptions" }; google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_options = { @@ -248,7 +248,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileDescriptorProto_options }; /* google_protobuf_DescriptorProto_descriptor */ static struct upb_string google_protobuf_DescriptorProto_descriptor_name = { - .byte_len=15, .data="DescriptorProto" + .byte_len=15, .ptr="DescriptorProto" }; struct google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_name_descriptor; @@ -269,7 +269,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_DescriptorProto_des &google_protobuf_DescriptorProto_options_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_DescriptorProto_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_DescriptorProto_descriptor_field = { .len=7, .elements=google_protobuf_DescriptorProto_descriptor_field_array }; @@ -279,7 +279,7 @@ static google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_descript &google_protobuf_DescriptorProto_ExtensionRange_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto) google_protobuf_DescriptorProto_descriptor_nested_type = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto) google_protobuf_DescriptorProto_descriptor_nested_type = { .len=1, .elements=google_protobuf_DescriptorProto_descriptor_nested_type_array }; @@ -291,7 +291,7 @@ google_protobuf_DescriptorProto google_protobuf_DescriptorProto_descriptor = { .extension_range = NULL, }; static struct upb_string google_protobuf_DescriptorProto_name_fieldname = { - .byte_len=4, .data="name" + .byte_len=4, .ptr="name" }; google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_name = { @@ -302,11 +302,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_name = { .type_name = NULL, }; static struct upb_string google_protobuf_DescriptorProto_field_fieldname = { - .byte_len=5, .data="field" + .byte_len=5, .ptr="field" }; static struct upb_string google_protobuf_DescriptorProto_field_field_typename = { - .byte_len=20, .data="FieldDescriptorProto" + .byte_len=20, .ptr="FieldDescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_field = { @@ -317,11 +317,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_field = { .type_name = &google_protobuf_DescriptorProto_field_field_typename, }; static struct upb_string google_protobuf_DescriptorProto_extension_fieldname = { - .byte_len=9, .data="extension" + .byte_len=9, .ptr="extension" }; static struct upb_string google_protobuf_DescriptorProto_extension_field_typename = { - .byte_len=20, .data="FieldDescriptorProto" + .byte_len=20, .ptr="FieldDescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_extension = { @@ -332,11 +332,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_extension = .type_name = &google_protobuf_DescriptorProto_extension_field_typename, }; static struct upb_string google_protobuf_DescriptorProto_nested_type_fieldname = { - .byte_len=11, .data="nested_type" + .byte_len=11, .ptr="nested_type" }; static struct upb_string google_protobuf_DescriptorProto_nested_type_field_typename = { - .byte_len=15, .data="DescriptorProto" + .byte_len=15, .ptr="DescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_nested_type = { @@ -347,11 +347,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_nested_type .type_name = &google_protobuf_DescriptorProto_nested_type_field_typename, }; static struct upb_string google_protobuf_DescriptorProto_enum_type_fieldname = { - .byte_len=9, .data="enum_type" + .byte_len=9, .ptr="enum_type" }; static struct upb_string google_protobuf_DescriptorProto_enum_type_field_typename = { - .byte_len=19, .data="EnumDescriptorProto" + .byte_len=19, .ptr="EnumDescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_enum_type = { @@ -362,11 +362,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_enum_type = .type_name = &google_protobuf_DescriptorProto_enum_type_field_typename, }; static struct upb_string google_protobuf_DescriptorProto_extension_range_fieldname = { - .byte_len=15, .data="extension_range" + .byte_len=15, .ptr="extension_range" }; static struct upb_string google_protobuf_DescriptorProto_extension_range_field_typename = { - .byte_len=14, .data="ExtensionRange" + .byte_len=14, .ptr="ExtensionRange" }; google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_extension_range = { @@ -377,11 +377,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_extension_r .type_name = &google_protobuf_DescriptorProto_extension_range_field_typename, }; static struct upb_string google_protobuf_DescriptorProto_options_fieldname = { - .byte_len=7, .data="options" + .byte_len=7, .ptr="options" }; static struct upb_string google_protobuf_DescriptorProto_options_field_typename = { - .byte_len=14, .data="MessageOptions" + .byte_len=14, .ptr="MessageOptions" }; google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_options = { @@ -393,7 +393,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_options = { }; /* google_protobuf_DescriptorProto_ExtensionRange_descriptor */ static struct upb_string google_protobuf_DescriptorProto_ExtensionRange_descriptor_name = { - .byte_len=14, .data="ExtensionRange" + .byte_len=14, .ptr="ExtensionRange" }; struct google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_ExtensionRange_start_descriptor; @@ -404,7 +404,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_DescriptorProto_Ext &google_protobuf_DescriptorProto_ExtensionRange_end_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_DescriptorProto_ExtensionRange_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_DescriptorProto_ExtensionRange_descriptor_field = { .len=2, .elements=google_protobuf_DescriptorProto_ExtensionRange_descriptor_field_array }; @@ -416,7 +416,7 @@ google_protobuf_DescriptorProto google_protobuf_DescriptorProto_ExtensionRange_d .extension_range = NULL, }; static struct upb_string google_protobuf_DescriptorProto_ExtensionRange_start_fieldname = { - .byte_len=5, .data="start" + .byte_len=5, .ptr="start" }; google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_ExtensionRange_start = { @@ -427,7 +427,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_ExtensionRa .type_name = NULL, }; static struct upb_string google_protobuf_DescriptorProto_ExtensionRange_end_fieldname = { - .byte_len=3, .data="end" + .byte_len=3, .ptr="end" }; google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_ExtensionRange_end = { @@ -439,7 +439,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_DescriptorProto_ExtensionRa }; /* google_protobuf_FieldDescriptorProto_descriptor */ static struct upb_string google_protobuf_FieldDescriptorProto_descriptor_name = { - .byte_len=20, .data="FieldDescriptorProto" + .byte_len=20, .ptr="FieldDescriptorProto" }; struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_name_descriptor; @@ -462,7 +462,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProt &google_protobuf_FieldDescriptorProto_options_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FieldDescriptorProto_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FieldDescriptorProto_descriptor_field = { .len=8, .elements=google_protobuf_FieldDescriptorProto_descriptor_field_array }; @@ -474,7 +474,7 @@ static google_protobuf_EnumDescriptorProto *google_protobuf_FieldDescriptorProto &google_protobuf_FieldDescriptorProto_Label_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_EnumDescriptorProto) google_protobuf_FieldDescriptorProto_descriptor_enum_type = { +static UPB_MSG_ARRAY(google_protobuf_EnumDescriptorProto) google_protobuf_FieldDescriptorProto_descriptor_enum_type = { .len=2, .elements=google_protobuf_FieldDescriptorProto_descriptor_enum_type_array }; @@ -486,7 +486,7 @@ google_protobuf_DescriptorProto google_protobuf_FieldDescriptorProto_descriptor .extension_range = NULL, }; static struct upb_string google_protobuf_FieldDescriptorProto_name_fieldname = { - .byte_len=4, .data="name" + .byte_len=4, .ptr="name" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_name = { @@ -497,7 +497,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_name = .type_name = NULL, }; static struct upb_string google_protobuf_FieldDescriptorProto_number_fieldname = { - .byte_len=6, .data="number" + .byte_len=6, .ptr="number" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_number = { @@ -508,11 +508,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_number .type_name = NULL, }; static struct upb_string google_protobuf_FieldDescriptorProto_label_fieldname = { - .byte_len=5, .data="label" + .byte_len=5, .ptr="label" }; static struct upb_string google_protobuf_FieldDescriptorProto_label_field_typename = { - .byte_len=5, .data="Label" + .byte_len=5, .ptr="Label" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_label = { @@ -523,11 +523,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_label .type_name = &google_protobuf_FieldDescriptorProto_label_field_typename, }; static struct upb_string google_protobuf_FieldDescriptorProto_type_fieldname = { - .byte_len=4, .data="type" + .byte_len=4, .ptr="type" }; static struct upb_string google_protobuf_FieldDescriptorProto_type_field_typename = { - .byte_len=4, .data="Type" + .byte_len=4, .ptr="Type" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_type = { @@ -538,7 +538,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_type = .type_name = &google_protobuf_FieldDescriptorProto_type_field_typename, }; static struct upb_string google_protobuf_FieldDescriptorProto_type_name_fieldname = { - .byte_len=9, .data="type_name" + .byte_len=9, .ptr="type_name" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_type_name = { @@ -549,7 +549,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_type_n .type_name = NULL, }; static struct upb_string google_protobuf_FieldDescriptorProto_extendee_fieldname = { - .byte_len=8, .data="extendee" + .byte_len=8, .ptr="extendee" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_extendee = { @@ -560,7 +560,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_extend .type_name = NULL, }; static struct upb_string google_protobuf_FieldDescriptorProto_default_value_fieldname = { - .byte_len=13, .data="default_value" + .byte_len=13, .ptr="default_value" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_default_value = { @@ -571,11 +571,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_defaul .type_name = NULL, }; static struct upb_string google_protobuf_FieldDescriptorProto_options_fieldname = { - .byte_len=7, .data="options" + .byte_len=7, .ptr="options" }; static struct upb_string google_protobuf_FieldDescriptorProto_options_field_typename = { - .byte_len=12, .data="FieldOptions" + .byte_len=12, .ptr="FieldOptions" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_options = { @@ -586,14 +586,14 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto_option .type_name = &google_protobuf_FieldDescriptorProto_options_field_typename, }; static struct upb_string google_protobuf_FieldDescriptorProto_Type_name = { - .byte_len=4, .data="Type" + .byte_len=4, .ptr="Type" }; google_protobuf_EnumDescriptorProto google_protobuf_FieldDescriptorProto_Type_descriptor = { .name = &google_protobuf_FieldDescriptorProto_Type_name, }; static struct upb_string google_protobuf_FieldDescriptorProto_Label_name = { - .byte_len=5, .data="Label" + .byte_len=5, .ptr="Label" }; google_protobuf_EnumDescriptorProto google_protobuf_FieldDescriptorProto_Label_descriptor = { @@ -601,7 +601,7 @@ google_protobuf_EnumDescriptorProto google_protobuf_FieldDescriptorProto_Label_d }; /* google_protobuf_EnumDescriptorProto_descriptor */ static struct upb_string google_protobuf_EnumDescriptorProto_descriptor_name = { - .byte_len=19, .data="EnumDescriptorProto" + .byte_len=19, .ptr="EnumDescriptorProto" }; struct google_protobuf_FieldDescriptorProto google_protobuf_EnumDescriptorProto_name_descriptor; @@ -614,7 +614,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_EnumDescriptorProto &google_protobuf_EnumDescriptorProto_options_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_EnumDescriptorProto_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_EnumDescriptorProto_descriptor_field = { .len=3, .elements=google_protobuf_EnumDescriptorProto_descriptor_field_array }; @@ -626,7 +626,7 @@ google_protobuf_DescriptorProto google_protobuf_EnumDescriptorProto_descriptor = .extension_range = NULL, }; static struct upb_string google_protobuf_EnumDescriptorProto_name_fieldname = { - .byte_len=4, .data="name" + .byte_len=4, .ptr="name" }; google_protobuf_FieldDescriptorProto google_protobuf_EnumDescriptorProto_name = { @@ -637,11 +637,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_EnumDescriptorProto_name = .type_name = NULL, }; static struct upb_string google_protobuf_EnumDescriptorProto_value_fieldname = { - .byte_len=5, .data="value" + .byte_len=5, .ptr="value" }; static struct upb_string google_protobuf_EnumDescriptorProto_value_field_typename = { - .byte_len=24, .data="EnumValueDescriptorProto" + .byte_len=24, .ptr="EnumValueDescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_EnumDescriptorProto_value = { @@ -652,11 +652,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_EnumDescriptorProto_value = .type_name = &google_protobuf_EnumDescriptorProto_value_field_typename, }; static struct upb_string google_protobuf_EnumDescriptorProto_options_fieldname = { - .byte_len=7, .data="options" + .byte_len=7, .ptr="options" }; static struct upb_string google_protobuf_EnumDescriptorProto_options_field_typename = { - .byte_len=11, .data="EnumOptions" + .byte_len=11, .ptr="EnumOptions" }; google_protobuf_FieldDescriptorProto google_protobuf_EnumDescriptorProto_options = { @@ -668,7 +668,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_EnumDescriptorProto_options }; /* google_protobuf_EnumValueDescriptorProto_descriptor */ static struct upb_string google_protobuf_EnumValueDescriptorProto_descriptor_name = { - .byte_len=24, .data="EnumValueDescriptorProto" + .byte_len=24, .ptr="EnumValueDescriptorProto" }; struct google_protobuf_FieldDescriptorProto google_protobuf_EnumValueDescriptorProto_name_descriptor; @@ -681,7 +681,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_EnumValueDescriptor &google_protobuf_EnumValueDescriptorProto_options_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_EnumValueDescriptorProto_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_EnumValueDescriptorProto_descriptor_field = { .len=3, .elements=google_protobuf_EnumValueDescriptorProto_descriptor_field_array }; @@ -693,7 +693,7 @@ google_protobuf_DescriptorProto google_protobuf_EnumValueDescriptorProto_descrip .extension_range = NULL, }; static struct upb_string google_protobuf_EnumValueDescriptorProto_name_fieldname = { - .byte_len=4, .data="name" + .byte_len=4, .ptr="name" }; google_protobuf_FieldDescriptorProto google_protobuf_EnumValueDescriptorProto_name = { @@ -704,7 +704,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_EnumValueDescriptorProto_na .type_name = NULL, }; static struct upb_string google_protobuf_EnumValueDescriptorProto_number_fieldname = { - .byte_len=6, .data="number" + .byte_len=6, .ptr="number" }; google_protobuf_FieldDescriptorProto google_protobuf_EnumValueDescriptorProto_number = { @@ -715,11 +715,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_EnumValueDescriptorProto_nu .type_name = NULL, }; static struct upb_string google_protobuf_EnumValueDescriptorProto_options_fieldname = { - .byte_len=7, .data="options" + .byte_len=7, .ptr="options" }; static struct upb_string google_protobuf_EnumValueDescriptorProto_options_field_typename = { - .byte_len=16, .data="EnumValueOptions" + .byte_len=16, .ptr="EnumValueOptions" }; google_protobuf_FieldDescriptorProto google_protobuf_EnumValueDescriptorProto_options = { @@ -731,7 +731,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_EnumValueDescriptorProto_op }; /* google_protobuf_ServiceDescriptorProto_descriptor */ static struct upb_string google_protobuf_ServiceDescriptorProto_descriptor_name = { - .byte_len=22, .data="ServiceDescriptorProto" + .byte_len=22, .ptr="ServiceDescriptorProto" }; struct google_protobuf_FieldDescriptorProto google_protobuf_ServiceDescriptorProto_name_descriptor; @@ -744,7 +744,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_ServiceDescriptorPr &google_protobuf_ServiceDescriptorProto_options_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_ServiceDescriptorProto_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_ServiceDescriptorProto_descriptor_field = { .len=3, .elements=google_protobuf_ServiceDescriptorProto_descriptor_field_array }; @@ -756,7 +756,7 @@ google_protobuf_DescriptorProto google_protobuf_ServiceDescriptorProto_descripto .extension_range = NULL, }; static struct upb_string google_protobuf_ServiceDescriptorProto_name_fieldname = { - .byte_len=4, .data="name" + .byte_len=4, .ptr="name" }; google_protobuf_FieldDescriptorProto google_protobuf_ServiceDescriptorProto_name = { @@ -767,11 +767,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_ServiceDescriptorProto_name .type_name = NULL, }; static struct upb_string google_protobuf_ServiceDescriptorProto_method_fieldname = { - .byte_len=6, .data="method" + .byte_len=6, .ptr="method" }; static struct upb_string google_protobuf_ServiceDescriptorProto_method_field_typename = { - .byte_len=21, .data="MethodDescriptorProto" + .byte_len=21, .ptr="MethodDescriptorProto" }; google_protobuf_FieldDescriptorProto google_protobuf_ServiceDescriptorProto_method = { @@ -782,11 +782,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_ServiceDescriptorProto_meth .type_name = &google_protobuf_ServiceDescriptorProto_method_field_typename, }; static struct upb_string google_protobuf_ServiceDescriptorProto_options_fieldname = { - .byte_len=7, .data="options" + .byte_len=7, .ptr="options" }; static struct upb_string google_protobuf_ServiceDescriptorProto_options_field_typename = { - .byte_len=14, .data="ServiceOptions" + .byte_len=14, .ptr="ServiceOptions" }; google_protobuf_FieldDescriptorProto google_protobuf_ServiceDescriptorProto_options = { @@ -798,7 +798,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_ServiceDescriptorProto_opti }; /* google_protobuf_MethodDescriptorProto_descriptor */ static struct upb_string google_protobuf_MethodDescriptorProto_descriptor_name = { - .byte_len=21, .data="MethodDescriptorProto" + .byte_len=21, .ptr="MethodDescriptorProto" }; struct google_protobuf_FieldDescriptorProto google_protobuf_MethodDescriptorProto_name_descriptor; @@ -813,7 +813,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_MethodDescriptorPro &google_protobuf_MethodDescriptorProto_options_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_MethodDescriptorProto_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_MethodDescriptorProto_descriptor_field = { .len=4, .elements=google_protobuf_MethodDescriptorProto_descriptor_field_array }; @@ -825,7 +825,7 @@ google_protobuf_DescriptorProto google_protobuf_MethodDescriptorProto_descriptor .extension_range = NULL, }; static struct upb_string google_protobuf_MethodDescriptorProto_name_fieldname = { - .byte_len=4, .data="name" + .byte_len=4, .ptr="name" }; google_protobuf_FieldDescriptorProto google_protobuf_MethodDescriptorProto_name = { @@ -836,7 +836,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_MethodDescriptorProto_name .type_name = NULL, }; static struct upb_string google_protobuf_MethodDescriptorProto_input_type_fieldname = { - .byte_len=10, .data="input_type" + .byte_len=10, .ptr="input_type" }; google_protobuf_FieldDescriptorProto google_protobuf_MethodDescriptorProto_input_type = { @@ -847,7 +847,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_MethodDescriptorProto_input .type_name = NULL, }; static struct upb_string google_protobuf_MethodDescriptorProto_output_type_fieldname = { - .byte_len=11, .data="output_type" + .byte_len=11, .ptr="output_type" }; google_protobuf_FieldDescriptorProto google_protobuf_MethodDescriptorProto_output_type = { @@ -858,11 +858,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_MethodDescriptorProto_outpu .type_name = NULL, }; static struct upb_string google_protobuf_MethodDescriptorProto_options_fieldname = { - .byte_len=7, .data="options" + .byte_len=7, .ptr="options" }; static struct upb_string google_protobuf_MethodDescriptorProto_options_field_typename = { - .byte_len=13, .data="MethodOptions" + .byte_len=13, .ptr="MethodOptions" }; google_protobuf_FieldDescriptorProto google_protobuf_MethodDescriptorProto_options = { @@ -874,7 +874,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_MethodDescriptorProto_optio }; /* google_protobuf_FileOptions_descriptor */ static struct upb_string google_protobuf_FileOptions_descriptor_name = { - .byte_len=11, .data="FileOptions" + .byte_len=11, .ptr="FileOptions" }; struct google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_java_package_descriptor; @@ -891,7 +891,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_FileOptions_descrip &google_protobuf_FileOptions_uninterpreted_option_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FileOptions_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FileOptions_descriptor_field = { .len=5, .elements=google_protobuf_FileOptions_descriptor_field_array }; @@ -901,7 +901,7 @@ static google_protobuf_EnumDescriptorProto *google_protobuf_FileOptions_descript &google_protobuf_FileOptions_OptimizeMode_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_EnumDescriptorProto) google_protobuf_FileOptions_descriptor_enum_type = { +static UPB_MSG_ARRAY(google_protobuf_EnumDescriptorProto) google_protobuf_FileOptions_descriptor_enum_type = { .len=1, .elements=google_protobuf_FileOptions_descriptor_enum_type_array }; @@ -911,7 +911,7 @@ static google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_FileOptio &google_protobuf_FileOptions_descriptor_extension_range0_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_FileOptions_descriptor_extension_range = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_FileOptions_descriptor_extension_range = { .len=1, .elements=google_protobuf_FileOptions_descriptor_extension_range_array }; @@ -923,7 +923,7 @@ google_protobuf_DescriptorProto google_protobuf_FileOptions_descriptor = { .extension_range = &google_protobuf_FileOptions_descriptor_extension_range, }; static struct upb_string google_protobuf_FileOptions_java_package_fieldname = { - .byte_len=12, .data="java_package" + .byte_len=12, .ptr="java_package" }; google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_java_package = { @@ -934,7 +934,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_java_package = .type_name = NULL, }; static struct upb_string google_protobuf_FileOptions_java_outer_classname_fieldname = { - .byte_len=20, .data="java_outer_classname" + .byte_len=20, .ptr="java_outer_classname" }; google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_java_outer_classname = { @@ -945,7 +945,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_java_outer_clas .type_name = NULL, }; static struct upb_string google_protobuf_FileOptions_java_multiple_files_fieldname = { - .byte_len=19, .data="java_multiple_files" + .byte_len=19, .ptr="java_multiple_files" }; google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_java_multiple_files = { @@ -956,11 +956,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_java_multiple_f .type_name = NULL, }; static struct upb_string google_protobuf_FileOptions_optimize_for_fieldname = { - .byte_len=12, .data="optimize_for" + .byte_len=12, .ptr="optimize_for" }; static struct upb_string google_protobuf_FileOptions_optimize_for_field_typename = { - .byte_len=12, .data="OptimizeMode" + .byte_len=12, .ptr="OptimizeMode" }; google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_optimize_for = { @@ -971,11 +971,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_optimize_for = .type_name = &google_protobuf_FileOptions_optimize_for_field_typename, }; static struct upb_string google_protobuf_FileOptions_uninterpreted_option_fieldname = { - .byte_len=20, .data="uninterpreted_option" + .byte_len=20, .ptr="uninterpreted_option" }; static struct upb_string google_protobuf_FileOptions_uninterpreted_option_field_typename = { - .byte_len=19, .data="UninterpretedOption" + .byte_len=19, .ptr="UninterpretedOption" }; google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_uninterpreted_option = { @@ -986,7 +986,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FileOptions_uninterpreted_o .type_name = &google_protobuf_FileOptions_uninterpreted_option_field_typename, }; static struct upb_string google_protobuf_FileOptions_OptimizeMode_name = { - .byte_len=12, .data="OptimizeMode" + .byte_len=12, .ptr="OptimizeMode" }; google_protobuf_EnumDescriptorProto google_protobuf_FileOptions_OptimizeMode_descriptor = { @@ -994,7 +994,7 @@ google_protobuf_EnumDescriptorProto google_protobuf_FileOptions_OptimizeMode_des }; /* google_protobuf_MessageOptions_descriptor */ static struct upb_string google_protobuf_MessageOptions_descriptor_name = { - .byte_len=14, .data="MessageOptions" + .byte_len=14, .ptr="MessageOptions" }; struct google_protobuf_FieldDescriptorProto google_protobuf_MessageOptions_message_set_wire_format_descriptor; @@ -1005,7 +1005,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_MessageOptions_desc &google_protobuf_MessageOptions_uninterpreted_option_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_MessageOptions_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_MessageOptions_descriptor_field = { .len=2, .elements=google_protobuf_MessageOptions_descriptor_field_array }; @@ -1015,7 +1015,7 @@ static google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_MessageOp &google_protobuf_MessageOptions_descriptor_extension_range0_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_MessageOptions_descriptor_extension_range = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_MessageOptions_descriptor_extension_range = { .len=1, .elements=google_protobuf_MessageOptions_descriptor_extension_range_array }; @@ -1027,7 +1027,7 @@ google_protobuf_DescriptorProto google_protobuf_MessageOptions_descriptor = { .extension_range = &google_protobuf_MessageOptions_descriptor_extension_range, }; static struct upb_string google_protobuf_MessageOptions_message_set_wire_format_fieldname = { - .byte_len=23, .data="message_set_wire_format" + .byte_len=23, .ptr="message_set_wire_format" }; google_protobuf_FieldDescriptorProto google_protobuf_MessageOptions_message_set_wire_format = { @@ -1038,11 +1038,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_MessageOptions_message_set_ .type_name = NULL, }; static struct upb_string google_protobuf_MessageOptions_uninterpreted_option_fieldname = { - .byte_len=20, .data="uninterpreted_option" + .byte_len=20, .ptr="uninterpreted_option" }; static struct upb_string google_protobuf_MessageOptions_uninterpreted_option_field_typename = { - .byte_len=19, .data="UninterpretedOption" + .byte_len=19, .ptr="UninterpretedOption" }; google_protobuf_FieldDescriptorProto google_protobuf_MessageOptions_uninterpreted_option = { @@ -1054,7 +1054,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_MessageOptions_uninterprete }; /* google_protobuf_FieldOptions_descriptor */ static struct upb_string google_protobuf_FieldOptions_descriptor_name = { - .byte_len=12, .data="FieldOptions" + .byte_len=12, .ptr="FieldOptions" }; struct google_protobuf_FieldDescriptorProto google_protobuf_FieldOptions_ctype_descriptor; @@ -1067,7 +1067,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_FieldOptions_descri &google_protobuf_FieldOptions_uninterpreted_option_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FieldOptions_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_FieldOptions_descriptor_field = { .len=3, .elements=google_protobuf_FieldOptions_descriptor_field_array }; @@ -1077,7 +1077,7 @@ static google_protobuf_EnumDescriptorProto *google_protobuf_FieldOptions_descrip &google_protobuf_FieldOptions_CType_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_EnumDescriptorProto) google_protobuf_FieldOptions_descriptor_enum_type = { +static UPB_MSG_ARRAY(google_protobuf_EnumDescriptorProto) google_protobuf_FieldOptions_descriptor_enum_type = { .len=1, .elements=google_protobuf_FieldOptions_descriptor_enum_type_array }; @@ -1087,7 +1087,7 @@ static google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_FieldOpti &google_protobuf_FieldOptions_descriptor_extension_range0_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_FieldOptions_descriptor_extension_range = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_FieldOptions_descriptor_extension_range = { .len=1, .elements=google_protobuf_FieldOptions_descriptor_extension_range_array }; @@ -1099,11 +1099,11 @@ google_protobuf_DescriptorProto google_protobuf_FieldOptions_descriptor = { .extension_range = &google_protobuf_FieldOptions_descriptor_extension_range, }; static struct upb_string google_protobuf_FieldOptions_ctype_fieldname = { - .byte_len=5, .data="ctype" + .byte_len=5, .ptr="ctype" }; static struct upb_string google_protobuf_FieldOptions_ctype_field_typename = { - .byte_len=5, .data="CType" + .byte_len=5, .ptr="CType" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldOptions_ctype = { @@ -1114,7 +1114,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldOptions_ctype = { .type_name = &google_protobuf_FieldOptions_ctype_field_typename, }; static struct upb_string google_protobuf_FieldOptions_experimental_map_key_fieldname = { - .byte_len=20, .data="experimental_map_key" + .byte_len=20, .ptr="experimental_map_key" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldOptions_experimental_map_key = { @@ -1125,11 +1125,11 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldOptions_experimental_m .type_name = NULL, }; static struct upb_string google_protobuf_FieldOptions_uninterpreted_option_fieldname = { - .byte_len=20, .data="uninterpreted_option" + .byte_len=20, .ptr="uninterpreted_option" }; static struct upb_string google_protobuf_FieldOptions_uninterpreted_option_field_typename = { - .byte_len=19, .data="UninterpretedOption" + .byte_len=19, .ptr="UninterpretedOption" }; google_protobuf_FieldDescriptorProto google_protobuf_FieldOptions_uninterpreted_option = { @@ -1140,7 +1140,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_FieldOptions_uninterpreted_ .type_name = &google_protobuf_FieldOptions_uninterpreted_option_field_typename, }; static struct upb_string google_protobuf_FieldOptions_CType_name = { - .byte_len=5, .data="CType" + .byte_len=5, .ptr="CType" }; google_protobuf_EnumDescriptorProto google_protobuf_FieldOptions_CType_descriptor = { @@ -1148,7 +1148,7 @@ google_protobuf_EnumDescriptorProto google_protobuf_FieldOptions_CType_descripto }; /* google_protobuf_EnumOptions_descriptor */ static struct upb_string google_protobuf_EnumOptions_descriptor_name = { - .byte_len=11, .data="EnumOptions" + .byte_len=11, .ptr="EnumOptions" }; struct google_protobuf_FieldDescriptorProto google_protobuf_EnumOptions_uninterpreted_option_descriptor; @@ -1157,7 +1157,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_EnumOptions_descrip &google_protobuf_EnumOptions_uninterpreted_option_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_EnumOptions_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_EnumOptions_descriptor_field = { .len=1, .elements=google_protobuf_EnumOptions_descriptor_field_array }; @@ -1167,7 +1167,7 @@ static google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_EnumOptio &google_protobuf_EnumOptions_descriptor_extension_range0_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_EnumOptions_descriptor_extension_range = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_EnumOptions_descriptor_extension_range = { .len=1, .elements=google_protobuf_EnumOptions_descriptor_extension_range_array }; @@ -1179,11 +1179,11 @@ google_protobuf_DescriptorProto google_protobuf_EnumOptions_descriptor = { .extension_range = &google_protobuf_EnumOptions_descriptor_extension_range, }; static struct upb_string google_protobuf_EnumOptions_uninterpreted_option_fieldname = { - .byte_len=20, .data="uninterpreted_option" + .byte_len=20, .ptr="uninterpreted_option" }; static struct upb_string google_protobuf_EnumOptions_uninterpreted_option_field_typename = { - .byte_len=19, .data="UninterpretedOption" + .byte_len=19, .ptr="UninterpretedOption" }; google_protobuf_FieldDescriptorProto google_protobuf_EnumOptions_uninterpreted_option = { @@ -1195,7 +1195,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_EnumOptions_uninterpreted_o }; /* google_protobuf_EnumValueOptions_descriptor */ static struct upb_string google_protobuf_EnumValueOptions_descriptor_name = { - .byte_len=16, .data="EnumValueOptions" + .byte_len=16, .ptr="EnumValueOptions" }; struct google_protobuf_FieldDescriptorProto google_protobuf_EnumValueOptions_uninterpreted_option_descriptor; @@ -1204,7 +1204,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_EnumValueOptions_de &google_protobuf_EnumValueOptions_uninterpreted_option_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_EnumValueOptions_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_EnumValueOptions_descriptor_field = { .len=1, .elements=google_protobuf_EnumValueOptions_descriptor_field_array }; @@ -1214,7 +1214,7 @@ static google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_EnumValue &google_protobuf_EnumValueOptions_descriptor_extension_range0_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_EnumValueOptions_descriptor_extension_range = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_EnumValueOptions_descriptor_extension_range = { .len=1, .elements=google_protobuf_EnumValueOptions_descriptor_extension_range_array }; @@ -1226,11 +1226,11 @@ google_protobuf_DescriptorProto google_protobuf_EnumValueOptions_descriptor = { .extension_range = &google_protobuf_EnumValueOptions_descriptor_extension_range, }; static struct upb_string google_protobuf_EnumValueOptions_uninterpreted_option_fieldname = { - .byte_len=20, .data="uninterpreted_option" + .byte_len=20, .ptr="uninterpreted_option" }; static struct upb_string google_protobuf_EnumValueOptions_uninterpreted_option_field_typename = { - .byte_len=19, .data="UninterpretedOption" + .byte_len=19, .ptr="UninterpretedOption" }; google_protobuf_FieldDescriptorProto google_protobuf_EnumValueOptions_uninterpreted_option = { @@ -1242,7 +1242,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_EnumValueOptions_uninterpre }; /* google_protobuf_ServiceOptions_descriptor */ static struct upb_string google_protobuf_ServiceOptions_descriptor_name = { - .byte_len=14, .data="ServiceOptions" + .byte_len=14, .ptr="ServiceOptions" }; struct google_protobuf_FieldDescriptorProto google_protobuf_ServiceOptions_uninterpreted_option_descriptor; @@ -1251,7 +1251,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_ServiceOptions_desc &google_protobuf_ServiceOptions_uninterpreted_option_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_ServiceOptions_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_ServiceOptions_descriptor_field = { .len=1, .elements=google_protobuf_ServiceOptions_descriptor_field_array }; @@ -1261,7 +1261,7 @@ static google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_ServiceOp &google_protobuf_ServiceOptions_descriptor_extension_range0_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_ServiceOptions_descriptor_extension_range = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_ServiceOptions_descriptor_extension_range = { .len=1, .elements=google_protobuf_ServiceOptions_descriptor_extension_range_array }; @@ -1273,11 +1273,11 @@ google_protobuf_DescriptorProto google_protobuf_ServiceOptions_descriptor = { .extension_range = &google_protobuf_ServiceOptions_descriptor_extension_range, }; static struct upb_string google_protobuf_ServiceOptions_uninterpreted_option_fieldname = { - .byte_len=20, .data="uninterpreted_option" + .byte_len=20, .ptr="uninterpreted_option" }; static struct upb_string google_protobuf_ServiceOptions_uninterpreted_option_field_typename = { - .byte_len=19, .data="UninterpretedOption" + .byte_len=19, .ptr="UninterpretedOption" }; google_protobuf_FieldDescriptorProto google_protobuf_ServiceOptions_uninterpreted_option = { @@ -1289,7 +1289,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_ServiceOptions_uninterprete }; /* google_protobuf_MethodOptions_descriptor */ static struct upb_string google_protobuf_MethodOptions_descriptor_name = { - .byte_len=13, .data="MethodOptions" + .byte_len=13, .ptr="MethodOptions" }; struct google_protobuf_FieldDescriptorProto google_protobuf_MethodOptions_uninterpreted_option_descriptor; @@ -1298,7 +1298,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_MethodOptions_descr &google_protobuf_MethodOptions_uninterpreted_option_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_MethodOptions_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_MethodOptions_descriptor_field = { .len=1, .elements=google_protobuf_MethodOptions_descriptor_field_array }; @@ -1308,7 +1308,7 @@ static google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_MethodOpt &google_protobuf_MethodOptions_descriptor_extension_range0_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_MethodOptions_descriptor_extension_range = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) google_protobuf_MethodOptions_descriptor_extension_range = { .len=1, .elements=google_protobuf_MethodOptions_descriptor_extension_range_array }; @@ -1320,11 +1320,11 @@ google_protobuf_DescriptorProto google_protobuf_MethodOptions_descriptor = { .extension_range = &google_protobuf_MethodOptions_descriptor_extension_range, }; static struct upb_string google_protobuf_MethodOptions_uninterpreted_option_fieldname = { - .byte_len=20, .data="uninterpreted_option" + .byte_len=20, .ptr="uninterpreted_option" }; static struct upb_string google_protobuf_MethodOptions_uninterpreted_option_field_typename = { - .byte_len=19, .data="UninterpretedOption" + .byte_len=19, .ptr="UninterpretedOption" }; google_protobuf_FieldDescriptorProto google_protobuf_MethodOptions_uninterpreted_option = { @@ -1336,7 +1336,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_MethodOptions_uninterpreted }; /* google_protobuf_UninterpretedOption_descriptor */ static struct upb_string google_protobuf_UninterpretedOption_descriptor_name = { - .byte_len=19, .data="UninterpretedOption" + .byte_len=19, .ptr="UninterpretedOption" }; struct google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_name_descriptor; @@ -1355,7 +1355,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_UninterpretedOption &google_protobuf_UninterpretedOption_string_value_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_UninterpretedOption_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_UninterpretedOption_descriptor_field = { .len=6, .elements=google_protobuf_UninterpretedOption_descriptor_field_array }; @@ -1365,7 +1365,7 @@ static google_protobuf_DescriptorProto *google_protobuf_UninterpretedOption_desc &google_protobuf_UninterpretedOption_NamePart_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto) google_protobuf_UninterpretedOption_descriptor_nested_type = { +static UPB_MSG_ARRAY(google_protobuf_DescriptorProto) google_protobuf_UninterpretedOption_descriptor_nested_type = { .len=1, .elements=google_protobuf_UninterpretedOption_descriptor_nested_type_array }; @@ -1377,11 +1377,11 @@ google_protobuf_DescriptorProto google_protobuf_UninterpretedOption_descriptor = .extension_range = NULL, }; static struct upb_string google_protobuf_UninterpretedOption_name_fieldname = { - .byte_len=4, .data="name" + .byte_len=4, .ptr="name" }; static struct upb_string google_protobuf_UninterpretedOption_name_field_typename = { - .byte_len=8, .data="NamePart" + .byte_len=8, .ptr="NamePart" }; google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_name = { @@ -1392,7 +1392,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_name = .type_name = &google_protobuf_UninterpretedOption_name_field_typename, }; static struct upb_string google_protobuf_UninterpretedOption_identifier_value_fieldname = { - .byte_len=16, .data="identifier_value" + .byte_len=16, .ptr="identifier_value" }; google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_identifier_value = { @@ -1403,7 +1403,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_identif .type_name = NULL, }; static struct upb_string google_protobuf_UninterpretedOption_positive_int_value_fieldname = { - .byte_len=18, .data="positive_int_value" + .byte_len=18, .ptr="positive_int_value" }; google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_positive_int_value = { @@ -1414,7 +1414,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_positiv .type_name = NULL, }; static struct upb_string google_protobuf_UninterpretedOption_negative_int_value_fieldname = { - .byte_len=18, .data="negative_int_value" + .byte_len=18, .ptr="negative_int_value" }; google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_negative_int_value = { @@ -1425,7 +1425,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_negativ .type_name = NULL, }; static struct upb_string google_protobuf_UninterpretedOption_double_value_fieldname = { - .byte_len=12, .data="double_value" + .byte_len=12, .ptr="double_value" }; google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_double_value = { @@ -1436,7 +1436,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_double_ .type_name = NULL, }; static struct upb_string google_protobuf_UninterpretedOption_string_value_fieldname = { - .byte_len=12, .data="string_value" + .byte_len=12, .ptr="string_value" }; google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_string_value = { @@ -1448,7 +1448,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_string_ }; /* google_protobuf_UninterpretedOption_NamePart_descriptor */ static struct upb_string google_protobuf_UninterpretedOption_NamePart_descriptor_name = { - .byte_len=8, .data="NamePart" + .byte_len=8, .ptr="NamePart" }; struct google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_NamePart_name_part_descriptor; @@ -1459,7 +1459,7 @@ static google_protobuf_FieldDescriptorProto *google_protobuf_UninterpretedOption &google_protobuf_UninterpretedOption_NamePart_is_extension_descriptor, }; -static UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_UninterpretedOption_NamePart_descriptor_field = { +static UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto) google_protobuf_UninterpretedOption_NamePart_descriptor_field = { .len=2, .elements=google_protobuf_UninterpretedOption_NamePart_descriptor_field_array }; @@ -1471,7 +1471,7 @@ google_protobuf_DescriptorProto google_protobuf_UninterpretedOption_NamePart_des .extension_range = NULL, }; static struct upb_string google_protobuf_UninterpretedOption_NamePart_name_part_fieldname = { - .byte_len=9, .data="name_part" + .byte_len=9, .ptr="name_part" }; google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_NamePart_name_part = { @@ -1482,7 +1482,7 @@ google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_NamePar .type_name = NULL, }; static struct upb_string google_protobuf_UninterpretedOption_NamePart_is_extension_fieldname = { - .byte_len=12, .data="is_extension" + .byte_len=12, .ptr="is_extension" }; google_protobuf_FieldDescriptorProto google_protobuf_UninterpretedOption_NamePart_is_extension = { diff --git a/descriptor.h b/descriptor.h index b49f77d..ea6fa78 100644 --- a/descriptor.h +++ b/descriptor.h @@ -125,9 +125,9 @@ struct google_protobuf_FileDescriptorSet { bool file:1; /* = 1, repeated. */ } has; } set_flags; - UPB_STRUCT_ARRAY(google_protobuf_FileDescriptorProto)* file; + UPB_MSG_ARRAY(google_protobuf_FileDescriptorProto)* file; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_FileDescriptorSet) +UPB_DEFINE_MSG_ARRAY(google_protobuf_FileDescriptorSet) struct google_protobuf_FileDescriptorProto { union { @@ -146,13 +146,13 @@ struct google_protobuf_FileDescriptorProto { struct upb_string* name; struct upb_string* package; struct upb_string_array* dependency; - UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto)* message_type; - UPB_STRUCT_ARRAY(google_protobuf_EnumDescriptorProto)* enum_type; - UPB_STRUCT_ARRAY(google_protobuf_ServiceDescriptorProto)* service; - UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto)* extension; + UPB_MSG_ARRAY(google_protobuf_DescriptorProto)* message_type; + UPB_MSG_ARRAY(google_protobuf_EnumDescriptorProto)* enum_type; + UPB_MSG_ARRAY(google_protobuf_ServiceDescriptorProto)* service; + UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto)* extension; google_protobuf_FileOptions* options; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_FileDescriptorProto) +UPB_DEFINE_MSG_ARRAY(google_protobuf_FileDescriptorProto) struct google_protobuf_DescriptorProto_ExtensionRange { union { @@ -165,7 +165,7 @@ struct google_protobuf_DescriptorProto_ExtensionRange { int32_t start; int32_t end; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) +UPB_DEFINE_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) struct google_protobuf_DescriptorProto { union { uint8_t bytes[1]; @@ -180,14 +180,14 @@ struct google_protobuf_DescriptorProto { } has; } set_flags; struct upb_string* name; - UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto)* field; - UPB_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto)* extension; - UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto)* nested_type; - UPB_STRUCT_ARRAY(google_protobuf_EnumDescriptorProto)* enum_type; - UPB_STRUCT_ARRAY(google_protobuf_DescriptorProto_ExtensionRange)* extension_range; + UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto)* field; + UPB_MSG_ARRAY(google_protobuf_FieldDescriptorProto)* extension; + UPB_MSG_ARRAY(google_protobuf_DescriptorProto)* nested_type; + UPB_MSG_ARRAY(google_protobuf_EnumDescriptorProto)* enum_type; + UPB_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange)* extension_range; google_protobuf_MessageOptions* options; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_DescriptorProto) +UPB_DEFINE_MSG_ARRAY(google_protobuf_DescriptorProto) struct google_protobuf_FieldDescriptorProto { union { @@ -212,7 +212,7 @@ struct google_protobuf_FieldDescriptorProto { struct upb_string* default_value; google_protobuf_FieldOptions* options; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_FieldDescriptorProto) +UPB_DEFINE_MSG_ARRAY(google_protobuf_FieldDescriptorProto) struct google_protobuf_EnumDescriptorProto { union { @@ -224,10 +224,10 @@ struct google_protobuf_EnumDescriptorProto { } has; } set_flags; struct upb_string* name; - UPB_STRUCT_ARRAY(google_protobuf_EnumValueDescriptorProto)* value; + UPB_MSG_ARRAY(google_protobuf_EnumValueDescriptorProto)* value; google_protobuf_EnumOptions* options; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_EnumDescriptorProto) +UPB_DEFINE_MSG_ARRAY(google_protobuf_EnumDescriptorProto) struct google_protobuf_EnumValueDescriptorProto { union { @@ -242,7 +242,7 @@ struct google_protobuf_EnumValueDescriptorProto { int32_t number; google_protobuf_EnumValueOptions* options; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_EnumValueDescriptorProto) +UPB_DEFINE_MSG_ARRAY(google_protobuf_EnumValueDescriptorProto) struct google_protobuf_ServiceDescriptorProto { union { @@ -254,10 +254,10 @@ struct google_protobuf_ServiceDescriptorProto { } has; } set_flags; struct upb_string* name; - UPB_STRUCT_ARRAY(google_protobuf_MethodDescriptorProto)* method; + UPB_MSG_ARRAY(google_protobuf_MethodDescriptorProto)* method; google_protobuf_ServiceOptions* options; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_ServiceDescriptorProto) +UPB_DEFINE_MSG_ARRAY(google_protobuf_ServiceDescriptorProto) struct google_protobuf_MethodDescriptorProto { union { @@ -274,7 +274,7 @@ struct google_protobuf_MethodDescriptorProto { struct upb_string* output_type; google_protobuf_MethodOptions* options; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_MethodDescriptorProto) +UPB_DEFINE_MSG_ARRAY(google_protobuf_MethodDescriptorProto) struct google_protobuf_FileOptions { union { @@ -291,9 +291,9 @@ struct google_protobuf_FileOptions { struct upb_string* java_outer_classname; bool java_multiple_files; int32_t optimize_for; /* enum google.protobuf.FileOptions.OptimizeMode */ - UPB_STRUCT_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; + UPB_MSG_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_FileOptions) +UPB_DEFINE_MSG_ARRAY(google_protobuf_FileOptions) struct google_protobuf_MessageOptions { union { @@ -304,9 +304,9 @@ struct google_protobuf_MessageOptions { } has; } set_flags; bool message_set_wire_format; - UPB_STRUCT_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; + UPB_MSG_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_MessageOptions) +UPB_DEFINE_MSG_ARRAY(google_protobuf_MessageOptions) struct google_protobuf_FieldOptions { union { @@ -319,9 +319,9 @@ struct google_protobuf_FieldOptions { } set_flags; int32_t ctype; /* enum google.protobuf.FieldOptions.CType */ struct upb_string* experimental_map_key; - UPB_STRUCT_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; + UPB_MSG_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_FieldOptions) +UPB_DEFINE_MSG_ARRAY(google_protobuf_FieldOptions) struct google_protobuf_EnumOptions { union { @@ -330,9 +330,9 @@ struct google_protobuf_EnumOptions { bool uninterpreted_option:1; /* = 999, repeated. */ } has; } set_flags; - UPB_STRUCT_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; + UPB_MSG_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_EnumOptions) +UPB_DEFINE_MSG_ARRAY(google_protobuf_EnumOptions) struct google_protobuf_EnumValueOptions { union { @@ -341,9 +341,9 @@ struct google_protobuf_EnumValueOptions { bool uninterpreted_option:1; /* = 999, repeated. */ } has; } set_flags; - UPB_STRUCT_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; + UPB_MSG_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_EnumValueOptions) +UPB_DEFINE_MSG_ARRAY(google_protobuf_EnumValueOptions) struct google_protobuf_ServiceOptions { union { @@ -352,9 +352,9 @@ struct google_protobuf_ServiceOptions { bool uninterpreted_option:1; /* = 999, repeated. */ } has; } set_flags; - UPB_STRUCT_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; + UPB_MSG_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_ServiceOptions) +UPB_DEFINE_MSG_ARRAY(google_protobuf_ServiceOptions) struct google_protobuf_MethodOptions { union { @@ -363,9 +363,9 @@ struct google_protobuf_MethodOptions { bool uninterpreted_option:1; /* = 999, repeated. */ } has; } set_flags; - UPB_STRUCT_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; + UPB_MSG_ARRAY(google_protobuf_UninterpretedOption)* uninterpreted_option; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_MethodOptions) +UPB_DEFINE_MSG_ARRAY(google_protobuf_MethodOptions) struct google_protobuf_UninterpretedOption_NamePart { union { @@ -378,7 +378,7 @@ struct google_protobuf_UninterpretedOption_NamePart { struct upb_string* name_part; bool is_extension; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_UninterpretedOption_NamePart) +UPB_DEFINE_MSG_ARRAY(google_protobuf_UninterpretedOption_NamePart) struct google_protobuf_UninterpretedOption { union { uint8_t bytes[1]; @@ -391,13 +391,13 @@ struct google_protobuf_UninterpretedOption { bool string_value:1; /* = 7, optional. */ } has; } set_flags; - UPB_STRUCT_ARRAY(google_protobuf_UninterpretedOption_NamePart)* name; + UPB_MSG_ARRAY(google_protobuf_UninterpretedOption_NamePart)* name; struct upb_string* identifier_value; uint64_t positive_int_value; int64_t negative_int_value; double double_value; struct upb_string* string_value; }; -UPB_DEFINE_STRUCT_ARRAY(google_protobuf_UninterpretedOption) +UPB_DEFINE_MSG_ARRAY(google_protobuf_UninterpretedOption) extern google_protobuf_FileDescriptorProto google_protobuf_filedescriptor; diff --git a/upb.h b/upb.h index 39ca0de..f5f19d3 100644 --- a/upb.h +++ b/upb.h @@ -38,13 +38,18 @@ extern "C" { struct upb_string { /* We expect the data to be 8-bit clean (uint8_t), but char* is such an * ingrained convention that we follow it. */ - char *data; + char *ptr; uint32_t byte_len; }; -INLINE bool upb_string_eql(struct upb_string *s1, struct upb_string *s2) { +INLINE bool upb_streql(struct upb_string *s1, struct upb_string *s2) { return s1->byte_len == s2->byte_len && - memcmp(s1->data, s2->data, s1->byte_len) == 0; + memcmp(s1->ptr, s2->ptr, s1->byte_len) == 0; +} + +INLINE void upb_strcpy(struct upb_string *dest, struct upb_string *src) { + memcpy(dest->ptr, src->ptr, dest->byte_len); + dest->byte_len = src->byte_len; } /* A list of types as they are encoded on-the-wire. */ @@ -72,16 +77,21 @@ union upb_wire_value { * represent exceptional circumstances. */ typedef uint8_t upb_field_type_t; +/* Label (optional, repeated, required) as defined in a .proto file. The values + * of this are defined by google.protobuf.FieldDescriptorProto.Label (from + * descriptor.proto). */ +typedef uint8_t upb_label_t; + struct upb_type_info { uint8_t align; uint8_t size; uint8_t expected_wire_type; }; +/* This array is indexed by upb_field_type_t. */ extern struct upb_type_info upb_type_info[]; -/* A value as described in a .proto file, except delimited, which is handled - * separately. */ +/* A scalar value as described in a .proto file */ union upb_value { double _double; float _float; @@ -90,7 +100,19 @@ union upb_value { uint32_t uint32; uint64_t uint64; bool _bool; - uint32_t delim_len; +}; + +union upb_value_ptr { + double *_double; + float *_float; + int32_t *int32; + int64_t *int64; + uint32_t *uint32; + uint64_t *uint64; + bool *_bool; + struct upb_string **string; + struct upb_array **array; + void *_void; }; /* The number of a field, eg. "optional string foo = 3". */ diff --git a/upb_context.c b/upb_context.c index 79ce20d..9fd6cef 100644 --- a/upb_context.c +++ b/upb_context.c @@ -46,28 +46,28 @@ static struct upb_symtab_entry *resolve(struct upb_strtable *t, if(base->byte_len + symbol->byte_len + 1 >= UPB_SYM_MAX_LENGTH || symbol->byte_len == 0) return NULL; - if(symbol->data[0] == UPB_CONTEXT_SEPARATOR) { + if(symbol->ptr[0] == UPB_CONTEXT_SEPARATOR) { /* Symbols starting with '.' are absolute, so we do a single lookup. */ - struct upb_string sym_str = {.data = symbol->data+1, + struct upb_string sym_str = {.ptr = symbol->ptr+1, .byte_len = symbol->byte_len-1}; return upb_strtable_lookup(t, &sym_str); } else { /* Remove components from base until we find an entry or run out. */ char sym[UPB_SYM_MAX_LENGTH+1]; - struct upb_string sym_str = {.data = sym}; + struct upb_string sym_str = {.ptr = sym}; int baselen = base->byte_len; while(1) { /* sym_str = base[0...base_len] + UPB_CONTEXT_SEPARATOR + symbol */ - memcpy(sym, base->data, baselen); + memcpy(sym, base->ptr, baselen); sym[baselen] = UPB_CONTEXT_SEPARATOR; - memcpy(sym + baselen + 1, symbol->data, symbol->byte_len); + memcpy(sym + baselen + 1, symbol->ptr, symbol->byte_len); sym_str.byte_len = baselen + symbol->byte_len + 1; struct upb_symtab_entry *e = upb_strtable_lookup(t, &sym_str); if (e) return e; else if(baselen == 0) return NULL; /* No more scopes to try. */ - baselen = memrchr(base->data, UPB_CONTEXT_SEPARATOR, baselen); + baselen = memrchr(base->ptr, UPB_CONTEXT_SEPARATOR, baselen); } } } @@ -96,14 +96,14 @@ struct upb_symtab_entry *upb_context_resolve(struct upb_context *c, static struct upb_string join(struct upb_string *base, struct upb_string *name) { size_t len = base->byte_len + name->byte_len; if(base->byte_len > 0) len++; /* For the separator. */ - struct upb_string joined = {.byte_len=len, .data=malloc(len)}; + struct upb_string joined = {.byte_len=len, .ptr=malloc(len)}; if(base->byte_len > 0) { /* nested_base = base + '.' + d->name */ - memcpy(joined.data, base->data, base->byte_len); - joined.data[base->byte_len] = UPB_CONTEXT_SEPARATOR; - memcpy(&joined.data[base->byte_len+1], name->data, name->byte_len); + memcpy(joined.ptr, base->ptr, base->byte_len); + joined.ptr[base->byte_len] = UPB_CONTEXT_SEPARATOR; + memcpy(&joined.ptr[base->byte_len+1], name->ptr, name->byte_len); } else { - memcpy(joined.data, name->data, name->byte_len); + memcpy(joined.ptr, name->ptr, name->byte_len); } return joined; } @@ -119,7 +119,7 @@ static bool insert_enum(struct upb_strtable *t, /* Redefinition within a FileDescriptorProto is not allowed. */ if(upb_strtable_lookup(t, &fqname)) { - free(fqname.data); + free(fqname.ptr); return false; } @@ -144,7 +144,7 @@ static bool insert_message(struct upb_strtable *t, /* Redefinition within a FileDescriptorProto is not allowed. */ if(upb_strtable_lookup(t, d->name)) { - free(fqname.data); + free(fqname.ptr); return false; } diff --git a/upb_msg.c b/upb_msg.c index f2ad6c4..bf55764 100644 --- a/upb_msg.c +++ b/upb_msg.c @@ -92,45 +92,155 @@ void upb_msg_free(struct upb_msg *m) free(m->fields); } -#if 0 -struct parse_frame_data { - struct upb_msg *m; - void *data; +void *upb_msg_new(struct upb_msg *m) +{ + void *msg = malloc(m->size); + memset(msg, 0, m->size); /* Clear all pointers, values, and set bits. */ + return msg; +} + +//void upb_msg_free(void *msg, struct upb_msg *m, bool free_submsgs); + +struct mm_upb_string { + struct upb_string s; + uint32_t size; + char *data; }; -static void set_frame_data(struct upb_parse_state *s, struct upb_msg *m) +struct mm_upb_array { + struct upb_array a; + uint32_t size; + char *data; +}; + +uint32_t round_up_to_pow2(uint32_t v) +{ +#ifdef __GNUC__ + return (1U<<31) >> (__builtin_clz(v-1)+1); +#else + /* cf. http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 */ + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v++; + return v; +#endif +} + +void upb_msg_reuse_str(struct upb_string **str, uint32_t size) +{ + if(!*str) *str = malloc(sizeof(struct mm_upb_string)); + struct mm_upb_string *s = (void*)*str; + if(s->size < size) { + size = max(16, round_up_to_pow2(size)); + s->data = realloc(s->data, size); + s->size = size; + } + s->s.ptr = s->data; +} + +void upb_msg_reuse_array(struct upb_array **arr, uint32_t n, upb_field_type_t t) { + if(!*arr) *arr = malloc(sizeof(struct mm_upb_array)); + struct mm_upb_array *a = (void*)*arr; + if(a->size < n) { + n = max(16, round_up_to_pow2(n)); + a->a.elements._void = realloc(a->a.elements._void, n*upb_type_info[t].size); + a->size = n; + } } +void upb_msg_reuse_strref(struct upb_string **str) { upb_msg_reuse_str(str, 0); } + +void upb_msg_reuse_submsg(void **msg, struct upb_msg *m) +{ + if(!*msg) *msg = malloc(m->size); + upb_msg_clear(*msg, m); /* Clears set bits, leaves pointers. */ +} + +/* Parser. */ + +struct parse_frame_data { + struct upb_msg *m; + void *data; +}; + static upb_field_type_t tag_cb(struct upb_parse_state *s, struct upb_tag *tag, void **user_field_desc) { - struct upb_msg *m = (struct upb_msg*)s->top->user_data; - struct upb_msg_field *f = upb_msg_fieldbynum(m, tag->field_number); + struct parse_frame_data *frame = (void*)s->top->user_data; + struct upb_msg_field *f = upb_msg_fieldbynum(frame->m, tag->field_number); if(!f || !upb_check_type(tag->wire_type, f->type)) return 0; /* Skip unknown or fields of the wrong type. */ - *user_field_desc = f->ref.msg; + *user_field_desc = f; return f->type; } -static void value_cb(struct upb_parse_state *s, union upb_value *v, - void *str, void *user_field_desc) +static upb_status_t value_cb(struct upb_parse_state *s, void **buf, void *end, + upb_field_type_t type, void *user_field_desc) { - *user_field_desc = f->ref.msg; + struct parse_frame_data *frame = (void*)s->top->user_data; + struct upb_msg_field *f = user_field_desc; + union upb_value_ptr p = upb_msg_get_ptr(frame->data, f); + if(f->label == GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_REPEATED) { + upb_msg_reuse_array(p.array, (*p.array)->len, type); + p = upb_array_getelementptr(*p.array, (*p.array)->len++, type); + } + UPB_CHECK(upb_parse_value(buf, end, type, p)); + return UPB_STATUS_OK; +} + +static upb_status_t str_cb(struct upb_parse_state *s, struct upb_string *str, + upb_field_type_t type, void *user_field_desc) +{ + struct parse_frame_data *frame = (void*)s->top->user_data; + struct upb_msg_field *f = user_field_desc; + union upb_value_ptr p = upb_msg_get_ptr(frame->data, f); + if(f->label == GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_REPEATED) { + upb_msg_reuse_array(p.array, (*p.array)->len, type); + p = upb_array_getelementptr(*p.array, (*p.array)->len++, type); + } + bool byref = false; + if(byref) { + upb_msg_reuse_strref(p.string); + **p.string = *str; + } else { + upb_msg_reuse_str(p.string, str->byte_len); + upb_strcpy(*p.string, str); + } + return UPB_STATUS_OK; +} + +static void set_frame_data(struct upb_parse_state *s, struct upb_msg *m, + void *data) +{ + struct parse_frame_data *frame = (void*)s->top->user_data; + frame->m = m; + frame->data = data; } static void submsg_start_cb(struct upb_parse_state *s, void *user_field_desc) { - set_frame_data(s, user_field_desc); + struct upb_msg_field *f = user_field_desc; + struct parse_frame_data *frame = (void*)s->top->user_data; + void **submsg = upb_msg_get_submsg_ptr(frame->data, f); + upb_msg_reuse_submsg(submsg, f->ref.msg); + set_frame_data(s, f->ref.msg, *submsg); } -void *upb_msg_parse(struct upb_msg *m, struct upb_string *str) +upb_status_t upb_msg_merge(void *data, struct upb_msg *m, struct upb_string *str) { struct upb_parse_state s; upb_parse_state_init(&s, sizeof(struct parse_frame_data)); - set_frame_data(&s, m); + set_frame_data(&s, m, data); s.tag_cb = tag_cb; s.value_cb = value_cb; + s.str_cb = str_cb; s.submsg_start_cb = submsg_start_cb; + size_t read; + UPB_CHECK(upb_parse(&s, str->ptr, str->byte_len, &read)); + return UPB_STATUS_OK; } -#endif diff --git a/upb_msg.h b/upb_msg.h index 9608e64..605ca94 100644 --- a/upb_msg.h +++ b/upb_msg.h @@ -62,6 +62,7 @@ struct upb_msg_field { uint32_t byte_offset; /* Where to find the data. */ uint16_t field_index; /* Indexes upb_msg.fields. Also indicates set bit */ upb_field_type_t type; /* Copied from descriptor for cache-friendliness. */ + upb_label_t label; union upb_symbol_ref ref; }; @@ -127,71 +128,70 @@ INLINE struct upb_msg_field *upb_msg_fieldbyname(struct upb_msg *m, return e ? &e->f : NULL; } -/* Variable-length data (strings and arrays).**********************************/ +/* Arrays. ********************************************************************/ /* Represents an array (a repeated field) of any type. The interpretation of * the data in the array depends on the type. */ struct upb_array { - void *data; /* Size of individual elements is based on type. */ + union { + double *_double; + float *_float; + int32_t *int32; + int64_t *int64; + uint32_t *uint32; + uint64_t *uint64; + bool *_bool; + struct upb_string **string; + void **submsg; + void *_void; + } elements; uint32_t len; /* Measured in elements. */ }; -/* A generic array of structs, using void* instead of specific types. */ -struct upb_msg_array { - void **elements; - uint32_t len; -}; - -/* An array of strings. */ -struct upb_string_array { - struct upb_string **elements; - uint32_t len; -}; - -/* Specific arrays of all the primitive types. */ -#define UPB_DEFINE_PRIMITIVE_ARRAY(type, name) \ +/* These are all overlays on upb_array, pointers between them can be cast. */ +#define UPB_DEFINE_ARRAY_TYPE(name, type) \ struct upb_ ## name ## _array { \ - size_t len; \ type *elements; \ + uint32_t len; \ }; -UPB_DEFINE_PRIMITIVE_ARRAY(double, double) -UPB_DEFINE_PRIMITIVE_ARRAY(float, float) -UPB_DEFINE_PRIMITIVE_ARRAY(int32_t, int32) -UPB_DEFINE_PRIMITIVE_ARRAY(int64_t, int64) -UPB_DEFINE_PRIMITIVE_ARRAY(uint32_t, uint32) -UPB_DEFINE_PRIMITIVE_ARRAY(uint64_t, uint64) -UPB_DEFINE_PRIMITIVE_ARRAY(bool, bool) -#undef UPB_DEFINE_PRMITIVE_ARRAY - -#define UPB_STRUCT_ARRAY(struct_type) struct struct_type ## _array - -#define UPB_DEFINE_STRUCT_ARRAY(struct_type) \ - UPB_STRUCT_ARRAY(struct_type) { \ - size_t len; \ - struct_type **elements; \ +union upb_value_ptr upb_array_getelementptr(struct upb_array *arr, uint32_t n, + upb_field_type_t type) +{ + union upb_value_ptr ptr = { + ._void = ((char*)arr->elements._void + n*upb_type_info[type].size) + }; + return ptr; +} + +UPB_DEFINE_ARRAY_TYPE(upb_double, double) +UPB_DEFINE_ARRAY_TYPE(upb_float, float) +UPB_DEFINE_ARRAY_TYPE(upb_int32, int32_t) +UPB_DEFINE_ARRAY_TYPE(upb_int64, int64_t) +UPB_DEFINE_ARRAY_TYPE(upb_uint32, uint32_t) +UPB_DEFINE_ARRAY_TYPE(upb_uint64, uint64_t) +UPB_DEFINE_ARRAY_TYPE(upb_bool, bool) +UPB_DEFINE_ARRAY_TYPE(upb_string, struct upb_string*) + +#define UPB_MSG_ARRAY(msg_type) struct msg_type ## _array +#define UPB_DEFINE_MSG_ARRAY(msg_type) \ + UPB_MSG_ARRAY(msg_type) { \ + msg_type **elements; \ + uint32_t len; \ }; /* Accessors for primitive types. ********************************************/ -/* For each primitive type we define a set of six functions: +/* For each primitive type we define a set of three functions: * * // For fetching out of a msg (s points to the raw msg data). * int32_t *upb_msg_get_int32_ptr(void *s, struct upb_msg_field *f); * int32_t upb_msg_get_int32(void *s, struct upb_msg_field *f); * void upb_msg_set_int32(void *s, struct upb_msg_field *f, int32_t val); * - * // For fetching out of an array. - * int32_t *upb_array_get_int32_ptr(struct upb_array *a, int n); - * int32_t upb_array_get_int32(struct upb_array *a, int n); - * void upb_array_set_int32(struct upb_array *a, int n, ctype val); - * - * For arrays we provide only the first three because protobufs do not support - * arrays of arrays. - * * These do no existence checks, bounds checks, or type checks. */ -#define UPB_DEFINE_ACCESSORS(ctype, name, INLINE) \ +#define UPB_DEFINE_ACCESSORS(INLINE, name, ctype) \ INLINE ctype *upb_msg_get_ ## name ## _ptr( \ void *s, struct upb_msg_field *f) { \ return (ctype*)((char*)s + f->byte_offset); \ @@ -205,32 +205,35 @@ UPB_DEFINE_PRIMITIVE_ARRAY(bool, bool) *upb_msg_get_ ## name ## _ptr(s, f) = val; \ } -#define UPB_DEFINE_ARRAY_ACCESSORS(ctype, name, INLINE) \ - INLINE ctype *upb_array_get_ ## name ## _ptr(struct upb_array *a, int n) { \ - return ((ctype*)a->data) + n; \ - } \ - INLINE ctype upb_array_get_ ## name(struct upb_array *a, int n) { \ - return *upb_array_get_ ## name ## _ptr(a, n); \ - } \ - INLINE void upb_array_set_ ## name(struct upb_array *a, int n, ctype val) { \ - *upb_array_get_ ## name ## _ptr(a, n) = val; \ - } +UPB_DEFINE_ACCESSORS(INLINE, double, double) +UPB_DEFINE_ACCESSORS(INLINE, float, float) +UPB_DEFINE_ACCESSORS(INLINE, int32, int32_t) +UPB_DEFINE_ACCESSORS(INLINE, int64, int64_t) +UPB_DEFINE_ACCESSORS(INLINE, uint32, uint32_t) +UPB_DEFINE_ACCESSORS(INLINE, uint64, uint64_t) +UPB_DEFINE_ACCESSORS(INLINE, bool, bool) +UPB_DEFINE_ACCESSORS(INLINE, bytes, struct upb_string*) +UPB_DEFINE_ACCESSORS(INLINE, string, struct upb_string*) +UPB_DEFINE_ACCESSORS(INLINE, submsg, void*) +UPB_DEFINE_ACCESSORS(INLINE, array, struct upb_array*) + +INLINE union upb_value_ptr upb_msg_get_ptr( + void *data, struct upb_msg_field *f) { + union upb_value_ptr p = {._void = ((char*)data + f->byte_offset)}; + return p; +} + +/* Memory management *********************************************************/ + +void *upb_msg_new(struct upb_msg *m); +//void upb_msg_free(void *msg, struct upb_msg *m, bool free_submsgs); -#define UPB_DEFINE_ALL_ACCESSORS(ctype, name, INLINE) \ - UPB_DEFINE_ACCESSORS(ctype, name, INLINE) \ - UPB_DEFINE_ARRAY_ACCESSORS(ctype, name, INLINE) - -UPB_DEFINE_ALL_ACCESSORS(double, double, INLINE) -UPB_DEFINE_ALL_ACCESSORS(float, float, INLINE) -UPB_DEFINE_ALL_ACCESSORS(int32_t, int32, INLINE) -UPB_DEFINE_ALL_ACCESSORS(int64_t, int64, INLINE) -UPB_DEFINE_ALL_ACCESSORS(uint32_t, uint32, INLINE) -UPB_DEFINE_ALL_ACCESSORS(uint64_t, uint64, INLINE) -UPB_DEFINE_ALL_ACCESSORS(bool, bool, INLINE) -UPB_DEFINE_ALL_ACCESSORS(struct upb_string*, bytes, INLINE) -UPB_DEFINE_ALL_ACCESSORS(struct upb_string*, string, INLINE) -UPB_DEFINE_ALL_ACCESSORS(void*, submsg, INLINE) -UPB_DEFINE_ACCESSORS(struct upb_array*, array, INLINE) +/* Note! These two may not be use on a upb_string* that was initialized by + * means other than these functions. */ +void upb_msg_reuse_str(struct upb_string **str, uint32_t len); +void upb_msg_reuse_array(struct upb_array **arr, uint32_t n, upb_field_type_t t); +void upb_msg_reuse_strref(struct upb_string **str); +void upb_msg_reuse_submsg(void **msg, struct upb_msg *m); /* "Set" flag reading and writing. *******************************************/ @@ -279,10 +282,8 @@ INLINE void upb_msg_clear(void *s, struct upb_msg *m) /* Serialization/Deserialization. ********************************************/ -/* Parses the string data in s according to the message description in m. - * Returns a newly allocated message which is now owned by the caller, or - * NULL if there was an error parsing the string. */ -void *upb_msg_parse(struct upb_msg *m, struct upb_string *s); +/* Parses the string data in s according to the message description in m. */ +upb_status_t upb_msg_merge(void *data, struct upb_msg *m, struct upb_string *s); #ifdef __cplusplus } /* extern "C" */ diff --git a/upb_parse.c b/upb_parse.c index 673241d..625b2cc 100644 --- a/upb_parse.c +++ b/upb_parse.c @@ -222,11 +222,11 @@ upb_status_t upb_skip_wire_value(void **buf, void *end, upb_wire_type_t wt) } upb_status_t upb_parse_value(void **buf, void *end, upb_field_type_t ft, - union upb_value *v) + union upb_value_ptr v) { #define CASE(t, member_name) \ case GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_ ## t: \ - return get_ ## t(buf, end, &v->member_name); + return get_ ## t(buf, end, v.member_name); switch(ft) { CASE(DOUBLE, _double) CASE(FLOAT, _float) @@ -307,8 +307,8 @@ static upb_status_t parse_delimited(struct upb_parse_state *s, void *delim_end = (char*)*buf + delim_len; if(ft == GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_STRING || ft == GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_BYTES) { - struct upb_string str = {.data = *buf, .byte_len = delim_len}; - s->str_cb(s, &str, user_field_desc); + struct upb_string str = {.ptr = *buf, .byte_len = delim_len}; + s->str_cb(s, &str, ft, user_field_desc); *buf = delim_end; } else { /* Packed Array. */ diff --git a/upb_parse.h b/upb_parse.h index 9d3d52d..45b5b76 100644 --- a/upb_parse.h +++ b/upb_parse.h @@ -4,7 +4,7 @@ * This file contains parsing routines; both stream-oriented and tree-oriented * models are supported. * - * Copyright (c) 2008 Joshua Haberman. See LICENSE for details. + * Copyright (c) 2009 Joshua Haberman. See LICENSE for details. */ #ifndef UPB_PARSE_H_ @@ -54,6 +54,7 @@ typedef upb_status_t (*upb_value_cb)(struct upb_parse_state *s, /* The callback that is called when a string is parsed. */ typedef upb_status_t (*upb_str_cb)(struct upb_parse_state *s, struct upb_string *str, + upb_field_type_t type, void *user_field_desc); /* Callbacks that are called when a submessage begins and ends, respectively. @@ -105,7 +106,7 @@ upb_status_t upb_parse_tag(void **buf, void *end, struct upb_tag *tag); * this field type. For delimited data, buf is advanced to the beginning of * the delimited data, not the end. */ upb_status_t upb_parse_value(void **buf, void *end, upb_field_type_t ft, - union upb_value *v); + union upb_value_ptr v); /* Parses a wire value with the given type (which must have been obtained from * a tag that was just parsed) and adds the number of bytes that were consumed diff --git a/upb_table.c b/upb_table.c index e74e47a..22c0d5a 100644 --- a/upb_table.c +++ b/upb_table.c @@ -53,7 +53,7 @@ void upb_strtable_free(struct upb_strtable *t) { upb_table_free(&t->t); } static uint32_t strtable_bucket(struct upb_strtable *t, struct upb_string *key) { - uint32_t hash = MurmurHash2(key->data, key->byte_len, 0); + uint32_t hash = MurmurHash2(key->ptr, key->byte_len, 0); return (hash & (upb_strtable_size(t)-1)) + 1; } @@ -63,7 +63,7 @@ void *upb_strtable_lookup(struct upb_strtable *t, struct upb_string *key) struct upb_strtable_entry *e; do { e = strent(t, bucket); - if(upb_string_eql(&e->key, key)) return e; + if(upb_streql(&e->key, key)) return e; } while((bucket = e->next) != UPB_END_OF_CHAIN); return NULL; } -- cgit v1.2.3