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
diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc
index 1e09bff..cfb1ff1 100644
--- a/compiler/cpp/src/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/generate/t_csharp_generator.cc
@@ -103,7 +103,7 @@
 
 void t_csharp_generator::init_generator() {
   MKDIR(get_out_dir().c_str());
-  namespace_name_ = program_->get_csharp_namespace();
+  namespace_name_ = program_->get_namespace("csharp");
 
   string dir = namespace_name_;
   string subdir = get_out_dir().c_str();
@@ -1501,7 +1501,7 @@
 
   t_program* program = ttype->get_program();
   if (program != NULL && program != program_) {
-    string ns = program->get_csharp_namespace();
+    string ns = program->get_namespace("csharp");
     if (!ns.empty()) {
       return ns + "." + ttype->get_name();
     }
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index 3afc226..bcb3967 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -176,14 +176,6 @@
     return php_namespace_;
   }
 
-  void set_csharp_namespace(std::string csharp_namespace) {
-    csharp_namespace_ = csharp_namespace;
-  }
-
-  const std::string& get_csharp_namespace() const {
-    return csharp_namespace_;
-  }
-
   void set_xsd_namespace(std::string xsd_namespace) {
     xsd_namespace_ = xsd_namespace;
   }
@@ -269,9 +261,6 @@
   // Perl namespace
   std::string perl_package_;
 
-
-  // C# namespace
-  std::string csharp_namespace_;
 };
 
 #endif
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index 61febeb..81c7360 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -341,11 +341,13 @@
         g_program->set_xsd_namespace($2);
       }
     }
+/* TODO(dreiss): Get rid of this once everyone is using the new hotness. */
 | tok_csharp_namespace tok_identifier
    {
+     pwarning(1, "'csharp_namespace' is deprecated. Use 'namespace csharp' instead");
      pdebug("Header -> tok_csharp_namespace tok_identifier");
      if (g_parse_mode == PROGRAM) {
-       g_program->set_csharp_namespace($2);
+       g_program->set_namespace("csharp", $2);
      }
    }