1 #include <reader.h>
2 #include <alien.h>
4 #include <string>
5 #include <assert.h>
9 Reader::Reader(std::istream &rider): d_rider(rider), d_cancelled(false), d_readAlien(false), d_typeList(),
13 SHORTCHAR out;
16 }
20 }
23 CHAR buf;
29 CHAR out;
33 }
34 }
46 }
47 }
48 }
51 BYTE out;
54 }
57 INTEGER buf;
63 INTEGER out;
67 }
68 }
73 }
74 }
81 }
85 }
91 }
93 }
115 }
116 }
117 // PROCEDURE (VAR rd: Reader) ReadStore* (OUT x: Store), NEW;
118 // VAR a: Alien; t: Kernel.Type;
119 // len, pos, pos1, id, comment, next, down, downPos, nextTypeId, nextElemId, nextStoreId: INTEGER;
120 // kind: SHORTCHAR; path: TypePath; type: TypeName;
121 // save: ReaderState;
124 }
125 // IF kind = nil THEN
126 // rd.ReadInt(comment); rd.ReadInt(next);
127 // rd.st.end := rd.Pos();
128 // IF (next > 0) OR ((next = 0) & ODD(comment)) THEN rd.st.next := rd.st.end + next ELSE rd.st.next := 0 END;
129 // x := NIL
132 }
133 // ELSIF kind = link THEN
134 // rd.ReadInt(id); rd.ReadInt(comment); rd.ReadInt(next);
135 // rd.st.end := rd.Pos();
136 // IF (next > 0) OR ((next = 0) & ODD(comment)) THEN rd.st.next := rd.st.end + next ELSE rd.st.next := 0 END;
137 // x := ThisStore(rd.eDict, id)
140 }
141 // ELSIF kind = newlink THEN
142 // rd.ReadInt(id); rd.ReadInt(comment); rd.ReadInt(next);
143 // rd.st.end := rd.Pos();
144 // IF (next > 0) OR ((next = 0) & ODD(comment)) THEN rd.st.next := rd.st.end + next ELSE rd.st.next := 0 END;
145 // x := ThisStore(rd.sDict, id)
162 }
166 }
174 }
175 }
179 }
187 }
199 }
203 // rd.cause := inconsistentType; AlienTypeReport(rd.cause, type);
205 }
206 }
212 // join(d_store, x)
214 }
219 }
227 // join(d_store, alien)
229 }
234 }
242 // we've just read the alien, so reset the state
247 }
250 }
269 }
270 }
271 }
277 }
279 }
282 TypePath path;
284 SHORTCHAR *buf = new SHORTCHAR[64]; // TypeName has a maximum of length 64 (including terminator).
291 // IF path[i] # elemTName THEN INC(i) END;
293 }
305 }
309 // IF path[i] # elemTName THEN INC(i) END
311 }
314 }
316 }
323 }
325 }