Fix the erlang tutorial

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1071148 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tutorial/erl/client.erl b/tutorial/erl/client.erl
index adaebe4..5d40916 100644
--- a/tutorial/erl/client.erl
+++ b/tutorial/erl/client.erl
@@ -44,7 +44,7 @@
     {Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
     io:format("1+4=~p~n", [Sum1]),
 
-    Work = #work{op=?tutorial_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 @@
 
     Client6 =
         try
-            Work1 = #work{op=?tutorial_DIVIDE,
+            Work1 = #work{op=?tutorial_Operation_DIVIDE,
                           num1=1,
                           num2=0},
             {ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, [2, Work1]),
diff --git a/tutorial/erl/server.erl b/tutorial/erl/server.erl
index 5a994ce..4915606 100644
--- a/tutorial/erl/server.erl
+++ b/tutorial/erl/server.erl
@@ -39,17 +39,17 @@
     { 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_ADD      -> Num1 + Num2;
-	?tutorial_SUBTRACT -> Num1 - Num2;
-	?tutorial_MULTIPLY -> Num1 * Num2;
+        ?tutorial_Operation_ADD      -> Num1 + Num2;
+        ?tutorial_Operation_SUBTRACT -> Num1 - Num2;
+        ?tutorial_Operation_MULTIPLY -> Num1 * Num2;
 
-	?tutorial_DIVIDE when Num2 == 0 ->
-	    throw(#invalidOperation{what=Op, why="Cannot divide by 0"});
-	?tutorial_DIVIDE ->
-	    Num1 div Num2;
+        ?tutorial_Operation_DIVIDE when Num2 == 0 ->
+          throw(#invalidOperation{what=Op, why="Cannot divide by 0"});
+        ?tutorial_Operation_DIVIDE ->
+          Num1 div Num2;
 
-	_Else ->
-	    throw(#invalidOperation{what=Op, why="Invalid operation"})
+        _Else ->
+          throw(#invalidOperation{what=Op, why="Invalid operation"})
     end.
 
 getStruct(Key) ->
diff --git a/tutorial/erl/server.sh b/tutorial/erl/server.sh
index 106c89e..775afb6 100755
--- a/tutorial/erl/server.sh
+++ b/tutorial/erl/server.sh
@@ -26,12 +26,12 @@
     exit 1
 fi
 
-if ! [ -d ../gen-erl ]; then
-    echo "Please run thrift first to generate ../gen-erl/"
-    exit 1
+if ! [ -d gen-erl ]; then
+  ../../compiler/cpp/thrift -r --gen erl ../tutorial.thrift
 fi
 
 
-erlc -I ${ERL_THRIFT}/include -I ../gen-erl -o ../gen-erl ../gen-erl/*.erl  &&
-  erlc -I ${ERL_THRIFT}/include -I ../gen-erl *.erl &&
-  erl +K true -pa ${ERL_THRIFT}/ebin -pa ../gen-erl 
+erlc -I ${ERL_THRIFT}/include -I ${ERL_THRIFT}/ebin \
+     -I gen-erl -o gen-erl gen-erl/*.erl &&
+  erlc -I ${ERL_THRIFT}/include -I gen-erl *.erl &&
+  erl +K true -pa ${ERL_THRIFT}/ebin -pa gen-erl