DEADSOFTWARE

Modularize, some progress toward reading stores
[odcread.git] / odcread.cc
1 #include <iostream>
2 #include <fstream>
4 #include <oberon.h>
5 #include <reader.h>
6 #include <store.h>
8 namespace odc {
9 Store* importDocument(std::istream &is) {
10 const INTEGER docTag = 0x6F4F4443;
11 const INTEGER docVersion = 0;
12 Reader r(is);
13 INTEGER tag = r.readInt();
14 if (tag == docTag) {
15 INTEGER version = r.readInt();
16 if (version != docVersion) {
17 throw 100;
18 }
19 Store *s = r.readStore();
20 return s;
21 }
22 return 0;
23 }
24 }
26 int main(int argc, char *argv[]) {
27 std::ifstream in(argv[1], std::ios::in | std::ios::binary);
28 odc::Store* s = odc::importDocument(in);
29 std::cout << s << std::endl;
30 return 0;
31 }