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
This commit is contained in:
David Reiss 2008-03-27 21:40:35 +00:00
parent 73dc1431d1
commit a890b5714e
3 changed files with 14 additions and 12 deletions

View File

@ -926,3 +926,6 @@ string t_st_generator::type_to_enum(t_type* type) {
throw "INVALID TYPE IN type_to_enum: " + type->get_name();
}
THRIFT_REGISTER_GENERATOR(st, "Smalltalk", "");

View File

@ -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";
}

View File

@ -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 @@ void usage() {
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 @@ void generate(t_program* program, const vector<string>& generator_strings) {
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 @@ int main(int argc, char** argv) {
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 @@ int main(int argc, char** argv) {
}
// 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();
}