This patch fixes the ocaml generator to generate good code when the 'include' Thrift IDL directive is used.
Patch: Joel Raymont
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1084654 13f79535-47bb-0310-9956-ffa450edef68
This patch adds a triple-underscore prefix to all the ivars in TAsyncClient, making it substantially more difficult to get a conflict.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1081868 13f79535-47bb-0310-9956-ffa450edef68
This patch adds a -out switch that allows for an absolute path to be set for outputting generated code.
Patch: Jake Farrell
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1076000 13f79535-47bb-0310-9956-ffa450edef68
This patch introduces a handful of abstract, non-generated classes that allow us to generate much less code for service implementations.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1068487 13f79535-47bb-0310-9956-ffa450edef68
This patch causes Java Serialized Thrift structs to be serialized onto the stream via the Compact Protocol.
Patch: Mathias Herberts
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1063907 13f79535-47bb-0310-9956-ffa450edef68
valueOf saves us on memory for 'small' primitive types and costs us nothing in other situations, so it's an all-around win.
Patch: Takashi Yonebayashi
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1063818 13f79535-47bb-0310-9956-ffa450edef68
This patch resolves problems with double constants and adds a copy method to generated structs.
Patch: Richard Low
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1045320 13f79535-47bb-0310-9956-ffa450edef68
This patch removes the imports for Thrift library classes and fully qualifies all references, guaranteeing there won't be any name clashes.
Patch: Peter Schuller
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1043156 13f79535-47bb-0310-9956-ffa450edef68
Be a little more sensitive to how we parse out dots; some java generator changes to make sure things stay consistent.
THRIFT-1005. java: Give unions byte[] signature methods to go along with their ByteBuffer counterparts
Some new constructors, getters, and setters to ease migration of unions to ByteBuffer style.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1038399 13f79535-47bb-0310-9956-ffa450edef68
Make the PHP generator recognize a new-style namespace called "php.path".
If it is present, it is segmented and used as a path to include the
generated code. (It goes between "packages" and the Thrit file basename.)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005172 13f79535-47bb-0310-9956-ffa450edef68
Add some profiling code to track when potentially unnecessary virtual
calls are made in the thrift C++ serialization and deserialization code.
This can be used to help service implementors determine which places in
their code should be updated to use an appropriate thrift template
class.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005140 13f79535-47bb-0310-9956-ffa450edef68
Add the ability for Thrift servers to monitor client connections. It is
activated by #including server/TClientInfo.h and creating 1) a
TClientInfoCallHandler passed to the processor with setEventHandler()
and 2) a TClientInforServerHandler passed to the server with
setServerEventHandler().
The result vector, showing active connections, provides client address
and the thrift call it is executing (or last executed), the time
connected, and the number of calls made since connection.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005139 13f79535-47bb-0310-9956-ffa450edef68
When the "templates" option is passed to the C++ generator, it now emits
templatized versions of the client and processor. Generated types emit
templatized read() and write() functions.
This allows the generated code to invoke the correct non-virtual
TTransport and TProtocol implementations, resulting in faster
serialization and deserialization.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005138 13f79535-47bb-0310-9956-ffa450edef68
Add a virtual function "completed__(bool)" to xxxCobClient that is
called by recv_xxx() after reception of a response (arg = true) or an
exception (arg = false). This allows the TAsyncClient to intercede at
that point, permitting, e.g., the load-balancing of persistent
connections that would otherwise remain bound to a single server.
A new "no_client_completion" flag inhibits generation of this mechanism.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005131 13f79535-47bb-0310-9956-ffa450edef68
Changing the order of these calls makes more sense from the perspective
of logical operations. It also simplifies the upcoming stats collection
code. No clients should be affected.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005128 13f79535-47bb-0310-9956-ffa450edef68
There are three major parts of this:
1/ New callback-style interfaces for for a few key Thrift components:
TAsyncProcessor for servers and TAsyncChannel for clients.
2/ Concrete implementations of TAsyncChannel and a server for
TAsyncProcessor based on evhttp.
3/ Async-style code generation for C++
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005127 13f79535-47bb-0310-9956-ffa450edef68
- Add a TProcessorEventHandler callback interface.
- Add methods to TProcessor to hold an instance of the interface.
- Add code to the compiler to make the processor call callbacks at key points.
- Add an optional processor event handler to the test server.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005126 13f79535-47bb-0310-9956-ffa450edef68
Just requires calling get_true_type in the right spot. Because "the
right spot" is under src/parse, get_true_type had to be moed from
t_generator to t_type.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1004703 13f79535-47bb-0310-9956-ffa450edef68
Forcing all of the functions under src/parse to be defined in header
files is silly and sometimes painful. Createa a "parse.cc" file for
functions that don't belong in header files. To start, move
generate_fingerprint there, because it requires including md5.h.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1004702 13f79535-47bb-0310-9956-ffa450edef68
This patch removes unnecessary enum value resolution code from all the individual generators. It's been unnecessary since forever ago when we made the compiler force the global resolution of values.
Patch: Christian Lavoie
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1001966 13f79535-47bb-0310-9956-ffa450edef68
This patch fixes the type mappings to be more sane. It *will* break existing code, but the breakages should be well worth it.
Patch: Christian Lavoie
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@999700 13f79535-47bb-0310-9956-ffa450edef68
This patch makes the bindings compile with pedantic warning levels, and individually declares each required language extension.
Patch: Christian Lavoie
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@998955 13f79535-47bb-0310-9956-ffa450edef68
The recent enum change was causing enums to break if used as constant
values by the C++ generator. The problem was that we were searching for
the fully-qualified constant name (enum_name.VALUE_NAME) in the enum
values. This didn't affect Java because it just uses symbolic names in
the generated code. Fix it by grabbing the base name before doing the
search.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@996610 13f79535-47bb-0310-9956-ffa450edef68
The recent enum change was causing t_enum::get_constant_by_name to fail
in t_const_value::get_integer. This was causing a difficult-to-debug
segfault. Check for failure and throw an exeception.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@996609 13f79535-47bb-0310-9956-ffa450edef68
This patch causes the underlying ByteBuffer that backs a binary field to be hidden behind a default accessor that provides a byte[] interface. This should allow users who skipped 0.4 to update their generated code without breaking any of their other code. A new accessor has been added that allows a way down to the underlying ByteBuffer for those experts who want to take advantage.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@996579 13f79535-47bb-0310-9956-ffa450edef68
This patch makes it illegal to refer to enum values by just their names in the IDL. Now, you must also provide the enum type's name as well.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@996320 13f79535-47bb-0310-9956-ffa450edef68
Most of the other Thrift languages either have enum values that are
scoped to the type or emulate enums in that way. Now C++ does the same
by default. "enum Foo" in a .thrift file will be generated as Foo::type
so the values can be called Foo::value1, etc. The "pure_enums" compiler
option restores the old behavior.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@996015 13f79535-47bb-0310-9956-ffa450edef68
yywrap is only needed if we need one lexer context to traverse multiple
input files. This feature isn't used by Thrift, so we disable it with
"option noyywrap". With yywrap disabled, there is no need to link to
libfl if flex is the lex implementation used.
With this patch, release tarballs can be built without lex.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991254 13f79535-47bb-0310-9956-ffa450edef68
- Make AX_BOOST_BASE warn instead of fataling if Boost is not found.
- If Boost is not found, disable compilation of the C++ library.
- Do not use CPPFLAGS or LDFLAGS from Boost when building the compiler.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991253 13f79535-47bb-0310-9956-ffa450edef68
Previously, the Ruby generated used boost::tokenizer to produce a
vector of namespace components from a dot-delimited namespace string.
We can do this manually with only a slight increase in complexity.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991251 13f79535-47bb-0310-9956-ffa450edef68
My combined patch for THRIFT-599 was committed, but it is preferable
commit the individual patches to preserve the more detailed log and
blame data. I'll recommit r987018 as a sequence of patches and r988722
as its own rev.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@990957 13f79535-47bb-0310-9956-ffa450edef68
This patch adds a new method to t_generator that allows the compiler to avoid special cases in checking for sub-namespaces in the Thrift IDL.
Patch: Bruce Lowekamp
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@987565 13f79535-47bb-0310-9956-ffa450edef68
The only user-visible changes are to the client. Every thrift call now returns {NewClient, Result} instead of just Result.
Patch: David Reiss (assist to Anthony Molinaro)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@987018 13f79535-47bb-0310-9956-ffa450edef68
A patch to the OCaml generator which uses default values defined in the .thrift file to initialize the members of the generated class.
Patch: Lev Walkin
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@985041 13f79535-47bb-0310-9956-ffa450edef68
Add the "utf8strings" option to the Python generator. If set, all
Thrift strings (not binary) will be expected to be unicode objects, not
str. They will be encoded as UTF-8 before serialization and decoded as
UTF-8 after deserialization.
The accelerator module for TBinaryProtocol is not affected.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@959516 13f79535-47bb-0310-9956-ffa450edef68
This patch adds an implementation of a fully-asynchronous client that makes use of NIO. Stubs for the async method calls are generated along with the existing synchronous ones.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@948492 13f79535-47bb-0310-9956-ffa450edef68
This patch ditches the old print_version.sh method and instead generates the compiler's version.h via the Makefile.
Patch: Anthony Molinaro
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@940630 13f79535-47bb-0310-9956-ffa450edef68
This patch causes all generated Client classes to inherit from TServiceClient, an interface that provides a way to get the protocols the Client is using. Also, it causes a new TServiceClientFactory implementation to generated for each Service, which provides a generic, reflection-free way to get Clients. These changes make it easier to build generic pools of Client objects.
Patch: Mathias Herberts
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930601 13f79535-47bb-0310-9956-ffa450edef68
This patch causes the beans option to suppress the builder-style setter methods. It also adds a new 'private-members' option that leaves the builder-style methods, but makes the actual instance variables private.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930474 13f79535-47bb-0310-9956-ffa450edef68
Use a static {} block instead of an anonymous inner class to define metaDataMap. This saves some space in jars generated by avoiding the internal class.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@926466 13f79535-47bb-0310-9956-ffa450edef68
Previously, Thrift.cpp contained TApplicationException, which was using
TProtocol methods, defined in TProtocol.h. This caused a circular
dependency since libprotocol depends on Thrift.h. This change moves
TApplicationException into its own file.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920682 13f79535-47bb-0310-9956-ffa450edef68
Previously, we only used the acclerator module for clients to
write calls and read returns. Now PHP servers will use it for
writing returns. We cannot use it to read calls on the server side
(without modifications), because the module requires that
the structure type be known before reading the message header.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920663 13f79535-47bb-0310-9956-ffa450edef68
This is subtly different from a type annotation, since some bits of
metadata only make sense in the context of a single structure field,
like whether the field is required, or whether the C++ code should use
a pointer for it.
This change doesn't define any meaningful annotations. It just sets up
the parsing infrastructure.
I have no idea if $10 will work with older versions of yacc. It seems
to work fine with bison.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@919325 13f79535-47bb-0310-9956-ffa450edef68
This patch resolves the name clash issue by removing the unnecessary parameters from the generated method and using the protected variables directly instead.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@917130 13f79535-47bb-0310-9956-ffa450edef68
When a protocol error occurs, the server will now send back a message containing the exception. Clients should be able to detect and rethrow these exceptions as appropriate.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@916825 13f79535-47bb-0310-9956-ffa450edef68
This patch gets rid of an unnecessary map lookup and null check in generated structs' read method, amounting a noticeable performance improvement.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@899721 13f79535-47bb-0310-9956-ffa450edef68
This patch causes constants of all types to be resolved differently by the compiler, and makes it so that constants of enum types contain a reference to the enum type so that code generators can produce the correct names.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@892358 13f79535-47bb-0310-9956-ffa450edef68
This patch introduces new IDL syntax for creating Unions, explicityly single-valued structs. While the parser changes are portable, this patch only includes the actual generated code changes for the Java library. Other libraries can continue to generate a struct with the same fields and remain compatible until they are able to implement the full shebang.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@810300 13f79535-47bb-0310-9956-ffa450edef68
This patch makes the compiler act consistently regarding what it means to be required or optional. Additionally, it cleans up the tests to actually use the Fixtures class all over.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@806014 13f79535-47bb-0310-9956-ffa450edef68
As the summary suggests, this patch causes "optional" fields to be skipped if they are unset, even if they are primitives. As this patch is for the non-beans style generator, the user is expected to maintain the set/unset status themselves.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@793778 13f79535-47bb-0310-9956-ffa450edef68
This patch causes Java servers to log internal server errors and return an INTERNAL_ERROR exception instead of just closing the connection.
Author: Jonathan Ellis
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@785713 13f79535-47bb-0310-9956-ffa450edef68
2nd try at this issue. This time, we will use numeric field order ONLY for the serialization portion, instead of globally. This should make it much easier to produce the correctly ordered output in all cases.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@764072 13f79535-47bb-0310-9956-ffa450edef68
Simplify it a bit in the process, because the beans-style setters
are produced even in non-beans mode, and they handle isset internally.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@762956 13f79535-47bb-0310-9956-ffa450edef68
This monster of a patch moves all the classes into their own files and specs as appropriate. Additionally, it concentrates all the requires into thrift.rb, removing the need to require any other file. (Changes were made to the compiler to reflect this reduced requirement.)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@761849 13f79535-47bb-0310-9956-ffa450edef68
Pave the way for a new message type for oneway function calls.
For now, just define the constant in all languages and make
server implementations treat it the same way as a normal call.
Only C++ and Erlang currently check the message type (on the
server side).
There is a little bit of redundancy in the Erlang code, but
the alternative is a bit gross, and this split-up will be
necessary eventually when we start handling one-way calls
differently.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@761389 13f79535-47bb-0310-9956-ffa450edef68
r758558 introduced a but that caused some of the generated docstrings
to be indented incorrectly, resulting in syntactically invalid code.
This commit fixes the indentation.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@760118 13f79535-47bb-0310-9956-ffa450edef68
Docstrings are generated for
- enums (but not enum members)
- structures and structure fields
- service interfaces
- functions and function arguments
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758558 13f79535-47bb-0310-9956-ffa450edef68
This is the real change. The lexer now recognizes "oneway"
and warns on "async". All example and test IDLs have been
updated, as have the syntax files.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757994 13f79535-47bb-0310-9956-ffa450edef68
This is kind of a bummer because it requires a simultaneous
code regeneration and library upgrade, and possibly also a
server restart. I'm not sure if it is worth it, since the
only benefit is a little code clarity.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757993 13f79535-47bb-0310-9956-ffa450edef68
NOTE:
This will break wire-compatibility, but only with functions that have
both negative-id arguments and negative id-exceptions, and only in the
exceptional case.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755870 13f79535-47bb-0310-9956-ffa450edef68
This patch adds a new generated map of enum values to their respective names to each generated enum class, and then consumes that in the toString method to print the names when possible.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755464 13f79535-47bb-0310-9956-ffa450edef68
This patch causes validate to throw exceptions that contain the bad field value as well as the field name. I had to modify it slightly from the patch on the issue to conform with the new style isset checks.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755454 13f79535-47bb-0310-9956-ffa450edef68