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