summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5abab2c)
raw | patch | inline | side by side (parent: 5abab2c)
author | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Mon, 7 Nov 2011 22:27:21 +0000 (22:27 +0000) | ||
committer | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Mon, 7 Nov 2011 22:27:21 +0000 (22:27 +0000) |
Makefile | patch | blob | history | |
fold.cc | patch | blob | history | |
reader.cc | patch | blob | history | |
reader.h | patch | blob | history |
diff --git a/Makefile b/Makefile
index c933edc1a60e9aae1f39808e273438968abc6abc..e3f74e5ddf148a5018ffd21b9347676e16466af8 100644 (file)
--- a/Makefile
+++ b/Makefile
-HEADERS=oberon.h store.h reader.h domain.h alien.h typeregister.h
+HEADERS=oberon.h store.h reader.h domain.h alien.h typeregister.h textmodel.h fold.h
-odcread: odcread.o reader.o store.o util.o alien.o typeregister.o textmodel.o
+odcread: odcread.o reader.o store.o util.o alien.o typeregister.o textmodel.o fold.o
g++ -o $@ $^
%.o: %.cc $(HEADERS)
index 4be4081d8b3fd1d479b4c8fad85d7ab35be14138..5cdbbb46ec12e89c40c4d1be530c937f5505e7e8 100644 (file)
--- a/fold.cc
+++ b/fold.cc
reader.readVersion(0, 0);
}
-const std::string Fold::TYPENAME("Folds.Fold^");
+const std::string Fold::TYPENAME("StdFolds.Fold^");
const TypeProxy<Fold> Fold::PROXY;
Fold::Fold(INTEGER id) : View(id) {}
}
void Fold::internalize(Reader &reader) {
- Store::internalize(reader);
+ View::internalize(reader);
if (reader.isCancelled()) return;
reader.readVersion(0, 0);
if (reader.isCancelled()) return;
- reader.readSInt(); // FIXME IMPLEMENT
// rd.ReadXInt(xint);fold.leftSide := xint = 0;
+ reader.readSInt();
// rd.ReadXInt(xint); fold.collapsed := xint = 0;
+ reader.readSInt();
// rd.ReadXString(fold.label);
+ SHORTCHAR label[32];
+ reader.readSString(label); // the label
// rd.ReadStore(store);
+ reader.readStore(); // the hidden part
// IF store # NIL THEN fold.hidden := store(TextModels.Model); Stores.Join(fold.hidden, fold)
// ELSE fold.hidden := NIL
// END;
diff --git a/reader.cc b/reader.cc
index 587c391857cfb84416a953199cf6a0945c311c6e..21cef1dd1882ec8fcdda0033f05821e6f67a538c 100644 (file)
--- a/reader.cc
+++ b/reader.cc
return out;
}
+SHORTINT Reader::readSInt() {
+ SHORTINT buf;
+ char *bufPtr = (char*)&buf;
+ d_rider.read(bufPtr, 2);
+ if (isLittleEndian()) {
+ return buf;
+ } else {
+ SHORTINT out;
+ char *outPtr = (char *)&out;
+ outPtr[0] = bufPtr[1]; outPtr[1] = bufPtr[0];
+ return out;
+ }
+}
+
INTEGER Reader::readInt() {
INTEGER buf;
char *bufPtr = (char*)&buf;
diff --git a/reader.h b/reader.h
index 21178f304e2ba32ee0d0ff86d6a74c39c8d2a028..136fb4748cd45f9e0f5595f13e02f1e72b708339 100644 (file)
--- a/reader.h
+++ b/reader.h
* PROCEDURE (VAR rd: Reader) ReadSInt (OUT x: SHORTINT)
* NEW
* Reads a short integer (-32768..32767).
- *
+ */
+ SHORTINT readSInt();
+ /**
* PROCEDURE (VAR rd: Reader) ReadXInt (OUT x: INTEGER)
* NEW
* Same as ReadSInt, but has an INTEGER-type parameter.