Commit Graph

870 Commits

Author SHA1 Message Date
Bryan Duxbury
9e34741004 THRIFT-489. java: Java enum validation only validates explicitly assigned values
This patch puts all of an enum's values into the valid values set, fixing validation. 



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@780091 13f79535-47bb-0310-9956-ffa450edef68
2009-05-29 20:15:02 +00:00
Bryan Duxbury
32194ab442 THRIFT-501. rb: File.dirname(...) requires cause warnings in some scenarios
This patch removes the File.dirname usage. Instead, you should put the directory that contains your _types.rb into the load path.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@776800 13f79535-47bb-0310-9956-ffa450edef68
2009-05-20 18:22:19 +00:00
Bryan Duxbury
1cc7a1369e THRIFT-485. rb: Generated validate methods that reference external thrift files' types are not referenced correctly
This patch fully qualifies type names in two spots.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@771964 13f79535-47bb-0310-9956-ffa450edef68
2009-05-05 18:50:26 +00:00
Andrew McGeachie
853bdfea38 THRIFT-60. Make generated constants object extend NSObject.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@771514 13f79535-47bb-0310-9956-ffa450edef68
2009-05-05 00:44:48 +00:00
David Reiss
4f3192093d THRIFT-471. python: Generated exceptions should implement __str__
This makes Python stack dumps properly show the exception content.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@770002 13f79535-47bb-0310-9956-ffa450edef68
2009-04-29 23:35:01 +00:00
David Reiss
1cc8995c14 THRIFT-463. python: Fix thrift_spec ordering bug from r760201
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@769123 13f79535-47bb-0310-9956-ffa450edef68
2009-04-27 19:36:50 +00:00
T Jake Luciani
fae0e78158 THRIFT-460: fixes constant structs
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@766933 13f79535-47bb-0310-9956-ffa450edef68
2009-04-21 00:50:11 +00:00
Bryan Duxbury
4650144f52 THRIFT-451. rb: ruby structs use lowercase enum while modules are capitalized
This patch updates the full_type_name call so it capitalizes a type before it's appended to the module prefix. 



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@764549 13f79535-47bb-0310-9956-ffa450edef68
2009-04-13 18:12:07 +00:00
Bryan Duxbury
256f704d9d THRIFT-445. rb: client and processor do not inherit from the proper namespace scope
This patch adds namespace support to a client and processor extended from an included thrift def with its own namespace. 



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@764540 13f79535-47bb-0310-9956-ffa450edef68
2009-04-13 17:48:23 +00:00
Bryan Duxbury
ff219acb6c THRIFT-236. Structs should be serialized in a consistent order
2nd try at this issue. This time, we will use numeric field order ONLY for the serialization portion, instead of globally. This should make it much easier to produce the correctly ordered output in all cases. 

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@764072 13f79535-47bb-0310-9956-ffa450edef68
2009-04-10 21:51:00 +00:00
David Reiss
ebb6cc4cf1 THRIFT-445. Revert r760201 "THRIFT-236. Sort fields in id order during parsing"
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@763786 13f79535-47bb-0310-9956-ffa450edef68
2009-04-09 20:02:56 +00:00
Bryan Duxbury
def30a6072 THRIFT-387. Add appropriate Apache header to all code files
This hits all the documentation and some misc code files that have avoided the license up to this point.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@763048 13f79535-47bb-0310-9956-ffa450edef68
2009-04-08 00:19:37 +00:00
Bryan Duxbury
0781f2b549 THRIFT-407. hs: Refactor and improve Haskell-related code
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@763031 13f79535-47bb-0310-9956-ffa450edef68
2009-04-07 23:29:42 +00:00
Kevin Clark
ffd4bafc7f THRIFT-431. rb: Capitalize namespace values
Author: Michael Stockton

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@763022 13f79535-47bb-0310-9956-ffa450edef68
2009-04-07 22:47:34 +00:00
David Reiss
2bcf3995ef THRIFT-427. java: Fix print_const_value
Simplify it a bit in the process, because the beans-style setters
are produced even in non-beans mode, and they handle isset internally.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@762956 13f79535-47bb-0310-9956-ffa450edef68
2009-04-07 20:51:37 +00:00
Kevin Clark
19f8d1febe Thrift-421. rb: Underscore output file names and require file statments
Breaks compatiblity

Author: Michael Stockton

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@762907 13f79535-47bb-0310-9956-ffa450edef68
2009-04-07 19:09:28 +00:00
Bryan Duxbury
9b1f5a6f1a THRIFT-422. rb: scope all references to the Thrift module
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@762620 13f79535-47bb-0310-9956-ffa450edef68
2009-04-07 04:40:50 +00:00
Bryan Duxbury
d1d1542e1e THRIFT-276. rb: Ruby libraries should have one class per file
This monster of a patch moves all the classes into their own files and specs as appropriate. Additionally, it concentrates all the requires into thrift.rb, removing the need to require any other file. (Changes were made to the compiler to reflect this reduced requirement.)

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@761849 13f79535-47bb-0310-9956-ffa450edef68
2009-04-04 00:58:03 +00:00
Bryan Duxbury
a145b4d58a THRIFT-423. -strict should turn omitted field ids into compile error
Issue name says it all.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@761736 13f79535-47bb-0310-9956-ffa450edef68
2009-04-03 17:29:25 +00:00
David Reiss
7247b8cfd6 cpp: Fix compiler and library compilation with newer glibc
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@761464 13f79535-47bb-0310-9956-ffa450edef68
2009-04-02 23:05:40 +00:00
David Reiss
bb4613629b THRIFT-420. Warn on implicit (negative) structure field ids
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@761391 13f79535-47bb-0310-9956-ffa450edef68
2009-04-02 19:23:59 +00:00
David Reiss
deda141392 THRIFT-388. Create a "ONEWAY" message type that is an alias for "CALL"
Pave the way for a new message type for oneway function calls.
For now, just define the constant in all languages and make
server implementations treat it the same way as a normal call.
Only C++ and Erlang currently check the message type (on the
server side).

