You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/07/04 00:17:54 UTC

[1/2] git commit: Testcase fixed

Repository: thrift
Updated Branches:
  refs/heads/master 0cb870bac -> 12ee88170


Testcase fixed


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/9bb4c117
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/9bb4c117
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/9bb4c117

Branch: refs/heads/master
Commit: 9bb4c117aacb38e143b616bd70edb1bf1cbab883
Parents: 0cb870b
Author: Jens Geyer <je...@apache.org>
Authored: Thu Jul 3 23:05:54 2014 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Jul 4 00:11:56 2014 +0200

----------------------------------------------------------------------
 .../test/serializer/TestSerializer.Data.pas     | 104 ++++++++++---------
 lib/delphi/test/serializer/TestSerializer.dpr   |  27 ++++-
 2 files changed, 75 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/9bb4c117/lib/delphi/test/serializer/TestSerializer.Data.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/test/serializer/TestSerializer.Data.pas b/lib/delphi/test/serializer/TestSerializer.Data.pas
index 34ad4f6..30d9dd4 100644
--- a/lib/delphi/test/serializer/TestSerializer.Data.pas
+++ b/lib/delphi/test/serializer/TestSerializer.Data.pas
@@ -283,57 +283,57 @@ class function Fixtures.CreateCompactProtoTestStruct : ICompactProtoTestStruct;
 // superhuge compact proto test struct
 begin
   result := TCompactProtoTestStructImpl.Create;
