My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "Browser.h"

#define LTIMING(x) // RTIMING(x)
#define LDUMP(x) // DUMP(x)

void LaySkipRest(CParser& p)
{
int lvl = 1;
while(!p.IsEof()) {
if(p.Char('('))
lvl++;
else
if(p.Char(')')) {
if(--lvl == 0)
break;
}
else
p.SkipTerm();
}
}

inline void WriteLines(String& r, int count)
{
for (int i = 0; i < count; ++i)
r << '\n';
}

void ScanLayFile(const char *fn)
{
LTIMING("Lay file");
String s = LoadFile(fn);
CParser p(s);
String r;
try {
int line = p.GetLine();
if(p.Char('#') && p.Id("ifdef")) {
if(!p.Id("LAYOUTFILE"))
p.Id("LAYOUT");
WriteLines(r, p.GetLine() - line);
}
while(!p.IsEof()) {
line = p.GetLine();
p.PassId("LAYOUT");
p.PassChar('(');
r << "template <class T> struct With" << p.ReadId() << " : public T {"
<< "\tstatic Size GetLayoutSize();";
LaySkipRest(p);
WriteLines(r, p.GetLine() - line);
for(;;) {
line = p.GetLine();
if(p.Id("ITEM")) {
p.PassChar('(');
if(p.IsId()) {
String type = p.ReadIdt();
if(strncmp(type, "dv___", 5)) {
r << '\t' << type;
p.PassChar(',');
r << ' ' << p.ReadId() << ";";
}
}
}
else
if(p.Id("UNTYPED"))
p.Char('(');
else
break;
LaySkipRest(p);
WriteLines(r, p.GetLine() - line);
}
line = p.GetLine();
p.PassId("END_LAYOUT");
if(p.Char('#'))
p.Id("endif");
r << "};";
WriteLines(r, p.GetLine() - line);
}
}
catch(CParser::Error) {}
LDUMP(r);
StringStream ss(r);
CppBase& base = CodeBase();
Parse(ss, IgnoreList(), base, fn, CNULL);
}

Change log

r4163 by cxl on Nov 12, 2011   Diff
ide: Layout files are now syntax
highlighted, Assist++ now knows correct
line postition info (thanks Sender Ghost)
(RM #166, #168)
Go to: 
Project members, sign in to write a code review

Older revisions

r521 by cxl on Oct 12, 2008   Diff
One more A++ fix...
r281 by mdelfede on Jun 7, 2008   Diff
changed svn layout
r3 by unodgs on Feb 26, 2006   Diff
[No log message]
All revisions of this file

File info

Size: 1592 bytes, 83 lines

File properties

svn:eol-style
native
Powered by Google Project Hosting