There is a little bit of redundancy in the Erlang code, but
the alternative is a bit gross, and this split-up will be
necessary eventually when we start handling one-way calls
differently.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@761389 13f79535-47bb-0310-9956-ffa450edef68
2009-04-02 19:22:31 +00:00
David Reiss
566a987dac THRIFT-236. Sort fields in id order during parsing
This effectively eliminates the notion of "IDL-order".
All structs have their fields sorted in increasing order of field id.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@760201 13f79535-47bb-0310-9956-ffa450edef68
2009-03-30 22:24:30 +00:00
David Reiss
ea2cba8ba8 THRIFT-387. Add license headers to a bunch of files
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@760189 13f79535-47bb-0310-9956-ffa450edef68
2009-03-30 21:35:00 +00:00
David Reiss
64f87529db THRIFT-412. python: Fix some syntacticaly-incorrect code generation
r758558 introduced a but that caused some of the generated docstrings
to be indented incorrectly, resulting in syntactically invalid code.
This commit fixes the indentation.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@760118 13f79535-47bb-0310-9956-ffa450edef68
2009-03-30 19:31:36 +00:00
David Reiss
82e6fc0266 THRIFT-153. Proper handling of strings with escapes (in IDL)
- Recognize and parse escape characters in .thrift files.
- Escape strings used as constants in generated source files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758922 13f79535-47bb-0310-9956-ffa450edef68
2009-03-26 23:32:36 +00:00
David Reiss
4a05434d0b Make vim recognize that "thriftl.ll" is Lex source
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758921 13f79535-47bb-0310-9956-ffa450edef68
2009-03-26 23:32:27 +00:00
David Reiss
885c82d75a THRIFT-282. Generate doccstrings for Python classes
Docstrings are generated for
  - enums (but not enum members)
  - structures and structure fields
  - service interfaces
  - functions and function arguments


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758558 13f79535-47bb-0310-9956-ffa450edef68
2009-03-26 08:40:55 +00:00
David Reiss
39aa00d2e0 THRIFT-282. Move generate_docstring_comment to t_generator
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758556 13f79535-47bb-0310-9956-ffa450edef68
2009-03-26 08:40:18 +00:00
David Reiss
cecbed81c8 THRIFT-136. s/async/oneway/ in the Thrift IDL
This is the real change.  The lexer now recognizes "oneway"
and warns on "async".  All example and test IDLs have been
updated, as have the syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757994 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 20:02:22 +00:00
David Reiss
fe931d1526 THRIFT-136. s/async/oneway/ in Erlang
This is kind of a bummer because it requires a simultaneous
code regeneration and library upgrade, and possibly also a
server restart.  I'm not sure if it is worth it, since the
only benefit is a little code clarity.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757993 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 20:02:08 +00:00
David Reiss
6ce401dd55 THRIFT-136. s/async/oneway/ in misc places
This is mostly an internal-only change.
It affects docstrings, messages, variables, test cases, etc.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757992 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 20:01:58 +00:00
David Reiss
c51986f438 THRIFT-136. s/async/oneway/ in comments
This is an internal-only change.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757990 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 20:01:25 +00:00
David Reiss
473292500d THRIFT-136. s/async/oneway/ in compiler variables
This is an internal-only change.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757989 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 20:01:02 +00:00
David Reiss
6985a4205b THRIFT-136. s/async/oneway/ in lexer and parser variables
This is an internal-only change.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757988 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 20:00:47 +00:00
Kevin Clark
4798a7ad12 THRIFT-399. hs: Fix set and number issues in generated constant code
Author: Spiridon Eliopoulos


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757864 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 15:56:19 +00:00
Kevin Clark
38c8b5b92a THRIFT-398. hs: Remove unnecessary parens from generated type annotations
Author: Spiridon Eliopoulos


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757825 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 14:51:51 +00:00
Kevin Clark
db3a83a799 THRIFT-397. hs: Remove unnecessary redefinition of generate_program()
Author: Spiridon Eliopoulos


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757824 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 14:47:31 +00:00
Bryan Duxbury
2ad9eb7c5e THRIFT-382. java: Unused imports in generated code
Regrouped some of the imports and removed ones that will never be used.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757623 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 00:43:33 +00:00
Bryan Duxbury
f3c83cf88e THRIFT-385. hs: 64-bit integer and double types incorrectly serialized on 32-bit platforms
Use 64-bit types where appropriate.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757619 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 00:34:16 +00:00
Bryan Duxbury
ff58a9aecd THRIFT-266. erlang: Erlang atoms must always start with lower-case character
Forces first char of atom to lowercase for struct fields.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757617 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 00:28:40 +00:00
Bryan Duxbury
13083d6d52 THRIFT-294. Remove @author tags
They're gone. Don't add any new ones!



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@756307 13f79535-47bb-0310-9956-ffa450edef68
2009-03-20 02:19:46 +00:00
Bryan Duxbury
afa1b47e60 THRIFT-245. rb: FIELDS constant should contain name of enumerated type for enum fields
This patch adds the :enum_class key to FIELDS entries that are enums. 



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@756295 13f79535-47bb-0310-9956-ffa450edef68
2009-03-20 01:51:16 +00:00
David Reiss
1f804a80c2 THRIFT-384. csharp: Fix handling of fields named "value"
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@756179 13f79535-47bb-0310-9956-ffa450edef68
2009-03-19 20:33:15 +00:00
David Reiss
00a8dd633c THRIFT-361. Use separate negative id counters for arguments and exceptions
NOTE:
This will break wire-compatibility, but only with functions that have
both negative-id arguments and negative id-exceptions, and only in the
exceptional case.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755870 13f79535-47bb-0310-9956-ffa450edef68
2009-03-19 08:14:12 +00:00
Bryan Duxbury
3696d643d0 THRIFT-379. java: Print enum value names
This patch adds a new generated map of enum values to their respective names to each generated enum class, and then consumes that in the toString method to print the names when possible.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755464 13f79535-47bb-0310-9956-ffa450edef68
2009-03-18 03:14:56 +00:00
Bryan Duxbury
97592b40b1 THRIFT-278. java: #validate exceptions should contain the offending value
This patch causes validate to throw exceptions that contain the bad field value as well as the field name. I had to modify it slightly from the patch on the issue to conform with the new style isset checks.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755454 13f79535-47bb-0310-9956-ffa450edef68
2009-03-18 01:50:50 +00:00
Bryan Duxbury
65f7e60b7b THRIFT-365. html: HTML compiler infinite loop
Trivial fix for 64-bit systems.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755413 13f79535-47bb-0310-9956-ffa450edef68
2009-03-17 21:55:36 +00:00
Bryan Duxbury
42336c19b2 THRIFT-368. java: setFieldValue should allow nulls for all field types
After this patch, setFieldValue will treat a set with a null as an unset.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@753337 13f79535-47bb-0310-9956-ffa450edef68
2009-03-13 18:28:40 +00:00
Bryan Duxbury
56c4836220 THRIFT-364. java: Use of enums in other namespaces breaks java generated code
This patch checks for different namespaces and prefixes appropriately.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@752696 13f79535-47bb-0310-9956-ffa450edef68
2009-03-11 23:40:57 +00:00
Bryan Duxbury
e3c3d19c7a THRIFT-359. java: nocamel style breaks generated services
This patch makes the generated code respect the nocamel option.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@751180 13f79535-47bb-0310-9956-ffa450edef68
2009-03-07 03:08:37 +00:00
Bryan Duxbury
f4d6fa408f THRIFT-358. ruby: Change how external thrift files' generated code is required
Generated code that relies on included thrift files now doesn't assume the path will be the same.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@750667 13f79535-47bb-0310-9956-ffa450edef68
2009-03-05 23:11:37 +00:00
Kevin Clark
af99b5c398 THRIFT-352. rb: Implicit enums should be valid values
Author: Gary Tsang

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@750171 13f79535-47bb-0310-9956-ffa450edef68
2009-03-04 21:42:46 +00:00
Kevin Clark
c289608e19 THRIFT-353. rb: Capitalize module names on ruby generation
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@750160 13f79535-47bb-0310-9956-ffa450edef68
2009-03-04 21:32:54 +00:00
Kevin Clark
120ff31d11 THRIFT-148. py: Add support for Twisted
Author: Esteve Fernandez

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@749510 13f79535-47bb-0310-9956-ffa450edef68
2009-03-03 02:25:50 +00:00
Bryan Duxbury
f4c71c73d0 THRIFT-116. java: Isset fields for non-primitive types unnecessary
Prior commit on this issue was missing a !.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@747090 13f79535-47bb-0310-9956-ffa450edef68
2009-02-23 17:49:24 +00:00
Bryan Duxbury
f9d105c519 THRIFT-116. java: Isset fields for non-primitive types unnecessary
Missed one of the cases where isset was being used on non-primitive fields.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@746429 13f79535-47bb-0310-9956-ffa450edef68
2009-02-21 01:57:46 +00:00
Bryan Duxbury
d11f2411e2 THRIFT-116. java: Isset fields for non-primitive types unnecessary
This patch gets rid of the __isset fields for non-primitives and updates ToStringTest and EqualityTest appropriately.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@746000 13f79535-47bb-0310-9956-ffa450edef68
2009-02-19 21:21:44 +00:00
David Reiss
554ea6f936 Make the PHP generator use non-hardcoded namespaces.
- Make the PHP generator use program->get_namespace("php")
  instead of program->get_php_namespace()
