You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2017/09/05 20:44:13 UTC

thrift git commit: THRIFT-4313: Program code of the Erlang tutorial files contain syntax errors. Client: erl

Repository: thrift
Updated Branches:
  refs/heads/master 78b71851f -> fcb2f5a8f


THRIFT-4313: Program code of the Erlang tutorial files contain syntax errors.
Client: erl

This closes #1342


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

Branch: refs/heads/master
Commit: fcb2f5a8f4048cda9b72b76ec067d174e2690896
Parents: 78b7185
Author: walter-weinmann <wa...@gmail.com>
Authored: Tue Sep 5 15:20:37 2017 +0200
Committer: James E. King, III <jk...@apache.org>
Committed: Tue Sep 5 13:43:46 2017 -0700

----------------------------------------------------------------------
 tutorial/erl/client.erl      |  4 ++--
 tutorial/erl/json_client.erl |  4 ++--
 tutorial/erl/server.erl      | 18 +++++++++---------
 3 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/fcb2f5a8/tutorial/erl/client.erl
----------------------------------------------------------------------
diff --git a/tutorial/erl/client.erl b/tutorial/erl/client.erl
index 5d40916..77763a2 100644
--- a/tutorial/erl/client.erl
+++ b/tutorial/erl/client.erl
@@ -44,7 +44,7 @@ t() ->
     {Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
     io:format("1+4=~p~n", [Sum1]),
 
-    Work = #work{op=?tutorial_Operation_SUBTRACT,
+    Work = #'Work'{op=?TUTORIAL_OPERATION_SUBTRACT,
                  num1=15,
                  num2=10},
     {Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
@@ -55,7 +55,7 @@ t() ->
 
     Client6 =
         try
-            Work1 = #work{op=?tutorial_Operation_DIVIDE,
+            Work1 = #'Work'{op=?TUTORIAL_OPERATION_DIVIDE,
                           num1=1,
                           num2=0},
             {ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, [2, Work1]),

http://git-wip-us.apache.org/repos/asf/thrift/blob/fcb2f5a8/tutorial/erl/json_client.erl
----------------------------------------------------------------------
diff --git a/tutorial/erl/json_client.erl b/tutorial/erl/json_client.erl
index 312b01e..0b39ced 100644
--- a/tutorial/erl/json_client.erl
+++ b/tutorial/erl/json_client.erl
@@ -55,7 +55,7 @@ t() ->
     {Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
     io:format("1+4=~p~n", [Sum1]),
 
-    Work = #work{op=?tutorial_Operation_SUBTRACT,
+    Work = #'Work'{op=?TUTORIAL_OPERATION_SUBTRACT,
                  num1=15,
                  num2=10},
     {Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
@@ -66,7 +66,7 @@ t() ->
 
     Client6 =
         try
-            Work1 = #work{op=?tutorial_Operation_DIVIDE,
+            Work1 = #'Work'{op=?TUTORIAL_OPERATION_DIVIDE,
                           num1=1,
                           num2=0},
             {ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, [2, Work1]),

http://git-wip-us.apache.org/repos/asf/thrift/blob/fcb2f5a8/tutorial/erl/server.erl
----------------------------------------------------------------------
diff --git a/tutorial/erl/server.erl b/tutorial/erl/server.erl
index f1e7357..b877f5e 100644
--- a/tutorial/erl/server.erl
+++ b/tutorial/erl/server.erl
@@ -36,25 +36,25 @@ add(N1, N2) ->
     N1+N2.
 
 calculate(Logid, Work) ->
-    { Op, Num1, Num2 } = { Work#work.op, Work#work.num1, Work#work.num2 },
+    { Op, Num1, Num2 } = { Work#'Work'.op, Work#'Work'.num1, Work#'Work'.num2 },
     debug("calculate(~p, {~p,~p,~p})", [Logid, Op, Num1, Num2]),
     case Op of
-        ?tutorial_Operation_ADD      -> Num1 + Num2;
-        ?tutorial_Operation_SUBTRACT -> Num1 - Num2;
-        ?tutorial_Operation_MULTIPLY -> Num1 * Num2;
+        ?TUTORIAL_OPERATION_ADD      -> Num1 + Num2;
+        ?TUTORIAL_OPERATION_SUBTRACT -> Num1 - Num2;
+        ?TUTORIAL_OPERATION_MULTIPLY -> Num1 * Num2;
 
-        ?tutorial_Operation_DIVIDE when Num2 == 0 ->
-          throw(#invalidOperation{whatOp=Op, why="Cannot divide by 0"});
-        ?tutorial_Operation_DIVIDE ->
+        ?TUTORIAL_OPERATION_DIVIDE when Num2 == 0 ->
+          throw(#'InvalidOperation'{whatOp=Op, why="Cannot divide by 0"});
+        ?TUTORIAL_OPERATION_DIVIDE ->
           Num1 div Num2;
 
         _Else ->
-          throw(#invalidOperation{whatOp=Op, why="Invalid operation"})
+          throw(#'InvalidOperation'{whatOp=Op, why="Invalid operation"})
     end.
 
 getStruct(Key) ->
     debug("getStruct(~p)", [Key]),
-    #sharedStruct{key=Key, value="RARG"}.
+    #'SharedStruct'{key=Key, value="RARG"}.
 
 zip() ->
     debug("zip", []),