Commit Graph

191 Commits

Author SHA1 Message Date
David Reiss
c6fc329a40 Thrift: Support for explicit Python module declaration.
Summary:
Previously, Thrift used the name of the .thrift file as the python module name.
This wasn't very flexible.  Now the python module can be explicitly declared.
Also, there was no need for t_py_generator to inherit from t_oop_generator.

Reviewed By: mcslee

Test Plan:
cd test/py/explicit_module
./runtest.sh

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665234 13f79535-47bb-0310-9956-ffa450edef68
2007-08-30 00:58:43 +00:00
Mark Slee
6868eae42a Autoconf fixes
Summary: Need these after some recent changes to rebuild with Engeleman's fix

Reviewed By: aditya

Test Plan: Build compiler


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665232 13f79535-47bb-0310-9956-ffa450edef68
2007-08-29 04:36:53 +00:00
Mark Slee
a0f8bdca95 Merge patch from Dan Engeleman for Java utility constructors
Summary: As well as a packaging fix

Reviewed By: aditya

Test Plan: Generate test files, look at Java obj constructors


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665231 13f79535-47bb-0310-9956-ffa450edef68
2007-08-29 04:36:28 +00:00
David Reiss
1746e30c91 Thrift: Fix a compile error.
Summary:
The fingerprint code was generating invalid C++ code.

Blame Rev: 57192

Reviewed By: mcslee

Test Plan:
Recompiled thrift.
Thrifted DebugProtoTest with new compiler.
Compiled and rand DebugProtoTest.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665229 13f79535-47bb-0310-9956-ffa450edef68
2007-08-28 22:18:22 +00:00
David Reiss
dd7796fd8b Thrift: Fix untriggerable bug.
Reviewed By: mcslee

Test Plan: Compiled the Thrift compiler.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665228 13f79535-47bb-0310-9956-ffa450edef68
2007-08-28 21:09:06 +00:00
David Reiss
18bf22d5ba Thrift: Generate structural fingerprints for thrift structs.
Summary:
We are going to write a dense protocol soon that eliminates some metadata.
To prevent version conflicts, we want each structure to have a
structural fingerprint that will change whenever the struct changes
in a way that will affect the dense protocol.
This change computes those fingerprints and puts them in
the generated C++ code.

Reviewed By: aditya, mcslee

Test Plan:
Recompiled thrift.
Thrifted DebugProtoTest with old and new compilers.
Compared output.
Also ran thrift with those "cout"s uncommented,
examined the fingerprint material,
and verified the hashes.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665227 13f79535-47bb-0310-9956-ffa450edef68
2007-08-28 20:49:17 +00:00
David Reiss
2375312fa0 Thrift: Limited Reflection for C++.
Summary:
The Thrift compiler now generates static methods for every service to generate
a reflection of the methods provided by the service.  This reflection is fairly
limited, but should be enough for what we want to do with SMC.

Reviewed By: mcslee

Test Plan: test/ReflectionTest.cpp

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665226 13f79535-47bb-0310-9956-ffa450edef68
2007-08-27 19:57:34 +00:00
David Reiss
382fc3043c Thrift: Native-code Binary Protocol encoder.
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
2007-08-25 18:01:30 +00:00
Mark Slee
cf3c124f29 Trivial automake fix
Summary: Apparently needed to fix some install stuff

Reviewed By: mcslee

Test Plan: Build thrift compiler


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665221 13f79535-47bb-0310-9956-ffa450edef68
2007-08-23 23:19:56 +00:00
David Reiss
e087a30585 Thrift: Make use of get_true_type.
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
2007-08-23 21:43:25 +00:00
Mark Slee
27ed6ec1f9 Merging Jake Luciani's latest perl code gen fixes
Reviewed By: dreiss

Test Plan: Watch for any weirdness on Thrift code gen, perl specific


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665206 13f79535-47bb-0310-9956-ffa450edef68
2007-08-16 01:26:31 +00:00
Mark Slee
1b65b724eb Generate a -u option for Python Service-remote CLI utility
Summary: In case you want to hit an HTTP Thrift service

Reviewed By: peter

Test Plan: ServiceClient-remote -u http://dope.vip.facebook.com/intern/smc/smcserver.php getTierByName test


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665205 13f79535-47bb-0310-9956-ffa450edef68
2007-08-16 00:27:21 +00:00
David Reiss
3429b6a9a0 Thrift: Add a useful helper function (in compiler).
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
2007-08-15 00:55:41 +00:00
David Reiss
8320a92d9b Thrift: Merging external patch.
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
2007-08-14 19:59:26 +00:00
David Reiss
cbd4bacc30 Thrift: docstring revamp step 2.
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
2007-08-14 17:12:33 +00:00
David Reiss
cdffe260f1 Thrift: docstring revamp step 1.
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
2007-08-14 17:12:31 +00:00
Mark Slee
7e2cda1316 Fix C++ enum deserialization
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
2007-08-09 03:39:18 +00:00
David Reiss
202111d2e9 Thrift: More constant enums.
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
2007-08-06 20:38:18 +00:00
Christopher Piro
5b3a8f7a8b [thrift] improved error logging and handling for Erlang bindings
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
2007-08-01 22:27:37 +00:00
David Reiss
c2532a9ac4 Thrift: Allow whole program doctext.
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
2007-07-30 23:46:11 +00:00
David Reiss
1ac0580378 Thrift: Change docstring syntax.
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
2007-07-30 22:00:27 +00:00
Mark Slee
d0767c5796 Fix Thrift compiler to support reuse of enums and constants in later constants
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
2007-07-27 22:14:41 +00:00
David Reiss
877237abcf Thrift: Catch what you throw.
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
2007-07-27 00:40:19 +00:00
David Reiss
96d2388ade Thrift: Cleaned up whitespace.
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
2007-07-26 21:10:32 +00:00
Christopher Piro
5f5fdf3a20 [thrift] maps, lists, sets, and service inheritance for Erlang
Reviewed by: cpiro