-  result.A_byte := TConstants.COMPACT_TEST.A_byte;
-  result.A_i16 := TConstants.COMPACT_TEST.A_i16;
-  result.A_i32 := TConstants.COMPACT_TEST.A_i32;
-  result.A_i64 := TConstants.COMPACT_TEST.A_i64;
-  result.A_double := TConstants.COMPACT_TEST.A_double;
-  result.A_string := TConstants.COMPACT_TEST.A_string;
-  result.A_binary := TConstants.COMPACT_TEST.A_binary;
-  result.True_field := TConstants.COMPACT_TEST.True_field;
-  result.False_field := TConstants.COMPACT_TEST.False_field;
-  result.Empty_struct_field := TConstants.COMPACT_TEST.Empty_struct_field;
-  result.Byte_list := TConstants.COMPACT_TEST.Byte_list;
-  result.I16_list := TConstants.COMPACT_TEST.I16_list;
-  result.I32_list := TConstants.COMPACT_TEST.I32_list;
-  result.I64_list := TConstants.COMPACT_TEST.I64_list;
-  result.Double_list := TConstants.COMPACT_TEST.Double_list;
-  result.String_list := TConstants.COMPACT_TEST.String_list;
-  result.Binary_list := TConstants.COMPACT_TEST.Binary_list;
-  result.Boolean_list := TConstants.COMPACT_TEST.Boolean_list;
-  result.Struct_list := TConstants.COMPACT_TEST.Struct_list;
-  result.Byte_set := TConstants.COMPACT_TEST.Byte_set;
-  result.I16_set := TConstants.COMPACT_TEST.I16_set;
-  result.I32_set := TConstants.COMPACT_TEST.I32_set;
-  result.I64_set := TConstants.COMPACT_TEST.I64_set;
-  result.Double_set := TConstants.COMPACT_TEST.Double_set;
-  result.String_set := TConstants.COMPACT_TEST.String_set;
-  result.String_set := TConstants.COMPACT_TEST.String_set;
-  result.String_set := TConstants.COMPACT_TEST.String_set;
-  result.Binary_set := TConstants.COMPACT_TEST.Binary_set;
-  result.Boolean_set := TConstants.COMPACT_TEST.Boolean_set;
-  result.Struct_set := TConstants.COMPACT_TEST.Struct_set;
-  result.Byte_byte_map := TConstants.COMPACT_TEST.Byte_byte_map;
-  result.I16_byte_map := TConstants.COMPACT_TEST.I16_byte_map;
-  result.I32_byte_map := TConstants.COMPACT_TEST.I32_byte_map;
-  result.I64_byte_map := TConstants.COMPACT_TEST.I64_byte_map;
-  result.Double_byte_map := TConstants.COMPACT_TEST.Double_byte_map;
-  result.String_byte_map := TConstants.COMPACT_TEST.String_byte_map;
-  result.Binary_byte_map := TConstants.COMPACT_TEST.Binary_byte_map;
-  result.Boolean_byte_map := TConstants.COMPACT_TEST.Boolean_byte_map;
-  result.Byte_i16_map := TConstants.COMPACT_TEST.Byte_i16_map;
-  result.Byte_i32_map := TConstants.COMPACT_TEST.Byte_i32_map;
-  result.Byte_i64_map := TConstants.COMPACT_TEST.Byte_i64_map;
-  result.Byte_double_map := TConstants.COMPACT_TEST.Byte_double_map;
-  result.Byte_string_map := TConstants.COMPACT_TEST.Byte_string_map;
-  result.Byte_binary_map := TConstants.COMPACT_TEST.Byte_binary_map;
-  result.Byte_boolean_map := TConstants.COMPACT_TEST.Byte_boolean_map;
-  result.List_byte_map := TConstants.COMPACT_TEST.List_byte_map;
-  result.Set_byte_map := TConstants.COMPACT_TEST.Set_byte_map;
-  result.Map_byte_map := TConstants.COMPACT_TEST.Map_byte_map;
-  result.Byte_map_map := TConstants.COMPACT_TEST.Byte_map_map;
-  result.Byte_set_map := TConstants.COMPACT_TEST.Byte_set_map;
-  result.Byte_list_map := TConstants.COMPACT_TEST.Byte_list_map;
+  result.A_byte := TDebugProtoTestConstants.COMPACT_TEST.A_byte;
+  result.A_i16 := TDebugProtoTestConstants.COMPACT_TEST.A_i16;
+  result.A_i32 := TDebugProtoTestConstants.COMPACT_TEST.A_i32;
+  result.A_i64 := TDebugProtoTestConstants.COMPACT_TEST.A_i64;
+  result.A_double := TDebugProtoTestConstants.COMPACT_TEST.A_double;
+  result.A_string := TDebugProtoTestConstants.COMPACT_TEST.A_string;
+  result.A_binary := TDebugProtoTestConstants.COMPACT_TEST.A_binary;
+  result.True_field := TDebugProtoTestConstants.COMPACT_TEST.True_field;
+  result.False_field := TDebugProtoTestConstants.COMPACT_TEST.False_field;
+  result.Empty_struct_field := TDebugProtoTestConstants.COMPACT_TEST.Empty_struct_field;
+  result.Byte_list := TDebugProtoTestConstants.COMPACT_TEST.Byte_list;
+  result.I16_list := TDebugProtoTestConstants.COMPACT_TEST.I16_list;
+  result.I32_list := TDebugProtoTestConstants.COMPACT_TEST.I32_list;
+  result.I64_list := TDebugProtoTestConstants.COMPACT_TEST.I64_list;
+  result.Double_list := TDebugProtoTestConstants.COMPACT_TEST.Double_list;
+  result.String_list := TDebugProtoTestConstants.COMPACT_TEST.String_list;
+  result.Binary_list := TDebugProtoTestConstants.COMPACT_TEST.Binary_list;
+  result.Boolean_list := TDebugProtoTestConstants.COMPACT_TEST.Boolean_list;
+  result.Struct_list := TDebugProtoTestConstants.COMPACT_TEST.Struct_list;
+  result.Byte_set := TDebugProtoTestConstants.COMPACT_TEST.Byte_set;
+  result.I16_set := TDebugProtoTestConstants.COMPACT_TEST.I16_set;
+  result.I32_set := TDebugProtoTestConstants.COMPACT_TEST.I32_set;
+  result.I64_set := TDebugProtoTestConstants.COMPACT_TEST.I64_set;
+  result.Double_set := TDebugProtoTestConstants.COMPACT_TEST.Double_set;
+  result.String_set := TDebugProtoTestConstants.COMPACT_TEST.String_set;
+  result.String_set := TDebugProtoTestConstants.COMPACT_TEST.String_set;
+  result.String_set := TDebugProtoTestConstants.COMPACT_TEST.String_set;
+  result.Binary_set := TDebugProtoTestConstants.COMPACT_TEST.Binary_set;
+  result.Boolean_set := TDebugProtoTestConstants.COMPACT_TEST.Boolean_set;
+  result.Struct_set := TDebugProtoTestConstants.COMPACT_TEST.Struct_set;
+  result.Byte_byte_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_byte_map;
+  result.I16_byte_map := TDebugProtoTestConstants.COMPACT_TEST.I16_byte_map;
+  result.I32_byte_map := TDebugProtoTestConstants.COMPACT_TEST.I32_byte_map;
+  result.I64_byte_map := TDebugProtoTestConstants.COMPACT_TEST.I64_byte_map;
+  result.Double_byte_map := TDebugProtoTestConstants.COMPACT_TEST.Double_byte_map;
+  result.String_byte_map := TDebugProtoTestConstants.COMPACT_TEST.String_byte_map;
+  result.Binary_byte_map := TDebugProtoTestConstants.COMPACT_TEST.Binary_byte_map;
+  result.Boolean_byte_map := TDebugProtoTestConstants.COMPACT_TEST.Boolean_byte_map;
+  result.Byte_i16_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_i16_map;
+  result.Byte_i32_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_i32_map;
+  result.Byte_i64_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_i64_map;
+  result.Byte_double_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_double_map;
+  result.Byte_string_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_string_map;
+  result.Byte_binary_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_binary_map;
+  result.Byte_boolean_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_boolean_map;
+  result.List_byte_map := TDebugProtoTestConstants.COMPACT_TEST.List_byte_map;
+  result.Set_byte_map := TDebugProtoTestConstants.COMPACT_TEST.Set_byte_map;
+  result.Map_byte_map := TDebugProtoTestConstants.COMPACT_TEST.Map_byte_map;
+  result.Byte_map_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_map_map;
+  result.Byte_set_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_set_map;
+  result.Byte_list_map := TDebugProtoTestConstants.COMPACT_TEST.Byte_list_map;
 
   {$IF cDebugProtoTest_Option_AnsiStr_Binary}
   result.A_binary := AnsiString( #0#1#2#3#4#5#6#7#8);
@@ -343,5 +343,7 @@ begin
 end;
 
 
+
+
 end.
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/9bb4c117/lib/delphi/test/serializer/TestSerializer.dpr
----------------------------------------------------------------------
diff --git a/lib/delphi/test/serializer/TestSerializer.dpr b/lib/delphi/test/serializer/TestSerializer.dpr
index 60e55c1..3d9a453 100644
--- a/lib/delphi/test/serializer/TestSerializer.dpr
+++ b/lib/delphi/test/serializer/TestSerializer.dpr
@@ -17,7 +17,7 @@
  * under the License.
  *)
 
