1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

updated func/fift

- updated func/fift
- updated liteclient/liteserver
- bugfixes
This commit is contained in:
ton 2019-12-29 12:14:12 +03:00
parent d41ce55305
commit acf16718e6
45 changed files with 1360 additions and 185 deletions

View file

@ -3257,6 +3257,31 @@ void generate_type_constants(std::ostream& os, int mode) {
}
}
void generate_register_function(std::ostream& os, int mode) {
os << "\n// " << (mode ? "definition" : "declaration") << " of type name registration function\n";
if (!mode) {
os << "extern bool register_simple_types(std::function<bool(const char*, const TLB*)> func);\n";
return;
}
os << "bool register_simple_types(std::function<bool(const char*, const TLB*)> func) {\n";
os << " return ";
int k = 0;
for (int i = builtin_types_num; i < types_num; i++) {
Type& type = types[i];
CppTypeCode& cc = *cpp_type[i];
if (!cc.cpp_type_var_name.empty() && type.type_name) {
if (k++) {
os << "\n && ";
}
os << "func(\"" << type.get_name() << "\", &" << cc.cpp_type_var_name << ")";
}
}
if (!k) {
os << "true";
}
os << ";\n}\n\n";
}
void assign_const_type_cpp_idents() {
const_type_expr_cpp_idents.resize(const_type_expr_num + 1, "");
const_type_expr_simple.resize(const_type_expr_num + 1, false);
@ -3389,6 +3414,7 @@ void generate_cpp_output_to(std::ostream& os, int options = 0, std::vector<std::
cc.generate(os, (options & -4) | pass);
}
generate_type_constants(os, pass - 1);
generate_register_function(os, pass - 1);
}
}
for (auto it = cpp_namespace_list.rbegin(); it != cpp_namespace_list.rend(); ++it) {