Test Plan: tested wit tutorial/tutorial.thrift

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665175 13f79535-47bb-0310-9956-ffa450edef68
2007-07-25 22:41:00 +00:00
iproctor
ff8eb9288d Thrift: Haskell library and codegen
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
2007-07-25 19:06:13 +00:00
iproctor
5ced286cec Thrift: Ruby cogeden not creating exception fields properly.
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
2007-07-25 18:50:50 +00:00
Christopher Piro
873726035a [thrift] stupid case bug in Erlang codegen
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
2007-07-24 06:20:47 +00:00
Christopher Piro
ae1f10f8f2 [thrift] misc. Erlang codegen improvements, cleanups
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
2007-07-24 04:30:15 +00:00
David Reiss
8639e1056d Thrift: add an indent to generated cpp files.
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
2007-07-21 00:23:32 +00:00
Christopher Piro
094823a46c [thrift] highly concurrent Erlang goodness
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
2007-07-18 00:26:12 +00:00
iproctor
9a41a0c51e Thrift: OCaml library and generator
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
2007-07-16 21:59:24 +00:00
Mark Slee
b1ad0141d4 Add typecasting to REST parameters in generated Thrift PHP code
Trac Bug: #4360

Reviewed By: ari

Test Plan: Honky tonk, view the new generated api_10/x packages


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665161 13f79535-47bb-0310-9956-ffa450edef68
2007-07-10 16:48:37 +00:00
Mark Slee
58dfb4fbe8 Lots of Ruby code generation improvements
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
2007-07-06 02:45:25 +00:00
Mark Slee
756b1d1b07 Make -rest an optional param to the Thrift PHP compiler
Summary: You rarely need the generated REST stuff

Reviewed By: jwang

Test Plan: Gen falcon code without REST part


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665150 13f79535-47bb-0310-9956-ffa450edef68
2007-07-06 00:30:21 +00:00
Christopher Piro
2f5afceeaa [thrift] preliminary Erlang support (initial import)
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
2007-06-29 07:17:33 +00:00
eletuchy
447d7d2365 [thrift] small fixes to java generator
Summary: - size generated collections correctly
         - StringBuilder vs StringBuffer

Reviewed By: mcslee

Test Plan: built TestThrift.thrift; it compiled, yay

Revert Plan: sure

Notes:

EImportant:


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665134 13f79535-47bb-0310-9956-ffa450edef68
2007-06-13 04:24:11 +00:00
Mark Slee
e9ce01cf40 Apply thrift license to all files in compiler
Summary: Forgot to do this last time around, only got the libs

Reviewed By: no code in here, just comments


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665113 13f79535-47bb-0310-9956-ffa450edef68
2007-05-16 02:29:53 +00:00
Mark Slee
2c44d2047e Perl generator for Thrift compiler
Summary: Submitted by Jake Luciani

Reviewed By: mcslee

Test Plan: Who likes perl? Not me. Test files to be checked in soon.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665111 13f79535-47bb-0310-9956-ffa450edef68
2007-05-16 02:18:07 +00:00
Mark Slee
e9a1edc75d Make sure isset fields of java generated objects is public
Reviewed By: rob mccool from yahoo


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665103 13f79535-47bb-0310-9956-ffa450edef68
2007-05-03 01:30:18 +00:00
peter
67bfaf2782 fixing a typo
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665102 13f79535-47bb-0310-9956-ffa450edef68
2007-05-01 04:03:22 +00:00
Mark Slee
8d725a2738 Add explicit binary type to Thrift
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
2007-04-13 01:57:12 +00:00
Mark Slee
b86c4b251e Yeeeeeeeeahhh
Summary: Missing that $ in the vairable

Reviewed By: php

Test Plan: you need that!


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665092 13f79535-47bb-0310-9956-ffa450edef68
2007-04-10 06:44:53 +00:00
Mark Slee
ec3f32009b In php generate array of enum values to string names
Summary: for peter k

Reviewed By: peter


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665091 13f79535-47bb-0310-9956-ffa450edef68
2007-04-10 06:15:25 +00:00
Martin Kraemer
a7d6c3c142 Thrift: fix error with handling TApplicationException
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
2007-03-16 02:03:32 +00:00
Mark Slee
6632e0b041 Constants lowercase in java true/false
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665060 13f79535-47bb-0310-9956-ffa450edef68
2007-03-14 09:08:38 +00:00
Mark Slee
8109757e6c Generate toString() convenience method for Thrift java structs
Reviewed By: biren


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665059 13f79535-47bb-0310-9956-ffa450edef68
2007-03-14 03:07:00 +00:00
Mark Slee
7679196f1c Various Thrift fixes, including Application Exception support in Ruby, better errror messages across languages, etc.
Reviewed By: thrift


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665058 13f79535-47bb-0310-9956-ffa450edef68
2007-03-14 02:47:35 +00:00
Mark Slee
227ac2c50e Ruby code gen fixes and some README improvements
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665053 13f79535-47bb-0310-9956-ffa450edef68
2007-03-07 05:46:50 +00:00
Mark Slee
3303f36081 Thrift CPP threading fixes
Reviewed By: karl


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665045 13f79535-47bb-0310-9956-ffa450edef68
2007-03-05 20:09:37 +00:00