- Eliminate the explicit "php_namespace" in t_program.
- Deprecate the php_namespace token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745241 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:37 +00:00
David Reiss
32272d9bd8 Allow the Thrift compiler to be built without the PHP generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-php
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745240 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:30 +00:00
David Reiss
bba692833d Remove t_php_generator.h.
t_php_generator.h is no longer included anywhere, because
the PHP 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@745239 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:28 +00:00
David Reiss
a9ea68b907 Make the PHP generator dynamic.
- Modify the PHP generator constructor to fit the new generic interface.
- Register the PHP genrator with the central registry.
- Deprecate the old way of invoking the PHP generator.
- main.cc no longer includes t_php_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745238 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:24 +00:00
David Reiss
92e10d8297 Make the XSD generator use non-hardcoded namespaces.
- Make the XSD generator use program->get_namespace("xsd")
  instead of program->get_xsd_namespace()
- Eliminate the explicit "xsd_namespace" in t_program.
- Deprecate the xsd_namespace token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745237 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:19 +00:00
David Reiss
782cb67a3b Allow the Thrift compiler to be built without the XSD generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-xsd
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745236 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:13 +00:00
David Reiss
3ac5b6aa85 Remove t_xsd_generator.h.
t_xsd_generator.h is no longer included anywhere, because
the XSD 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@745235 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:10 +00:00
David Reiss
4ba6710ea1 Make the XSD generator dynamic.
- Modify the XSD generator constructor to fit the new generic interface.
- Register the XSD genrator with the central registry.
- Deprecate the old way of invoking the XSD generator.
- main.cc no longer includes t_xsd_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745234 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:06 +00:00
David Reiss
f3b0db3735 Allow the Thrift compiler to be built without the Erlang generator.
- Use AX_THRIFT_GEN to make configure support --disable-gen-erl
- Update the compiler Makefile.am to exclude the generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745233 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:01 +00:00
David Reiss
9f16d78553 Remove t_erl_generator.h.
t_erl_generator.h is no longer included anywhere, because
the Erlang 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@745232 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:27:58 +00:00
David Reiss
a204783a06 Make the Erlang generator dynamic.
- Modify the Erlang generator constructor to fit the new generic interface.
- Register the Erlang genrator with the central registry.
- Deprecate the old way of invoking the Erlang generator.
- main.cc no longer includes t_erl_generator.h.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745231 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:27:54 +00:00
David Reiss
bbbbe880a0 THRIFT-325. Include t_generator.h in main.cc
I'm about to remove all of the generator includes, but we'll still need
the generic header for the generator registry and interface.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745230 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:27:48 +00:00
David Reiss
d831a21773 THRIFT-309. Make Thrift's C# mapping .NET 2.0 (Mono 1.2.4) compatible
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@743963 13f79535-47bb-0310-9956-ffa450edef68
2009-02-13 03:09:52 +00:00
Bryan Duxbury
30e1de9fd5 THRIFT-316. java: @Override isn't generated for hashCode() without the hash code builder
Fixed with a trivial reorganization of the hashCode method generation.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@743046 13f79535-47bb-0310-9956-ffa450edef68
2009-02-10 18:36:56 +00:00
Bryan Duxbury
c707855048 THRIFT-318. java: Performance of HashSet for enumeration VALID_VALUES seems poor
Instead of a HashSet, enums will now use the special IntRangeSet implementation. 

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@743037 13f79535-47bb-0310-9956-ffa450edef68
2009-02-10 18:10:57 +00:00
David Reiss
6ad6251951 java: Fix a minor formatting problem in the gen-code
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@742192 13f79535-47bb-0310-9956-ffa450edef68
2009-02-08 22:46:38 +00:00
Bryan Duxbury
bb7826da70 THRIFT-10. java: Descriptors used during serialization should be immutable objects
-Descriptor classes all have final members, making them immutable.
-Generated structs now have static constant versions of their TStruct and TField descriptors, and will be used during writing.
-Protocols that can benefit use static constants for various common returned descriptors.
-A duplicate FieldMetaData.java that should have been removed previously was also removed.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@741984 13f79535-47bb-0310-9956-ffa450edef68
2009-02-08 00:12:38 +00:00
Bryan Duxbury
f28f82631a THRIFT-159. csharp: Compiler doesn't add package scope to exceptions in catch blocks and assigns to unused local var when reading
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@741917 13f79535-47bb-0310-9956-ffa450edef68
2009-02-07 17:17:43 +00:00
David Reiss
a7fc092ee1 THRIFT-256. python: Fix inheritance of services in the same IDL file
The old version of type_name did not fully qualify parent service names
when they were defined in the same IDL file, but it is necessary because
they end up in different Python files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@741833 13f79535-47bb-0310-9956-ffa450edef68
2009-02-07 02:37:09 +00:00
David Reiss
8cee47cf5e THRIFT-310. python: Generate valid code for empty services
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@741832 13f79535-47bb-0310-9956-ffa450edef68
2009-02-07 02:37:05 +00:00
David Reiss
0b7d6fa5ee THRIFT-314. Purge reflection.limited
This was a feature designed to allow a Thrift server to report
information about its interface.  However, the feature has
significant design problems, and is presence is currently causing
confusion without doing any good.  Therefore, it is being removed.
It will always be in source control if and when we are ready to
come back to it.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@741824 13f79535-47bb-0310-9956-ffa450edef68
2009-02-07 02:36:35 +00:00
Bryan Duxbury
d20a1d3619 THRIFT-303. java: Changes to __isset interface
This patch makes __isset always private and adds a method per field to set the __isset state when not using the bean-style generator.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@741805 13f79535-47bb-0310-9956-ffa450edef68
2009-02-07 01:08:58 +00:00
Bryan Duxbury
3d0abc36a9 THRIFT-132. ruby: Ruby generator should use ::Thrift::Foo namespace form
All of the Thrift library includes now prefix with ::.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@740377 13f79535-47bb-0310-9956-ffa450edef68
2009-02-03 19:18:57 +00:00
Bryan Duxbury
f5383b663e THRIFT-297. java: getFieldValue and setFieldValue should be abstract TBase methods
This patch makes getFieldValue, setFieldValue, and isSet TBase interface methods, and adds all the previously beans-only getters and setters to all Java generated classes. 

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@740169 13f79535-47bb-0310-9956-ffa450edef68
2009-02-03 00:49:25 +00:00
Bryan Duxbury
056bcb6947 THRIFT-178. java, csharp, cpp: Final Keyword
The lexer has been changed to make "final" a non-reserved word, and the java, csharp, and cpp compilers now look for the final annotation and amend their class declarations appropriately.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739788 13f79535-47bb-0310-9956-ffa450edef68
2009-02-01 16:56:29 +00:00
David Reiss
c2c8ad8f0b THRIFT-259. html: Generate "extends" link for extended services
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739700 13f79535-47bb-0310-9956-ffa450edef68
2009-02-01 05:36:10 +00:00
David Reiss
4704d4383c THRIFT-285. python: Don't generate _result structs for async functions
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739668 13f79535-47bb-0310-9956-ffa450edef68
2009-02-01 00:42:10 +00:00
T Jake Luciani
b5e6221eb5 THRIFT-270: change cpp namespaces from facebook::thrift to apache::thrift
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739644 13f79535-47bb-0310-9956-ffa450edef68
2009-01-31 22:36:20 +00:00
Bryan Duxbury
796381d857 THRIFT-290. java: Metadata map doesn't properly reference external thrift file's types
The code generator now uses full namespaces to refer to the classes.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739045 13f79535-47bb-0310-9956-ffa450edef68
2009-01-29 22:13:56 +00:00
Bryan Duxbury
9f427ee0e1 THRIFT-288. java: Generated code iterates maps during write inefficiently
Newly generated code will now use entrySet instead of keySet when serializing maps. Existing generated classes does not need to be regenerated, though they won't reap the performance improvements unless they do.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@738765 13f79535-47bb-0310-9956-ffa450edef68
2009-01-29 05:47:21 +00:00
Bryan Duxbury
1f6302fab0 THRIFT-218. java: When validation fails on serialization/deserialization, print out the invalid object
The error thrown when validation fails now contains the toString output.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@738764 13f79535-47bb-0310-9956-ffa450edef68
2009-01-29 05:38:10 +00:00
Bryan Duxbury
986d705578 THRIFT-253. java: Enhance FieldMetaData
The code generator new creates a static map of field id to metadata for each field, including information like the field TType, class of embedded structs, required/optional/default, etc. Additionally, on loading, generated classes statically register their class and metadata map with the global FieldMetaData map, so you can get the metadata for any TBase-implementing class easily.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@738708 13f79535-47bb-0310-9956-ffa450edef68
2009-01-29 01:51:08 +00:00
Bryan Duxbury
369417a5f1 THRIFT-239. java: Generate @Override annotations for all overrided methods
equals, toString, clone, and hashcode now all have a preceeding @Override annotation.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@738270 13f79535-47bb-0310-9956-ffa450edef68
2009-01-27 22:09:33 +00:00
Bryan Duxbury
8bbd8447b9 THRIFT-223 Validate method should check that enum types are assigned valid values
Enum classes now get a VALID_VALUES Set that contains all of the acceptable values. Structs' validate() method has been extended to compare an enum field's value to the valid value set, but only if the __isset flag for that field is true, meaning that non-beans generated code will not perform this validity check unless the __isset flag is manually maintained.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@735910 13f79535-47bb-0310-9956-ffa450edef68
2009-01-20 01:54:14 +00:00
Bryan Duxbury
46b77c4be6 THRIFT-224 Validate method should check that enum types are assigned valid values
Each generated enumeration type will now have a VALID_VALUES Set as a static member that contains all the values of the enumeration.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@735167 13f79535-47bb-0310-9956-ffa450edef68
2009-01-16 22:34:40 +00:00
Bryan Duxbury
afa80ea73d THRIFT-34 Java libraries should be namespaced under org.apache.thrift, not com.facebook.thrift
Library classes and tests have been moved to the proper package and directory structure, and references to com.facebook.thrift where replaced with org.apache.thrift throughout the code. The fb303 contrib project still contains com.facebook packages.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@734855 13f79535-47bb-0310-9956-ffa450edef68
2009-01-15 23:47:51 +00:00
David Reiss
46bb4aeb5e THRIFT-242. python: Used named arguments in __init__ instead of a dict
This is a wire-compatible but non-source-compatible change.
When initializing structures, you must use

