Commit Graph

491 Commits

Author SHA1 Message Date
David Reiss
fdc21aa713 Allow the Thrift compiler to be built without the Perl generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-perl
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665623 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:42:34 +00:00
David Reiss
fb63533c78 Remove t_perl_generator.h.
t_perl_generator.h is no longer included anywhere, because
the Perl generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665622 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:42:30 +00:00
David Reiss
2b386c50d7 Make the Perl generator dynamic.
- Modify the Perl generator constructor to fit the new generic interface.
- Register the Perl genrator with the central registry.
- Deprecate the old way of invoking the Perl generator.
- main.cc no longer includes t_pl_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665621 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:42:23 +00:00
David Reiss
6a4b82c4b7 Make the Ruby generator use non-hardcoded namespaces.
- Make the Ruby generator use program->get_namespace("ruby")
  instead of program->get_ruby_namespace()
- Eliminate the explicit "ruby_namespace" in t_program.
- Deprecate the ruby_namespace token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665620 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:42:16 +00:00
David Reiss
ae253583e7 Allow the Thrift compiler to be built without the Ruby generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-ruby
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665619 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:42:11 +00:00
David Reiss
6e93b454ec Remove t_rb_generator.h.
t_rb_generator.h is no longer included anywhere, because
the Ruby generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665618 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:42:06 +00:00
David Reiss
a640cea9ae Make the Ruby generator dynamic.
- Modify the Ruby generator constructor to fit the new generic interface.
- Register the Ruby genrator with the central registry.
- Deprecate the old way of invoking the Ruby generator.
- main.cc no longer includes t_rb_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665617 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:42:01 +00:00
David Reiss
c53b184c12 Remove an unused helper function in the Ruby generator.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665616 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:58 +00:00
David Reiss
320e45ce8b Make the Python generator use non-hardcoded namespaces.
- Make the Python generator use program->get_namespace("py")
  instead of program->get_py_module()
- Eliminate the explicit "py_module" in t_program.
- Deprecate the py_module token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665615 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:54 +00:00
David Reiss
bfd26dcecc Allow the Thrift compiler to be built without the Python generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-py
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665614 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:49 +00:00
David Reiss
0d6eb969e1 Remove t_py_generator.h.
t_py_generator.h is no longer included anywhere, because
the Python generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665613 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:45 +00:00
David Reiss
558e3993e1 Make the Python generator dynamic.
- Modify the Python generator constructor to fit the new generic interface.
- Register the Python genrator with the central registry.
- Deprecate the old way of invoking the Python generator.
- main.cc no longer includes t_py_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665612 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:40 +00:00
David Reiss
9d65bf061f Make the C# generator use non-hardcoded namespaces.
- Make the C# generator use program->get_namespace("csharp")
  instead of program->get_csharp_namespace()
- Eliminate the explicit "csharp_namespace" in t_program.
- Deprecate the csharp_namespace token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665611 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:37 +00:00
David Reiss
ce4f4f0cbd Allow the Thrift compiler to be built without the C# generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-csharp
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665610 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:31 +00:00
David Reiss
2dfdb2d7f7 Remove t_csharp_generator.h.
t_csharp_generator.h is no longer included anywhere, because
the C# generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.

Also cleaned up its includes a little bit.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665609 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:27 +00:00
David Reiss
861869b734 Make the C# generator dynamic.
- Modify the C# generator constructor to fit the new generic interface.
- Register the C# genrator with the central registry.
- Deprecate the old way of invoking the C# generator.
- main.cc no longer includes t_csharp_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665608 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:23 +00:00
David Reiss
919ae80934 Fix a stale debug message.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665607 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:11 +00:00
David Reiss
54b602b746 Make the Cocoa generator use non-hardcoded namespaces.
- Make the Cocoa generator use program->get_namespace("cocoa")
  instead of program->get_cocoa_prefix()
- Eliminate the explicit "cocoa_prefix" in t_program.
- Deprecate the cocoa_prefix token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665606 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:06 +00:00
David Reiss
4b349aabc9 Allow the Thrift compiler to be built without the Cocoa generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-cocoa
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665605 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:41:02 +00:00
David Reiss
e21ce4c6ca Remove t_cocoa_generator.h.
t_cocoa_generator.h is no longer included anywhere, because
the Cocoa generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665604 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:59 +00:00
David Reiss
d01c64dec5 Make the Cocoa generator dynamic.
- Modify the Cocoa generator constructor to fit the new generic interface.
- Register the Cocoa genrator with the central registry.
- Deprecate the old way of invoking the Cocoa generator.
- main.cc no longer includes t_cocoa_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665603 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:55 +00:00
David Reiss
be9757568f Put a newline at the end of the generated header file in the Cocoa generator.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665602 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:52 +00:00
David Reiss
3b45501b52 Make the Smalltalk generator use non-hardcoded namespaces.
- Make the Smalltalk generator use program->get_namespace("smalltalk.*")
  instead of program->get_smalltalk_{category|prefix}()
- Eliminate the explicit "smalltalk_{category|prefix}" in t_program.
- Deprecate the smalltalk_{category|prefix} tokens.
- Update example .thrift files and syntax files.

This was a little more complex than the others.  We now convert "." to "-"
in Smalltalk categories, because we no longer lex them as tok_st_identifier.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665601 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:46 +00:00
David Reiss
b3ac8a6c72 Allow the Thrift compiler to be built without the Smalltalk generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-st
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665600 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:42 +00:00
David Reiss
2b6ba090dc Remove t_st_generator.h.
t_st_generator.h is no longer included anywhere, because
the Smalltalk generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665599 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:38 +00:00
David Reiss
a890b5714e Make the Smalltalk generator dynamic.
- Modify the Smalltalk generator constructor to fit the new generic interface.
- Register the Smalltalk genrator with the central registry.
- Deprecate the old way of invoking the Smalltalk generator.
- main.cc no longer includes t_st_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665598 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:35 +00:00
David Reiss
73dc1431d1 Make the Smalltalk generator respect the "-o" flag.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665597 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:30 +00:00
David Reiss
22812f8be8 Allow the Thrift compiler to be built without the Haskell generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-hs
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665596 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:26 +00:00
David Reiss
42e6d51437 Remove t_hs_generator.h.
t_hs_generator.h is no longer included anywhere, because
the Haskell generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665595 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:20 +00:00
David Reiss
af3ab2619d Make the Haskell generator dynamic.
- Modify the Haskell generator constructor to fit the new generic interface.
- Register the Haskell genrator with the central registry.
- Deprecate the old way of invoking the Haskell generator.
- main.cc no longer includes t_hs_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665594 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:16 +00:00
David Reiss
3d671b5e53 Allow the Thrift compiler to be built without the OCaml generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-ocaml
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665593 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:11 +00:00
David Reiss
7bb71df6ef Remove t_ocaml_generator.h.
t_ocaml_generator.h is no longer included anywhere, because
the Ocaml generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665592 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:08 +00:00
David Reiss
f0521b1305 Make the OCaml generator dynamic.
- Modify the OCaml generator constructor to fit the new generic interface.
- Register the OCaml genrator with the central registry.
- Deprecate the old way of invoking the OCaml generator.
- main.cc no longer includes t_ocaml_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665591 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:05 +00:00
David Reiss
b4d7b89efd Make generate_program virtual.
Haskell and OCaml need to override this to put typedefs at the end.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665590 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:40:01 +00:00
David Reiss
237171ee81 Whitespace-only change for consistency.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665589 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:39:58 +00:00
David Reiss
f10984b589 Include <cassert> in main.cc.
We are doing an assert in main, but the assert header is being pulled in
by an include that is about to go.  Make it explicit.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665587 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:39:52 +00:00
David Reiss
c934268249 Delete code generators after using them.
This has been leaking memory in the compiler, but it has also been
preventing the dynamic generators destructors from being called.
This can prevent a stream from being flushed properly.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665586 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:39:49 +00:00
David Reiss
4b83d6ddeb Allow nested namespaces to be used in perl.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665584 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 19:45:19 +00:00
David Reiss
0c703cc2f8 Fix some small bugs in the Perl generator.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665582 13f79535-47bb-0310-9956-ffa450edef68
2008-03-25 18:38:56 +00:00
David Reiss
62f0d5428d Remove an unnecessary "else" from the generated Thrift code.
The "if" block here always results in a return (or an exception),
so there is no need for an "else".  We can just put the rest of the code
under the "if" block.  This actually makes a little more sense because
the "if" block here is an exceptional case.

