X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=reader.h;h=e9b0234b4972c403099584334386b9d7cb137b62;hb=8987976196a50e3e9639879990c7473610ff5369;hp=208cf287a34875be20020ec159fe3fb44fb009fb;hpb=121a58d72f3b5e537007072f93397f6e6661fb90;p=odcread.git diff --git a/reader.h b/reader.h index 208cf28..e9b0234 100644 --- a/reader.h +++ b/reader.h @@ -10,12 +10,11 @@ namespace odc { -class TypeEntry { - public: - SHORTCHAR *name; +struct TypeEntry { + const std::string name; INTEGER baseId; - TypeEntry(SHORTCHAR *typeName) : name(typeName), baseId(-1) {} + TypeEntry(const std::string &typeName) : name(typeName), baseId(-1) {} }; /** @@ -136,11 +135,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). @@ -245,7 +247,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. @@ -261,26 +265,12 @@ private: Store *readNewLinkStore(); void internalizeAlien(Alien *alien, std::streampos down, std::streampos end); - /* - TypeName* = ARRAY 64 OF CHAR; - TypePath* = ARRAY 16 OF TypeName; - OpName* = ARRAY 32 OF CHAR; - */ - inline SHORTCHAR *newTypeName() { - return new SHORTCHAR[64]; - } - inline SHORTCHAR **newTypePath() { - SHORTCHAR **out = new SHORTCHAR*[16]; - for (int i = 0; i < 16; ++i) { - out[i] = newTypeName(); - } - return out; - } - void readPath(SHORTCHAR **path); + std::string &fixTypeName(std::string &name); + TypePath readPath(); /** * Add another component to the current path. If first==true, start a new path. */ - void addPathComponent(bool first, SHORTCHAR *typeName); + void addPathComponent(bool first, const std::string &typeName); }; } // namespace odc