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:27:54 UTC
svn commit: r745231 - in /incubator/thrift/trunk/compiler/cpp/src:
generate/t_erl_generator.cc generate/t_erl_generator.h main.cc
Author: dreiss
Date: Tue Feb 17 20:27:54 2009
New Revision: 745231
URL: http://svn.apache.org/viewvc?rev=745231&view=rev
Log:
Make the Erlang generator dynamic.
- Modify the Erlang generator constructor to fit the new generic interface.
- Register the Erlang genrator with the central registry.
- Deprecate the old way of invoking the Erlang generator.
- main.cc no longer includes t_erl_generator.h.
Modified:
incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.cc
incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.h
incubator/thrift/trunk/compiler/cpp/src/main.cc
Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.cc?rev=745231&r1=745230&r2=745231&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.cc Tue Feb 17 20:27:54 2009
@@ -781,3 +781,5 @@
std::string t_erl_generator::type_module(t_type* ttype) {
return uncapitalize(ttype->get_program()->get_name()) + "_types";
}
+
+THRIFT_REGISTER_GENERATOR(erl, "Erlang", "");
Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.h?rev=745231&r1=745230&r2=745231&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_erl_generator.h Tue Feb 17 20:27:54 2009
@@ -15,8 +15,11 @@
*/
class t_erl_generator : public t_generator {
public:
- t_erl_generator(t_program* program) :
- t_generator(program)
+ t_erl_generator(
+ t_program* program,
+ const std::map<std::string, std::string>& parsed_options,
+ const std::string& option_string)
+ : t_generator(program)
{
program_name_[0] = tolower(program_name_[0]);
service_name_[0] = tolower(service_name_[0]);
Modified: incubator/thrift/trunk/compiler/cpp/src/main.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/main.cc?rev=745231&r1=745230&r2=745231&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/main.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/main.cc Tue Feb 17 20:27:54 2009
@@ -39,7 +39,6 @@
#include "generate/t_generator.h"
#include "generate/t_php_generator.h"
#include "generate/t_xsd_generator.h"
-#include "generate/t_erl_generator.h"
#include "version.h"
@@ -612,7 +611,6 @@
fprintf(stderr, " -phpa Generate PHP with autoload (with -php)\n");
fprintf(stderr, " -phpo Generate PHP with object oriented subclasses (with -php)\n");
fprintf(stderr, " -xsd Generate XSD output files\n");
- fprintf(stderr, " -erl Generate Erlang output files\n");
fprintf(stderr, " -o dir Set the output directory for gen-* packages\n");
fprintf(stderr, " (default: current directory)\n");
fprintf(stderr, " -I dir Add a directory to the list of directories\n");
@@ -882,13 +880,6 @@
delete xsd;
}
- if (gen_erl) {
- pverbose("Generating Erlang\n");
- t_erl_generator* erl = new t_erl_generator(program);
- erl->generate_program();
- delete erl;
- }
-
if (dump_docs) {
dump_docstrings(program);
}
@@ -1111,6 +1102,10 @@
pwarning(1, "-cocoa is deprecated. Use --gen cocoa");
generator_strings.push_back("cocoa");
}
+ if (gen_erl) {
+ pwarning(1, "-erl is deprecated. Use --gen erl");
+ generator_strings.push_back("erl");
+ }
if (gen_st) {
pwarning(1, "-st is deprecated. Use --gen st");
generator_strings.push_back("st");
@@ -1125,7 +1120,7 @@
}
// You gotta generate something!
- if (!gen_php && !gen_phpi && !gen_xsd && !gen_erl && generator_strings.empty()) {
+ if (!gen_php && !gen_phpi && !gen_xsd && generator_strings.empty()) {
fprintf(stderr, "!!! No output language(s) specified\n\n");
usage();
}