-program skiptest_version1;
+program TestSerializer;
 
 {$APPTYPE CONSOLE}
 
@@ -33,6 +33,7 @@ uses
   Thrift.Utils in '..\..\src\Thrift.Utils.pas',
   Thrift.Serializer in '..\..\src\Thrift.Serializer.pas',
   Thrift.Stream in '..\..\src\Thrift.Stream.pas',
+  Thrift.TypeRegistry in '..\..\src\Thrift.TypeRegistry.pas',
   DebugProtoTest,
   TestSerializer.Data;
 
@@ -48,11 +49,13 @@ type
     class procedure Deserialize( const input : TBytes; const target : IBase; const factory : IProtocolFactory);  overload;
     class procedure Deserialize( const input : TStream; const target : IBase; const factory : IProtocolFactory);  overload;
 
+    procedure Test_Serializer_Deserializer;
+
   public
     constructor Create;
     destructor Destroy;  override;
 
-    procedure TestDeserialize;
+    procedure RunTests;
   end;
 
 
@@ -78,9 +81,10 @@ begin
   end;
 end;
 
-
-procedure TTestSerializer.TestDeserialize;
 type TMethod = (mt_Bytes, mt_Stream);
+
+
+procedure TTestSerializer.Test_Serializer_Deserializer;
 var level3ooe, correct : IOneOfEach;
     factory : IProtocolFactory;
     bytes   : TBytes;
@@ -153,6 +157,19 @@ begin
 end;
 
 
+procedure TTestSerializer.RunTests;
+begin
+  try
+    Test_Serializer_Deserializer;
+  except
+    on e:Exception do begin
+      Writeln( e.Message);
+      Write('Hit ENTER to close ... '); Readln;
+    end;
+  end;
+end;
+
+
 class function TTestSerializer.Serialize(const input : IBase; const factory : IProtocolFactory) : TBytes;
 var serial : TSerializer;
 begin