Foo(bar=1, baz="qux")
Foo(**{"bar": 1, "baz": "qux"})

instead of

Foo({"bar": 1, "baz": "qux"})


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@734536 13f79535-47bb-0310-9956-ffa450edef68
2009-01-14 22:34:15 +00:00
David Reiss
7bcf866c16 THRIFT-249. java: Add @param lines to function docstrings
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@732116 13f79535-47bb-0310-9956-ffa450edef68
2009-01-06 20:54:27 +00:00
David Reiss
c654416843 THRIFT-129. csharp: Make all Thrift structures extend TBase
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@732081 13f79535-47bb-0310-9956-ffa450edef68
2009-01-06 19:49:33 +00:00
David Reiss
b0f31ef92f THRIFT-46. csharp: Throw the correct exception for an unknown method
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@732080 13f79535-47bb-0310-9956-ffa450edef68
2009-01-06 19:49:29 +00:00
David Reiss
6319133cac THRIFT-25. csharp: Various compiler and library improvements
Compiler:
- Thrift structures are serializable.
- The member fields of thrift structures are now private and only accessible
  through Properties, which keep the appropriate __isset up to date.

Library
- Addition of TBufferedTransport, which can be used to wrap other Transports.
- Addition of TThreadedServer, which manually manages threads instead of
  relying on .NET ThreadPool.