Also deleted a stale comment.

Reviewed By: lhastings

Test Plan: diff'ed the old and new code.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665580 13f79535-47bb-0310-9956-ffa450edef68
2008-03-21 21:50:41 +00:00
Mark Slee
dcdf25b003 Fix compiler __construct gen in php
Reviewed By: dreiss

Test Plan: Build payments


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665578 13f79535-47bb-0310-9956-ffa450edef68
2008-03-19 20:16:35 +00:00
David Reiss
968bed847e Initialize the binary_ field of t_base_type.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665574 13f79535-47bb-0310-9956-ffa450edef68
2008-03-18 18:22:26 +00:00
David Reiss
cdfbeb8d75 Public access to the protocols in C# Thrift clients.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665573 13f79535-47bb-0310-9956-ffa450edef68
2008-03-18 18:22:14 +00:00
David Reiss
b79acc9f60 Some optimizations to the C# generated code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665572 13f79535-47bb-0310-9956-ffa450edef68
2008-03-18 18:21:58 +00:00
David Reiss
6d94390375 Don't allow async (no return) functions that throw exceptions.
This wouldn't work anyway.  Better to catch it early.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665570 13f79535-47bb-0310-9956-ffa450edef68
2008-03-14 00:51:42 +00:00
Christopher Piro
21c95a31ee [thrift] cleanup generated trailing whitespace in php
Summary: Verfolgenplaatze sind verboten!

Reviewed By: kder

Test Plan: no

Revert Plan: yes


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665569 13f79535-47bb-0310-9956-ffa450edef68
2008-03-12 04:28:43 +00:00
dweatherford
6b53bbb778 [thrift] Move readMessageEnd inside of else block for accelerated protocol
Summary: Otherwise, readMessageEnd will be performed twice; once in the extension and once in PHP-land. Since TBinaryProtocol readMessageEnd is a no-op this isn't a huge deal, but it's bad style.
Reviewed By: mcslee
Test Plan: Inspect generated php code
Revert: OK
TracCamp Project: Thrift
DiffCamp Revision: 9155


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665567 13f79535-47bb-0310-9956-ffa450edef68
2008-03-11 02:42:45 +00:00
David Reiss
0e913a6381 Add an accessor for the I/O protocols of Thrift clients.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665565 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:28:31 +00:00
David Reiss
6987535d65 Change the Java help to be a little more consistent.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665553 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 21:10:41 +00:00
David Reiss
4ac9267cf8 Don't declare getStaticLimitedReflection if gen_reflection_limited_ is off.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665552 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 21:10:38 +00:00
David Reiss
a014788f73 Changed an awkward if/else if/else to be slightly less awkward.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665551 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 21:10:34 +00:00
dweatherford
cf997a45c6 [thrift] PHP thrift_protocol extension, revision 2.0
Summary:
  All PHP serialization and deserialization can now happen in extension-land,
  which should be much faster. This includes reading message headers and all
  complex types (structs, exceptions, whatever).

  The compiler has been updated to always emit the $_TSPEC static array for
  generated PHP code, since the new extension depends on it.

  As before, the PHP code gates enabling the accelerated serialization on
  the protocol being an instance of TBinaryProtocolAcclerated and the function
  for the [de]serialization operation existing.

  The function names have changed since the last version of the extension,
  so old and new generated code can coexist, and new generated code can run on
  a server with the old extension (but it will not use accelerated serialization).

Reviewed by: hzhao
Test Plan: Generated a couple of endpoints and called their services through the
  new extension. Both use a variety of nested complex types. Built and ran the
  extension in php-5.2.3 in debug mode, killed the reported memory leaks.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665548 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 01:08:23 +00:00
David Reiss
9f646157f0 Fix a typo in a warning message in thrifty.yy.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665547 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 21:59:48 +00:00
David Reiss
14feb4127c Generate quality overrides of hashCode for Thrift structs (in Java).
This feature is turned off by default because it adds a new dependency:
Apache Commons Lang.  This package seems enough like Boost that
I would be open to turning this feature on by default.

Also updated test/java/build.xml to use this new option.
ant test still passes.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665542 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 06:29:23 +00:00
David Reiss
3b15ebc251 Add support for .equals() to Java structs.
- Add a new method to t_java_generator that generates a .equals() method.
- Add a correct but useless implementation of hashCode for structs.
  (This is required by conventino when overriding .equals().)
- Add java_package to DebugProtoTest and OptionalRequiredTest.
- Add a new structure to OptionalRequiredTest to assist testing the behavior
  of .equals() with respect to null and unset fields.
- Clean up test/java/build.xml a bit.  (It still has a ways to go.)
- Add EqualityTest.java to test .equals().
- Add IdentityTest.java to test that writing and reading a structure
  preserves equality.

Tested by runnint atn test.
I also looked at the generated code for OptionalRequiredTest.thrift.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665541 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 06:29:19 +00:00
David Reiss
4b6a3c7a68 Fix a subtle bug in cpp_use_include_path.
Summary:
I thought I had eliminated all the places where work was only done
if cpp_use_include_path was set.  I guess I missed one.

Reviewed By: mcslee, mrabkin, kholst

Test Plan:
Built BigGrep and looked at the generated code.

Revert Plan: ok

DiffCamp Revision: 8375


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665530 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 22:28:12 +00:00
David Reiss
cf2e8d9af3 Add an operator< for Thrift structs (in C++).
Some people want to use sets of Thrift structs.  This has interesting
implications, but it is a reasonable request.  However, in C++,
this requires structures to have a less-than operator.
It seems a little dangerous to auto-generate an arbitrary comparator,
but allowing users to define their own operator< implementations
seems fine.  This change makes that a lot easier.

The one downside of this change is that developers who try to compare
structures with operator< (including trying to make sets of them)
will now get a linker error instead of a compiler error.
However, the old compiler error was so scary that
I'm not sure this is any worse.

Reviewed By: kholst, mcslee

Test Plan: make check


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665527 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 19:38:51 +00:00
David Reiss
10ae20f684 Fix a warning message.
Forgot to update this when copy-pasting.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665521 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 07:45:10 +00:00
David Reiss
4ce2874fd5 Make limited reflection optional (off by default).
Limited reflection is deprecated, and it is slowing down compilation.
This change will disable generation of static reflection by default,
but it adds a command line argument to re-enable it.

Tested by running make check and building the C++ test client and server.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665520 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 07:45:05 +00:00
Mark Slee
b1b8079e62 Make compiler work on cpp_includes with < in them
Reviewed By: spiantino

Test Plan: build multifeed aggregator


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665518 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 04:29:34 +00:00
David Reiss
e8a87de867 Allow the Thrift compiler to be built without the Java generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-java
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665517 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 02:39:25 +00:00
David Reiss
22585733e1 Allow the Thrift compiler to be built without the C++ generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-cpp
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665516 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:55:33 +00:00
David Reiss
771f8c797b Make the Java generator use non-hardcoded namespaces.
- Make the Java generator use program->get_namespace("java")
  instead of program->get_java_namespace()
- Eliminate the explicit "java_namespace" in t_program.
- Deprecate the java_namespace token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665514 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:55:25 +00:00
David Reiss
9a08dc6184 Make the C++ generator use non-hardcoded namespaces.
- Make the C++ generator use program->get_namespace("cpp")
  instead of program->get_cpp_namespace()
