summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 121a58d)
raw | patch | inline | side by side (parent: 121a58d)
author | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Tue, 9 Aug 2011 07:48:25 +0000 (08:48 +0100) | ||
committer | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Tue, 9 Aug 2011 07:48:25 +0000 (08:48 +0100) |
odcread.cc | patch | blob | history | |
reader.cc | patch | blob | history |
diff --git a/odcread.cc b/odcread.cc
index 32fcd6b25471d2b368f16e05c10cf00105f0a77c..a6765e913ab97614b3ceb0d877ca21e0b6a1d1fd 100644 (file)
--- a/odcread.cc
+++ b/odcread.cc
}
int main(int argc, char *argv[]) {
+ if (argc < 2) {
+ return 1;
+ }
std::ifstream in(argv[1], std::ios::in | std::ios::binary);
odc::Store* s = odc::importDocument(in);
std::cout << s->toString() << std::endl;
diff --git a/reader.cc b/reader.cc
index 46a0b812e7334485a6d22b1add42c62b4eca787a..581917197f2c9bdbcbcbd3e6dc130193784e1263 100644 (file)
--- a/reader.cc
+++ b/reader.cc
Store* Reader::readStore() {
SHORTCHAR kind = readSChar();
if (kind == Store::NIL) {
+ std::cout << "NIL STORE" << std::endl;
return readNilStore();
} else if (kind == Store::LINK) {
+ std::cout << "LINK STORE" << std::endl;
return readLinkStore();
} else if (kind == Store::NEWLINK) {
+ std::cout << "NEWLINK STORE" << std::endl;
return readNewLinkStore();
} else if (kind == Store::STORE) {
+ std::cout << "STORE STORE" << std::endl;
return readStoreOrElemStore(false);
} else if (kind == Store::ELEM) {
+ std::cout << "ELEM STORE" << std::endl;
return readStoreOrElemStore(true);
} else {
throw 20;
SHORTCHAR kind = readSChar();
int i;
for (i = 0; kind == Store::NEWEXT; ++i) {
+ std::cout << i << std::endl;
readSString(path[i]);
addPathComponent(i == 0, path[i]);
// IF path[i] # elemTName THEN INC(i) END;
}
if (kind == Store::NEWBASE) {
+ std::cout << i << std::endl;
readSString(path[i]);
addPathComponent(i == 0, path[i]);
++i;
} else if (kind == Store::OLDTYPE) {
int id = readInt();
d_typeList[d_typeList.size() - 1]->baseId = id;
+ while (id != -1) {
+ std::cout << "old " << i << "id " << id << d_typeList[id]->name << std::endl;
+ path[i] = d_typeList[id]->name;
+ id = d_typeList[id]->baseId;
+ ++i;
+ }
// REPEAT
// GetThisType(rd.tDict, id, path[i]); id := ThisBaseId(rd.tDict, id);
// IF path[i] # elemTName THEN INC(i) END
} else {
throw 100;
}
+ std::cout << "term " << i << std::endl;
path[i] = 0;
}
// PROCEDURE ReadPath (VAR rd: Reader; VAR path: TypePath);