]>
Commit | Line | Data |
---|---|---|
1 | extern "C++" { | |
2 | namespace std { | |
3 | class exception { | |
4 | }; | |
5 | } | |
6 | } | |
7 | typedef unsigned int size_t; | |
8 | typedef unsigned char UCHAR; | |
9 | typedef char TEXT; | |
10 | namespace Firebird { | |
11 | class status_exception : public std::exception { | |
12 | }; | |
13 | class fatal_exception : public status_exception { | |
14 | union { | |
15 | } | |
16 | __value; | |
17 | } | |
18 | _IO_cookie_io_functions_t; | |
19 | void gds__log(const TEXT*, ...); | |
20 | struct MemoryBlock { | |
21 | union { | |
22 | class MemoryPool* mbk_pool; | |
23 | }; | |
24 | }; | |
25 | class PermanentStorage { | |
26 | private: MemoryPool& pool; | |
27 | protected: explicit PermanentStorage(MemoryPool& p) : pool(p) { | |
28 | } | |
29 | }; | |
30 | class AutoStorage : public PermanentStorage { | |
31 | public: static MemoryPool& getAutoMemoryPool(); | |
32 | protected: AutoStorage() : PermanentStorage(getAutoMemoryPool()) { | |
33 | } | |
34 | }; | |
35 | class AbstractString : private AutoStorage { | |
36 | typedef const char* const_pointer; | |
37 | enum { | |
38 | INLINE_BUFFER_SIZE = 32, INIT_RESERVE = 16 }; | |
39 | public: inline const_pointer c_str() const { | |
40 | } | |
41 | }; | |
42 | class StringComparator { | |
43 | }; | |
44 | template<typename Comparator> class StringBase : public AbstractString { | |
45 | typedef StringBase<Comparator> StringType; | |
46 | inline StringType& append(const StringType& str) { | |
47 | } | |
48 | }; | |
49 | typedef StringBase<StringComparator> string; | |
50 | class ClumpletReader : protected AutoStorage { | |
51 | public: enum Kind { | |
52 | Tagged, UnTagged, SpbAttach, SpbStart, Tpb }; | |
53 | ClumpletReader(Kind k, const UCHAR* buffer, size_t buffLen); | |
54 | bool isEof() const { | |
55 | } | |
56 | void moveNext(); | |
57 | void rewind(); | |
58 | UCHAR getClumpTag() const; | |
59 | size_t getClumpLength() const; | |
60 | const UCHAR* getBytes() const; | |
61 | size_t getBufferLength() const { | |
62 | size_t rc = getBufferEnd() - getBuffer(); | |
63 | if (rc == 1 && kind != UnTagged && kind != SpbStart) { | |
64 | } | |
65 | } | |
66 | size_t getCurOffset() const { | |
67 | } | |
68 | void dump() const; | |
69 | const Kind kind; | |
70 | virtual const UCHAR* getBuffer() const { | |
71 | } | |
72 | virtual const UCHAR* getBufferEnd() const { | |
73 | } | |
74 | }; | |
75 | void ClumpletReader::dump() const { | |
76 | class ClumpletDump : public ClumpletReader { | |
77 | public: ClumpletDump(Kind k, const UCHAR* buffer, size_t buffLen) : ClumpletReader(k, buffer, buffLen) { | |
78 | } | |
79 | static string hexString(const UCHAR* b, size_t len) { | |
80 | for (; | |
81 | len > 0; | |
82 | --len, ++b) { | |
83 | } | |
84 | } | |
85 | }; | |
86 | try { | |
87 | ClumpletDump d(kind, getBuffer(), getBufferLength()); | |
88 | for (d.rewind(); | |
89 | !(d.isEof()); | |
90 | d.moveNext()) { | |
91 | gds__log("Clump %d at offset %d: %s", d.getClumpTag(), d.getCurOffset(), ClumpletDump::hexString(d.getBytes(), d.getClumpLength()).c_str()); | |
92 | } | |
93 | } | |
94 | catch(const fatal_exception& x) { | |
95 | } | |
96 | } | |
97 | } |