- Eliminate the explicit "cpp_namespace" in t_program.
- Deprecate the cpp_namespace token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665513 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:55:17 +00:00
David Reiss
79eca14125 Infrastructure for a language-neutral namespace declaration.
Altered the once-deprecated "namespace" directive in .thrift files
to take two identifiers: the language and the namespace.
They are stored in a map inside of the program object.
Future changes will convert specific generators to use this map
and deprecate the old language-specific tokens.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665512 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:55:13 +00:00
David Reiss
dc61be9650 Remove t_java_generator.h.
t_java_generator.h is no longer included anywhere, because
the Java generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.

Also cleaned up its includes a little bit.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665511 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:55:09 +00:00
David Reiss
e1404d21ac Make the Java generator dynamic.
- Modify the Java generator constructor to fit the new generic interface.
- Register the Java genrator with the central registry.
- Deprecate the old way of invoking the Java generator.
- main.cc no longer includes t_java_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665510 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:55:05 +00:00
David Reiss
52812f98db Remove t_cpp_generator.h.
t_cpp_generator.h is no longer included anywhere, because
the C++ generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.

Also cleaned up its includes a little bit.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665509 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:54:59 +00:00
David Reiss
400cd4be38 Make the C++ generator dynamic.
- Modify the C++ generator constructor to fit the new generic interface.
- Register the C++ genrator with the central registry.
- Deprecate the old way of invoking the C++ generator.
- main.cc no longer includes t_cpp_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665508 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:54:55 +00:00
David Reiss
bd0db88477 Infrastructure for loading code generators a bit more dynamically.
Add a generic and easy-to-use mechanism for Thrift code generators to
register themselves centrally.  The central registry is used to
obtain documentation for the options accepted by individual generators
and get instances of individual generators.  It also does a little bit of
option parsing that will be useful for all generators.

Obviously, this change cannot be tested on its own.  I can only say
that Thrift still builds and runs correctly.  Subsequent changes
will apply this infrastructure to specific code generators.
Steve Grimm has assured me that this is standard Git practice.

In fact, I ran this test after converting the C++ and Java generators:

dreiss@dreiss-vmware:dynamic_generators:thrift/test$ mkdir old new
dreiss@dreiss-vmware:dynamic_generators:thrift/test$ cd old
dreiss@dreiss-vmware:dynamic_generators:thrift/test/old$ ../../compiler/cpp/thrift -cpp -dense -java -javabean ../DebugProtoTest.thrift
[WARNING::1] -cpp is deprecated.  Use --gen cpp
[WARNING::1] -java is deprecated.  Use --gen java
[WARNING::1] -javabean is deprecated.  Use --gen java:beans
dreiss@dreiss-vmware:dynamic_generators:thrift/test/old$ cd ../new/
dreiss@dreiss-vmware:dynamic_generators:thrift/test/new$ ../../compiler/cpp/thrift --gen cpp:dense --gen java --gen java:beans ../DebugProtoTest.thrift
dreiss@dreiss-vmware:dynamic_generators:thrift/test/new$ cd ..
dreiss@dreiss-vmware:dynamic_generators:thrift/test$ diff -ur old/ new/
dreiss@dreiss-vmware:dynamic_generators:thrift/test$


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665507 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:54:51 +00:00
David Reiss
9cc2c13710 Make warnings from the Thrift compiler a little clearer.
Reviewed by: mcslee

Warning and error messages from the Thrift compiler include
the file currently being parsed and the line number.
This change sets those to dummy values for stages that
have nothing to do with parsing.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665506 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 01:54:47 +00:00
David Reiss
0e18224473 Tighten integration with Ruby exceptions by tying in Exception#message
For Thrift exceptions that contain only a single string field, integrate
these even more tightly with Ruby exceptions by aliasing Ruby's
Exception#message field with the Thrift field.

Ruby exception objects created by Thrift will now display properly in
Ruby backtraces, etc. without any special handling by client code.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665503 13f79535-47bb-0310-9956-ffa450edef68
2008-02-26 06:40:25 +00:00
David Reiss
68ccc699a3 Move Ruby fielded object creation from generated constructor to ThriftStruct
Rather than the generated code needing to handle simple fielded
creation of objects, the ThriftStruct module constructor is extended to
handle hash arguments. Statements such as

  o = ThriftObject.new :field1 => value1, :field2 => value2, ...

are supported as before, and the string form,

  o = ThriftObject.new "field1" => value1, "field2" => value2, ...

disabled by the previous patch now also works.

Placing this code in the module is also just a cleaner solution.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665502 13f79535-47bb-0310-9956-ffa450edef68
2008-02-26 06:40:22 +00:00
David Reiss
ebbfbd8395 Ruby exception constructor bugfix
The Ruby exception constructor is modified to accept 0 arguments, which is
how Thrift library code creates exception objects. Without this fix, Thrift
Ruby clients that receive exception objects crash.

