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 }
98 //std::cout << "NIL STORE" << std::endl;
101 //std::cout << "LINK STORE" << std::endl;
104 //std::cout << "NEWLINK STORE" << std::endl;
107 //std::cout << "STORE STORE" << std::endl;
110 //std::cout << "ELEM STORE" << std::endl;
113 //std::cout << std::hex << (unsigned int)kind << std::endl;
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;
130 }
132 }
133 // IF kind = nil THEN
134 // 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 := NIL
140 }
141 // ELSIF kind = link 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.eDict, id)
148 }
149 // ELSIF kind = newlink THEN
150 // rd.ReadInt(id); rd.ReadInt(comment); rd.ReadInt(next);
151 // rd.st.end := rd.Pos();
152 // IF (next > 0) OR ((next = 0) & ODD(comment)) THEN rd.st.next := rd.st.end + next ELSE rd.st.next := 0 END;
153 // x := ThisStore(rd.sDict, id)
158 //std::cout << path.toString() << std::endl;
170 }
174 }
182 }
183 }
187 }
195 }
207 }
211 // rd.cause := inconsistentType; AlienTypeReport(rd.cause, type);
213 }
214 }
220 // join(d_store, x)
221 //std::cout << "Man, should have written join(.,.)" << std::endl;
222 }
227 }
235 // join(d_store, alien)
236 //std::cout << "Man, should have written join(.,.)" << std::endl;
237 }
242 }
250 // we've just read the alien, so reset the state
255 }
258 }
265 //std::cout << "Alien Piece" << std::endl;
272 //std::cout << "Alien Store" << std::endl;
277 }
278 }
279 }
285 }
287 }
290 TypePath path;
292 SHORTCHAR *buf = new SHORTCHAR[64]; // TypeName has a maximum of length 64 (including terminator).
299 // IF path[i] # elemTName THEN INC(i) END;
301 }
313 }
317 // IF path[i] # elemTName THEN INC(i) END
319 }
322 }
324 }
331 }
333 }