Assist++ now supports .sch files

git-svn-id: svn://ultimatepp.org/upp/trunk@1292 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-06-09 16:01:59 +00:00
parent 0d71073609
commit cb33f077e1
7 changed files with 93 additions and 6 deletions

View file

@ -79,7 +79,7 @@ String XmlTag::operator()(const char* text)
StringBuffer r;
r << tag << '>';
if(strchr(text, '\n')) {
r << "\r\n"
r << "\r\n";
bool tab = true;
while(*text) {
if(tab)
@ -87,7 +87,7 @@ String XmlTag::operator()(const char* text)
int c = (byte)*text++;
tab = c == '\n';
if(tab)
r << "\r\n"
r << "\r\n";
else
if(c == '\t' || c >= 32)
r.Cat(c);

View file

@ -308,7 +308,7 @@ void AssistEditor::SyncAssist()
&& memcmp(name, m.name, name.GetCount())
: memcmp(name, m.name, name.GetCount()) == 0)) {
int q = over.Find(m.name);
if(q < 0 || over[q] == m.typei) {
if(q < 0 || over[q] == m.typei && m.scope.GetCount()) {
assist.Add(RawToValue(m));
if(q < 0)
over.Add(m.name, m.typei);

View file

@ -181,7 +181,7 @@ void UpdateCodeBase(Progress& pi)
String ext = ToUpper(GetFileExt(path));
if(ext == ".C" || ext == ".CPP" || ext == ".CC" || ext == ".CXX" ||
ext == ".H" || ext == ".HPP" || ext == ".HH" || ext == ".HXX" ||
ext == ".LAY") {
ext == ".LAY" || ext == ".SCH") {
fp.Add(path);
int q = set.Find(path);
Time tm = FileGetTime(path);
@ -218,6 +218,9 @@ void UpdateCodeBase(Progress& pi)
String ext = ToUpper(GetFileExt(s_file));
if(ext == ".LAY")
ScanLayFile(s_file);
else
if(ext == ".SCH")
ScanSchFile(s_file);
else {
FileIn fi(s_file);
Parse(fi, ignore, base, s_file, callback(BrowserScanError));
@ -236,7 +239,10 @@ void CodeBaseScan(Stream& s, const String& fn)
remove.Add(fn);
Remove(base, remove);
LLOG("Scan3 " << tm);
Parse(s, IgnoreList(), base, fn, CNULL);
if(ToUpper(GetFileExt(fn)) == ".SCH")
ScanSchFile(fn);
else
Parse(s, IgnoreList(), base, fn, CNULL);
LLOG("Scan4 " << tm);
FinishBase();
LLOG("Scan total " << tm);

View file

@ -30,6 +30,7 @@ void ReQualifyCodeBase();
void CodeBaseScanLay(const String& fn);
void ScanLayFile(const char *fn);
void ScanSchFile(const char *fn);
String MakeCodeRef(const String& scope, const String& item);
void SplitCodeRef(const String& ref, String& scope, String& item);

View file

@ -10,6 +10,7 @@ file
Browser.h,
Browser readonly separator,
Lay.cpp,
Sch.cpp,
Base.cpp optimize_speed,
Util.cpp,
Item.cpp,

View file

@ -0,0 +1,79 @@
#include "Browser.h"
String ReadId(CParser& p, String& rr)
{
p.Char('(');
String id = p.ReadId();
p.Char(',');
if(p.IsNumber())
p.ReadNumber();
p.Char(',');
if(p.IsNumber())
p.ReadNumber();
p.Char(')');
rr << "SqlId " << id << "(\"" << id << "\");\n";
return id;
}
void ScanSchFile(const char *fn)
{
String s = LoadFile(fn);
CParser p(s);
String r, rr;
while(!p.IsEof())
try {
if(p.Id("TABLE") || p.Id("TABLE_") || p.Id("TYPE") || p.Id("TYPE_"))
r << "struct S_" << ReadId(p, rr) << " {\n";
else
if(p.Id("END_TABLE") || p.Id("END_TYPE"))
r << "};\n";
else
if(p.Id("LONGRAW") || p.Id("LONGRAW_") || p.Id("BLOB") || p.Id("BLOB_") ||
p.Id("BOOL") || p.Id("BOOL_") || p.Id("STRING_") || p.Id("STRING"))
r << "\tString " << ReadId(p, rr) << ";\n";
else
if(p.Id("INT") || p.Id("INT_"))
r << "\tint " << ReadId(p, rr) << ";\n";
else
if(p.Id("DOUBLE") || p.Id("DOUBLE_"))
r << "\tdouble " << ReadId(p, rr) << ";\n";
else
if(p.Id("TIME") || p.Id("TIME_"))
r << "\tTime " << ReadId(p, rr) << ";\n";
else
if(p.Id("DATE") || p.Id("DATE_"))
r << "\tDate " << ReadId(p, rr) << ";\n";
else
if(p.Id("BIT") || p.Id("BIT_"))
r << "\tbool " << ReadId(p, rr) << ";\n";
else
if(p.Id("BOOL_ARRAY") || p.Id("BOOL_ARRAY_"))
r << "\tString " << ReadId(p, rr) << "[1];\n";
else
if(p.Id("INT_ARRAY") || p.Id("INT_ARRAY_"))
r << "\tint " << ReadId(p, rr) << "[1];\n";
else
if(p.Id("DOUBLE_ARRAY") || p.Id("DOUBLE_ARRAY_"))
r << "\tdouble " << ReadId(p, rr) << "[1];\n";
else
if(p.Id("TIME_ARRAY") || p.Id("TIME_ARRAY_"))
r << "\tTime " << ReadId(p, rr) << "[1];\n";
else
if(p.Id("DATE_ARRAY") || p.Id("DATE_ARRAY_"))
r << "\tDate " << ReadId(p, rr) << "[1];\n";
else
if(p.Id("BIT_ARRAY") || p.Id("BIT_ARRAY_"))
r << "\tbool " << ReadId(p, rr) << "[1];\n";
else
if(p.Id("SEQUENCE") || p.Id("SEQUENCE_"))
ReadId(p, rr);
else
p.SkipTerm();
}
catch(CParser::Error)
{}
r << "\n" << rr;
StringStream ss(r);
CppBase& base = CodeBase();
Parse(ss, IgnoreList(), base, fn, CNULL);
}

View file

@ -4,7 +4,7 @@
#include "ide\Common/init"
#include "PdfDraw/init"
#include "RichEdit/init"
#define BLITZ_INDEX__ FCB83C9D580625CD4EAD50BEDC296DB64
#define BLITZ_INDEX__ FB5C792D5E6989A57EBD963D0F3A0F4E9
#include "TopicI.icpp"
#undef BLITZ_INDEX__
#endif