mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
Rename "alterl" to "erl".
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666481 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f2e66c1cb7
commit
9f2a5d7799
2
.gitignore
vendored
2
.gitignore
vendored
@ -21,7 +21,7 @@ if/Makefile.in
|
||||
install-sh
|
||||
lib/Makefile
|
||||
lib/Makefile.in
|
||||
lib/alterl/ebin
|
||||
lib/erl/ebin
|
||||
lib/cpp/.deps
|
||||
lib/cpp/.libs
|
||||
lib/cpp/Makefile
|
||||
|
@ -11,7 +11,7 @@ thrift_SOURCES = src/thrifty.yy \
|
||||
src/generate/t_generator.cc \
|
||||
src/generate/t_php_generator.cc \
|
||||
src/generate/t_xsd_generator.cc \
|
||||
src/generate/t_alterl_generator.cc \
|
||||
src/generate/t_erl_generator.cc \
|
||||
src/globals.h \
|
||||
src/main.h \
|
||||
src/platform.h \
|
||||
@ -38,7 +38,7 @@ thrift_SOURCES = src/thrifty.yy \
|
||||
src/generate/t_oop_generator.h \
|
||||
src/generate/t_php_generator.h \
|
||||
src/generate/t_xsd_generator.h \
|
||||
src/generate/t_alterl_generator.h
|
||||
src/generate/t_erl_generator.h
|
||||
|
||||
if THRIFT_GEN_cpp
|
||||
thrift_SOURCES += src/generate/t_cpp_generator.cc
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sstream>
|
||||
#include "t_alterl_generator.h"
|
||||
#include "t_erl_generator.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -18,7 +18,7 @@ using namespace std;
|
||||
*
|
||||
* @param tprogram The program to generate
|
||||
*/
|
||||
void t_alterl_generator::init_generator() {
|
||||
void t_erl_generator::init_generator() {
|
||||
// Make output directory
|
||||
mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
||||
@ -60,19 +60,19 @@ void t_alterl_generator::init_generator() {
|
||||
/**
|
||||
* Boilerplate at beginning and end of header files
|
||||
*/
|
||||
void t_alterl_generator::hrl_header(ostream& out, string name) {
|
||||
void t_erl_generator::hrl_header(ostream& out, string name) {
|
||||
out << "-ifndef(_" << name << "_included)." << endl <<
|
||||
"-define(_" << name << "_included, yeah)." << endl;
|
||||
}
|
||||
|
||||
void t_alterl_generator::hrl_footer(ostream& out, string name) {
|
||||
void t_erl_generator::hrl_footer(ostream& out, string name) {
|
||||
out << "-endif." << endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders all the imports necessary for including another Thrift program
|
||||
*/
|
||||
string t_alterl_generator::render_includes() {
|
||||
string t_erl_generator::render_includes() {
|
||||
const vector<t_program*>& includes = program_->get_includes();
|
||||
string result = "";
|
||||
for (size_t i = 0; i < includes.size(); ++i) {
|
||||
@ -87,7 +87,7 @@ string t_alterl_generator::render_includes() {
|
||||
/**
|
||||
* Autogen'd comment
|
||||
*/
|
||||
string t_alterl_generator::erl_autogen_comment() {
|
||||
string t_erl_generator::erl_autogen_comment() {
|
||||
return
|
||||
std::string("%%\n") +
|
||||
"%% Autogenerated by Thrift\n" +
|
||||
@ -99,14 +99,14 @@ string t_alterl_generator::erl_autogen_comment() {
|
||||
/**
|
||||
* Prints standard thrift imports
|
||||
*/
|
||||
string t_alterl_generator::erl_imports() {
|
||||
string t_erl_generator::erl_imports() {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the type files
|
||||
*/
|
||||
void t_alterl_generator::close_generator() {
|
||||
void t_erl_generator::close_generator() {
|
||||
// Close types file
|
||||
export_types_string("struct_info", 1);
|
||||
|
||||
@ -126,7 +126,7 @@ void t_alterl_generator::close_generator() {
|
||||
*
|
||||
* @param ttypedef The type definition
|
||||
*/
|
||||
void t_alterl_generator::generate_typedef(t_typedef* ttypedef) {
|
||||
void t_erl_generator::generate_typedef(t_typedef* ttypedef) {
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,7 +135,7 @@ void t_alterl_generator::generate_typedef(t_typedef* ttypedef) {
|
||||
*
|
||||
* @param tenum The enumeration
|
||||
*/
|
||||
void t_alterl_generator::generate_enum(t_enum* tenum) {
|
||||
void t_erl_generator::generate_enum(t_enum* tenum) {
|
||||
vector<t_enum_value*> constants = tenum->get_constants();
|
||||
vector<t_enum_value*>::iterator c_iter;
|
||||
|
||||
@ -160,7 +160,7 @@ void t_alterl_generator::generate_enum(t_enum* tenum) {
|
||||
/**
|
||||
* Generate a constant value
|
||||
*/
|
||||
void t_alterl_generator::generate_const(t_const* tconst) {
|
||||
void t_erl_generator::generate_const(t_const* tconst) {
|
||||
t_type* type = tconst->get_type();
|
||||
string name = capitalize(tconst->get_name());
|
||||
t_const_value* value = tconst->get_value();
|
||||
@ -173,7 +173,7 @@ void t_alterl_generator::generate_const(t_const* tconst) {
|
||||
* is NOT performed in this function as it is always run beforehand using the
|
||||
* validate_types method in main.cc
|
||||
*/
|
||||
string t_alterl_generator::render_const_value(t_type* type, t_const_value* value) {
|
||||
string t_erl_generator::render_const_value(t_type* type, t_const_value* value) {
|
||||
std::ostringstream out;
|
||||
|
||||
if (type->is_base_type()) {
|
||||
@ -297,7 +297,7 @@ string t_alterl_generator::render_const_value(t_type* type, t_const_value* value
|
||||
/**
|
||||
* Generates a struct
|
||||
*/
|
||||
void t_alterl_generator::generate_struct(t_struct* tstruct) {
|
||||
void t_erl_generator::generate_struct(t_struct* tstruct) {
|
||||
generate_erl_struct(tstruct, false);
|
||||
}
|
||||
|
||||
@ -307,14 +307,14 @@ void t_alterl_generator::generate_struct(t_struct* tstruct) {
|
||||
*
|
||||
* @param txception The struct definition
|
||||
*/
|
||||
void t_alterl_generator::generate_xception(t_struct* txception) {
|
||||
void t_erl_generator::generate_xception(t_struct* txception) {
|
||||
generate_erl_struct(txception, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a struct
|
||||
*/
|
||||
void t_alterl_generator::generate_erl_struct(t_struct* tstruct,
|
||||
void t_erl_generator::generate_erl_struct(t_struct* tstruct,
|
||||
bool is_exception) {
|
||||
generate_erl_struct_definition(f_types_, f_types_hrl_file_, tstruct, is_exception);
|
||||
}
|
||||
@ -324,7 +324,7 @@ void t_alterl_generator::generate_erl_struct(t_struct* tstruct,
|
||||
*
|
||||
* @param tstruct The struct definition
|
||||
*/
|
||||
void t_alterl_generator::generate_erl_struct_definition(ostream& out,
|
||||
void t_erl_generator::generate_erl_struct_definition(ostream& out,
|
||||
ostream& hrl_out,
|
||||
t_struct* tstruct,
|
||||
bool is_exception,
|
||||
@ -372,7 +372,7 @@ void t_alterl_generator::generate_erl_struct_definition(ostream& out,
|
||||
/**
|
||||
* Generates the read method for a struct
|
||||
*/
|
||||
void t_alterl_generator::generate_erl_struct_info(ostream& out,
|
||||
void t_erl_generator::generate_erl_struct_info(ostream& out,
|
||||
t_struct* tstruct) {
|
||||
string name = type_name(tstruct);
|
||||
|
||||
@ -391,7 +391,7 @@ void t_alterl_generator::generate_erl_struct_info(ostream& out,
|
||||
*
|
||||
* @param tservice The service definition
|
||||
*/
|
||||
void t_alterl_generator::generate_service(t_service* tservice) {
|
||||
void t_erl_generator::generate_service(t_service* tservice) {
|
||||
// somehow this point is reached before the constructor and it's not downcased yet
|
||||
// ...awesome
|
||||
service_name_[0] = tolower(service_name_[0]);
|
||||
@ -448,7 +448,7 @@ void t_alterl_generator::generate_service(t_service* tservice) {
|
||||
*
|
||||
* @param tservice The service to generate a header definition for
|
||||
*/
|
||||
void t_alterl_generator::generate_service_helpers(t_service* tservice) {
|
||||
void t_erl_generator::generate_service_helpers(t_service* tservice) {
|
||||
vector<t_function*> functions = tservice->get_functions();
|
||||
vector<t_function*>::iterator f_iter;
|
||||
|
||||
@ -468,7 +468,7 @@ void t_alterl_generator::generate_service_helpers(t_service* tservice) {
|
||||
*
|
||||
* @param tfunction The function
|
||||
*/
|
||||
void t_alterl_generator::generate_erl_function_helpers(t_function* tfunction) {
|
||||
void t_erl_generator::generate_erl_function_helpers(t_function* tfunction) {
|
||||
}
|
||||
|
||||
/**
|
||||
@ -476,7 +476,7 @@ void t_alterl_generator::generate_erl_function_helpers(t_function* tfunction) {
|
||||
*
|
||||
* @param tservice The service to generate a header definition for
|
||||
*/
|
||||
void t_alterl_generator::generate_service_interface(t_service* tservice) {
|
||||
void t_erl_generator::generate_service_interface(t_service* tservice) {
|
||||
|
||||
export_string("function_info", 2);
|
||||
|
||||
@ -510,7 +510,7 @@ void t_alterl_generator::generate_service_interface(t_service* tservice) {
|
||||
* Generates a function_info(FunctionName, params_type) and
|
||||
* function_info(FunctionName, reply_type)
|
||||
*/
|
||||
void t_alterl_generator::generate_function_info(t_service* tservice,
|
||||
void t_erl_generator::generate_function_info(t_service* tservice,
|
||||
t_function* tfunction) {
|
||||
|
||||
string name_atom = "'" + tfunction->get_name() + "'";
|
||||
@ -556,7 +556,7 @@ void t_alterl_generator::generate_function_info(t_service* tservice,
|
||||
*
|
||||
* @param ttype The type
|
||||
*/
|
||||
string t_alterl_generator::declare_field(t_field* tfield) { // TODO
|
||||
string t_erl_generator::declare_field(t_field* tfield) { // TODO
|
||||
string result = "@" + tfield->get_name();
|
||||
t_type* type = get_true_type(tfield->get_type());
|
||||
if (tfield->get_value() != NULL) {
|
||||
@ -573,7 +573,7 @@ string t_alterl_generator::declare_field(t_field* tfield) { // TODO
|
||||
* @param tfunction Function definition
|
||||
* @return String of rendered function definition
|
||||
*/
|
||||
string t_alterl_generator::function_signature(t_function* tfunction,
|
||||
string t_erl_generator::function_signature(t_function* tfunction,
|
||||
string prefix) {
|
||||
return
|
||||
prefix + tfunction->get_name() +
|
||||
@ -583,7 +583,7 @@ string t_alterl_generator::function_signature(t_function* tfunction,
|
||||
/**
|
||||
* Add a function to the exports list
|
||||
*/
|
||||
void t_alterl_generator::export_string(string name, int num) {
|
||||
void t_erl_generator::export_string(string name, int num) {
|
||||
if (export_lines_first_) {
|
||||
export_lines_first_ = false;
|
||||
} else {
|
||||
@ -592,7 +592,7 @@ void t_alterl_generator::export_string(string name, int num) {
|
||||
export_lines_ << name << "/" << num;
|
||||
}
|
||||
|
||||
void t_alterl_generator::export_types_function(t_function* tfunction,
|
||||
void t_erl_generator::export_types_function(t_function* tfunction,
|
||||
string prefix) {
|
||||
|
||||
export_types_string(prefix + tfunction->get_name(),
|
||||
@ -601,7 +601,7 @@ void t_alterl_generator::export_types_function(t_function* tfunction,
|
||||
);
|
||||
}
|
||||
|
||||
void t_alterl_generator::export_types_string(string name, int num) {
|
||||
void t_erl_generator::export_types_string(string name, int num) {
|
||||
if (export_types_lines_first_) {
|
||||
export_types_lines_first_ = false;
|
||||
} else {
|
||||
@ -610,7 +610,7 @@ void t_alterl_generator::export_types_string(string name, int num) {
|
||||
export_types_lines_ << name << "/" << num;
|
||||
}
|
||||
|
||||
void t_alterl_generator::export_function(t_function* tfunction,
|
||||
void t_erl_generator::export_function(t_function* tfunction,
|
||||
string prefix) {
|
||||
|
||||
export_string(prefix + tfunction->get_name(),
|
||||
@ -623,7 +623,7 @@ void t_alterl_generator::export_function(t_function* tfunction,
|
||||
/**
|
||||
* Renders a field list
|
||||
*/
|
||||
string t_alterl_generator::argument_list(t_struct* tstruct) {
|
||||
string t_erl_generator::argument_list(t_struct* tstruct) {
|
||||
string result = "";
|
||||
|
||||
const vector<t_field*>& fields = tstruct->get_members();
|
||||
@ -641,7 +641,7 @@ string t_alterl_generator::argument_list(t_struct* tstruct) {
|
||||
return result;
|
||||
}
|
||||
|
||||
string t_alterl_generator::type_name(t_type* ttype) {
|
||||
string t_erl_generator::type_name(t_type* ttype) {
|
||||
string prefix = "";
|
||||
string name = ttype->get_name();
|
||||
|
||||
@ -655,7 +655,7 @@ string t_alterl_generator::type_name(t_type* ttype) {
|
||||
/**
|
||||
* Converts the parse type to a Erlang "type" (macro for int constants)
|
||||
*/
|
||||
string t_alterl_generator::type_to_enum(t_type* type) {
|
||||
string t_erl_generator::type_to_enum(t_type* type) {
|
||||
type = get_true_type(type);
|
||||
|
||||
if (type->is_base_type()) {
|
||||
@ -697,7 +697,7 @@ string t_alterl_generator::type_to_enum(t_type* type) {
|
||||
/**
|
||||
* Generate an Erlang term which represents a thrift type
|
||||
*/
|
||||
std::string t_alterl_generator::generate_type_term(t_type* type,
|
||||
std::string t_erl_generator::generate_type_term(t_type* type,
|
||||
bool expand_structs) {
|
||||
type = get_true_type(type);
|
||||
|
||||
@ -773,6 +773,6 @@ std::string t_alterl_generator::generate_type_term(t_type* type,
|
||||
throw "INVALID TYPE IN type_to_enum: " + type->get_name();
|
||||
}
|
||||
|
||||
std::string t_alterl_generator::type_module(t_type* ttype) {
|
||||
std::string t_erl_generator::type_module(t_type* ttype) {
|
||||
return uncapitalize(ttype->get_program()->get_name()) + "_types";
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#ifndef T_ALTERL_GENERATOR_H
|
||||
#define T_ALTERL_GENERATOR_H
|
||||
#ifndef T_ERL_GENERATOR_H
|
||||
#define T_ERL_GENERATOR_H
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
@ -13,9 +13,9 @@
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
class t_alterl_generator : public t_generator {
|
||||
class t_erl_generator : public t_generator {
|
||||
public:
|
||||
t_alterl_generator(t_program* program) :
|
||||
t_erl_generator(t_program* program) :
|
||||
t_generator(program)
|
||||
{
|
||||
program_name_[0] = tolower(program_name_[0]);
|
@ -38,7 +38,7 @@
|
||||
#include "parse/t_scope.h"
|
||||
#include "generate/t_php_generator.h"
|
||||
#include "generate/t_xsd_generator.h"
|
||||
#include "generate/t_alterl_generator.h"
|
||||
#include "generate/t_erl_generator.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -151,7 +151,7 @@ bool gen_phpa = false;
|
||||
bool gen_phpo = false;
|
||||
bool gen_rest = false;
|
||||
bool gen_perl = false;
|
||||
bool gen_alterl = false;
|
||||
bool gen_erl = false;
|
||||
bool gen_ocaml = false;
|
||||
bool gen_hs = false;
|
||||
bool gen_cocoa = false;
|
||||
@ -601,7 +601,7 @@ void usage() {
|
||||
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, " -alterl Generate Alternative Erlang 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");
|
||||
@ -871,11 +871,11 @@ void generate(t_program* program, const vector<string>& generator_strings) {
|
||||
delete xsd;
|
||||
}
|
||||
|
||||
if (gen_alterl) {
|
||||
pverbose("Generating Alternative Erlang\n");
|
||||
t_alterl_generator* alterl = new t_alterl_generator(program);
|
||||
alterl->generate_program();
|
||||
delete alterl;
|
||||
if (gen_erl) {
|
||||
pverbose("Generating Erlang\n");
|
||||
t_erl_generator* erl = new t_erl_generator(program);
|
||||
erl->generate_program();
|
||||
delete erl;
|
||||
}
|
||||
|
||||
if (dump_docs) {
|
||||
@ -992,8 +992,8 @@ int main(int argc, char** argv) {
|
||||
gen_xsd = true;
|
||||
} else if (strcmp(arg, "-perl") == 0) {
|
||||
gen_perl = true;
|
||||
} else if (strcmp(arg, "-alterl") == 0) {
|
||||
gen_alterl = true;
|
||||
} else if (strcmp(arg, "-erl") == 0) {
|
||||
gen_erl = true;
|
||||
} else if (strcmp(arg, "-ocaml") == 0) {
|
||||
gen_ocaml = true;
|
||||
} else if (strcmp(arg, "-hs") == 0) {
|
||||
@ -1105,7 +1105,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
// You gotta generate something!
|
||||
if (!gen_php && !gen_phpi && !gen_xsd && !gen_alterl && generator_strings.empty()) {
|
||||
if (!gen_php && !gen_phpi && !gen_xsd && !gen_erl && generator_strings.empty()) {
|
||||
fprintf(stderr, "!!! No output language(s) specified\n\n");
|
||||
usage();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ SUBDIRS += java
|
||||
endif
|
||||
|
||||
if ENABLE_ERLANG
|
||||
SUBDIRS += alterl
|
||||
SUBDIRS += erl
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
@ -7,7 +7,7 @@ INCLUDEDIR=include
|
||||
TARGETDIR=ebin
|
||||
SRCDIR=src
|
||||
|
||||
ALL_INCLUDEDIR=$(GEN_INCLUDEDIR) $(INCLUDEDIR) ../../lib/alterl/include
|
||||
ALL_INCLUDEDIR=$(GEN_INCLUDEDIR) $(INCLUDEDIR) ../../lib/erl/include
|
||||
INCLUDEFLAGS=$(patsubst %,-I%, ${ALL_INCLUDEDIR})
|
||||
|
||||
MODULES = stress_server test_server test_disklog
|
||||
@ -24,8 +24,8 @@ THRIFT = ../../compiler/cpp/thrift
|
||||
|
||||
${GENDIR}/: ${RPCFILE}
|
||||
rm -rf ${GENDIR}
|
||||
${THRIFT} -alterl ${TEST_RPCFILE}
|
||||
${THRIFT} -alterl ${STRESS_RPCFILE}
|
||||
${THRIFT} -erl ${TEST_RPCFILE}
|
||||
${THRIFT} -erl ${STRESS_RPCFILE}
|
||||
mkdir -p ${GEN_INCLUDEDIR}
|
||||
mkdir -p ${GEN_SRCDIR}
|
||||
mkdir -p ${GEN_TARGETDIR}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
ERL_THRIFT=../../lib/alterl
|
||||
ERL_THRIFT=../../lib/erl
|
||||
|
||||
if ! [ -d ${ERL_THRIFT}/ebin ]; then
|
||||
echo "Please build the Thrift library by running \`make' in ${ERL_THRIFT}"
|
Loading…
Reference in New Issue
Block a user