mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
CppBase: preparing for preprocessor, Sql: Fixed NOAPPSQL isues, cosmetics
git-svn-id: svn://ultimatepp.org/upp/trunk@8160 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
31c71ac872
commit
c8df5ab53d
11 changed files with 45 additions and 9 deletions
|
|
@ -225,7 +225,7 @@ template <class T>
|
|||
void DumpMap(Stream& s, const T& t) {
|
||||
s << LOG_BEGIN;
|
||||
for(int i = 0; i < t.GetCount(); i++)
|
||||
s << '[' << i << "] = ("<< t.GetKey(i) << ") " << t[i] << EOL;
|
||||
s << '[' << i << "] = (" << t.GetKey(i) << ") " << t[i] << EOL;
|
||||
s << LOG_END;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,16 @@ bool CppBase::IsType(int i) const
|
|||
return GetKey(i).GetCount();
|
||||
}
|
||||
|
||||
void CppBase::Dump(Stream& s)
|
||||
{
|
||||
for(int i = 0; i < GetCount(); i++) {
|
||||
s << Nvl(GetKey(i), "<<GLOBALS>>") << "\n";
|
||||
const Array<CppItem>& m = (*this)[i];
|
||||
for(int j = 0; j < m.GetCount(); j++)
|
||||
s << '\t' << m[j] << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void Remove(CppBase& base, const Vector<String>& pf)
|
||||
{
|
||||
int ni = 0;
|
||||
|
|
|
|||
|
|
@ -260,10 +260,13 @@ struct CppItem {
|
|||
void Serialize(Stream& s);
|
||||
|
||||
void Dump(Stream& s) const;
|
||||
String ToString() const;
|
||||
|
||||
CppItem() { at = decla = virt = false; qualify_type = qualify_param = true; serial = -1; isptr = false; }
|
||||
};
|
||||
|
||||
String CppItemKindAsString(int kind);
|
||||
|
||||
int FindItem(const Array<CppItem>& x, const String& qitem);
|
||||
int GetCount(const Array<CppItem>& x, int i);
|
||||
int FindNext(const Array<CppItem>& x, int i);
|
||||
|
|
@ -275,6 +278,8 @@ struct CppBase : ArrayMap<String, Array<CppItem> > {
|
|||
|
||||
bool IsType(int i) const;
|
||||
|
||||
void Dump(Stream& s);
|
||||
|
||||
CppBase() { serial = 0; }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ uses
|
|||
Core;
|
||||
|
||||
file
|
||||
CppBase.h options PCH,
|
||||
CppBase.h options(BUILDER_OPTION) PCH,
|
||||
keyword.i,
|
||||
Pre.cpp,
|
||||
cpplex.cpp,
|
||||
|
|
|
|||
|
|
@ -2,10 +2,16 @@
|
|||
|
||||
NAMESPACE_UPP
|
||||
|
||||
void CppItem::Dump(Stream& s) const
|
||||
String CppItem::ToString() const
|
||||
{
|
||||
s << Nvl(qitem, "?") << ' ';
|
||||
s << decode(kind,
|
||||
StringStream ss;
|
||||
Dump(ss);
|
||||
return ss;
|
||||
}
|
||||
|
||||
String CppItemKindAsString(int kind)
|
||||
{
|
||||
return decode(kind,
|
||||
STRUCT, "STRUCT",
|
||||
STRUCTTEMPLATE, "STRUCTTEMPLATE",
|
||||
TYPEDEF, "TYPEDEF",
|
||||
|
|
@ -24,7 +30,13 @@ void CppItem::Dump(Stream& s) const
|
|||
ENUM, "ENUM",
|
||||
MACRO, "MACRO",
|
||||
FRIENDCLASS, "FRIENDCLASS",
|
||||
"?kind:" + AsString(kind)) << ' '
|
||||
"?kind:" + AsString(kind));
|
||||
}
|
||||
|
||||
void CppItem::Dump(Stream& s) const
|
||||
{
|
||||
s << Nvl(qitem, "?") << ' ';
|
||||
s << CppItemKindAsString(kind) << ' '
|
||||
<< decode(access,
|
||||
PUBLIC, "PUBLIC",
|
||||
PROTECTED, "PROTECTED",
|
||||
|
|
|
|||
|
|
@ -1564,6 +1564,7 @@ void Parser::Do(Stream& in, const Vector<String>& ignore, CppBase& _base, const
|
|||
++lex;
|
||||
lex.SkipToGrounding();
|
||||
lex.ClearBracesLevel();
|
||||
LLOG("Grounding skipped to " << GetLine(lex.Pos()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1578,6 +1579,7 @@ void Parse(Stream& s, const Vector<String>& ignore, CppBase& base, const String&
|
|||
Callback2<int, const String&> _err)
|
||||
{
|
||||
LTIMING("Parse");
|
||||
DUMP(ignore);
|
||||
Parser p;
|
||||
p.Do(s, ignore, base, fn, _err);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,9 +85,12 @@ SrcFile PreProcess(Stream& in)
|
|||
if(IsAlNum(*rm)) {
|
||||
const char *s = ln.Last();
|
||||
while(s > rm && *s == ' ') s--;
|
||||
if(*s != ':')
|
||||
if(*s != ':') // check for label, labeled lines are not grounded
|
||||
res.text << '\2';
|
||||
}
|
||||
else
|
||||
if(*rm == '\x1a') // line started with macro
|
||||
res.text << '\2';
|
||||
while(*rm == ' ' || *rm == '\t') rm++;
|
||||
if(*rm == '\0')
|
||||
res.blankLinesRemoved++;
|
||||
|
|
|
|||
|
|
@ -704,6 +704,7 @@ SqlR::SqlR(const SqlStatement& s)
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef NOAPPSQL
|
||||
void operator*=(ValueMap& map, SqlSelect select)
|
||||
{
|
||||
map.Clear();
|
||||
|
|
@ -712,5 +713,6 @@ void operator*=(ValueMap& map, SqlSelect select)
|
|||
while(sql.Fetch())
|
||||
map.Add(sql[0], sql[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ uses
|
|||
Core;
|
||||
|
||||
file
|
||||
Sql.h options PCH,
|
||||
Sql.h options(BUILDER_OPTION) PCH,
|
||||
Sqlexp.h,
|
||||
SqlCase.cpp optimize_speed,
|
||||
SqlVal.cpp optimize_speed,
|
||||
|
|
|
|||
|
|
@ -330,10 +330,12 @@ String SqlCompile(byte dialect, const String& s)
|
|||
return b;
|
||||
}
|
||||
|
||||
#ifndef NOAPPSQL
|
||||
String SqlCompile(const String& s)
|
||||
{
|
||||
return SqlCompile(SQL.GetDialect(), s);
|
||||
}
|
||||
#endif
|
||||
|
||||
Vector<SqlVal> SplitSqlSet(const SqlSet& set)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ uses
|
|||
plugin/bz2;
|
||||
|
||||
file
|
||||
Core.h options PCH,
|
||||
Core.h options(BUILDER_OPTION) PCH,
|
||||
Core.cpp,
|
||||
Hdepend.cpp optimize_speed,
|
||||
Package.cpp,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue