X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=reader.h;h=b4f475ca725bceff119d4f2bd790171995d4bd56;hb=9b0fce2b8ea23e4eb23485421e1d80a774c912b3;hp=764a27618138fa5d4d7f098b04510fff6151964a;hpb=32b22b42cd974e98e8a56f5ac39a51c8990ef57c;p=odcread.git diff --git a/reader.h b/reader.h index 764a276..b4f475c 100644 --- a/reader.h +++ b/reader.h @@ -25,6 +25,9 @@ struct TypeEntry { */ class Reader { private: + static const unsigned int TYPENOTFOUND = 1; + static const unsigned int ALIENVERSION = 2; + /* * rider-: Files.Reader * The file rider which links a Reader to a file. @@ -33,7 +36,7 @@ private: /* * cancelled-: BOOLEAN valid during a Store.Internalize call - * Tells whether the currently executing Internalize has been called by ReadVersion or TurnIntoAlien. + * Tells whether the currently executing Internalize has been cancelled by ReadVersion or TurnIntoAlien. */ bool d_cancelled; @@ -43,6 +46,11 @@ private: */ bool d_readAlien; + /** + * Cause of current read being alien. + */ + unsigned int d_cause; + std::vector d_typeList; std::vector d_elemList; // FIXME: WTH, why are these different? @@ -62,8 +70,6 @@ private: }; ReaderState *d_state; - INTEGER d_cause; - public: /** * Construct a reader from the istream rider. @@ -135,11 +141,14 @@ private: * PROCEDURE (VAR rd: Reader) ReadChar (OUT x: CHAR) * NEW * Reads a character (0000X..0FFFFX). - * + */ + /** * PROCEDURE (VAR rd: Reader) ReadByte (OUT x: BYTE) * NEW * Reads a very short integer (-128..127). - * + */ + BYTE readByte(); + /** * PROCEDURE (VAR rd: Reader) ReadSInt (OUT x: SHORTINT) * NEW * Reads a short integer (-32768..32767). @@ -244,7 +253,9 @@ private: * rd.cause = alienVersion * rd.cancelled * rd.readAlien - * + */ + INTEGER readVersion(INTEGER min, INTEGER max); + /* * PROCEDURE (VAR rd: Reader) TurnIntoAlien (cause: INTEGER) * NEW * A store which is currently being internalized can turn itself into an alien, e.g., if it has read a component store which is an alien. @@ -252,6 +263,9 @@ private: * Pre * 20 cause > 0 */ + void turnIntoAlien(int cause); + + bool isCancelled(); private: Store *readStoreOrElemStore(bool isElem); @@ -260,6 +274,7 @@ private: Store *readNewLinkStore(); void internalizeAlien(Alien *alien, std::streampos down, std::streampos end); + std::string &fixTypeName(std::string &name); TypePath readPath(); /** * Add another component to the current path. If first==true, start a new path.