Summary:
Merging a patch from Ben Maurer.
This adds a python extension (i.e., a C module) that
encodes Python thrift structs into the standard binary protocol
much faster than our generated Python code.
Also added by-value equality comparison to thrift structs
(to help with testing).
Cleaned up some trailing whitespace too.
Reviewed By: mcslee, dreiss
Test Plan:
Recompiled Thrift.
Thrifted a bunch of IDLs and compared the generated Python output.
Looked at the extension module a lot.
test/FastBinaryTest.py
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665224 13f79535-47bb-0310-9956-ffa450edef68
Summary:
We added a helper function for the generators: get_true_type,
which finds the actual type behind a series of typedefs
(though the compiler only supports one layer of typedefs now).
This change uses it everywhere we used to have that loop.
(It was a lot of places.)
Reviewed By: mcslee
Test Plan: test/ManyTypedefs.thrift
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665220 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Add a function to t_generator to traverse the typedef chain.
Reviewed By: mcslee
Test Plan:
Rebuilt thrift.
Re-thrifted ThriftTest.thrift.
Saw that the output was unchanged.
Revert Plan: ok
Notes:
Converting all of the generators to use this will happen later.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665203 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Merging a patch from Andy Lutomirsky.
- Allow fields to be marked "required" or "optional" (only affects C++).
- Thrift structs now have operator ==.
Reviewed By: mcslee
Test Plan: test/OptionalRequiredTest.cpp
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665202 13f79535-47bb-0310-9956-ffa450edef68
Summary:
It was a bad idea to let doxygen comments become a part of the parse tree.
We now get them a totally different way. The lexer stashes the docsting
contents in a global, and the parser actions (not the rules) pull it out.
This should prevent doxygen comments from ever causing parse errors.
Blame Rev: 52678, 52732
Reviewed By: mcslee
Test Plan:
Recompiled thrift.
Thrifted a bunch of files and saw no parse errors (or C++ compile errors).
Thrifted DocTest.thrift with dump_docs on.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665201 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Allow constants to be documented.
Now any "Definition" can be documented, so we can move the docstring stuff
up to a a higher node in the parse tree.
Reviewed By: mcslee
Test Plan:
Recompiled thrift.
Checked out DocTest.thrift and a few other thrifts.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665200 13f79535-47bb-0310-9956-ffa450edef68
Summary: Because we're all about strict aliasing rules in the g++, m'holmbie.
Reviewed By: aditya
Test Plan: Should be NO compiler warnings about (enum&) -> (int32_t&) typecasting
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665196 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Make enum constants as structure defaults work.
Make enum constants as constant map keys work.
Un-break the generated skeleton servers.
Reviewed By: mcslee
Test Plan:
cd test
../compiler/cpp/thrift -cpp ConstantsDemo.thrift
g++ -I../lib/cpp/src -c gen-cpp/*.cpp
Also compared the generated output to the old generated output.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665193 13f79535-47bb-0310-9956-ffa450edef68
Summary:
* custom, extensible error logger -- show only relevant stuff
* clean up of errors in developer-supplied handler module
now gives sane error messages and doesn't crash whole server
(introduces tApplicationException_HANDLER_ERROR)
* more precise catch in tErlProcessor (exits gracefully only if
transport closes)
Reviewed By: iproctor
Test Plan: tutorial works
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665186 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Allow docstrings at the top of the program.
Blame Rev: 52687
Reviewed By: mcslee
Test Plan:
../compiler/cpp/thrift -cpp DocTest.thrift
(with dump_docs on)
and looked at the output.
Generated C++ is identical to installed thrift.
Revert Plan: Do 52687 also.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665183 13f79535-47bb-0310-9956-ffa450edef68
Summary:
The old docstring syntax collided with the syntax for list constants.
The new syntax looks a lot like doxygent comments.
Trac Bug: #4664
Blame Rev: 32392
Reviewed By: mcslee
Test Plan:
../compiler/cpp/thrift -cpp DocTest.thrift
(with dump_docs on)
and looked at the output.
Generated C++ is identical to installed thrift.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665182 13f79535-47bb-0310-9956-ffa450edef68
Summary: So for example, you can make a constant map of enum values to string identifiers.
Reviewed By: dreiss
Test Plan: ConstantsDemo.thrift in the test folder
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665181 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Catch an exception that was being thrown,
and print out the error message.
Trac Bug: #
Blame Rev:
Reviewed By: mcslee
Test Plan:
Recompiled Thrift.
Ran it on a broken .thrift that throws one of these exceptions.
Revert Plan: ok
Notes:
EImportant:
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665177 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Replaced a lot of tabs with spaces in the thrift codebase.
Removed a lot of trailing whitespace from thrift-generated c++.
Added a few things to cleanup.sh.
Trac Bug: #
Blame Rev:
Reviewed By: mcslee
Test Plan:
Recompiled thrift.
Re-thrifted some test .thrifts.
Compiled the genrated c++.
Ran cleanup.sh.
Revert Plan: ok
Notes:
EImportant:
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665176 13f79535-47bb-0310-9956-ffa450edef68
Summary: It's thrift for haskell. The codegen is complete. The library has binary protocol, io channel transport, and a threaded server.
Reviewed by: mcslee
Test plan: Yes
Revert plan: yes
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665174 13f79535-47bb-0310-9956-ffa450edef68
Summary: Generated ruby code did not give exception struct fields a class. This broke the result structs for all functions that threw exceptions.
Reviewed by: mcslee
Test plan: Yes
Revert plan: yes
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665173 13f79535-47bb-0310-9956-ffa450edef68
Summary: stop generating files/modules in titlecase
Notes: somehow we access service_name_ before the constructor downcases it ... burnsauce
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665170 13f79535-47bb-0310-9956-ffa450edef68
Summary:
* const/enum namespacing
* better formatting, less debugging comments in both source and gen-erl/
Notes:
* in preparation for iproctor's whiz-bang map/list/set support
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665169 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Someone forgot an indent after a newline. Added.
Trac Bug: #
Blame Rev:
Reviewed By: mcslee
Test Plan:
Compiled the compiler, compiled a .thrift, and compared the output
with diff -u and diff -w -u.
Revert Plan: svn revert
Notes:
EImportant:
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665165 13f79535-47bb-0310-9956-ffa450edef68
Summary:
* shim to use object-oriented code as gen_servers
* high(er) performance Erlang-style server and transport
* sane packaging based on otp-base, i.e. Makefiles and real structure
Test Plan: tutorial server offers the same (subset of) functionality as previous version
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665164 13f79535-47bb-0310-9956-ffa450edef68
Summary: Added (minimal) library and code generator for OCaml.
Reviewed by: mcslee
Test plan: Test client and server (included).
Revert plan: yes
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665163 13f79535-47bb-0310-9956-ffa450edef68
Summary: Submitted by Kevin Clark, Ruby guru from Powerset
Reviewed By: mcslee
Test Plan: He updated the tests in trunk/test/rb/
Notes: The code is now officially "ruby-ish" and idiomatic
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665151 13f79535-47bb-0310-9956-ffa450edef68
Summary:
* missing {list,map,set}s, inheritance is spotty
* loose source code, plus everything is one process (application / gen_server behavior is forthcoming)
* codegen is a mess, need t_fp_generator
Test Plan:
* codegen invoked without -erl generates identical code for test/
* calculatorHandler plus 'thrift -erl -r tutorial.thrift' more or less works
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665146 13f79535-47bb-0310-9956-ffa450edef68
Summary: Identical to string in all languages except Java. Java String is NOT binary-safe, so we need to use raw byte[] in that case. PHP/RUBY/Python strings are all binary safe, and C++ std::string works fine and manages memory for you so it's the safest route. Java just needs this tweak.
Reviewed By: aditya
Test Plan: Use "binary" as a type instead of String.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665099 13f79535-47bb-0310-9956-ffa450edef68
Summary:
The php recv functions for method invocations didn't pass a proper input object into the handler for reading an application exception. This caused graceful thrift failures to not work gracefully in PHP.
Reviewed By: Slee
Test Plan: Tested by invoking from a thrift client a function not defined on a thrift server. Should response with Invalid method name
Revert Plan: revertible
Notes:
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665061 13f79535-47bb-0310-9956-ffa450edef68
see DocTest.thrift for examples.
todo: integrate parsed documentation into code generation
review: marc k, mcslee
test plan: DocTest.thrift
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664970 13f79535-47bb-0310-9956-ffa450edef68
The minOccurs and maxOccurs attributes should appear on the elements, rather than the containers.
for a thrift struct, we produce:
<sequence>
<element name="some_element"> <!-- max is implicitly 1 -->
<element name="some_optional_element" minOccurs="0"> <!-- max is
implicitly 1 -->
...
for a thrift list, we produce
<sequence>
<element name="the_list_element" minOccurs="0" maxOccurs="unbounded">
</sequence>
for a thrift struct tagged with xsd_all, we produce
<all>
<element name="some_element" minOccurs="0"/> <!-- max is implicitly 1
-->
</all>
Reviewed By: mcslee
Test Plan: sandbox
Revert Plan: revertible
Notes:
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664962 13f79535-47bb-0310-9956-ffa450edef68
Summary: Or else you are bound to get shitty errors in some generated languages.. They're not all covered here, but a lot of them are.
Reviewed By: dougb, bobby
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664907 13f79535-47bb-0310-9956-ffa450edef68
Summary: Sometimes you just want a subclass that only implements one method... annoying to fill in nulls for the others, so use the generated null class
Reviewed By: tbr-aditya
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664888 13f79535-47bb-0310-9956-ffa450edef68
Summary: Cause it's just too much work to put in quotes sometimes. struct thing = { a : 325, bb : 5632} OBVIOUSLY a and bb are strings. Duh.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664882 13f79535-47bb-0310-9956-ffa450edef68
Summary: Hot! Now you can defined your maps to strings and other constnats things in your .thrift file, so you can have the same symbols and useful defaults defined in your client as in your server.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664881 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Add support for include path specification in thrift. Using a -I <dir> option you can build a list of search paths to resolve thrift includes.
Reviewed By: mcslee
Revert Plan: revertible
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664868 13f79535-47bb-0310-9956-ffa450edef68
Summary: If you want your map to be a hash_map instead of an stl::map, we now have a directive in Thrift to let you do that.
Instead of:
map<i32,i32>
You can do:
map[cpp:hash_map<int32_t,int32_t>]<i32,i32>
This tells the Thrift compiler to explicitly use whatever type was specified in the brackets when generating C++ code, instead of the implied Thrift type.
Reviewed By: aditya
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664828 13f79535-47bb-0310-9956-ffa450edef68
Summary: Just for completeness cause I'm crazy. Let's never use these!
Notes: Also made thrift grammar support # style comments, so you can do this at the top of your files
#!/usr/local/bin/thrift --cpp
/**
* This is a thrift def file youc an invoke directly and gen code!
*/
blah
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664789 13f79535-47bb-0310-9956-ffa450edef68
Summary:
-- these are hook points that thrift_logger/logfile will integrate with..
Reviewed By: McSlee
Test Plan: Generated thrift code
Notes:
-- Thrift logfiles are soon coming to a netapp near you!
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664787 13f79535-47bb-0310-9956-ffa450edef68
Summary: Yep, it's up and running. We now have full client/server support in all of C++ Java PHP and Python. Well, not quite... there's no PHP server, but honestly who wants one? Actually, if we do want one the framework will support writing is as a PHP file that can be served in apache like a web service (i.e. restserver.php would be thriftserver.php). But now that's rambling and nothing to do with this commit.
Notes: cheever, let's chat about porting your multithreaded Pillar Python server over to Thrift
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664783 13f79535-47bb-0310-9956-ffa450edef68
Summary: Generate classes instead of structs, and put read/write methods inside the class definition. Separate services into uniquely generated files. Separate types header file from types implementation file (read/write methods)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664777 13f79535-47bb-0310-9956-ffa450edef68
Summary: Complete PHP generator and CPP generator to new formats, and offer PHP generator that generates inline code free of any TProtocol abstraction
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664771 13f79535-47bb-0310-9956-ffa450edef68