Merging in some Smalltalk changes from Patrick Collison
Reviewed By: mcslee
Test Plan: Rebuild Thrift compiler
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665361 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 0ac02d4..62a3e5b 100644
--- a/compiler/cpp/src/generate/t_st_generator.cc
+++ b/compiler/cpp/src/generate/t_st_generator.cc
@@ -74,10 +74,14 @@
void t_st_generator::close_generator() {
generate_force_consts();
-
f_.close();
}
+string t_st_generator::generated_category() {
+ string cat = program_->get_smalltalk_category();
+ return cat.size() ? cat : "Generated-" + class_name();
+}
+
/**
* Generates a typedef. This is not done in Smalltalk, types are all implicit.
*
@@ -91,7 +95,7 @@
out << indent() << "instanceVariableNames: ''" << endl <<
indent() << "classVariableNames: ''" << endl <<
indent() << "poolDictionaries: ''" << endl <<
- indent() << "category: 'Thrift-Generated-" << class_name() << "'!" << endl << endl;
+ indent() << "category: '" << generated_category() << "'!" << endl << endl;
}
void t_st_generator::st_method(std::ofstream &out, string cls, string name) {
@@ -346,7 +350,7 @@
out << "'\n" <<
"\tclassVariableNames: ''\n" <<
"\tpoolDictionaries: ''\n" <<
- "\tcategory: 'Thrift-Generated-" << class_name() << "'!\n\n";
+ "\tcategory: '" << generated_category() << "'!\n\n";
generate_accessors(out, tstruct);
}
@@ -378,8 +382,10 @@
if (members.size() > 0) {
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
- st_accessors(out, capitalize(type_name(tstruct)), sanitize((*m_iter)->get_name()),
- a_type((*m_iter)->get_type()));
+ st_accessors(out,
+ capitalize(type_name(tstruct)),
+ sanitize((*m_iter)->get_name()),
+ a_type((*m_iter)->get_type()));
}
out << endl;
}
@@ -547,14 +553,14 @@
indent_up();
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
- bool optional = (*fld_iter)->get_req() == t_field::OPTIONAL;
+ bool optional = (*fld_iter)->get_req() == t_field::OPTIONAL;
string fname = (*fld_iter)->get_name();
- string accessor = sname + " " + sanitize(fname);
+ string accessor = sname + " " + sanitize(fname);
- if (optional) {
- out << indent() << accessor << " ifNotNil: [" << endl;
- indent_up();
- }
+ if (optional) {
+ out << indent() << accessor << " ifNotNil: [" << endl;
+ indent_up();
+ }
out << indent() << "oprot writeFieldBegin: (TField new name: '" << fname <<
"'; type: " << type_to_enum((*fld_iter)->get_type()) <<
@@ -563,15 +569,15 @@
out << indent() << write_val((*fld_iter)->get_type(), accessor) << "." << endl <<
indent() << "oprot writeFieldEnd";
- if(optional) {
- out << "]";
- indent_down();
- }
+ if (optional) {
+ out << "]";
+ indent_down();
+ }
- out << "." << endl;
+ out << "." << endl;
}
- out << indent() << "oprot writeFieldStop; writeStructEnd] value";
+ out << indent() << "oprot writeFieldStop; writeStructEnd] value";
indent_down();
return out.str();
@@ -585,8 +591,9 @@
string desc = temp_name();
string found = temp_name();
- if(clsName.size() == 0)
+ if (clsName.size() == 0) {
clsName = tstruct->get_name();
+ }
out << "[|" << desc << " " << val << "|" << endl;
indent_up();
@@ -606,48 +613,48 @@
out << indent() << found << " := true." << endl <<
indent() << val << " " << sanitize((*fld_iter)->get_name()) << ": " <<
- read_val((*fld_iter)->get_type());
+ read_val((*fld_iter)->get_type());
indent_down();
- out << "]." << endl;
+ out << "]." << endl;
}
out << indent() << found << " ifNil: [iprot skip: " << desc << " type]]." << endl;
indent_down();
out << indent() << "oprot readStructEnd." << endl <<
- indent() << val << "] value";
+ indent() << val << "] value";
indent_down();
return out.str();
}
string t_st_generator::write_val(t_type *t, string fname) {
- t = get_true_type(t);
+ t = get_true_type(t);
- if(t->is_base_type()) {
- t_base_type::t_base tbase = ((t_base_type*) t)->get_base();
- switch(tbase) {
- case t_base_type::TYPE_DOUBLE:
- return "iprot writeDouble: " + fname + " asFloat";
- break;
- case t_base_type::TYPE_BYTE:
- case t_base_type::TYPE_I16:
- case t_base_type::TYPE_I32:
- case t_base_type::TYPE_I64:
- return "iprot write" + capitalize(type_name(t)) + ": " + fname + " asInteger";
- default:
- return "iprot write" + capitalize(type_name(t)) + ": " + fname;
- }
- } else if(t->is_map()) {
+ if (t->is_base_type()) {
+ t_base_type::t_base tbase = ((t_base_type*) t)->get_base();
+ switch(tbase) {
+ case t_base_type::TYPE_DOUBLE:
+ return "iprot writeDouble: " + fname + " asFloat";
+ break;
+ case t_base_type::TYPE_BYTE:
+ case t_base_type::TYPE_I16:
+ case t_base_type::TYPE_I32:
+ case t_base_type::TYPE_I64:
+ return "iprot write" + capitalize(type_name(t)) + ": " + fname + " asInteger";
+ default:
+ return "iprot write" + capitalize(type_name(t)) + ": " + fname;
+ }
+ } else if (t->is_map()) {
return map_writer((t_map*) t, fname);
- } else if(t->is_struct() || t->is_xception()) {
+ } else if (t->is_struct() || t->is_xception()) {
return struct_writer((t_struct*) t, fname);
- } else if(t->is_list()) {
+ } else if (t->is_list()) {
return list_writer((t_list*) t, fname);
- } else if(t->is_set()) {
+ } else if (t->is_set()) {
return set_writer((t_set*) t, fname);
- } else if(t->is_enum()) {
+ } else if (t->is_enum()) {
return "iprot writeI32: " + fname;
} else {
throw "Sorry, I don't know how to write this: " + type_name(t);
@@ -655,19 +662,19 @@
}
string t_st_generator::read_val(t_type *t) {
- t = get_true_type(t);
+ t = get_true_type(t);
- if(t->is_base_type()) {
+ if (t->is_base_type()) {
return "iprot read" + capitalize(type_name(t));
- } else if(t->is_map()) {
+ } else if (t->is_map()) {
return map_reader((t_map*) t);
- } else if(t->is_struct() || t->is_xception()) {
+ } else if (t->is_struct() || t->is_xception()) {
return struct_reader((t_struct*) t);
- } else if(t->is_list()) {
+ } else if (t->is_list()) {
return list_reader((t_list*) t);
- } else if(t->is_set()) {
+ } else if (t->is_set()) {
return set_reader((t_set*) t);
- } else if(t->is_enum()) {
+ } else if (t->is_enum()) {
return "iprot readI32";
} else {
throw "Sorry, I don't know how to read this: " + type_name(t);
@@ -744,21 +751,22 @@
}
string t_st_generator::function_types_comment(t_function* fn) {
- std::ostringstream out;
+ std::ostringstream out;
const vector<t_field*>& fields = fn->get_arglist()->get_members();
vector<t_field*>::const_iterator f_iter;
- out << "\"";
+ out << "\"";
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
- out << (*f_iter)->get_name() << ": " << type_name((*f_iter)->get_type());
- if((f_iter + 1) != fields.end())
- out << ", ";
- }
+ out << (*f_iter)->get_name() << ": " << type_name((*f_iter)->get_type());
+ if ((f_iter + 1) != fields.end()) {
+ out << ", ";
+ }
+ }
- out << "\"";
+ out << "\"";
- return out.str();
+ return out.str();
}
/**
@@ -781,44 +789,47 @@
"\tinstanceVariableNames: ''\n" <<
"\tclassVariableNames: ''\n" <<
"\tpoolDictionaries: ''\n" <<
- "\tcategory: 'ThriftGenerated-" << class_name() << "'!\n\n";
+ "\tcategory: '" << generated_category() << "'!\n\n";
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
string funname = (*f_iter)->get_name();
string signature = function_signature(*f_iter);
st_method(f_, client_class_name(), signature);
- f_ << function_types_comment(*f_iter) << endl <<
- indent() << "self send" << capitalize(signature) << "." << endl;
+ f_ << function_types_comment(*f_iter) << endl <<
+ indent() << "self send" << capitalize(signature) << "." << endl;
- if(!(*f_iter)->is_async())
+ if (!(*f_iter)->is_async()) {
f_ << indent() << "^ self recv" << capitalize(funname) << " success " << endl;
+ }
st_close_method(f_);
generate_send_method(*f_iter);
- if(!(*f_iter)->is_async()) generate_recv_method(*f_iter);
+ if (!(*f_iter)->is_async()) {
+ generate_recv_method(*f_iter);
+ }
}
}
string t_st_generator::sanitize(string s) {
- std::ostringstream out;
- bool underscore = false;
+ std::ostringstream out;
+ bool underscore = false;
- for(unsigned int i = 0; i < s.size(); i++) {
- if(s[i] == '_') {
- underscore = true;
- continue;
- }
- if(underscore) {
- out << (char) toupper(s[i]);
- underscore = false;
- continue;
- }
- out << s[i];
- }
+ for (unsigned int i = 0; i < s.size(); i++) {
+ if (s[i] == '_') {
+ underscore = true;
+ continue;
+ }
+ if (underscore) {
+ out << (char) toupper(s[i]);
+ underscore = false;
+ continue;
+ }
+ out << s[i];
+ }
- return out.str();
+ return out.str();
}
/**
@@ -878,7 +889,7 @@
case t_base_type::TYPE_VOID:
throw "NO T_VOID CONSTRUCT";
case t_base_type::TYPE_STRING:
- return "TType string";
+ return "TType string";
case t_base_type::TYPE_BOOL:
return "TType bool";
case t_base_type::TYPE_BYTE:
diff --git a/compiler/cpp/src/generate/t_st_generator.h b/compiler/cpp/src/generate/t_st_generator.h
index 141555f..6491cbd 100644
--- a/compiler/cpp/src/generate/t_st_generator.h
+++ b/compiler/cpp/src/generate/t_st_generator.h
@@ -111,6 +111,7 @@
std::string a_type(t_type* type);
bool is_vowel(char c);
std::string temp_name();
+ std::string generated_category();
private:
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index 224c9d5..ddc121c 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -192,6 +192,14 @@
return cocoa_prefix_;
}
+ void set_smalltalk_category(std::string smalltalk_category) {
+ smalltalk_category_ = smalltalk_category;
+ }
+
+ const std::string& get_smalltalk_category() const {
+ return smalltalk_category_;
+ }
+
private:
// File path
@@ -247,6 +255,8 @@
// Cocoa/Objective-C naming prefix
std::string cocoa_prefix_;
+ // Smalltalk category
+ std::string smalltalk_category_;
};
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index baaef5c..d371658 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -41,139 +41,141 @@
* Helper definitions, comments, constants, and whatnot
*/
-intconstant ([+-]?[0-9]+)
-hexconstant ("0x"[0-9A-Fa-f]+)
-dubconstant ([+-]?[0-9]*(\.[0-9]+)?([eE][+-]?[0-9]+)?)
-identifier ([a-zA-Z_][\.a-zA-Z_0-9]*)
-whitespace ([ \t\r\n]*)
-sillycomm ("/*""*"*"*/")
-multicomm ("/*"[^*]"/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/")
-doctext ("/**"([^*/]|[^*]"/"|"*"[^/])*"*"*"*/")
-comment ("//"[^\n]*)
-unixcomment ("#"[^\n]*)
-symbol ([:;\,\{\}\(\)\=<>\[\]])
-dliteral ("\""[^"]*"\"")
-sliteral ("'"[^']*"'")
+intconstant ([+-]?[0-9]+)
+hexconstant ("0x"[0-9A-Fa-f]+)
+dubconstant ([+-]?[0-9]*(\.[0-9]+)?([eE][+-]?[0-9]+)?)
+identifier ([a-zA-Z_][\.a-zA-Z_0-9]*)
+whitespace ([ \t\r\n]*)
+sillycomm ("/*""*"*"*/")
+multicomm ("/*"[^*]"/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/")
+doctext ("/**"([^*/]|[^*]"/"|"*"[^/])*"*"*"*/")
+comment ("//"[^\n]*)
+unixcomment ("#"[^\n]*)
+symbol ([:;\,\{\}\(\)\=<>\[\]])
+dliteral ("\""[^"]*"\"")
+sliteral ("'"[^']*"'")
+st_identifier ([a-zA-Z-][\.a-zA-Z_0-9-]*)
%%
-{whitespace} { /* do nothing */ }
-{sillycomm} { /* do nothing */ }
-{multicomm} { /* do nothing */ }
-{comment} { /* do nothing */ }
-{unixcomment} { /* do nothing */ }
+{whitespace} { /* do nothing */ }
+{sillycomm} { /* do nothing */ }
+{multicomm} { /* do nothing */ }
+{comment} { /* do nothing */ }
+{unixcomment} { /* do nothing */ }
-{symbol} { return yytext[0]; }
+{symbol} { return yytext[0]; }
-"namespace" { return tok_namespace; }
-"cpp_namespace" { return tok_cpp_namespace; }
-"cpp_include" { return tok_cpp_include; }
-"cpp_type" { return tok_cpp_type; }
-"java_package" { return tok_java_package; }
-"cocoa_prefix" { return tok_cocoa_prefix; }
-"php_namespace" { return tok_php_namespace; }
-"py_module" { return tok_py_module; }
-"perl_package" { return tok_perl_package; }
-"ruby_namespace" { return tok_ruby_namespace; }
-"xsd_all" { return tok_xsd_all; }
-"xsd_optional" { return tok_xsd_optional; }
-"xsd_nillable" { return tok_xsd_nillable; }
-"xsd_namespace" { return tok_xsd_namespace; }
-"xsd_attrs" { return tok_xsd_attrs; }
-"include" { return tok_include; }
+"namespace" { return tok_namespace; }
+"cpp_namespace" { return tok_cpp_namespace; }
+"cpp_include" { return tok_cpp_include; }
+"cpp_type" { return tok_cpp_type; }
+"java_package" { return tok_java_package; }
+"cocoa_prefix" { return tok_cocoa_prefix; }
+"php_namespace" { return tok_php_namespace; }
+"py_module" { return tok_py_module; }
+"perl_package" { return tok_perl_package; }
+"ruby_namespace" { return tok_ruby_namespace; }
+"smalltalk_category" { return tok_smalltalk_category; }
+"xsd_all" { return tok_xsd_all; }
+"xsd_optional" { return tok_xsd_optional; }
+"xsd_nillable" { return tok_xsd_nillable; }
+"xsd_namespace" { return tok_xsd_namespace; }
+"xsd_attrs" { return tok_xsd_attrs; }
+"include" { return tok_include; }
+"void" { return tok_void; }
+"bool" { return tok_bool; }
+"byte" { return tok_byte; }
+"i16" { return tok_i16; }
+"i32" { return tok_i32; }
+"i64" { return tok_i64; }
+"double" { return tok_double; }
+"string" { return tok_string; }
+"binary" { return tok_binary; }
+"slist" { return tok_slist; }
+"senum" { return tok_senum; }
+"map" { return tok_map; }
+"list" { return tok_list; }
+"set" { return tok_set; }
+"async" { return tok_async; }
+"typedef" { return tok_typedef; }
+"struct" { return tok_struct; }
+"exception" { return tok_xception; }
+"extends" { return tok_extends; }
+"throws" { return tok_throws; }
+"service" { return tok_service; }
+"enum" { return tok_enum; }
+"const" { return tok_const; }
+"required" { return tok_required; }
+"optional" { return tok_optional; }
-"void" { return tok_void; }
-"bool" { return tok_bool; }
-"byte" { return tok_byte; }
-"i16" { return tok_i16; }
-"i32" { return tok_i32; }
-"i64" { return tok_i64; }
-"double" { return tok_double; }
-"string" { return tok_string; }
-"binary" { return tok_binary; }
-"slist" { return tok_slist; }
-"senum" { return tok_senum; }
-"map" { return tok_map; }
-"list" { return tok_list; }
-"set" { return tok_set; }
-"async" { return tok_async; }
-"typedef" { return tok_typedef; }
-"struct" { return tok_struct; }
-"exception" { return tok_xception; }
-"extends" { return tok_extends; }
-"throws" { return tok_throws; }
-"service" { return tok_service; }
-"enum" { return tok_enum; }
-"const" { return tok_const; }
-"required" { return tok_required; }
-"optional" { return tok_optional; }
-"abstract" { thrift_reserved_keyword(yytext); }
-"and" { thrift_reserved_keyword(yytext); }
-"as" { thrift_reserved_keyword(yytext); }
-"assert" { thrift_reserved_keyword(yytext); }
-"break" { thrift_reserved_keyword(yytext); }
-"case" { thrift_reserved_keyword(yytext); }
-"class" { thrift_reserved_keyword(yytext); }
-"continue" { thrift_reserved_keyword(yytext); }
-"declare" { thrift_reserved_keyword(yytext); }
-"def" { thrift_reserved_keyword(yytext); }
-"default" { thrift_reserved_keyword(yytext); }
-"del" { thrift_reserved_keyword(yytext); }
-"delete" { thrift_reserved_keyword(yytext); }
-"do" { thrift_reserved_keyword(yytext); }
-"elif" { thrift_reserved_keyword(yytext); }
-"else" { thrift_reserved_keyword(yytext); }
-"elseif" { thrift_reserved_keyword(yytext); }
-"except" { thrift_reserved_keyword(yytext); }
-"exec" { thrift_reserved_keyword(yytext); }
-"false" { thrift_reserved_keyword(yytext); }
-"final" { thrift_reserved_keyword(yytext); }
-"finally" { thrift_reserved_keyword(yytext); }
-"float" { thrift_reserved_keyword(yytext); }
-"for" { thrift_reserved_keyword(yytext); }
-"foreach" { thrift_reserved_keyword(yytext); }
-"function" { thrift_reserved_keyword(yytext); }
-"global" { thrift_reserved_keyword(yytext); }
-"goto" { thrift_reserved_keyword(yytext); }
-"if" { thrift_reserved_keyword(yytext); }
-"implements" { thrift_reserved_keyword(yytext); }
-"import" { thrift_reserved_keyword(yytext); }
-"in" { thrift_reserved_keyword(yytext); }
-"inline" { thrift_reserved_keyword(yytext); }
-"instanceof" { thrift_reserved_keyword(yytext); }
-"interface" { thrift_reserved_keyword(yytext); }
-"is" { thrift_reserved_keyword(yytext); }
-"lambda" { thrift_reserved_keyword(yytext); }
-"native" { thrift_reserved_keyword(yytext); }
-"new" { thrift_reserved_keyword(yytext); }
-"not" { thrift_reserved_keyword(yytext); }
-"or" { thrift_reserved_keyword(yytext); }
-"pass" { thrift_reserved_keyword(yytext); }
-"public" { thrift_reserved_keyword(yytext); }
-"print" { thrift_reserved_keyword(yytext); }
-"private" { thrift_reserved_keyword(yytext); }
-"protected" { thrift_reserved_keyword(yytext); }
-"raise" { thrift_reserved_keyword(yytext); }
-"return" { thrift_reserved_keyword(yytext); }
-"sizeof" { thrift_reserved_keyword(yytext); }
-"static" { thrift_reserved_keyword(yytext); }
-"switch" { thrift_reserved_keyword(yytext); }
-"synchronized" { thrift_reserved_keyword(yytext); }
-"this" { thrift_reserved_keyword(yytext); }
-"throw" { thrift_reserved_keyword(yytext); }
-"transient" { thrift_reserved_keyword(yytext); }
-"true" { thrift_reserved_keyword(yytext); }
-"try" { thrift_reserved_keyword(yytext); }
-"unsigned" { thrift_reserved_keyword(yytext); }
-"var" { thrift_reserved_keyword(yytext); }
-"virtual" { thrift_reserved_keyword(yytext); }
-"volatile" { thrift_reserved_keyword(yytext); }
-"while" { thrift_reserved_keyword(yytext); }
-"with" { thrift_reserved_keyword(yytext); }
-"union" { thrift_reserved_keyword(yytext); }
-"yield" { thrift_reserved_keyword(yytext); }
+"abstract" { thrift_reserved_keyword(yytext); }
+"and" { thrift_reserved_keyword(yytext); }
+"as" { thrift_reserved_keyword(yytext); }
+"assert" { thrift_reserved_keyword(yytext); }
+"break" { thrift_reserved_keyword(yytext); }
+"case" { thrift_reserved_keyword(yytext); }
+"class" { thrift_reserved_keyword(yytext); }
+"continue" { thrift_reserved_keyword(yytext); }
+"declare" { thrift_reserved_keyword(yytext); }
+"def" { thrift_reserved_keyword(yytext); }
+"default" { thrift_reserved_keyword(yytext); }
+"del" { thrift_reserved_keyword(yytext); }
+"delete" { thrift_reserved_keyword(yytext); }
+"do" { thrift_reserved_keyword(yytext); }
+"elif" { thrift_reserved_keyword(yytext); }
+"else" { thrift_reserved_keyword(yytext); }
+"elseif" { thrift_reserved_keyword(yytext); }
+"except" { thrift_reserved_keyword(yytext); }
+"exec" { thrift_reserved_keyword(yytext); }
+"false" { thrift_reserved_keyword(yytext); }
+"final" { thrift_reserved_keyword(yytext); }
+"finally" { thrift_reserved_keyword(yytext); }
+"float" { thrift_reserved_keyword(yytext); }
+"for" { thrift_reserved_keyword(yytext); }
+"foreach" { thrift_reserved_keyword(yytext); }
+"function" { thrift_reserved_keyword(yytext); }
+"global" { thrift_reserved_keyword(yytext); }
+"goto" { thrift_reserved_keyword(yytext); }
+"if" { thrift_reserved_keyword(yytext); }
+"implements" { thrift_reserved_keyword(yytext); }
+"import" { thrift_reserved_keyword(yytext); }
+"in" { thrift_reserved_keyword(yytext); }
+"inline" { thrift_reserved_keyword(yytext); }
+"instanceof" { thrift_reserved_keyword(yytext); }
+"interface" { thrift_reserved_keyword(yytext); }
+"is" { thrift_reserved_keyword(yytext); }
+"lambda" { thrift_reserved_keyword(yytext); }
+"native" { thrift_reserved_keyword(yytext); }
+"new" { thrift_reserved_keyword(yytext); }
+"not" { thrift_reserved_keyword(yytext); }
+"or" { thrift_reserved_keyword(yytext); }
+"pass" { thrift_reserved_keyword(yytext); }
+"public" { thrift_reserved_keyword(yytext); }
+"print" { thrift_reserved_keyword(yytext); }
+"private" { thrift_reserved_keyword(yytext); }
+"protected" { thrift_reserved_keyword(yytext); }
+"raise" { thrift_reserved_keyword(yytext); }
+"return" { thrift_reserved_keyword(yytext); }
+"sizeof" { thrift_reserved_keyword(yytext); }
+"static" { thrift_reserved_keyword(yytext); }
+"switch" { thrift_reserved_keyword(yytext); }
+"synchronized" { thrift_reserved_keyword(yytext); }
+"this" { thrift_reserved_keyword(yytext); }
+"throw" { thrift_reserved_keyword(yytext); }
+"transient" { thrift_reserved_keyword(yytext); }
+"true" { thrift_reserved_keyword(yytext); }
+"try" { thrift_reserved_keyword(yytext); }
+"unsigned" { thrift_reserved_keyword(yytext); }
+"var" { thrift_reserved_keyword(yytext); }
+"virtual" { thrift_reserved_keyword(yytext); }
+"volatile" { thrift_reserved_keyword(yytext); }
+"while" { thrift_reserved_keyword(yytext); }
+"with" { thrift_reserved_keyword(yytext); }
+"union" { thrift_reserved_keyword(yytext); }
+"yield" { thrift_reserved_keyword(yytext); }
{intconstant} {
yylval.iconst = atoi(yytext);
@@ -195,6 +197,11 @@
return tok_identifier;
}
+{st_identifier} {
+ yylval.id = strdup(yytext);
+ return tok_st_identifier;
+}
+
{dliteral} {
yylval.id = strdup(yytext+1);
yylval.id[strlen(yylval.id)-1] = '\0';
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index cd727c1..5d7cfcc 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -60,6 +60,7 @@
%token<id> tok_identifier
%token<id> tok_literal
%token<dtext> tok_doctext
+%token<id> tok_st_identifier
/**
* Constant values
@@ -85,6 +86,7 @@
%token tok_xsd_namespace
%token tok_xsd_attrs
%token tok_ruby_namespace
+%token tok_smalltalk_category
%token tok_cocoa_prefix
/**
@@ -211,7 +213,7 @@
CaptureDocText:
{
if (g_parse_mode == PROGRAM) {
- $$ = g_doctext;
+ $$ = g_doctext;
g_doctext = NULL;
} else {
$$ = NULL;
@@ -293,6 +295,13 @@
g_program->set_ruby_namespace($2);
}
}
+| tok_smalltalk_category tok_st_identifier
+ {
+ pdebug("Header -> tok_smalltalk_category tok_st_identifier");
+ if (g_parse_mode == PROGRAM) {
+ g_program->set_smalltalk_category($2);
+ }
+ }
| tok_java_package tok_identifier
{
pdebug("Header -> tok_java_package tok_identifier");
@@ -346,7 +355,7 @@
pdebug("Definition -> Const");
if (g_parse_mode == PROGRAM) {
g_program->add_const($1);
- }
+ }
$$ = $1;
}
| TypeDefinition
@@ -411,7 +420,7 @@
}
Typedef:
- tok_typedef DefinitionType tok_identifier
+ tok_typedef DefinitionType tok_identifier
{
pdebug("TypeDef -> tok_typedef DefinitionType tok_identifier");
t_typedef *td = new t_typedef(g_program, $2, $3);
diff --git a/lib/st/README b/lib/st/README
index 14c72db..7ceb7ff 100644
--- a/lib/st/README
+++ b/lib/st/README
@@ -1,11 +1,11 @@
Author: Patrick Collison <patrick@collison.ie>
Last updated Nov 2007
-To get started, just file in thrift.st with Squeak, and run something like:
+To get started, just file in thrift.st with Squeak, run thrift -st
+on the tutorial .thrift files (and file in the resulting code), and
+then:
-sock := TSocket new host: 'localhost'; port: 9090; open.
-prot := TBinaryProtocol new transport: sock.
-calc := CalculatorClient new inProtocol: prot.
+calc := CalculatorClient binaryOnHost: 'localhost' port: '9090'
calc addNum1: 10 num2: 15
-Tested in Squeak 3.7, but should work fine with anything later.
\ No newline at end of file
+Tested in Squeak 3.7, but should work fine with anything later.
diff --git a/lib/st/thrift.st b/lib/st/thrift.st
index c24f616..445534c 100644
--- a/lib/st/thrift.st
+++ b/lib/st/thrift.st
@@ -1,6 +1,5 @@
SystemOrganization addCategory: #Thrift!
SystemOrganization addCategory: #'Thrift-Protocol'!
-SystemOrganization addCategory: #'Thrift-Test'!
SystemOrganization addCategory: #'Thrift-Transport'!
Error subclass: #TError
@@ -59,149 +58,19 @@
poolDictionaries: ''
category: 'Thrift-Transport'!
-Error subclass: #Xception
- instanceVariableNames: 'errorCode message'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-!Xception methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-errorCode
- ^ errorCode! !
-
-!Xception methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-errorCode: anI32
- errorCode := anI32! !
-
-!Xception methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-message
- ^ message! !
-
-!Xception methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-message: aString
- message := aString! !
-
-Error subclass: #Xception2
- instanceVariableNames: 'errorCode structThing'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-!Xception2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-errorCode
- ^ errorCode! !
-
-!Xception2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-errorCode: anI32
- errorCode := anI32! !
-
-!Xception2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-structThing
- ^ structThing! !
-
-!Xception2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-structThing: aXtruct
- structThing := aXtruct! !
-
-Object subclass: #Bonk
- instanceVariableNames: 'message type'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-!Bonk methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-message
- ^ message! !
-
-!Bonk methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-message: aString
- message := aString! !
-
-!Bonk methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-type
- ^ type! !
-
-!Bonk methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-type: anI32
- type := anI32! !
-
-Object subclass: #EmptyStruct
- instanceVariableNames: ''
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-Object subclass: #Insanity
- instanceVariableNames: 'userMap xtructs'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-!Insanity methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-userMap
- ^ userMap! !
-
-!Insanity methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-userMap: a
- userMap := a! !
-
-!Insanity methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-xtructs
- ^ xtructs! !
-
-!Insanity methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-xtructs: a
- xtructs := a! !
-
Object subclass: #TClient
instanceVariableNames: 'iprot oprot seqid remoteSeqid'
classVariableNames: ''
poolDictionaries: ''
category: 'Thrift'!
-TClient subclass: #SecondServiceClient
- instanceVariableNames: ''
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-!SecondServiceClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-blahBlah
- ""
- self sendBlahBlah.
- ^ self recvBlahBlah success
-! !
-
-!SecondServiceClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvBlahBlah
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp118 temp117|
- temp117 := TResult new.
- iprot readStructBegin.
- [temp118 := iprot readFieldBegin.
- temp118 type = TType stop] whileFalse: [|temp119|
- temp118 id = 0 ifTrue: [
- temp119 := true.
- temp117 success: iprot readVoid].
- temp119 ifNil: [iprot skip: temp118 type]].
- oprot readStructEnd.
- temp117] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!SecondServiceClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendBlahBlah
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'blahBlah';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'BlahBlah_args').
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
+!TClient class methodsFor: 'as yet unclassified' stamp: 'pc 11/7/2007 06:00'!
+binaryOnHost: aString port: anInteger
+ | sock |
+ sock := TSocket new host: aString; port: anInteger; open; yourself.
+ ^ self new
+ inProtocol: (TBinaryProtocol new transport: sock);
+ yourself! !
!TClient methodsFor: 'as yet unclassified' stamp: 'pc 10/24/2007 23:03'!
inProtocol: aProtocol
@@ -222,1134 +91,12 @@
validateRemoteMessage: aMsg
remoteSeqid
ifNil: [remoteSeqid := aMsg seqid]
- ifNotNil:
+ ifNotNil:
[(remoteSeqid + 1) = aMsg seqid ifFalse:
[TProtocolError signal: 'Bad seqid: ', aMsg seqid asString,
'; wanted: ', remoteSeqid asString].
remoteSeqid := aMsg seqid]! !
-TClient subclass: #ThriftTestClient
- instanceVariableNames: ''
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestByte
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp7 temp6|
- temp6 := TResult new.
- iprot readStructBegin.
- [temp7 := iprot readFieldBegin.
- temp7 type = TType stop] whileFalse: [|temp8|
- temp7 id = 0 ifTrue: [
- temp8 := true.
- temp6 success: iprot readByte].
- temp8 ifNil: [iprot skip: temp7 type]].
- oprot readStructEnd.
- temp6] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestDouble
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp19 temp18|
- temp18 := TResult new.
- iprot readStructBegin.
- [temp19 := iprot readFieldBegin.
- temp19 type = TType stop] whileFalse: [|temp20|
- temp19 id = 0 ifTrue: [
- temp20 := true.
- temp18 success: iprot readDouble].
- temp20 ifNil: [iprot skip: temp19 type]].
- oprot readStructEnd.
- temp18] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestEnum
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp56 temp55|
- temp55 := TResult new.
- iprot readStructBegin.
- [temp56 := iprot readFieldBegin.
- temp56 type = TType stop] whileFalse: [|temp57|
- temp56 id = 0 ifTrue: [
- temp57 := true.
- temp55 success: iprot readI32].
- temp57 ifNil: [iprot skip: temp56 type]].
- oprot readStructEnd.
- temp55] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestException
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp97 temp96|
- temp96 := TResult new.
- iprot readStructBegin.
- [temp97 := iprot readFieldBegin.
- temp97 type = TType stop] whileFalse: [|temp98|
- temp97 id = 0 ifTrue: [
- temp98 := true.
- temp96 success: iprot readVoid].
- temp97 id = -2 ifTrue: [
- temp98 := true.
- temp96 exception: [|temp100 temp99|
- temp99 := Xception new.
- iprot readStructBegin.
- [temp100 := iprot readFieldBegin.
- temp100 type = TType stop] whileFalse: [|temp101|
- temp100 id = 1 ifTrue: [
- temp101 := true.
- temp99 errorCode: iprot readI32].
- temp100 id = 2 ifTrue: [
- temp101 := true.
- temp99 message: iprot readString].
- temp101 ifNil: [iprot skip: temp100 type]].
- oprot readStructEnd.
- temp99] value].
- temp98 ifNil: [iprot skip: temp97 type]].
- oprot readStructEnd.
- temp96] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestI16
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp10 temp9|
- temp9 := TResult new.
- iprot readStructBegin.
- [temp10 := iprot readFieldBegin.
- temp10 type = TType stop] whileFalse: [|temp11|
- temp10 id = 0 ifTrue: [
- temp11 := true.
- temp9 success: iprot readI16].
- temp11 ifNil: [iprot skip: temp10 type]].
- oprot readStructEnd.
- temp9] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestI32
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp13 temp12|
- temp12 := TResult new.
- iprot readStructBegin.
- [temp13 := iprot readFieldBegin.
- temp13 type = TType stop] whileFalse: [|temp14|
- temp13 id = 0 ifTrue: [
- temp14 := true.
- temp12 success: iprot readI32].
- temp14 ifNil: [iprot skip: temp13 type]].
- oprot readStructEnd.
- temp12] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestI64
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp16 temp15|
- temp15 := TResult new.
- iprot readStructBegin.
- [temp16 := iprot readFieldBegin.
- temp16 type = TType stop] whileFalse: [|temp17|
- temp16 id = 0 ifTrue: [
- temp17 := true.
- temp15 success: iprot readI64].
- temp17 ifNil: [iprot skip: temp16 type]].
- oprot readStructEnd.
- temp15] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestInsanity
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp72 temp71|
- temp71 := TResult new.
- iprot readStructBegin.
- [temp72 := iprot readFieldBegin.
- temp72 type = TType stop] whileFalse: [|temp73|
- temp72 id = 0 ifTrue: [
- temp73 := true.
- temp71 success: [|temp74 temp75|
- temp74 := iprot readMapBegin.
- temp75 := Dictionary new.
- temp74 size timesRepeat: [
- temp75 at: iprot readI64 put: [|temp76 temp77|
- temp76 := iprot readMapBegin.
- temp77 := Dictionary new.
- temp76 size timesRepeat: [
- temp77 at: iprot readI32 put: [|temp79 temp78|
- temp78 := Insanity new.
- iprot readStructBegin.
- [temp79 := iprot readFieldBegin.
- temp79 type = TType stop] whileFalse: [|temp80|
- temp79 id = 1 ifTrue: [
- temp80 := true.
- temp78 userMap: [|temp81 temp82|
- temp81 := iprot readMapBegin.
- temp82 := Dictionary new.
- temp81 size timesRepeat: [
- temp82 at: iprot readI32 put: iprot readI64].
- iprot readMapEnd.
- temp82] value].
- temp79 id = 2 ifTrue: [
- temp80 := true.
- temp78 xtructs: [|temp83 temp84| temp83 := iprot readListBegin.
- temp84 := OrderedCollection new.
- temp83 size timesRepeat: [
- temp84 add: [|temp86 temp85|
- temp85 := Xtruct new.
- iprot readStructBegin.
- [temp86 := iprot readFieldBegin.
- temp86 type = TType stop] whileFalse: [|temp87|
- temp86 id = 1 ifTrue: [
- temp87 := true.
- temp85 stringThing: iprot readString].
- temp86 id = 4 ifTrue: [
- temp87 := true.
- temp85 byteThing: iprot readByte].
- temp86 id = 9 ifTrue: [
- temp87 := true.
- temp85 i32Thing: iprot readI32].
- temp86 id = 11 ifTrue: [
- temp87 := true.
- temp85 i64Thing: iprot readI64].
- temp87 ifNil: [iprot skip: temp86 type]].
- oprot readStructEnd.
- temp85] value].
- iprot readListEnd.
- temp84] value].
- temp80 ifNil: [iprot skip: temp79 type]].
- oprot readStructEnd.
- temp78] value].
- iprot readMapEnd.
- temp77] value].
- iprot readMapEnd.
- temp75] value].
- temp73 ifNil: [iprot skip: temp72 type]].
- oprot readStructEnd.
- temp71] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestList
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp51 temp50|
- temp50 := TResult new.
- iprot readStructBegin.
- [temp51 := iprot readFieldBegin.
- temp51 type = TType stop] whileFalse: [|temp52|
- temp51 id = 0 ifTrue: [
- temp52 := true.
- temp50 success: [|temp53 temp54| temp53 := iprot readListBegin.
- temp54 := OrderedCollection new.
- temp53 size timesRepeat: [
- temp54 add: iprot readI32].
- iprot readListEnd.
- temp54] value].
- temp52 ifNil: [iprot skip: temp51 type]].
- oprot readStructEnd.
- temp50] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestMap
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp39 temp38|
- temp38 := TResult new.
- iprot readStructBegin.
- [temp39 := iprot readFieldBegin.
- temp39 type = TType stop] whileFalse: [|temp40|
- temp39 id = 0 ifTrue: [
- temp40 := true.
- temp38 success: [|temp41 temp42|
- temp41 := iprot readMapBegin.
- temp42 := Dictionary new.
- temp41 size timesRepeat: [
- temp42 at: iprot readI32 put: iprot readI32].
- iprot readMapEnd.
- temp42] value].
- temp40 ifNil: [iprot skip: temp39 type]].
- oprot readStructEnd.
- temp38] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestMapMap
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp62 temp61|
- temp61 := TResult new.
- iprot readStructBegin.
- [temp62 := iprot readFieldBegin.
- temp62 type = TType stop] whileFalse: [|temp63|
- temp62 id = 0 ifTrue: [
- temp63 := true.
- temp61 success: [|temp64 temp65|
- temp64 := iprot readMapBegin.
- temp65 := Dictionary new.
- temp64 size timesRepeat: [
- temp65 at: iprot readI32 put: [|temp66 temp67|
- temp66 := iprot readMapBegin.
- temp67 := Dictionary new.
- temp66 size timesRepeat: [
- temp67 at: iprot readI32 put: iprot readI32].
- iprot readMapEnd.
- temp67] value].
- iprot readMapEnd.
- temp65] value].
- temp63 ifNil: [iprot skip: temp62 type]].
- oprot readStructEnd.
- temp61] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestMulti
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp91 temp90|
- temp90 := TResult new.
- iprot readStructBegin.
- [temp91 := iprot readFieldBegin.
- temp91 type = TType stop] whileFalse: [|temp92|
- temp91 id = 0 ifTrue: [
- temp92 := true.
- temp90 success: [|temp94 temp93|
- temp93 := Xtruct new.
- iprot readStructBegin.
- [temp94 := iprot readFieldBegin.
- temp94 type = TType stop] whileFalse: [|temp95|
- temp94 id = 1 ifTrue: [
- temp95 := true.
- temp93 stringThing: iprot readString].
- temp94 id = 4 ifTrue: [
- temp95 := true.
- temp93 byteThing: iprot readByte].
- temp94 id = 9 ifTrue: [
- temp95 := true.
- temp93 i32Thing: iprot readI32].
- temp94 id = 11 ifTrue: [
- temp95 := true.
- temp93 i64Thing: iprot readI64].
- temp95 ifNil: [iprot skip: temp94 type]].
- oprot readStructEnd.
- temp93] value].
- temp92 ifNil: [iprot skip: temp91 type]].
- oprot readStructEnd.
- temp90] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestMultiException
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp103 temp102|
- temp102 := TResult new.
- iprot readStructBegin.
- [temp103 := iprot readFieldBegin.
- temp103 type = TType stop] whileFalse: [|temp104|
- temp103 id = 0 ifTrue: [
- temp104 := true.
- temp102 success: [|temp106 temp105|
- temp105 := Xtruct new.
- iprot readStructBegin.
- [temp106 := iprot readFieldBegin.
- temp106 type = TType stop] whileFalse: [|temp107|
- temp106 id = 1 ifTrue: [
- temp107 := true.
- temp105 stringThing: iprot readString].
- temp106 id = 4 ifTrue: [
- temp107 := true.
- temp105 byteThing: iprot readByte].
- temp106 id = 9 ifTrue: [
- temp107 := true.
- temp105 i32Thing: iprot readI32].
- temp106 id = 11 ifTrue: [
- temp107 := true.
- temp105 i64Thing: iprot readI64].
- temp107 ifNil: [iprot skip: temp106 type]].
- oprot readStructEnd.
- temp105] value].
- temp103 id = -3 ifTrue: [
- temp104 := true.
- temp102 exception: [|temp109 temp108|
- temp108 := Xception new.
- iprot readStructBegin.
- [temp109 := iprot readFieldBegin.
- temp109 type = TType stop] whileFalse: [|temp110|
- temp109 id = 1 ifTrue: [
- temp110 := true.
- temp108 errorCode: iprot readI32].
- temp109 id = 2 ifTrue: [
- temp110 := true.
- temp108 message: iprot readString].
- temp110 ifNil: [iprot skip: temp109 type]].
- oprot readStructEnd.
- temp108] value].
- temp103 id = -4 ifTrue: [
- temp104 := true.
- temp102 exception: [|temp112 temp111|
- temp111 := Xception2 new.
- iprot readStructBegin.
- [temp112 := iprot readFieldBegin.
- temp112 type = TType stop] whileFalse: [|temp113|
- temp112 id = 1 ifTrue: [
- temp113 := true.
- temp111 errorCode: iprot readI32].
- temp112 id = 2 ifTrue: [
- temp113 := true.
- temp111 structThing: [|temp115 temp114|
- temp114 := Xtruct new.
- iprot readStructBegin.
- [temp115 := iprot readFieldBegin.
- temp115 type = TType stop] whileFalse: [|temp116|
- temp115 id = 1 ifTrue: [
- temp116 := true.
- temp114 stringThing: iprot readString].
- temp115 id = 4 ifTrue: [
- temp116 := true.
- temp114 byteThing: iprot readByte].
- temp115 id = 9 ifTrue: [
- temp116 := true.
- temp114 i32Thing: iprot readI32].
- temp115 id = 11 ifTrue: [
- temp116 := true.
- temp114 i64Thing: iprot readI64].
- temp116 ifNil: [iprot skip: temp115 type]].
- oprot readStructEnd.
- temp114] value].
- temp113 ifNil: [iprot skip: temp112 type]].
- oprot readStructEnd.
- temp111] value].
- temp104 ifNil: [iprot skip: temp103 type]].
- oprot readStructEnd.
- temp102] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestNest
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp28 temp27|
- temp27 := TResult new.
- iprot readStructBegin.
- [temp28 := iprot readFieldBegin.
- temp28 type = TType stop] whileFalse: [|temp29|
- temp28 id = 0 ifTrue: [
- temp29 := true.
- temp27 success: [|temp31 temp30|
- temp30 := Xtruct2 new.
- iprot readStructBegin.
- [temp31 := iprot readFieldBegin.
- temp31 type = TType stop] whileFalse: [|temp32|
- temp31 id = 1 ifTrue: [
- temp32 := true.
- temp30 byteThing: iprot readByte].
- temp31 id = 2 ifTrue: [
- temp32 := true.
- temp30 structThing: [|temp34 temp33|
- temp33 := Xtruct new.
- iprot readStructBegin.
- [temp34 := iprot readFieldBegin.
- temp34 type = TType stop] whileFalse: [|temp35|
- temp34 id = 1 ifTrue: [
- temp35 := true.
- temp33 stringThing: iprot readString].
- temp34 id = 4 ifTrue: [
- temp35 := true.
- temp33 byteThing: iprot readByte].
- temp34 id = 9 ifTrue: [
- temp35 := true.
- temp33 i32Thing: iprot readI32].
- temp34 id = 11 ifTrue: [
- temp35 := true.
- temp33 i64Thing: iprot readI64].
- temp35 ifNil: [iprot skip: temp34 type]].
- oprot readStructEnd.
- temp33] value].
- temp31 id = 3 ifTrue: [
- temp32 := true.
- temp30 i32Thing: iprot readI32].
- temp32 ifNil: [iprot skip: temp31 type]].
- oprot readStructEnd.
- temp30] value].
- temp29 ifNil: [iprot skip: temp28 type]].
- oprot readStructEnd.
- temp27] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestSet
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp45 temp44|
- temp44 := TResult new.
- iprot readStructBegin.
- [temp45 := iprot readFieldBegin.
- temp45 type = TType stop] whileFalse: [|temp46|
- temp45 id = 0 ifTrue: [
- temp46 := true.
- temp44 success: [|temp47 temp48| temp47 := iprot readSetBegin.
- temp48 := Set new.
- temp47 size timesRepeat: [
- temp48 add: iprot readI32].
- iprot readSetEnd.
- temp48] value].
- temp46 ifNil: [iprot skip: temp45 type]].
- oprot readStructEnd.
- temp44] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestString
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp4 temp3|
- temp3 := TResult new.
- iprot readStructBegin.
- [temp4 := iprot readFieldBegin.
- temp4 type = TType stop] whileFalse: [|temp5|
- temp4 id = 0 ifTrue: [
- temp5 := true.
- temp3 success: iprot readString].
- temp5 ifNil: [iprot skip: temp4 type]].
- oprot readStructEnd.
- temp3] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestStruct
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp22 temp21|
- temp21 := TResult new.
- iprot readStructBegin.
- [temp22 := iprot readFieldBegin.
- temp22 type = TType stop] whileFalse: [|temp23|
- temp22 id = 0 ifTrue: [
- temp23 := true.
- temp21 success: [|temp25 temp24|
- temp24 := Xtruct new.
- iprot readStructBegin.
- [temp25 := iprot readFieldBegin.
- temp25 type = TType stop] whileFalse: [|temp26|
- temp25 id = 1 ifTrue: [
- temp26 := true.
- temp24 stringThing: iprot readString].
- temp25 id = 4 ifTrue: [
- temp26 := true.
- temp24 byteThing: iprot readByte].
- temp25 id = 9 ifTrue: [
- temp26 := true.
- temp24 i32Thing: iprot readI32].
- temp25 id = 11 ifTrue: [
- temp26 := true.
- temp24 i64Thing: iprot readI64].
- temp26 ifNil: [iprot skip: temp25 type]].
- oprot readStructEnd.
- temp24] value].
- temp23 ifNil: [iprot skip: temp22 type]].
- oprot readStructEnd.
- temp21] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestTypedef
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp59 temp58|
- temp58 := TResult new.
- iprot readStructBegin.
- [temp59 := iprot readFieldBegin.
- temp59 type = TType stop] whileFalse: [|temp60|
- temp59 id = 0 ifTrue: [
- temp60 := true.
- temp58 success: iprot readI64].
- temp60 ifNil: [iprot skip: temp59 type]].
- oprot readStructEnd.
- temp58] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-recvTestVoid
- | f msg res |
- msg := oprot readMessageBegin.
- self validateRemoteMessage: msg.
- res := [|temp1 temp0|
- temp0 := TResult new.
- iprot readStructBegin.
- [temp1 := iprot readFieldBegin.
- temp1 type = TType stop] whileFalse: [|temp2|
- temp1 id = 0 ifTrue: [
- temp2 := true.
- temp0 success: iprot readVoid].
- temp2 ifNil: [iprot skip: temp1 type]].
- oprot readStructEnd.
- temp0] value.
- oprot readMessageEnd.
- oprot transport flush.
- res exception ifNotNil: [res exception signal].
- ^ res! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestByteThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testByte';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestByte_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType byte; id: 1).
- iprot writeByte: thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestDoubleThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testDouble';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestDouble_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType double; id: 1).
- iprot writeDouble: thing asFloat.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestEnumThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testEnum';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestEnum_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType i32; id: 1).
- iprot writeI32: thing.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestExceptionArg: arg
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testException';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestException_args').
- oprot writeFieldBegin: (TField new name: 'arg'; type: TType string; id: -1).
- iprot writeString: arg.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestI16Thing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testI16';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestI16_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType i16; id: 1).
- iprot writeI16: thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestI32Thing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testI32';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestI32_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType i32; id: 1).
- iprot writeI32: thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestI64Thing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testI64';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestI64_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType i64; id: 1).
- iprot writeI64: thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestInsanityArgument: argument
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testInsanity';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestInsanity_args').
- oprot writeFieldBegin: (TField new name: 'argument'; type: TType struct; id: 1).
- [oprot writeStructBegin: (TStruct new name: 'Insanity').
- oprot writeFieldBegin: (TField new name: 'userMap'; type: TType map; id: 1).
- [oprot writeMapBegin: (TMap new keyType: TType i32; valueType: TType i64; size: argument userMap size).
- argument userMap keysAndValuesDo: [:temp68 :temp69 |
- iprot writeI32: temp68.
- iprot writeI64: temp69 asInteger].
- oprot writeMapEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'xtructs'; type: TType list; id: 2).
- [oprot writeListBegin: (TList new elemType: TType struct; size: argument xtructs size).
- argument xtructs do: [:temp70|
- [oprot writeStructBegin: (TStruct new name: 'Xtruct').
- oprot writeFieldBegin: (TField new name: 'string_thing'; type: TType string; id: 1).
- iprot writeString: temp70 stringThing.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'byte_thing'; type: TType byte; id: 4).
- iprot writeByte: temp70 byteThing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'i32_thing'; type: TType i32; id: 9).
- iprot writeI32: temp70 i32Thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'i64_thing'; type: TType i64; id: 11).
- iprot writeI64: temp70 i64Thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd] value
-].
- oprot writeListEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestListThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testList';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestList_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType list; id: 1).
- [oprot writeListBegin: (TList new elemType: TType i32; size: thing size).
- thing do: [:temp49|
- iprot writeI32: temp49 asInteger
-].
- oprot writeListEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestMapMapHello: hello
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testMapMap';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestMapMap_args').
- oprot writeFieldBegin: (TField new name: 'hello'; type: TType i32; id: 1).
- iprot writeI32: hello asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestMapThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testMap';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestMap_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType map; id: 1).
- [oprot writeMapBegin: (TMap new keyType: TType i32; valueType: TType i32; size: thing size).
- thing keysAndValuesDo: [:temp36 :temp37 |
- iprot writeI32: temp36 asInteger.
- iprot writeI32: temp37 asInteger].
- oprot writeMapEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestMultiArg0: arg0 arg1: arg1 arg2: arg2 arg3: arg3 arg4: arg4 arg5: arg5
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testMulti';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestMulti_args').
- oprot writeFieldBegin: (TField new name: 'arg0'; type: TType byte; id: -1).
- iprot writeByte: arg0 asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'arg1'; type: TType i32; id: -2).
- iprot writeI32: arg1 asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'arg2'; type: TType i64; id: -3).
- iprot writeI64: arg2 asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'arg3'; type: TType map; id: -4).
- [oprot writeMapBegin: (TMap new keyType: TType i16; valueType: TType string; size: arg3 size).
- arg3 keysAndValuesDo: [:temp88 :temp89 |
- iprot writeI16: temp88 asInteger.
- iprot writeString: temp89].
- oprot writeMapEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'arg4'; type: TType i32; id: -5).
- iprot writeI32: arg4.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'arg5'; type: TType i64; id: -6).
- iprot writeI64: arg5 asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestMultiExceptionArg0: arg0 arg1: arg1
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testMultiException';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestMultiException_args').
- oprot writeFieldBegin: (TField new name: 'arg0'; type: TType string; id: -1).
- iprot writeString: arg0.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'arg1'; type: TType string; id: -2).
- iprot writeString: arg1.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestNestThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testNest';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestNest_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType struct; id: 1).
- [oprot writeStructBegin: (TStruct new name: 'Xtruct2').
- oprot writeFieldBegin: (TField new name: 'byte_thing'; type: TType byte; id: 1).
- iprot writeByte: thing byteThing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'struct_thing'; type: TType struct; id: 2).
- [oprot writeStructBegin: (TStruct new name: 'Xtruct').
- oprot writeFieldBegin: (TField new name: 'string_thing'; type: TType string; id: 1).
- iprot writeString: thing structThing stringThing.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'byte_thing'; type: TType byte; id: 4).
- iprot writeByte: thing structThing byteThing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'i32_thing'; type: TType i32; id: 9).
- iprot writeI32: thing structThing i32Thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'i64_thing'; type: TType i64; id: 11).
- iprot writeI64: thing structThing i64Thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'i32_thing'; type: TType i32; id: 3).
- iprot writeI32: thing i32Thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestSetThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testSet';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestSet_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType set; id: 1).
- [oprot writeSetBegin: (TSet new elemType: TType i32; size: thing size).
- thing do: [:temp43|
- iprot writeI32: temp43 asInteger
-].
- oprot writeSetEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestStringThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testString';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestString_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType string; id: 1).
- iprot writeString: thing.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestStructThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testStruct';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestStruct_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType struct; id: 1).
- [oprot writeStructBegin: (TStruct new name: 'Xtruct').
- oprot writeFieldBegin: (TField new name: 'string_thing'; type: TType string; id: 1).
- iprot writeString: thing stringThing.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'byte_thing'; type: TType byte; id: 4).
- iprot writeByte: thing byteThing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'i32_thing'; type: TType i32; id: 9).
- iprot writeI32: thing i32Thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldBegin: (TField new name: 'i64_thing'; type: TType i64; id: 11).
- iprot writeI64: thing i64Thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd] value.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestTypedefThing: thing
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testTypedef';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestTypedef_args').
- oprot writeFieldBegin: (TField new name: 'thing'; type: TType i64; id: 1).
- iprot writeI64: thing asInteger.
- oprot writeFieldEnd.
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-sendTestVoid
- oprot writeMessageBegin:
- (TCallMessage new
- name: 'testVoid';
- seqid: self nextSeqid).
- oprot writeStructBegin: (TStruct new name: 'TestVoid_args').
- oprot writeFieldStop; writeStructEnd; writeMessageEnd.
- oprot transport flush! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testByteThing: thing
- "thing: byte"
- self sendTestByteThing: thing.
- ^ self recvTestByte success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testDoubleThing: thing
- "thing: double"
- self sendTestDoubleThing: thing.
- ^ self recvTestDouble success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testEnumThing: thing
- "thing: Numberz"
- self sendTestEnumThing: thing.
- ^ self recvTestEnum success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testExceptionArg: arg
- "arg: string"
- self sendTestExceptionArg: arg.
- ^ self recvTestException success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testI16Thing: thing
- "thing: i16"
- self sendTestI16Thing: thing.
- ^ self recvTestI16 success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testI32Thing: thing
- "thing: i32"
- self sendTestI32Thing: thing.
- ^ self recvTestI32 success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testI64Thing: thing
- "thing: i64"
- self sendTestI64Thing: thing.
- ^ self recvTestI64 success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testInsanityArgument: argument
- "argument: Insanity"
- self sendTestInsanityArgument: argument.
- ^ self recvTestInsanity success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testListThing: thing
- "thing: "
- self sendTestListThing: thing.
- ^ self recvTestList success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testMapMapHello: hello
- "hello: i32"
- self sendTestMapMapHello: hello.
- ^ self recvTestMapMap success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testMapThing: thing
- "thing: "
- self sendTestMapThing: thing.
- ^ self recvTestMap success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testMultiArg0: arg0 arg1: arg1 arg2: arg2 arg3: arg3 arg4: arg4 arg5: arg5
- "arg0: byte, arg1: i32, arg2: i64, arg3: , arg4: Numberz, arg5: UserId"
- self sendTestMultiArg0: arg0 arg1: arg1 arg2: arg2 arg3: arg3 arg4: arg4 arg5: arg5.
- ^ self recvTestMulti success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testMultiExceptionArg0: arg0 arg1: arg1
- "arg0: string, arg1: string"
- self sendTestMultiExceptionArg0: arg0 arg1: arg1.
- ^ self recvTestMultiException success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testNestThing: thing
- "thing: Xtruct2"
- self sendTestNestThing: thing.
- ^ self recvTestNest success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testSetThing: thing
- "thing: "
- self sendTestSetThing: thing.
- ^ self recvTestSet success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testStringThing: thing
- "thing: string"
- self sendTestStringThing: thing.
- ^ self recvTestString success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testStructThing: thing
- "thing: Xtruct"
- self sendTestStructThing: thing.
- ^ self recvTestStruct success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testTypedefThing: thing
- "thing: UserId"
- self sendTestTypedefThing: thing.
- ^ self recvTestTypedef success
-! !
-
-!ThriftTestClient methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-testVoid
- ""
- self sendTestVoid.
- ^ self recvTestVoid success
-! !
-
Object subclass: #TField
instanceVariableNames: 'name type id'
classVariableNames: ''
@@ -1459,7 +206,7 @@
readFieldBegin
| field |
field := TField new type: self readByte.
-
+
^ field type = TType stop
ifTrue: [field]
ifFalse: [field id: self readI16; yourself]! !
@@ -1502,10 +249,10 @@
readMessageBegin
| version |
version := self readI32.
-
+
(version bitAnd: self versionMask) = self version1
ifFalse: [TProtocolError signalWithCode: TProtocolError badVersion].
-
+
^ TMessage new
type: (version bitAnd: 16r000000FF);
name: self readString;
@@ -1711,7 +458,7 @@
set := self readSetBegin.
set size timesRepeat: [self skip: set elemType].
^ self readSetEnd].
-
+
self error: 'Unknown type'! !
!TProtocol methodsFor: 'as yet unclassified' stamp: 'pc 10/24/2007 23:02'!
@@ -1933,42 +680,6 @@
name: aString
name := aString! !
-Object subclass: #TTest
- instanceVariableNames: 'prot'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-!TTest methodsFor: 'as yet unclassified' stamp: 'pc 11/1/2007 04:47'!
-protocol: aProtocol
- prot := aProtocol! !
-
-!TTest methodsFor: 'as yet unclassified' stamp: 'pc 11/1/2007 04:49'!
-runAll
- | c |
- c := ThriftTestClient new inProtocol: prot.
- c testByteThing: 32.
- c testDoubleThing: -1.0.
- c testEnumThing: 1.
- c testExceptionArg: 'foo'.
- c testI16Thing: 16.
- c testI16Thing: -16.
- c testI32Thing: 32.
- c testI32Thing: -32.
- c testI64Thing: 123.
- c testDoubleThing: 1.2.
- c testStructThing: (Xtruct new byteThing: 1; i32Thing: 2; i64Thing: 3; stringThing: 'foo').
- c testSetThing: (Set new).
- c testListThing: (OrderedCollection new).
- c testEnumThing: 1.
- c testInsanityArgument:
- (Insanity new
- userMap: (Dictionary new at: 1 put: 2; yourself);
- xtructs: (OrderedCollection new)).
- c testMultiArg0: 1 arg1: 2 arg2: 3 arg3: (Dictionary new) arg4: ((ThriftTest enums at: 'Numberz') at: 'FIVE') arg5: 6.
- c testExceptionArg: 'Xception'.
- c testMultiExceptionArg0: 'Xception' arg1: 'Xception2'! !
-
Object subclass: #TTransport
instanceVariableNames: ''
classVariableNames: ''
@@ -2077,71 +788,3 @@
!TType class methodsFor: 'as yet unclassified' stamp: 'pc 10/24/2007 17:03'!
void
^ 1! !
-
-Object subclass: #Xtruct
- instanceVariableNames: 'stringThing byteThing i32Thing i64Thing'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-!Xtruct methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-byteThing
- ^ byteThing! !
-
-!Xtruct methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-byteThing: aByte
- byteThing := aByte! !
-
-!Xtruct methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-i32Thing
- ^ i32Thing! !
-
-!Xtruct methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-i32Thing: anI32
- i32Thing := anI32! !
-
-!Xtruct methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-i64Thing
- ^ i64Thing! !
-
-!Xtruct methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-i64Thing: anI64
- i64Thing := anI64! !
-
-!Xtruct methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-stringThing
- ^ stringThing! !
-
-!Xtruct methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-stringThing: aString
- stringThing := aString! !
-
-Object subclass: #Xtruct2
- instanceVariableNames: 'byteThing structThing i32Thing'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Thrift-Test'!
-
-!Xtruct2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-byteThing
- ^ byteThing! !
-
-!Xtruct2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-byteThing: aByte
- byteThing := aByte! !
-
-!Xtruct2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-i32Thing
- ^ i32Thing! !
-
-!Xtruct2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-i32Thing: anI32
- i32Thing := anI32! !
-
-!Xtruct2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-structThing
- ^ structThing! !
-
-!Xtruct2 methodsFor: 'as yet uncategorized' stamp: 'thrift 11/01/2007 04:43'!
-structThing: aXtruct
- structThing := aXtruct! !
diff --git a/tutorial/tutorial.thrift b/tutorial/tutorial.thrift
index 7b377d6..f5e5836 100755
--- a/tutorial/tutorial.thrift
+++ b/tutorial/tutorial.thrift
@@ -48,6 +48,7 @@
java_package tutorial
php_namespace tutorial
perl_package tutorial
+smalltalk_category Thrift-Tutorial
/**
* Thrift lets you do typedefs to get pretty names for your types. Standard