git-svn-id: svn://db.shs.com.ru/pip@1005 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -388,7 +388,7 @@ PIByteArray & operator >>(PIByteArray & s, PIByteArray & v) {
|
|||||||
assert(s.size_s() >= 4);
|
assert(s.size_s() >= 4);
|
||||||
int sz = 0;
|
int sz = 0;
|
||||||
s >> sz;
|
s >> sz;
|
||||||
if (sz > s.size_s()) {
|
if (sz > (s.size_s() - 4)) {
|
||||||
piCout << "[PIByteArray] Warning: operator >> wants too much data, discard!" << sz << s.size_s();
|
piCout << "[PIByteArray] Warning: operator >> wants too much data, discard!" << sz << s.size_s();
|
||||||
s.clear();
|
s.clear();
|
||||||
v.clear();
|
v.clear();
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ PIString toCName(const PIString &s) {
|
|||||||
|
|
||||||
|
|
||||||
void makeClassInfo(PIFile & f, const PICodeParser::Entity * e) {
|
void makeClassInfo(PIFile & f, const PICodeParser::Entity * e) {
|
||||||
f << "\n\tci = new ClassInfo();\n";
|
f << "\n\t{\n\tClassInfo * ci = new ClassInfo();\n";
|
||||||
f << "\tci->type = \"" << e->type << "\";\n";
|
f << "\tci->type = \"" << e->type << "\";\n";
|
||||||
f << "\tci->name = \"" << e->name << "\";\n";
|
f << "\tci->name = \"" << e->name << "\";\n";
|
||||||
f << "\tci->has_name = " << (e->has_name ? "true" : "false") << ";\n";
|
f << "\tci->has_name = " << (e->has_name ? "true" : "false") << ";\n";
|
||||||
@@ -97,6 +97,7 @@ void makeClassInfo(PIFile & f, const PICodeParser::Entity * e) {
|
|||||||
}
|
}
|
||||||
piForeachC (PICodeParser::Entity * p, e->parents)
|
piForeachC (PICodeParser::Entity * p, e->parents)
|
||||||
f << "\tci->parents << \"" << p->name << "\";\n";
|
f << "\tci->parents << \"" << p->name << "\";\n";
|
||||||
|
if (!e->members.isEmpty()) f << "\n\tTypeInfo ti;\n";
|
||||||
piForeachC (PICodeParser::Member & m, e->members) {
|
piForeachC (PICodeParser::Member & m, e->members) {
|
||||||
f << "\tti = TypeInfo(\"" << m.name << "\", \"" << m.type << "\"";
|
f << "\tti = TypeInfo(\"" << m.name << "\", \"" << m.type << "\"";
|
||||||
if (m.attributes != 0) {
|
if (m.attributes != 0) {
|
||||||
@@ -122,6 +123,7 @@ void makeClassInfo(PIFile & f, const PICodeParser::Entity * e) {
|
|||||||
f << "\tci->variables << ti;\n";
|
f << "\tci->variables << ti;\n";
|
||||||
}
|
}
|
||||||
PIString arg;
|
PIString arg;
|
||||||
|
if (!e->functions.isEmpty()) f << "\n\tFunctionInfo * fi;\n";
|
||||||
piForeachC (PICodeParser::Member & m, e->functions) {
|
piForeachC (PICodeParser::Member & m, e->functions) {
|
||||||
if (e->name.findCWord(m.name) >= 0) continue;
|
if (e->name.findCWord(m.name) >= 0) continue;
|
||||||
f << "\tci->functions.push_back(FunctionInfo()); fi = &(ci->functions.back());\n";
|
f << "\tci->functions.push_back(FunctionInfo()); fi = &(ci->functions.back());\n";
|
||||||
@@ -159,6 +161,7 @@ void makeClassInfo(PIFile & f, const PICodeParser::Entity * e) {
|
|||||||
f << "\tfi->meta[\"" << i.key() << "\"] = PIString::fromUTF8(\"" << i.value() << "\");\n";
|
f << "\tfi->meta[\"" << i.key() << "\"] = PIString::fromUTF8(\"" << i.value() << "\");\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
f << "\n\t}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -418,10 +421,10 @@ void writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool met
|
|||||||
f << "\n\n// Metainformation\n\n__ClassInfo_" << defname << "_Initializer__::__ClassInfo_" << defname << "_Initializer__() {\n";
|
f << "\n\n// Metainformation\n\n__ClassInfo_" << defname << "_Initializer__::__ClassInfo_" << defname << "_Initializer__() {\n";
|
||||||
f << "\tif (_inited_) return;\n\t_inited_ = true;\n\n";
|
f << "\tif (_inited_) return;\n\t_inited_ = true;\n\n";
|
||||||
if (meta) {
|
if (meta) {
|
||||||
f << "\tClassInfo * ci, * pci = new ClassInfo();\n\tTypeInfo * ni;\n\tFunctionInfo * fi;\n\tTypeInfo ti;\n";
|
f << "\tClassInfo * pci = new ClassInfo();\n";
|
||||||
f << "\t(*classesInfo)[\"\"] = pci;\n";
|
f << "\t(*classesInfo)[\"\"] = pci;\n";
|
||||||
}
|
}
|
||||||
if (enums) {
|
if (enums && !parser.enums.isEmpty()) {
|
||||||
f << "\tEnumInfo * ei;\n";
|
f << "\tEnumInfo * ei;\n";
|
||||||
f << "\t(*enumsInfo)[\"\"] = new EnumInfo();\n";
|
f << "\t(*enumsInfo)[\"\"] = new EnumInfo();\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user