You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2009/02/17 21:28:37 UTC
svn commit: r745241 - in /incubator/thrift/trunk:
compiler/cpp/src/generate/t_php_generator.cc
compiler/cpp/src/parse/t_program.h compiler/cpp/src/thrifty.yy
contrib/thrift.el contrib/thrift.vim tutorial/tutorial.thrift
Author: dreiss
Date: Tue Feb 17 20:28:37 2009
New Revision: 745241
URL: http://svn.apache.org/viewvc?rev=745241&view=rev
Log:
Make the PHP generator use non-hardcoded namespaces.
- Make the PHP generator use program->get_namespace("php")
instead of program->get_php_namespace()
- Eliminate the explicit "php_namespace" in t_program.
- Deprecate the php_namespace token.
- Update example .thrift files and syntax files.
Modified:
incubator/thrift/trunk/compiler/cpp/src/generate/t_php_generator.cc
incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h
incubator/thrift/trunk/compiler/cpp/src/thrifty.yy
incubator/thrift/trunk/contrib/thrift.el
incubator/thrift/trunk/contrib/thrift.vim
incubator/thrift/trunk/tutorial/tutorial.thrift
Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_php_generator.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_php_generator.cc?rev=745241&r1=745240&r2=745241&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_php_generator.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_php_generator.cc Tue Feb 17 20:28:37 2009
@@ -166,7 +166,7 @@
std::string type_to_enum(t_type* ttype);
std::string php_namespace(t_program* p) {
- std::string ns = p->get_php_namespace();
+ std::string ns = p->get_namespace("php");
return ns.size() ? (ns + "_") : "";
}
Modified: incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h?rev=745241&r1=745240&r2=745241&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h Tue Feb 17 20:28:37 2009
@@ -168,14 +168,6 @@
return cpp_includes_;
}
- void set_php_namespace(std::string php_namespace) {
- php_namespace_ = php_namespace;
- }
-
- const std::string& get_php_namespace() const {
- return php_namespace_;
- }
-
private:
// File path
@@ -214,9 +206,6 @@
// C++ extra includes
std::vector<std::string> cpp_includes_;
- // PHP namespace
- std::string php_namespace_;
-
};
#endif
Modified: incubator/thrift/trunk/compiler/cpp/src/thrifty.yy
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/thrifty.yy?rev=745241&r1=745240&r2=745241&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/thrifty.yy (original)
+++ incubator/thrift/trunk/compiler/cpp/src/thrifty.yy Tue Feb 17 20:28:37 2009
@@ -282,9 +282,10 @@
}
| tok_php_namespace tok_identifier
{
+ pwarning(1, "'php_namespace' is deprecated. Use 'namespace php' instead");
pdebug("Header -> tok_php_namespace tok_identifier");
if (g_parse_mode == PROGRAM) {
- g_program->set_php_namespace($2);
+ g_program->set_namespace("php", $2);
}
}
/* TODO(dreiss): Get rid of this once everyone is using the new hotness. */
Modified: incubator/thrift/trunk/contrib/thrift.el
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/contrib/thrift.el?rev=745241&r1=745240&r2=745241&view=diff
==============================================================================
--- incubator/thrift/trunk/contrib/thrift.el (original)
+++ incubator/thrift/trunk/contrib/thrift.el Tue Feb 17 20:28:37 2009
@@ -10,7 +10,7 @@
(defconst thrift-font-lock-keywords
(list
'("#.*$" . font-lock-comment-face) ;; perl style comments
- '("\\<\\(include\\|struct\\|exception\\|typedef\\|php_namespace\\|const\\|enum\\|service\\|extends\\|void\\|async\\|throws\\|optional\\|required\\)\\>" . font-lock-keyword-face) ;; keywords
+ '("\\<\\(include\\|struct\\|exception\\|typedef\\|const\\|enum\\|service\\|extends\\|void\\|async\\|throws\\|optional\\|required\\)\\>" . font-lock-keyword-face) ;; keywords
'("\\<\\(bool\\|byte\\|i16\\|i32\\|i64\\|double\\|string\\|binary\\|map\\|list\\|set\\)\\>" . font-lock-type-face) ;; built-in types
'("\\<\\([0-9]+\\)\\>" . font-lock-variable-name-face) ;; ordinals
'("\\<\\(\\w+\\)\\s-*(" (1 font-lock-function-name-face)) ;; functions
Modified: incubator/thrift/trunk/contrib/thrift.vim
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/contrib/thrift.vim?rev=745241&r1=745240&r2=745241&view=diff
==============================================================================
--- incubator/thrift/trunk/contrib/thrift.vim (original)
+++ incubator/thrift/trunk/contrib/thrift.vim Tue Feb 17 20:28:37 2009
@@ -31,7 +31,6 @@
" Keywords
syn keyword thriftKeyword namespace
-syn keyword thriftKeyword php_namespace
syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_attrs
syn keyword thriftKeyword include cpp_include cpp_type const optional required
syn keyword thriftBasicTypes void bool byte i16 i32 i64 double string binary
Modified: incubator/thrift/trunk/tutorial/tutorial.thrift
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/tutorial/tutorial.thrift?rev=745241&r1=745240&r2=745241&view=diff
==============================================================================
--- incubator/thrift/trunk/tutorial/tutorial.thrift (original)
+++ incubator/thrift/trunk/tutorial/tutorial.thrift Tue Feb 17 20:28:37 2009
@@ -47,7 +47,7 @@
*/
namespace cpp tutorial
namespace java tutorial
-php_namespace tutorial
+namespace php tutorial
namespace perl tutorial
namespace smalltalk.category Thrift.Tutorial