git-svn-id: svn://db.shs.com.ru/pip@592 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2018-02-09 21:44:38 +00:00
parent 9a1c5deadd
commit 9017861eb0
5 changed files with 194 additions and 30 deletions

View File

@@ -58,6 +58,10 @@ void makeClassInfo(PIFile & f, const PICodeParser::Entity * e) {
f << "\tci->type = \"" << e->type << "\";\n";
f << "\tci->name = \"" << e->name << "\";\n";
f << "\tci->has_name = " << (e->has_name ? "true" : "false") << ";\n";
if (!e->meta.isEmpty()) {
for (PICodeParser::MetaMap::const_iterator i = e->meta.begin(); i != e->meta.end(); ++i)
f << "\tci->meta[\"" << i.key() << "\"] = \"" << i.value() << "\";\n";
}
f << "\t(*classesInfo)[ci->name] = ci;\n";
if (e->parent_scope) {
f << "\tpci = " << "classesInfo->value(\"" << e->parent_scope->name << "\", 0);\n";
@@ -66,7 +70,7 @@ void makeClassInfo(PIFile & f, const PICodeParser::Entity * e) {
piForeachC (PICodeParser::Entity * p, e->parents)
f << "\tci->parents << \"" << p->name << "\";\n";
piForeachC (PICodeParser::Member & m, e->members) {
f << "\tci->variables << TypeInfo(\"" << m.name << "\", \"" << m.type << "\"";
f << "\tti = TypeInfo(\"" << m.name << "\", \"" << m.type << "\"";
if (m.attributes != 0) {
bool fir = true;
f << ", ";
@@ -83,6 +87,11 @@ void makeClassInfo(PIFile & f, const PICodeParser::Entity * e) {
if (m.isBitfield())
f << ", " << m.bits;
f << ");\n";
if (!m.meta.isEmpty()) {
for (PICodeParser::MetaMap::const_iterator i = m.meta.begin(); i != m.meta.end(); ++i)
f << "\tti.meta[\"" << i.key() << "\"] = \"" << i.value() << "\";\n";
}
f << "\tci->variables << ti;\n";
}
PIString arg;
piForeachC (PICodeParser::Member & m, e->functions) {
@@ -117,6 +126,10 @@ void makeClassInfo(PIFile & f, const PICodeParser::Entity * e) {
if (con) f << ", Const";
f << ");\n";
}
if (!m.meta.isEmpty()) {
for (PICodeParser::MetaMap::const_iterator i = m.meta.begin(); i != m.meta.end(); ++i)
f << "\tfi->meta[\"" << i.key() << "\"] = \"" << i.value() << "\";\n";
}
}
}
@@ -128,9 +141,18 @@ void makeEnumInfo(PIFile & f, const PICodeParser::Enum * e) {
f << "\n\tei = new EnumInfo();\n";
f << "\t(*enumsInfo)[\"" << e->name << "\"] = ei;\n";
f << "\tei->name = \"" << e->name << "\";\n";
if (!e->meta.isEmpty()) {
for (PICodeParser::MetaMap::const_iterator i = e->meta.begin(); i != e->meta.end(); ++i)
f << "\tei->meta[\"" << i.key() << "\"] = \"" << i.value() << "\";\n";
}
}
piForeachC (PICodeParser::EnumeratorInfo & m, e->members)
piForeachC (PICodeParser::EnumeratorInfo & m, e->members) {
f << "\tei->members << PICodeInfo::EnumeratorInfo(\"" << m.name << "\", " << m.value << ");\n";
if (!e->meta.isEmpty()) {
for (PICodeParser::MetaMap::const_iterator i = e->meta.begin(); i != e->meta.end(); ++i)
f << "\tei->members.back().meta[\"" << i.key() << "\"] = \"" << i.value() << "\";\n";
}
}
}
@@ -310,7 +332,7 @@ 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 << "\tif (_inited_) return;\n\t_inited_ = true;\n\n";
if (meta) {
f << "\tClassInfo * ci, * pci = new ClassInfo();\n\tTypeInfo * ni;\n\tFunctionInfo * fi;\n";
f << "\tClassInfo * ci, * pci = new ClassInfo();\n\tTypeInfo * ni;\n\tFunctionInfo * fi;\n\tTypeInfo ti;\n";
f << "\t(*classesInfo)[\"\"] = pci;\n";
}
if (enums) {