diff options
Diffstat (limited to 'upb')
60 files changed, 363 insertions, 634 deletions
diff --git a/upb/bindings/googlepb/bridge.cc b/upb/bindings/googlepb/bridge.cc index 394f7b4..c196140 100644 --- a/upb/bindings/googlepb/bridge.cc +++ b/upb/bindings/googlepb/bridge.cc @@ -1,9 +1,4 @@ -// -// upb - a minimalist implementation of protocol buffers. -// -// Copyright (c) 2011-2012 Google Inc. See LICENSE for details. -// Author: Josh Haberman <jhaberman@gmail.com> -// + // IMPORTANT NOTE! Inside Google, This file is compiled TWICE, once with // UPB_GOOGLE3 defined and once without! This allows us to provide // functionality against proto2 and protobuf opensource both in a single binary diff --git a/upb/bindings/googlepb/bridge.h b/upb/bindings/googlepb/bridge.h index 9878247..ec8ac41 100644 --- a/upb/bindings/googlepb/bridge.h +++ b/upb/bindings/googlepb/bridge.h @@ -1,8 +1,7 @@ // -// upb - a minimalist implementation of protocol buffers. -// -// Copyright (c) 2011-2012 Google Inc. See LICENSE for details. -// Author: Josh Haberman <jhaberman@gmail.com> +// upb::googlepb::DefBuilder +// upb::googlepb::WriteHandlers +// upb::googlepb::CodeCache // // This file contains functionality for constructing upb Defs and Handlers // corresponding to proto2 messages. Using this functionality, you can use upb diff --git a/upb/bindings/googlepb/proto1.cc b/upb/bindings/googlepb/proto1.cc index 68b572c..fa51f79 100644 --- a/upb/bindings/googlepb/proto1.cc +++ b/upb/bindings/googlepb/proto1.cc @@ -1,9 +1,4 @@ // -// upb - a minimalist implementation of protocol buffers. -// -// Copyright (c) 2011-2012 Google Inc. See LICENSE for details. -// Author: Josh Haberman <jhaberman@gmail.com> -// // This set of handlers can write into a proto2::Message whose reflection class // is _pi::Proto2Reflection (ie. proto1 messages; while slightly confusing, the // name "Proto2Reflection" indicates that it is a reflection class implementing diff --git a/upb/bindings/googlepb/proto1.int.h b/upb/bindings/googlepb/proto1.int.h index 64ebb2f..d5c9cad 100644 --- a/upb/bindings/googlepb/proto1.int.h +++ b/upb/bindings/googlepb/proto1.int.h @@ -1,9 +1,3 @@ -// -// upb - a minimalist implementation of protocol buffers. -// -// Copyright (c) 2011-2012 Google Inc. See LICENSE for details. -// Author: Josh Haberman <jhaberman@gmail.com> -// // Support for registering field handlers that can write into a legacy proto1 // message. This functionality is only needed inside Google. // diff --git a/upb/bindings/googlepb/proto2.cc b/upb/bindings/googlepb/proto2.cc index 636bb90..ee31d34 100644 --- a/upb/bindings/googlepb/proto2.cc +++ b/upb/bindings/googlepb/proto2.cc @@ -1,9 +1,4 @@ // -// upb - a minimalist implementation of protocol buffers. -// -// Copyright (c) 2011-2012 Google Inc. See LICENSE for details. -// Author: Josh Haberman <jhaberman@gmail.com> -// // Note that we have received an exception from c-style-artiters regarding // dynamic_cast<> in this file: // https://groups.google.com/a/google.com/d/msg/c-style/7Zp_XCX0e7s/I6dpzno4l-MJ diff --git a/upb/bindings/googlepb/proto2.int.h b/upb/bindings/googlepb/proto2.int.h index 5ce44c4..4f45efb 100644 --- a/upb/bindings/googlepb/proto2.int.h +++ b/upb/bindings/googlepb/proto2.int.h @@ -1,9 +1,3 @@ -// -// upb - a minimalist implementation of protocol buffers. -// -// Copyright (c) 2011-2012 Google Inc. See LICENSE for details. -// Author: Josh Haberman <jhaberman@gmail.com> -// // Support for registering field handlers that can write into a proto2 // message that uses GeneratedMessageReflection (which includes all messages // generated by the proto2 compiler as well as DynamicMessage). diff --git a/upb/bindings/linux/assert.h b/upb/bindings/linux/assert.h index 26d8ab6..543f7fb 100644 --- a/upb/bindings/linux/assert.h +++ b/upb/bindings/linux/assert.h @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include <linux/kernel.h> diff --git a/upb/bindings/linux/errno.h b/upb/bindings/linux/errno.h index f45d939..d6c56bc 100644 --- a/upb/bindings/linux/errno.h +++ b/upb/bindings/linux/errno.h @@ -1,8 +1,2 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include <linux/errno.h> diff --git a/upb/bindings/linux/stdint.h b/upb/bindings/linux/stdint.h index 2524b23..2aa5144 100644 --- a/upb/bindings/linux/stdint.h +++ b/upb/bindings/linux/stdint.h @@ -1,8 +1,2 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include <linux/types.h> diff --git a/upb/bindings/linux/stdio.h b/upb/bindings/linux/stdio.h index 72c1b0d..dd22e5b 100644 --- a/upb/bindings/linux/stdio.h +++ b/upb/bindings/linux/stdio.h @@ -1,10 +1,2 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Linux-kernel implementations of some stdlib.h functions. - */ #include <linux/kernel.h> // For sprintf and friends. diff --git a/upb/bindings/linux/stdlib.h b/upb/bindings/linux/stdlib.h index 8381b13..5ae6742 100644 --- a/upb/bindings/linux/stdlib.h +++ b/upb/bindings/linux/stdlib.h @@ -1,11 +1,6 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Linux-kernel implementations of some stdlib.h functions. - */ +** Linux-kernel implementations of some stdlib.h functions. +*/ #include <linux/slab.h> diff --git a/upb/bindings/linux/string.h b/upb/bindings/linux/string.h index 30ebf8a..9cfd9b3 100644 --- a/upb/bindings/linux/string.h +++ b/upb/bindings/linux/string.h @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #ifndef UPB_LINUX_STRING_H_ #define UPB_LINUX_STRING_H_ diff --git a/upb/bindings/lua/upb.c b/upb/bindings/lua/upb.c index 9629314..2d7b1b3 100644 --- a/upb/bindings/lua/upb.c +++ b/upb/bindings/lua/upb.c @@ -1,27 +1,24 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * A Lua extension for upb. Exposes only the core library - * (sub-libraries are exposed in other extensions). - * - * 64-bit woes: Lua can only represent numbers of type lua_Number (which is - * double unless the user specifically overrides this). Doubles can represent - * the entire range of 64-bit integers, but lose precision once the integers are - * greater than 2^53. - * - * Lua 5.3 is adding support for integers, which will allow for 64-bit - * integers (which can be interpreted as signed or unsigned). - * - * LuaJIT supports 64-bit signed and unsigned boxed representations - * through its "cdata" mechanism, but this is not portable to regular Lua. - * - * Hopefully Lua 5.3 will come soon enough that we can either use Lua 5.3 - * integer support or LuaJIT 64-bit cdata for users that need the entire - * domain of [u]int64 values. - */ +** require("lua") -- A Lua extension for upb. +** +** Exposes only the core library +** (sub-libraries are exposed in other extensions). +** +** 64-bit woes: Lua can only represent numbers of type lua_Number (which is +** double unless the user specifically overrides this). Doubles can represent +** the entire range of 64-bit integers, but lose precision once the integers are +** greater than 2^53. +** +** Lua 5.3 is adding support for integers, which will allow for 64-bit +** integers (which can be interpreted as signed or unsigned). +** +** LuaJIT supports 64-bit signed and unsigned boxed representations +** through its "cdata" mechanism, but this is not portable to regular Lua. +** +** Hopefully Lua 5.3 will come soon enough that we can either use Lua 5.3 +** integer support or LuaJIT 64-bit cdata for users that need the entire +** domain of [u]int64 values. +*/ #include <float.h> #include <math.h> diff --git a/upb/bindings/lua/upb.h b/upb/bindings/lua/upb.h index 09ffaa9..6957ec2 100644 --- a/upb/bindings/lua/upb.h +++ b/upb/bindings/lua/upb.h @@ -1,11 +1,6 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Shared definitions for upb Lua modules. - */ +** Shared definitions for upb Lua modules. +*/ #ifndef UPB_LUA_UPB_H_ #define UPB_LUA_UPB_H_ diff --git a/upb/bindings/lua/upb/pb.c b/upb/bindings/lua/upb/pb.c index b85da18..f095a61 100644 --- a/upb/bindings/lua/upb/pb.c +++ b/upb/bindings/lua/upb/pb.c @@ -1,14 +1,9 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * A Lua extension for upb.pb. - * - * Exposes all the types defined in upb/pb/{*}.h - * Also defines a few convenience functions on top. - */ +** require("upb.pb") -- A Lua extension for upb.pb. +** +** Exposes all the types defined in upb/pb/{*}.h +** Also defines a few convenience functions on top. +*/ #include "upb/bindings/lua/upb.h" #include "upb/pb/decoder.h" diff --git a/upb/bindings/lua/upb/table.c b/upb/bindings/lua/upb/table.c index b82b3f8..2379342 100644 --- a/upb/bindings/lua/upb/table.c +++ b/upb/bindings/lua/upb/table.c @@ -1,21 +1,17 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Lua extension that provides access to upb_table. This is an internal-only - * interface and exists for the sole purpose of writing a C code generator in - * Lua that can dump a upb_table as static C initializers. This lets us use - * Lua for convenient string manipulation while saving us from re-implementing - * the upb_table hash function and hash table layout / collision strategy in - * Lua. - * - * Since this is used only as part of the toolchain (and not part of the - * runtime) we do not hold this module to the same stringent requirements as - * the main Lua modules (for example that misbehaving Lua programs cannot - * crash the interpreter). - */ +** require("upb.table") -- a Lua extension for accessing upb_table +** +** This is an internal-only interface and exists for the sole purpose of +** writing a C code generator in Lua that can dump a upb_table as static C +** initializers. This lets us use Lua for convenient string manipulation while +** saving us from re-implementing the upb_table hash function and hash table +** layout / collision strategy in Lua. +** +** Since this is used only as part of the toolchain (and not part of the +** runtime) we do not hold this module to the same stringent requirements as +** the main Lua modules (for example that misbehaving Lua programs cannot +** crash the interpreter). +*/ #include <float.h> #include <math.h> diff --git a/upb/bindings/python/upb.c b/upb/bindings/python/upb.c index 6cfc8e9..778b821 100644 --- a/upb/bindings/python/upb.c +++ b/upb/bindings/python/upb.c @@ -1,12 +1,7 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Python extension exposing the core of upb: definitions, handlers, - * and a message type. - */ +** Python extension exposing the core of upb: definitions, handlers, +** and a message type. +**/ #include <stddef.h> #include <Python.h> diff --git a/upb/bindings/ruby/upb.c b/upb/bindings/ruby/upb.c index 9618366..ea0fcc8 100644 --- a/upb/bindings/ruby/upb.c +++ b/upb/bindings/ruby/upb.c @@ -1,11 +1,6 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * upb (prototype) extension for Ruby. - */ +** upb (prototype) extension for Ruby. +*/ #include "ruby/ruby.h" #include "ruby/vm.h" diff --git a/upb/bindings/stdc++/string.h b/upb/bindings/stdc++/string.h index 20a0876..99efd4f 100644 --- a/upb/bindings/stdc++/string.h +++ b/upb/bindings/stdc++/string.h @@ -1,7 +1,3 @@ -// Copyright 2014 Google Inc. All Rights Reserved. -// Author: haberman@google.com (Josh Haberman) -// -// upb - a minimalist implementation of protocol buffers. #ifndef UPB_STDCPP_H_ #define UPB_STDCPP_H_ diff --git a/upb/bindings/stdc/error.c b/upb/bindings/stdc/error.c index 85c9ca6..521c1e4 100644 --- a/upb/bindings/stdc/error.c +++ b/upb/bindings/stdc/error.c @@ -1,11 +1,6 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Handling of errno. - */ +** Handling of errno. +*/ #include "upb/stdc/error.h" diff --git a/upb/bindings/stdc/error.h b/upb/bindings/stdc/error.h index cfc7025..69a2e2b 100644 --- a/upb/bindings/stdc/error.h +++ b/upb/bindings/stdc/error.h @@ -1,11 +1,6 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Handling of errno. - */ +** Handling of errno. +*/ #include "upb/upb.h" diff --git a/upb/bindings/stdc/io.c b/upb/bindings/stdc/io.c index 5d36aa5..a95eb48 100644 --- a/upb/bindings/stdc/io.c +++ b/upb/bindings/stdc/io.c @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include "upb/stdc/io.h" diff --git a/upb/bindings/stdc/io.h b/upb/bindings/stdc/io.h index 7c6f282..b131500 100644 --- a/upb/bindings/stdc/io.h +++ b/upb/bindings/stdc/io.h @@ -1,11 +1,6 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * ANSI C file I/O. - */ +** ANSI C file I/O. +*/ #ifndef UPB_STDC_IO_H_ #define UPB_STDC_IO_H_ @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2008-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include "upb/def.h" @@ -1,23 +1,21 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Defs are upb's internal representation of the constructs that can appear - * in a .proto file: - * - * - upb_msgdef: describes a "message" construct. - * - upb_fielddef: describes a message field. - * - upb_enumdef: describes an enum. - * (TODO: definitions of services). - * - * Like upb_refcounted objects, defs are mutable only until frozen, and are - * only thread-safe once frozen. - * - * This is a mixed C/C++ interface that offers a full API to both languages. - * See the top-level README for more information. - */ +** Defs are upb's internal representation of the constructs that can appear +** in a .proto file: +** +** - upb::MessageDef (upb_msgdef): describes a "message" construct. +** - upb::FieldDef (upb_fielddef): describes a message field. +** - upb::EnumDef (upb_enumdef): describes an enum. +** - upb::OneofDef (upb_oneofdef): describes a oneof. +** - upb::Def (upb_def): base class of all the others. +** +** TODO: definitions of services. +** +** Like upb_refcounted objects, defs are mutable only until frozen, and are +** only thread-safe once frozen. +** +** This is a mixed C/C++ interface that offers a full API to both languages. +** See the top-level README for more information. +*/ #ifndef UPB_DEF_H_ #define UPB_DEF_H_ diff --git a/upb/descriptor/reader.c b/upb/descriptor/reader.c index 9ed5d12..17d6675 100644 --- a/upb/descriptor/reader.c +++ b/upb/descriptor/reader.c @@ -1,15 +1,10 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2008-2009 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * XXX: The routines in this file that consume a string do not currently - * support having the string span buffers. In the future, as upb_sink and - * its buffering/sharing functionality evolve there should be an easy and - * idiomatic way of correctly handling this case. For now, we accept this - * limitation since we currently only parse descriptors from single strings. - */ +** XXX: The routines in this file that consume a string do not currently +** support having the string span buffers. In the future, as upb_sink and +** its buffering/sharing functionality evolve there should be an easy and +** idiomatic way of correctly handling this case. For now, we accept this +** limitation since we currently only parse descriptors from single strings. +*/ #include "upb/descriptor/reader.h" diff --git a/upb/descriptor/reader.h b/upb/descriptor/reader.h index bb9565c..e345f53 100644 --- a/upb/descriptor/reader.h +++ b/upb/descriptor/reader.h @@ -1,12 +1,8 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2011 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * upb::descriptor::Reader provides a way of building upb::Defs from - * data in descriptor.proto format. - */ +** upb::descriptor::Reader (upb_descreader) +** +** Provides a way of building upb::Defs from data in descriptor.proto format. +*/ #ifndef UPB_DESCRIPTOR_H #define UPB_DESCRIPTOR_H @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include "upb/env.h" @@ -1,19 +1,16 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * A upb::Environment provides a means for injecting malloc and an - * error-reporting callback into encoders/decoders. This allows them to be - * independent of nearly all assumptions about their actual environment. - * - * It is also a container for allocating the encoders/decoders themselves that - * insulates clients from knowing their actual size. This provides ABI - * compatibility even if the size of the objects change. And this allows the - * structure definitions to be in the .c files instead of the .h files, making - * the .h files smaller and more readable. - */ +** upb::Environment (upb_env) +** +** A upb::Environment provides a means for injecting malloc and an +** error-reporting callback into encoders/decoders. This allows them to be +** independent of nearly all assumptions about their actual environment. +** +** It is also a container for allocating the encoders/decoders themselves that +** insulates clients from knowing their actual size. This provides ABI +** compatibility even if the size of the objects change. And this allows the +** structure definitions to be in the .c files instead of the .h files, making +** the .h files smaller and more readable. +*/ #include "upb/upb.h" diff --git a/upb/handlers-inl.h b/upb/handlers-inl.h index 444ca76..8cec602 100644 --- a/upb/handlers-inl.h +++ b/upb/handlers-inl.h @@ -1,12 +1,7 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2011-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Inline definitions for handlers.h, which are particularly long and a bit - * tricky. - */ +** Inline definitions for handlers.h, which are particularly long and a bit +** tricky. +*/ #ifndef UPB_HANDLERS_INL_H_ #define UPB_HANDLERS_INL_H_ diff --git a/upb/handlers.c b/upb/handlers.c index 64f8595..ead0403 100644 --- a/upb/handlers.c +++ b/upb/handlers.c @@ -1,12 +1,7 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2011-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * TODO(haberman): it's unclear whether a lot of the consistency checks should - * assert() or return false. - */ +** TODO(haberman): it's unclear whether a lot of the consistency checks should +** assert() or return false. +*/ #include "upb/handlers.h" #include "upb/structdefs.int.h" diff --git a/upb/handlers.h b/upb/handlers.h index 229d808..8925d4f 100644 --- a/upb/handlers.h +++ b/upb/handlers.h @@ -1,23 +1,20 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2010-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * A upb_handlers is like a virtual table for a upb_msgdef. Each field of the - * message can have associated functions that will be called when we are - * parsing or visiting a stream of data. This is similar to how handlers work - * in SAX (the Simple API for XML). - * - * The handlers have no idea where the data is coming from, so a single set of - * handlers could be used with two completely different data sources (for - * example, a parser and a visitor over in-memory objects). This decoupling is - * the most important feature of upb, because it allows parsers and serializers - * to be highly reusable. - * - * This is a mixed C/C++ interface that offers a full API to both languages. - * See the top-level README for more information. - */ +** upb::Handlers (upb_handlers) +** +** A upb_handlers is like a virtual table for a upb_msgdef. Each field of the +** message can have associated functions that will be called when we are +** parsing or visiting a stream of data. This is similar to how handlers work +** in SAX (the Simple API for XML). +** +** The handlers have no idea where the data is coming from, so a single set of +** handlers could be used with two completely different data sources (for +** example, a parser and a visitor over in-memory objects). This decoupling is +** the most important feature of upb, because it allows parsers and serializers +** to be highly reusable. +** +** This is a mixed C/C++ interface that offers a full API to both languages. +** See the top-level README for more information. +*/ #ifndef UPB_HANDLERS_H #define UPB_HANDLERS_H diff --git a/upb/json/parser.h b/upb/json/parser.h index 2facb45..8e608e8 100644 --- a/upb/json/parser.h +++ b/upb/json/parser.h @@ -1,12 +1,9 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * upb::json::Parser can parse JSON according to a specific schema. - * Support for parsing arbitrary JSON (schema-less) will be added later. - */ +** upb::json::Parser (upb_json_parser) +** +** Parses JSON according to a specific schema. +** Support for parsing arbitrary JSON (schema-less) will be added later. +*/ #ifndef UPB_JSON_PARSER_H_ #define UPB_JSON_PARSER_H_ diff --git a/upb/json/printer.c b/upb/json/printer.c index 7e52dc2..4a6f1ad 100644 --- a/upb/json/printer.c +++ b/upb/json/printer.c @@ -1,12 +1,7 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * This currently uses snprintf() to format primitives, and could be optimized - * further. - */ +** This currently uses snprintf() to format primitives, and could be optimized +** further. +*/ #include "upb/json/printer.h" diff --git a/upb/json/printer.h b/upb/json/printer.h index 0b4e19c..84d814c 100644 --- a/upb/json/printer.h +++ b/upb/json/printer.h @@ -1,12 +1,8 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * upb::json::Printer allows you to create handlers that emit JSON - * according to a specific protobuf schema. - */ +** upb::json::Printer +** +** Handlers that emit JSON according to a specific protobuf schema. +*/ #ifndef UPB_JSON_TYPED_PRINTER_H_ #define UPB_JSON_TYPED_PRINTER_H_ diff --git a/upb/pb/compile_decoder.c b/upb/pb/compile_decoder.c index 83c914b..2828247 100644 --- a/upb/pb/compile_decoder.c +++ b/upb/pb/compile_decoder.c @@ -1,19 +1,16 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2013 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Code to compile a upb::Handlers into bytecode for decoding a protobuf - * according to that specific schema and destination handlers. - * - * Compiling to bytecode is always the first step. If we are using the - * interpreted decoder we leave it as bytecode and interpret that. If we are - * using a JIT decoder we use a code generator to turn the bytecode into native - * code, LLVM IR, etc. - * - * Bytecode definition is in decoder.int.h. - */ +** protobuf decoder bytecode compiler +** +** Code to compile a upb::Handlers into bytecode for decoding a protobuf +** according to that specific schema and destination handlers. +** +** Compiling to bytecode is always the first step. If we are using the +** interpreted decoder we leave it as bytecode and interpret that. If we are +** using a JIT decoder we use a code generator to turn the bytecode into native +** code, LLVM IR, etc. +** +** Bytecode definition is in decoder.int.h. +*/ #include <stdarg.h> #include "upb/pb/decoder.int.h" diff --git a/upb/pb/compile_decoder_x64.c b/upb/pb/compile_decoder_x64.c index 9b78c65..88561d6 100644 --- a/upb/pb/compile_decoder_x64.c +++ b/upb/pb/compile_decoder_x64.c @@ -1,11 +1,6 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2013 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Driver code for the x64 JIT compiler. - */ +** Driver code for the x64 JIT compiler. +*/ /* Needed to ensure we get defines like MAP_ANON. */ #define _GNU_SOURCE diff --git a/upb/pb/decoder.c b/upb/pb/decoder.c index a6240ce..905fdd1 100644 --- a/upb/pb/decoder.c +++ b/upb/pb/decoder.c @@ -1,22 +1,17 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2008-2013 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * This file implements a VM for the interpreted (bytecode) decoder. - * - * Bytecode must previously have been generated using the bytecode compiler in - * compile_decoder.c. This decoder then walks through the bytecode op-by-op to - * parse the input. - * - * Decoding is fully resumable; we just keep a pointer to the current bytecode - * instruction and resume from there. A fair amount of the logic here is to - * handle the fact that values can span buffer seams and we have to be able to - * be capable of suspending/resuming from any byte in the stream. This - * sometimes requires keeping a few trailing bytes from the last buffer around - * in the "residual" buffer. - */ +** upb::Decoder (Bytecode Decoder VM) +** +** Bytecode must previously have been generated using the bytecode compiler in +** compile_decoder.c. This decoder then walks through the bytecode op-by-op to +** parse the input. +** +** Decoding is fully resumable; we just keep a pointer to the current bytecode +** instruction and resume from there. A fair amount of the logic here is to +** handle the fact that values can span buffer seams and we have to be able to +** be capable of suspending/resuming from any byte in the stream. This +** sometimes requires keeping a few trailing bytes from the last buffer around +** in the "residual" buffer. +*/ #include <inttypes.h> #include <stddef.h> diff --git a/upb/pb/decoder.h b/upb/pb/decoder.h index 6a9e1d4..f28e5e6 100644 --- a/upb/pb/decoder.h +++ b/upb/pb/decoder.h @@ -1,19 +1,16 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009-2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * upb::pb::Decoder implements a high performance, streaming, resumable decoder - * for the binary protobuf format. - * - * This interface works the same regardless of what decoder backend is being - * used. A client of this class does not need to know whether decoding is using - * a JITted decoder (DynASM, LLVM, etc) or an interpreted decoder. By default, - * it will always use the fastest available decoder. However, you can call - * set_allow_jit(false) to disable any JIT decoder that might be available. - * This is primarily useful for testing purposes. - */ +** upb::pb::Decoder +** +** A high performance, streaming, resumable decoder for the binary protobuf +** format. +** +** This interface works the same regardless of what decoder backend is being +** used. A client of this class does not need to know whether decoding is using +** a JITted decoder (DynASM, LLVM, etc) or an interpreted decoder. By default, +** it will always use the fastest available decoder. However, you can call +** set_allow_jit(false) to disable any JIT decoder that might be available. +** This is primarily useful for testing purposes. +*/ #ifndef UPB_DECODER_H_ #define UPB_DECODER_H_ diff --git a/upb/pb/decoder.int.h b/upb/pb/decoder.int.h index ba18771..2d4485a 100644 --- a/upb/pb/decoder.int.h +++ b/upb/pb/decoder.int.h @@ -1,11 +1,6 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009-2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Internal-only definitions for the decoder. - */ +** Internal-only definitions for the decoder. +*/ #ifndef UPB_DECODER_INT_H_ #define UPB_DECODER_INT_H_ diff --git a/upb/pb/encoder.c b/upb/pb/encoder.c index e704bbd..cf4df9e 100644 --- a/upb/pb/encoder.c +++ b/upb/pb/encoder.c @@ -1,61 +1,58 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2014 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Since we are implementing pure handlers (ie. without any out-of-band access - * to pre-computed lengths), we have to buffer all submessages before we can - * emit even their first byte. - * - * Not knowing the size of submessages also means we can't write a perfect - * zero-copy implementation, even with buffering. Lengths are stored as - * varints, which means that we don't know how many bytes to reserve for the - * length until we know what the length is. - * - * This leaves us with three main choices: - * - * 1. buffer all submessage data in a temporary buffer, then copy it exactly - * once into the output buffer. - * - * 2. attempt to buffer data directly into the output buffer, estimating how - * many bytes each length will take. When our guesses are wrong, use - * memmove() to grow or shrink the allotted space. - * - * 3. buffer directly into the output buffer, allocating a max length - * ahead-of-time for each submessage length. If we overallocated, we waste - * space, but no memcpy() or memmove() is required. This approach requires - * defining a maximum size for submessages and rejecting submessages that - * exceed that size. - * - * (2) and (3) have the potential to have better performance, but they are more - * complicated and subtle to implement: - * - * (3) requires making an arbitrary choice of the maximum message size; it - * wastes space when submessages are shorter than this and fails - * completely when they are longer. This makes it more finicky and - * requires configuration based on the input. It also makes it impossible - * to perfectly match the output of reference encoders that always use the - * optimal amount of space for each length. - * - * (2) requires guessing the the size upfront, and if multiple lengths are - * guessed wrong the minimum required number of memmove() operations may - * be complicated to compute correctly. Implemented properly, it may have - * a useful amortized or average cost, but more investigation is required - * to determine this and what the optimal algorithm is to achieve it. - * - * (1) makes you always pay for exactly one copy, but its implementation is - * the simplest and its performance is predictable. - * - * So for now, we implement (1) only. If we wish to optimize later, we should - * be able to do it without affecting users. - * - * The strategy is to buffer the segments of data that do *not* depend on - * unknown lengths in one buffer, and keep a separate buffer of segment pointers - * and lengths. When the top-level submessage ends, we can go beginning to end, - * alternating the writing of lengths with memcpy() of the rest of the data. - * At the top level though, no buffering is required. - */ +** upb::Encoder +** +** Since we are implementing pure handlers (ie. without any out-of-band access +** to pre-computed lengths), we have to buffer all submessages before we can +** emit even their first byte. +** +** Not knowing the size of submessages also means we can't write a perfect +** zero-copy implementation, even with buffering. Lengths are stored as +** varints, which means that we don't know how many bytes to reserve for the +** length until we know what the length is. +** +** This leaves us with three main choices: +** +** 1. buffer all submessage data in a temporary buffer, then copy it exactly +** once into the output buffer. +** +** 2. attempt to buffer data directly into the output buffer, estimating how +** many bytes each length will take. When our guesses are wrong, use +** memmove() to grow or shrink the allotted space. +** +** 3. buffer directly into the output buffer, allocating a max length +** ahead-of-time for each submessage length. If we overallocated, we waste +** space, but no memcpy() or memmove() is required. This approach requires +** defining a maximum size for submessages and rejecting submessages that +** exceed that size. +** +** (2) and (3) have the potential to have better performance, but they are more +** complicated and subtle to implement: +** +** (3) requires making an arbitrary choice of the maximum message size; it +** wastes space when submessages are shorter than this and fails +** completely when they are longer. This makes it more finicky and +** requires configuration based on the input. It also makes it impossible +** to perfectly match the output of reference encoders that always use the +** optimal amount of space for each length. +** +** (2) requires guessing the the size upfront, and if multiple lengths are +** guessed wrong the minimum required number of memmove() operations may +** be complicated to compute correctly. Implemented properly, it may have +** a useful amortized or average cost, but more investigation is required +** to determine this and what the optimal algorithm is to achieve it. +** +** (1) makes you always pay for exactly one copy, but its implementation is +** the simplest and its performance is predictable. +** +** So for now, we implement (1) only. If we wish to optimize later, we should +** be able to do it without affecting users. +** +** The strategy is to buffer the segments of data that do *not* depend on +** unknown lengths in one buffer, and keep a separate buffer of segment pointers +** and lengths. When the top-level submessage ends, we can go beginning to end, +** alternating the writing of lengths with memcpy() of the rest of the data. +** At the top level though, no buffering is required. +*/ #include "upb/pb/encoder.h" #include "upb/pb/varint.int.h" diff --git a/upb/pb/encoder.h b/upb/pb/encoder.h index cb5c79f..e8f7425 100644 --- a/upb/pb/encoder.h +++ b/upb/pb/encoder.h @@ -1,16 +1,13 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009-2010 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Implements a set of upb_handlers that write protobuf data to the binary wire - * format. - * - * This encoder implementation does not have any access to any out-of-band or - * precomputed lengths for submessages, so it must buffer submessages internally - * before it can emit the first byte. - */ +** upb::pb::Encoder (upb_pb_encoder) +** +** Implements a set of upb_handlers that write protobuf data to the binary wire +** format. +** +** This encoder implementation does not have any access to any out-of-band or +** precomputed lengths for submessages, so it must buffer submessages internally +** before it can emit the first byte. +*/ #ifndef UPB_ENCODER_H_ #define UPB_ENCODER_H_ diff --git a/upb/pb/glue.c b/upb/pb/glue.c index 76c8356..d6faeff 100644 --- a/upb/pb/glue.c +++ b/upb/pb/glue.c @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2010-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include "upb/pb/glue.h" diff --git a/upb/pb/glue.h b/upb/pb/glue.h index 5073968..f65753c 100644 --- a/upb/pb/glue.h +++ b/upb/pb/glue.h @@ -1,27 +1,22 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2011-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * upb's core components like upb_decoder and upb_msg are carefully designed to - * avoid depending on each other for maximum orthogonality. In other words, - * you can use a upb_decoder to decode into *any* kind of structure; upb_msg is - * just one such structure. A upb_msg can be serialized/deserialized into any - * format, protobuf binary format is just one such format. - * - * However, for convenience we provide functions here for doing common - * operations like deserializing protobuf binary format into a upb_msg. The - * compromise is that this file drags in almost all of upb as a dependency, - * which could be undesirable if you're trying to use a trimmed-down build of - * upb. - * - * While these routines are convenient, they do not reuse any encoding/decoding - * state. For example, if a decoder is JIT-based, it will be re-JITted every - * time these functions are called. For this reason, if you are parsing lots - * of data and efficiency is an issue, these may not be the best functions to - * use (though they are useful for prototyping, before optimizing). - */ +** upb's core components like upb_decoder and upb_msg are carefully designed to +** avoid depending on each other for maximum orthogonality. In other words, +** you can use a upb_decoder to decode into *any* kind of structure; upb_msg is +** just one such structure. A upb_msg can be serialized/deserialized into any +** format, protobuf binary format is just one such format. +** +** However, for convenience we provide functions here for doing common +** operations like deserializing protobuf binary format into a upb_msg. The +** compromise is that this file drags in almost all of upb as a dependency, +** which could be undesirable if you're trying to use a trimmed-down build of +** upb. +** +** While these routines are convenient, they do not reuse any encoding/decoding +** state. For example, if a decoder is JIT-based, it will be re-JITted every +** time these functions are called. For this reason, if you are parsing lots +** of data and efficiency is an issue, these may not be the best functions to +** use (though they are useful for prototyping, before optimizing). +*/ #ifndef UPB_GLUE_H #define UPB_GLUE_H diff --git a/upb/pb/textprinter.c b/upb/pb/textprinter.c index 4932468..3785d83 100644 --- a/upb/pb/textprinter.c +++ b/upb/pb/textprinter.c @@ -1,8 +1,5 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> + * upb::pb::TextPrinter * * OPT: This is not optimized at all. It uses printf() which parses the format * string every time, and it allocates memory for every put. diff --git a/upb/pb/textprinter.h b/upb/pb/textprinter.h index 4b0050f..b6ad9c5 100644 --- a/upb/pb/textprinter.h +++ b/upb/pb/textprinter.h @@ -1,9 +1,8 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ +** upb::pb::TextPrinter (upb_textprinter) +** +** Handlers for writing to protobuf text format. +*/ #ifndef UPB_TEXT_H_ #define UPB_TEXT_H_ diff --git a/upb/pb/varint.c b/upb/pb/varint.c index 04767eb..25cdd81 100644 --- a/upb/pb/varint.c +++ b/upb/pb/varint.c @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2011 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include "upb/pb/varint.int.h" diff --git a/upb/pb/varint.int.h b/upb/pb/varint.int.h index a394a75..735bcbe 100644 --- a/upb/pb/varint.int.h +++ b/upb/pb/varint.int.h @@ -1,12 +1,7 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2011 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * A number of routines for varint manipulation (we keep them all around to - * have multiple approaches available for benchmarking). - */ +** A number of routines for varint manipulation (we keep them all around to +** have multiple approaches available for benchmarking). +*/ #ifndef UPB_VARINT_DECODER_H_ #define UPB_VARINT_DECODER_H_ diff --git a/upb/refcounted.c b/upb/refcounted.c index 85b378c..c8162f0 100644 --- a/upb/refcounted.c +++ b/upb/refcounted.c @@ -1,22 +1,19 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Our key invariants are: - * 1. reference cycles never span groups - * 2. for ref2(to, from), we increment to's count iff group(from) != group(to) - * - * The previous two are how we avoid leaking cycles. Other important - * invariants are: - * 3. for mutable objects "from" and "to", if there exists a ref2(to, from) - * this implies group(from) == group(to). (In practice, what we implement - * is even stronger; "from" and "to" will share a group if there has *ever* - * been a ref2(to, from), but all that is necessary for correctness is the - * weaker one). - * 4. mutable and immutable objects are never in the same group. - */ +** upb::RefCounted Implementation +** +** Our key invariants are: +** 1. reference cycles never span groups +** 2. for ref2(to, from), we increment to's count iff group(from) != group(to) +** +** The previous two are how we avoid leaking cycles. Other important +** invariants are: +** 3. for mutable objects "from" and "to", if there exists a ref2(to, from) +** this implies group(from) == group(to). (In practice, what we implement +** is even stronger; "from" and "to" will share a group if there has *ever* +** been a ref2(to, from), but all that is necessary for correctness is the +** weaker one). +** 4. mutable and immutable objects are never in the same group. +*/ #include "upb/refcounted.h" diff --git a/upb/refcounted.h b/upb/refcounted.h index 4013906..aaa2f60 100644 --- a/upb/refcounted.h +++ b/upb/refcounted.h @@ -1,20 +1,17 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * A refcounting scheme that supports circular refs. It accomplishes this by - * partitioning the set of objects into groups such that no cycle spans groups; - * we can then reference-count the group as a whole and ignore refs within the - * group. When objects are mutable, these groups are computed very - * conservatively; we group any objects that have ever had a link between them. - * When objects are frozen, we compute strongly-connected components which - * allows us to be precise and only group objects that are actually cyclic. - * - * This is a mixed C/C++ interface that offers a full API to both languages. - * See the top-level README for more information. - */ +** upb::RefCounted (upb_refcounted) +** +** A refcounting scheme that supports circular refs. It accomplishes this by +** partitioning the set of objects into groups such that no cycle spans groups; +** we can then reference-count the group as a whole and ignore refs within the +** group. When objects are mutable, these groups are computed very +** conservatively; we group any objects that have ever had a link between them. +** When objects are frozen, we compute strongly-connected components which +** allows us to be precise and only group objects that are actually cyclic. +** +** This is a mixed C/C++ interface that offers a full API to both languages. +** See the top-level README for more information. +*/ #ifndef UPB_REFCOUNTED_H_ #define UPB_REFCOUNTED_H_ diff --git a/upb/shim/shim.c b/upb/shim/shim.c index 2f7f215..42bdb10 100644 --- a/upb/shim/shim.c +++ b/upb/shim/shim.c @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2013 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include "upb/shim/shim.h" diff --git a/upb/shim/shim.h b/upb/shim/shim.h index 0ccd6fb..935f085 100644 --- a/upb/shim/shim.h +++ b/upb/shim/shim.h @@ -1,19 +1,14 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2013 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * For handlers that do very tiny, very simple operations, the function call - * overhead of calling a handler can be significant. This file allows the - * user to define handlers that do something very simple like store the value - * to memory and/or set a hasbit. JIT compilers can then special-case these - * handlers and emit specialized code for them instead of actually calling the - * handler. - * - * The functionality is very simple/limited right now but may expand to be able - * to call another function. - */ +** For handlers that do very tiny, very simple operations, the function call +** overhead of calling a handler can be significant. This file allows the +** user to define handlers that do something very simple like store the value +** to memory and/or set a hasbit. JIT compilers can then special-case these +** handlers and emit specialized code for them instead of actually calling the +** handler. +** +** The functionality is very simple/limited right now but may expand to be able +** to call another function. +*/ #ifndef UPB_SHIM_H #define UPB_SHIM_H @@ -1,21 +1,19 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2010-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * A upb_sink is an object that binds a upb_handlers object to some runtime - * state. It is the object that can actually receive data via the upb_handlers - * interface. - * - * Unlike upb_def and upb_handlers, upb_sink is never frozen, immutable, or - * thread-safe. You can create as many of them as you want, but each one may - * only be used in a single thread at a time. - * - * If we compare with class-based OOP, a you can think of a upb_def as an - * abstract base class, a upb_handlers as a concrete derived class, and a - * upb_sink as an object (class instance). - */ +** upb::Sink (upb_sink) +** upb::BytesSink (upb_bytessink) +** +** A upb_sink is an object that binds a upb_handlers object to some runtime +** state. It is the object that can actually receive data via the upb_handlers +** interface. +** +** Unlike upb_def and upb_handlers, upb_sink is never frozen, immutable, or +** thread-safe. You can create as many of them as you want, but each one may +** only be used in a single thread at a time. +** +** If we compare with class-based OOP, a you can think of a upb_def as an +** abstract base class, a upb_handlers as a concrete derived class, and a +** upb_sink as an object (class instance). +*/ #ifndef UPB_SINK_H #define UPB_SINK_H diff --git a/upb/structdefs.int.h b/upb/structdefs.int.h index b3dcfa0..e650c32 100644 --- a/upb/structdefs.int.h +++ b/upb/structdefs.int.h @@ -1,23 +1,18 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2015 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * This file contains definitions of structs that should be considered private - * and NOT stable across versions of upb. - * - * The only reason they are declared here and not in .c files is to allow upb - * and the application (if desired) to embed statically-initialized instances - * of structures like defs. - * - * If you include this file, all guarantees of ABI compatibility go out the - * window! Any code that includes this file needs to recompile against the - * exact same version of upb that they are linking against. - * - * You also need to recompile if you change the value of the UPB_DEBUG_REFS - * flag. - */ +** This file contains definitions of structs that should be considered private +** and NOT stable across versions of upb. +** +** The only reason they are declared here and not in .c files is to allow upb +** and the application (if desired) to embed statically-initialized instances +** of structures like defs. +** +** If you include this file, all guarantees of ABI compatibility go out the +** window! Any code that includes this file needs to recompile against the +** exact same version of upb that they are linking against. +** +** You also need to recompile if you change the value of the UPB_DEBUG_REFS +** flag. +*/ #include "upb/def.h" diff --git a/upb/symtab.c b/upb/symtab.c index 0ce3e18..de936e4 100644 --- a/upb/symtab.c +++ b/upb/symtab.c @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2008-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include "upb/structdefs.int.h" #include "upb/symtab.h" diff --git a/upb/symtab.h b/upb/symtab.h index f9a0a95..ffe9f73 100644 --- a/upb/symtab.h +++ b/upb/symtab.h @@ -1,17 +1,14 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * A symtab (symbol table) stores a name->def map of upb_defs. Clients could - * always create such tables themselves, but upb_symtab has logic for resolving - * symbolic references, and in particular, for keeping a whole set of consistent - * defs when replacing some subset of those defs. This logic is nontrivial. - * - * This is a mixed C/C++ interface that offers a full API to both languages. - * See the top-level README for more information. - */ +** upb::SymbolTable (upb_symtab) +** +** A symtab (symbol table) stores a name->def map of upb_defs. Clients could +** always create such tables themselves, but upb_symtab has logic for resolving +** symbolic references, and in particular, for keeping a whole set of consistent +** defs when replacing some subset of those defs. This logic is nontrivial. +** +** This is a mixed C/C++ interface that offers a full API to both languages. +** See the top-level README for more information. +*/ #ifndef UPB_SYMTAB_H_ #define UPB_SYMTAB_H_ diff --git a/upb/table.c b/upb/table.c index 943290e..790a20b 100644 --- a/upb/table.c +++ b/upb/table.c @@ -1,11 +1,8 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * Implementation is heavily inspired by Lua's ltable.c. - */ +** upb_table Implementation +** +** Implementation is heavily inspired by Lua's ltable.c. +*/ #include "upb/table.int.h" diff --git a/upb/table.int.h b/upb/table.int.h index 28e2cff..4874e3c 100644 --- a/upb/table.int.h +++ b/upb/table.int.h @@ -1,24 +1,21 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * This header is INTERNAL-ONLY! Its interfaces are not public or stable! - * This file defines very fast int->upb_value (inttable) and string->upb_value - * (strtable) hash tables. - * - * The table uses chained scatter with Brent's variation (inspired by the Lua - * implementation of hash tables). The hash function for strings is Austin - * Appleby's "MurmurHash." - * - * The inttable uses uintptr_t as its key, which guarantees it can be used to - * store pointers or integers of at least 32 bits (upb isn't really useful on - * systems where sizeof(void*) < 4). - * - * The table must be homogenous (all values of the same type). In debug - * mode, we check this on insert and lookup. - */ +** upb_table +** +** This header is INTERNAL-ONLY! Its interfaces are not public or stable! +** This file defines very fast int->upb_value (inttable) and string->upb_value +** (strtable) hash tables. +** +** The table uses chained scatter with Brent's variation (inspired by the Lua +** implementation of hash tables). The hash function for strings is Austin +** Appleby's "MurmurHash." +** +** The inttable uses uintptr_t as its key, which guarantees it can be used to +** store pointers or integers of at least 32 bits (upb isn't really useful on +** systems where sizeof(void*) < 4). +** +** The table must be homogenous (all values of the same type). In debug +** mode, we check this on insert and lookup. +*/ #ifndef UPB_TABLE_H_ #define UPB_TABLE_H_ @@ -1,9 +1,3 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009-2012 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - */ #include <errno.h> #include <stdarg.h> @@ -1,14 +1,9 @@ /* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Google Inc. See LICENSE for details. - * Author: Josh Haberman <jhaberman@gmail.com> - * - * This file contains shared definitions that are widely used across upb. - * - * This is a mixed C/C++ interface that offers a full API to both languages. - * See the top-level README for more information. - */ +** This file contains shared definitions that are widely used across upb. +** +** This is a mixed C/C++ interface that offers a full API to both languages. +** See the top-level README for more information. +*/ #ifndef UPB_H_ #define UPB_H_ |