Make the Smalltalk generator dynamic.
- Modify the Smalltalk generator constructor to fit the new generic interface.
- Register the Smalltalk genrator with the central registry.
- Deprecate the old way of invoking the Smalltalk generator.
- main.cc no longer includes t_st_generator.h.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665598 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_st_generator.cc b/compiler/cpp/src/generate/t_st_generator.cc
index dd8bfe4..cf17416 100644
--- a/compiler/cpp/src/generate/t_st_generator.cc
+++ b/compiler/cpp/src/generate/t_st_generator.cc
@@ -926,3 +926,6 @@
throw "INVALID TYPE IN type_to_enum: " + type->get_name();
}
+
+
+THRIFT_REGISTER_GENERATOR(st, "Smalltalk", "");
diff --git a/compiler/cpp/src/generate/t_st_generator.h b/compiler/cpp/src/generate/t_st_generator.h
index 9f831e7..ae8f323 100644
--- a/compiler/cpp/src/generate/t_st_generator.h
+++ b/compiler/cpp/src/generate/t_st_generator.h
@@ -24,8 +24,12 @@
*/
class t_st_generator : public t_oop_generator {
public:
- t_st_generator(t_program* program) :
- t_oop_generator(program) {
+ t_st_generator(
+ t_program* program,
+ const std::map<std::string, std::string>& parsed_options,
+ const std::string& option_string)
+ : t_oop_generator(program)
+ {
out_dir_base_ = "gen-st";
}
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc
index a4c1dd7..dfd5f9e 100644
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -42,7 +42,6 @@
#include "generate/t_perl_generator.h"
#include "generate/t_erl_generator.h"
#include "generate/t_cocoa_generator.h"
-#include "generate/t_st_generator.h"
#include "generate/t_csharp_generator.h"
using namespace std;
@@ -613,7 +612,6 @@
fprintf(stderr, " -erl Generate Erlang output files\n");
fprintf(stderr, " -cocoa Generate Cocoa/Objective-C output files\n");
fprintf(stderr, " -csharp Generate C# output files\n");
- fprintf(stderr, " -st Generate Squeak/Smalltalk 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");
@@ -918,13 +916,6 @@
delete cocoa;
}
- if (gen_st) {
- pverbose("Generating Smalltalk/Squeak\n");
- t_st_generator* st = new t_st_generator(program);
- st->generate_program();
- delete st;
- }
-
if (gen_csharp) {
pverbose("Generating C#\n");
t_csharp_generator* csharp = new t_csharp_generator(program);
@@ -1125,6 +1116,10 @@
pwarning(1, "-javabean is deprecated. Use --gen java:beans");
generator_strings.push_back("java:beans");
}
+ if (gen_st) {
+ pwarning(1, "-st is deprecated. Use --gen st");
+ generator_strings.push_back("st");
+ }
if (gen_ocaml) {
pwarning(1, "-ocaml is deprecated. Use --gen ocaml");
generator_strings.push_back("ocaml");
@@ -1135,7 +1130,7 @@
}
// You gotta generate something!
- if (!gen_php && !gen_phpi && !gen_py && !gen_rb && !gen_xsd && !gen_perl && !gen_erl && !gen_cocoa && !gen_st && !gen_csharp && generator_strings.empty()) {
+ if (!gen_php && !gen_phpi && !gen_py && !gen_rb && !gen_xsd && !gen_perl && !gen_erl && !gen_cocoa && !gen_csharp && generator_strings.empty()) {
fprintf(stderr, "!!! No output language(s) specified\n\n");
usage();
}