The call to super (resolving to ThriftStruct#initialize) is retained, but
is called with the default value (an empty hash) instead of passing the
message along.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665501 13f79535-47bb-0310-9956-ffa450edef68
2008-02-26 06:40:16 +00:00
David Reiss
2ca456a8ae Make "make clean" rules a bit more standard.
Summary:
make-generic is some sort of internal undocumented thing.
make-local is what is supposed to be used for this stuff.
Also use $(RM) instead of "rm -f".

Reviewed By: marc

Test Plan: make clean


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665498 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 16:42:18 +00:00
David Reiss
c91d07c784 Fix a typo in the C# generator.
Actually, it is not a typo.  The original authors didn't convert one call
to get_java_package to get_csharp_namespace.

Tested by building Thrift.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665489 13f79535-47bb-0310-9956-ffa450edef68
2008-02-20 05:30:55 +00:00
David Reiss
399442be81 Fix a typo
Reviewed By: mcslee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665488 13f79535-47bb-0310-9956-ffa450edef68
2008-02-20 02:28:05 +00:00
David Reiss
c005b1b65e Thrift: Distinguish between string and binary types in C++ and Java.
Summary:
The upcoming TJSONProtocol handles string and binary types quite differently.
This change makes that distinction in all parts of the C++ binding.

Java already distinguished between string and binary, but this change
also updates the Java skip method to skip over strings as binary
so we don't get encoding errors when skipping binary data.

Reviewed By: mcslee

Test Plan: make check

Revert Plan: ok

Other Notes:
I just pulled this out of Chad Walters' JSON patch.
The only other change was adding readBinary (or was it writeBinary)
to TDenseProtocol.  Maybe inheriting from TBinaryProtocol wasn't a good idea.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665481 13f79535-47bb-0310-9956-ffa450edef68
2008-02-15 01:38:18 +00:00
eletuchy
bbf8062e4f [thrift] making generated php struct readers more compact
Summary: introducing a $bin_accel variable in struct reader scope that
         can be reference by the deserializers of each field

Reviewed By: dreiss, mcslee

Test Plan: regenerated a thrift service, compared before and after calls

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665478 13f79535-47bb-0310-9956-ffa450edef68
2008-02-13 22:44:24 +00:00
Mark Slee
dd43eb85c7 Fix Java generator for javabean target to construct maps and lists properly
Summary: From Johann Oskarsson

Reviewed By: dreiss

Test Plan: Generate javabean code


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665476 13f79535-47bb-0310-9956-ffa450edef68
2008-02-13 22:03:15 +00:00
iproctor
55aebc404b Thrift haskell getTransport working
Summary: getTransport is now a method of Protocol. To flush the transport one does tflush (getTransport p) instead of pflush p. This is more like how it is done with other languages.

Reviewed By: dcorson

Test Plan: Ran thrifttest for haskell.

Revert: OK

DiffCamp Revision: 7515


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665473 13f79535-47bb-0310-9956-ffa450edef68
2008-02-11 22:59:01 +00:00
David Reiss
407c9e7865 Thrift: Fix a bug with local reflection and namespaces.
Summary:
References to "local reflections" in other thrift files were not given
namespace prefixes, give undefined symbol errors.  This change
distinguishes between relfection names being generated for declarations
(not namespaced) and those that could be external references (namespaced).

Reviewed By: mcslee

Test Plan:
Got the following files to build and link correctly with -dense.

==> test1.thrift <==
cpp_namespace ns
enum foo { bar }

==> test2.thrift <==
include "test1.thrift"
enum dummy_enum_workaround { I_AM_A_WORKAROUND }
struct baz {
  1: test1.foo qux
}

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665472 13f79535-47bb-0310-9956-ffa450edef68
2008-02-09 02:51:43 +00:00
Mark Slee
6756f1351a Getters for input/output protocol in client lib
Summary: Why not, nice to have. From Ted Dziuba.

Reviewed By: dreiss

Test Plan: Build Java compiler.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665471 13f79535-47bb-0310-9956-ffa450edef68
2008-02-09 00:26:29 +00:00
Mark Slee
22360b2f30 Use interfaces, not classes for Java gen
Summary: Not AbstractMap or HashSet, etc. use Map, List, Set

Reviewed By: dreiss

Test Plan: Generate Java code and build java tests

Other Notes: Submitted by Seth Falcon


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665470 13f79535-47bb-0310-9956-ffa450edef68
2008-02-09 00:18:32 +00:00
Mark Slee
a8de4895f6 Patch from Ross McFarland to compile with strict warnings
Summary: Use comment trick in params that are unused to prevent warnings

Reviewed By: dreiss

Test Plan: Generate C++ code and compile -W -Wall


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665469 13f79535-47bb-0310-9956-ffa450edef68
2008-02-09 00:02:26 +00:00
David Reiss
3c5d2fd9a8 Thrift: Fix a bug in local reflection generation.
Summary:
The problem was that in generate_local_reflection, we refused to
generate reflections for types defined in another program, including enums.
But in local_reflection_name, we treated enums like base types,
assuming that their reflections were always defined in this program.
One solution would be to treat enums like base types everywhere, and always
generate their reflections in the program where they were being used.
But this change takes the opposite approach.  We now always
generate fingerprints for enums in the program in which they are defined,
even if they are not used there.

Reviewed By: mcslee

Test Plan:
Got the following files to build and link correctly with -dense.

dreiss@dreiss-vmware:reflection:thrift/test$ tail test[12].thrift
==> test1.thrift <==
enum foo { bar }

==> test2.thrift <==
include "test1.thrift"
struct baz {
  1: test1.foo qux
}

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665468 13f79535-47bb-0310-9956-ffa450edef68
2008-02-08 21:58:06 +00:00
David Reiss
0c90f6f8af Thrift: Whitespace cleanup.
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.

Reviewed By: mcslee

Test Plan: git diff -b

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:18:40 +00:00
David Reiss
46dc62950d Thrift: Miscellaneous optimizations for C#.
Reviewed By: mcslee

Test Plan: Built it after a future revision.

Revert Plan: ok

Other Notes:
Submitted by Ben Maurer.
Actually reviewed by Todd Berman.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665464 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:09:58 +00:00
David Reiss
cba5727a3f Thrift: String/Binary distinction for C#.
Reviewed By: mcslee

Test Plan: Built it after a future revision.

Revert Plan: ok

Other Notes:
Submitted by Ben Maurer.
Actually reviewed by Todd Berman.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665463 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:09:44 +00:00
Mark Slee
adb5cad7d3 Make inner Isset classes implement serializable
Summary: Since the outer class is serializable, you'll want it on the inner member too. Though in general you shouldn't be using Java to serialize Thrift objects, as that misses the point and tosses version compatibility out the window.

Reviewed By: dreiss

Test Plan: Generate Java code


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665460 13f79535-47bb-0310-9956-ffa450edef68
2008-02-04 21:34:22 +00:00
dweatherford
84e5022bfc [thrift] Fix generated T_LIST push_back() for cpptype override
Summary: Thrift compiler emitting code missing a closing paren:
  "this->extras.push_back(_elem18;"
Reviewed by: eletuchy
Test plan: rebuild some feed code that uses cpptype overrides
Revert: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665453 13f79535-47bb-0310-9956-ffa450edef68
2008-02-01 20:42:56 +00:00
Mark Slee
f07d48e812 Fix to the throws clause validation
Summary: Types from external files are not resolved until the program parse pass, not the include one. Therefore, only do full type validation once after all includes have been parsed and external type pointers resolved.

Reviewed By: aditya

Test Plan: build ServiceManager.thrift


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665452 13f79535-47bb-0310-9956-ffa450edef68
2008-02-01 01:36:26 +00:00
Mark Slee
5cf89c1610 If a list has a custom CPP type, use push_back
Summary: Can't deserialize by reference into std::list, for example

Reviewed By: dweatherford

Test Plan: Build feed


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665451 13f79535-47bb-0310-9956-ffa450edef68
2008-01-31 22:02:26 +00:00
Mark Slee
91f2b7b2f7 Validate that throws clauses in Thrift contain only exceptions
Summary: Throwing non-exceptions, though allowed in some languages, is a weird concept and causes problems in many places. Disallow it in the Thrift compiler and throw an informative error.

Reviewed By: dreiss

Test Plan: Generate a file with an int or something in a throws clause. Peep the nice informative compiler error.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665450 13f79535-47bb-0310-9956-ffa450edef68
2008-01-31 01:49:16 +00:00
Mark Slee
8d4b1cc3ab Improve C++ vector deserialization
Summary: Use std::vector::resize() method to default construct placeholder elements. Then grab references via operator[] to deserialize directly into the vector, instead of copy-constructing elements in.

Reviewed By: hzhao

Test Plan: test/cpp contains list serialization/deserialization checks


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665449 13f79535-47bb-0310-9956-ffa450edef68
2008-01-31 00:06:29 +00:00
Mark Slee
61959f5d9d Improve Thrift map deserialization code
Summary: Instead of copy-constructing map values into the map, alter the code such that we insert default-constructed elements into the map and then deserialize them by reference.

Reviewed By: hzhao

Test Plan: Ran the test in test/cpp which include serialization and deserialization of nested maps.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665448 13f79535-47bb-0310-9956-ffa450edef68
2008-01-30 23:23:15 +00:00
David Reiss
073e2cfeb5 Thrift/Ruby: Generate nicer constructors for Thrift structs.
Submitted by William Morgan.
Approved by Kevin Clark.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665446 13f79535-47bb-0310-9956-ffa450edef68
2008-01-28 20:47:00 +00:00
David Reiss
3e6583365a Thrift/Ruby: Allow some thrift exceptions to use standard Ruby syntax.
Submitted by William Morgan.
Approved by Kevin Clark.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665445 13f79535-47bb-0310-9956-ffa450edef68
2008-01-28 20:46:57 +00:00
David Reiss
050f3200a2 Thrift: Change the way constants are initialized to avoid segfaults.
Reviewed By: mcslee

Test Plan: Looked at the patch carefully.

Other Notes:
Patch submitted by Dave Simpson.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665437 13f79535-47bb-0310-9956-ffa450edef68
2008-01-18 07:39:36 +00:00
Mark Slee
32007a555c Fix set_name compiler method signature
Reviewed By: kholst

Other Notes: Follow up from 78130


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665434 13f79535-47bb-0310-9956-ffa450edef68
2008-01-18 00:57:59 +00:00
kholst
76f2c88eda thrift: Add -cpp_use_include_prefix flag to compiler
Summary: Adds a new flag to allow for a mode where #include statements in generated c++ will include path context information.  For example, if my .thrift file includes "foo/bar/baz.thrift", the generated source files will contain #include statements like:

         #include "foo/bar/gen-cpp/baz_types.h"

         instead of just:

         #include "baz_types.h"

         -cpp_use_include_prefix is OFF by default.

Reviewed By: dreiss

Test Plan: Tested against multiple thrift input files both with and without the new flag.

Revert: OK

DiffCamp Revision: 5522


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665431 13f79535-47bb-0310-9956-ffa450edef68
2008-01-16 02:47:41 +00:00
Mark Slee
1c4ced7409 Generate structs/exceptions in declared order
Summary: Otherwise you're liable to get forward declaration problems in the generated C++ code.

Reviewed By: dreiss

Test Plan: Generate some code that mixes exceptions/structs and has methods potentially return a list of exceptions


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665423 13f79535-47bb-0310-9956-ffa450edef68
2008-01-14 23:04:43 +00:00
David Reiss
7f42bcf97c Thrift: C# Bindings.
Summary:
C# generator, library, and MS Build task contributed by imeem.

Reviewed By: mcslee

Test Plan:
Built the Thrift compiler and generated some C# code.
I'd love to say I installed Mono or Portable.NET and built the C# code,
but I did not.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665421 13f79535-47bb-0310-9956-ffa450edef68
2008-01-11 20:59:12 +00:00
David Reiss
204420fa56 Thrift: MinGW port.
Summary:
Todd Berman from imeem has contributed a patch that allows
the Thrift compiler to be built with MinGW and run on Windows.

Reviewed By: mcslee

Test Plan:
Built the compiler from scratch on Linux.
If my changes messed up the MinGW build, I'm sure Todd will yell at me.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665420 13f79535-47bb-0310-9956-ffa450edef68
2008-01-11 20:59:03 +00:00
Mark Slee
89f5716421 Ruby default values patch
Summary: Submitted by Dan Sully, reviewed by Kevin Clark

Reviewed By: dreiss

Test Plan: New ruby generated code with default vals, and new test scripts


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665418 13f79535-47bb-0310-9956-ffa450edef68
2008-01-10 00:53:08 +00:00
Mark Slee
8c46b1a881 Fix generation for Byte/byte while we're at it
Summary: If in a container, use Byte not byte

Reviewed By: dreiss

Test Plan: Generate a list of bytes

Other Notes: based upon Kyle's submission


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665417 13f79535-47bb-0310-9956-ffa450edef68
2008-01-09 19:51:24 +00:00
David Reiss
a65a79ed26 Thrift: Java generator bugfix.
Reviewed By: mcslee

Test Plan: None.

Revert Plan: ok

Other Notes:
Reported by Kyle Shank.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665416 13f79535-47bb-0310-9956-ffa450edef68
2008-01-09 19:20:20 +00:00
David Reiss
832b262aca Thrift: Revamp build to use a single configure.ac.
Summary:
Ben Maurer suggested that it would make sense for Thrift to build as
a single project, with one configure.ac and multiple Makefile.am.
He was also kind enough to do the heavy lifting, and this commit
is the application of his patch (with minor modifications).
The most significant visible change from this diff is that
in order to buidl one of the thrift sub-projects (i.e.: the compiler,
the C++ library, or the Python library) you must run bootstrap.sh
and configure in the Thrift root, then make in the specific project.
Users who want to build and install the Python library but
can't run configure because they don't have Boost can simply
run setup.py directly.

Reviewed By: mcslee

Test Plan: Built Thrift from scratch.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665409 13f79535-47bb-0310-9956-ffa450edef68
2007-12-28 18:25:33 +00:00
eletuchy
6570451145 [thrift] service functions that begin with a Capital now work for Erlang ...
Summary: ... The main interface function has the same name, but as an escaped atom
         (ie 'CapitalizedFun'(Arg1, Arg2) -> is the function sig)

Reviewed by: dweatherford

Test Plan: tested with the following thrift
     service foo {
         Struct1 CapitalizedFun(1: list<Struct2> param);
     }

     Generated erlang code now compiles

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665408 13f79535-47bb-0310-9956-ffa450edef68
2007-12-27 15:20:14 +00:00
Mark Slee
f845b7d3e0 Make base set_name take const std:string& instead of std:string
Summary: All the subclasses do that so it causes warnings not to and is dumb because copy constructing std::string is dumb

Reviewed By: kholst

Test Plan: Generate some codes, compile with -Werror


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665405 13f79535-47bb-0310-9956-ffa450edef68
2007-12-21 23:53:10 +00:00
Mark Slee
c27fc31333 Make "args" reserved in thrift
Summary: Breaks the generated python code

Reviewed By: dcorson

Test Plan: Get an error if you use "args" as a variable name in Thrift.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665404 13f79535-47bb-0310-9956-ffa450edef68
2007-12-21 23:52:19 +00:00
Mark Slee
97264864df is_a is deprecated, instanceof only takes vars or constants
Summary: Solution, dummy static class var to use instanceof

Reviewed By: dweatherford

Test Plan: Regen'd some mobile code in trunk using this


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665401 13f79535-47bb-0310-9956-ffa450edef68
2007-12-20 03:23:27 +00:00
David Reiss
6495adb992 Thrift: Optional support for new-style classes.
Reviewed By: mcslee

Test Plan: Thrifted ThriftTest.thrift and looked at the output.

Revert Plan: ok

Other Notes:
Based on a patch from Jon Dugan.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665399 13f79535-47bb-0310-9956-ffa450edef68
2007-12-18 03:37:30 +00:00
David Reiss
80a702fa39 Thrift: Make default values for base types work in Java.
Summary:
The Java generator wasn't setting default values for base types
in the zero argument constructor.  This check was probably brought over
from the C++ generator, where base types are given their default values
in the member variable initializer list (or whatever that thing is called).

Blame Rev: Somewhere in the mysterious past.  I tried to find it, but failed.

Reviewed By: mcslee

Test Plan: Recompiled Thrift and thrifted a file that showed the bug.

Revert Plan: ok

Other Notes:
Bug reported by Jake Luciani.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665398 13f79535-47bb-0310-9956-ffa450edef68
2007-12-18 02:54:06 +00:00
David Reiss
15457c9b08 Thrift: Smalltalk prefix support.
Reviewed By: mcslee

Test Plan: Built the compiler.

Revert Plan: ok

Other Notes:
Contributed by Ben Matasar.
Signed off by Patrick Collison.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665391 13f79535-47bb-0310-9956-ffa450edef68
2007-12-14 07:03:03 +00:00
Mark Slee
9860ee2c86 Fix bug that double-initializes list objects in deserialization.
Reviewed By: jssarma

Test Plan: Regenerate Java code, check list deserializer for no double-object instantiation


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665381 13f79535-47bb-0310-9956-ffa450edef68
2007-11-30 01:43:36 +00:00
Mark Slee
6f9ac3ffeb Thrift compiler now enforces uniqueness of field identifiers
Summary: The code would either not generate, or generate code with errors, if you did this beforehand. Now it's a die-fast stop hard error since this is absolultely always a wrong thing to do.

Reviewed By: dreiss

Test Plan: Test compiling a .thrift file with a repeated field identifier in a struct or arglist.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665379 13f79535-47bb-0310-9956-ffa450edef68
2007-11-28 22:28:13 +00:00
Mark Slee
e02ab33cb8 Lowercase autoload strings
Summary: PHP is undebatably the worst programming language in the world. Class names are case insensitive, so new $tHiNg = new $THing. Garbase. Now autoload has to deal with the fallout.

Reviewed By: dreiss

Test Plan: autoload enabled falcon code


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665375 13f79535-47bb-0310-9956-ffa450edef68
2007-11-28 04:17:49 +00:00
Mark Slee
b22df7c963 Make inheriting from TBase and using inherited read method optional in generated Thrift PHP code
Reviewed By: dreiss, akhil

Test Plan: Generate falcon etc. without -phpo and check it out


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665372 13f79535-47bb-0310-9956-ffa450edef68
2007-11-28 02:39:59 +00:00
Mark Slee
5ab570558f Fix writeContainerEnd call being inside loop instead of after loop
Summary: Potentailly breaks Java serialization for protocols that care about container termination.

Reviewed By: dreiss

Test Plan: Generate code, veirfy writeListEnd/writeSetEnd is in the apporpriate place


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665366 13f79535-47bb-0310-9956-ffa450edef68
2007-11-27 08:38:16 +00:00
Mark Slee
7962223ce2 libtoolize and configure tweaks for Thrift compiler
Summary: Need glibtoolize on OSX.

Reviewed By: mcslee

Other Notes: From Paul Collison


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665363 13f79535-47bb-0310-9956-ffa450edef68
2007-11-21 23:35:52 +00:00
Mark Slee
a9387af56e Double-free Cocoa fix: Redux
Summary: Need get_true_type to evaluate string status

Reviewed By: mcslee

Other Notes: Submission from Andrew McGeachie


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665362 13f79535-47bb-0310-9956-ffa450edef68
2007-11-21 22:05:50 +00:00
Mark Slee
bd5882259d Merging in some Smalltalk changes from Patrick Collison
Reviewed By: mcslee

Test Plan: Rebuild Thrift compiler


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665361 13f79535-47bb-0310-9956-ffa450edef68
2007-11-21 08:43:35 +00:00
Mark Slee
12a28758a6 Fix cocoa double-free issue with strings
Reviewed By: mcslee

Other Notes: Submitted by Andrew McGeachie


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665360 13f79535-47bb-0310-9956-ffa450edef68
2007-11-20 23:55:33 +00:00
Mark Slee
efd37f14d2 Add Smalltalk support to Thrift
Summary: Submitted by Patrick Collison


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665358 13f79535-47bb-0310-9956-ffa450edef68
2007-11-20 05:13:09 +00:00
Mark Slee
12a3b4e002 Do not generate constants php files from Thrift when they will be empty
Summary: That's just silly

Reviewed By: peter, dreiss

Test Plan: Generate PHP from a .thrift with no constants. Notice there is no _constants.php generated.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665355 13f79535-47bb-0310-9956-ffa450edef68
2007-11-20 02:05:29 +00:00
Christopher Piro
de11d85211 [thrift] gut Erlang exception handling
Summary: * move type field to tException from subclasses
          * add backtrace to tException
          * add oop:is_a
          * on exit, wrap exceptions in {thrift_exception, E} ... otherwise can't distinguish e.g. exit:{{tBinProtException, {tException, ...}}, Stack} vs. exit:{tBinProtException, {tException, ...} -- I hate erlang
          * all throws/exits to tException:throw which does the wrapping described above

Reviewed By: eletuchy

Test Plan: been using this code on my live server ^_^

Revert: OK


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665350 13f79535-47bb-0310-9956-ffa450edef68
2007-11-18 02:10:20 +00:00
Mark Slee
09f69e0524 Add __autoload() support to Thrift-generated PHP code
Summary: Include thrift/autoload.php and use -phpa flag to generated code that works with autoload. Good for services with lots of methods that are typically not all invoked.

Reviewed By: dreiss

Test Plan: Falcon, baby, falcon.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665349 13f79535-47bb-0310-9956-ffa450edef68
2007-11-17 00:32:36 +00:00
Mark Slee
eab6ac8b18 Make sure to lazily initialize $TSPEC for structs even with no members
Reviewed By: dweatherford

Test Plan: Generate code with no E_ALL for method-less args


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665346 13f79535-47bb-0310-9956-ffa450edef68
2007-11-16 03:27:22 +00:00
Mark Slee
9e58f4330d Fix namespacing of included enum types in C++ generated code
Summary: If you reference enum types from an include you need to fully qualify their namespace in the generated C++ code.

Reviewed By: pfung

Test Plan: fbtypes code that pfung is using


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665345 13f79535-47bb-0310-9956-ffa450edef68
2007-11-16 02:48:52 +00:00
Christopher Piro
9230539a6f [thrift] Erlang client calls return value from recv_
Summary: only return `ok' if it's an async, otherwise return the value of recv_

Reviewed By: cvarenhorst

Test Plan: my server works now

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665344 13f79535-47bb-0310-9956-ffa450edef68
2007-11-15 06:26:32 +00:00
Christopher Piro
90eab4d6e4 [thrift] remove trailing-whitespace-generating code from t_erl_generator.cc
Summary: meta

Reviewed By: dcorson

Test Plan: M-x delete-trailing-whitespace does nothing

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665341 13f79535-47bb-0310-9956-ffa450edef68
2007-11-15 06:26:29 +00:00
Christopher Piro
2605af3a2d [thrift] remove tabs from t_erl_generator.cc
Summary: ididntdoit

Reviewed By: eletuchy

Test Plan: ok

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665340 13f79535-47bb-0310-9956-ffa450edef68
2007-11-15 06:26:29 +00:00
Mark Slee
89d5207983 Change Thrift to lazily instantiate $_TSPEC objects on first object instantiation
Summary: Apparently adding the static array costs overhead since it must get preinitialized or something? It's unclear exactly what's going on here, but let's test to see if explicit lazy instantiation helps here.

Reviewed By: dreiss

Test Plan: See if this speeds up falcon loading


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665334 13f79535-47bb-0310-9956-ffa450edef68
2007-11-14 00:24:14 +00:00
David Reiss
380298f458 Thrift: Fix new-style generated PHP code.
Summary:
We were generating a fatal when constructing a struct with an argument.

Reviewed By: lucas

Test Plan: None.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665332 13f79535-47bb-0310-9956-ffa450edef68
2007-11-13 11:55:06 +00:00
Mark Slee
c557df42ed Need to properly namespace the php class names in typespec
Reviewed By: aditya

Test Plan: Regenerate ubersearch code


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665330 13f79535-47bb-0310-9956-ffa450edef68
2007-11-13 05:53:44 +00:00
Mark Slee
5b743079da Thrift PHP generation Redux
Summary: Chopping the amount of code generated by Thrift for PHP services by two orders of magnitude (approx 25% of the previous size). This is done via putting more logic in a dynamic base class and taking it out of the generated code. Hopefully this wins back the CPU cycles paid just to load code from APC at the cost of a marginal increase in dynamic execution runtime.

Reviewed By: sgrimm, dreiss

Test Plan: Ran all the tests in trunk/test/php, also tested the API generate code and Falcon, etc. in my sandbox


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665328 13f79535-47bb-0310-9956-ffa450edef68
2007-11-13 04:00:29 +00:00
Mark Slee
5151c6279b Add include_once statements for generated PHP code that depends upon other types
Reviewed By: root

Test Plan: Generate PHP code for a .thrift file with an include in it

Other Notes: Reviewed by Todd Lipcon from AmieStreet


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665325 13f79535-47bb-0310-9956-ffa450edef68
2007-11-06 22:11:29 +00:00
Mark Slee
f968926f2b Missing configure check for strerror function
Reviewed By: dreiss

Test Plan: Run configure script


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665324 13f79535-47bb-0310-9956-ffa450edef68
2007-11-06 22:10:24 +00:00
David Reiss
83be086c7d Thrift: Create directories with more permissive modes.
Summary:
How many times has no one else been able to use your awesome Python script
because the Thrift generated files are in a directory that they can't access?
Never again!  We now create directories with mode 0777.
Of course, your process umask will ensure that they are actually created
with mode 0755.  (This is how the mkdir command works.)

Reviewed By: mcslee

Test Plan:
Rebuilt thrift, then did this:
dreiss@dreiss-vmware:dir_mode:thrift/test$ rm -rf gen-*
dreiss@dreiss-vmware:dir_mode:thrift/test$ thrift -cpp  -java -php -py ThriftTest.thrift
dreiss@dreiss-vmware:dir_mode:thrift/test$ ls -ld gen-*
drwx------ 2 dreiss dreiss 4096 2007-10-18 12:20 gen-cpp
drwx------ 3 dreiss dreiss 4096 2007-10-18 12:20 gen-java
drwx------ 2 dreiss dreiss 4096 2007-10-18 12:20 gen-php
drwx------ 3 dreiss dreiss 4096 2007-10-18 12:20 gen-py
dreiss@dreiss-vmware:dir_mode:thrift/test$ rm -rf gen-*
dreiss@dreiss-vmware:dir_mode:thrift/test$ ../compiler/cpp/thrift -cpp  -java -php -py ThriftTest.thrift
dreiss@dreiss-vmware:dir_mode:thrift/test$ ls -ld gen-*
drwxr-xr-x 2 dreiss dreiss 4096 2007-10-18 12:20 gen-cpp
drwxr-xr-x 3 dreiss dreiss 4096 2007-10-18 12:20 gen-java
drwxr-xr-x 2 dreiss dreiss 4096 2007-10-18 12:20 gen-php
drwxr-xr-x 3 dreiss dreiss 4096 2007-10-18 12:20 gen-py
dreiss@dreiss-vmware:dir_mode:thrift/test$

Revert Plan: ok

Other Notes:
With some help from external contributor Ben Maurer.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665317 13f79535-47bb-0310-9956-ffa450edef68
2007-11-01 17:15:35 +00:00
eletuchy
83f14ee795 [thrift] erlang structs now compile
Summary: if "cond and cond ->" is not valid erlang,
         if "cond andalso cond ->" is.

Reviewed By: cpiro

Test Plan: generated erlang from and thrift file with structs ...
           generated code compiles

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665314 13f79535-47bb-0310-9956-ffa450edef68
2007-10-31 13:40:48 +00:00
dweatherford
5afc0aae32 [thrift] PHP generator: extension support
Summary: Adds php code generation to take advantage of the php
  'thrift_protocol' extension (currently for deserialization only)

  Requires you to swap your protocol for a TBinaryProtocolAccelerated
  (which just inherits TBinaryProtocol without actually adding any
  new functionality) and that you use a TFramedTransport or wrap your
  transport in a TBufferedTransport.

  TBinaryProtocolAccelerated is currently only in tfb/www/lib (or will
  be momentarily).

Reviewed By: mcslee
Test Plan: synapse_feed uses this in my sandbox, works fine
Revert: svn


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665313 13f79535-47bb-0310-9956-ffa450edef68
2007-10-31 06:03:54 +00:00
dweatherford
65b7075b5a [thrift] Output dir selection + updated TSCons
Summary: Allows setting the output directory via the new '-o dir' cmdline option.

  TSCons is updated to use this to put the output in the right place no matter
  the cwd, so doing dependent builds from different directories won't break.

Reviewed By: martin
Test Plan: mkdir /tmp/honk; thrift -cpp -java -javabean -php -phpi -py -rb -xsd -perl -erl -ocaml -hs -cocoa -o /tmp/honk Tablet.thrift
Revert: svn


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665311 13f79535-47bb-0310-9956-ffa450edef68
2007-10-31 02:18:14 +00:00
Mark Slee
2e7801d7c0 Make the Java generator respect the optional keyword in struct writers
Reviewed By: dreiss

Test Plan: Generate Java code. Check functionality and safe compile


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665308 13f79535-47bb-0310-9956-ffa450edef68
2007-10-24 02:56:24 +00:00
dweatherford
969b226b06 [thrift] Updating gen_phpi for new header format
Summary: This was still sending/expecting the old style (no version field); should be fixed now.
Reviewed By: mcslee
Test Plan: build and use Tablemaster and Tablet interfaces with gen-phpi
Revert: svn
DiffCamp Revision: 1435


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665306 13f79535-47bb-0310-9956-ffa450edef68
2007-10-23 00:26:44 +00:00
David Reiss
2b9ddab14c Thrift: Kill a warning.
Summary:
These should always have been const.

Reviewed By: mcslee

Test Plan:
Re-ran the dense protocol test.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665303 13f79535-47bb-0310-9956-ffa450edef68
2007-10-17 03:39:55 +00:00
Mark Slee
65e595f54f Generate REST code properly for objects/struct arguments
Reviewed By: hzhao

Test Plan: Data store API


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665302 13f79535-47bb-0310-9956-ffa450edef68
2007-10-15 21:32:12 +00:00
Christopher Piro
7b19b65a16 [thrift] Erlang Thrift 'oop:get' -> 'This#'
Summary: the client structures aren't oop objects, they're vanilla records ... adjust accordingly

Reviewed By: eletuchy

Test Plan: ok

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665300 13f79535-47bb-0310-9956-ffa450edef68
2007-10-13 05:10:52 +00:00
Mark Slee
34b2926d5c Java Thrift objects implement common base interface
Reviewed By: dreiss

Test Plan: Generate java code and run against new library.

Revert: OK

DiffCamp Revision: 900


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665296 13f79535-47bb-0310-9956-ffa450edef68
2007-10-09 20:55:10 +00:00
Christopher Piro
4c3d7b84b6 [thrift] don't scope non-service types in Erlang
Summary: kind of funny ... exact same patch as for the Ruby version; both were unexposed until I tried using reflection_limited

Test Plan: thx but nothx

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665295 13f79535-47bb-0310-9956-ffa450edef68
2007-10-09 04:41:48 +00:00
Mark Slee
6c848a02df Use json encoding logic for <list> and <set> args in Thrift PHP/REST
Reviewed By: hzhao

Test Plan: Data store API interface


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665294 13f79535-47bb-0310-9956-ffa450edef68
2007-10-08 22:31:03 +00:00
Christopher Piro
e4e1968935 [thrift] don't scope non-service types in Ruby
Summary: non-service types live in the top-level namespace, so look for them there. example from FacebookService.rb (accessing Service from reflection_limited_types.rb):

              FIELDS = {
         -      0 => {:type => TType::STRUCT, :name => 'success', :class => reflection_limited_types.Service}
         +      0 => {:type => TType::STRUCT, :name => 'success', :class => Service}
              }

         preferable to adding a "module honk_types ... end" around honk_types.rb ... non-service types should land in top-level space (or whatever ruby_namespace has been defined).  if ruby_namespace even works ... who knows

Reviewed By: mcslee

Test Plan: now reflection_limited works with my simple Ruby client

           honestly, there's no test suite for these?  TODO:cpiro

Revert: OK

TracCamp Project: Thrift

DiffCamp Revision: 735


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665291 13f79535-47bb-0310-9956-ffa450edef68
2007-10-04 01:54:11 +00:00
Mark Slee
165eca9c7c Make REST PHP deserializer generated PHP code support map/list/set
Summary: list/set are comma-separated and explode, map is JSON decoded

Reviewed By: hzhao

Test Plan: Invoke API methods via JSON


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665290 13f79535-47bb-0310-9956-ffa450edef68
2007-10-04 01:19:20 +00:00
Christopher Piro
73e3dd7d5f [thrift] fix Ruby codegen: capitalize module name for enums
Summary: all module names must be capitalized in Ruby -- if the enum name from the interface isn't capitalized \
         then it's a runtime error, e.g. in fb303_types.rb:

         -module fb_status
         +module Fb_status

Reviewed By: mcslee

Test Plan: fb303 now works with Ruby binding

Revert: OK

TracCamp Project: Thrift

DiffCamp Revision: 692


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665288 13f79535-47bb-0310-9956-ffa450edef68
2007-10-03 07:13:44 +00:00
Mark Slee
aa3c5a882c Merging latest minor Cocoa changes
Summary: BinaryProtocol handling of null strings, destructor, and contributors email fix. Submitted by Andrew McGeachie

Reviewed By: mcslee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665278 13f79535-47bb-0310-9956-ffa450edef68
2007-09-19 21:12:52 +00:00
Mark Slee
8266443d92 OO perl accessors for Thrift objects
Summary: Submitted by Jake Luciani

Reviewed By: cpiro

Test Plan: Supplied in test/tutorial code


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665276 13f79535-47bb-0310-9956-ffa450edef68
2007-09-19 06:49:30 +00:00
David Reiss
b72d19f653 Thrift: Prep for release.
Summary:
- make dist is no fun.  Had to add a lot of stuff to Makefile.am to
  make sure stuff got included in the tarball.
- Added a permanent NEWS file with the release notes for this release.
- clean.sh removes ylwrap also.
- Gave it a real version for make dist.
- Added ACLOCAL_AMFLAGS to lib/cpp/Makefile.am to make it easier to
  work on configure.ac.
- Made concurrency_test a non-installed binary because
  no one wants to install it.
- Dropped some symlinks that were annoying make dist.
- Updated README.

Test Plan:
./bootstrap.sh && ./configure && make dist
Compared contents of tarball to source tree.
Did this from a fresh git tree so no gross untracked files would be around.
On devrs: ./bootstrap.sh && ./configure && make install DESTDIR=/tmp/relinst1
Made sure concurrency_test was built but not installed.
Checked zlib URL with firefox.

Reviewed By: mcslee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665274 13f79535-47bb-0310-9956-ffa450edef68
2007-09-18 19:46:00 +00:00
Christopher Piro
0f6cc29f72 [thrift] fix _thrift for inheriting services
Summary: obviously Iain's fault


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665272 13f79535-47bb-0310-9956-ffa450edef68
2007-09-18 02:14:31 +00:00
Christopher Piro
b97b89d1dc [thrift] give the generated Erlang service file a _thrift
Summary: Before they were names Service.erl, but the Service module name should be reserved for more important things.  Namespaces what?

Test Plan: with channel server

Riders: also fixes whitespace, puts -erl in its right place


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665271 13f79535-47bb-0310-9956-ffa450edef68
2007-09-18 00:07:42 +00:00
David Reiss
f84b360d5c Thrift: Fix fingerprinting bug.
Summary:
Fingerprints were'nt being initialized properly because I forgot to move
the initialization from t_struct to t_type.  Fixed that.
Also, typedefs weren't generating fingerprints for their true types.

Reviewed By: mcslee

Test Plan:
This didn't work before with -cpp -dense.  Now it does.
typedef list<i32> ilist
struct foo { 1: ilist l }

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665268 13f79535-47bb-0310-9956-ffa450edef68
2007-09-17 21:16:32 +00:00
dweatherford
df72c01c37 [thrift] C++: Pass std::exception from server to client
Summary: Rather than an uncaught exception dropping the connection, catching std::exception (and anything derived from it) and passing its message payload back in the form of a T_EXCEPTION message is a much cleaner response.
Reviewed By: mcslee
Test Plan: compile generated code for Synapse's tablet interface, throw a generic exception at the server, observe the message for the exception arising from the client in the form of a TApplicationException (instead of the previous 'no more data to read' exception)
Revert: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665264 13f79535-47bb-0310-9956-ffa450edef68
2007-09-15 08:49:48 +00:00
Mark Slee
3d029786cd Add missing writeEnd calls
Summary: When flush is called this also should be

Reviewed By: aditya

Test Plan: Use w/ PipedTransport. Should writeEnd() when an exception is thrown


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665261 13f79535-47bb-0310-9956-ffa450edef68
2007-09-14 22:18:09 +00:00
Mark Slee
33a7d898ca Merge more cocoa changes from Andrew McGeachie
Reviewed By: dreiss

Test Plan: To be provided later by McGeachie. Compiler builds fine. Does not affect other libraries.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665259 13f79535-47bb-0310-9956-ffa450edef68
2007-09-14 19:44:30 +00:00
David Reiss
ce161a96cd Thrift: Clean up and test TDenseProtocol
Summary:
- TDenseProtocol now includes a part of the struct fingerprint in
  the serialized message, to protect from unserialzing trash.
- A lot of cleanups and commenting for TDenseProtocol.
- A lot of test cases for same.

Reviewed By: mcslee

Test Plan: test/DenseProtoTest.cpp

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665257 13f79535-47bb-0310-9956-ffa450edef68
2007-09-11 22:09:42 +00:00
Mark Slee
8775c73db2 Add JavaDoc comments to generated Thrift Java code
Reviewed By: dreiss
           Test Plan: Generate Java code from .thrift file w/ javadoc comments
              Revert: OK
               Notes: My first backend diffcamp review


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665256 13f79535-47bb-0310-9956-ffa450edef68
2007-09-10 22:33:05 +00:00
Mark Slee
7816572784 Modify Thrift parser to disallow optional/required keywords in argument lists
Reviewed By: dreiss

Test Plan: Toss an optional/required in an arg list, check that it's ignored and compiler spits a warning


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665255 13f79535-47bb-0310-9956-ffa450edef68
2007-09-10 22:08:49 +00:00
Mark Slee
7e9eea4871 Adding Cocoa generator to Thrift
Summary: Thanks to Andrew McGeachie for doing this

Reviewed By: dreiss

Test Plan: No merge/build issues. Will solicit McGeachie for additions to test/cocoa in the future


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665254 13f79535-47bb-0310-9956-ffa450edef68
2007-09-10 21:00:23 +00:00
Mark Slee
979ff958c1 Merge Java get/set Size and Iterator changes from Dave Engberg
Reviewed By: dreiss


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665253 13f79535-47bb-0310-9956-ffa450edef68
2007-09-10 20:53:23 +00:00
David Reiss
47557bc8ad Thrift: Slight tweaks to local reflection.
Summary:
Local reflection typespecs for structs now have a dummy T_STOP field at the end
so we don't have to check the size on every iteration.
They also contain information about which fields are optional.
Also put a static pointer to the reflection in each structure.

Reviewed By: mcslee

Test Plan: test/DenseLinkingTest.thrift

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665246 13f79535-47bb-0310-9956-ffa450edef68
2007-09-04 21:31:04 +00:00
James Wang
d3f1a2d2ba Summary: Checking in fix to TFileTransport to remove redundant behavior of readEvent -- just return NULL or the next event
Also, checking in changes to the php generation code I made awhile ago, but forgot to check in

Reviewed By: aditya, mcslee

Test Plan: Compiled thrift and falcon, and confirmed that falcon's print binary still worked

Revert Plan: revertible


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665245 13f79535-47bb-0310-9956-ffa450edef68
2007-08-31 23:45:53 +00:00
Mark Slee
5de75dd859 Merge some java gen fixes from Johan Oskarsson
Summary: Making Isset inner classes static because they don't need to reference their owner, and killing some unused variables.

Reviewed By: dreiss


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665244 13f79535-47bb-0310-9956-ffa450edef68
2007-08-31 20:06:36 +00:00
Mark Slee
f150f1aed5 Add get_true_type call to RB generator
Summary: Issue with typedefs failing, submitted by kevin clark @ powerset

Reviewed By: mcslee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665241 13f79535-47bb-0310-9956-ffa450edef68
2007-08-31 04:30:52 +00:00
David Reiss
d779cbe48c Thrift: Local Reflection for C++.
Summary:
The compiler now takes a "-dense" flag that will cause it to
generate some extra metadata for C++.  This metadata will be used by
TDenseProtocol.  This should be the last compiler change necessary
to enable that feature.

Reviewed By: mcslee

Test Plan: test/DenseLinkingTest.thrift

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665240 13f79535-47bb-0310-9956-ffa450edef68
2007-08-31 01:42:55 +00:00
Mark Slee
01a9f8845d Add -javabean option to Thrift
Summary: In case you want getters and setters and iterators and magic. Submitted by Dave Engberg

Reviewed By: dreiss


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665239 13f79535-47bb-0310-9956-ffa450edef68
2007-08-31 00:55:28 +00:00
David Reiss
6ce97e3d8d Thrift: Forgot to commit these fixes.
Summary:
Small git error.  These changes should have gone in my last commit.

Reviewed By: mcslee

Test Plan: Same as the last one.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665238 13f79535-47bb-0310-9956-ffa450edef68
2007-08-30 23:18:31 +00:00
David Reiss
9885c6801d Thrift: Generate fingerprints for non-structs.
Summary:
This is going to be needed to support TDenseProtocol.

Reviewed By: mcslee

Test Plan:
Clean build of Thrift.
Ran if/regen.sh.  No change to generated C++ or Python.
gdb thrift -cpp ThriftTest.thrift.  Made sure they were being generated.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665237 13f79535-47bb-0310-9956-ffa450edef68
2007-08-30 23:12:37 +00:00
David Reiss
5db3e92671 Thrift: Handle absence of fastbinary.so
Summary:
- Wrap import of fastbinary in a try/catch, setting it to None if it fails.
- Don't try to fastbinary.encode/decode if fastbinary is None.
- Always generate thrift_spec, even if it is None.
- Don't try to fastbinary.encode/decode if thrift_spec is None.

Reviewed By: mcslee

Test Plan:
test/py/Test{Client,Server}.py
Manually delete my fastbinary.so, they worked fine.
Changed them to use Accelerated protocol.  They still worked fine because
the test falls through to the normal generated code.
Installed fastbinary.so, everything worked fine (eventually).

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665236 13f79535-47bb-0310-9956-ffa450edef68
2007-08-30 23:07:45 +00:00
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