DEADSOFTWARE

Reader split into files
[odcread.git] / reader / readPath.cc
1 #include "reader/reader.ih"
3 namespace odc {
5 TypePath Reader::readPath() {
6 TypePath path;
7 SHORTCHAR kind = readSChar();
8 SHORTCHAR *buf = new SHORTCHAR[64]; // TypeName has a maximum of length 64 (including terminator).
9 int i;
10 for (i = 0; kind == Store::NEWEXT; ++i) {
11 readSString(buf);
12 std::string name(buf);
13 path.push_back(fixTypeName(name));
14 addPathComponent(i == 0, path[i]);
15 // IF path[i] # elemTName THEN INC(i) END;
16 kind = readSChar();
17 }
19 if (kind == Store::NEWBASE) {
20 readSString(buf);
21 std::string name(buf);
22 path.push_back(fixTypeName(name));
23 addPathComponent(i == 0, path[i]);
24 ++i;
25 } else if (kind == Store::OLDTYPE) {
26 int id = readInt();
27 if (i > 0) {
28 d_typeList[d_typeList.size() - 1]->baseId = id;
29 }
30 while (id != -1) {
31 path.push_back(d_typeList[id]->name);
32 id = d_typeList[id]->baseId;
33 // IF path[i] # elemTName THEN INC(i) END
34 ++i;
35 }
36 } else {
37 throw 100;
38 }
39 return path;
40 }
42 } // namespace odc