@@ -204,7 +221,7 @@ var test : TTestSerializer;
 begin
   test := TTestSerializer.Create;
   try
-    test.TestDeserialize;
+    test.RunTests;
   finally
     test.Free;
   end;


[2/2] git commit: THRIFT-2599 Uncompileable Delphi code due to naming conflicts with IDL Client: Delphi Patch: Jens Geyer

Posted by je...@apache.org.
THRIFT-2599 Uncompileable Delphi code due to naming conflicts with IDL
Client: Delphi
Patch: Jens Geyer


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/12ee8817
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/12ee8817
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/12ee8817

Branch: refs/heads/master
Commit: 12ee88170a30c025962513b993f8f2c421b5f08c
Parents: 9bb4c11
Author: Jens Geyer <je...@apache.org>
Authored: Fri Jul 4 00:00:33 2014 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Jul 4 00:12:25 2014 +0200

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_delphi_generator.cc | 67 +++++++++++---------
 1 file changed, 37 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/12ee8817/compiler/cpp/src/generate/t_delphi_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_delphi_generator.cc b/compiler/cpp/src/generate/t_delphi_generator.cc
index b877e86..81a04df 100644
--- a/compiler/cpp/src/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/generate/t_delphi_generator.cc
@@ -1733,12 +1733,15 @@ void t_delphi_generator::generate_service_client(t_service* tservice) {
     string args_clsnm = normalize_clsnm( argsname, "T");
     string args_intfnm= normalize_clsnm( argsname, "I");
 
+    string argsvar = tmp("_args");
+    string msgvar  = tmp("_msg");
+
     indent(s_service) << function_signature(&send_function) << endl;
     indent_impl(s_service_impl) << function_signature(&send_function, full_cls) << endl;
     indent_impl(s_service_impl) << "var" << endl;
     indent_up_impl();
-    indent_impl(s_service_impl) << "args : " << args_intfnm << ";" << endl;
-    indent_impl(s_service_impl) << "msg : IMessage;" << endl;
+    indent_impl(s_service_impl) << argsvar << " : " << args_intfnm << ";" << endl;
+    indent_impl(s_service_impl) << msgvar << " : Thrift.Protocol.IMessage;" << endl;
     indent_down_impl();
     indent_impl(s_service_impl) << "begin" << endl;
     indent_up_impl();
@@ -1746,21 +1749,21 @@ void t_delphi_generator::generate_service_client(t_service* tservice) {
     indent_impl(s_service_impl) <<
       "seqid_ := seqid_ + 1;" << endl;
     indent_impl(s_service_impl) <<
-      "msg := TMessageImpl.Create('" << funname << "', TMessageType.Call, seqid_);" << endl;
+      msgvar << " := Thrift.Protocol.TMessageImpl.Create('" << funname << "', TMessageType.Call, seqid_);" << endl;
 
     indent_impl(s_service_impl) <<
-      "oprot_.WriteMessageBegin( msg );" << endl;
+      "oprot_.WriteMessageBegin( " << msgvar << " );" << endl;
     indent_impl(s_service_impl) <<
-      "args := " << args_clsnm << "Impl.Create();" << endl;
+      argsvar << " := " << args_clsnm << "Impl.Create();" << endl;
 
     for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
       indent_impl(s_service_impl) <<
-        "args." << prop_name(*fld_iter) << " := " << normalize_name( (*fld_iter)->get_name()) << ";" << endl;
+        argsvar << "." << prop_name(*fld_iter) << " := " << normalize_name( (*fld_iter)->get_name()) << ";" << endl;
     }
-    indent_impl(s_service_impl) << "args.Write(oprot_);" << endl;
+    indent_impl(s_service_impl) << argsvar << ".Write(oprot_);" << endl;
     for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
       indent_impl(s_service_impl) <<
-        "args." << prop_name(*fld_iter) << " := " << empty_value((*fld_iter)->get_type()) << ";" << endl;
+        argsvar << "." << prop_name(*fld_iter) << " := " << empty_value((*fld_iter)->get_type()) << ";" << endl;
     }
 
     indent_impl(s_service_impl) << "oprot_.WriteMessageEnd();" << endl;