- Servers use a log delegate that defaults to System.Console but allows
  servers to use log4net without introducing the dependency.

ThriftTest Visual Studio Project
- Test client and server that use ThriftTest.thrift. The project references
  thrift.exe and Thrift.dll from the subversion tree and automatically builds
  generated code. This makes it very easy to test changes in both the compiler
  and library.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@732079 13f79535-47bb-0310-9956-ffa450edef68
2009-01-06 19:49:22 +00:00
Kevin Clark
d6b7182df5 THRIFT-246. rb: Generate #struct_fields rather than reflect.
Author: Bryan Duxbury


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@731806 13f79535-47bb-0310-9956-ffa450edef68
2009-01-06 01:34:28 +00:00
Kevin Clark
41baeaba96 THRIFT-157. rb: Quote strings and qualify class names properly
Author: Dave Engberg


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@731763 13f79535-47bb-0310-9956-ffa450edef68
2009-01-05 23:10:17 +00:00
David Reiss
8eaebfedc1 THRIFT-235. java: Explicitly cast integer constants to double
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@731723 13f79535-47bb-0310-9956-ffa450edef68
2009-01-05 21:03:01 +00:00
David Reiss
25be92bf0d THRIFT-222. java: Better exposure if __isset in beans style
- Generate an isSet method for each field to test its set-ness.
- Generate a generic isSet method that checks by field id.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@731722 13f79535-47bb-0310-9956-ffa450edef68
2009-01-05 21:02:58 +00:00
David Reiss
2db737df8f java: Add a helper function to implement nocamel style
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@731721 13f79535-47bb-0310-9956-ffa450edef68
2009-01-05 21:02:55 +00:00
David Reiss
b936ffdbd1 THRIFT-191. java: Create a static field id -> name map for each struct
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@731720 13f79535-47bb-0310-9956-ffa450edef68
2009-01-05 21:02:52 +00:00
David Reiss
5455f00348 THRIFT-138. java: Fix copy constructor for binary fields
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@731719 13f79535-47bb-0310-9956-ffa450edef68
2009-01-05 21:02:48 +00:00
David Reiss
888f88b05d THRIFT-241. python: Generate a better implementation of __repr__
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@731685 13f79535-47bb-0310-9956-ffa450edef68
2009-01-05 20:14:52 +00:00
T Jake Luciani
41687fc6cf THRIFT-193: Patch for proper namespace support in perl compiler
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@728863 13f79535-47bb-0310-9956-ffa450edef68
2008-12-23 03:45:43 +00:00
David Reiss
a8efac862a THRIFT-225. java/cpp: Handle non-i32 integer constants properly
Java generates a warning when converting from an integer constant
to a byte or short without an explicit cast.  This change adds a
cast to byte and short literals in Java.

