diff --git a/php/ext/google/protobuf/bundled_php.h b/php/ext/google/protobuf/bundled_php.h deleted file mode 100644 index 76147677a1..0000000000 --- a/php/ext/google/protobuf/bundled_php.h +++ /dev/null @@ -1,46 +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. - -#ifndef PHP_PROTOBUF_BUNDLED_PHP_H_ -#define PHP_PROTOBUF_BUNDLED_PHP_H_ - -// We embed PHP source code into the binary for things we don't want to -// implement in C. This struct serves as a table of contents for all of -// the embedded files. -typedef struct { - const char *filename; - const char *contents; -} BundledPhp_File; - -// An array of all the embedded file structs. This array is terminated with a -// {NULL, NULL} entry. -extern BundledPhp_File *bundled_files; - -#endif // PHP_PROTOBUF_BUNDLED_PHP_H_ diff --git a/php/ext/google/protobuf/config.m4 b/php/ext/google/protobuf/config.m4 index 3fdcb00480..635cb19a52 100644 --- a/php/ext/google/protobuf/config.m4 +++ b/php/ext/google/protobuf/config.m4 @@ -4,7 +4,7 @@ if test "$PHP_PROTOBUF" != "no"; then PHP_NEW_EXTENSION( protobuf, - arena.c array.c bundled_php.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c, + arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c, $ext_shared) fi diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c index 37dd50c182..c3ffd3154e 100644 --- a/php/ext/google/protobuf/def.c +++ b/php/ext/google/protobuf/def.c @@ -772,6 +772,7 @@ upb_symtab *DescriptorPool_GetSymbolTable() { return intern->symtab; } + /* * DescriptorPool::getGeneratedPool() * @@ -906,13 +907,38 @@ static void add_name_mappings(const upb_filedef *file) { } } +static void add_descriptor(DescriptorPool *pool, + const google_protobuf_FileDescriptorProto *file) { + upb_strview name = google_protobuf_FileDescriptorProto_name(file); + upb_status status; + const upb_filedef *file_def; + upb_status_clear(&status); + + if (upb_symtab_lookupfile2(pool->symtab, name.data, name.size)) { + // Already added. + fprintf(stderr, "WARNING: file was already added\n"); + return; + } + + // The PHP code generator currently special-cases descriptor.proto. It + // doesn't add it as a dependency even if the proto file actually does + // depend on it. + if (depends_on_descriptor(file)) { + google_protobuf_FileDescriptorProto_getmsgdef(pool->symtab); + } + + file_def = upb_symtab_addfile(pool->symtab, file, &status); + CheckUpbStatus(&status, "Unable to load descriptor"); + add_name_mappings(file_def); +} + /* - * add_name_mappings() + * add_descriptor() * * Adds the given descriptor data to this DescriptorPool. */ -static void add_descriptor(DescriptorPool *pool, const char *data, - int data_len, upb_arena *arena) { +static void add_descriptor_set(DescriptorPool *pool, const char *data, + int data_len, upb_arena *arena) { size_t i, n; google_protobuf_FileDescriptorSet *set; const google_protobuf_FileDescriptorProto* const* files; @@ -928,27 +954,28 @@ static void add_descriptor(DescriptorPool *pool, const char *data, for (i = 0; i < n; i++) { const google_protobuf_FileDescriptorProto* file = files[i]; - upb_strview name = google_protobuf_FileDescriptorProto_name(file); - upb_status status; - const upb_filedef *file_def; - upb_status_clear(&status); - - if (upb_symtab_lookupfile2(pool->symtab, name.data, name.size)) { - // Already added. - continue; - } + add_descriptor(pool, file); + } +} - // The PHP code generator currently special-cases descriptor.proto. It - // doesn't add it as a dependency even if the proto file actually does - // depend on it. - if (depends_on_descriptor(file)) { - google_protobuf_FileDescriptorProto_getmsgdef(pool->symtab); - } +bool DescriptorPool_HasFile(const char *filename) { + DescriptorPool *intern = GetPool(get_generated_pool()); + return upb_symtab_lookupfile(intern->symtab, filename) != NULL; +} + +void DescriptorPool_AddDescriptor(const char *filename, const char *data, + int size) { + upb_arena *arena = upb_arena_new(); + const google_protobuf_FileDescriptorProto *file = + google_protobuf_FileDescriptorProto_parse(data, size, arena); - file_def = upb_symtab_addfile(pool->symtab, file, &status); - CheckUpbStatus(&status, "Unable to load descriptor"); - add_name_mappings(file_def); + if (!file) { + zend_error(E_ERROR, "Failed to parse binary descriptor for %s\n", filename); + return; } + + add_descriptor(GetPool(get_generated_pool()), file); + upb_arena_free(arena); } /* @@ -969,7 +996,7 @@ PHP_METHOD(DescriptorPool, internalAddGeneratedFile) { } arena = upb_arena_new(); - add_descriptor(intern, data, data_len, arena); + add_descriptor_set(intern, data, data_len, arena); upb_arena_free(arena); } diff --git a/php/ext/google/protobuf/def.h b/php/ext/google/protobuf/def.h index 515a83eca7..2a89cd0fd4 100644 --- a/php/ext/google/protobuf/def.h +++ b/php/ext/google/protobuf/def.h @@ -49,6 +49,12 @@ upb_symtab *DescriptorPool_Steal(zval *zv); upb_symtab *DescriptorPool_GetSymbolTable(); +// Returns true if the global descriptor pool already has the given filename. +bool DescriptorPool_HasFile(const char *filename); + +// Adds the given descriptor with the given filename to the global pool. +void DescriptorPool_AddDescriptor(const char *filename, const char *data, int size); + typedef struct Descriptor { zend_object std; const upb_msgdef *msgdef; diff --git a/php/ext/google/protobuf/make-preload.php b/php/ext/google/protobuf/make-preload.php deleted file mode 100644 index 4b1ce7f676..0000000000 --- a/php/ext/google/protobuf/make-preload.php +++ /dev/null @@ -1,62 +0,0 @@ - Google\\Protobuf\\BoolValue - $ret = stripSuffix($filename, ".php"); - return str_replace("/", "\\\\", $ret); -} - -function toCSymbolName($filename) { - # Google/Protobuf/BoolValue.php -> Google__Protobuf__BoolValue - $ret = stripSuffix($filename, ".php"); - return str_replace("/", "__", $ret); -} - -$f = fopen($output, "w"); - -fwrite($f, "#include \"bundled_php.h\"\n"); -fwrite($f, "#include \"stdlib.h\"\n"); - -foreach ($filenames as $filename) { - print("Reading $filename...\n"); - $contents = file_get_contents($filename); - $contents = substr($contents, 5); // Strip diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index b2a03063f5..8dd8edf3c9 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -36,6 +36,7 @@ // This is not self-contained: it must be after other Zend includes. #include +#include #include "arena.h" #include "array.h" @@ -108,6 +109,43 @@ static const upb_fielddef *get_field(Message *msg, PROTO_STR *member) { return f; } +static void Message_get(Message *intern, const upb_fielddef *f, zval *rv) { + upb_arena *arena = Arena_Get(&intern->arena); + + if (upb_fielddef_ismap(f)) { + upb_mutmsgval msgval = upb_msg_mutable(intern->msg, f, arena); + MapField_GetPhpWrapper(rv, msgval.map, f, &intern->arena); + } else if (upb_fielddef_isseq(f)) { + upb_mutmsgval msgval = upb_msg_mutable(intern->msg, f, arena); + RepeatedField_GetPhpWrapper(rv, msgval.array, f, &intern->arena); + } else { + upb_msgval msgval = upb_msg_get(intern->msg, f); + const Descriptor *subdesc = Descriptor_GetFromFieldDef(f); + Convert_UpbToPhp(msgval, rv, upb_fielddef_type(f), subdesc, &intern->arena); + } +} + +static bool Message_set(Message *intern, const upb_fielddef *f, zval *val) { + upb_arena *arena = Arena_Get(&intern->arena); + upb_msgval msgval; + + if (upb_fielddef_ismap(f)) { + msgval.map_val = MapField_GetUpbMap(val, f, arena); + if (!msgval.map_val) return false; + } else if (upb_fielddef_isseq(f)) { + msgval.array_val = RepeatedField_GetUpbArray(val, f, arena); + if (!msgval.array_val) return false; + } else { + upb_fieldtype_t type = upb_fielddef_type(f); + const Descriptor *subdesc = Descriptor_GetFromFieldDef(f); + bool ok = Convert_PhpToUpb(val, &msgval, type, subdesc, arena); + if (!ok) return false; + } + + upb_msg_set(intern->msg, f, msgval, arena); + return true; +} + static bool MessageEq(const upb_msg *m1, const upb_msg *m2, const upb_msgdef *m); /** @@ -271,6 +309,7 @@ static void Message_unset_property(PROTO_VAL *obj, PROTO_STR *member, upb_msg_clearfield(intern->msg, f); } + /** * Message_read_property() * @@ -293,22 +332,9 @@ static zval *Message_read_property(PROTO_VAL *obj, PROTO_STR *member, int type, void **cache_slot, zval *rv) { Message* intern = PROTO_MSG_P(obj); const upb_fielddef *f = get_field(intern, member); - upb_arena *arena = Arena_Get(&intern->arena); if (!f) return NULL; - - if (upb_fielddef_ismap(f)) { - upb_mutmsgval msgval = upb_msg_mutable(intern->msg, f, arena); - MapField_GetPhpWrapper(rv, msgval.map, f, &intern->arena); - } else if (upb_fielddef_isseq(f)) { - upb_mutmsgval msgval = upb_msg_mutable(intern->msg, f, arena); - RepeatedField_GetPhpWrapper(rv, msgval.array, f, &intern->arena); - } else { - upb_msgval msgval = upb_msg_get(intern->msg, f); - const Descriptor *subdesc = Descriptor_GetFromFieldDef(f); - Convert_UpbToPhp(msgval, rv, upb_fielddef_type(f), subdesc, &intern->arena); - } - + Message_get(intern, f, rv); return rv; } @@ -337,37 +363,20 @@ static PROTO_RETURN_VAL Message_write_property( PROTO_VAL *obj, PROTO_STR *member, zval *val, void **cache_slot) { Message* intern = PROTO_MSG_P(obj); const upb_fielddef *f = get_field(intern, member); - upb_arena *arena = Arena_Get(&intern->arena); - upb_msgval msgval; - if (!f) goto error; - - if (upb_fielddef_ismap(f)) { - msgval.map_val = MapField_GetUpbMap(val, f, arena); - if (!msgval.map_val) goto error; - } else if (upb_fielddef_isseq(f)) { - msgval.array_val = RepeatedField_GetUpbArray(val, f, arena); - if (!msgval.array_val) goto error; - } else { - upb_fieldtype_t type = upb_fielddef_type(f); - const Descriptor *subdesc = Descriptor_GetFromFieldDef(f); - bool ok = Convert_PhpToUpb(val, &msgval, type, subdesc, arena); - if (!ok) goto error; - } - - upb_msg_set(intern->msg, f, msgval, arena); + if (f && Message_set(intern, f, val)) { #if PHP_VERSION_ID < 704000 - return; + return; #else - return val; + return val; #endif - -error: + } else { #if PHP_VERSION_ID < 704000 - return; + return; #else - return &EG(error_zval); + return &EG(error_zval); #endif + } } /** @@ -1009,6 +1018,151 @@ static zend_function_entry Message_methods[] = { ZEND_FE_END }; +// Well-known types //////////////////////////////////////////////////////////// + +static const char TYPE_URL_PREFIX[] = "type.googleapis.com/"; + +static upb_msgval Message_getval(Message *intern, const char *field_name) { + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, field_name); + return upb_msg_get(intern->msg, f); +} + +PHP_METHOD(google_protobuf_Any, unpack) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + upb_strview type_url = Message_getval(intern, "type_url").str_val; + upb_strview value = Message_getval(intern, "value").str_val; + size_t prefix_len = strlen(TYPE_URL_PREFIX); + upb_symtab *symtab = DescriptorPool_GetSymbolTable(); + const upb_msgdef *m; + Descriptor *desc; + zend_class_entry *klass; + zval ret; + + // Ensure that type_url has TYPE_URL_PREFIX as a prefix. + if (type_url.size < prefix_len || + strncmp(TYPE_URL_PREFIX, type_url.data, prefix_len) != 0) { + zend_throw_exception( + NULL, "Type url needs to be type.googleapis.com/fully-qualified", + 0 TSRMLS_CC); + return; + } + + type_url.size -= prefix_len; + type_url.data += prefix_len; + m = upb_symtab_lookupmsg2(symtab, type_url.data, type_url.size); + + if (m == NULL) { + zend_throw_exception( + NULL, "Specified message in any hasn't been added to descriptor pool", + 0 TSRMLS_CC); + return; + } + + desc = Descriptor_GetFromMessageDef(m); + klass = desc->class_entry; + ZVAL_OBJ(&ret, klass->create_object(klass)); + Message *msg = (Message*)Z_OBJ_P(&ret); + + // Get value. + if (!upb_decode(value.data, value.size, msg->msg, + upb_msgdef_layout(desc->msgdef), Arena_Get(&msg->arena))) { + zend_throw_exception_ex(NULL, 0, "Error occurred during parsing"); + return; + } + + // Fuse since the parsed message could alias "value". + upb_arena_fuse(Arena_Get(&intern->arena), Arena_Get(&msg->arena)); + + RETURN_ZVAL(&ret, 1, 0); +} + +/* +PHP_METHOD(Any, pack) { + zval* val; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &val) == + FAILURE) { + return; + } + + if (!instanceof_function(Z_OBJCE_P(val), message_ce)) { + zend_error(E_USER_ERROR, "Given value is not an instance of Message."); + return; + } + + // Set value by serialized data. + zval data; + serialize_to_string(val, &data TSRMLS_CC); + + zval member; + PHP_PROTO_ZVAL_STRING(&member, "value", 1); + + PHP_PROTO_FAKE_SCOPE_BEGIN(any_type); + message_handlers->write_property(getThis(), &member, &data, + NULL PHP_PROTO_TSRMLS_CC); + zval_dtor(&data); + zval_dtor(&member); + PHP_PROTO_FAKE_SCOPE_END; + + // Set type url. + DescriptorInternal* desc = get_ce_desc(Z_OBJCE_P(val)); + const char* fully_qualified_name = upb_msgdef_fullname(desc->msgdef); + size_t type_url_len = + strlen(TYPE_URL_PREFIX) + strlen(fully_qualified_name) + 1; + char* type_url = ALLOC_N(char, type_url_len); + sprintf(type_url, "%s%s", TYPE_URL_PREFIX, fully_qualified_name); + zval type_url_php; + PHP_PROTO_ZVAL_STRING(&type_url_php, type_url, 1); + PHP_PROTO_ZVAL_STRING(&member, "type_url", 1); + + PHP_PROTO_FAKE_SCOPE_RESTART(any_type); + message_handlers->write_property(getThis(), &member, &type_url_php, + NULL PHP_PROTO_TSRMLS_CC); + zval_dtor(&type_url_php); + zval_dtor(&member); + PHP_PROTO_FAKE_SCOPE_END; + FREE(type_url); +} + +PHP_METHOD(Any, is) { + zend_class_entry *klass = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "C", &klass) == + FAILURE) { + return; + } + + DescriptorInternal* desc = get_ce_desc(klass); + if (desc == NULL) { + RETURN_BOOL(false); + } + + // Create corresponded type url. + const char* fully_qualified_name = upb_msgdef_fullname(desc->msgdef); + size_t type_url_len = + strlen(TYPE_URL_PREFIX) + strlen(fully_qualified_name) + 1; + char* type_url = ALLOC_N(char, type_url_len); + sprintf(type_url, "%s%s", TYPE_URL_PREFIX, fully_qualified_name); + + // Fetch stored type url. + zval member; + PHP_PROTO_ZVAL_STRING(&member, "type_url", 1); + PHP_PROTO_FAKE_SCOPE_BEGIN(any_type); + zval* value = + php_proto_message_read_property(getThis(), &member PHP_PROTO_TSRMLS_CC); + zval_dtor(&member); + PHP_PROTO_FAKE_SCOPE_END; + + // Compare two type url. + bool is = strcmp(type_url, Z_STRVAL_P(value)) == 0; + FREE(type_url); + + RETURN_BOOL(is); +} +*/ + +#include "wkt.inc" + /** * Message_ModuleInit() * @@ -1033,4 +1187,6 @@ void Message_ModuleInit() { h->unset_property = Message_unset_property; h->get_properties = Message_get_properties; h->get_property_ptr_ptr = Message_get_property_ptr_ptr; + + WellKnownTypes_ModuleInit(); /* From wkt.inc. */ } diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index d1fc36663d..2ed7114e7f 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -81,6 +81,10 @@ #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) #define UPB_NOINLINE __attribute__((noinline)) #define UPB_NORETURN __attribute__((__noreturn__)) +#elif defined(_MSC_VER) +#define UPB_NOINLINE +#define UPB_FORCEINLINE +#define UPB_NORETURN __declspec(noreturn) #else /* !defined(__GNUC__) */ #define UPB_FORCEINLINE #define UPB_NOINLINE @@ -143,7 +147,7 @@ int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg); #elif defined _MSC_VER #define UPB_ASSUME(expr) if (!(expr)) __assume(0) #else -#define UPB_ASSUME(expr) do {} if (false && (expr)) +#define UPB_ASSUME(expr) do {} while (false && (expr)) #endif #else #define UPB_ASSUME(expr) assert(expr) @@ -323,8 +327,6 @@ typedef struct { typedef union { bool bool_val; - int32_t int32_val; - int64_t int64_val; uint32_t uint32_val; uint64_t uint64_val; upb_strview str_val; @@ -424,14 +426,21 @@ static void decode_munge(int type, wireval *val) { break; case UPB_DESCRIPTOR_TYPE_SINT32: { uint32_t n = val->uint32_val; - val->int32_val = (n >> 1) ^ -(int32_t)(n & 1); + val->uint32_val = (n >> 1) ^ -(int32_t)(n & 1); break; } case UPB_DESCRIPTOR_TYPE_SINT64: { uint64_t n = val->uint64_val; - val->int64_val = (n >> 1) ^ -(int64_t)(n & 1); + val->uint64_val = (n >> 1) ^ -(int64_t)(n & 1); break; } + case UPB_DESCRIPTOR_TYPE_INT32: + case UPB_DESCRIPTOR_TYPE_UINT32: + if (!_upb_isle()) { + /* The next stage will memcpy(dst, &val, 4) */ + val->uint32_val = val->uint64_val; + } + break; } } @@ -607,7 +616,7 @@ static void decode_tomap(upb_decstate *d, upb_msg *msg, if (entry->fields[1].descriptortype == UPB_DESCRIPTOR_TYPE_MESSAGE || entry->fields[1].descriptortype == UPB_DESCRIPTOR_TYPE_GROUP) { /* Create proactively to handle the case where it doesn't appear. */ - ent.v.val.val = (uint64_t)_upb_msg_new(entry->submsgs[0], d->arena); + ent.v.val = upb_value_ptr(_upb_msg_new(entry->submsgs[0], d->arena)); } decode_tosubmsg(d, &ent.k, layout, field, val.str_val); @@ -698,14 +707,16 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, break; case UPB_WIRE_TYPE_32BIT: if (d->limit - ptr < 4) decode_err(d); - memcpy(&val, ptr, 4); + memcpy(&val.uint32_val, ptr, 4); + val.uint32_val = _upb_be_swap32(val.uint32_val); ptr += 4; op = OP_SCALAR_LG2(2); if (((1 << field->descriptortype) & fixed32_ok) == 0) goto unknown; break; case UPB_WIRE_TYPE_64BIT: if (d->limit - ptr < 8) decode_err(d); - memcpy(&val, ptr, 8); + memcpy(&val.uint64_val, ptr, 8); + val.uint64_val = _upb_be_swap64(val.uint64_val); ptr += 8; op = OP_SCALAR_LG2(3); if (((1 << field->descriptortype) & fixed64_ok) == 0) goto unknown; @@ -725,7 +736,7 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, break; } case UPB_WIRE_TYPE_START_GROUP: - val.int32_val = field_number; + val.uint32_val = field_number; op = OP_SUBMSG; if (field->descriptortype != UPB_DTYPE_GROUP) goto unknown; break; @@ -794,30 +805,30 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, /* We encode backwards, to avoid pre-computing lengths (one-pass encode). */ +#include #include #define UPB_PB_VARINT_MAX_LEN 10 -#define CHK(x) do { if (!(x)) { return false; } } while(0) -static size_t upb_encode_varint(uint64_t val, char *buf) { - size_t i; - if (val < 128) { buf[0] = val; return 1; } - i = 0; - while (val) { +UPB_NOINLINE +static size_t encode_varint64(uint64_t val, char *buf) { + size_t i = 0; + do { uint8_t byte = val & 0x7fU; val >>= 7; if (val) byte |= 0x80U; buf[i++] = byte; - } + } while (val); return i; } -static uint32_t upb_zzencode_32(int32_t n) { return ((uint32_t)n << 1) ^ (n >> 31); } -static uint64_t upb_zzencode_64(int64_t n) { return ((uint64_t)n << 1) ^ (n >> 63); } +static uint32_t encode_zz32(int32_t n) { return ((uint32_t)n << 1) ^ (n >> 31); } +static uint64_t encode_zz64(int64_t n) { return ((uint64_t)n << 1) ^ (n >> 63); } typedef struct { + jmp_buf err; upb_alloc *alloc; char *buf, *ptr, *limit; } upb_encstate; @@ -830,11 +841,15 @@ static size_t upb_roundup_pow2(size_t bytes) { return ret; } -static bool upb_encode_growbuffer(upb_encstate *e, size_t bytes) { +UPB_NORETURN static void encode_err(upb_encstate *e) { longjmp(e->err, 1); } + +UPB_NOINLINE +static void encode_growbuffer(upb_encstate *e, size_t bytes) { size_t old_size = e->limit - e->buf; size_t new_size = upb_roundup_pow2(bytes + (e->limit - e->ptr)); char *new_buf = upb_realloc(e->alloc, e->buf, old_size, new_size); - CHK(new_buf); + + if (!new_buf) encode_err(e); /* We want previous data at the end, realloc() put it at the beginning. */ if (old_size > 0) { @@ -844,99 +859,115 @@ static bool upb_encode_growbuffer(upb_encstate *e, size_t bytes) { e->ptr = new_buf + new_size - (e->limit - e->ptr); e->limit = new_buf + new_size; e->buf = new_buf; - return true; + + e->ptr -= bytes; } /* Call to ensure that at least "bytes" bytes are available for writing at * e->ptr. Returns false if the bytes could not be allocated. */ -static bool upb_encode_reserve(upb_encstate *e, size_t bytes) { - CHK(UPB_LIKELY((size_t)(e->ptr - e->buf) >= bytes) || - upb_encode_growbuffer(e, bytes)); +UPB_FORCEINLINE +static void encode_reserve(upb_encstate *e, size_t bytes) { + if ((size_t)(e->ptr - e->buf) < bytes) { + encode_growbuffer(e, bytes); + return; + } e->ptr -= bytes; - return true; } /* Writes the given bytes to the buffer, handling reserve/advance. */ -static bool upb_put_bytes(upb_encstate *e, const void *data, size_t len) { - if (len == 0) return true; - CHK(upb_encode_reserve(e, len)); +static void encode_bytes(upb_encstate *e, const void *data, size_t len) { + if (len == 0) return; /* memcpy() with zero size is UB */ + encode_reserve(e, len); memcpy(e->ptr, data, len); - return true; } -static bool upb_put_fixed64(upb_encstate *e, uint64_t val) { - /* TODO(haberman): byte-swap for big endian. */ - return upb_put_bytes(e, &val, sizeof(uint64_t)); +static void encode_fixed64(upb_encstate *e, uint64_t val) { + val = _upb_be_swap64(val); + encode_bytes(e, &val, sizeof(uint64_t)); } -static bool upb_put_fixed32(upb_encstate *e, uint32_t val) { - /* TODO(haberman): byte-swap for big endian. */ - return upb_put_bytes(e, &val, sizeof(uint32_t)); +static void encode_fixed32(upb_encstate *e, uint32_t val) { + val = _upb_be_swap32(val); + encode_bytes(e, &val, sizeof(uint32_t)); } -static bool upb_put_varint(upb_encstate *e, uint64_t val) { +UPB_NOINLINE +static void encode_longvarint(upb_encstate *e, uint64_t val) { size_t len; char *start; - CHK(upb_encode_reserve(e, UPB_PB_VARINT_MAX_LEN)); - len = upb_encode_varint(val, e->ptr); + + encode_reserve(e, UPB_PB_VARINT_MAX_LEN); + len = encode_varint64(val, e->ptr); start = e->ptr + UPB_PB_VARINT_MAX_LEN - len; memmove(start, e->ptr, len); e->ptr = start; - return true; } -static bool upb_put_double(upb_encstate *e, double d) { +UPB_FORCEINLINE +static void encode_varint(upb_encstate *e, uint64_t val) { + if (val < 128 && e->ptr != e->buf) { + --e->ptr; + *e->ptr = val; + } else { + encode_longvarint(e, val); + } +} + +static void encode_double(upb_encstate *e, double d) { uint64_t u64; UPB_ASSERT(sizeof(double) == sizeof(uint64_t)); memcpy(&u64, &d, sizeof(uint64_t)); - return upb_put_fixed64(e, u64); + encode_fixed64(e, u64); } -static bool upb_put_float(upb_encstate *e, float d) { +static void encode_float(upb_encstate *e, float d) { uint32_t u32; UPB_ASSERT(sizeof(float) == sizeof(uint32_t)); memcpy(&u32, &d, sizeof(uint32_t)); - return upb_put_fixed32(e, u32); + encode_fixed32(e, u32); } -static bool upb_put_tag(upb_encstate *e, int field_number, int wire_type) { - return upb_put_varint(e, (field_number << 3) | wire_type); +static void encode_tag(upb_encstate *e, int field_number, int wire_type) { + encode_varint(e, (field_number << 3) | wire_type); } -static bool upb_put_fixedarray(upb_encstate *e, const upb_array *arr, +static void encode_fixedarray(upb_encstate *e, const upb_array *arr, size_t elem_size, uint32_t tag) { size_t bytes = arr->len * elem_size; const char* data = _upb_array_constptr(arr); const char* ptr = data + bytes - elem_size; if (tag) { while (true) { - CHK(upb_put_bytes(e, ptr, elem_size) && upb_put_varint(e, tag)); + encode_bytes(e, ptr, elem_size); + encode_varint(e, tag); if (ptr == data) break; ptr -= elem_size; } - return true; } else { - return upb_put_bytes(e, data, bytes) && upb_put_varint(e, bytes); + encode_bytes(e, data, bytes); } } -bool upb_encode_message(upb_encstate *e, const char *msg, - const upb_msglayout *m, size_t *size); +static void encode_message(upb_encstate *e, const char *msg, + const upb_msglayout *m, size_t *size); -static bool upb_encode_scalarfield(upb_encstate *e, const void *_field_mem, - const upb_msglayout *m, - const upb_msglayout_field *f, - bool skip_zero_value) { +static void encode_scalar(upb_encstate *e, const void *_field_mem, + const upb_msglayout *m, const upb_msglayout_field *f, + bool skip_zero_value) { const char *field_mem = _field_mem; -#define CASE(ctype, type, wire_type, encodeval) do { \ - ctype val = *(ctype*)field_mem; \ - if (skip_zero_value && val == 0) { \ - return true; \ - } \ - return upb_put_ ## type(e, encodeval) && \ - upb_put_tag(e, f->number, wire_type); \ -} while(0) + int wire_type; + +#define CASE(ctype, type, wtype, encodeval) \ + { \ + ctype val = *(ctype *)field_mem; \ + if (skip_zero_value && val == 0) { \ + return; \ + } \ + encode_##type(e, encodeval); \ + wire_type = wtype; \ + break; \ + } switch (f->descriptortype) { case UPB_DESCRIPTOR_TYPE_DOUBLE: @@ -960,90 +991,91 @@ static bool upb_encode_scalarfield(upb_encstate *e, const void *_field_mem, case UPB_DESCRIPTOR_TYPE_BOOL: CASE(bool, varint, UPB_WIRE_TYPE_VARINT, val); case UPB_DESCRIPTOR_TYPE_SINT32: - CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_32(val)); + CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, encode_zz32(val)); case UPB_DESCRIPTOR_TYPE_SINT64: - CASE(int64_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_64(val)); + CASE(int64_t, varint, UPB_WIRE_TYPE_VARINT, encode_zz64(val)); case UPB_DESCRIPTOR_TYPE_STRING: case UPB_DESCRIPTOR_TYPE_BYTES: { upb_strview view = *(upb_strview*)field_mem; if (skip_zero_value && view.size == 0) { - return true; + return; } - return upb_put_bytes(e, view.data, view.size) && - upb_put_varint(e, view.size) && - upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED); + encode_bytes(e, view.data, view.size); + encode_varint(e, view.size); + wire_type = UPB_WIRE_TYPE_DELIMITED; + break; } case UPB_DESCRIPTOR_TYPE_GROUP: { size_t size; void *submsg = *(void **)field_mem; const upb_msglayout *subm = m->submsgs[f->submsg_index]; if (submsg == NULL) { - return true; + return; } - return upb_put_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP) && - upb_encode_message(e, submsg, subm, &size) && - upb_put_tag(e, f->number, UPB_WIRE_TYPE_START_GROUP); + encode_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP); + encode_message(e, submsg, subm, &size); + wire_type = UPB_WIRE_TYPE_START_GROUP; + break; } case UPB_DESCRIPTOR_TYPE_MESSAGE: { size_t size; void *submsg = *(void **)field_mem; const upb_msglayout *subm = m->submsgs[f->submsg_index]; if (submsg == NULL) { - return true; + return; } - return upb_encode_message(e, submsg, subm, &size) && - upb_put_varint(e, size) && - upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED); + encode_message(e, submsg, subm, &size); + encode_varint(e, size); + wire_type = UPB_WIRE_TYPE_DELIMITED; + break; } + default: + UPB_UNREACHABLE(); } #undef CASE - UPB_UNREACHABLE(); + + encode_tag(e, f->number, wire_type); } -static bool upb_encode_array(upb_encstate *e, const char *field_mem, - const upb_msglayout *m, - const upb_msglayout_field *f) { +static void encode_array(upb_encstate *e, const char *field_mem, + const upb_msglayout *m, const upb_msglayout_field *f) { const upb_array *arr = *(const upb_array**)field_mem; bool packed = f->label == _UPB_LABEL_PACKED; + size_t pre_len = e->limit - e->ptr; if (arr == NULL || arr->len == 0) { - return true; + return; } #define VARINT_CASE(ctype, encode) \ { \ const ctype *start = _upb_array_constptr(arr); \ const ctype *ptr = start + arr->len; \ - size_t pre_len = e->limit - e->ptr; \ uint32_t tag = packed ? 0 : (f->number << 3) | UPB_WIRE_TYPE_VARINT; \ do { \ ptr--; \ - CHK(upb_put_varint(e, encode)); \ - if (tag) CHK(upb_put_varint(e, tag)); \ + encode_varint(e, encode); \ + if (tag) encode_varint(e, tag); \ } while (ptr != start); \ - if (!tag) CHK(upb_put_varint(e, e->limit - e->ptr - pre_len)); \ } \ - break; \ - do { \ - ; \ - } while (0) + break; #define TAG(wire_type) (packed ? 0 : (f->number << 3 | wire_type)) switch (f->descriptortype) { case UPB_DESCRIPTOR_TYPE_DOUBLE: - CHK(upb_put_fixedarray(e, arr, sizeof(double), TAG(UPB_WIRE_TYPE_64BIT))); + encode_fixedarray(e, arr, sizeof(double), TAG(UPB_WIRE_TYPE_64BIT)); break; case UPB_DESCRIPTOR_TYPE_FLOAT: - CHK(upb_put_fixedarray(e, arr, sizeof(float), TAG(UPB_WIRE_TYPE_32BIT))); + encode_fixedarray(e, arr, sizeof(float), TAG(UPB_WIRE_TYPE_32BIT)); break; case UPB_DESCRIPTOR_TYPE_SFIXED64: case UPB_DESCRIPTOR_TYPE_FIXED64: - CHK(upb_put_fixedarray(e, arr, sizeof(uint64_t), TAG(UPB_WIRE_TYPE_64BIT))); + encode_fixedarray(e, arr, sizeof(uint64_t), TAG(UPB_WIRE_TYPE_64BIT)); break; case UPB_DESCRIPTOR_TYPE_FIXED32: case UPB_DESCRIPTOR_TYPE_SFIXED32: - CHK(upb_put_fixedarray(e, arr, sizeof(uint32_t), TAG(UPB_WIRE_TYPE_32BIT))); + encode_fixedarray(e, arr, sizeof(uint32_t), TAG(UPB_WIRE_TYPE_32BIT)); break; case UPB_DESCRIPTOR_TYPE_INT64: case UPB_DESCRIPTOR_TYPE_UINT64: @@ -1056,20 +1088,20 @@ static bool upb_encode_array(upb_encstate *e, const char *field_mem, case UPB_DESCRIPTOR_TYPE_BOOL: VARINT_CASE(bool, *ptr); case UPB_DESCRIPTOR_TYPE_SINT32: - VARINT_CASE(int32_t, upb_zzencode_32(*ptr)); + VARINT_CASE(int32_t, encode_zz32(*ptr)); case UPB_DESCRIPTOR_TYPE_SINT64: - VARINT_CASE(int64_t, upb_zzencode_64(*ptr)); + VARINT_CASE(int64_t, encode_zz64(*ptr)); case UPB_DESCRIPTOR_TYPE_STRING: case UPB_DESCRIPTOR_TYPE_BYTES: { const upb_strview *start = _upb_array_constptr(arr); const upb_strview *ptr = start + arr->len; do { ptr--; - CHK(upb_put_bytes(e, ptr->data, ptr->size) && - upb_put_varint(e, ptr->size) && - upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED)); + encode_bytes(e, ptr->data, ptr->size); + encode_varint(e, ptr->size); + encode_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED); } while (ptr != start); - return true; + return; } case UPB_DESCRIPTOR_TYPE_GROUP: { const void *const*start = _upb_array_constptr(arr); @@ -1078,11 +1110,11 @@ static bool upb_encode_array(upb_encstate *e, const char *field_mem, do { size_t size; ptr--; - CHK(upb_put_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP) && - upb_encode_message(e, *ptr, subm, &size) && - upb_put_tag(e, f->number, UPB_WIRE_TYPE_START_GROUP)); + encode_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP); + encode_message(e, *ptr, subm, &size); + encode_tag(e, f->number, UPB_WIRE_TYPE_START_GROUP); } while (ptr != start); - return true; + return; } case UPB_DESCRIPTOR_TYPE_MESSAGE: { const void *const*start = _upb_array_constptr(arr); @@ -1091,31 +1123,30 @@ static bool upb_encode_array(upb_encstate *e, const char *field_mem, do { size_t size; ptr--; - CHK(upb_encode_message(e, *ptr, subm, &size) && - upb_put_varint(e, size) && - upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED)); + encode_message(e, *ptr, subm, &size); + encode_varint(e, size); + encode_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED); } while (ptr != start); - return true; + return; } } #undef VARINT_CASE if (packed) { - CHK(upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED)); + encode_varint(e, e->limit - e->ptr - pre_len); + encode_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED); } - return true; } -static bool upb_encode_map(upb_encstate *e, const char *field_mem, - const upb_msglayout *m, - const upb_msglayout_field *f) { +static void encode_map(upb_encstate *e, const char *field_mem, + const upb_msglayout *m, const upb_msglayout_field *f) { const upb_map *map = *(const upb_map**)field_mem; const upb_msglayout *entry = m->submsgs[f->submsg_index]; const upb_msglayout_field *key_field = &entry->fields[0]; const upb_msglayout_field *val_field = &entry->fields[1]; upb_strtable_iter i; if (map == NULL) { - return true; + return; } upb_strtable_begin(&i, &map->table); @@ -1127,59 +1158,57 @@ static bool upb_encode_map(upb_encstate *e, const char *field_mem, upb_map_entry ent; _upb_map_fromkey(key, &ent.k, map->key_size); _upb_map_fromvalue(val, &ent.v, map->val_size); - CHK(upb_encode_scalarfield(e, &ent.v, entry, val_field, false)); - CHK(upb_encode_scalarfield(e, &ent.k, entry, key_field, false)); + encode_scalar(e, &ent.v, entry, val_field, false); + encode_scalar(e, &ent.k, entry, key_field, false); size = (e->limit - e->ptr) - pre_len; - CHK(upb_put_varint(e, size)); - CHK(upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED)); + encode_varint(e, size); + encode_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED); } - - return true; } +static void encode_scalarfield(upb_encstate *e, const char *msg, + const upb_msglayout *m, + const upb_msglayout_field *f) { + bool skip_empty = false; + if (f->presence == 0) { + /* Proto3 presence. */ + skip_empty = true; + } else if (f->presence > 0) { + /* Proto2 presence: hasbit. */ + if (!_upb_hasbit_field(msg, f)) return; + } else { + /* Field is in a oneof. */ + if (_upb_getoneofcase_field(msg, f) != f->number) return; + } + encode_scalar(e, msg + f->offset, m, f, skip_empty); +} -bool upb_encode_message(upb_encstate *e, const char *msg, - const upb_msglayout *m, size_t *size) { - int i; +static void encode_message(upb_encstate *e, const char *msg, + const upb_msglayout *m, size_t *size) { size_t pre_len = e->limit - e->ptr; const char *unknown; size_t unknown_size; + const upb_msglayout_field *f = &m->fields[m->field_count]; + const upb_msglayout_field *first = &m->fields[0]; unknown = upb_msg_getunknown(msg, &unknown_size); if (unknown) { - upb_put_bytes(e, unknown, unknown_size); + encode_bytes(e, unknown, unknown_size); } - for (i = m->field_count - 1; i >= 0; i--) { - const upb_msglayout_field *f = &m->fields[i]; - + while (f != first) { + f--; if (_upb_isrepeated(f)) { - CHK(upb_encode_array(e, msg + f->offset, m, f)); + encode_array(e, msg + f->offset, m, f); } else if (f->label == _UPB_LABEL_MAP) { - CHK(upb_encode_map(e, msg + f->offset, m, f)); + encode_map(e, msg + f->offset, m, f); } else { - bool skip_empty = false; - if (f->presence == 0) { - /* Proto3 presence. */ - skip_empty = true; - } else if (f->presence > 0) { - /* Proto2 presence: hasbit. */ - if (!_upb_hasbit_field(msg, f)) { - continue; - } - } else { - /* Field is in a oneof. */ - if (_upb_getoneofcase_field(msg, f) != f->number) { - continue; - } - } - CHK(upb_encode_scalarfield(e, msg + f->offset, m, f, skip_empty)); + encode_scalarfield(e, msg, m, f); } } *size = (e->limit - e->ptr) - pre_len; - return true; } char *upb_encode(const void *msg, const upb_msglayout *m, upb_arena *arena, @@ -1190,11 +1219,13 @@ char *upb_encode(const void *msg, const upb_msglayout *m, upb_arena *arena, e.limit = NULL; e.ptr = NULL; - if (!upb_encode_message(&e, msg, m, size)) { + if (setjmp(e.err)) { *size = 0; return NULL; } + encode_message(&e, msg, m, size); + *size = e.limit - e.ptr; if (*size == 0) { @@ -1206,8 +1237,6 @@ char *upb_encode(const void *msg, const upb_msglayout *m, upb_arena *arena, } } -#undef CHK - @@ -3063,7 +3092,7 @@ extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit; extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit; extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit; -static const upb_msglayout *layouts[27] = { +static const upb_msglayout *google_protobuf_descriptor_proto_layouts[27] = { &google_protobuf_FileDescriptorSet_msginit, &google_protobuf_FileDescriptorProto_msginit, &google_protobuf_DescriptorProto_msginit, @@ -3093,7 +3122,8 @@ static const upb_msglayout *layouts[27] = { &google_protobuf_GeneratedCodeInfo_Annotation_msginit, }; -static const char descriptor[7619] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', +static const char google_protobuf_descriptor_proto_descriptor[7619] = { +'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\"', 'M', '\n', '\021', 'F', 'i', 'l', 'e', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'S', 'e', 't', '\022', '8', '\n', '\004', 'f', 'i', 'l', 'e', '\030', '\001', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', @@ -3400,15 +3430,15 @@ static const char descriptor[7619] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', ' 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', 'e', 'f', 'l', 'e', 'c', 't', 'i', 'o', 'n', }; -static upb_def_init *deps[1] = { +static upb_def_init *google_protobuf_descriptor_proto_deps[1] = { NULL }; -upb_def_init google_protobuf_descriptor_proto_upbdefinit = { - deps, - layouts, +upb_def_init google_protobuf_descriptor_proto_definit = { + google_protobuf_descriptor_proto_deps, + google_protobuf_descriptor_proto_layouts, "google/protobuf/descriptor.proto", - UPB_STRVIEW_INIT(descriptor, 7619) + UPB_STRVIEW_INIT(google_protobuf_descriptor_proto_descriptor, 7619) }; @@ -5666,11 +5696,7 @@ const upb_fielddef *upb_msg_whichoneof(const upb_msg *msg, if (upb_oneof_done(&i)) return false; f = upb_oneof_iter_field(&i); field = upb_fielddef_layout(f); - if (in_oneof(field)) { - oneof_case = _upb_getoneofcase_field(msg, field); - } else { - return _upb_hasbit_field(msg, field) ? f : NULL; - } + oneof_case = _upb_getoneofcase_field(msg, field); return oneof_case ? upb_msgdef_itof(m, oneof_case) : NULL; } diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index 666ec76d05..973635214e 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -80,6 +80,10 @@ #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) #define UPB_NOINLINE __attribute__((noinline)) #define UPB_NORETURN __attribute__((__noreturn__)) +#elif defined(_MSC_VER) +#define UPB_NOINLINE +#define UPB_FORCEINLINE +#define UPB_NORETURN __declspec(noreturn) #else /* !defined(__GNUC__) */ #define UPB_FORCEINLINE #define UPB_NOINLINE @@ -142,7 +146,7 @@ int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg); #elif defined _MSC_VER #define UPB_ASSUME(expr) if (!(expr)) __assume(0) #else -#define UPB_ASSUME(expr) do {} if (false && (expr)) +#define UPB_ASSUME(expr) do {} while (false && (expr)) #endif #else #define UPB_ASSUME(expr) assert(expr) @@ -213,7 +217,7 @@ int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg); ** store pointers or integers of at least 32 bits (upb isn't really useful on ** systems where sizeof(void*) < 4). ** -** The table must be homogeneous (all values of the same type). In debug +** The table must be homogenous (all values of the same type). In debug ** mode, we check this on insert and lookup. */ @@ -496,6 +500,32 @@ typedef enum { #define UPB_MAP_BEGIN ((size_t)-1) +UPB_INLINE bool _upb_isle(void) { + int x = 1; + return *(char*)&x == 1; +} + +UPB_INLINE uint32_t _upb_be_swap32(uint32_t val) { + if (_upb_isle()) { + return val; + } else { + return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | + ((val & 0xff0000ULL) >> 8) | ((val & 0xff000000ULL) >> 24); + } +} + +UPB_INLINE uint64_t _upb_be_swap64(uint64_t val) { + if (_upb_isle()) { + return val; + } else { + return ((val & 0xff) << 56) | ((val & 0xff00) << 40) | + ((val & 0xff0000) << 24) | ((val & 0xff000000) << 8) | + ((val & 0xff00000000ULL) >> 8) | ((val & 0xff0000000000ULL) >> 24) | + ((val & 0xff000000000000ULL) >> 40) | + ((val & 0xff00000000000000ULL) >> 56); + } +} + #ifdef __cplusplus } /* extern "C" */ @@ -1251,7 +1281,7 @@ UPB_INLINE upb_value _upb_map_tovalue(const void *val, size_t size, if (size == UPB_MAPTYPE_STRING) { upb_strview *strp = (upb_strview*)upb_arena_malloc(a, sizeof(*strp)); *strp = *(upb_strview*)val; - memcpy(&ret, &strp, sizeof(strp)); + ret = upb_value_ptr(strp); } else { memcpy(&ret, val, size); } @@ -1382,7 +1412,7 @@ UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, size_t size) /* This is like _upb_map_tovalue() except the entry already exists so we can * reuse the allocated upb_strview for string fields. */ if (size == UPB_MAPTYPE_STRING) { - upb_strview *strp = (upb_strview*)ent->val.val; + upb_strview *strp = (upb_strview*)(uintptr_t)ent->val.val; memcpy(strp, val, sizeof(*strp)); } else { memcpy(&ent->val.val, val, size); @@ -3489,140 +3519,140 @@ extern "C" { -extern upb_def_init google_protobuf_descriptor_proto_upbdefinit; +extern upb_def_init google_protobuf_descriptor_proto_definit; UPB_INLINE const upb_msgdef *google_protobuf_FileDescriptorSet_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.FileDescriptorSet"); } UPB_INLINE const upb_msgdef *google_protobuf_FileDescriptorProto_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.FileDescriptorProto"); } UPB_INLINE const upb_msgdef *google_protobuf_DescriptorProto_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.DescriptorProto"); } UPB_INLINE const upb_msgdef *google_protobuf_DescriptorProto_ExtensionRange_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.DescriptorProto.ExtensionRange"); } UPB_INLINE const upb_msgdef *google_protobuf_DescriptorProto_ReservedRange_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.DescriptorProto.ReservedRange"); } UPB_INLINE const upb_msgdef *google_protobuf_ExtensionRangeOptions_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.ExtensionRangeOptions"); } UPB_INLINE const upb_msgdef *google_protobuf_FieldDescriptorProto_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.FieldDescriptorProto"); } UPB_INLINE const upb_msgdef *google_protobuf_OneofDescriptorProto_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.OneofDescriptorProto"); } UPB_INLINE const upb_msgdef *google_protobuf_EnumDescriptorProto_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.EnumDescriptorProto"); } UPB_INLINE const upb_msgdef *google_protobuf_EnumDescriptorProto_EnumReservedRange_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.EnumDescriptorProto.EnumReservedRange"); } UPB_INLINE const upb_msgdef *google_protobuf_EnumValueDescriptorProto_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.EnumValueDescriptorProto"); } UPB_INLINE const upb_msgdef *google_protobuf_ServiceDescriptorProto_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.ServiceDescriptorProto"); } UPB_INLINE const upb_msgdef *google_protobuf_MethodDescriptorProto_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.MethodDescriptorProto"); } UPB_INLINE const upb_msgdef *google_protobuf_FileOptions_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.FileOptions"); } UPB_INLINE const upb_msgdef *google_protobuf_MessageOptions_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.MessageOptions"); } UPB_INLINE const upb_msgdef *google_protobuf_FieldOptions_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.FieldOptions"); } UPB_INLINE const upb_msgdef *google_protobuf_OneofOptions_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.OneofOptions"); } UPB_INLINE const upb_msgdef *google_protobuf_EnumOptions_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.EnumOptions"); } UPB_INLINE const upb_msgdef *google_protobuf_EnumValueOptions_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.EnumValueOptions"); } UPB_INLINE const upb_msgdef *google_protobuf_ServiceOptions_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.ServiceOptions"); } UPB_INLINE const upb_msgdef *google_protobuf_MethodOptions_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.MethodOptions"); } UPB_INLINE const upb_msgdef *google_protobuf_UninterpretedOption_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.UninterpretedOption"); } UPB_INLINE const upb_msgdef *google_protobuf_UninterpretedOption_NamePart_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.UninterpretedOption.NamePart"); } UPB_INLINE const upb_msgdef *google_protobuf_SourceCodeInfo_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.SourceCodeInfo"); } UPB_INLINE const upb_msgdef *google_protobuf_SourceCodeInfo_Location_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.SourceCodeInfo.Location"); } UPB_INLINE const upb_msgdef *google_protobuf_GeneratedCodeInfo_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.GeneratedCodeInfo"); } UPB_INLINE const upb_msgdef *google_protobuf_GeneratedCodeInfo_Annotation_getmsgdef(upb_symtab *s) { - _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_upbdefinit); + _upb_symtab_loaddefinit(s, &google_protobuf_descriptor_proto_definit); return upb_symtab_lookupmsg(s, "google.protobuf.GeneratedCodeInfo.Annotation"); } @@ -3827,7 +3857,7 @@ extern "C" { #endif enum { - /* When set, emits 0/default values. TODO(haberman): proto3 only? */ + /* When set, emits 0/default values. TOOD(haberman): proto3 only? */ UPB_JSONENC_EMITDEFAULTS = 1, /* When set, use normal (snake_caes) field names instead of JSON (camelCase) diff --git a/php/ext/google/protobuf/protobuf.c b/php/ext/google/protobuf/protobuf.c index fa1cc114b1..05095a0f36 100644 --- a/php/ext/google/protobuf/protobuf.c +++ b/php/ext/google/protobuf/protobuf.c @@ -35,7 +35,6 @@ #include "arena.h" #include "array.h" -#include "bundled_php.h" #include "convert.h" #include "def.h" #include "map.h" @@ -162,10 +161,6 @@ static PHP_RINIT_FUNCTION(protobuf) { upb_symtab *symtab = PROTOBUF_G(saved_symtab); DescriptorPool_CreateWithSymbolTable(&PROTOBUF_G(generated_pool), symtab); - // Set up autoloader for bundled sources. - zend_eval_string("spl_autoload_register('protobuf_internal_loadbundled');", - NULL, "autoload_register.php"); - zend_hash_init(&PROTOBUF_G(object_cache), 64, NULL, NULL, 0); zend_hash_init(&PROTOBUF_G(name_msg_cache), 64, NULL, NULL, 0); zend_hash_init(&PROTOBUF_G(name_enum_cache), 64, NULL, NULL, 0); @@ -193,34 +188,6 @@ static PHP_RSHUTDOWN_FUNCTION(protobuf) { return SUCCESS; } -// ----------------------------------------------------------------------------- -// Bundled PHP sources -// ----------------------------------------------------------------------------- - -// We bundle PHP sources for well-known types into the C extension. There is no -// need to implement these in C. - -static PHP_FUNCTION(protobuf_internal_loadbundled) { - char *name = NULL; - zend_long size; - BundledPhp_File *file; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &size) != SUCCESS) { - return; - } - - for (file = bundled_files; file->filename; file++) { - if (strcmp(file->filename, name) == 0) { - zend_eval_string((char*)file->contents, NULL, (char*)file->filename); - return; - } - } -} - -ZEND_BEGIN_ARG_INFO_EX(arginfo_load_bundled_source, 0, 0, 1) - ZEND_ARG_INFO(0, class_name) -ZEND_END_ARG_INFO() - // ----------------------------------------------------------------------------- // Object Cache. // ----------------------------------------------------------------------------- @@ -303,7 +270,6 @@ const upb_enumdef *NameMap_GetEnum(zend_class_entry *ce) { // ----------------------------------------------------------------------------- zend_function_entry protobuf_functions[] = { - PHP_FE(protobuf_internal_loadbundled, arginfo_load_bundled_source) ZEND_FE_END }; diff --git a/php/ext/google/protobuf/wkt.inc b/php/ext/google/protobuf/wkt.inc new file mode 100644 index 0000000000..c7a469f951 --- /dev/null +++ b/php/ext/google/protobuf/wkt.inc @@ -0,0 +1,2920 @@ +// This file is generated from the .proto files for the well-known +// types. Do not edit! +static void google_protobuf_timestamp_proto_AddDescriptor(); +static void google_protobuf_wrappers_proto_AddDescriptor(); +static void google_protobuf_any_proto_AddDescriptor(); +static void google_protobuf_duration_proto_AddDescriptor(); +static void google_protobuf_api_proto_AddDescriptor(); +static void google_protobuf_empty_proto_AddDescriptor(); +static void google_protobuf_type_proto_AddDescriptor(); +static void google_protobuf_struct_proto_AddDescriptor(); +static void google_protobuf_source_context_proto_AddDescriptor(); +static void google_protobuf_field_mask_proto_AddDescriptor(); +/* google/protobuf/timestamp.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_Timestamp_ce; + +const char google_protobuf_timestamp_proto_descriptor [239] = { +'\n', '\037', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'i', 'm', 'e', 's', 't', 'a', +'m', 'p', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', +'\"', '+', '\n', '\t', 'T', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', '\022', '\017', '\n', '\007', 's', 'e', 'c', 'o', 'n', 'd', 's', '\030', +'\001', ' ', '\001', '(', '\003', '\022', '\r', '\n', '\005', 'n', 'a', 'n', 'o', 's', '\030', '\002', ' ', '\001', '(', '\005', 'B', '\205', '\001', '\n', '\023', +'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\016', 'T', 'i', 'm', 'e', +'s', 't', 'a', 'm', 'p', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '2', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', +'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o', +'w', 'n', '/', 't', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', +'\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', +'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_timestamp_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/timestamp.proto")) return; + DescriptorPool_AddDescriptor("google/protobuf/timestamp.proto", google_protobuf_timestamp_proto_descriptor, + sizeof(google_protobuf_timestamp_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_Timestamp, initOnce) { + google_protobuf_timestamp_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_Timestamp_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_Timestamp, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_Timestamp_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Timestamp", + GPBMetadata_Google_Protobuf_Timestamp_methods); + + GPBMetadata_Google_Protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_Timestamp */ + +zend_class_entry* google_protobuf_Timestamp_ce; + +static PHP_METHOD(google_protobuf_Timestamp, __construct) { + google_protobuf_timestamp_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Timestamp, getSeconds) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "seconds"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Timestamp, setSeconds) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "seconds"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Timestamp, getNanos) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "nanos"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Timestamp, setNanos) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "nanos"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Timestamp_phpmethods[] = { + PHP_ME(google_protobuf_Timestamp, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, getSeconds, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, setSeconds, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, getNanos, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, setNanos, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Timestamp_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Timestamp", + google_protobuf_Timestamp_phpmethods); + + google_protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Timestamp_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Timestamp_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Timestamp_ce, message_ce); +} + +/* google/protobuf/wrappers.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_Wrappers_ce; + +const char google_protobuf_wrappers_proto_descriptor [455] = { +'\n', '\036', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'w', 'r', 'a', 'p', 'p', 'e', 'r', +'s', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\"', +'\034', '\n', '\013', 'D', 'o', 'u', 'b', 'l', 'e', 'V', 'a', 'l', 'u', 'e', '\022', '\r', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\001', +' ', '\001', '(', '\001', '\"', '\033', '\n', '\n', 'F', 'l', 'o', 'a', 't', 'V', 'a', 'l', 'u', 'e', '\022', '\r', '\n', '\005', 'v', 'a', 'l', +'u', 'e', '\030', '\001', ' ', '\001', '(', '\002', '\"', '\033', '\n', '\n', 'I', 'n', 't', '6', '4', 'V', 'a', 'l', 'u', 'e', '\022', '\r', '\n', +'\005', 'v', 'a', 'l', 'u', 'e', '\030', '\001', ' ', '\001', '(', '\003', '\"', '\034', '\n', '\013', 'U', 'I', 'n', 't', '6', '4', 'V', 'a', 'l', +'u', 'e', '\022', '\r', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\001', ' ', '\001', '(', '\004', '\"', '\033', '\n', '\n', 'I', 'n', 't', '3', +'2', 'V', 'a', 'l', 'u', 'e', '\022', '\r', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\001', ' ', '\001', '(', '\005', '\"', '\034', '\n', '\013', +'U', 'I', 'n', 't', '3', '2', 'V', 'a', 'l', 'u', 'e', '\022', '\r', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\001', ' ', '\001', '(', +'\r', '\"', '\032', '\n', '\t', 'B', 'o', 'o', 'l', 'V', 'a', 'l', 'u', 'e', '\022', '\r', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\001', +' ', '\001', '(', '\010', '\"', '\034', '\n', '\013', 'S', 't', 'r', 'i', 'n', 'g', 'V', 'a', 'l', 'u', 'e', '\022', '\r', '\n', '\005', 'v', 'a', +'l', 'u', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\"', '\033', '\n', '\n', 'B', 'y', 't', 'e', 's', 'V', 'a', 'l', 'u', 'e', '\022', '\r', +'\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\001', ' ', '\001', '(', '\014', 'B', '\203', '\001', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', +'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\r', 'W', 'r', 'a', 'p', 'p', 'e', 'r', 's', 'P', 'r', 'o', +'t', 'o', 'P', '\001', 'Z', '1', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', +'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o', 'w', 'n', '/', 'w', 'r', 'a', 'p', 'p', +'e', 'r', 's', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', +'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', 'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', +'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_wrappers_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/wrappers.proto")) return; + DescriptorPool_AddDescriptor("google/protobuf/wrappers.proto", google_protobuf_wrappers_proto_descriptor, + sizeof(google_protobuf_wrappers_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_Wrappers, initOnce) { + google_protobuf_wrappers_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_Wrappers_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_Wrappers, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_Wrappers_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Wrappers", + GPBMetadata_Google_Protobuf_Wrappers_methods); + + GPBMetadata_Google_Protobuf_Wrappers_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_DoubleValue */ + +zend_class_entry* google_protobuf_DoubleValue_ce; + +static PHP_METHOD(google_protobuf_DoubleValue, __construct) { + google_protobuf_wrappers_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_DoubleValue, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_DoubleValue, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_DoubleValue_phpmethods[] = { + PHP_ME(google_protobuf_DoubleValue, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_DoubleValue, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_DoubleValue, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_DoubleValue_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\DoubleValue", + google_protobuf_DoubleValue_phpmethods); + + google_protobuf_DoubleValue_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_DoubleValue_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_DoubleValue_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_DoubleValue_ce, message_ce); +} + +/* google_protobuf_FloatValue */ + +zend_class_entry* google_protobuf_FloatValue_ce; + +static PHP_METHOD(google_protobuf_FloatValue, __construct) { + google_protobuf_wrappers_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_FloatValue, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_FloatValue, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_FloatValue_phpmethods[] = { + PHP_ME(google_protobuf_FloatValue, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_FloatValue, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_FloatValue, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_FloatValue_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\FloatValue", + google_protobuf_FloatValue_phpmethods); + + google_protobuf_FloatValue_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_FloatValue_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_FloatValue_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_FloatValue_ce, message_ce); +} + +/* google_protobuf_Int64Value */ + +zend_class_entry* google_protobuf_Int64Value_ce; + +static PHP_METHOD(google_protobuf_Int64Value, __construct) { + google_protobuf_wrappers_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Int64Value, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Int64Value, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Int64Value_phpmethods[] = { + PHP_ME(google_protobuf_Int64Value, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Int64Value, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Int64Value, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Int64Value_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Int64Value", + google_protobuf_Int64Value_phpmethods); + + google_protobuf_Int64Value_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Int64Value_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Int64Value_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Int64Value_ce, message_ce); +} + +/* google_protobuf_UInt64Value */ + +zend_class_entry* google_protobuf_UInt64Value_ce; + +static PHP_METHOD(google_protobuf_UInt64Value, __construct) { + google_protobuf_wrappers_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_UInt64Value, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_UInt64Value, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_UInt64Value_phpmethods[] = { + PHP_ME(google_protobuf_UInt64Value, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_UInt64Value, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_UInt64Value, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_UInt64Value_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\UInt64Value", + google_protobuf_UInt64Value_phpmethods); + + google_protobuf_UInt64Value_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_UInt64Value_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_UInt64Value_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_UInt64Value_ce, message_ce); +} + +/* google_protobuf_Int32Value */ + +zend_class_entry* google_protobuf_Int32Value_ce; + +static PHP_METHOD(google_protobuf_Int32Value, __construct) { + google_protobuf_wrappers_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Int32Value, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Int32Value, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Int32Value_phpmethods[] = { + PHP_ME(google_protobuf_Int32Value, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Int32Value, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Int32Value, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Int32Value_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Int32Value", + google_protobuf_Int32Value_phpmethods); + + google_protobuf_Int32Value_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Int32Value_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Int32Value_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Int32Value_ce, message_ce); +} + +/* google_protobuf_UInt32Value */ + +zend_class_entry* google_protobuf_UInt32Value_ce; + +static PHP_METHOD(google_protobuf_UInt32Value, __construct) { + google_protobuf_wrappers_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_UInt32Value, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_UInt32Value, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_UInt32Value_phpmethods[] = { + PHP_ME(google_protobuf_UInt32Value, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_UInt32Value, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_UInt32Value, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_UInt32Value_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\UInt32Value", + google_protobuf_UInt32Value_phpmethods); + + google_protobuf_UInt32Value_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_UInt32Value_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_UInt32Value_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_UInt32Value_ce, message_ce); +} + +/* google_protobuf_BoolValue */ + +zend_class_entry* google_protobuf_BoolValue_ce; + +static PHP_METHOD(google_protobuf_BoolValue, __construct) { + google_protobuf_wrappers_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_BoolValue, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_BoolValue, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_BoolValue_phpmethods[] = { + PHP_ME(google_protobuf_BoolValue, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_BoolValue, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_BoolValue, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_BoolValue_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\BoolValue", + google_protobuf_BoolValue_phpmethods); + + google_protobuf_BoolValue_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_BoolValue_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_BoolValue_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_BoolValue_ce, message_ce); +} + +/* google_protobuf_StringValue */ + +zend_class_entry* google_protobuf_StringValue_ce; + +static PHP_METHOD(google_protobuf_StringValue, __construct) { + google_protobuf_wrappers_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_StringValue, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_StringValue, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_StringValue_phpmethods[] = { + PHP_ME(google_protobuf_StringValue, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_StringValue, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_StringValue, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_StringValue_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\StringValue", + google_protobuf_StringValue_phpmethods); + + google_protobuf_StringValue_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_StringValue_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_StringValue_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_StringValue_ce, message_ce); +} + +/* google_protobuf_BytesValue */ + +zend_class_entry* google_protobuf_BytesValue_ce; + +static PHP_METHOD(google_protobuf_BytesValue, __construct) { + google_protobuf_wrappers_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_BytesValue, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_BytesValue, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_BytesValue_phpmethods[] = { + PHP_ME(google_protobuf_BytesValue, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_BytesValue, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_BytesValue, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_BytesValue_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\BytesValue", + google_protobuf_BytesValue_phpmethods); + + google_protobuf_BytesValue_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_BytesValue_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_BytesValue_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_BytesValue_ce, message_ce); +} + +/* google/protobuf/any.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_Any_ce; + +const char google_protobuf_any_proto_descriptor [212] = { +'\n', '\031', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'a', 'n', 'y', '.', 'p', 'r', 'o', +'t', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\"', '&', '\n', '\003', 'A', 'n', +'y', '\022', '\020', '\n', '\010', 't', 'y', 'p', 'e', '_', 'u', 'r', 'l', '\030', '\001', ' ', '\001', '(', '\t', '\022', '\r', '\n', '\005', 'v', 'a', +'l', 'u', 'e', '\030', '\002', ' ', '\001', '(', '\014', 'B', 'v', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', +'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\010', 'A', 'n', 'y', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', ',', 'g', 'o', 'o', 'g', +'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', +'p', 'e', 's', '/', 'k', 'n', 'o', 'w', 'n', '/', 'a', 'n', 'y', 'p', 'b', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\036', 'G', +'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', 'n', 'T', +'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_any_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/any.proto")) return; + DescriptorPool_AddDescriptor("google/protobuf/any.proto", google_protobuf_any_proto_descriptor, + sizeof(google_protobuf_any_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_Any, initOnce) { + google_protobuf_any_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_Any_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_Any, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_Any_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Any", + GPBMetadata_Google_Protobuf_Any_methods); + + GPBMetadata_Google_Protobuf_Any_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_Any */ + +zend_class_entry* google_protobuf_Any_ce; + +static PHP_METHOD(google_protobuf_Any, __construct) { + google_protobuf_any_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Any, getTypeUrl) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "type_url"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Any, setTypeUrl) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "type_url"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Any, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Any, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Any_phpmethods[] = { + PHP_ME(google_protobuf_Any, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Any, getTypeUrl, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Any, setTypeUrl, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Any, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Any, setValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Any, unpack, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Any_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Any", + google_protobuf_Any_phpmethods); + + google_protobuf_Any_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Any_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Any_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Any_ce, message_ce); +} + +/* google/protobuf/duration.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_Duration_ce; + +const char google_protobuf_duration_proto_descriptor [235] = { +'\n', '\036', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'u', 'r', 'a', 't', 'i', 'o', +'n', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\"', +'*', '\n', '\010', 'D', 'u', 'r', 'a', 't', 'i', 'o', 'n', '\022', '\017', '\n', '\007', 's', 'e', 'c', 'o', 'n', 'd', 's', '\030', '\001', ' ', +'\001', '(', '\003', '\022', '\r', '\n', '\005', 'n', 'a', 'n', 'o', 's', '\030', '\002', ' ', '\001', '(', '\005', 'B', '\203', '\001', '\n', '\023', 'c', 'o', +'m', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\r', 'D', 'u', 'r', 'a', 't', 'i', +'o', 'n', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '1', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', +'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o', 'w', 'n', '/', +'d', 'u', 'r', 'a', 't', 'i', 'o', 'n', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\036', 'G', 'o', 'o', +'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', 'n', 'T', 'y', 'p', +'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_duration_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/duration.proto")) return; + DescriptorPool_AddDescriptor("google/protobuf/duration.proto", google_protobuf_duration_proto_descriptor, + sizeof(google_protobuf_duration_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_Duration, initOnce) { + google_protobuf_duration_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_Duration_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_Duration, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_Duration_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Duration", + GPBMetadata_Google_Protobuf_Duration_methods); + + GPBMetadata_Google_Protobuf_Duration_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_Duration */ + +zend_class_entry* google_protobuf_Duration_ce; + +static PHP_METHOD(google_protobuf_Duration, __construct) { + google_protobuf_duration_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Duration, getSeconds) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "seconds"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Duration, setSeconds) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "seconds"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Duration, getNanos) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "nanos"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Duration, setNanos) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "nanos"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Duration_phpmethods[] = { + PHP_ME(google_protobuf_Duration, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Duration, getSeconds, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Duration, setSeconds, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Duration, getNanos, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Duration, setNanos, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Duration_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Duration", + google_protobuf_Duration_phpmethods); + + google_protobuf_Duration_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Duration_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Duration_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Duration_ce, message_ce); +} + +/* google/protobuf/api.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_Api_ce; + +const char google_protobuf_api_proto_descriptor [751] = { +'\n', '\031', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'a', 'p', 'i', '.', 'p', 'r', 'o', +'t', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\032', '$', 'g', 'o', 'o', 'g', +'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 's', 'o', 'u', 'r', 'c', 'e', '_', 'c', 'o', 'n', 't', 'e', 'x', +'t', '.', 'p', 'r', 'o', 't', 'o', '\032', '\032', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', +'t', 'y', 'p', 'e', '.', 'p', 'r', 'o', 't', 'o', '\"', '\201', '\002', '\n', '\003', 'A', 'p', 'i', '\022', '\014', '\n', '\004', 'n', 'a', 'm', +'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', '(', '\n', '\007', 'm', 'e', 't', 'h', 'o', 'd', 's', '\030', '\002', ' ', '\003', '(', '\013', '2', +'\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'M', 'e', 't', 'h', 'o', 'd', '\022', +'(', '\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', '\030', '\003', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', +'.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', '\022', '\017', '\n', '\007', 'v', 'e', 'r', 's', 'i', +'o', 'n', '\030', '\004', ' ', '\001', '(', '\t', '\022', '6', '\n', '\016', 's', 'o', 'u', 'r', 'c', 'e', '_', 'c', 'o', 'n', 't', 'e', 'x', +'t', '\030', '\005', ' ', '\001', '(', '\013', '2', '\036', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', +'.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'n', 't', 'e', 'x', 't', '\022', '&', '\n', '\006', 'm', 'i', 'x', 'i', 'n', 's', '\030', +'\006', ' ', '\003', '(', '\013', '2', '\026', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'M', +'i', 'x', 'i', 'n', '\022', '\'', '\n', '\006', 's', 'y', 'n', 't', 'a', 'x', '\030', '\007', ' ', '\001', '(', '\016', '2', '\027', '.', 'g', 'o', +'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'y', 'n', 't', 'a', 'x', '\"', '\325', '\001', '\n', '\006', +'M', 'e', 't', 'h', 'o', 'd', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', '\030', '\n', '\020', 'r', +'e', 'q', 'u', 'e', 's', 't', '_', 't', 'y', 'p', 'e', '_', 'u', 'r', 'l', '\030', '\002', ' ', '\001', '(', '\t', '\022', '\031', '\n', '\021', +'r', 'e', 'q', 'u', 'e', 's', 't', '_', 's', 't', 'r', 'e', 'a', 'm', 'i', 'n', 'g', '\030', '\003', ' ', '\001', '(', '\010', '\022', '\031', +'\n', '\021', 'r', 'e', 's', 'p', 'o', 'n', 's', 'e', '_', 't', 'y', 'p', 'e', '_', 'u', 'r', 'l', '\030', '\004', ' ', '\001', '(', '\t', +'\022', '\032', '\n', '\022', 'r', 'e', 's', 'p', 'o', 'n', 's', 'e', '_', 's', 't', 'r', 'e', 'a', 'm', 'i', 'n', 'g', '\030', '\005', ' ', +'\001', '(', '\010', '\022', '(', '\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', '\030', '\006', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', +'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', '\022', '\'', '\n', '\006', 's', +'y', 'n', 't', 'a', 'x', '\030', '\007', ' ', '\001', '(', '\016', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', +'o', 'b', 'u', 'f', '.', 'S', 'y', 'n', 't', 'a', 'x', '\"', '#', '\n', '\005', 'M', 'i', 'x', 'i', 'n', '\022', '\014', '\n', '\004', 'n', +'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', '\014', '\n', '\004', 'r', 'o', 'o', 't', '\030', '\002', ' ', '\001', '(', '\t', 'B', 'v', +'\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\010', 'A', 'p', +'i', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', ',', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', +'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o', 'w', 'n', '/', 'a', +'p', 'i', 'p', 'b', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', +'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', 'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', +'3', +}; + +static void google_protobuf_api_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/api.proto")) return; + google_protobuf_source_context_proto_AddDescriptor(); + google_protobuf_type_proto_AddDescriptor(); + DescriptorPool_AddDescriptor("google/protobuf/api.proto", google_protobuf_api_proto_descriptor, + sizeof(google_protobuf_api_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_Api, initOnce) { + google_protobuf_api_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_Api_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_Api, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_Api_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Api", + GPBMetadata_Google_Protobuf_Api_methods); + + GPBMetadata_Google_Protobuf_Api_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_Api */ + +zend_class_entry* google_protobuf_Api_ce; + +static PHP_METHOD(google_protobuf_Api, __construct) { + google_protobuf_api_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Api, getName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, setName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, getMethods) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "methods"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, setMethods) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "methods"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, getOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, setOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, getVersion) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "version"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, setVersion) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "version"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, getSourceContext) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "source_context"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, setSourceContext) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "source_context"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, getMixins) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "mixins"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, setMixins) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "mixins"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, getSyntax) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "syntax"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Api, setSyntax) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "syntax"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Api_phpmethods[] = { + PHP_ME(google_protobuf_Api, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, getName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, setName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, getMethods, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, setMethods, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, getOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, setOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, getVersion, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, setVersion, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, getSourceContext, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, setSourceContext, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, getMixins, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, setMixins, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, getSyntax, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Api, setSyntax, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Api_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Api", + google_protobuf_Api_phpmethods); + + google_protobuf_Api_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Api_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Api_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Api_ce, message_ce); +} + +/* google_protobuf_Method */ + +zend_class_entry* google_protobuf_Method_ce; + +static PHP_METHOD(google_protobuf_Method, __construct) { + google_protobuf_api_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Method, getName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, setName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, getRequestTypeUrl) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "request_type_url"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, setRequestTypeUrl) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "request_type_url"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, getRequestStreaming) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "request_streaming"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, setRequestStreaming) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "request_streaming"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, getResponseTypeUrl) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "response_type_url"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, setResponseTypeUrl) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "response_type_url"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, getResponseStreaming) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "response_streaming"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, setResponseStreaming) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "response_streaming"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, getOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, setOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, getSyntax) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "syntax"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Method, setSyntax) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "syntax"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Method_phpmethods[] = { + PHP_ME(google_protobuf_Method, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, getName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, setName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, getRequestTypeUrl, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, setRequestTypeUrl, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, getRequestStreaming, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, setRequestStreaming, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, getResponseTypeUrl, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, setResponseTypeUrl, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, getResponseStreaming, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, setResponseStreaming, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, getOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, setOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, getSyntax, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Method, setSyntax, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Method_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Method", + google_protobuf_Method_phpmethods); + + google_protobuf_Method_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Method_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Method_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Method_ce, message_ce); +} + +/* google_protobuf_Mixin */ + +zend_class_entry* google_protobuf_Mixin_ce; + +static PHP_METHOD(google_protobuf_Mixin, __construct) { + google_protobuf_api_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Mixin, getName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Mixin, setName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Mixin, getRoot) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "root"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Mixin, setRoot) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "root"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Mixin_phpmethods[] = { + PHP_ME(google_protobuf_Mixin, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Mixin, getName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Mixin, setName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Mixin, getRoot, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Mixin, setRoot, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Mixin_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Mixin", + google_protobuf_Mixin_phpmethods); + + google_protobuf_Mixin_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Mixin_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Mixin_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Mixin_ce, message_ce); +} + +/* google/protobuf/empty.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_GPBEmpty_ce; + +const char google_protobuf_empty_proto_descriptor [190] = { +'\n', '\033', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'e', 'm', 'p', 't', 'y', '.', 'p', +'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\"', '\007', '\n', '\005', +'E', 'm', 'p', 't', 'y', 'B', '}', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', +'b', 'u', 'f', 'B', '\n', 'E', 'm', 'p', 't', 'y', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '.', 'g', 'o', 'o', 'g', 'l', 'e', +'.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', +'s', '/', 'k', 'n', 'o', 'w', 'n', '/', 'e', 'm', 'p', 't', 'y', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', +'\002', '\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', +'w', 'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_empty_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/empty.proto")) return; + DescriptorPool_AddDescriptor("google/protobuf/empty.proto", google_protobuf_empty_proto_descriptor, + sizeof(google_protobuf_empty_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_GPBEmpty, initOnce) { + google_protobuf_empty_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_GPBEmpty_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_GPBEmpty, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_GPBEmpty_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\GPBEmpty", + GPBMetadata_Google_Protobuf_GPBEmpty_methods); + + GPBMetadata_Google_Protobuf_GPBEmpty_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_Empty */ + +zend_class_entry* google_protobuf_Empty_ce; + +static PHP_METHOD(google_protobuf_Empty, __construct) { + google_protobuf_empty_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static zend_function_entry google_protobuf_Empty_phpmethods[] = { + PHP_ME(google_protobuf_Empty, __construct, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Empty_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\GPBEmpty", + google_protobuf_Empty_phpmethods); + + google_protobuf_Empty_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Empty_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Empty_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Empty_ce, message_ce); +} + +/* google/protobuf/type.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_Type_ce; + +const char google_protobuf_type_proto_descriptor [1592] = { +'\n', '\032', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', '.', 'p', 'r', +'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\032', '\031', 'g', 'o', 'o', +'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'a', 'n', 'y', '.', 'p', 'r', 'o', 't', 'o', '\032', '$', 'g', +'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 's', 'o', 'u', 'r', 'c', 'e', '_', 'c', 'o', 'n', +'t', 'e', 'x', 't', '.', 'p', 'r', 'o', 't', 'o', '\"', '\327', '\001', '\n', '\004', 'T', 'y', 'p', 'e', '\022', '\014', '\n', '\004', 'n', 'a', +'m', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', '&', '\n', '\006', 'f', 'i', 'e', 'l', 'd', 's', '\030', '\002', ' ', '\003', '(', '\013', '2', +'\026', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', '\022', '\016', +'\n', '\006', 'o', 'n', 'e', 'o', 'f', 's', '\030', '\003', ' ', '\003', '(', '\t', '\022', '(', '\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', +'\030', '\004', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', +'O', 'p', 't', 'i', 'o', 'n', '\022', '6', '\n', '\016', 's', 'o', 'u', 'r', 'c', 'e', '_', 'c', 'o', 'n', 't', 'e', 'x', 't', '\030', +'\005', ' ', '\001', '(', '\013', '2', '\036', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', +'o', 'u', 'r', 'c', 'e', 'C', 'o', 'n', 't', 'e', 'x', 't', '\022', '\'', '\n', '\006', 's', 'y', 'n', 't', 'a', 'x', '\030', '\006', ' ', +'\001', '(', '\016', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'y', 'n', +'t', 'a', 'x', '\"', '\325', '\005', '\n', '\005', 'F', 'i', 'e', 'l', 'd', '\022', ')', '\n', '\004', 'k', 'i', 'n', 'd', '\030', '\001', ' ', '\001', +'(', '\016', '2', '\033', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', +'d', '.', 'K', 'i', 'n', 'd', '\022', '7', '\n', '\013', 'c', 'a', 'r', 'd', 'i', 'n', 'a', 'l', 'i', 't', 'y', '\030', '\002', ' ', '\001', +'(', '\016', '2', '\"', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', +'d', '.', 'C', 'a', 'r', 'd', 'i', 'n', 'a', 'l', 'i', 't', 'y', '\022', '\016', '\n', '\006', 'n', 'u', 'm', 'b', 'e', 'r', '\030', '\003', +' ', '\001', '(', '\005', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\004', ' ', '\001', '(', '\t', '\022', '\020', '\n', '\010', 't', 'y', 'p', +'e', '_', 'u', 'r', 'l', '\030', '\006', ' ', '\001', '(', '\t', '\022', '\023', '\n', '\013', 'o', 'n', 'e', 'o', 'f', '_', 'i', 'n', 'd', 'e', +'x', '\030', '\007', ' ', '\001', '(', '\005', '\022', '\016', '\n', '\006', 'p', 'a', 'c', 'k', 'e', 'd', '\030', '\010', ' ', '\001', '(', '\010', '\022', '(', +'\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', '\030', '\t', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', +'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', '\022', '\021', '\n', '\t', 'j', 's', 'o', 'n', '_', 'n', +'a', 'm', 'e', '\030', '\n', ' ', '\001', '(', '\t', '\022', '\025', '\n', '\r', 'd', 'e', 'f', 'a', 'u', 'l', 't', '_', 'v', 'a', 'l', 'u', +'e', '\030', '\013', ' ', '\001', '(', '\t', '\"', '\310', '\002', '\n', '\004', 'K', 'i', 'n', 'd', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', +'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'D', 'O', 'U', 'B', 'L', 'E', '\020', +'\001', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', '_', 'F', 'L', 'O', 'A', 'T', '\020', '\002', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', +'_', 'I', 'N', 'T', '6', '4', '\020', '\003', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'U', 'I', 'N', 'T', '6', '4', '\020', '\004', +'\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', '_', 'I', 'N', 'T', '3', '2', '\020', '\005', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', +'F', 'I', 'X', 'E', 'D', '6', '4', '\020', '\006', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', 'F', 'I', 'X', 'E', 'D', '3', '2', +'\020', '\007', '\022', '\r', '\n', '\t', 'T', 'Y', 'P', 'E', '_', 'B', 'O', 'O', 'L', '\020', '\010', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', +'_', 'S', 'T', 'R', 'I', 'N', 'G', '\020', '\t', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', '_', 'G', 'R', 'O', 'U', 'P', '\020', '\n', +'\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', 'M', 'E', 'S', 'S', 'A', 'G', 'E', '\020', '\013', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', +'E', '_', 'B', 'Y', 'T', 'E', 'S', '\020', '\014', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'U', 'I', 'N', 'T', '3', '2', '\020', +'\r', '\022', '\r', '\n', '\t', 'T', 'Y', 'P', 'E', '_', 'E', 'N', 'U', 'M', '\020', '\016', '\022', '\021', '\n', '\r', 'T', 'Y', 'P', 'E', '_', +'S', 'F', 'I', 'X', 'E', 'D', '3', '2', '\020', '\017', '\022', '\021', '\n', '\r', 'T', 'Y', 'P', 'E', '_', 'S', 'F', 'I', 'X', 'E', 'D', +'6', '4', '\020', '\020', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'S', 'I', 'N', 'T', '3', '2', '\020', '\021', '\022', '\017', '\n', '\013', +'T', 'Y', 'P', 'E', '_', 'S', 'I', 'N', 'T', '6', '4', '\020', '\022', '\"', 't', '\n', '\013', 'C', 'a', 'r', 'd', 'i', 'n', 'a', 'l', +'i', 't', 'y', '\022', '\027', '\n', '\023', 'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', +'N', '\020', '\000', '\022', '\030', '\n', '\024', 'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'O', 'P', 'T', 'I', 'O', 'N', +'A', 'L', '\020', '\001', '\022', '\030', '\n', '\024', 'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'E', 'Q', 'U', 'I', +'R', 'E', 'D', '\020', '\002', '\022', '\030', '\n', '\024', 'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'E', 'P', 'E', +'A', 'T', 'E', 'D', '\020', '\003', '\"', '\316', '\001', '\n', '\004', 'E', 'n', 'u', 'm', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', +' ', '\001', '(', '\t', '\022', '-', '\n', '\t', 'e', 'n', 'u', 'm', 'v', 'a', 'l', 'u', 'e', '\030', '\002', ' ', '\003', '(', '\013', '2', '\032', +'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'n', 'u', 'm', 'V', 'a', 'l', 'u', +'e', '\022', '(', '\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', '\030', '\003', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', +'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', '\022', '6', '\n', '\016', 's', 'o', 'u', +'r', 'c', 'e', '_', 'c', 'o', 'n', 't', 'e', 'x', 't', '\030', '\004', ' ', '\001', '(', '\013', '2', '\036', '.', 'g', 'o', 'o', 'g', 'l', +'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'n', 't', 'e', 'x', 't', '\022', +'\'', '\n', '\006', 's', 'y', 'n', 't', 'a', 'x', '\030', '\005', ' ', '\001', '(', '\016', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', +'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'y', 'n', 't', 'a', 'x', '\"', 'S', '\n', '\t', 'E', 'n', 'u', 'm', 'V', 'a', +'l', 'u', 'e', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', '\016', '\n', '\006', 'n', 'u', 'm', 'b', +'e', 'r', '\030', '\002', ' ', '\001', '(', '\005', '\022', '(', '\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', '\030', '\003', ' ', '\003', '(', '\013', +'2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', +'\"', ';', '\n', '\006', 'O', 'p', 't', 'i', 'o', 'n', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', +'#', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\002', ' ', '\001', '(', '\013', '2', '\024', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', +'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'A', 'n', 'y', '*', '.', '\n', '\006', 'S', 'y', 'n', 't', 'a', 'x', '\022', '\021', '\n', '\r', +'S', 'Y', 'N', 'T', 'A', 'X', '_', 'P', 'R', 'O', 'T', 'O', '2', '\020', '\000', '\022', '\021', '\n', '\r', 'S', 'Y', 'N', 'T', 'A', 'X', +'_', 'P', 'R', 'O', 'T', 'O', '3', '\020', '\001', 'B', '{', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', +'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\t', 'T', 'y', 'p', 'e', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '-', 'g', 'o', 'o', +'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', +'y', 'p', 'e', 's', '/', 'k', 'n', 'o', 'w', 'n', '/', 't', 'y', 'p', 'e', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', +'B', '\252', '\002', '\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', +'n', 'o', 'w', 'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_type_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/type.proto")) return; + google_protobuf_any_proto_AddDescriptor(); + google_protobuf_source_context_proto_AddDescriptor(); + DescriptorPool_AddDescriptor("google/protobuf/type.proto", google_protobuf_type_proto_descriptor, + sizeof(google_protobuf_type_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_Type, initOnce) { + google_protobuf_type_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_Type_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_Type, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_Type_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Type", + GPBMetadata_Google_Protobuf_Type_methods); + + GPBMetadata_Google_Protobuf_Type_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_Type */ + +zend_class_entry* google_protobuf_Type_ce; + +static PHP_METHOD(google_protobuf_Type, __construct) { + google_protobuf_type_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Type, getName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, setName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, getFields) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "fields"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, setFields) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "fields"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, getOneofs) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "oneofs"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, setOneofs) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "oneofs"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, getOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, setOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, getSourceContext) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "source_context"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, setSourceContext) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "source_context"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, getSyntax) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "syntax"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Type, setSyntax) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "syntax"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Type_phpmethods[] = { + PHP_ME(google_protobuf_Type, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, getName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, setName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, getFields, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, setFields, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, getOneofs, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, setOneofs, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, getOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, setOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, getSourceContext, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, setSourceContext, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, getSyntax, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, setSyntax, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Type_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Type", + google_protobuf_Type_phpmethods); + + google_protobuf_Type_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Type_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Type_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Type_ce, message_ce); +} + +/* google_protobuf_Field */ + +zend_class_entry* google_protobuf_Field_ce; + +static PHP_METHOD(google_protobuf_Field, __construct) { + google_protobuf_type_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Field, getKind) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "kind"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setKind) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "kind"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, getCardinality) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "cardinality"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setCardinality) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "cardinality"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, getNumber) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "number"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setNumber) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "number"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, getName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, getTypeUrl) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "type_url"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setTypeUrl) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "type_url"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, getOneofIndex) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "oneof_index"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setOneofIndex) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "oneof_index"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, getPacked) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "packed"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setPacked) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "packed"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, getOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, getJsonName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "json_name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setJsonName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "json_name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, getDefaultValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "default_value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Field, setDefaultValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "default_value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Field_phpmethods[] = { + PHP_ME(google_protobuf_Field, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getKind, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setKind, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getCardinality, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setCardinality, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getNumber, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setNumber, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getTypeUrl, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setTypeUrl, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getOneofIndex, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setOneofIndex, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getPacked, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setPacked, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getJsonName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setJsonName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, getDefaultValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Field, setDefaultValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Field_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Field", + google_protobuf_Field_phpmethods); + + google_protobuf_Field_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Field_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Field_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Field_ce, message_ce); +} + +/* google_protobuf_Enum */ + +zend_class_entry* google_protobuf_Enum_ce; + +static PHP_METHOD(google_protobuf_Enum, __construct) { + google_protobuf_type_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Enum, getName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Enum, setName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Enum, getEnumvalue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "enumvalue"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Enum, setEnumvalue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "enumvalue"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Enum, getOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Enum, setOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Enum, getSourceContext) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "source_context"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Enum, setSourceContext) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "source_context"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Enum, getSyntax) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "syntax"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Enum, setSyntax) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "syntax"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Enum_phpmethods[] = { + PHP_ME(google_protobuf_Enum, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, getName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, setName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, getEnumvalue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, setEnumvalue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, getOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, setOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, getSourceContext, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, setSourceContext, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, getSyntax, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, setSyntax, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Enum_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Enum", + google_protobuf_Enum_phpmethods); + + google_protobuf_Enum_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Enum_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Enum_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Enum_ce, message_ce); +} + +/* google_protobuf_EnumValue */ + +zend_class_entry* google_protobuf_EnumValue_ce; + +static PHP_METHOD(google_protobuf_EnumValue, __construct) { + google_protobuf_type_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_EnumValue, getName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_EnumValue, setName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_EnumValue, getNumber) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "number"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_EnumValue, setNumber) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "number"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_EnumValue, getOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_EnumValue, setOptions) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "options"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_EnumValue_phpmethods[] = { + PHP_ME(google_protobuf_EnumValue, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_EnumValue, getName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_EnumValue, setName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_EnumValue, getNumber, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_EnumValue, setNumber, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_EnumValue, getOptions, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_EnumValue, setOptions, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_EnumValue_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\EnumValue", + google_protobuf_EnumValue_phpmethods); + + google_protobuf_EnumValue_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_EnumValue_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_EnumValue_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_EnumValue_ce, message_ce); +} + +/* google_protobuf_Option */ + +zend_class_entry* google_protobuf_Option_ce; + +static PHP_METHOD(google_protobuf_Option, __construct) { + google_protobuf_type_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Option, getName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Option, setName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Option, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Option, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Option_phpmethods[] = { + PHP_ME(google_protobuf_Option, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Option, getName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Option, setName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Option, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Option, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Option_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Option", + google_protobuf_Option_phpmethods); + + google_protobuf_Option_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Option_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Option_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Option_ce, message_ce); +} + +/* google/protobuf/struct.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_Struct_ce; + +const char google_protobuf_struct_proto_descriptor [638] = { +'\n', '\034', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 's', 't', 'r', 'u', 'c', 't', '.', +'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\"', '\204', '\001', +'\n', '\006', 'S', 't', 'r', 'u', 'c', 't', '\022', '3', '\n', '\006', 'f', 'i', 'e', 'l', 'd', 's', '\030', '\001', ' ', '\003', '(', '\013', '2', +'#', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 't', 'r', 'u', 'c', 't', '.', +'F', 'i', 'e', 'l', 'd', 's', 'E', 'n', 't', 'r', 'y', '\032', 'E', '\n', '\013', 'F', 'i', 'e', 'l', 'd', 's', 'E', 'n', 't', 'r', +'y', '\022', '\013', '\n', '\003', 'k', 'e', 'y', '\030', '\001', ' ', '\001', '(', '\t', '\022', '%', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\002', +' ', '\001', '(', '\013', '2', '\026', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'V', 'a', +'l', 'u', 'e', ':', '\002', '8', '\001', '\"', '\352', '\001', '\n', '\005', 'V', 'a', 'l', 'u', 'e', '\022', '0', '\n', '\n', 'n', 'u', 'l', 'l', +'_', 'v', 'a', 'l', 'u', 'e', '\030', '\001', ' ', '\001', '(', '\016', '2', '\032', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', +'t', 'o', 'b', 'u', 'f', '.', 'N', 'u', 'l', 'l', 'V', 'a', 'l', 'u', 'e', 'H', '\000', '\022', '\026', '\n', '\014', 'n', 'u', 'm', 'b', +'e', 'r', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\002', ' ', '\001', '(', '\001', 'H', '\000', '\022', '\026', '\n', '\014', 's', 't', 'r', 'i', 'n', +'g', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\003', ' ', '\001', '(', '\t', 'H', '\000', '\022', '\024', '\n', '\n', 'b', 'o', 'o', 'l', '_', 'v', +'a', 'l', 'u', 'e', '\030', '\004', ' ', '\001', '(', '\010', 'H', '\000', '\022', '/', '\n', '\014', 's', 't', 'r', 'u', 'c', 't', '_', 'v', 'a', +'l', 'u', 'e', '\030', '\005', ' ', '\001', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', +'u', 'f', '.', 'S', 't', 'r', 'u', 'c', 't', 'H', '\000', '\022', '0', '\n', '\n', 'l', 'i', 's', 't', '_', 'v', 'a', 'l', 'u', 'e', +'\030', '\006', ' ', '\001', '(', '\013', '2', '\032', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', +'L', 'i', 's', 't', 'V', 'a', 'l', 'u', 'e', 'H', '\000', 'B', '\006', '\n', '\004', 'k', 'i', 'n', 'd', '\"', '3', '\n', '\t', 'L', 'i', +'s', 't', 'V', 'a', 'l', 'u', 'e', '\022', '&', '\n', '\006', 'v', 'a', 'l', 'u', 'e', 's', '\030', '\001', ' ', '\003', '(', '\013', '2', '\026', +'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'V', 'a', 'l', 'u', 'e', '*', '\033', '\n', +'\t', 'N', 'u', 'l', 'l', 'V', 'a', 'l', 'u', 'e', '\022', '\016', '\n', '\n', 'N', 'U', 'L', 'L', '_', 'V', 'A', 'L', 'U', 'E', '\020', +'\000', 'B', '\177', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', +'\013', 'S', 't', 'r', 'u', 'c', 't', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '/', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', +'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', +'n', 'o', 'w', 'n', '/', 's', 't', 'r', 'u', 'c', 't', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\036', +'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', 'n', +'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_struct_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/struct.proto")) return; + DescriptorPool_AddDescriptor("google/protobuf/struct.proto", google_protobuf_struct_proto_descriptor, + sizeof(google_protobuf_struct_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_Struct, initOnce) { + google_protobuf_struct_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_Struct_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_Struct, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_Struct_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Struct", + GPBMetadata_Google_Protobuf_Struct_methods); + + GPBMetadata_Google_Protobuf_Struct_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_Struct */ + +zend_class_entry* google_protobuf_Struct_ce; + +static PHP_METHOD(google_protobuf_Struct, __construct) { + google_protobuf_struct_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Struct, getFields) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "fields"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Struct, setFields) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "fields"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Struct_phpmethods[] = { + PHP_ME(google_protobuf_Struct, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Struct, getFields, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Struct, setFields, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Struct_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Struct", + google_protobuf_Struct_phpmethods); + + google_protobuf_Struct_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Struct_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Struct_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Struct_ce, message_ce); +} + +/* google_protobuf_Struct_FieldsEntry */ + +zend_class_entry* google_protobuf_Struct_FieldsEntry_ce; + +static PHP_METHOD(google_protobuf_Struct_FieldsEntry, __construct) { + google_protobuf_struct_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Struct_FieldsEntry, getKey) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "key"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Struct_FieldsEntry, setKey) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "key"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Struct_FieldsEntry, getValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Struct_FieldsEntry, setValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Struct_FieldsEntry_phpmethods[] = { + PHP_ME(google_protobuf_Struct_FieldsEntry, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Struct_FieldsEntry, getKey, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Struct_FieldsEntry, setKey, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Struct_FieldsEntry, getValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Struct_FieldsEntry, setValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Struct_FieldsEntry_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Struct\\FieldsEntry", + google_protobuf_Struct_FieldsEntry_phpmethods); + + google_protobuf_Struct_FieldsEntry_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Struct_FieldsEntry_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Struct_FieldsEntry_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Struct_FieldsEntry_ce, message_ce); +} + +/* google_protobuf_Value */ + +zend_class_entry* google_protobuf_Value_ce; + +static PHP_METHOD(google_protobuf_Value, __construct) { + google_protobuf_struct_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Value, getNullValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "null_value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, setNullValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "null_value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, getNumberValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "number_value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, setNumberValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "number_value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, getStringValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "string_value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, setStringValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "string_value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, getBoolValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "bool_value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, setBoolValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "bool_value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, getStructValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "struct_value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, setStructValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "struct_value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, getListValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "list_value"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_Value, setListValue) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "list_value"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_Value_phpmethods[] = { + PHP_ME(google_protobuf_Value, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, getNullValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, setNullValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, getNumberValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, setNumberValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, getStringValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, setStringValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, getBoolValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, setBoolValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, getStructValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, setStructValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, getListValue, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Value, setListValue, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Value_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Value", + google_protobuf_Value_phpmethods); + + google_protobuf_Value_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Value_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Value_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Value_ce, message_ce); +} + +/* google_protobuf_ListValue */ + +zend_class_entry* google_protobuf_ListValue_ce; + +static PHP_METHOD(google_protobuf_ListValue, __construct) { + google_protobuf_struct_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_ListValue, getValues) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "values"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_ListValue, setValues) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "values"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_ListValue_phpmethods[] = { + PHP_ME(google_protobuf_ListValue, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_ListValue, getValues, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_ListValue, setValues, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_ListValue_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\ListValue", + google_protobuf_ListValue_phpmethods); + + google_protobuf_ListValue_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_ListValue_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_ListValue_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_ListValue_ce, message_ce); +} + +/* google/protobuf/source_context.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_SourceContext_ce; + +const char google_protobuf_source_context_proto_descriptor [240] = { +'\n', '$', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 's', 'o', 'u', 'r', 'c', 'e', '_', +'c', 'o', 'n', 't', 'e', 'x', 't', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', +'t', 'o', 'b', 'u', 'f', '\"', '\"', '\n', '\r', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'n', 't', 'e', 'x', 't', '\022', '\021', '\n', +'\t', 'f', 'i', 'l', 'e', '_', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', 'B', '\212', '\001', '\n', '\023', 'c', 'o', 'm', '.', +'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\022', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', +'n', 't', 'e', 'x', 't', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '6', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', +'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o', +'w', 'n', '/', 's', 'o', 'u', 'r', 'c', 'e', 'c', 'o', 'n', 't', 'e', 'x', 't', 'p', 'b', '\242', '\002', '\003', 'G', 'P', 'B', '\252', +'\002', '\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', +'w', 'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_source_context_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/source_context.proto")) return; + DescriptorPool_AddDescriptor("google/protobuf/source_context.proto", google_protobuf_source_context_proto_descriptor, + sizeof(google_protobuf_source_context_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_SourceContext, initOnce) { + google_protobuf_source_context_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_SourceContext_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_SourceContext, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_SourceContext_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\SourceContext", + GPBMetadata_Google_Protobuf_SourceContext_methods); + + GPBMetadata_Google_Protobuf_SourceContext_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_SourceContext */ + +zend_class_entry* google_protobuf_SourceContext_ce; + +static PHP_METHOD(google_protobuf_SourceContext, __construct) { + google_protobuf_source_context_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_SourceContext, getFileName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "file_name"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_SourceContext, setFileName) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "file_name"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_SourceContext_phpmethods[] = { + PHP_ME(google_protobuf_SourceContext, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_SourceContext, getFileName, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_SourceContext, setFileName, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_SourceContext_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\SourceContext", + google_protobuf_SourceContext_phpmethods); + + google_protobuf_SourceContext_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_SourceContext_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_SourceContext_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_SourceContext_ce, message_ce); +} + +/* google/protobuf/field_mask.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_FieldMask_ce; + +const char google_protobuf_field_mask_proto_descriptor [223] = { +'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'f', 'i', 'e', 'l', 'd', '_', 'm', +'a', 's', 'k', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', +'f', '\"', '\032', '\n', '\t', 'F', 'i', 'e', 'l', 'd', 'M', 'a', 's', 'k', '\022', '\r', '\n', '\005', 'p', 'a', 't', 'h', 's', '\030', '\001', +' ', '\003', '(', '\t', 'B', '\205', '\001', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', +'b', 'u', 'f', 'B', '\016', 'F', 'i', 'e', 'l', 'd', 'M', 'a', 's', 'k', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '2', 'g', 'o', +'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', +'t', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o', 'w', 'n', '/', 'f', 'i', 'e', 'l', 'd', 'm', 'a', 's', 'k', 'p', 'b', '\370', '\001', +'\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', +'.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', 'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_field_mask_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/field_mask.proto")) return; + DescriptorPool_AddDescriptor("google/protobuf/field_mask.proto", google_protobuf_field_mask_proto_descriptor, + sizeof(google_protobuf_field_mask_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_FieldMask, initOnce) { + google_protobuf_field_mask_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_FieldMask_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_FieldMask, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_FieldMask_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\FieldMask", + GPBMetadata_Google_Protobuf_FieldMask_methods); + + GPBMetadata_Google_Protobuf_FieldMask_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_FieldMask */ + +zend_class_entry* google_protobuf_FieldMask_ce; + +static PHP_METHOD(google_protobuf_FieldMask, __construct) { + google_protobuf_field_mask_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_FieldMask, getPaths) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "paths"); + zval ret; + Message_get(intern, f, &ret); + RETURN_ZVAL(&ret, 1, 0); +} + +static PHP_METHOD(google_protobuf_FieldMask, setPaths) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, + "paths"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_ZVAL(getThis(), 1, 0); +} + +static zend_function_entry google_protobuf_FieldMask_phpmethods[] = { + PHP_ME(google_protobuf_FieldMask, __construct, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_FieldMask, getPaths, NULL, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_FieldMask, setPaths, NULL, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_FieldMask_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\FieldMask", + google_protobuf_FieldMask_phpmethods); + + google_protobuf_FieldMask_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_FieldMask_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_FieldMask_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_FieldMask_ce, message_ce); +} + +static void WellKnownTypes_ModuleInit() { + GPBMetadata_Google_Protobuf_Timestamp_ModuleInit(); + google_protobuf_Timestamp_ModuleInit(); + GPBMetadata_Google_Protobuf_Wrappers_ModuleInit(); + google_protobuf_DoubleValue_ModuleInit(); + google_protobuf_FloatValue_ModuleInit(); + google_protobuf_Int64Value_ModuleInit(); + google_protobuf_UInt64Value_ModuleInit(); + google_protobuf_Int32Value_ModuleInit(); + google_protobuf_UInt32Value_ModuleInit(); + google_protobuf_BoolValue_ModuleInit(); + google_protobuf_StringValue_ModuleInit(); + google_protobuf_BytesValue_ModuleInit(); + GPBMetadata_Google_Protobuf_Any_ModuleInit(); + google_protobuf_Any_ModuleInit(); + GPBMetadata_Google_Protobuf_Duration_ModuleInit(); + google_protobuf_Duration_ModuleInit(); + GPBMetadata_Google_Protobuf_Api_ModuleInit(); + google_protobuf_Api_ModuleInit(); + google_protobuf_Method_ModuleInit(); + google_protobuf_Mixin_ModuleInit(); + GPBMetadata_Google_Protobuf_GPBEmpty_ModuleInit(); + google_protobuf_Empty_ModuleInit(); + GPBMetadata_Google_Protobuf_Type_ModuleInit(); + google_protobuf_Type_ModuleInit(); + google_protobuf_Field_ModuleInit(); + google_protobuf_Enum_ModuleInit(); + google_protobuf_EnumValue_ModuleInit(); + google_protobuf_Option_ModuleInit(); + GPBMetadata_Google_Protobuf_Struct_ModuleInit(); + google_protobuf_Struct_ModuleInit(); + google_protobuf_Struct_FieldsEntry_ModuleInit(); + google_protobuf_Value_ModuleInit(); + google_protobuf_ListValue_ModuleInit(); + GPBMetadata_Google_Protobuf_SourceContext_ModuleInit(); + google_protobuf_SourceContext_ModuleInit(); + GPBMetadata_Google_Protobuf_FieldMask_ModuleInit(); + google_protobuf_FieldMask_ModuleInit(); +} diff --git a/php/tests/compile_extension.sh b/php/tests/compile_extension.sh index d6dcabcbbb..01ec79f0c1 100755 --- a/php/tests/compile_extension.sh +++ b/php/tests/compile_extension.sh @@ -7,7 +7,6 @@ cd $(dirname $0) pushd ../ext/google/protobuf phpize --clean rm -f configure.in configure.ac -php make-preload.php phpize if [ "$1" = "--release" ]; then ./configure --with-php-config=$(which php-config) diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index 177ca90cee..9b518f508c 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -81,6 +81,7 @@ namespace php { struct Options { bool is_descriptor = false; bool aggregate_metadata = false; + bool gen_c_wkt = false; std::set aggregate_metadata_prefixes; }; @@ -1791,7 +1792,7 @@ void GenerateEnumValueDocComment(io::Printer* printer, } void GenerateServiceMethodDocComment(io::Printer* printer, - const MethodDescriptor* method) { + const MethodDescriptor* method) { printer->Print("/**\n"); GenerateDocCommentBody(printer, method); printer->Print( @@ -1807,6 +1808,231 @@ void GenerateServiceMethodDocComment(io::Printer* printer, "return_type", EscapePhpdoc(FullClassName(method->output_type(), false))); } +std::string FilenameCName(const FileDescriptor* file) { + std::string c_name = file->name(); + c_name = StringReplace(c_name, ".", "_", true); + c_name = StringReplace(c_name, "/", "_", true); + return c_name; +} + +void GenerateCMessage(const Descriptor* message, io::Printer* printer) { + std::string c_name = message->full_name(); + c_name = StringReplace(c_name, ".", "_", true); + std::string php_name = FullClassName(message, Options()); + php_name = StringReplace(php_name, "\\", "\\\\", true); + printer->Print( + "/* $c_name$ */\n" + "\n" + "zend_class_entry* $c_name$_ce;\n" + "\n" + "static PHP_METHOD($c_name$, __construct) {\n" + " $file_c_name$_AddDescriptor();\n" + " zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU);\n" + "}\n" + "\n", + "file_c_name", FilenameCName(message->file()), + "c_name", c_name); + + for (int i = 0; i < message->field_count(); i++) { + auto field = message->field(i); + printer->Print( + "static PHP_METHOD($c_name$, get$camel_name$) {\n" + " Message* intern = (Message*)Z_OBJ_P(getThis());\n" + " const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef,\n" + " \"$name$\");\n" + " zval ret;\n" + " Message_get(intern, f, &ret);\n" + " RETURN_ZVAL(&ret, 1, 0);\n" + "}\n" + "\n" + "static PHP_METHOD($c_name$, set$camel_name$) {\n" + " Message* intern = (Message*)Z_OBJ_P(getThis());\n" + " const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef,\n" + " \"$name$\");\n" + " zval *val;\n" + " if (zend_parse_parameters(ZEND_NUM_ARGS(), \"z\", &val)\n" + " == FAILURE) {\n" + " return;\n" + " }\n" + " Message_set(intern, f, val);\n" + " RETURN_ZVAL(getThis(), 1, 0);\n" + "}\n" + "\n", + "c_name", c_name, + "name", field->name(), + "camel_name", UnderscoresToCamelCase(field->name(), true)); + } + + printer->Print( + "static zend_function_entry $c_name$_phpmethods[] = {\n" + " PHP_ME($c_name$, __construct, NULL, ZEND_ACC_PUBLIC)\n", + "c_name", c_name); + + for (int i = 0; i < message->field_count(); i++) { + auto field = message->field(i); + printer->Print( + " PHP_ME($c_name$, get$camel_name$, NULL, ZEND_ACC_PUBLIC)\n" + " PHP_ME($c_name$, set$camel_name$, NULL, ZEND_ACC_PUBLIC)\n", + "c_name", c_name, + "camel_name", UnderscoresToCamelCase(field->name(), true)); + } + + if (message->well_known_type() == Descriptor::WELLKNOWNTYPE_ANY) { + printer->Print( + " PHP_ME($c_name$, unpack, NULL, ZEND_ACC_PUBLIC)\n", + "c_name", c_name); + } + + printer->Print( + " ZEND_FE_END\n" + "};\n" + "\n" + "static void $c_name$_ModuleInit() {\n" + " zend_class_entry tmp_ce;\n" + "\n" + " INIT_CLASS_ENTRY(tmp_ce, \"$php_name$\",\n" + " $c_name$_phpmethods);\n" + "\n" + " $c_name$_ce = zend_register_internal_class(&tmp_ce);\n" + " $c_name$_ce->ce_flags |= ZEND_ACC_FINAL;\n" + " $c_name$_ce->create_object = Message_create;\n" + " zend_do_inheritance($c_name$_ce, message_ce);\n" + "}\n" + "\n", + "c_name", c_name, + "php_name", php_name); + + for (int i = 0; i < message->nested_type_count(); i++) { + GenerateCMessage(message->nested_type(i), printer); + } +} + +void GenerateCInit(const Descriptor* message, io::Printer* printer) { + std::string c_name = message->full_name(); + c_name = StringReplace(c_name, ".", "_", true); + + printer->Print( + " $c_name$_ModuleInit();\n", + "c_name", c_name); + + for (int i = 0; i < message->nested_type_count(); i++) { + GenerateCInit(message->nested_type(i), printer); + } +} + +void GenerateCWellKnownTypes(const std::vector& files, + GeneratorContext* context) { + std::unique_ptr output( + context->Open("../ext/google/protobuf/wkt.inc")); + io::Printer printer(output.get(), '$'); + + printer.Print( + "// This file is generated from the .proto files for the well-known\n" + "// types. Do not edit!\n"); + + for (auto file : files) { + printer.Print( + "static void $c_name$_AddDescriptor();\n", + "c_name", FilenameCName(file)); + } + + for (auto file : files) { + std::string c_name = FilenameCName(file); + std::string metadata_filename = GeneratedMetadataFileName(file, Options()); + std::string metadata_classname = FilenameToClassname(metadata_filename); + std::string metadata_c_name = + StringReplace(metadata_classname, "\\", "_", true); + metadata_classname = StringReplace(metadata_classname, "\\", "\\\\", true); + FileDescriptorProto file_proto; + file->CopyTo(&file_proto); + std::string serialized; + file_proto.SerializeToString(&serialized); + printer.Print( + "/* $filename$ */\n" + "\n" + "zend_class_entry* $metadata_c_name$_ce;\n" + "\n" + "const char $c_name$_descriptor [$size$] = {\n", + "filename", file->name(), + "c_name", c_name, + "metadata_c_name", metadata_c_name, + "size", std::to_string(serialized.size())); + + for (size_t i = 0; i < serialized.size();) { + for (size_t j = 0; j < 25 && i < serialized.size(); ++i, ++j) { + printer.Print("'$ch$', ", "ch", CEscape(serialized.substr(i, 1))); + } + printer.Print("\n"); + } + + printer.Print( + "};\n" + "\n" + "static void $c_name$_AddDescriptor() {\n" + " if (DescriptorPool_HasFile(\"$filename$\")) return;\n", + "filename", file->name(), + "c_name", c_name, + "metadata_c_name", metadata_c_name); + + for (int i = 0; i < file->dependency_count(); i++) { + std::string dep_c_name = FilenameCName(file->dependency(i)); + printer.Print( + " $dep_c_name$_AddDescriptor();\n", + "dep_c_name", dep_c_name); + } + + printer.Print( + " DescriptorPool_AddDescriptor(\"$filename$\", $c_name$_descriptor,\n" + " sizeof($c_name$_descriptor));\n" + "}\n" + "\n" + "static PHP_METHOD($metadata_c_name$, initOnce) {\n" + " $c_name$_AddDescriptor();\n" + "}\n" + "\n" + "static zend_function_entry $metadata_c_name$_methods[] = {\n" + " PHP_ME($metadata_c_name$, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)\n" + " ZEND_FE_END\n" + "};\n" + "\n" + "static void $metadata_c_name$_ModuleInit() {\n" + " zend_class_entry tmp_ce;\n" + "\n" + " INIT_CLASS_ENTRY(tmp_ce, \"$metadata_classname$\",\n" + " $metadata_c_name$_methods);\n" + "\n" + " $metadata_c_name$_ce = zend_register_internal_class(&tmp_ce);\n" + "}\n" + "\n", + "filename", file->name(), + "c_name", c_name, + "metadata_c_name", metadata_c_name, + "metadata_classname", metadata_classname); + for (int i = 0; i < file->message_type_count(); i++) { + GenerateCMessage(file->message_type(i), &printer); + } + } + + printer.Print( + "static void WellKnownTypes_ModuleInit() {\n"); + + for (auto file : files) { + std::string metadata_filename = GeneratedMetadataFileName(file, Options()); + std::string metadata_classname = FilenameToClassname(metadata_filename); + std::string metadata_c_name = + StringReplace(metadata_classname, "\\", "_", true); + printer.Print( + " $metadata_c_name$_ModuleInit();\n", + "metadata_c_name", metadata_c_name); + for (int i = 0; i < file->message_type_count(); i++) { + GenerateCInit(file->message_type(i), &printer); + } + } + + printer.Print( + "}\n"); +} + } // namespace bool Generator::Generate(const FileDescriptor* file, const string& parameter, @@ -1850,9 +2076,12 @@ bool Generator::GenerateAll(const std::vector& files, options.aggregate_metadata_prefixes.insert(prefix); GOOGLE_LOG(INFO) << prefix; } - } - if (option_pair[0] == "internal") { + } else if (option_pair[0] == "internal") { options.is_descriptor = true; + } else if (option_pair[0] == "internal_generate_c_wkt") { + GenerateCWellKnownTypes(files, generator_context); + } else { + GOOGLE_LOG(FATAL) << "Unknown codegen option: " << option_pair[0]; } } @@ -1861,6 +2090,7 @@ bool Generator::GenerateAll(const std::vector& files, return false; } } + return true; }