@@ -1783,42 +1786,46 @@ void t_delphi_generator::generate_service_client(t_service* tservice) {
       t_struct *xs = (*f_iter)->get_xceptions();
       const std::vector<t_field*>& xceptions = xs->get_members();
 
+      string exceptvar = tmp("_ex");
+      string appexvar = tmp("_ax");
+      string retvar = tmp("_ret");
+
       indent(s_service) << function_signature(&recv_function) << endl;
       indent_impl(s_service_impl) << function_signature(&recv_function, full_cls) << endl;
       indent_impl(s_service_impl) << "var" << endl;
       indent_up_impl();
-      indent_impl(s_service_impl) << "msg : IMessage;" << endl;
+      indent_impl(s_service_impl) << msgvar << " : Thrift.Protocol.IMessage;" << endl;
       if ( xceptions.size() > 0) {
-        indent_impl(s_service_impl) << "ex : Exception;" << endl;
+        indent_impl(s_service_impl) << exceptvar << " : Exception;" << endl;
       }
-      indent_impl(s_service_impl) << "x : TApplicationException;" << endl;
-      indent_impl(s_service_impl) << "ret : " << result_intfnm << ";" << endl;
+      indent_impl(s_service_impl) << appexvar << " : TApplicationException;" << endl;
+      indent_impl(s_service_impl) << retvar << " : " << result_intfnm << ";" << endl;
 
       indent_down_impl();
       indent_impl(s_service_impl) << "begin" << endl;
       indent_up_impl();
-      indent_impl(s_service_impl) << "msg := iprot_.ReadMessageBegin();" << endl;
-      indent_impl(s_service_impl) << "if (msg.Type_ = TMessageType.Exception) then" << endl;
+      indent_impl(s_service_impl) << msgvar << " := iprot_.ReadMessageBegin();" << endl;
+      indent_impl(s_service_impl) << "if (" << msgvar << ".Type_ = TMessageType.Exception) then" << endl;
       indent_impl(s_service_impl) << "begin" << endl;
       indent_up_impl();
-      indent_impl(s_service_impl) << "x := TApplicationException.Read(iprot_);" << endl;
+      indent_impl(s_service_impl) << appexvar << " := TApplicationException.Read(iprot_);" << endl;
       indent_impl(s_service_impl) << "iprot_.ReadMessageEnd();" << endl;
-      indent_impl(s_service_impl) << "raise x;" << endl;
+      indent_impl(s_service_impl) << "raise " << appexvar << ";" << endl;
       indent_down_impl();
       indent_impl(s_service_impl) << "end;" << endl;
 
-      indent_impl(s_service_impl) << "ret := " << result_clsnm << "Impl.Create();" << endl;
-      indent_impl(s_service_impl) << "ret.Read(iprot_);" << endl;
+      indent_impl(s_service_impl) << retvar << " := " << result_clsnm << "Impl.Create();" << endl;
+      indent_impl(s_service_impl) << retvar << ".Read(iprot_);" << endl;
       indent_impl(s_service_impl) << "iprot_.ReadMessageEnd();" << endl;
 
       if (!(*f_iter)->get_returntype()->is_void()) {
-        indent_impl(s_service_impl) << "if (ret.__isset_success) then" << endl;
+        indent_impl(s_service_impl) << "if (" << retvar << ".__isset_success) then" << endl;
         indent_impl(s_service_impl) << "begin" << endl;
         indent_up_impl();
-        indent_impl(s_service_impl) << "Result := ret.Success;" << endl;
+        indent_impl(s_service_impl) << "Result := " << retvar << ".Success;" << endl;
         t_type *type = (*f_iter)->get_returntype();
         if (type->is_struct() || type->is_xception() || type->is_map() || type->is_list() || type->is_set()) {
-          indent_impl(s_service_impl) << "ret.Success := nil;" << endl;
+          indent_impl(s_service_impl) << retvar << ".Success := nil;" << endl;
         }
         indent_impl(s_service_impl) << "Exit;" << endl;
         indent_down_impl();
@@ -1827,11 +1834,11 @@ void t_delphi_generator::generate_service_client(t_service* tservice) {
 
       vector<t_field*>::const_iterator x_iter;
       for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
-        indent_impl(s_service_impl) << "if (ret.__isset_" << prop_name(*x_iter) << ") then" << endl;
+        indent_impl(s_service_impl) << "if (" << retvar << ".__isset_" << prop_name(*x_iter) << ") then" << endl;
         indent_impl(s_service_impl) << "begin" << endl;
         indent_up_impl();
-        indent_impl(s_service_impl) << "ex := ret." << prop_name(*x_iter) << ".CreateException;" << endl;
-        indent_impl(s_service_impl) << "raise ex;" << endl;
+        indent_impl(s_service_impl) << exceptvar << " := " << retvar << "." << prop_name(*x_iter) << ".CreateException;" << endl;
+        indent_impl(s_service_impl) << "raise " << exceptvar << ";" << endl;
         indent_down_impl();
         indent_impl(s_service_impl) << "end;" << endl;
       }
@@ -1939,7 +1946,7 @@ void t_delphi_generator::generate_service_server(t_service* tservice) {
   indent_impl(s_service_impl) << "function " << full_cls << ".Process( const iprot: IProtocol; const oprot: IProtocol; const events : IProcessorEvents): Boolean;" << endl;;
   indent_impl(s_service_impl) << "var" << endl;
   indent_up_impl();
-  indent_impl(s_service_impl) << "msg : IMessage;" << endl;
+  indent_impl(s_service_impl) << "msg : Thrift.Protocol.IMessage;" << endl;
   indent_impl(s_service_impl) << "fn : TProcessFunction;" << endl;
   indent_impl(s_service_impl) << "x : TApplicationException;" << endl;
   if( events_) {
@@ -1959,7 +1966,7 @@ void t_delphi_generator::generate_service_server(t_service* tservice) {
   indent_impl(s_service_impl) << "TProtocolUtil.Skip(iprot, TType.Struct);" << endl;
   indent_impl(s_service_impl) << "iprot.ReadMessageEnd();" << endl;
   indent_impl(s_service_impl) << "x := TApplicationException.Create(TApplicationException.TExceptionType.UnknownMethod, 'Invalid method name: ''' + msg.Name + '''');" << endl;
-  indent_impl(s_service_impl) << "msg := TMessageImpl.Create(msg.Name, TMessageType.Exception, msg.SeqID);" << endl;
+  indent_impl(s_service_impl) << "msg := Thrift.Protocol.TMessageImpl.Create(msg.Name, TMessageType.Exception, msg.SeqID);" << endl;
   indent_impl(s_service_impl) << "oprot.WriteMessageBegin( msg);" << endl;
   indent_impl(s_service_impl) << "x.Write(oprot);" << endl;
   indent_impl(s_service_impl) << "oprot.WriteMessageEnd();" << endl;
@@ -2064,7 +2071,7 @@ void t_delphi_generator::generate_process_function(t_service* tservice, t_functi
   indent_up_impl();
   indent_impl(s_service_impl) << "args: " << args_intfnm << ";" << endl;
   if (!tfunction->is_oneway()) {
-    indent_impl(s_service_impl) << "msg: IMessage;" << endl;
+    indent_impl(s_service_impl) << "msg: Thrift.Protocol.IMessage;" << endl;
     indent_impl(s_service_impl) << "ret: " << result_intfnm << ";" << endl;
   }
 
@@ -2153,7 +2160,7 @@ void t_delphi_generator::generate_process_function(t_service* tservice, t_functi
     if (events_) {
       indent_impl(s_service_impl) << "if events <> nil then events.PreWrite;" << endl;
     }
-    indent_impl(s_service_impl) << "msg := TMessageImpl.Create('" << tfunction->get_name() << "', TMessageType.Reply, seqid); " << endl;
+    indent_impl(s_service_impl) << "msg := Thrift.Protocol.TMessageImpl.Create('" << tfunction->get_name() << "', TMessageType.Reply, seqid); " << endl;
     indent_impl(s_service_impl) << "oprot.WriteMessageBegin( msg); " << endl;
     indent_impl(s_service_impl) << "ret.Write(oprot);" << endl;
     indent_impl(s_service_impl) << "oprot.WriteMessageEnd();" << endl;
@@ -3317,8 +3324,8 @@ void t_delphi_generator::generate_delphi_struct_tostring_impl(ostream& out, stri
     cls_nm = type_name(tstruct,true,false);
   }
 
-  string tmp_sb = "__sb";
-  string tmp_first = "__first";
+  string tmp_sb = tmp("_sb");
+  string tmp_first = tmp("_first");
   bool useFirstFlag = false;
 
   indent_impl(out) << "function " << cls_prefix << cls_nm << ".ToString: string;" << endl;