Commit Graph

391 Commits

Author SHA1 Message Date
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