Both Java and C++ fail to compile integer literals larger than 2^31
unless they are decorated with "L" (for Java) or "LL" (for g++).
This change adds the appropriate decorations.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@727130 13f79535-47bb-0310-9956-ffa450edef68
2008-12-16 20:28:13 +00:00
David Reiss
a230999667 THRIFT-121. Support arbitrary type annotations
Adds syntax for attaching arbitrary key/value pairs to types.
These annotations can be accessed by individual generators to alter
the code they produce.

This version supports annotations on container types and structures.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@724954 13f79535-47bb-0310-9956-ffa450edef68
2008-12-10 01:52:48 +00:00
David Reiss
603d50437c THRIFT-138. java: Create deep-copy constructors for Thrift structs
- Create a copy constructor for every Thrift struct.  The constructor
  performs a deep copy on the argument, resulting in no shared state.
- Make thrift structions implement Cloneable and implement .clone()
  using the copy constructor.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@722332 13f79535-47bb-0310-9956-ffa450edef68
2008-12-02 02:06:31 +00:00
David Reiss
fd71808e35 THRIFT-142. java: Better handling of required fields
- On reading, behave the same way as the C++ code:
  throw an exception if a required field is missing.
- In addition, throw an exception if a required field is missing
  when writing.  For the JavaBeans code, this means that __isset
  is false (because it is maintained automatically).  For non-beans
  code, this means that the field is null.  Non-nullable fields are
  not checked in non-beans code.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@719727 13f79535-47bb-0310-9956-ffa450edef68
2008-11-21 21:55:52 +00:00
David Reiss
e31b77e90e THRIFT-194. cpp: Properlyl namespace exception types in catch
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@719721 13f79535-47bb-0310-9956-ffa450edef68
2008-11-21 21:36:41 +00:00
David Reiss
30a9360e3f THRIFT-172. java: Improve toString output for binary fields
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@719720 13f79535-47bb-0310-9956-ffa450edef68
2008-11-21 21:31:36 +00:00
David Reiss
7f5e184785 THRIFT-139. java: Fix indentation in beans mode
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@719701 13f79535-47bb-0310-9956-ffa450edef68
2008-11-21 20:25:14 +00:00
David Reiss
466b3fafcd Remove compiler/cpp/version.h in "make clean"
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@719380 13f79535-47bb-0310-9956-ffa450edef68
2008-11-20 21:24:32 +00:00
Kevin Clark
031baf7086 Merge branch 'THRIFT-143'
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@714070 13f79535-47bb-0310-9956-ffa450edef68
2008-11-14 17:11:39 +00:00
Kevin Clark
159383f789 rb: raise if an object is serialized without required fields [THRIFT-143]
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@712945 13f79535-47bb-0310-9956-ffa450edef68
2008-11-11 05:46:04 +00:00
Kevin Clark
cfca336fad rb: Add docstrings to generated ruby code [THRIFT-147]
Author: Bryan Duxbury


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@709309 13f79535-47bb-0310-9956-ffa450edef68
2008-10-31 00:32:25 +00:00
David Reiss
f33e03c6fa THRIFT-179. java: Include per-field docstrings in generated code
This also involves refactoring a bit of the functionality into
t_oop_generator.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@708737 13f79535-47bb-0310-9956-ffa450edef68
2008-10-29 00:07:49 +00:00
David Reiss
f011bd4312 Make t_field inherit from t_doc instead of reimplementing it
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@708736 13f79535-47bb-0310-9956-ffa450edef68
2008-10-29 00:07:45 +00:00
David Reiss
66f5e9ba0b Make a pointer const to fix a warning
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@707213 13f79535-47bb-0310-9956-ffa450edef68
2008-10-22 22:07:03 +00:00
David Reiss
80096e278c Add a missing include to fix compilation on Ubuntu 8.10
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@707212 13f79535-47bb-0310-9956-ffa450edef68
2008-10-22 22:07:00 +00:00
David Reiss
dc0aada961 THRIFT-173. Commit the html generator
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@706466 13f79535-47bb-0310-9956-ffa450edef68
2008-10-21 00:09:23 +00:00
Kevin Clark
7dc7f75e7c rb: Create constants for field ids in generated structs [THRIFT-165]
Author: Bryan Duxbury


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@705330 13f79535-47bb-0310-9956-ffa450edef68
2008-10-16 19:15:20 +00:00
David Reiss
31997ca9ee THRIFT-139. java: Expose field ids in more useful ways
- Define constants in each structure class that provide access to the
  field ids by name (at compile time).  Use them for (de)serialization.
- For beans-mode code, generate a generic getter and setter for accessing
  fields by field id.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@703028 13f79535-47bb-0310-9956-ffa450edef68
2008-10-09 00:08:46 +00:00
David Reiss
a0b4409f57 THRIFT-152. java: Set isset appropriately in structure constructors
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@702697 13f79535-47bb-0310-9956-ffa450edef68
2008-10-08 04:49:25 +00:00
David Reiss
8684554e29 THRIFT-119. java: structs' toString omits unset optional fields
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@700860 13f79535-47bb-0310-9956-ffa450edef68
2008-10-01 18:32:47 +00:00
David Reiss
931d69be9e THRIFT-120. java: Make the nocamel option work for more methods
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@700668 13f79535-47bb-0310-9956-ffa450edef68
2008-10-01 03:24:54 +00:00
David Reiss
5af01bcbdc THRIFT-100. java: Set __isset better in beans style
When setX(null) is called on a structure, set __isset.x to false.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@700667 13f79535-47bb-0310-9956-ffa450edef68
2008-10-01 03:24:50 +00:00
Mark Slee
6341d13a1f Python generator exception namespacing, THRIFT-150
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@700277 13f79535-47bb-0310-9956-ffa450edef68
2008-09-29 22:01:30 +00:00
Kevin Clark
5ad6d4a7e3 rb: Add pretty inspect, optional field hint for Thrift::Struct
Author: Bryan Duxbury


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@689193 13f79535-47bb-0310-9956-ffa450edef68
2008-08-26 20:02:07 +00:00
David Reiss
400a543b04 THRIFT-91. cpp: Fix compilation on Fedora Core 9
It turns out that __STDC_LIMIT_MACROS is not portable.
Include limits.h at least until cstdint becomes mainstream.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@679885 13f79535-47bb-0310-9956-ffa450edef68
2008-07-25 19:48:39 +00:00
David Reiss
70e329f0b8 java: Add nocamel option to not CamelCase field accessors [THRIFT-42]
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@676699 13f79535-47bb-0310-9956-ffa450edef68
2008-07-14 19:35:50 +00:00
David Reiss
aabfa63c47 (THRIFT-40) Remove stray \n's from the generated version.h
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@672945 13f79535-47bb-0310-9956-ffa450edef68
2008-06-30 22:27:29 +00:00
David Reiss
4d8edc5269 (THRIFT-40) Fix compilation and version string on OS X.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@672943 13f79535-47bb-0310-9956-ffa450edef68
2008-06-30 21:55:52 +00:00
David Reiss
f14541626d Partial handlling of 64-bit integer constants.
- Parse integer constants in Thrift files as 64-bit ints.
- Die if an overflow occurs.
- Warn if an enum value cannot fit in 32 bits.
- Add a simple test for the above.

