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 SHORTINT buf;
63 SHORTINT out;
67 }
68 }
71 INTEGER buf;
77 INTEGER out;
81 }
82 }
87 }
88 }
95 }
99 }
105 }
107 }
112 //std::cout << "NIL STORE" << std::endl;
115 //std::cout << "LINK STORE" << std::endl;
118 //std::cout << "NEWLINK STORE" << std::endl;
121 //std::cout << "STORE STORE" << std::endl;
124 //std::cout << "ELEM STORE" << std::endl;
127 //std::cout << std::hex << (unsigned int)kind << std::endl;
129 }
130 }
131 // PROCEDURE (VAR rd: Reader) ReadStore* (OUT x: Store), NEW;
132 // VAR a: Alien; t: Kernel.Type;
133 // len, pos, pos1, id, comment, next, down, downPos, nextTypeId, nextElemId, nextStoreId: INTEGER;
134 // kind: SHORTCHAR; path: TypePath; type: TypeName;
135 // save: ReaderState;
145 }
147 }
148 // IF kind = nil THEN
149 // rd.ReadInt(comment); rd.ReadInt(next);
150 // rd.st.end := rd.Pos();
151 // IF (next > 0) OR ((next = 0) & ODD(comment)) THEN rd.st.next := rd.st.end + next ELSE rd.st.next := 0 END;
152 // x := NIL
156 }
157 // ELSIF kind = link THEN
158 // rd.ReadInt(id); rd.ReadInt(comment); rd.ReadInt(next);
159 // rd.st.end := rd.Pos();
160 // IF (next > 0) OR ((next = 0) & ODD(comment)) THEN rd.st.next := rd.st.end + next ELSE rd.st.next := 0 END;
161 // x := ThisStore(rd.eDict, id)
165 }
166 // ELSIF kind = newlink THEN
167 // rd.ReadInt(id); rd.ReadInt(comment); rd.ReadInt(next);
168 // rd.st.end := rd.Pos();
169 // IF (next > 0) OR ((next = 0) & ODD(comment)) THEN rd.st.next := rd.st.end + next ELSE rd.st.next := 0 END;
170 // x := ThisStore(rd.sDict, id)
175 //std::cout << path.toString() << std::endl;
187 }
191 }
199 }
200 }
204 }
212 }
224 }
228 // rd.cause := inconsistentType; AlienTypeReport(rd.cause, type);
230 }
231 }
237 // join(d_store, x)
238 }
243 }
251 // join(d_store, alien)
252 }
257 }
265 // we've just read the alien, so reset the state
270 }
273 }
290 }
291 }
292 }
298 }
300 }
303 TypePath path;
305 SHORTCHAR *buf = new SHORTCHAR[64]; // TypeName has a maximum of length 64 (including terminator).
312 // IF path[i] # elemTName THEN INC(i) END;
314 }
326 }
330 // IF path[i] # elemTName THEN INC(i) END
332 }
335 }
337 }
344 }
346 }