DEADSOFTWARE

27117ddeab85d2240d89bd82ce6a3c82d6ae7577
[odcread.git] / odcread.cc
1 #include <iostream>
2 #include <fstream>
3 #include <string>
5 #include <oberon.h>
6 #include <reader.h>
7 #include <store.h>
9 namespace odc {
10 Store* importDocument(std::istream &is) {
11 const INTEGER docTag = 0x6F4F4443;
12 const INTEGER docVersion = 0;
13 Reader r(is);
14 INTEGER tag = r.readInt();
15 if (tag == docTag) {
16 INTEGER version = r.readInt();
17 if (version != docVersion) {
18 throw 100;
19 }
20 Store *s = r.readStore();
21 return s;
22 }
23 return 0;
24 }
25 }
27 int main(int argc, char *argv[]) {
28 if (argc < 2) {
29 return 1;
30 }
31 std::ifstream in(argv[1], std::ios::in | std::ios::binary);
32 odc::Store* s = odc::importDocument(in);
33 //std::cout << s->toString() << std::endl;
34 //std::cout << in.tellg() << " " << in.eof() << std::endl;
36 odc::TypePath path;
37 odc::ContainerModel(0).getTypePath(&path);
38 //std::cout << path.toString() << std::endl;
39 return 0;
40 }