I ran all of the generators over BrokenConstants.thrift before adding the
overflow, and they appeared to work.  However, the code generated was not
always valid (for example, the 64-bit constant must have an LL suffix in C++).


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@672907 13f79535-47bb-0310-9956-ffa450edef68
2008-06-30 20:45:47 +00:00
David Reiss
dd08f6d5a5 (THRIFT-40) Add -version switch to the compiler to show the Thrift version
The version is determined by configure.ac. After this version is shown the
revision. For subversion, it is simply the current revision as given by
`svnversion`. For git, the latest svn revision that HEAD includes is shown,
followed by the offset of HEAD from that commit, followed by a truncated sha1
for HEAD. If the offset is 0, the offset and sha1 are omitted.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@672900 13f79535-47bb-0310-9956-ffa450edef68
2008-06-30 20:24:24 +00:00
Kevin Clark
2bd3a30b91 rb: Use File.dirname(__FILE__) in generated requires [THRIFT-57]
This means you no longer have to put the gen-rb folder in $:

Author: Kevin Ballard <kevin@rapleaf.com>


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@671963 13f79535-47bb-0310-9956-ffa450edef68
2008-06-26 17:49:49 +00:00
Kevin Clark
3836f9ba35 rb: require 'thrift' first in generated service definitions [THRIFT-38]
From kevin@rapleaf.com


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@670979 13f79535-47bb-0310-9956-ffa450edef68
2008-06-24 01:05:51 +00:00
Kevin Clark
23193757bc rb: Implement type-checking in Thrift::Struct.new and field accessors
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@669015 13f79535-47bb-0310-9956-ffa450edef68
2008-06-18 01:18:07 +00:00
Kevin Clark
8d79e3f954 Convert fields of type Thrift::Types::SET to use the Set library.
Also teach Thrift::Struct how to compare itself with ==


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668959 13f79535-47bb-0310-9956-ffa450edef68
2008-06-18 01:09:15 +00:00
Kevin Clark
18e21565b3 Fix the requires generated by the compiler
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668934 13f79535-47bb-0310-9956-ffa450edef68
2008-06-18 01:03:17 +00:00
Kevin Clark
2960044415 rb: Add more classes/modules to the Thrift namespace. Provide backwards compatable mappings.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668904 13f79535-47bb-0310-9956-ffa450edef68
2008-06-18 00:54:13 +00:00
David Reiss
4d1c712ad1 Eliminate some trailing whitespace from the generated Python code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666492 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:18:03 +00:00
David Reiss
ab55ed53e3 Include limits.h in the compiler for PATH_MAX
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666491 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:17:00 +00:00
David Reiss
cc0c9e98b5 Clean up some bad/missed merges from the alterl merge.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666486 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:16:29 +00:00
David Reiss
e20b972088 [erl] fix generator to use unexpanded structs for reply_types on functions
This fixes a bug where thrift_client would return a tuple rather than a tagged record when the called function returned a struct.

Test plan:
  in tutorial client:
    Log: {sharedStruct,1,<<"RARG">>}
  instead of:
    Log: {1,<<"RARG">>}


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666482 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:15:54 +00:00
David Reiss
9f2a5d7799 Rename "alterl" to "erl".
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666481 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:15:45 +00:00
David Reiss
f2e66c1cb7 Remove all of the old Erlang stuff in preparation for renaming alterl.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666480 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:14:38 +00:00
David Reiss
1a2f2187cd Another whitespace rampage
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666477 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:14:01 +00:00
David Reiss
81b473b4a1 Fix warning in generated source for alterl bindings
Summary:
  - Was previously including both the fall-through to the base service as well as the "dummy" fallthrough function clause. This generated a warning like:

  gen-erl/redacted_thrift.erl:134: Warning: this clause cannot match because a previous clause at line 132 always matches

  Now we only include the "dummy" function if there is no base class to fall through to.

Test plan: Generated tutorial.thrift and shared.thrift, compiled without warnings

Notes: It's probably possible to have a circular inheritance graph, which would cause an infinite loop at runtime. Do we care about this?


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666423 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:58:41 +00:00
David Reiss
1d8b752971 Implement inheritance in the alterl generator
Summary:
  - Simply forwards function_info calls through to the base service

Test plan: cpiro will test it?


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666422 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:58:33 +00:00
David Reiss
cdf8d1994a Implement async_void in alterl bindings
Summary:
  - reply_type for async void functions is now async_void instead of
    the empty struct definition
  - async void functions should return "ok". otherwise the processor
    will crash and the connection will be killed. Is this behaviour
    expected?

Test Plan: tested using testAsync() in ThriftTest. Didn't used to work
           but works now


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666415 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:57:35 +00:00
David Reiss
982c72de7b Properly handle exceptions
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666384 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:33 +00:00
David Reiss
11300fe872 Properly uncapitalize package names when referencing structs
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666379 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:57:52 +00:00
David Reiss
0c9b516506 Fix generation when multiple services are in the same service definition
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666378 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:57:44 +00:00
David Reiss
76f0d11dc9 Generator for alternative erl bindings, as well as a few more changes to lib code.
- Exceptions don't work yet, but it looks like everything else does.
- Seems to work fine on our pricing service
- Code could need some cleanup


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666377 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:57:35 +00:00
David Reiss
a1e0a6f0d8 Don't generate a constants file if there are no constants (Java only).
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666372 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:43 +00:00
David Reiss
87e9ac6382 Fix a bug with initialization in JavaBean-style generated code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666371 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:34 +00:00
David Reiss
5245f40b3e Print an error instead of segfaulting with a bad compiler command line.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666370 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:26 +00:00
David Reiss
9d866ac231 Add newlines to some warning messages in the compiler.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666369 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:19 +00:00
David Reiss
0babe40d74 Fix some warnings caused by treating string literals as non-const.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666368 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:12 +00:00
David Reiss
d14f4f86d4 Fix some indentation in the PHP generator.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666366 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:55:54 +00:00
David Reiss
c0092f973d PHP Generator: Throw an exception on bad types.
Summary:
Previously, if you set a structure field to, say, an int when it was
supposed to be a container (array) or struct (object), the serialization
code would either produce corrupt output (container) or cause a fatal
error (struct).  Now they both throw exceptions.

Reviewed By: mcslee

Test Plan: Looked at generated code.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666365 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:55:46 +00:00
David Reiss
c89e4de509 Make sure list<byte> is List<Byte> in Java gen'd code.
Reviewed By: dreiss

Test Plan: Generate list<byte> into Java


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666357 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:54:32 +00:00
David Reiss
8df6c82aa7 Switch md5 implementations.
Specifically, switch from the legally-ambiguous RSA implementation to
a zlib-licensed RFC-based implementation from SourceForge.

Generated some files with "dense" and made sure the output hadn't changed.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665679 13f79535-47bb-0310-9956-ffa450edef68
2008-05-04 03:00:22 +00:00
David Reiss
de59292f38 Remove an unnecessary include of boost/lexical_cast.hpp
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665678 13f79535-47bb-0310-9956-ffa450edef68
2008-05-01 20:51:03 +00:00
David Reiss
28f298dd5d Memory-based transport rewrite.
The old implementations of the memory-based transports (TBufferedTransport,
TFramedTransport, and TMemoryBuffer) shared very little code and all worked
a bit differently.  This change unifies them all as subclasses of a single
base (TBufferBase) which handles the fast-path operations (when requests
can be satisfied by the buffer) with inline methods (that will eventually
be made nonvirtual in the template branch) and calls out to pure-virutal
methods to handle full/empty buffers.  All of the buffer-management is now
done in terms of "base and bound" pointers rather than "pos" integers.

These classes were moved to TBufferTransports.{h,cpp}.  The .h is included
in TTransportUtils for backwards compatibility.

Also added a "TShortReadTransport" to assist testing transports.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665676 13f79535-47bb-0310-9956-ffa450edef68
2008-05-01 06:17:36 +00:00
David Reiss
9a4edfa07f Properly handle constants of typedef'ed types.
Also throw an error in the compiler if we cannot generate a constant for a
declared const because of its type.  Added a test of this functionality in
ConstantsDemo.thrift.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665675 13f79535-47bb-0310-9956-ffa450edef68
2008-05-01 05:52:50 +00:00
David Reiss
372126079c Eliminate an unused local variable.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665674 13f79535-47bb-0310-9956-ffa450edef68
2008-05-01 05:52:49 +00:00
David Reiss
74672b6719 Java: In toString for generated structs, handle nulls.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665671 13f79535-47bb-0310-9956-ffa450edef68
2008-04-29 23:09:11 +00:00
David Reiss
051fbd4e57 Thrift REST parsing allows null object params
Summary: If JSON objects are passed in allow them to be null and don'\''t default construct.

Reviewed By: dreiss

Test Plan: Regenerate API code and test on object args.

Revert: OK

DiffCamp Revision: 12407


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665670 13f79535-47bb-0310-9956-ffa450edef68
2008-04-29 00:29:45 +00:00
David Reiss
739cbe2b86 Add a few missing includes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665657 13f79535-47bb-0310-9956-ffa450edef68
2008-04-15 05:44:00 +00:00
iproctor
8361bf0565 ocaml and haskell thrift clients now calling readMessageEnd
Summary: I neglected to make the call to readMessageEnd if the client read an app exception in the haskell and ocaml code. Fixed now. The test cases for both now also compile with the new ThriftTest.thrift (though haskell's is still not doing anything but echoing  the args)

Reviewed By: dreiss

Test Plan: Ran test code. This bug would actually never show up because there's only tbinaryprotocol implemented for these languages and that does nothing on a readMessageEnd.

Revert: OK

DiffCamp Revision: 11377


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665651 13f79535-47bb-0310-9956-ffa450edef68
2008-04-10 00:31:55 +00:00
David Reiss
c5c542538b Fix some indentation.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665639 13f79535-47bb-0310-9956-ffa450edef68
2008-04-03 23:16:46 +00:00
David Reiss
8bfba63dfb C#: Generate proper code for services that inherit from other services.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665632 13f79535-47bb-0310-9956-ffa450edef68
2008-04-02 22:10:13 +00:00
David Reiss
f5ece05649 Fix a segfault in the compiler.
We weren't initializing our pointers properly, resulting in
a difficult-to-trigger segfault.

Reviewed By: mcslee, bhamadani

Test Plan: Built the modified search IDL.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665627 13f79535-47bb-0310-9956-ffa450edef68
2008-04-02 00:23:31 +00:00
David Reiss
07ef3a930a Make the Perl generator use non-hardcoded namespaces.
- Make the Perl generator use program->get_namespace("perl")
  instead of program->get_perl_package()
- Eliminate the explicit "perl_package" in t_program.
- Deprecate the perl_package token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665624 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 21:42:39 +00:00
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
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